Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct size for nameBuffer #262

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
Loading