Skip to content

Commit 2a9fb52

Browse files
committed
Fix color scheme EEPROM, change clock to 7-segment font
1 parent cd9c4b2 commit 2a9fb52

File tree

1 file changed

+40
-45
lines changed

1 file changed

+40
-45
lines changed

m5stick-nemo.ino

+40-45
Original file line numberDiff line numberDiff line change
@@ -719,19 +719,12 @@ void setcolor(bool fg, int col){
719719
break;
720720
}
721721
if(fg){
722-
if(color == BGCOLOR){
723-
cursor++;
724-
cursor = cursor % cmenu_size;
725-
}else{
726-
FGCOLOR=color;
727-
}
722+
FGCOLOR=color;
728723
}else{
729-
if(color == FGCOLOR){
730-
cursor++;
731-
cursor = cursor % cmenu_size;
732-
}else{
733-
BGCOLOR=color;
734-
}
724+
BGCOLOR=color;
725+
}
726+
if(FGCOLOR == BGCOLOR){
727+
BGCOLOR = FGCOLOR ^ 0xFFFF;
735728
}
736729
DISP.setTextColor(FGCOLOR, BGCOLOR);
737730
}
@@ -751,6 +744,7 @@ void color_setup() {
751744

752745
void color_loop() {
753746
if (check_next_press()) {
747+
setcolor(EEPROM.read(5), false);
754748
cursor++;
755749
cursor = cursor % cmenu_size;
756750
setcolor(true, cursor);
@@ -815,58 +809,61 @@ void theme_setup() {
815809
drawmenu(thmenu, thmenu_size);
816810
}
817811

812+
int BG=0;
813+
int FG=0;
814+
818815
void theme_loop() {
819816
if (check_next_press()) {
820817
cursor++;
821818
cursor = cursor % thmenu_size;
822819
switch (thmenu[cursor].command){
823820
case 0:
824-
FGCOLOR=11;
825-
BGCOLOR=1;
821+
FG=11;
822+
BG=1;
826823
break;
827824
case 1: // Nemo
828-
FGCOLOR=11;
829-
BGCOLOR=1;
825+
FG=11;
826+
BG=1;
830827
break;
831828
case 2: // Tux
832-
FGCOLOR=8;
833-
BGCOLOR=1;
829+
FG=8;
830+
BG=1;
834831
break;
835832
case 3: // Bill
836-
FGCOLOR=16;
837-
BGCOLOR=10;
833+
FG=16;
834+
BG=10;
838835
break;
839836
case 4: // Steve
840-
FGCOLOR=1;
841-
BGCOLOR=8;
837+
FG=1;
838+
BG=8;
842839
break;
843840
case 5: // Lilac
844-
FGCOLOR=19;
845-
BGCOLOR=6;
841+
FG=19;
842+
BG=6;
846843
break;
847844
case 6: // Contrast
848-
FGCOLOR=16;
849-
BGCOLOR=1;
845+
FG=16;
846+
BG=1;
850847
break;
851848
case 7: // NightShift
852-
FGCOLOR=5;
853-
BGCOLOR=1;
849+
FG=5;
850+
BG=1;
854851
break;
855852
case 8: // Camo
856-
FGCOLOR=1;
857-
BGCOLOR=7;
853+
FG=1;
854+
BG=7;
858855
break;
859856
case 9: // BubbleGum
860-
FGCOLOR=1;
861-
BGCOLOR=19;
857+
FG=1;
858+
BG=19;
862859
break;
863860
case 99:
864-
FGCOLOR=11;
865-
BGCOLOR=1;
861+
FG=11;
862+
BG=1;
866863
break;
867864
}
868-
setcolor(true, FGCOLOR);
869-
setcolor(false, BGCOLOR);
865+
setcolor(true, FG);
866+
setcolor(false, BG);
870867
drawmenu(thmenu, thmenu_size);
871868
delay(250);
872869
}
@@ -888,10 +885,11 @@ void theme_loop() {
888885
break;
889886
default:
890887
#if defined(USE_EEPROM)
891-
Serial.printf("EEPROM WRITE (4) FGCOLOR: %d\n", FGCOLOR);
892-
EEPROM.write(4, FGCOLOR);
893-
Serial.printf("EEPROM WRITE (5) BGCOLOR: %d\n", BGCOLOR);
894-
EEPROM.write(5, BGCOLOR);
888+
Serial.printf("EEPROM WRITE (4) FGCOLOR: %d\n", FG);
889+
EEPROM.write(4, FG);
890+
Serial.printf("EEPROM WRITE (5) BGCOLOR: %d\n", BG);
891+
EEPROM.write(5, BG);
892+
EEPROM.commit();
895893
#endif
896894
rstOverride = false;
897895
isSwitching = true;
@@ -900,8 +898,6 @@ void theme_loop() {
900898
}
901899
}
902900

903-
904-
905901
int rotation = 1;
906902
#if defined(ROTATION)
907903
/// Rotation MENU ///
@@ -1256,19 +1252,18 @@ void sendAllCodes() {
12561252
#if defined(RTC)
12571253
void clock_setup() {
12581254
DISP.fillScreen(BGCOLOR);
1259-
DISP.setTextSize(MEDIUM_TEXT);
1255+
DISP.setTextSize(1);
12601256
}
12611257

12621258
void clock_loop() {
1263-
DISP.setCursor(40, 40, 2);
1259+
DISP.setCursor(10, 40, 7);
12641260
#if defined(STICK_C_PLUS2)
12651261
auto dt = StickCP2.Rtc.getDateTime();
12661262
DISP.printf("%02d:%02d:%02d\n", dt.time.hours, dt.time.minutes, dt.time.seconds);
12671263
#else
12681264
M5.Rtc.GetBm8563Time();
12691265
DISP.printf("%02d:%02d:%02d\n", M5.Rtc.Hour, M5.Rtc.Minute, M5.Rtc.Second);
12701266
#endif
1271-
delay(250);
12721267
check_select_press();
12731268
}
12741269

0 commit comments

Comments
 (0)