Add DAB ANTCAP calibration and fix BT1035 boot banner timing

Extend the FM-only ANTCAP antenna-varactor override to DAB, mirroring the
existing mechanism end to end (driver, tuner, service, EEPROM storage,
HTTP API). Live sweep on real hardware found no ANTCAP value beating
auto-tune on the ensembles tested, so DAB stays on auto-tune by default.

Also fix BT1035 boot: the module's real boot banner doesn't appear until
~18-24s after RESET# releases, not the 3.5s previously waited; add a
2-attempt retry and a baud-rate probe fallback for diagnostics.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-21 08:12:08 +02:00
co-authored by Claude Sonnet 5
parent 9ad2e42fe2
commit 3a58d33aad
38 changed files with 1444 additions and 115 deletions
@@ -31,15 +31,19 @@ namespace net::ble_provisioning {
* @dname start
* @param store Secure store the received credentials are saved
* to (same store POST /api/wifi writes to).
* @param deviceIdentity Supplies the BLE advertising name (softApSsid)
* and the proof-of-possession string (serialNumber).
* @param deviceIdentity Supplies the BLE advertising name (softApSsid).
* @return Ok once provisioning is advertising, or NetError::BleProvisioningFailed.
* @pubstate Starts the onboard ESP32-S3 BLE radio (independent of the BT1035
* UART module) and a process-lifetime wifi_provisioning manager
* singleton. On a successful join, saves credentials to store and
* reboots, mirroring wifiPostHandler's POST /api/wifi behaviour.
* Runs alongside the existing SoftAP + HTTP provisioning route,
* not instead of it — either path can complete setup.
* not instead of it — either path can complete setup. Uses
* protocomm Security0 (no proof-of-possession, no encryption):
* a PoP derived from the BLE advertising name would be visible to
* anyone scanning anyway, so it added app/firmware coupling
* without adding real secrecy — same trust level as the open
* SoftAP setup path this runs alongside.
*
* @author Michele Bigi
* @date 2026-08-18
@@ -87,6 +87,8 @@ public:
* @param ota Firmware OTA service for POST /api/system/ota.
* @param webRadio Streaming config for GET/POST /api/streaming.
* @param phoneStream I2S write-through for PUT /api/stream/phone.
* @param antennaCalibration EEPROM write-through for
* POST /api/tuner/calibrate-antenna.
* @param companionChips Boot flags exposed on GET /api/health.
* @param deviceIdentity EEPROM-derived SSID, hostname, and serial.
* @return NetBootstrap on success, or a NetError.
@@ -103,6 +105,7 @@ public:
ota::OtaService& ota,
webradio::WebRadioService& webRadio,
PhoneStreamSink& phoneStream,
AntennaCalibration& antennaCalibration,
core::CompanionChipStatus companionChips,
const core::DeviceIdentity& deviceIdentity);
@@ -85,6 +85,28 @@ struct PhoneStreamSink {
std::size_t frameCount);
};
/**
* @brief AntennaCalibration — plain function pointers over EEPROM-backed
* FM and DAB ANTCAP storage, so net/ never includes eeprom24aa
* headers directly; main/ supplies it (HardwareBootstrap owns the
* I2C bus and EEPROM handle).
*
* @dname AntennaCalibration
* @return n/a (type)
* @pubstate Free functions with process lifetime; no per-instance state.
*
* @author Michele Bigi
* @date 2026-08-19
*/
struct AntennaCalibration {
/** Persist a new FM ANTCAP calibration value to EEPROM.
* @return false on an I2C failure. */
bool (*save)(std::uint8_t antCap);
/** Persist a new DAB ANTCAP calibration value to EEPROM.
* @return false on an I2C failure. */
bool (*saveDab)(std::uint8_t antCap);
};
/**
* @brief HttpRouteContext — dependencies injected into HTTP handlers.
*
@@ -106,6 +128,7 @@ struct HttpRouteContext {
ota::OtaService* ota; ///< Firmware OTA streaming.
webradio::WebRadioService* webRadio; ///< Streaming config REST routes.
PhoneStreamSink* phoneStream; ///< PUT /api/stream/phone I2S write-through.
AntennaCalibration* antennaCalibration; ///< POST /api/tuner/calibrate-antenna.
core::CompanionChipStatus companionChips; ///< Boot flags for /api/health.
core::DeviceIdentity deviceIdentity; ///< EEPROM-derived unit identity.
};
@@ -187,6 +210,8 @@ public:
* @param ota Firmware OTA service for POST /api/system/ota.
* @param webRadio Streaming config for GET/POST /api/streaming.
* @param phoneStream I2S write-through for PUT /api/stream/phone.
* @param antennaCalibration EEPROM write-through for
* POST /api/tuner/calibrate-antenna.
* @param companionChips Boot flags for GET /api/health.
* @param deviceIdentity Unit identity for /api/health serialNumber.
* @return Ok on success, or NetError::HttpServerStartFailed.
@@ -204,6 +229,7 @@ public:
ota::OtaService& ota,
webradio::WebRadioService& webRadio,
PhoneStreamSink& phoneStream,
AntennaCalibration& antennaCalibration,
core::CompanionChipStatus companionChips,
const core::DeviceIdentity& deviceIdentity);