From ae0b9d13e116c4ad7bb45cf9d8bf246c37c564e3 Mon Sep 17 00:00:00 2001 From: GlassOnTin Date: Thu, 2 Apr 2026 15:30:19 +0100 Subject: [PATCH] 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. --- Gui.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Gui.h b/Gui.h index 0f4496c..984c0e6 100644 --- a/Gui.h +++ b/Gui.h @@ -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);