From 92890d492a2dea43837591de79ffec828b50d6e2 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 30 Jun 2022 21:38:06 +0200 Subject: fallback on unset device config var --- src/config/ConfigManager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/config/ConfigManager.cpp') 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; } -- cgit v1.2.3