webapp: Remove hard coded min/max frequencies for CMT module

This commit is contained in:
Thomas Basler 2024-01-13 12:48:28 +01:00
parent ee78698e37
commit 2c92750100
5 changed files with 15 additions and 3 deletions

View File

@ -201,6 +201,11 @@ uint32_t HoymilesRadio_CMT::getMaxFrequency()
return MAX_FREQ;
}
uint32_t HoymilesRadio_CMT::getChannelWidth()
{
return FH_OFFSET * CMT2300A_ONE_STEP_SIZE;
}
void ARDUINO_ISR_ATTR HoymilesRadio_CMT::handleInt1()
{
_packetSent = true;

View File

@ -28,6 +28,7 @@ public:
static uint32_t getMinFrequency();
static uint32_t getMaxFrequency();
static uint32_t getChannelWidth();
static uint32_t getFrequencyFromChannel(const uint8_t channel);
static uint8_t getChannelFromFrequency(const uint32_t frequency);

View File

@ -45,6 +45,9 @@ void WebApiDtuClass::onDtuAdminGet(AsyncWebServerRequest* request)
root["cmt_enabled"] = Hoymiles.getRadioCmt()->isInitialized();
root["cmt_palevel"] = config.Dtu.Cmt.PaLevel;
root["cmt_frequency"] = config.Dtu.Cmt.Frequency;
root["cmt_min_freq"] = Hoymiles.getRadioCmt()->getMinFrequency();
root["cmt_max_freq"] = Hoymiles.getRadioCmt()->getMaxFrequency();
root["cmt_chan_width"] = Hoymiles.getRadioCmt()->getChannelWidth();
response->setLength();
request->send(response);
@ -166,4 +169,4 @@ void WebApiDtuClass::onDtuAdminPost(AsyncWebServerRequest* request)
Hoymiles.getRadioCmt()->setDtuSerial(config.Dtu.Serial);
Hoymiles.getRadioCmt()->setInverterTargetFrequency(config.Dtu.Cmt.Frequency);
Hoymiles.setPollInterval(config.Dtu.PollInterval);
}
}

View File

@ -6,4 +6,7 @@ export interface DtuConfig {
cmt_enabled: boolean;
cmt_palevel: number;
cmt_frequency: number;
}
cmt_min_freq: number;
cmt_max_freq: number;
cmt_chan_width: number;
}

View File

@ -56,7 +56,7 @@
<div class="input-group mb-3">
<input type="range" class="form-control form-range"
v-model="dtuConfigList.cmt_frequency"
min="860250000" max="923500000" step="250000"
:min="dtuConfigList.cmt_min_freq" :max="dtuConfigList.cmt_max_freq" :step="dtuConfigList.cmt_chan_width"
id="cmtFrequency" aria-describedby="basic-addon2"
style="height: unset;" />
<span class="input-group-text" id="basic-addon2">{{ cmtFrequencyText }}</span>