From 92f86266871e37fc363a07f13842c3a47861d012 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier Date: Sat, 22 Oct 2022 08:21:24 +0000 Subject: [PATCH] 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. --- Cart_Reader/Cart_Reader.ino | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index cb89193..67d7f68 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -853,17 +853,17 @@ void mainMenu() { while (1) { if (currPage == 1) { // Copy menuOptions out of progmem - convertPgm(modeOptions, 0, 7); + convertPgm(modeOptions + 0, 7); modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 7, 0); } if (currPage == 2) { // Copy menuOptions out of progmem - convertPgm(modeOptions, 7, 7); + convertPgm(modeOptions + 7, 7); modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 7, 0); } if (currPage == 3) { // Copy menuOptions out of progmem - convertPgm(modeOptions, 14, 2); + convertPgm(modeOptions + 14, 2); modeMenu = question_box(F("OPEN SOURCE CART READER"), menuOptions, 2, 0); } if (numPages == 0) { @@ -1862,13 +1862,6 @@ void setColor_RGB(byte r, byte g, byte b) { #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 void convertPgm(const char* const pgmOptions[], byte numArrays) { for (int i = 0; i < numArrays; i++) {