Skip to content

Commit

Permalink
saveMode -> safeMode
Browse files Browse the repository at this point in the history
🤭
  • Loading branch information
ewowi committed Dec 10, 2024
1 parent 0a1418c commit 5c78c3f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion misc/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@
"fun": 41
},
{
"id": "saveMode",
"id": "safeMode",
"type": "checkbox",
"pid": "System",
"ro": false,
Expand Down
10 changes: 7 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ build_flags =
-D PIOENV=$PIOENV
-D VERSION=24112412 ; Date and time (GMT!), update at every commit!!
-D LFS_THREADSAFE ; enables use of semaphores in LittleFS driver
-D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board
-D STARBASE_DEVMODE
-mtext-section-literals ;otherwise [UserModLive::setup()]+0xa17): dangerous relocation: l32r: literal target out of range (try using text-section-literals)
;for StarLight, first only for s2, now for all due to something in UserModLive.Setup...
Expand Down Expand Up @@ -214,6 +213,7 @@ build_flags =
${env.build_flags}
-D CONFIG_IDF_TARGET_ESP32=1
-D ARDUINO_USB_CDC_ON_BOOT=0 ; Make sure that the right HardwareSerial driver is picked in arduino-esp32 (needed on "classic ESP32")
-D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board
${STARLIGHT_CLOCKLESS_LED_DRIVER.build_flags}
lib_deps =
${env.lib_deps}
Expand All @@ -229,6 +229,7 @@ build_flags =
${env.build_flags}
-D CONFIG_IDF_TARGET_ESP32=1
-D ARDUINO_USB_CDC_ON_BOOT=0 ; Make sure that the right HardwareSerial driver is picked in arduino-esp32 (needed on "classic ESP32")
-D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board
-D STARLIGHT_MAXLEDS=12288 ;LEDs specific
${STARLIGHT_CLOCKLESS_VIRTUAL_LED_DRIVER.build_flags}
-D STARLIGHT_LIVE_MAPPING
Expand All @@ -251,6 +252,7 @@ build_flags =
-D ARDUINO_USB_CDC_ON_BOOT=0 ; Make sure that the right HardwareSerial driver is picked in arduino-esp32 (needed on "classic ESP32")
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board, check
; ${STARLIGHT_CLOCKLESS_LED_DRIVER.build_flags}
-D STARLIGHT_MAXLEDS=12288 ;LEDs specific
; -D STARLIGHT_LIVE_MAPPING
Expand All @@ -269,7 +271,7 @@ build_flags =
${env.build_flags}
-D CONFIG_IDF_TARGET_ESP32=1
-D ARDUINO_USB_CDC_ON_BOOT=0 ; Make sure that the right HardwareSerial driver is picked in arduino-esp32 (needed on "classic ESP32")
-D STARBASE_BOOT_BUTTON_PIN=0 ;check
-D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board, check
lib_deps =
${env.lib_deps}

Expand All @@ -284,6 +286,7 @@ build_flags =
; -DARDUINO_ARCH_ESP32 ; no proof of necessity yet...
-D CONFIG_IDF_TARGET_ESP32=1
-D ARDUINO_USB_CDC_ON_BOOT=0 ; Make sure that the right HardwareSerial driver is picked in arduino-esp32 (needed on "classic ESP32")
-D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board, check
lib_deps =
${env.lib_deps}

Expand Down Expand Up @@ -326,6 +329,7 @@ build_flags =
-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_DFU_ON_BOOT=0 -D ARDUINO_USB_MSC_ON_BOOT=0 ; for debugging over USB
; -D DEBUG=1 -D CORE_DEBUG_LEVEL=1 -D ARDUINOJSON_DEBUG=1 ; for more debug output
; -DSTARBASE_LOLIN_WIFI_FIX ; I don't trust the tiny ceramic antenna - use workaround for LOLIN C3/S2/S3 wifi instability. https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi
; -D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board, check
lib_deps =
${env.lib_deps}

