From 836f9f54dcf32f6a64bf4bf17d3ffb685cf8173b Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Mon, 23 Oct 2023 21:07:01 +0200 Subject: [PATCH 1/2] use intended size for nameBuffer --- CustomDevices | 1 + src/Config.cpp | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) create mode 160000 CustomDevices diff --git a/CustomDevices b/CustomDevices new file mode 160000 index 00000000..9f716ee4 --- /dev/null +++ b/CustomDevices @@ -0,0 +1 @@ +Subproject commit 9f716ee4a1a0aac9c25d02437e795f7751c6fd98 diff --git a/src/Config.cpp b/src/Config.cpp index 55050c57..7ea80301 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -66,11 +66,11 @@ char serial[11] = MOBIFLIGHT_SERIAL; // 3 characters for "SN-",7 characters for #elif defined(ARDUINO_ARCH_RP2040) char serial[3 + UniqueIDsize * 2 + 1] = MOBIFLIGHT_SERIAL; // 3 characters for "SN-", UniqueID as HEX String, terminating NULL #endif -char name[MEM_LEN_NAME] = MOBIFLIGHT_NAME; -const int MEM_LEN_CONFIG = MEMLEN_CONFIG; -char nameBuffer[MEM_LEN_CONFIG] = ""; -uint16_t configLength = 0; -boolean configActivated = false; +char name[MEM_LEN_NAME] = MOBIFLIGHT_NAME; +const int MEM_LEN_CONFIG = MEMLEN_CONFIG; +char nameBuffer[MEMLEN_NAMES_BUFFER] = ""; +uint16_t configLength = 0; +boolean configActivated = false; void resetConfig(); void readConfig(); @@ -238,7 +238,7 @@ bool readEndCommandFromEEPROM(uint16_t *addreeprom, uint8_t delimiter) temp = MFeeprom.read_byte((*addreeprom)++); if (*addreeprom > length) // abort if EEPROM size will be exceeded return false; - } while (temp != delimiter); // reads until limiter ':' + } while (temp != delimiter); // reads until limiter ':' return true; } @@ -418,18 +418,18 @@ void readConfig() #if MF_CUSTOMDEVICE_SUPPORT == 1 case kTypeCustomDevice: { - uint16_t adrType = addreeprom; // first location of custom Type in EEPROM - copy_success = readEndCommandFromEEPROM(&addreeprom, '.'); + uint16_t adrType = addreeprom; // first location of custom Type in EEPROM + copy_success = readEndCommandFromEEPROM(&addreeprom, '.'); if (!copy_success) break; - uint16_t adrPin = addreeprom; // first location of custom pins in EEPROM - copy_success = readEndCommandFromEEPROM(&addreeprom, '.'); + uint16_t adrPin = addreeprom; // first location of custom pins in EEPROM + copy_success = readEndCommandFromEEPROM(&addreeprom, '.'); if (!copy_success) break; - uint16_t adrConfig = addreeprom; // first location of custom config in EEPROM - copy_success = readEndCommandFromEEPROM(&addreeprom, '.'); + uint16_t adrConfig = addreeprom; // first location of custom config in EEPROM + copy_success = readEndCommandFromEEPROM(&addreeprom, '.'); if (copy_success) { CustomDevice::Add(adrPin, adrType, adrConfig); copy_success = readEndCommandFromEEPROM(&addreeprom, ':'); // check EEPROM until end of command From 0c89f5f809dcd0b21f1b91ac6c3ca7a1f64be4e2 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Mon, 23 Oct 2023 22:07:47 +0200 Subject: [PATCH 2/2] not required folder deleted --- CustomDevices | 1 - 1 file changed, 1 deletion(-) delete mode 160000 CustomDevices diff --git a/CustomDevices b/CustomDevices deleted file mode 160000 index 9f716ee4..00000000 --- a/CustomDevices +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9f716ee4a1a0aac9c25d02437e795f7751c6fd98