Skip to content

Commit

Permalink
Merge pull request #52 from bmorcelli/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
bmorcelli authored Jul 22, 2024
2 parents c18cd20 + 4971f9e commit f00f849
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 53 deletions.
Binary file modified Launcher/Launcher_2.0_C.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_CYD-2-USB.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_CYD-2432S028.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_Cardputer.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_CoreS3.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_T-Display-S3-Touchscreen.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_core2.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_core_16Mb.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_cplus1_1.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_cplus2.bin
Binary file not shown.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Sourcecode will be released in the future..
* UiFlow 1 doesn´t work with M5Launcher.. it uses an old MicroPython distro, that uses an old ESP-IDF distro with lots os secrets that I couldn´t figure out.

## Changelog
* 2.2.3:
* [x] StickC, Plus and Plus2: removed power btn from skip logic at start.
* [x] Changed EEPROM Addresses to avoid problems with the new Bruce and other firmwares..
* 2.2.2:
* [x] Port for [CYD-2432S028R](https://www.amazon.com/dp/B0BVFXR313) and [CYD-2-Usb](https://www.amazon.com/dp/B0CLR7MQ91)
* [x] Added check after finish the download that will delete failed downloaded files
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default_envs =

[common]
build_flags =
-DLAUNCHER='"2.2.2"'
-DLAUNCHER='"2.2.3"'
-DMAXFILES=256
-DEEPROMSIZE=128
-DLH=8
Expand Down
32 changes: 16 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ void setup() {
#endif

EEPROM.begin(EEPROMSIZE); // open eeprom
if(EEPROM.read(0) > 3 || EEPROM.read(1) > 240 || EEPROM.read(2) > 100 || EEPROM.read(9) > 1 || EEPROM.read(EEPROMSIZE-2) > 1 || (EEPROM.read(EEPROMSIZE-3)==0xFF && EEPROM.read(EEPROMSIZE-4) == 0xFF && EEPROM.read(EEPROMSIZE-5)==0xFF && EEPROM.read(EEPROMSIZE-6) == 0xFF)) {
log_i("EEPROM back to default\n0=%d\n1=%d\n2=%d\n9=%d\nES-1=%d",EEPROM.read(0),EEPROM.read(1),EEPROM.read(2),EEPROM.read(9),EEPROM.read(EEPROMSIZE-2) );
if(EEPROM.read(EEPROMSIZE-13) > 3 || EEPROM.read(EEPROMSIZE-14) > 240 || EEPROM.read(EEPROMSIZE-15) > 100 || EEPROM.read(EEPROMSIZE-1) > 1 || EEPROM.read(EEPROMSIZE-2) > 1 || (EEPROM.read(EEPROMSIZE-3)==0xFF && EEPROM.read(EEPROMSIZE-4) == 0xFF && EEPROM.read(EEPROMSIZE-5)==0xFF && EEPROM.read(EEPROMSIZE-6) == 0xFF)) {
log_i("EEPROM back to default\n0=%d\n1=%d\n2=%d\n9=%d\nES-1=%d",EEPROM.read(EEPROMSIZE-13),EEPROM.read(EEPROMSIZE-14),EEPROM.read(EEPROMSIZE-15),EEPROM.read(EEPROMSIZE-1),EEPROM.read(EEPROMSIZE-2) );
#if defined(CARDPUTER) || defined(M5STACK)
EEPROM.write(0, 1); // Right rotation for cardputer
EEPROM.write(EEPROMSIZE-13, 1); // Right rotation for cardputer
#else
EEPROM.write(0, 3); // Left rotation
EEPROM.write(EEPROMSIZE-13, 3); // Left rotation
#endif
EEPROM.write(1, 20); // 20s Dimm time
EEPROM.write(2, 100); // 100% brightness
EEPROM.write(9, 1); // OnlyBins
EEPROM.writeString(10,"");
EEPROM.write(EEPROMSIZE-14, 20); // 20s Dimm time
EEPROM.write(EEPROMSIZE-15, 100); // 100% brightness
EEPROM.write(EEPROMSIZE-1, 1); // OnlyBins
EEPROM.writeString(20,"");
EEPROM.write(EEPROMSIZE-2, 1); // AskSpiffs

//FGCOLOR
Expand All @@ -192,14 +192,14 @@ void setup() {
EEPROM.write(EEPROMSIZE-12, 0xe5);
EEPROM.commit(); // Store data to EEPROM
}
if(EEPROM.read(0) != 1 && EEPROM.read(0) != 3) {
EEPROM.write(0, 3); // Left rotation
if(EEPROM.read(EEPROMSIZE-13) != 1 && EEPROM.read(EEPROMSIZE-13) != 3) {
EEPROM.write(EEPROMSIZE-13, ROTATION); // Left rotation
EEPROM.commit(); // Store data to EEPROM
}
rotation = EEPROM.read(0);
dimmerSet = EEPROM.read(1);
bright = EEPROM.read(2);
onlyBins = EEPROM.read(9);
rotation = EEPROM.read(EEPROMSIZE-13);
dimmerSet = EEPROM.read(EEPROMSIZE-14);
bright = EEPROM.read(EEPROMSIZE-15);
onlyBins = EEPROM.read(EEPROMSIZE-1);
askSpiffs = EEPROM.read(EEPROMSIZE-2);
FGCOLOR = (EEPROM.read(EEPROMSIZE-3) << 8) | EEPROM.read(EEPROMSIZE-4);
BGCOLOR = (EEPROM.read(EEPROMSIZE-5) << 8) | EEPROM.read(EEPROMSIZE-6);
Expand Down Expand Up @@ -275,9 +275,9 @@ void setup() {
Keyboard.update();
if (Keyboard.isPressed() && !(Keyboard.isKeyPressed(KEY_ENTER)))
#elif defined(STICK_C_PLUS2)
if((digitalRead(UP_BTN)==BTN_ACT && (millis()-i>2000)) || digitalRead(DW_BTN)==BTN_ACT)
if(digitalRead(DW_BTN)==BTN_ACT)
#elif defined(STICK_C_PLUS)
if((axp192.GetBtnPress() && (millis()-i>2000)) || digitalRead(DW_BTN)==BTN_ACT)
if(digitalRead(DW_BTN)==BTN_ACT)
#elif defined(M5STACK)
if(checkNextPress() || checkPrevPress())
#elif defined(T_DISPLAY_S3)
Expand Down
6 changes: 3 additions & 3 deletions src/onlineLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void wifiConnect(String ssid, int encryptation, bool isAP) {
JsonObject setting = settings[0];
JsonArray WifiList = setting["wifi"].as<JsonArray>();
EEPROM.begin(EEPROMSIZE);
pwd = EEPROM.readString(10);
pwd = EEPROM.readString(20);
EEPROM.end();
log_i("sdcardMounted: %d", sdcardMounted);

Expand All @@ -67,8 +67,8 @@ void wifiConnect(String ssid, int encryptation, bool isAP) {
if (encryptation > 0) pwd = keyboard(pwd, 63, "Network Password:");

EEPROM.begin(EEPROMSIZE);
if (pwd != EEPROM.readString(10)) {
EEPROM.writeString(10, pwd);
if (pwd != EEPROM.readString(20)) {
EEPROM.writeString(20, pwd);
EEPROM.commit(); // Store data to EEPROM
}
EEPROM.end(); // Free EEPROM memory
Expand Down
2 changes: 1 addition & 1 deletion src/partitioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void partitionCrawler() {
ESP_LOGI(TAG, "Restarting system to boot from test partition");
//Forces Recovering EEPROM data to default.
EEPROM.begin(EEPROMSIZE);
EEPROM.write(0,0xFF);
EEPROM.write(EEPROMSIZE-13,0xFF);
esp_restart();
}
}
73 changes: 41 additions & 32 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,33 @@
#include "sd_functions.h"
#include "mykeyboard.h"

/**************************************************************************************
EEPROM ADDRESSES MAP
0 N/B Rot 16 32 Pass 48 Pass 64 Pass 80 Pass 96 112
1 N/B Dim 17 33 Pass 49 Pass 65 Pass 81 Pass 97 113
2 N/B Bri 18 34 Pass 50 Pass 66 Pass 82 Pass 98 114
3 N 19 35 Pass 51 Pass 67 Pass 83 Pass 99 115 (L- Brigh)
4 N 20 Pass 36 Pass 52 Pass 68 Pass 84 Pass 100 116 (L- Dim)
5 N 21 Pass 37 Pass 53 Pass 69 Pass 85 101 117 (L- Rotation)
6 B-IrTX 22 Pass 38 Pass 54 Pass 70 Pass 86 102 118 (L-odd)
7 B-IrRx 23 Pass 39 Pass 55 Pass 71 Pass 87 103 119 (L-odd)
8 B-RfTX 24 Pass 40 Pass 56 Pass 72 Pass 88 104 120 (L-even)
9 B-RfRx 25 Pass 41 Pass 57 Pass 73 Pass 89 105 121 (L-even)
10 TimeZone 26 Pass 42 Pass 58 Pass 74 Pass 90 106 122 (L-BGCOLOR)
11 FGCOLOR 27 Pass 43 Pass 59 Pass 75 Pass 91 107 123 (L-BGCOLOR)
12 FGCOLOR 28 Pass 44 Pass 60 Pass 76 Pass 92 108 124 (L-FGCOLOR)
13 29 Pass 45 Pass 61 Pass 77 Pass 93 109 125 (L-FGCOLOR)
14 30 Pass 46 Pass 62 Pass 78 Pass 94 110 126 (L-AskSpiffs)
15 31 Pass 47 Pass 63 Pass 79 Pass 95 111 127 (L-OnlyBins)
From 1 to 5: Nemo shared addresses
(L -*) stands for Launcher addresses
***************************************************************************************/


/*********************************************************************
** Function: setBrightness
** save brightness value into EEPROM
Expand Down Expand Up @@ -35,7 +62,7 @@ void setBrightness(int brightval, bool save) {
if (save) {
EEPROM.begin(EEPROMSIZE); // open eeprom
bright = brightval;
EEPROM.write(2, brightval); //set the byte
EEPROM.write(EEPROMSIZE-15, brightval); //set the byte
EEPROM.commit(); // Store data to EEPROM
EEPROM.end(); // Free EEPROM memory
}
Expand All @@ -47,7 +74,7 @@ void setBrightness(int brightval, bool save) {
**********************************************************************/
void getBrightness() {
EEPROM.begin(EEPROMSIZE);
bright = EEPROM.read(2);
bright = EEPROM.read(EEPROMSIZE-15);
EEPROM.end(); // Free EEPROM memory
if(bright>100) {
bright = 100;
Expand Down Expand Up @@ -100,7 +127,7 @@ void getBrightness() {
**********************************************************************/
bool gsetOnlyBins(bool set, bool value) {
EEPROM.begin(EEPROMSIZE);
int onlyBin = EEPROM.read(9);
int onlyBin = EEPROM.read(EEPROMSIZE-1);
bool result = false;

if(onlyBin>1) {
Expand All @@ -113,7 +140,7 @@ bool gsetOnlyBins(bool set, bool value) {
if(set) {
result=value;
onlyBins=value; //update the global variable
EEPROM.write(9, result);
EEPROM.write(EEPROMSIZE-1, result);
EEPROM.commit();
}
EEPROM.end(); // Free EEPROM memory
Expand All @@ -126,7 +153,7 @@ bool gsetOnlyBins(bool set, bool value) {
**********************************************************************/
bool gsetAskSpiffs(bool set, bool value) {
EEPROM.begin(EEPROMSIZE);
int spiffs = EEPROM.read(EEPROMSIZE-1);
int spiffs = EEPROM.read(EEPROMSIZE-2);
bool result = false;

if(spiffs>1) {
Expand All @@ -139,7 +166,7 @@ bool gsetAskSpiffs(bool set, bool value) {
if(set) {
result=value;
askSpiffs=value; //update the global variable
EEPROM.write(EEPROMSIZE-1, result);
EEPROM.write(EEPROMSIZE-2, result);
EEPROM.commit();
}
EEPROM.end(); // Free EEPROM memory
Expand All @@ -152,7 +179,7 @@ bool gsetAskSpiffs(bool set, bool value) {
**********************************************************************/
int gsetRotation(bool set){
EEPROM.begin(EEPROMSIZE);
int getRot = EEPROM.read(0);
int getRot = EEPROM.read(EEPROMSIZE-13);
int result = ROTATION;

if(getRot==1 && set) result = 3;
Expand All @@ -166,7 +193,7 @@ int gsetRotation(bool set){
if(set) {
rotation = result;
tft.setRotation(result);
EEPROM.write(0, result); // Left rotation
EEPROM.write(EEPROMSIZE-13, result); // Left rotation
EEPROM.commit();
tft.fillScreen(BGCOLOR);
}
Expand Down Expand Up @@ -247,7 +274,7 @@ void setdimmerSet() {
loopOptions(options);
dimmerSet=time;
EEPROM.begin(EEPROMSIZE);
EEPROM.write(1, dimmerSet); // 20s Dimm time
EEPROM.write(EEPROMSIZE-14, dimmerSet); // 20s Dimm time
EEPROM.commit();
EEPROM.end();
saveConfigs();
Expand Down Expand Up @@ -301,25 +328,7 @@ void getConfigs() {
log_i("Failed to read file, using default configuration");
goto Default;
} else log_i("getConfigs: deserialized correctly");

/*
int count=0;
if(settings.containsKey("onlyBins")) { onlyBins = gsetOnlyBins(settings["onlyBins"].as<bool>()); } else { count++; log_i("Fail"); }
if(settings.containsKey("askSpiffs")) { askSpiffs = gsetAskSpiffs(settings["askSpiffs"].as<bool>()); } else { count++; log_i("Fail"); }
if(settings.containsKey("bright")) { bright = settings["bright"].as<int>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("dimmerSet")) { dimmerSet = settings["dimmerSet"].as<int>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("rot")) { rotation = settings["rot"].as<int>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("FGCOLOR")) { FGCOLOR = settings["FGCOLOR"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("BGCOLOR")) { BGCOLOR = settings["BGCOLOR"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("ALCOLOR")) { ALCOLOR = settings["ALCOLOR"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("odd")) { odd_color = settings["odd"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("even")) { even_color= settings["even"].as<uint16_t>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("wui_usr")) { wui_usr = settings["wui_usr"].as<String>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("wui_pwd")) { wui_pwd = settings["wui_pwd"].as<String>(); } else { count++; log_i("Fail"); }
if(settings.containsKey("dwn_path")) { dwn_path = settings["dwn_path"].as<String>(); } else { count++; log_i("Fail"); }
if(!settings.containsKey("wifi")) { count++; log_i("Fail"); }
if(count>0) saveConfigs();
*/

int count=0;
JsonObject setting = settings[0];
if(setting.containsKey("onlyBins")) { onlyBins = gsetOnlyBins(setting["onlyBins"].as<bool>()); } else { count++; log_i("Fail"); }
Expand All @@ -346,10 +355,10 @@ void getConfigs() {


EEPROM.begin(EEPROMSIZE); // open eeprom
EEPROM.write(0, rotation);
EEPROM.write(1, dimmerSet);
EEPROM.write(2, bright);
EEPROM.write(9, int(onlyBins));
EEPROM.write(EEPROMSIZE-13, rotation);
EEPROM.write(EEPROMSIZE-14, dimmerSet);
EEPROM.write(EEPROMSIZE-15, bright);
EEPROM.write(EEPROMSIZE-1, int(onlyBins));
EEPROM.write(EEPROMSIZE-2, int(askSpiffs));

EEPROM.write(EEPROMSIZE-3, int((FGCOLOR >> 8) & 0x00FF));
Expand Down

0 comments on commit f00f849

Please sign in to comment.