Expand Down Expand Up @@ -371,7 +375,7 @@ build_flags =
${env.build_flags}
-D CONFIG_IDF_TARGET_ESP32S3=1
-D STARBASE_LOLIN_WIFI_FIX ; shouldn't be necessary, but otherwise WiFi issues on my board
-D STARBASE_BOOT_BUTTON_PIN=48 ;check
-D STARBASE_BOOT_BUTTON_PIN=0 ; boot pin on the esp32 board, check 48?
-D STARLIGHT_MAXLEDS=16384 ;LEDs specific
${STARLIGHT_CLOCKLESS_VIRTUAL_LED_DRIVER.build_flags}
lib_deps =
Expand Down
2 changes: 1 addition & 1 deletion src/App/LedModEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ inline uint16_t getRGBWsize(uint16_t nleds){
case onChange:


if (sys->saveMode) return true; //do not process effect in saveMode do this if the effect crashes at boot, then change effect to working effect and reboot
if (sys->safeMode) return true; //do not process effect in safeMode do this if the effect crashes at boot, then change effect to working effect and reboot

print->printJson("layers.effect.onChange", variable.var);

Expand Down
2 changes: 1 addition & 1 deletion src/App/LedModFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
return true; }
case onChange: {

if (sys->saveMode) return true; //do not process fixture in saveMode do this if the fixture crashes at boot, then change fixture to working fixture and reboot
if (sys->safeMode) return true; //do not process fixture in safeMode do this if the fixture crashes at boot, then change fixture to working fixture and reboot

doAllocPins = true;
if (web->ws.getClients().length())
Expand Down
2 changes: 1 addition & 1 deletion src/Sys/SysModPrint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void SysModPrint::printf(const char * format, ...) {
toSerial = true;

if (toSerial) {
if (sys && sys->saveMode) Serial.print("🚑"); //print declared before sys
if (sys && sys->safeMode) Serial.print("🚑"); //print declared before sys
Serial.print(strncmp(pcTaskGetTaskName(nullptr), "loopTask", 8) == 0?"":"α"); //looptask λ/ asyncTCP task α
Serial.print(buffer);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sys/SysModSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void SysModSystem::setup() {
default: return false;
}});

ui->initCheckBox(parentVar, "saveMode", &saveMode);
ui->initCheckBox(parentVar, "safeMode", &safeMode);

//calculate version in format YYMMDDHH
//https://forum.arduino.cc/t/can-you-format-__date__/200818/10
Expand Down
2 changes: 1 addition & 1 deletion src/Sys/SysModSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SysModSystem:public SysModule {
public:
char build[64] = "";
char chipInfo[64] = "";
bool3State saveMode = false;
bool3State safeMode = false;

Toki toki = Toki(); //Minimal millisecond accurate timekeeping.
uint32_t
Expand Down
12 changes: 6 additions & 6 deletions src/SysModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ void SysModules::setup() {
#ifdef STARBASE_BOOT_BUTTON_PIN
pinsM->allocatePin(STARBASE_BOOT_BUTTON_PIN, "Buttons", "Boot");

sys->saveMode = digitalRead(STARBASE_BOOT_BUTTON_PIN) == 0;
mdl->setValue("System", "saveMode", sys->saveMode);
sys->safeMode = digitalRead(STARBASE_BOOT_BUTTON_PIN) == 0;
mdl->setValue("System", "safeMode", sys->safeMode);

#endif

Expand Down Expand Up @@ -155,11 +155,11 @@ void SysModules::loop() {

if (buttonPressedTime && (sys->now - buttonPressedTime) > 600) {
//longpress
// ppf("longpress boot -> saveMode on\n");
// ppf("longpress boot -> safeMode on\n");
buttonPressedTime = 0;
sys->saveMode = !sys->saveMode;
ppf("longpress saveMode %s\n", sys->saveMode?"on":"off");
mdl->setValue("System", "saveMode", sys->saveMode);
sys->safeMode = !sys->safeMode;
ppf("longpress safeMode %s\n", sys->safeMode?"on":"off");
mdl->setValue("System", "safeMode", sys->safeMode);
}
#endif

Expand Down

0 comments on commit 5c78c3f

Please sign in to comment.