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.pull/129/head
parent
00c4997b69
commit
ae0b9d13e1
9
Gui.h
9
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_flag(cell, LV_OBJ_FLAG_CLICKABLE);
|
||||||
lv_obj_add_event_cb(cell, [](lv_event_t *e) {
|
lv_obj_add_event_cb(cell, [](lv_event_t *e) {
|
||||||
if (radio_online) { stopRadio(); }
|
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);
|
}, LV_EVENT_CLICKED, NULL);
|
||||||
gui_lora_value = gui_label(cell, &font_mid, GUI_COL_AMBER, "--");
|
gui_lora_value = gui_label(cell, &font_mid, GUI_COL_AMBER, "--");
|
||||||
lv_obj_set_width(gui_lora_value, cw);
|
lv_obj_set_width(gui_lora_value, cw);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue