From 6dce3977d7466387cadff5b8f3172c8b34d94bd3 Mon Sep 17 00:00:00 2001 From: Ashin Walpola Date: Wed, 28 Oct 2026 16:49:08 +0100 Subject: [PATCH] Log the TX power the old C firmware gets, and retitle the beacon notes main.c (the pre-port firmware, kept on disk but no longer compiled) reads back and logs the TX power the driver actually set instead of trusting the request. obu-cam-transmistter/NOTES.md drops its stale "Phase 2, in progress" title. --- obu-cam-transmistter/NOTES.md | 2 +- obu-firmware/main/main.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/obu-cam-transmistter/NOTES.md b/obu-cam-transmistter/NOTES.md index c14ae31..25c4119 100644 --- a/obu-cam-transmistter/NOTES.md +++ b/obu-cam-transmistter/NOTES.md @@ -1,4 +1,4 @@ -# OBU transmit firmware - Phase 2 (in progress: HLN-SV DENM beacon) +# OBU transmit firmware Build and flash steps are under "Build and flash" below. (`docs/04-transmit-setup.md`, referenced here and in the sources, is not in the repo.) diff --git a/obu-firmware/main/main.c b/obu-firmware/main/main.c index 35d5bcb..e74f667 100644 --- a/obu-firmware/main/main.c +++ b/obu-firmware/main/main.c @@ -360,8 +360,22 @@ void app_main(void) ESP_LOGW(TAG, "esp_wifi_set_country(MANUAL) failed: %d (continuing)", ctry_err); } // Ensure the PA runs at full configured power (not a reduced regulatory - // default). Units are 0.25 dBm; 80 = 20 dBm. - esp_wifi_set_max_tx_power(80); + // default). Units are 0.25 dBm; 80 = 20 dBm, which is also the build's own + // ceiling (CONFIG_ESP_PHY_MAX_TX_POWER=20). + // + // Read back and logged, because the request is a ceiling and not a promise: the driver clamps + // it to its own calibrated power table, and our 5900 MHz is above the frequency range this + // chip is rated for (see docs/04-transmit-setup.md), so the table in use there is the one for + // channel 177. What the request alone tells you about radiated power is therefore nothing; + // this at least records what the driver admits to. + esp_err_t pw_err = esp_wifi_set_max_tx_power(80); + int8_t tx_power_q = 0; + if (pw_err != ESP_OK || esp_wifi_get_max_tx_power(&tx_power_q) != ESP_OK) { + ESP_LOGW(TAG, "tx power: set/read back failed (set returned %d), level unknown", pw_err); + } else { + ESP_LOGI(TAG, "tx power: %d quarter-dBm = %d.%02d dBm (20.00 requested)", + tx_power_q, tx_power_q / 4, (tx_power_q % 4) * 25); + } // ------------------------------------------------------------------------- // Force the dual-band C5 onto its 5 GHz PHY. This MUST be called after