firmware: debug/test build profiles with real behavioural differences
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
menu "wM-Bus repeater"
|
||||
|
||||
config WMBUS_VERBOSE_DEFAULT
|
||||
bool "Verbose diagnostics enabled at boot"
|
||||
default n
|
||||
help
|
||||
Emit dropped-frame reasons, suppressed duplicates, rx_ready timing
|
||||
and unexpected-IRQ events by default. Can always be toggled at
|
||||
runtime with "set verbose 0|1".
|
||||
|
||||
config WMBUS_TX_DIAG_ALWAYS
|
||||
bool "Always emit tx_diag after every transmission"
|
||||
default n
|
||||
help
|
||||
Logs polled IRQ state, DIO1 level, chip mode and device errors for
|
||||
every TX. Useful when bringing up a new board revision; adds one
|
||||
serial line per repeat, which perturbs timing measurements.
|
||||
|
||||
config WMBUS_LOG_RAW_FRAMES
|
||||
bool "Include raw frame hex in wmbus_rx / wmbus_tx events"
|
||||
default y
|
||||
help
|
||||
Required by the HIL correlator to compare bytes against the SDR.
|
||||
Disable only for a quiet production-style build; doing so makes
|
||||
hil/correlate.py unable to match frames.
|
||||
|
||||
endmenu
|
||||
@@ -22,7 +22,11 @@ repeater_cfg_t g_cfg = {
|
||||
.repeat_delay_ms = 50,
|
||||
.tx_power_dbm = -9,
|
||||
.repeat_enabled = true,
|
||||
#ifdef CONFIG_WMBUS_VERBOSE_DEFAULT
|
||||
.verbose = true,
|
||||
#else
|
||||
.verbose = false,
|
||||
#endif
|
||||
.whitelist = {0},
|
||||
.whitelist_len = 0,
|
||||
};
|
||||
@@ -219,10 +223,18 @@ static const char *do_tx(const uint8_t *payload, int payload_len,
|
||||
*tx_done_us = notify_seen ? s_irq_ts : esp_timer_get_time();
|
||||
fem_set_tx(false);
|
||||
sx126x_clear_irq(SX126X_IRQ_ALL);
|
||||
LOGJ("\"event\":\"tx_diag\",\"irq\":%u,\"notify\":%s,\"dio1_high_seen\":%s,"
|
||||
"\"max_chip_mode\":%u,\"device_errors\":%u",
|
||||
irq, notify_seen ? "true" : "false", dio1_seen ? "true" : "false",
|
||||
max_mode, sx126x_get_device_errors());
|
||||
#ifdef CONFIG_WMBUS_TX_DIAG_ALWAYS
|
||||
const bool want_diag = true;
|
||||
#else
|
||||
// otherwise only when something went wrong, so timing stays clean
|
||||
const bool want_diag = g_cfg.verbose || !(irq & SX126X_IRQ_TX_DONE);
|
||||
#endif
|
||||
if (want_diag) {
|
||||
LOGJ("\"event\":\"tx_diag\",\"irq\":%u,\"notify\":%s,"
|
||||
"\"dio1_high_seen\":%s,\"max_chip_mode\":%u,\"device_errors\":%u",
|
||||
irq, notify_seen ? "true" : "false", dio1_seen ? "true" : "false",
|
||||
max_mode, sx126x_get_device_errors());
|
||||
}
|
||||
if (irq & SX126X_IRQ_TX_DONE) {
|
||||
g_stats.tx_success++;
|
||||
return notify_seen ? "ok" : "ok_polled";
|
||||
@@ -247,11 +259,15 @@ static void log_tx(const char *result, uint32_t hash, int len,
|
||||
(long long)(tx_start - rx_ts), len, hash,
|
||||
(int)g_cfg.tx_power_dbm,
|
||||
(long long)(tx_done > tx_start ? tx_done - tx_start : 0), result);
|
||||
#ifdef CONFIG_WMBUS_LOG_RAW_FRAMES
|
||||
if (payload && payload_len > 0) {
|
||||
printf(",\"tx_payload\":\"");
|
||||
print_hex(payload, payload_len);
|
||||
printf("\"");
|
||||
}
|
||||
#else
|
||||
(void)payload; (void)payload_len;
|
||||
#endif
|
||||
printf("}\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
@@ -421,12 +437,16 @@ static void handle_rx(int64_t rxdone_ts)
|
||||
printf("{\"seq\":%" PRIu32 ",\"event\":\"wmbus_rx\",\"timestamp_us\":%lld,"
|
||||
"\"rxdone_us\":%lld,\"frequency_hz\":868950000,\"format\":\"%c\","
|
||||
"\"length\":%d,\"rssi_dbm\":%d,\"crc_ok\":%s,"
|
||||
"\"hash\":\"%08" PRIx32 "\",\"raw\":\"",
|
||||
"\"hash\":\"%08" PRIx32 "\"",
|
||||
s_seq++, (long long)frame_end_ts, (long long)rxdone_ts,
|
||||
fmt == WMBUS_FRAME_A ? 'A' : 'B', total, rssi,
|
||||
crc_ok ? "true" : "false", hash);
|
||||
#ifdef CONFIG_WMBUS_LOG_RAW_FRAMES
|
||||
printf(",\"raw\":\"");
|
||||
print_hex(frame, total);
|
||||
printf("\"}\n");
|
||||
printf("\"");
|
||||
#endif
|
||||
printf("}\n");
|
||||
fflush(stdout);
|
||||
|
||||
if (!g_cfg.repeat_enabled || !crc_ok) return;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Debug profile: verbose diagnostics, assertions, per-TX register dumps.
|
||||
# Extra serial traffic perturbs timing -- do not use for timing measurements.
|
||||
CONFIG_WMBUS_VERBOSE_DEFAULT=y
|
||||
CONFIG_WMBUS_TX_DIAG_ALWAYS=y
|
||||
CONFIG_WMBUS_LOG_RAW_FRAMES=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_DEBUG=y
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
|
||||
CONFIG_ESP_TASK_WDT_TIMEOUT_S=30
|
||||
@@ -0,0 +1,7 @@
|
||||
# Release/test profile: the configuration all HIL measurements are taken
|
||||
# with. Structured JSON only, no per-TX register dumps, size-optimised.
|
||||
CONFIG_WMBUS_VERBOSE_DEFAULT=n
|
||||
CONFIG_WMBUS_TX_DIAG_ALWAYS=n
|
||||
CONFIG_WMBUS_LOG_RAW_FRAMES=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL_WARN=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||
Reference in New Issue
Block a user