From d1361a196313c4375bcd3fe6624598f6b9c90419 Mon Sep 17 00:00:00 2001 From: Rennan Cockles Date: Tue, 1 Oct 2024 01:17:24 -0300 Subject: [PATCH 1/7] define DEFAULTFGCOLOR as 0xA80F --- src/core/eeprom.cpp | 2 +- src/core/globals.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/eeprom.cpp b/src/core/eeprom.cpp index 6dfd5e0..03d4210 100644 --- a/src/core/eeprom.cpp +++ b/src/core/eeprom.cpp @@ -56,7 +56,7 @@ void load_eeprom() { IrRx = GROVE_SCL; RfTx = GROVE_SDA; RfRx = GROVE_SCL; - FGCOLOR = 0xA80F; + FGCOLOR = DEFAULTFGCOLOR; tmz = 0; RfModule = M5_RF_MODULE; RfidModule = M5_RFID2_MODULE; diff --git a/src/core/globals.h b/src/core/globals.h index 9187902..e4e066d 100644 --- a/src/core/globals.h +++ b/src/core/globals.h @@ -3,6 +3,7 @@ //#define FGCOLOR TFT_PURPLE+0x3000 extern char16_t FGCOLOR; +#define DEFAULTFGCOLOR 0xA80F #define ALCOLOR TFT_RED #define BGCOLOR TFT_BLACK From 298a20ce5c5733054da9220e3889a5b8030af079 Mon Sep 17 00:00:00 2001 From: Rennan Cockles Date: Tue, 1 Oct 2024 01:17:50 -0300 Subject: [PATCH 2/7] pad top 4px for viewFile --- src/core/sd_functions.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/sd_functions.cpp b/src/core/sd_functions.cpp index 3530af7..45ac1cd 100644 --- a/src/core/sd_functions.cpp +++ b/src/core/sd_functions.cpp @@ -310,7 +310,7 @@ String readSmallFile(FS &fs, String filepath) { return ""; } // TODO: if(psramFound()) -> use PSRAM instead - + fileContent = file.readString(); file.close(); @@ -399,7 +399,7 @@ void readFs(FS fs, String folder, String allowed_ext) { int allFilesCount = 0; fileList.clear(); FileList object; - + File root = fs.open(folder); if (!root || !root.isDirectory()) { //Serial.println("Não foi possível abrir o diretório"); @@ -425,7 +425,7 @@ void readFs(FS fs, String folder, String allowed_ext) { int new_sort_start=fileList.size(); //Add files to the list - root = fs.open(folder); + root = fs.open(folder); File file2 = root.openNextFile(); while (file2) { String fileName = file2.name(); @@ -448,7 +448,7 @@ void readFs(FS fs, String folder, String allowed_ext) { // Order file list std::sort(fileList.begin()+new_sort_start, fileList.end(), sortList); - + // Adds Operational btn at the botton object.filename = "> Back"; object.folder=false; @@ -640,7 +640,7 @@ String loopSD(FS &fs, bool filePicker, String allowed_ext) { showJpeg(fs, filepath); delay(750); while(!checkAnyKeyPress()) yield(); - }}); + }}); if(filepath.endsWith(".ir")) options.insert(options.begin(), {"IR Tx SpamAll", [&]() { delay(200); txIrFile(&fs, filepath); @@ -832,7 +832,7 @@ void viewFile(FS fs, String filepath) { while(1) { if(updateContent) { tft.fillScreen(BGCOLOR); - tft.setCursor(0,0); + tft.setCursor(0,4); tft.setTextSize(FP); displayText = fileContent.substring( From e47b5a9c288d9128a54e260bc00e8f63ad627ae8 Mon Sep 17 00:00:00 2001 From: Rennan Cockles Date: Tue, 1 Oct 2024 13:44:01 -0300 Subject: [PATCH 3/7] change scripts icon --- src/core/menu_items/ScriptsMenu.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/core/menu_items/ScriptsMenu.cpp b/src/core/menu_items/ScriptsMenu.cpp index ebc99f2..076dbb2 100644 --- a/src/core/menu_items/ScriptsMenu.cpp +++ b/src/core/menu_items/ScriptsMenu.cpp @@ -6,22 +6,22 @@ void ScriptsMenu::optionsMenu() { - + String Folder = "/scripts"; FS* fs = NULL; if(SD.exists(Folder)) fs = &SD; if(LittleFS.exists(Folder)) fs = &LittleFS; if(!fs) return; // dir not found - + //String fileList[MAXFILES][3]; //readFs(fs, Folder, fileList, "bjs"); options = { }; - + File root = fs->open(Folder); if (!root || !root.isDirectory()) return; // not a dir File file2 = root.openNextFile(); - + while (file2) { if (file2.isDirectory()) continue; String fileName = String(file2.name()); @@ -33,7 +33,7 @@ void ScriptsMenu::optionsMenu() { } file2.close(); root.close(); - + options.push_back({"Load...", [=]() { run_bjs_script(); }}); options.push_back({"Main Menu", [=]() { backToMenu(); }}); @@ -46,11 +46,16 @@ String ScriptsMenu::getName() { } void ScriptsMenu::draw() { - // draw the icon tft.fillRect(iconX,iconY,80,80,BGCOLOR); - int i=0; - for(i=0;i<6;i++) { - tft.drawArc(40+iconX,40+iconY,30,20,15+60*i,45+60*i,FGCOLOR,BGCOLOR,true); - } - tft.drawArc(40+iconX,40+iconY,22,8,0,360,FGCOLOR,BGCOLOR,false); + + tft.drawRect(15+iconX, 5+iconY, 50, 70, FGCOLOR); + tft.fillRect(50+iconX, 5+iconY, 15, 15, BGCOLOR); + tft.drawTriangle(50+iconX, 5+iconY, 50+iconX, 19+iconY, 64+iconX, 19+iconY, FGCOLOR); + + tft.drawLine(25+iconX, 45+iconY, 30+iconX, 50+iconY, FGCOLOR); + tft.drawLine(25+iconX, 45+iconY, 30+iconX, 40+iconY, FGCOLOR); + tft.drawLine(35+iconX, 50+iconY, 45+iconX, 40+iconY, FGCOLOR); + tft.drawLine(55+iconX, 45+iconY, 50+iconX, 50+iconY, FGCOLOR); + tft.drawLine(55+iconX, 45+iconY, 50+iconX, 40+iconY, FGCOLOR); + } \ No newline at end of file From 76d37ef9fa8374509f522cb489c6b28bf3a3bb3e Mon Sep 17 00:00:00 2001 From: Rennan Cockles Date: Tue, 1 Oct 2024 14:15:07 -0300 Subject: [PATCH 4/7] add light blue color --- src/core/settings.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/core/settings.cpp b/src/core/settings.cpp index f043119..56d25b9 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -141,11 +141,11 @@ void setBrightnessMenu() { else if(bright== 1) idx=4; options = { - {"100%", [=]() { setBrightness(100); }, bright == 100 ? true:false }, - {"75 %", [=]() { setBrightness(75); }, bright == 75 ? true:false}, - {"50 %", [=]() { setBrightness(50); }, bright == 50 ? true:false}, - {"25 %", [=]() { setBrightness(25); }, bright == 25 ? true:false}, - {" 0 %", [=]() { setBrightness(1); }, bright == 1 ? true:false}, + {"100%", [=]() { setBrightness(100); }, bright == 100 }, + {"75 %", [=]() { setBrightness(75); }, bright == 75 }, + {"50 %", [=]() { setBrightness(50); }, bright == 50 }, + {"25 %", [=]() { setBrightness(25); }, bright == 25 }, + {" 1 %", [=]() { setBrightness(1); }, bright == 1 }, {"Main Menu", [=]() { backToMenu(); }}, }; delay(200); @@ -201,26 +201,29 @@ void setDimmerTimeMenu() { ** Function: setUIColor ** Set and store main UI color **********************************************************************/ +#define LIGHT_BLUE 0x96FE void setUIColor(){ int idx=0; - if(FGCOLOR==0xA80F) idx=0; + if(FGCOLOR==DEFAULTFGCOLOR) idx=0; else if(FGCOLOR==TFT_WHITE) idx=1; else if(FGCOLOR==TFT_RED) idx=2; else if(FGCOLOR==TFT_DARKGREEN) idx=3; else if(FGCOLOR==TFT_BLUE) idx=4; - else if(FGCOLOR==TFT_YELLOW) idx=5; - else if(FGCOLOR==TFT_MAGENTA) idx=6; - else if(FGCOLOR==TFT_ORANGE) idx=7; + else if(FGCOLOR==LIGHT_BLUE) idx=5; + else if(FGCOLOR==TFT_YELLOW) idx=6; + else if(FGCOLOR==TFT_MAGENTA) idx=7; + else if(FGCOLOR==TFT_ORANGE) idx=8; options = { - {"Default", [&]() { FGCOLOR=0xA80F; }, FGCOLOR==0xA80F ? true:false}, - {"White", [&]() { FGCOLOR=TFT_WHITE; }, FGCOLOR==TFT_WHITE ? true:false}, - {"Red", [&]() { FGCOLOR=TFT_RED; }, FGCOLOR==TFT_RED ? true:false}, - {"Green", [&]() { FGCOLOR=TFT_DARKGREEN; }, FGCOLOR==TFT_DARKGREEN ? true:false}, - {"Blue", [&]() { FGCOLOR=TFT_BLUE; }, FGCOLOR==TFT_BLUE ? true:false}, - {"Yellow", [&]() { FGCOLOR=TFT_YELLOW; }, FGCOLOR==TFT_YELLOW ? true:false}, - {"Magenta", [&]() { FGCOLOR=TFT_MAGENTA; }, FGCOLOR==TFT_MAGENTA ? true:false}, - {"Orange", [&]() { FGCOLOR=TFT_ORANGE; }, FGCOLOR==TFT_ORANGE ? true:false}, + {"Default", [&]() { FGCOLOR=DEFAULTFGCOLOR;}, FGCOLOR==DEFAULTFGCOLOR}, + {"White", [&]() { FGCOLOR=TFT_WHITE; }, FGCOLOR==TFT_WHITE }, + {"Red", [&]() { FGCOLOR=TFT_RED; }, FGCOLOR==TFT_RED }, + {"Green", [&]() { FGCOLOR=TFT_DARKGREEN; }, FGCOLOR==TFT_DARKGREEN }, + {"Blue", [&]() { FGCOLOR=TFT_BLUE; }, FGCOLOR==TFT_BLUE }, + {"Light Blue",[&]() { FGCOLOR=LIGHT_BLUE; }, FGCOLOR==LIGHT_BLUE }, + {"Yellow", [&]() { FGCOLOR=TFT_YELLOW; }, FGCOLOR==TFT_YELLOW }, + {"Magenta", [&]() { FGCOLOR=TFT_MAGENTA; }, FGCOLOR==TFT_MAGENTA }, + {"Orange", [&]() { FGCOLOR=TFT_ORANGE; }, FGCOLOR==TFT_ORANGE }, {"Main Menu", [=]() { backToMenu(); }}, }; delay(200); From 7881b82ea7fe5b6d9f2ae0cb2d42b935da889d6c Mon Sep 17 00:00:00 2001 From: Rennan Cockles Date: Tue, 1 Oct 2024 14:48:33 -0300 Subject: [PATCH 5/7] change color themes to use color variation instead of -0x1111 --- src/core/display.cpp | 130 ++++++++++++++++++++++++++++++++++++------- src/core/display.h | 3 + 2 files changed, 114 insertions(+), 19 deletions(-) diff --git a/src/core/display.cpp b/src/core/display.cpp index 8bce7c0..03fc78f 100644 --- a/src/core/display.cpp +++ b/src/core/display.cpp @@ -88,7 +88,7 @@ void displayRedStripe(String text, uint16_t fgcolor, uint16_t bgcolor) { tft.println(text); } -void displayError(String txt) { +void displayError(String txt) { #ifndef HAS_SCREEN Serial.println("ERR: " + txt); return; @@ -351,7 +351,7 @@ void drawOptions(int index,std::vector