Skip to content

Commit 8b05a72

Browse files
committed
menu actions reboot
1 parent d86f7ff commit 8b05a72

2 files changed

Lines changed: 22 additions & 11 deletions

File tree

src/graphics/draw/MenuHandler.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,15 +1903,14 @@ void menuHandler::GPSSmartPositionMenu()
19031903
menuQueue = PositionBaseMenu;
19041904
screen->runNow();
19051905
} else if (selected == 1) {
1906+
// Read live by PositionModule's smart-broadcast path every send - no reboot needed.
19061907
config.position.position_broadcast_smart_enabled = true;
19071908
saveUIConfig();
19081909
service->reloadConfig(SEGMENT_CONFIG, /*radioAffected=*/false); // position field, not LoRa
1909-
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
19101910
} else if (selected == 2) {
19111911
config.position.position_broadcast_smart_enabled = false;
19121912
saveUIConfig();
19131913
service->reloadConfig(SEGMENT_CONFIG, /*radioAffected=*/false); // position field, not LoRa
1914-
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
19151914
}
19161915
};
19171916
bannerOptions.InitialSelected = config.position.position_broadcast_smart_enabled ? 1 : 2;
@@ -2055,8 +2054,8 @@ void menuHandler::GPSPositionBroadcastMenu()
20552054

20562055
if (selected != 0) {
20572056
saveUIConfig();
2057+
// Read live by PositionModule's broadcast scheduler every cycle - no reboot needed.
20582058
service->reloadConfig(SEGMENT_CONFIG, /*radioAffected=*/false); // position field, not LoRa
2059-
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
20602059
}
20612060
};
20622061

src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "Power.h"
1111
#include "Router.h"
1212
#include "airtime.h"
13+
#include "buzz.h"
1314
#include "gps/RTC.h"
1415
#include "graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h"
1516
#include "graphics/niche/Utils/FlashData.h"
@@ -343,9 +344,8 @@ static void applyLoRaRegion(meshtastic_Config_LoRaConfig_RegionCode region)
343344
}
344345
// Notify UI that changes are being applied
345346
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
347+
// LoRa config applies live via configChanged observer -> RadioInterface::reconfigure(); no reboot needed.
346348
service->reloadConfig(changes, /*radioAffected=*/true); // region change is a LoRa radio parameter
347-
348-
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
349349
}
350350

351351
static void applyDeviceRole(meshtastic_Config_DeviceConfig_Role role)
@@ -374,12 +374,11 @@ static void applyLoRaPreset(meshtastic_Config_LoRaConfig_ModemPreset preset)
374374
config.lora.modem_preset = preset;
375375

376376
nodeDB->saveToDisk(SEGMENT_CONFIG);
377+
// LoRa config applies live via configChanged observer -> RadioInterface::reconfigure(); no reboot needed.
377378
service->reloadConfig(SEGMENT_CONFIG, /*radioAffected=*/true); // modem preset is a LoRa radio parameter
378379

379380
// Notify UI that changes are being applied
380381
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
381-
382-
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
383382
}
384383

385384
// Used for non-LoRa config fields only - LoRa region/preset go through the dedicated
@@ -610,28 +609,39 @@ void InkHUD::MenuApplet::execute(MenuItem item)
610609
#if !MESHTASTIC_EXCLUDE_GPS && HAS_GPS
611610
if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_DISABLED) {
612611
config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_ENABLED;
612+
if (gps != nullptr) {
613+
playGPSEnableBeep();
614+
gps->enable();
615+
}
613616
} else if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
614617
config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_DISABLED;
618+
if (gps != nullptr) {
619+
playGPSDisableBeep();
620+
gps->disable();
621+
}
615622
} else {
616623
// NOT_PRESENT do nothing
617624
break;
618625
}
619626
nodeDB->saveToDisk(SEGMENT_CONFIG);
627+
// GPS driver is toggled live above (matches MenuHandler.cpp's equivalent) - no reboot needed.
620628
service->reloadConfig(SEGMENT_CONFIG, /*radioAffected=*/false); // GPS mode, not LoRa
621629
#endif
622630
break;
623631

624632
case TOGGLE_SMART_POSITION:
633+
// Read live by PositionModule's smart-broadcast path every send - no reboot needed.
625634
config.position.position_broadcast_smart_enabled = !config.position.position_broadcast_smart_enabled;
626-
applyConfigReload(SEGMENT_CONFIG, true);
635+
applyConfigReload(SEGMENT_CONFIG);
627636
break;
628637

629638
case SET_POSITION_BROADCAST_INTERVAL: {
630639
const uint8_t index = cursor - 1;
631640
constexpr uint8_t optionCount = sizeof(POSITION_BROADCAST_OPTIONS) / sizeof(POSITION_BROADCAST_OPTIONS[0]);
632641
if (index < optionCount && config.position.position_broadcast_secs != POSITION_BROADCAST_OPTIONS[index].value) {
642+
// Read live by PositionModule's broadcast scheduler every cycle - no reboot needed.
633643
config.position.position_broadcast_secs = POSITION_BROADCAST_OPTIONS[index].value;
634-
applyConfigReload(SEGMENT_CONFIG, true);
644+
applyConfigReload(SEGMENT_CONFIG);
635645
}
636646
break;
637647
}
@@ -640,8 +650,9 @@ void InkHUD::MenuApplet::execute(MenuItem item)
640650
const uint8_t index = cursor - 1;
641651
constexpr uint8_t optionCount = sizeof(SMART_INTERVAL_OPTIONS) / sizeof(SMART_INTERVAL_OPTIONS[0]);
642652
if (index < optionCount && config.position.broadcast_smart_minimum_interval_secs != SMART_INTERVAL_OPTIONS[index].value) {
653+
// Read live by PositionModule::minimumTimeThreshold every send - no reboot needed.
643654
config.position.broadcast_smart_minimum_interval_secs = SMART_INTERVAL_OPTIONS[index].value;
644-
applyConfigReload(SEGMENT_CONFIG, true);
655+
applyConfigReload(SEGMENT_CONFIG);
645656
}
646657
break;
647658
}
@@ -650,8 +661,9 @@ void InkHUD::MenuApplet::execute(MenuItem item)
650661
const uint8_t index = cursor - 1;
651662
constexpr uint8_t optionCount = sizeof(SMART_DISTANCE_OPTIONS) / sizeof(SMART_DISTANCE_OPTIONS[0]);
652663
if (index < optionCount && config.position.broadcast_smart_minimum_distance != SMART_DISTANCE_OPTIONS[index]) {
664+
// Read live by PositionModule's smart-position distance check every send - no reboot needed.
653665
config.position.broadcast_smart_minimum_distance = SMART_DISTANCE_OPTIONS[index];
654-
applyConfigReload(SEGMENT_CONFIG, true);
666+
applyConfigReload(SEGMENT_CONFIG);
655667
}
656668
break;
657669
}

0 commit comments

Comments
 (0)