1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 16:16:13 +01:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Arsenii Kuzin
27ac1e99dc
Merge c8e3488bee into 3b162996ad 2024-02-07 00:07:54 +01:00
Sen Morgan
c8e3488bee feat: OTA update display messages 2024-02-07 00:07:42 +01:00
Sen Morgan
c0becf9f78 feat: emergency stop and power off during OTA 2024-02-07 00:06:56 +01:00

View File

@ -163,6 +163,32 @@ void loop()
// Initialise OTA if not already done // Initialise OTA if not already done
if (!otaInitialised) { if (!otaInitialised) {
ArduinoOTA.setHostname(WIFI_HOSTNAME); ArduinoOTA.setHostname(WIFI_HOSTNAME);
// Prevent locos from moving during OTA
ArduinoOTA.onStart([]() {
// Emergency stop all locos
DCC::setThrottle(0,1,1);
// Disable tracks power
TrackManager::setMainPower(POWERMODE::OFF);
TrackManager::setProgPower(POWERMODE::OFF);
// Broadcast power status
CommandDistributor::broadcastPower();
DISPLAY_START (
LCD(0,F("OTA update"));
LCD(1,F("In progress..."));
);
});
ArduinoOTA.onEnd([]() {
DISPLAY_START (
LCD(0,F("OTA update"));
LCD(1,F("Complete"));
);
});
ArduinoOTA.onError([](ota_error_t error) {
DISPLAY_START (
LCD(0,F("OTA update"));
LCD(1,F("Error: %d"), error);
);
});
// Set OTA password if defined // Set OTA password if defined
#ifdef OTA_AUTH #ifdef OTA_AUTH
ArduinoOTA.setPassword(OTA_AUTH); ArduinoOTA.setPassword(OTA_AUTH);