From 39c3f4ae0466fcfa9f6620bd49ed26757c367431 Mon Sep 17 00:00:00 2001 From: pandx Date: Sun, 17 Nov 2024 09:37:04 +0800 Subject: [PATCH 1/3] modify update and upgrade clear logic. --- scheduler/update_cfg.cpp | 6 +++++- scheduler/upgrade_cfg.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scheduler/update_cfg.cpp b/scheduler/update_cfg.cpp index 341d1d9..66e79ae 100644 --- a/scheduler/update_cfg.cpp +++ b/scheduler/update_cfg.cpp @@ -35,7 +35,11 @@ int UpdateCfg::ReadCfg(std::unordered_set& update) { return 0; } -int UpdateCfg::WriteCfg(std::unordered_set &update) { +int UpdateCfg::WriteCfg(std::unordered_set &update) { + if (update.size() == 0) { + ClearCfg(); + return 0; + } Json::Value root; for (auto item : update) { root.append(item); diff --git a/scheduler/upgrade_cfg.cpp b/scheduler/upgrade_cfg.cpp index 2beb7cb..09eb1c6 100644 --- a/scheduler/upgrade_cfg.cpp +++ b/scheduler/upgrade_cfg.cpp @@ -51,6 +51,10 @@ int UpgradeCfg::ReadCfg(std::map &upgrade) { } int UpgradeCfg::WriteCfg(std::map &upgrade) { + if (upgrade.size() == 0) { + ClearCfg(); + return 0; + } Json::Value root; for (auto item : upgrade) { Json::Value upgrade_item; From b40651380415a00b37bf52ef15c913fd50108926 Mon Sep 17 00:00:00 2001 From: pandx Date: Sun, 17 Nov 2024 10:40:05 +0800 Subject: [PATCH 2/3] modify project output. --- .cproject | 2 +- .settings/language.settings.xml | 4 ++-- uart/uart.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.cproject b/.cproject index 17b8cd2..41e7f75 100644 --- a/.cproject +++ b/.cproject @@ -101,7 +101,7 @@ - +