Skip to content

Commit

Permalink
dev_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorcelli committed Nov 27, 2024
1 parent 9591692 commit 69cf0bd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
14 changes: 14 additions & 0 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ void initDisplay(bool doAll) {
delay(50);

}
/***************************************************************************************
** Function name: initDisplayLoop
** Description: Start Display functions and display bootscreen
***************************************************************************************/
void initDisplayLoop() {
tft.fillScreen(BGCOLOR);
initDisplay(true);
delay(250);
while(!checkAnyKeyPress()){
initDisplay();
delay(50);
}
returnToMenu=true;
}

/***************************************************************************************
** Function name: displayCurrentItem
Expand Down
1 change: 1 addition & 0 deletions src/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void loopOptions(const std::vector<std::pair<std::string, std::function<void()>>
void loopVersions();
void loopFirmware();
void initDisplay(bool doAll = false); // Início da função e mostra bootscreen
void initDisplayLoop();

//Funções para economizar linhas nas outras funções
void resetTftDisplay(int x = 0, int y = 0, uint16_t fc = FGCOLOR, int size = FONT_M, uint16_t bg = BGCOLOR, uint16_t screen = BGCOLOR);
Expand Down
1 change: 1 addition & 0 deletions src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ extern uint32_t MAX_FAT_sys;
extern unsigned long previousMillis;
extern bool isSleeping;
extern bool isScreenOff;
extern bool dev_mode;

extern int dimmerSet;
extern int bright;
Expand Down
9 changes: 6 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int dimmerSet=20;
unsigned long previousMillis;
bool isSleeping;
bool isScreenOff;
bool dev_mode=false;
int bright=100;
bool dimmer=false;
int prog_handler; // 0 - Flash, 1 - SPIFFS
Expand Down Expand Up @@ -457,12 +458,14 @@ void loop() {
#endif

if(MAX_SPIFFS>0) options.push_back({"Save SPIFFS", [=]() { dumpPartition("spiffs", "/bkp/spiffs.bin"); }});
//if(MAX_FAT_sys>0) options.push_back({"Bkp FAT sys", [=]() { dumpPartition("sys", "/bkp/FAT_sys.bin"); }}); //Test only
if(MAX_FAT_vfs>0) options.push_back({"Save FAT vfs", [=]() { dumpPartition("vfs", "/bkp/FAT_vfs.bin"); }});
if(MAX_FAT_sys>0 && dev_mode) options.push_back({"Bkp FAT sys", [=]() { dumpPartition("sys", "/bkp/FAT_sys.bin"); }}); //Test only
if(MAX_FAT_vfs>0) options.push_back({"Bkp FAT vfs", [=]() { dumpPartition("vfs", "/bkp/FAT_vfs.bin"); }});
if(MAX_SPIFFS>0) options.push_back({ "Rest SPIFFS", [=]() { restorePartition("spiffs"); }});
//if(MAX_FAT_sys>0) options.push_back({"Rest FAT Sys", [=]() { restorePartition("sys"); }}); //Test only
if(MAX_FAT_sys>0 && dev_mode) options.push_back({"Rest FAT Sys", [=]() { restorePartition("sys"); }}); //Test only
if(MAX_FAT_vfs>0) options.push_back({"Rest FAT Vfs", [=]() { restorePartition("vfs"); }});

if(dev_mode) options.push_back({"Boot Animation", [=]() { initDisplayLoop(); }});

options.push_back({"Restart", [=]() { ESP.restart(); }});

#if defined(STICK_C_PLUS2) || defined(T_EMBED) || defined(STICK_C_PLUS)
Expand Down
6 changes: 4 additions & 2 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ bool config_exists() {
File conf = SDM.open(CONFIG_FILE, FILE_WRITE);
if (conf) {
#if ROTATION > 1
conf.print("[{\"rot\":3,\"dimmerSet\":10,\"onlyBins\":1,\"bright\":100,\"askSpiffs\":1,\"wui_usr\":\"admin\",\"wui_pwd\":\"launcher\",\"dwn_path\":\"/downloads/\",\"FGCOLOR\":2016,\"BGCOLOR\":0,\"ALCOLOR\":63488,\"even\":13029,\"odd\":12485,\"wifi\":[{\"ssid\":\"myNetSSID\",\"pwd\":\"myNetPassword\"}]}]");
conf.print("[{\"rot\":3,\"dimmerSet\":10,\"onlyBins\":1,\"bright\":100,\"askSpiffs\":1,\"wui_usr\":\"admin\",\"wui_pwd\":\"launcher\",\"dwn_path\":\"/downloads/\",\"FGCOLOR\":2016,\"BGCOLOR\":0,\"ALCOLOR\":63488,\"even\":13029,\"odd\":12485,\",\"dev\":0,\"wifi\":[{\"ssid\":\"myNetSSID\",\"pwd\":\"myNetPassword\"}]}]");
#else
conf.print("[{\"rot\":1,\"dimmerSet\":10,\"onlyBins\":1,\"bright\":100,\"askSpiffs\":1,\"wui_usr\":\"admin\",\"wui_pwd\":\"launcher\",\"dwn_path\":\"/downloads/\",\"FGCOLOR\":2016,\"BGCOLOR\":0,\"ALCOLOR\":63488,\"even\":13029,\"odd\":12485,\"wifi\":[{\"ssid\":\"myNetSSID\",\"pwd\":\"myNetPassword\"}]}]");
conf.print("[{\"rot\":1,\"dimmerSet\":10,\"onlyBins\":1,\"bright\":100,\"askSpiffs\":1,\"wui_usr\":\"admin\",\"wui_pwd\":\"launcher\",\"dwn_path\":\"/downloads/\",\"FGCOLOR\":2016,\"BGCOLOR\":0,\"ALCOLOR\":63488,\"even\":13029,\"odd\":12485,\",\"dev\":0,\"wifi\":[{\"ssid\":\"myNetSSID\",\"pwd\":\"myNetPassword\"}]}]");
#endif
}
conf.close();
Expand Down Expand Up @@ -318,6 +318,7 @@ void getConfigs() {
if(setting["ALCOLOR"].is<uint16_t>()) { ALCOLOR = setting["ALCOLOR"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(setting["odd"].is<uint16_t>()) { odd_color = setting["odd"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(setting["even"].is<uint16_t>()) { even_color= setting["even"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(setting["dev"].is<uint16_t>()) { dev_mode = setting["dev"].as<bool>(); } else { count++; log_i("Fail"); }
if(setting["wui_usr"].is<String>()) { wui_usr = setting["wui_usr"].as<String>(); } else { count++; log_i("Fail"); }
if(setting["wui_pwd"].is<String>()) { wui_pwd = setting["wui_pwd"].as<String>(); } else { count++; log_i("Fail"); }
if(setting["dwn_path"].is<String>()) { dwn_path = setting["dwn_path"].as<String>(); } else { count++; log_i("Fail"); }
Expand Down Expand Up @@ -388,6 +389,7 @@ void saveConfigs() {
setting["ALCOLOR"] = ALCOLOR;
setting["odd"] = odd_color;
setting["even"] = even_color;
setting["dev"] = dev_mode;
setting["wui_usr"] = wui_usr;
setting["wui_pwd"] = wui_pwd;
setting["dwn_path"] = dwn_path;
Expand Down

0 comments on commit 69cf0bd

Please sign in to comment.