summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-30 21:38:06 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-30 21:38:06 +0200
commit92890d492a2dea43837591de79ffec828b50d6e2 (patch)
treeb33d843cb2d7ee3f5a7e884ca9f2c85bc89dca68 /src
parentd010ca20492c7638d15690e888d80c6020685df1 (diff)
fallback on unset device config var
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp11
-rw-r--r--src/config/ConfigManager.hpp2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index d76a1800..215d71c0 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -180,6 +180,8 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
CONFIGENTRY = &configValues.at(COMMAND);
}
+ CONFIGENTRY->set = true;
+
if (CONFIGENTRY->intValue != -1) {
try {
if (VALUE.find("0x") == 0) {
@@ -910,6 +912,15 @@ SConfigValue CConfigManager::getConfigValueSafeDevice(const std::string& dev, co
SConfigValue copy = it->second[val];
+ // fallback if not set explicitly
+ if (!copy.set) {
+ for (auto& cv : configValues) {
+ if (cv.first.find(val) == cv.first.length() - val.length()) {
+ copy = cv.second;
+ }
+ }
+ }
+
return copy;
}
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index 57124ece..bcb2fbe5 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -20,6 +20,8 @@ struct SConfigValue {
int64_t intValue = -1;
float floatValue = -1;
std::string strValue = "";
+
+ bool set = false; // used for device configs
};
struct SMonitorRule {