Fix LoRa toggle: set beacon defaults when no radio config loaded

startRadio() requires lora_freq/bw/sf/txp to be set (radio_locked
check). After EEPROM erase, these are zero. The tap handler now
sets beacon defaults (868MHz SF7 BW125K 17dBm) before starting.
This commit is contained in:
GlassOnTin 2026-04-02 15:30:19 +01:00
commit ae0b9d13e1

9
Gui.h
View file

@ -368,7 +368,14 @@ static void gui_create_watchface(lv_obj_t *parent) {
lv_obj_add_flag(cell, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(cell, [](lv_event_t *e) {
if (radio_online) { stopRadio(); }
else { startRadio(); }
else {
// Set beacon defaults if no config loaded
if (lora_freq == 0) {
lora_freq = 868000000; lora_bw = 125000;
lora_sf = 7; lora_cr = 5; lora_txp = 17;
}
startRadio();
}
}, LV_EVENT_CLICKED, NULL);
gui_lora_value = gui_label(cell, &font_mid, GUI_COL_AMBER, "--");
lv_obj_set_width(gui_lora_value, cw);