Add sender queue display and batch timing

This commit is contained in:
2026-02-01 17:46:26 +01:00
parent 430b0d7054
commit 22ed41b55c
4 changed files with 38 additions and 2 deletions

View File

@@ -19,6 +19,10 @@ static uint32_t g_last_read_ts = 0;
static uint32_t g_last_tx_ts = 0;
static uint32_t g_last_read_ms = 0;
static uint32_t g_last_tx_ms = 0;
static uint8_t g_sender_queue_depth = 0;
static bool g_sender_build_pending = false;
static uint16_t g_sender_last_acked_batch_id = 0;
static uint16_t g_sender_current_batch_id = 0;
static FaultType g_last_error = FaultType::None;
static uint32_t g_last_error_ts = 0;
static uint32_t g_last_error_ms = 0;
@@ -111,6 +115,16 @@ void display_set_last_tx(bool ok, uint32_t ts_utc) {
g_last_tx_ms = millis();
}
void display_set_sender_queue(uint8_t depth, bool build_pending) {
g_sender_queue_depth = depth;
g_sender_build_pending = build_pending;
}
void display_set_sender_batches(uint16_t last_acked_batch_id, uint16_t current_batch_id) {
g_sender_last_acked_batch_id = last_acked_batch_id;
g_sender_current_batch_id = current_batch_id;
}
void display_set_last_error(FaultType type, uint32_t ts_utc, uint32_t ts_ms) {
g_last_error = type;
g_last_error_ts = ts_utc;
@@ -195,7 +209,13 @@ static void render_sender_status() {
display.printf("Read %s %lus ago", g_last_read_ok ? "OK" : "ERR", static_cast<unsigned long>(age_seconds(g_last_read_ts, g_last_read_ms)));
display.setCursor(0, 36);
display.printf("TX %s %lus ago", g_last_tx_ok ? "OK" : "ERR", static_cast<unsigned long>(age_seconds(g_last_tx_ts, g_last_tx_ms)));
display.printf("TX %s %lus Q%u%s A%u C%u",
g_last_tx_ok ? "OK" : "ERR",
static_cast<unsigned long>(age_seconds(g_last_tx_ts, g_last_tx_ms)),
g_sender_queue_depth,
g_sender_build_pending ? "+" : "",
g_sender_last_acked_batch_id,
g_sender_current_batch_id);
#ifdef ENABLE_TEST_MODE
if (strlen(g_test_code) > 0) {