This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
fuck-nemo.ino
3206 lines (3039 loc) · 82.2 KB
/
fuck-nemo.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Nemo Firmware for the M5 Stack Stick C Plus
// github.com/n0xa | IG: @4x0nn
// -=-=-=-=-=-=- Uncomment the platform you're building for -=-=-=-=-=-=-
// #define STICK_C_PLUS
// #define STICK_C_PLUS2
// #define STICK_C // Not supported anymore (Womp womp xD)
// #define CARDPUTER // Just use m5-bruce wtf
// -=-=- Uncommenting more than one at a time will result in errors -=-=-
// -=-=- NEMO Language for Menu and Portal -=- Thanks, @marivaaldo and @Mmatuda! -=-=-
// #define LANGUAGE_EN_US
// #define LANGUAGE_PT_BR
// #define LANGUAGE_IT_IT
// #define LANGUAGE_FR_FR
// -- DEPRECATED - THESE ARE NOW EEPROM DEFINED -- //
uint16_t BGCOLOR=0x0001; // placeholder
uint16_t FGCOLOR=0xFFF1; // placeholder
#ifndef NEMO_VERSION
#define NEMO_VERSION "Modded"
#endif
#ifndef USERNAME
#define USERNAME "Anonymous"
#endif
#if !defined(CARDPUTER) && !defined(STICK_C_PLUS2) && !defined(STICK_C_PLUS) && !defined(STICK_C)
#define CARDPUTER
#endif
#if !defined(LANGUAGE_EN_US) && !defined(LANGUAGE_PT_BR) && !defined(LANGUAGE_IT_IT) && !defined(LANGUAGE_FR_FR)
#define LANGUAGE_EN_US
#endif
// -=-=- DEAUTHER -=- @bmorcelli -=-=- | Discord: Pirata#5263 bmorcelli
#define DEAUTHER //Need to make some changes in arduino IDE, refer to https://github.com/Niximkk/fuck-nemo/tree/main/deauth_prerequisites
// #define RANDOMMAC //May crash your device.
#if defined(STICK_C_PLUS)
#include <M5StickCPlus.h>
// -=-=- Display -=-=-
String platformName="StickC+";
#define BIG_TEXT 4
#define MEDIUM_TEXT 3
#define SMALL_TEXT 2
#define TINY_TEXT 1
// -=-=- FEATURES -=-=-
#define M5LED 10
#define RTC
#define AXP
#define ACTIVE_LOW_IR
#define ROTATION
#define USE_EEPROM
#define SDCARD
//#define SONG
// -=-=- ALIASES -=-=-
#define DISP M5.Lcd
#define IRLED 26 // Use 9 for built-in IR
#define IRRECV 26
#define JAMMER 26
#define SPEAKER M5.Beep
#define BITMAP M5.Lcd.drawBitmap(0, 0, M5.Lcd.width(), M5.Lcd.height(), FuckNemo)
#define SD_CLK_PIN 0
#define SD_MISO_PIN 36
#define SD_MOSI_PIN 26
#define SD_CS_PIN 14 //can be 14, to avoid serial messages
#define M5LED_ON LOW
#define M5LED_OFF HIGH
#endif
#if defined(STICK_C_PLUS2)
#include <M5StickCPlus2.h>
// -=-=- Display -=-=-
String platformName="StickC+2";
#define BIG_TEXT 4
#define MEDIUM_TEXT 3
#define SMALL_TEXT 2
#define TINY_TEXT 1
// -=-=- FEATURES -=-=-
#define ACTIVE_LOW_IR
#define M5LED 19
#define ROTATION
#define USE_EEPROM
#define RTC //TODO: plus2 has a BM8563 RTC but the class isn't the same, needs work.
#define SDCARD //Requires a custom-built adapter
#define PWRMGMT
#define SPEAKER M5.Speaker
//#define SONG
// -=-=- ALIASES -=-=-
#define DISP M5.Lcd
#define IRLED 19
#define IRRECV 26
#define JAMMER 26
#define BITMAP M5.Lcd.drawBitmap(0, 0, M5.Lcd.width(), M5.Lcd.height(), FuckNemo)
#define M5_BUTTON_MENU 35
#define M5_BUTTON_HOME 37
#define M5_BUTTON_RST 39
#define BACKLIGHT 27
#define MINBRIGHT 190
#define SD_CLK_PIN 0
#define SD_MISO_PIN 36
#define SD_MOSI_PIN 26
#define SD_CS_PIN 14 //can be -1, but sends a lot of messages of error in serial monitor
#define M5LED_ON HIGH
#define M5LED_OFF LOW
#endif
#if defined(STICK_C)
#include <M5StickC.h>
// -=-=- Display -=-=-
String platformName="StickC";
#define BIG_TEXT 2
#define MEDIUM_TEXT 2
#define SMALL_TEXT 1
#define TINY_TEXT 1
// -=-=- FEATURES -=-=-
#define M5LED 10
#define RTC
#define AXP
#define ROTATION
#define USE_EEPROM
#define SDCARD //Requires a custom-built adapter
//#define SONG
// -=-=- ALIASES -=-=-
#define DISP M5.Lcd
#define IRLED 9
#define IRRECV 26
#define JAMMER 26
#define BITMAP Serial.println("unsupported")
#define SD_CLK_PIN 0
#define SD_MISO_PIN 36
#define SD_MOSI_PIN 26
#define SD_CS_PIN -1 //can be 14, to avoid serial messages
#define M5LED_ON LOW
#define M5LED_OFF HIGH
#endif
#if defined(CARDPUTER)
#include <M5Cardputer.h>
// -=-=- Display -=-=-
String platformName="Cardputer";
#define BIG_TEXT 4
#define MEDIUM_TEXT 3
#define SMALL_TEXT 2
#define TINY_TEXT 1
// -=-=- FEATURES -=-=-
#define KB
#define HID
#define ACTIVE_LOW_IR
#define USE_EEPROM
#define SDCARD
//#define SONG
// -=-=- ALIASES -=-=-
#define DISP M5Cardputer.Display
#define IRLED 44
#define IRRECV 1
#define JAMMER 26
#define BACKLIGHT 38
#define MINBRIGHT 165
#define SPEAKER M5Cardputer.Speaker
#define BITMAP M5Cardputer.Display.drawBmp(FuckNemo, 97338)
#define SD_CLK_PIN 40
#define SD_MISO_PIN 39
#define SD_MOSI_PIN 14
#define SD_CS_PIN 12
#define VBAT_PIN 10
#define M5LED_ON LOW
#define M5LED_OFF HIGH
#endif
// -=-=-=-=-=- LIST OF CURRENTLY DEFINED FEATURES -=-=-=-=-=-
// M5LED - A visible LED (Red) exposed on this pin number
// IRLED - An IR LED exposed on this pin number
// RTC - Real-time clock exposed as M5.Rtc
// AXP - AXP192 Power Management exposed as M5.Axp
// PWRMGMT - StickC+2 Power Management exposed as M5.Power
// KB - Keyboard exposed as M5Cardputer.Keyboard
// HID - HID exposed as USBHIDKeyboard
// USE_EEPROM - Store settings in EEPROM
// ROTATION - Allow screen to be rotated
// DISP - Set to the API's Display class
// SDCARD - Device has an SD Card Reader attached
// SONG - Play melody or beep on startup
// SPEAKER - Aliased to the prefix used for making noise
// BACKLIGHT - Alias to the pin used for the backlight on some models
// MINBRIGHT - The lowest number (0-255) for the backlight to show through
/// SWITCHER ///
// Proc codes
// 0 - Clock
// 1 - Main Menu
// 2 - Settings Menu
// 3 - Clock set
// 4 - Dimmer Time adjustment
// 5 - TV B-GONE
// 6 - Battery info
// 7 - screen rotation
// 8 - AppleJuice Menu
// 9 - AppleJuice Advertisement
// 10 - Credits
// 11 - Wifi beacon spam
// 12 - Wifi tools menu
// 13 - TV-B-Gone Region Setting
// 14 - Wifi scanning
// 15 - Wifi scan results
// 16 - Bluetooth Spam Menu
// 17 - Bluetooth Maelstrom
// 18 - QR Codes
// 19 - Evil Portal
// 20 - Attack menu
// 21 - Deauth Attack
// 22 - Custom Color Settings
// 23 - Pre-defined color themes
// 24 - Infrared Receiver
// 25 - 433Mhz Jammer
// 26 - Infrared Menu
// 27 - Bluetooth Menu
// 28 - Bluetooth Settings
// .. - ..
// 97 - Mount/UnMount SD Card on M5Stick devices, if SDCARD is declared
const String contributors[] PROGMEM = {
"@niximkk",
"@bicurico",
"@bmorcelli",
"@chr0m1ng",
"@doflamingozk",
"@9Ri7",
"@gustavocelani",
"@imxnoobx",
"@klamath1977",
"@marivaaldo",
"@mmatuda",
"@n0xa",
"@unagironin",
"@vladimirpetrov",
"@vs4vijay",
"@danny8972",
"@AH2005NA",
"@FlasherTwelve"
};
int advtime = 0;
int cursor = 0;
int wifict = 0;
int brightness = 100;
int ajDelay = 1000;
int apSsidOffset = 16;
int apSsidMaxLen = 32;
bool rstOverride = false; // Reset Button Override. Set to true when navigating menus.
bool sourApple = false; // Internal flag to place AppleJuice into SourApple iOS17 Exploit Mode
bool swiftPair = false; // Internal flag to place AppleJuice into Swift Pair random packet Mode
bool androidPair = false; // Internal flag to place AppleJuice into Android Pair random packet Mode
bool samsungSpam = false; // Internal flag to place AppleJuice into Samsung Spam random packet Mode
bool maelstrom = false; // Internal flag to place AppleJuice into Bluetooth Maelstrom mode
bool portal_active = false; // Internal flag used to ensure Evil Portal exits cleanly
bool activeQR = false;
bool jammerActivated = false;
const byte PortalTickTimer = 1000;
String apSsidName = String("");
bool isSwitching = true;
#if defined(RTC)
int current_proc = 0; // Start in Clock Mode
#else
int current_proc = 1; // Start in Main Menu mode if no RTC
#endif
// DEAUTH vars
uint8_t channel;
String apMac = String("");
bool target_deauth_flg = false;
bool target_deauth = false;
int deauth_tick = 0; // used to delay the deauth packets when combined to Evil Portal
bool clone_flg = false;
// DEAUTH end
#if defined(USE_EEPROM)
#include <EEPROM.h>
#define EEPROM_SIZE 64
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <DNSServer.h>
#include <WebServer.h>
#include "applejuice.h"
#include "WORLD_IR_CODES.h"
#include "wifispam.h"
#include "sd.h"
#include "portal.h"
#include "NEMOMatrix.h"
#include "songs.h"
#include "localization.h"
#include "IRextra.h"
#include "ir_replay.h"
//#include <BLEUtils.h>
//#include <BLEServer.h>
#include <NimBLEDevice.h>
#if defined(DEAUTHER)
#include "deauth.h" //DEAUTH
#include "esp_wifi.h" //DEAUTH
wifi_ap_record_t ap_record; //DEAUTH
#endif
struct MENU {
char name[19];
int command;
};
struct QRCODE {
char name[19];
String url;
};
QRCODE qrcodes[] = {
{ TXT_BACK, "" },
{ "Rickroll", "https://youtu.be/dQw4w9WgXcQ"},
{ "HackingTroop", "https://discord.gg/cpzagdy5XF"},
{ "Sellix", "https://discevolved.sellix.io/"},
{ "Bio", "https://terrorist.bio/sounix"},
{ "Pix", "00020126360014BR.GOV.BCB.PIX0114+55159913591865204000053039865802BR5903Nix6001A62130509HeyWassup6304FEF8"},
};
void drawmenu(MENU thismenu[], int size) {
DISP.setTextSize(SMALL_TEXT);
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 0, 1);
// scrolling menu
if (cursor < 0) {
cursor = size - 1; // rollover hack for up-arrow on cardputer
}
if (cursor > 5) {
for ( int i = 0 + (cursor - 5) ; i < size ; i++ ) {
if(cursor == i){
DISP.setTextColor(BGCOLOR, FGCOLOR);
}
DISP.printf(" %-19s\n",thismenu[i].name);
DISP.setTextColor(FGCOLOR, BGCOLOR);
}
} else {
for (
int i = 0 ; i < size ; i++ ) {
if(cursor == i){
DISP.setTextColor(BGCOLOR, FGCOLOR);
}
DISP.printf(" %-19s\n",thismenu[i].name);
DISP.setTextColor(FGCOLOR, BGCOLOR);
}
}
}
void number_drawmenu(int nums) {
DISP.setTextSize(SMALL_TEXT);
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 0);
// scrolling menu
if (cursor > 5) {
for ( int i = 0 + (cursor - 5) ; i < nums ; i++ ) {
if(cursor == i){
DISP.setTextColor(BGCOLOR, FGCOLOR);
}
DISP.printf(" %-19d\n",i);
DISP.setTextColor(FGCOLOR, BGCOLOR);
}
} else {
for (
int i = 0 ; i < nums ; i++ ) {
if(cursor == i){
DISP.setTextColor(BGCOLOR, FGCOLOR);
}
DISP.printf(" %-19d\n",i);
DISP.setTextColor(FGCOLOR, BGCOLOR);
}
}
}
void switcher_button_proc() {
if (rstOverride == false) {
if (check_next_press()) {
isSwitching = true;
current_proc = 1;
}
}
}
// Tap the power button from pretty much anywhere to get to the main menu
void check_menu_press() {
#if defined(AXP)
if (M5.Axp.GetBtnPress()) {
#endif
#if defined(KB)
if (M5Cardputer.Keyboard.isKeyPressed(',') || M5Cardputer.Keyboard.isKeyPressed('`')){
#endif
#if defined(M5_BUTTON_MENU)
if (digitalRead(M5_BUTTON_MENU) == LOW){
#endif
dimtimer();
isSwitching = true;
rstOverride = false;
current_proc = 1;
delay(100);
}
}
bool check_menu_press_usable(){
#if defined(AXP)
if (M5.Axp.GetBtnPress()) {
#endif
#if defined(KB)
if (M5Cardputer.Keyboard.isKeyPressed(',') || M5Cardputer.Keyboard.isKeyPressed('`')){
#endif
#if defined(M5_BUTTON_MENU)
if (digitalRead(M5_BUTTON_MENU) == LOW){
#endif
return true;
}
}
bool check_next_press(){
#if defined(KB)
M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(';')){
// hack to handle the up arrow
cursor = cursor - 2;
dimtimer();
return true;
}
//M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(KEY_TAB) || M5Cardputer.Keyboard.isKeyPressed('.')){
dimtimer();
return true;
}
#else
if (digitalRead(M5_BUTTON_RST) == LOW){
dimtimer();
return true;
}
#endif
return false;
}
bool check_select_press(){
#if defined(KB)
M5Cardputer.update();
if (M5Cardputer.Keyboard.isKeyPressed(KEY_ENTER) || M5Cardputer.Keyboard.isKeyPressed('/')){
dimtimer();
return true;
}
#else
if (digitalRead(M5_BUTTON_HOME) == LOW){
dimtimer();
return true;
}
#endif
return false;
}
/// MAIN MENU ///
MENU mmenu[] = {
#if defined(RTC)
{ TXT_CLOCK, 0},
#endif
{ "Infrared", 26},
{ "Bluetooth", 27},
{ "WiFi", 12},
{ "433Mhz", 29},
{ "QR Codes", 18},
{ TXT_SETTINGS, 2},
};
int mmenu_size = sizeof(mmenu) / sizeof(MENU);
int getBat() {
#if defined(PWRMGMT)
return M5.Power.getBatteryLevel();
#elif defined(AXP)
float c = M5.Axp.GetVapsData() * 1.4 / 1000; // This line seems unused, consider removing if unnecessary
float b = M5.Axp.GetVbatData() * 1.1 / 1000;
int battery = static_cast<int>(((b - 3.0) / 1.2) * 100);
return battery;
#elif defined(CARDPUTER)
int battery = static_cast<int>(((analogRead(VBAT_PIN) - 1842) * 100.0) / 738);
return battery;
#else
return -1;
#endif
}
void menu_extras() {
/* Stupid line */
DISP.drawLine(0, DISP.height()-25, DISP.width(), DISP.height()-25, FGCOLOR);
/* TIME */
#if defined(RTC)
DISP.setCursor(12, DISP.height()-20);
#if defined(STICK_C_PLUS2)
auto dt = StickCP2.Rtc.getDateTime();
DISP.printf("%02d:%02d\n", dt.time.hours, dt.time.minutes);
#elif defined(ESPTime)
DISP.printf("%02d:%02d\n", rtcp.getHour(), rtcp.getMinute());
#elif defined(STICK_C)
DISP.setCursor(12, DISP.height()-20);
M5.Rtc.GetBm8563Time();
DISP.printf("%02d:%02d\n", M5.Rtc.Hour, M5.Rtc.Minute);
#else
M5.Rtc.GetBm8563Time();
DISP.printf("%02d:%02d\n", M5.Rtc.Hour, M5.Rtc.Minute);
#endif
#endif
/* BATTERY */
DISP.setCursor(DISP.width()-50, DISP.height()-20);
if(getBat() < 25) DISP.setTextColor(RED, BGCOLOR);
else if(getBat() < 75) DISP.setTextColor(YELLOW, BGCOLOR);
DISP.print(String(getBat()));
DISP.print("%");
/* Evil Portal indicator */
if(portal_active){
DISP.setTextColor(RED, BGCOLOR);
if(getBat()!=100) DISP.setCursor(DISP.width()-80, DISP.height()-20);
else DISP.setCursor(DISP.width()-90, DISP.height()-20);
DISP.print("EP");
}
DISP.setTextColor(FGCOLOR, BGCOLOR);
}
void mmenu_setup() {
cursor = 0;
rstOverride = true;
drawmenu(mmenu, mmenu_size);
DISP.fillRect(0, DISP.height()-25, DISP.width(), 25, BLACK);
menu_extras();
jammerActivated = false;
noTone(JAMMER);
Serial.printf("jammerActivated = false\n");
delay(500); // Prevent switching after menu loads up
}
void mmenu_loop() {
if (check_next_press()) {
cursor++;
cursor = cursor % mmenu_size;
drawmenu(mmenu, mmenu_size);
DISP.fillRect(0, DISP.height()-25, DISP.width(), 25, BLACK);
menu_extras();
delay(250);
}
if (check_select_press()) {
rstOverride = false;
isSwitching = true;
current_proc = mmenu[cursor].command;
}
menu_extras();
}
bool screen_dim_dimmed = false;
int screen_dim_time = 30;
int screen_dim_current = 0;
void screenBrightness(int bright){
Serial.printf("Brightness: %d\n", bright);
#if defined(AXP)
M5.Axp.ScreenBreath(10 + round(((100 - 10) * bright / 100)));
#endif
#if defined(BACKLIGHT)
int bl = MINBRIGHT + round(((255 - MINBRIGHT) * bright / 100));
analogWrite(BACKLIGHT, bl);
#endif
}
int uptime(){
return(int(millis() / 1000));
}
void dimtimer(){
if(screen_dim_dimmed){
screenBrightness(brightness);
screen_dim_dimmed = false;
}
screen_dim_current = uptime() + screen_dim_time + 2;
}
void screen_dim_proc() {
if(screen_dim_time > 0){
if (screen_dim_dimmed == false) {
if (uptime() == screen_dim_current || (uptime() + 1) == screen_dim_current || (uptime() + 2) == screen_dim_current) {
screenBrightness(0);
screen_dim_dimmed = true;
}
}
}
}
/// Dimmer MENU ///
MENU dmenu[] = {
{ TXT_BACK, screen_dim_time},
{ TXT_NEVER, 0},
{ ("5 " TXT_SEC), 5},
{ ("10 " TXT_SEC), 10},
{ ("15 " TXT_SEC), 15},
{ ("30 " TXT_SEC), 30},
{ ("60 " TXT_SEC), 60},
{ ("120 " TXT_MIN), 120},
{ ("240 " TXT_MIN), 240},
};
int dmenu_size = sizeof(dmenu) / sizeof(MENU);
void dmenu_setup() {
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 0);
DISP.println(String(TXT_AUTO_DIM));
delay(1000);
cursor = 0;
rstOverride = true;
drawmenu(dmenu, dmenu_size);
delay(500); // Prevent switching after menu loads up
}
void dmenu_loop() {
if (check_next_press()) {
cursor++;
cursor = cursor % dmenu_size;
drawmenu(dmenu, dmenu_size);
delay(250);
}
if (check_select_press()) {
screen_dim_time = dmenu[cursor].command;
#if defined(USE_EEPROM)
EEPROM.write(1, screen_dim_time);
EEPROM.commit();
#endif
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 0);
DISP.println(String(TXT_SET_BRIGHT));
delay(1000);
cursor = brightness / 10;
number_drawmenu(11);
while( !check_select_press()) {
if (check_next_press()) {
cursor++;
cursor = cursor % 11 ;
number_drawmenu(11);
screenBrightness(10 * cursor);
delay(250);
}
}
screenBrightness(10 * cursor);
#if defined(USE_EEPROM)
EEPROM.write(2, 10 * cursor);
EEPROM.commit();
#endif
rstOverride = false;
isSwitching = true;
current_proc = 2;
}
}
/// SETTINGS MENU ///
MENU smenu[] = {
{ TXT_BACK, 1},
#if defined(AXP) || defined(PWRMGMT)
{ TXT_BATT_INFO, 6},
#endif
#if defined(CARDPUTER)
{ TXT_BATT_INFO, 6},
#endif
{ TXT_BRIGHT, 4},
#if defined(RTC)
{ TXT_SET_CLOCK, 3},
#endif
#if defined(ROTATION)
{ TXT_ROTATION, 7},
#endif
#if defined(SDCARD)
#ifndef CARDPUTER
{ TXT_SDCARD, 97},
#endif
#endif
{ TXT_THEME, 23},
{ TXT_ABOUT, 10},
{ TXT_REBOOT, 98},
#if defined(USE_EEPROM)
{ TXT_CLR_SETTINGS, 99},
#endif
};
int smenu_size = sizeof(smenu) / sizeof (MENU);
void smenu_setup() {
cursor = 0;
rstOverride = true;
drawmenu(smenu, smenu_size);
delay(500); // Prevent switching after menu loads up
}
void clearSettings(){
#if defined(USE_EEPROM)
for(int i = 0; i < EEPROM_SIZE; i++) {
EEPROM.write(i, 255);
}
EEPROM.commit();
#endif
screenBrightness(100);
DISP.fillScreen(BLUE);
DISP.setTextSize(BIG_TEXT);
DISP.setRotation(1);
DISP.setTextColor(BLUE, WHITE);
DISP.setCursor(40, 0);
DISP.println("FK-NEMO");
DISP.setTextColor(WHITE, BLUE);
DISP.setTextSize(SMALL_TEXT);
DISP.println(TXT_CLRING_SETTINGS);
delay(5000);
ESP.restart();
}
void smenu_loop() {
if (check_next_press()) {
cursor++;
cursor = cursor % smenu_size;
drawmenu(smenu, smenu_size);
delay(250);
}
if (check_select_press()) {
rstOverride = false;
isSwitching = true;
if(smenu[cursor].command == 98){
ESP.restart();
}
if(smenu[cursor].command == 99){
clearSettings();
}
current_proc = smenu[cursor].command;
}
}
MENU cmenu[] = {
{ TXT_BACK, 0},
{ TXT_BLACK, 1},
{ TXT_NAVY, 2},
{ TXT_DARKGREEN, 3},
{ TXT_DARKCYAN, 4},
{ TXT_MAROON, 5},
{ TXT_PURPLE, 6},
{ TXT_OLIVE, 7},
{ TXT_LIGHTGREY, 8},
{ TXT_DARKGREY, 9},
{ TXT_BLUE, 10},
{ TXT_GREEN, 11},
{ TXT_CYAN, 12},
{ TXT_RED, 13},
{ TXT_MAGENTA, 14},
{ TXT_YELLOW, 15},
{ TXT_WHITE, 16},
{ TXT_ORANGE, 17},
{ TXT_GREENYELLOW, 18},
{ TXT_PINK, 19},
};
int cmenu_size = sizeof(cmenu) / sizeof (MENU);
void setcolor(bool fg, int col){
uint16_t color = 0x0000;
switch (col){
case 1:
color=0x0000;
break;
case 2:
color=0x000F;
break;
case 3:
color=0x03E0;
break;
case 4:
color=0x03EF;
break;
case 5:
color=0x7800;
break;
case 6:
color=0x780F;
break;
case 7:
color=0x7BE0;
break;
case 8:
color=0xC618;
break;
case 9:
color=0x7BEF;
break;
case 10:
color=0x001F;
break;
case 11:
color=0x07E0;
break;
case 12:
color=0x07FF;
break;
case 13:
color=0xF800;
break;
case 14:
color=0xF81F;
break;
case 15:
color=0xFFE0;
break;
case 16:
color=0xFFFF;
break;
case 17:
color=0xFDA0;
break;
case 18:
color=0xB7E0;
break;
case 19:
color=0xFC9F;
break;
}
if(fg){
FGCOLOR=color;
}else{
BGCOLOR=color;
}
if(FGCOLOR == BGCOLOR){
BGCOLOR = FGCOLOR ^ 0xFFFF;
}
DISP.setTextColor(FGCOLOR, BGCOLOR);
}
void color_setup() {
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 0);
DISP.println(String(TXT_SET_FGCOLOR));
cursor = 0;
#if defined(USE_EEPROM)
cursor=EEPROM.read(4); // get current fg color
#endif
rstOverride = true;
delay(1000);
drawmenu(cmenu, cmenu_size);
}
void color_loop() {
if (check_next_press()) {
setcolor(EEPROM.read(5), false);
cursor++;
cursor = cursor % cmenu_size;
setcolor(true, cursor);
drawmenu(cmenu, cmenu_size);
delay(250);
}
if (check_select_press()) {
#if defined(USE_EEPROM)
Serial.printf("EEPROM WRITE (4) FGCOLOR: %d\n", cursor);
EEPROM.write(4, cursor);
EEPROM.commit();
cursor=EEPROM.read(5); // get current bg color
#endif
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 0);
DISP.println(String(TXT_SET_BGCOLOR));
delay(1000);
setcolor(false, cursor);
drawmenu(cmenu, cmenu_size);
while( !check_select_press()) {
if (check_next_press()) {
cursor++;
cursor = cursor % cmenu_size ;
setcolor(false, cursor);
drawmenu(cmenu, cmenu_size);
delay(250);
}
}
#if defined(USE_EEPROM)
Serial.printf("EEPROM WRITE (5) BGCOLOR: %d\n", cursor);
EEPROM.write(5, cursor);
EEPROM.commit();
#endif
rstOverride = false;
isSwitching = true;
current_proc = 2;
}
}
MENU thmenu[] = {
{ TXT_BACK, 0},
{ "Nemo", 1},
{ "Tux", 2},
{ "Bill", 3},
{ "Steve", 4},
{ "Lilac", 5},
{ "Contrast", 6},
{ "NightShift", 7},
{ "Camo", 8},
{ "BubbleGum", 9},
{ TXT_COLOR, 99},
};
int thmenu_size = sizeof(thmenu) / sizeof (MENU);
void theme_setup() {
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 0);
DISP.println(String(TXT_THEME));
cursor = 0;
rstOverride = true;
delay(1000);
drawmenu(thmenu, thmenu_size);
}
int BG=0;
int FG=0;
void theme_loop() {
if (check_next_press()) {
cursor++;
cursor = cursor % thmenu_size;
switch (thmenu[cursor].command){
case 0:
FG=14;
BG=1;
break;
case 1: // Nemo
FG=11;
BG=1;
break;
case 2: // Tux
FG=8;
BG=1;
break;
case 3: // Bill
FG=16;
BG=10;
break;
case 4: // Steve
FG=1;
BG=8;
break;
case 5: // Lilac
FG=19;
BG=6;
break;
case 6: // Contrast
FG=16;
BG=1;
break;
case 7: // NightShift
FG=5;
BG=1;
break;
case 8: // Camo
FG=1;
BG=7;
break;
case 9: // BubbleGum
FG=1;
BG=19;
break;
case 99:
FG=11;
BG=1;
break;
}
setcolor(true, FG);
setcolor(false, BG);
drawmenu(thmenu, thmenu_size);
delay(250);
}
if (check_select_press()) {
switch (thmenu[cursor].command){
case 99:
rstOverride = false;
isSwitching = true;
current_proc = 22;
break;
case 0:
#if defined(USE_EEPROM)
setcolor(true, EEPROM.read(4));
setcolor(false, EEPROM.read(5));
#endif
rstOverride = false;
isSwitching = true;
current_proc = 2;
break;
default:
#if defined(USE_EEPROM)
Serial.printf("EEPROM WRITE (4) FGCOLOR: %d\n", FG);
EEPROM.write(4, FG);
Serial.printf("EEPROM WRITE (5) BGCOLOR: %d\n", BG);
EEPROM.write(5, BG);
EEPROM.commit();
#endif
rstOverride = false;
isSwitching = true;
current_proc = 2;
}
}
}
int rotation = 1;