Allow configuration of the TX PA Level of the CMT2300A module

This commit is contained in:
Thomas Basler
2023-03-28 21:48:57 +02:00
parent bec9870347
commit 854fcdaeae
10 changed files with 104 additions and 52 deletions

View File

@@ -79,7 +79,8 @@ bool ConfigurationClass::write()
JsonObject dtu = doc.createNestedObject("dtu");
dtu["serial"] = config.Dtu_Serial;
dtu["poll_interval"] = config.Dtu_PollInterval;
dtu["pa_level"] = config.Dtu_PaLevel;
dtu["nrf_pa_level"] = config.Dtu_NrfPaLevel;
dtu["cmt_pa_level"] = config.Dtu_CmtPaLevel;
JsonObject security = doc.createNestedObject("security");
security["password"] = config.Security_Password;
@@ -219,7 +220,8 @@ bool ConfigurationClass::read()
JsonObject dtu = doc["dtu"];
config.Dtu_Serial = dtu["serial"] | DTU_SERIAL;
config.Dtu_PollInterval = dtu["poll_interval"] | DTU_POLL_INTERVAL;
config.Dtu_PaLevel = dtu["pa_level"] | DTU_PA_LEVEL;
config.Dtu_NrfPaLevel = dtu["nrf_pa_level"] | DTU_NRF_PA_LEVEL;
config.Dtu_CmtPaLevel = dtu["cmt_pa_level"] | DTU_CMT_PA_LEVEL;
JsonObject security = doc["security"];
strlcpy(config.Security_Password, security["password"] | ACCESS_POINT_PASSWORD, sizeof(config.Security_Password));
@@ -290,6 +292,11 @@ void ConfigurationClass::migrate()
config.Mqtt_PublishInterval = mqtt["publish_invterval"];
}
if (config.Cfg_Version < 0x00011900) {
JsonObject dtu = doc["dtu"];
config.Dtu_NrfPaLevel = dtu["pa_level"];
}
f.close();
config.Cfg_Version = CONFIG_VERSION;