Fix: don't write CONF_OK in self-provisioning (corrupts SX1262 calibration)

Self-provisioning wrote CONF_OK_BYTE without writing radio config values
(freq/bw/sf/txp). This caused eeprom_conf_load() to load 0xFFFFFFFF
into lora_freq, then startRadio() called begin(0xFFFFFFFF) which ran
calibrate_image() with an impossible frequency — no matching band,
leaving PLL/image calibration corrupted. Even when beacon_update()
later set correct params, the initial bad calibration persisted.

This was the root cause of the recurring LoRa RX decode failure
after any flash erase + re-provision cycle.
This commit is contained in:
GlassOnTin 2026-04-07 19:34:43 +01:00
commit fd8a0be97e

View file

@ -172,7 +172,9 @@ void setup() {
EEPROM.write(eeprom_addr(ADDR_MADE+2), 0x00);
EEPROM.write(eeprom_addr(ADDR_MADE+3), 0x00);
EEPROM.write(eeprom_addr(ADDR_INFO_LOCK), INFO_LOCK_BYTE);
EEPROM.write(eeprom_addr(ADDR_CONF_OK), CONF_OK_BYTE);
// Do NOT write CONF_OK_BYTE — radio config (freq/bw/sf) is not set.
// If CONF_OK is set, eeprom_conf_load() loads 0xFFFFFFFF into lora_freq
// and startRadio() calls begin(0xFFFFFFFF) which corrupts SX1262 calibration.
// Compute and write EEPROM checksum (MD5 of first CHECKSUMMED_SIZE bytes)
char chk_data[CHECKSUMMED_SIZE];
for (uint8_t i = 0; i < CHECKSUMMED_SIZE; i++)