Phase accel ESP-NOW TX into 1 ms slots from Discover sync.

Master broadcasts master_time_us; slaves schedule sends at
offset_ms=(assigned_id-1)%8 so concurrent streams collide less.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-01 22:35:47 +01:00
co-authored by Cursor
parent 1adaddd6c8
commit c3b20887bf
6 changed files with 122 additions and 19 deletions
+10 -4
View File
@@ -74,6 +74,10 @@ typedef struct _alox_EspNowDiscover {
uint32_t network;
/* * Master is in an OTA session (UART upload or ESP-NOW distribution). */
bool master_ota_pending;
/* *
Master esp_timer_get_time() (µs) at broadcast. Slaves use this to phase
accel TX into 1 ms slots: offset_ms = (assigned_id - 1) % 8. */
uint64_t master_time_us;
} alox_EspNowDiscover;
typedef struct _alox_EspNowSlavePresence {
@@ -277,7 +281,7 @@ extern "C" {
#define alox_EspNowEchoPong_init_default {0, 0}
#define alox_EspNowFindMe_init_default {0}
#define alox_EspNowRestart_init_default {0}
#define alox_EspNowDiscover_init_default {0, 0}
#define alox_EspNowDiscover_init_default {0, 0, 0}
#define alox_EspNowSlavePresence_init_default {0, {{NULL}, NULL}, 0, 0, 0, 0}
#define alox_EspNowAssignId_init_default {0}
#define alox_EspNowClearIdBinding_init_default {0}
@@ -301,7 +305,7 @@ extern "C" {
#define alox_EspNowEchoPong_init_zero {0, 0}
#define alox_EspNowFindMe_init_zero {0}
#define alox_EspNowRestart_init_zero {0}
#define alox_EspNowDiscover_init_zero {0, 0}
#define alox_EspNowDiscover_init_zero {0, 0, 0}
#define alox_EspNowSlavePresence_init_zero {0, {{NULL}, NULL}, 0, 0, 0, 0}
#define alox_EspNowAssignId_init_zero {0}
#define alox_EspNowClearIdBinding_init_zero {0}
@@ -331,6 +335,7 @@ extern "C" {
#define alox_EspNowRestart_client_id_tag 1
#define alox_EspNowDiscover_network_tag 1
#define alox_EspNowDiscover_master_ota_pending_tag 2
#define alox_EspNowDiscover_master_time_us_tag 3
#define alox_EspNowSlavePresence_network_tag 1
#define alox_EspNowSlavePresence_mac_tag 2
#define alox_EspNowSlavePresence_version_tag 3
@@ -442,7 +447,8 @@ X(a, STATIC, SINGULAR, UINT32, client_id, 1)
#define alox_EspNowDiscover_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, network, 1) \
X(a, STATIC, SINGULAR, BOOL, master_ota_pending, 2)
X(a, STATIC, SINGULAR, BOOL, master_ota_pending, 2) \
X(a, STATIC, SINGULAR, UINT64, master_time_us, 3)
#define alox_EspNowDiscover_CALLBACK NULL
#define alox_EspNowDiscover_DEFAULT NULL
@@ -686,7 +692,7 @@ extern const pb_msgdesc_t alox_EspNowMessage_msg;
#define alox_EspNowBatteryQuery_size 6
#define alox_EspNowBatteryReport_size 22
#define alox_EspNowClearIdBinding_size 0
#define alox_EspNowDiscover_size 8
#define alox_EspNowDiscover_size 19
#define alox_EspNowEchoPing_size 22
#define alox_EspNowEchoPong_size 22
#define alox_EspNowFindMe_size 6