Cart_Reader.ino: Factorise missing module error.

Also, handle one such case in the HW3 main menu.
This commit is contained in:
Vincent Pelletier 2022-10-30 00:36:59 +00:00
parent 25b615f77c
commit 0a823bf5b7

View File

@ -889,6 +889,12 @@ byte starting_letter() {
#endif #endif
} }
void print_MissingModule(void) {
display_Clear();
println_Msg(F("Please enable module"));
print_FatalError(F("in Cart_Reader.ino."));
}
/****************************************** /******************************************
Main menu optimized for rotary encoder Main menu optimized for rotary encoder
*****************************************/ *****************************************/
@ -1067,10 +1073,7 @@ void mainMenu() {
break; break;
default: default:
display_Clear(); print_MissingModule(); // does not return
println_Msg(F("Please enable module"));
print_Error(F("in Cart_Reader.ino."), true);
break;
} }
} }
@ -1162,6 +1165,9 @@ void mainMenu() {
case 6: case 6:
resetArduino(); resetArduino();
break; break;
default:
print_MissingModule(); // does not return
} }
} }
@ -1200,10 +1206,7 @@ void addonMenu() {
break; break;
default: default:
display_Clear(); print_MissingModule(); // does not return
println_Msg(F("Please enable module"));
print_Error(F("in Cart_Reader.ino."), true);
break;
} }
} }
@ -1259,10 +1262,7 @@ void consoleMenu() {
break; break;
default: default:
display_Clear(); print_MissingModule(); // does not return
println_Msg(F("Please enable module"));
print_Error(F("in Cart_Reader.ino."), true);
break;
} }
} }
@ -1320,10 +1320,7 @@ void handheldMenu() {
break; break;
default: default:
display_Clear(); print_MissingModule(); // does not return
println_Msg(F("Please enable module"));
print_Error(F("in Cart_Reader.ino."), true);
break;
} }
} }
#endif #endif