Refactor all menus to a reusable drawmenu func
This commit is contained in:
parent
d5575819fe
commit
683c3b554d
319
m5stick-nemo.ino
319
m5stick-nemo.ino
|
@ -172,6 +172,44 @@ bool isSwitching = true;
|
||||||
int current_proc = 1; // Start in Main Menu mode if no RTC
|
int current_proc = 1; // Start in Main Menu mode if no RTC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void drawmenu(MENU thismenu[], int size) {
|
||||||
|
DISP.setTextSize(SMALL_TEXT);
|
||||||
|
DISP.fillScreen(BGCOLOR);
|
||||||
|
DISP.setCursor(0, 5, 1);
|
||||||
|
// scrolling menu
|
||||||
|
if (cursor > 5) {
|
||||||
|
for ( int i = 0 + (cursor - 5) ; i < size ; i++ ) {
|
||||||
|
DISP.print((cursor == i) ? ">" : " ");
|
||||||
|
DISP.println(thismenu[i].name);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (
|
||||||
|
int i = 0 ; i < size ; i++ ) {
|
||||||
|
DISP.print((cursor == i) ? ">" : " ");
|
||||||
|
DISP.println(thismenu[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void number_drawmenu(int nums) {
|
||||||
|
DISP.setTextSize(SMALL_TEXT);
|
||||||
|
DISP.fillScreen(BGCOLOR);
|
||||||
|
DISP.setCursor(0, 5, 1);
|
||||||
|
// scrolling menu
|
||||||
|
if (cursor > 5) {
|
||||||
|
for ( int i = 0 + (cursor - 5) ; i < nums ; i++ ) {
|
||||||
|
DISP.print((cursor == i) ? ">" : " ");
|
||||||
|
DISP.println(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (
|
||||||
|
int i = 0 ; i < nums ; i++ ) {
|
||||||
|
DISP.print((cursor == i) ? ">" : " ");
|
||||||
|
DISP.println(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void switcher_button_proc() {
|
void switcher_button_proc() {
|
||||||
if (rstOverride == false) {
|
if (rstOverride == false) {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
|
@ -250,29 +288,20 @@ MENU mmenu[] = {
|
||||||
{ "QR Codes", 18},
|
{ "QR Codes", 18},
|
||||||
{ "Settings", 2},
|
{ "Settings", 2},
|
||||||
};
|
};
|
||||||
|
int mmenu_size = sizeof(mmenu) / sizeof(MENU);
|
||||||
void mmenu_drawmenu() {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 8, 1);
|
|
||||||
for ( int i = 0 ; i < ( sizeof(mmenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(mmenu[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mmenu_setup() {
|
void mmenu_setup() {
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
mmenu_drawmenu();
|
drawmenu(mmenu, mmenu_size);
|
||||||
delay(500); // Prevent switching after menu loads up
|
delay(500); // Prevent switching after menu loads up
|
||||||
}
|
}
|
||||||
|
|
||||||
void mmenu_loop() {
|
void mmenu_loop() {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % ( sizeof(mmenu) / sizeof(MENU) );
|
cursor = cursor % mmenu_size;
|
||||||
mmenu_drawmenu();
|
drawmenu(mmenu, mmenu_size);
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
if (check_select_press()) {
|
if (check_select_press()) {
|
||||||
|
@ -320,76 +349,67 @@ void screen_dim_proc() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Dimmer MENU ///
|
/// Dimmer MENU ///
|
||||||
MENU dmenu[] = {
|
MENU dmenu[] = {
|
||||||
{ "Back", screen_dim_time},
|
{ "Back", screen_dim_time},
|
||||||
{ "5 seconds", 5},
|
{ "5 seconds", 5},
|
||||||
{ "10 seconds", 10},
|
{ "10 seconds", 10},
|
||||||
{ "15 seconds", 15},
|
{ "15 seconds", 15},
|
||||||
{ "20 seconds", 20},
|
{ "20 seconds", 20},
|
||||||
{ "25 seconds", 25},
|
{ "25 seconds", 25},
|
||||||
{ "30 seconds", 30},
|
{ "30 seconds", 30},
|
||||||
};
|
};
|
||||||
|
int dmenu_size = sizeof(dmenu) / sizeof(MENU);
|
||||||
|
|
||||||
void dmenu_drawmenu() {
|
void dmenu_setup() {
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
DISP.fillScreen(BGCOLOR);
|
||||||
DISP.fillScreen(BGCOLOR);
|
DISP.setCursor(0, 5, 1);
|
||||||
DISP.setCursor(0, 8, 1);
|
DISP.println("SET AUTO DIM TIME");
|
||||||
for ( int i = 0 ; i < ( sizeof(dmenu) / sizeof(MENU) ) ; i++ ) {
|
delay(1000);
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
cursor = (screen_dim_time / 5) - 1;
|
||||||
DISP.println(dmenu[i].name);
|
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()) {
|
||||||
void dmenu_setup() {
|
screen_dim_time = dmenu[cursor].command;
|
||||||
|
#if defined(USE_EEPROM)
|
||||||
|
EEPROM.write(1, screen_dim_time);
|
||||||
|
EEPROM.commit();
|
||||||
|
#endif
|
||||||
DISP.fillScreen(BGCOLOR);
|
DISP.fillScreen(BGCOLOR);
|
||||||
DISP.setCursor(0, 5, 1);
|
DISP.setCursor(0, 5, 1);
|
||||||
DISP.println("SET AUTO DIM TIME");
|
DISP.println("SET BRIGHTNESS");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
cursor = (screen_dim_time / 5) - 1;
|
cursor = brightness / 10;
|
||||||
rstOverride = true;
|
number_drawmenu(11);
|
||||||
dmenu_drawmenu();
|
while( !check_select_press()) {
|
||||||
delay(500); // Prevent switching after menu loads up
|
if (check_next_press()) {
|
||||||
}
|
cursor++;
|
||||||
|
cursor = cursor % 11 ;
|
||||||
void dmenu_loop() {
|
number_drawmenu(11);
|
||||||
if (check_next_press()) {
|
screenBrightness(10 * cursor);
|
||||||
cursor++;
|
delay(250);
|
||||||
cursor = cursor % ( sizeof(dmenu) / sizeof(MENU) );
|
}
|
||||||
dmenu_drawmenu();
|
|
||||||
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, 5, 1);
|
|
||||||
DISP.println("SET BRIGHTNESS");
|
|
||||||
delay(1000);
|
|
||||||
cursor = brightness / 10;
|
|
||||||
timeset_drawmenu(11);
|
|
||||||
while( !check_select_press()) {
|
|
||||||
if (check_next_press()) {
|
|
||||||
cursor++;
|
|
||||||
cursor = cursor % 11 ;
|
|
||||||
timeset_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;
|
|
||||||
}
|
}
|
||||||
|
screenBrightness(10 * cursor);
|
||||||
|
#if defined(USE_EEPROM)
|
||||||
|
EEPROM.write(2, 10 * cursor);
|
||||||
|
EEPROM.commit();
|
||||||
|
#endif
|
||||||
|
rstOverride = false;
|
||||||
|
isSwitching = true;
|
||||||
|
current_proc = 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// SETTINGS MENU ///
|
/// SETTINGS MENU ///
|
||||||
MENU smenu[] = {
|
MENU smenu[] = {
|
||||||
|
@ -409,29 +429,20 @@ MENU smenu[] = {
|
||||||
{ "Clear Settings", 99},
|
{ "Clear Settings", 99},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
int smenu_size = sizeof(smenu) / sizeof (MENU);
|
||||||
void smenu_drawmenu() {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 8, 1);
|
|
||||||
for ( int i = 0 ; i < ( sizeof(smenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(smenu[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void smenu_setup() {
|
void smenu_setup() {
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
smenu_drawmenu();
|
drawmenu(smenu, smenu_size);
|
||||||
delay(500); // Prevent switching after menu loads up
|
delay(500); // Prevent switching after menu loads up
|
||||||
}
|
}
|
||||||
|
|
||||||
void smenu_loop() {
|
void smenu_loop() {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % ( sizeof(smenu) / sizeof(MENU) );
|
cursor = cursor % smenu_size;
|
||||||
smenu_drawmenu();
|
drawmenu(smenu, smenu_size);
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
if (check_select_press()) {
|
if (check_select_press()) {
|
||||||
|
@ -459,29 +470,20 @@ int rotation = 1;
|
||||||
{ "Right", 1},
|
{ "Right", 1},
|
||||||
{ "Left", 3},
|
{ "Left", 3},
|
||||||
};
|
};
|
||||||
|
int rmenu_size = sizeof(rmenu) / sizeof (MENU);
|
||||||
void rmenu_drawmenu() {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 8, 1);
|
|
||||||
for ( int i = 0 ; i < ( sizeof(rmenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(rmenu[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rmenu_setup() {
|
void rmenu_setup() {
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
rmenu_drawmenu();
|
drawmenu(rmenu, rmenu_size);
|
||||||
delay(500); // Prevent switching after menu loads up
|
delay(500); // Prevent switching after menu loads up
|
||||||
}
|
}
|
||||||
|
|
||||||
void rmenu_loop() {
|
void rmenu_loop() {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % ( sizeof(rmenu) / sizeof(MENU) );
|
cursor = cursor % rmenu_size;
|
||||||
rmenu_drawmenu();
|
drawmenu(rmenu, rmenu_size);
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
if (check_select_press()) {
|
if (check_select_press()) {
|
||||||
|
@ -532,7 +534,7 @@ int rotation = 1;
|
||||||
if (check_select_press()) {
|
if (check_select_press()) {
|
||||||
rstOverride = false;
|
rstOverride = false;
|
||||||
isSwitching = true;
|
isSwitching = true;
|
||||||
current_proc = 1;
|
current_proc = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // AXP
|
#endif // AXP
|
||||||
|
@ -575,16 +577,7 @@ MENU tvbgmenu[] = {
|
||||||
{ "Americas / Asia", 0},
|
{ "Americas / Asia", 0},
|
||||||
{ "EU/MidEast/Africa", 1},
|
{ "EU/MidEast/Africa", 1},
|
||||||
};
|
};
|
||||||
|
int tvbgmenu_size = sizeof(tvbgmenu) / sizeof (MENU);
|
||||||
void tvbgmenu_drawmenu() {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 8, 1);
|
|
||||||
for ( int i = 0 ; i < ( sizeof(tvbgmenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(tvbgmenu[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void tvbgmenu_setup() {
|
void tvbgmenu_setup() {
|
||||||
DISP.fillScreen(BGCOLOR);
|
DISP.fillScreen(BGCOLOR);
|
||||||
|
@ -596,14 +589,14 @@ void tvbgmenu_setup() {
|
||||||
cursor = region % 2;
|
cursor = region % 2;
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
delay(1000);
|
delay(1000);
|
||||||
tvbgmenu_drawmenu();
|
drawmenu(tvbgmenu, tvbgmenu_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tvbgmenu_loop() {
|
void tvbgmenu_loop() {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % ( sizeof(tvbgmenu) / sizeof(MENU) );
|
cursor = cursor % tvbgmenu_size;
|
||||||
tvbgmenu_drawmenu();
|
drawmenu(tvbgmenu, tvbgmenu_size);
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
if (check_select_press()) {
|
if (check_select_press()) {
|
||||||
|
@ -708,25 +701,7 @@ void sendAllCodes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CLOCK ///
|
/// CLOCK ///
|
||||||
/// TIMESET ///
|
/// TIMESET ///
|
||||||
void timeset_drawmenu(int nums) {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 5, 1);
|
|
||||||
// scrolling menu
|
|
||||||
if (cursor > 5) {
|
|
||||||
for ( int i = 0 + (cursor - 5) ; i < nums ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(i);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (
|
|
||||||
int i = 0 ; i < nums ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(RTC)
|
#if defined(RTC)
|
||||||
void clock_setup() {
|
void clock_setup() {
|
||||||
|
@ -753,12 +728,12 @@ void sendAllCodes() {
|
||||||
void timeset_loop() {
|
void timeset_loop() {
|
||||||
M5.Rtc.GetBm8563Time();
|
M5.Rtc.GetBm8563Time();
|
||||||
cursor = M5.Rtc.Hour;
|
cursor = M5.Rtc.Hour;
|
||||||
timeset_drawmenu(24);
|
number_drawmenu(24);
|
||||||
while(digitalRead(M5_BUTTON_HOME) == HIGH) {
|
while(digitalRead(M5_BUTTON_HOME) == HIGH) {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % 24 ;
|
cursor = cursor % 24 ;
|
||||||
timeset_drawmenu(24);
|
number_drawmenu(24);
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,12 +743,12 @@ void sendAllCodes() {
|
||||||
DISP.println("SET MINUTE");
|
DISP.println("SET MINUTE");
|
||||||
delay(2000);
|
delay(2000);
|
||||||
cursor = M5.Rtc.Minute;
|
cursor = M5.Rtc.Minute;
|
||||||
timeset_drawmenu(60);
|
number_drawmenu(60);
|
||||||
while(digitalRead(M5_BUTTON_HOME) == HIGH) {
|
while(digitalRead(M5_BUTTON_HOME) == HIGH) {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % 60 ;
|
cursor = cursor % 60 ;
|
||||||
timeset_drawmenu(60);
|
number_drawmenu(60);
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -803,16 +778,7 @@ MENU btmenu[] = {
|
||||||
{ "SourApple Crash", 2},
|
{ "SourApple Crash", 2},
|
||||||
{ "BT Maelstrom", 3},
|
{ "BT Maelstrom", 3},
|
||||||
};
|
};
|
||||||
|
int btmenu_size = sizeof(btmenu) / sizeof (MENU);
|
||||||
void btmenu_drawmenu() {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 8, 1);
|
|
||||||
for ( int i = 0 ; i < ( sizeof(btmenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(btmenu[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void btmenu_setup() {
|
void btmenu_setup() {
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
|
@ -821,15 +787,15 @@ void btmenu_setup() {
|
||||||
maelstrom = false;
|
maelstrom = false;
|
||||||
androidPair = false;
|
androidPair = false;
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
btmenu_drawmenu();
|
drawmenu(btmenu, btmenu_size);
|
||||||
delay(500); // Prevent switching after menu loads up
|
delay(500); // Prevent switching after menu loads up
|
||||||
}
|
}
|
||||||
|
|
||||||
void btmenu_loop() {
|
void btmenu_loop() {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % ( sizeof(btmenu) / sizeof(MENU) );
|
cursor = cursor % btmenu_size;
|
||||||
btmenu_drawmenu();
|
drawmenu(btmenu, btmenu_size);
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
if (check_select_press()) {
|
if (check_select_press()) {
|
||||||
|
@ -922,25 +888,7 @@ MENU ajmenu[] = {
|
||||||
{ "TV Color Balance", 26},
|
{ "TV Color Balance", 26},
|
||||||
{ "Setup New Phone", 28},
|
{ "Setup New Phone", 28},
|
||||||
};
|
};
|
||||||
|
int ajmenu_size = sizeof(ajmenu) / sizeof (MENU);
|
||||||
void aj_drawmenu() {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 5, 1);
|
|
||||||
// scrolling menu
|
|
||||||
if (cursor > 5) {
|
|
||||||
for ( int i = 0 + (cursor - 5) ; i < ( sizeof(ajmenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(ajmenu[i].name);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (
|
|
||||||
int i = 0 ; i < ( sizeof(ajmenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(ajmenu[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void aj_setup(){
|
void aj_setup(){
|
||||||
DISP.fillScreen(BGCOLOR);
|
DISP.fillScreen(BGCOLOR);
|
||||||
|
@ -953,15 +901,15 @@ void aj_setup(){
|
||||||
swiftPair = false;
|
swiftPair = false;
|
||||||
maelstrom = false;
|
maelstrom = false;
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
aj_drawmenu();
|
drawmenu(ajmenu, ajmenu_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void aj_loop(){
|
void aj_loop(){
|
||||||
if (!maelstrom){
|
if (!maelstrom){
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % ( sizeof(ajmenu) / sizeof(MENU) );
|
cursor = cursor % ajmenu_size;
|
||||||
aj_drawmenu();
|
drawmenu(ajmenu, ajmenu_size);
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1197,11 +1145,11 @@ void aj_adv(){
|
||||||
if (sourApple || swiftPair || androidPair || maelstrom){
|
if (sourApple || swiftPair || androidPair || maelstrom){
|
||||||
isSwitching = true;
|
isSwitching = true;
|
||||||
current_proc = 16;
|
current_proc = 16;
|
||||||
btmenu_drawmenu();
|
drawmenu(btmenu, btmenu_size);
|
||||||
} else {
|
} else {
|
||||||
isSwitching = true;
|
isSwitching = true;
|
||||||
current_proc = 8;
|
current_proc = 8;
|
||||||
aj_drawmenu();
|
drawmenu(ajmenu, ajmenu_size);
|
||||||
}
|
}
|
||||||
sourApple = false;
|
sourApple = false;
|
||||||
swiftPair = false;
|
swiftPair = false;
|
||||||
|
@ -1367,29 +1315,20 @@ MENU wsmenu[] = {
|
||||||
{ "Spam Rickroll", 2},
|
{ "Spam Rickroll", 2},
|
||||||
{ "Spam Random", 3},
|
{ "Spam Random", 3},
|
||||||
};
|
};
|
||||||
|
int wsmenu_size = sizeof(wsmenu) / sizeof (MENU);
|
||||||
void wsmenu_drawmenu() {
|
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
|
||||||
DISP.fillScreen(BGCOLOR);
|
|
||||||
DISP.setCursor(0, 8, 1);
|
|
||||||
for ( int i = 0 ; i < ( sizeof(wsmenu) / sizeof(MENU) ) ; i++ ) {
|
|
||||||
DISP.print((cursor == i) ? ">" : " ");
|
|
||||||
DISP.println(wsmenu[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wsmenu_setup() {
|
void wsmenu_setup() {
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
wsmenu_drawmenu();
|
drawmenu(wsmenu, wsmenu_size);
|
||||||
delay(500); // Prevent switching after menu loads up
|
delay(500); // Prevent switching after menu loads up
|
||||||
}
|
}
|
||||||
|
|
||||||
void wsmenu_loop() {
|
void wsmenu_loop() {
|
||||||
if (check_next_press()) {
|
if (check_next_press()) {
|
||||||
cursor++;
|
cursor++;
|
||||||
cursor = cursor % ( sizeof(wsmenu) / sizeof(MENU) );
|
cursor = cursor % wsmenu_size;
|
||||||
wsmenu_drawmenu();
|
drawmenu(wsmenu, wsmenu_size);
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
if (check_select_press()) {
|
if (check_select_press()) {
|
||||||
|
@ -1547,7 +1486,7 @@ void bootScreen(){
|
||||||
while(true){
|
while(true){
|
||||||
M5Cardputer.update();
|
M5Cardputer.update();
|
||||||
if (M5Cardputer.Keyboard.isChange()) {
|
if (M5Cardputer.Keyboard.isChange()) {
|
||||||
mmenu_drawmenu();
|
drawmenu(mmenu, mmenu_size);
|
||||||
delay(250);
|
delay(250);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue