Add sender queue display and batch timing
This commit is contained in:
@@ -76,6 +76,7 @@ static uint8_t g_last_battery_percent = 0;
|
||||
static uint32_t g_last_battery_ms = 0;
|
||||
static uint16_t g_batch_id = 1;
|
||||
static uint16_t g_last_sent_batch_id = 0;
|
||||
static uint16_t g_last_acked_batch_id = 0;
|
||||
static uint8_t g_batch_retry_count = 0;
|
||||
static bool g_batch_ack_pending = false;
|
||||
static MeterData g_inflight_samples[METER_BATCH_MAX_SAMPLES];
|
||||
@@ -542,6 +543,8 @@ void setup() {
|
||||
static void sender_loop() {
|
||||
watchdog_kick();
|
||||
uint32_t now_ms = millis();
|
||||
display_set_sender_queue(g_batch_count, g_build_count > 0);
|
||||
display_set_sender_batches(g_last_acked_batch_id, g_batch_id);
|
||||
|
||||
if (now_ms - g_last_sample_ms >= METER_SAMPLE_INTERVAL_MS) {
|
||||
g_last_sample_ms = now_ms;
|
||||
@@ -589,6 +592,7 @@ static void sender_loop() {
|
||||
uint16_t ack_receiver = read_u16_le(&rx.payload[4]);
|
||||
if (ack_sender == g_short_id && ack_receiver == rx.device_id_short &&
|
||||
g_batch_ack_pending && ack_id == g_last_sent_batch_id) {
|
||||
g_last_acked_batch_id = ack_id;
|
||||
finish_inflight_batch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user