mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 16:25:45 +08:00
permit inline comment and ScreenLayout of Nextion
two minor improvements - ScreenLayout in Nextion section can use hexadecimal (0xXXXXX), octal (0XXXX) and decimal value - in-line comment enabled example: # conventional comment, the line starts with # [Section] Key=value # this is new style comment Key="quoted value # this is not comment" Key="quoted value" # this is prohibited (not comment)
This commit is contained in:
5
Conf.cpp
5
Conf.cpp
@@ -390,6 +390,9 @@ bool CConf::read()
|
|||||||
if (len > 1U && *value == '"' && value[len - 1U] == '"') {
|
if (len > 1U && *value == '"' && value[len - 1U] == '"') {
|
||||||
value[len - 1U] = '\0';
|
value[len - 1U] = '\0';
|
||||||
value++;
|
value++;
|
||||||
|
} else {
|
||||||
|
// if value is not quoted, remove after # (to make comment)
|
||||||
|
strtok(value, "#");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section == SECTION_GENERAL) {
|
if (section == SECTION_GENERAL) {
|
||||||
@@ -916,7 +919,7 @@ bool CConf::read()
|
|||||||
else if (::strcmp(key, "IdleBrightness") == 0)
|
else if (::strcmp(key, "IdleBrightness") == 0)
|
||||||
m_nextionIdleBrightness = (unsigned int)::atoi(value);
|
m_nextionIdleBrightness = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "ScreenLayout") == 0)
|
else if (::strcmp(key, "ScreenLayout") == 0)
|
||||||
m_nextionScreenLayout = (unsigned int)::atoi(value);
|
m_nextionScreenLayout = (unsigned int)::strtoul(value, NULL, 0);
|
||||||
else if (::strcmp(key, "DisplayTempInFahrenheit") == 0)
|
else if (::strcmp(key, "DisplayTempInFahrenheit") == 0)
|
||||||
m_nextionTempInFahrenheit = ::atoi(value) == 1;
|
m_nextionTempInFahrenheit = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_OLED) {
|
} else if (section == SECTION_OLED) {
|
||||||
|
|||||||
Reference in New Issue
Block a user