Cart_Reader.ino: Drop convertPgm(const char* const [], byte, byte)

This avoids code duplication between it and
  convertPgm(const char* const [], byte)
for just 3 callers, when the callers can be easily updated to call the
latter.
This commit is contained in:
Vincent Pelletier 2022-10-22 08:21:24 +00:00
parent dc391541b4
commit 92f8626687

View File

@ -853,17 +853,17 @@ void mainMenu() {
while (1) { while (1) {
if (currPage == 1) { if (currPage == 1) {
// Copy menuOptions out of progmem // Copy menuOptions out of progmem
convertPgm(modeOptions, 0, 7); convertPgm(modeOptions + 0, 7);
modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 7, 0); modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 7, 0);
} }
if (currPage == 2) { if (currPage == 2) {
// Copy menuOptions out of progmem // Copy menuOptions out of progmem
convertPgm(modeOptions, 7, 7); convertPgm(modeOptions + 7, 7);
modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 7, 0); modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 7, 0);
} }
if (currPage == 3) { if (currPage == 3) {
// Copy menuOptions out of progmem // Copy menuOptions out of progmem
convertPgm(modeOptions, 14, 2); convertPgm(modeOptions + 14, 2);
modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 2, 0); modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 2, 0);
} }
if (numPages == 0) { if (numPages == 0) {
@ -1862,13 +1862,6 @@ void setColor_RGB(byte r, byte g, byte b) {
#endif #endif
} }
// Converts a progmem array into a ram array
void convertPgm(const char* const pgmOptions[], byte startArray, byte numArrays) {
for (int i = 0; i < numArrays; i++) {
strlcpy_P(menuOptions[i], (char*)pgm_read_word(&(pgmOptions[i + startArray])), 20);
}
}
// Converts a progmem array into a ram array // Converts a progmem array into a ram array
void convertPgm(const char* const pgmOptions[], byte numArrays) { void convertPgm(const char* const pgmOptions[], byte numArrays) {
for (int i = 0; i < numArrays; i++) { for (int i = 0; i < numArrays; i++) {