Fix: Set correct frequency when changing it via web ui

Previously it could happen that the frequency was changed between saving old and recovering new frequency. Therefor an invalid frequency was saved in the CMT module
This commit is contained in:
Thomas Basler 2023-04-13 19:11:18 +02:00
parent f1f4322db5
commit f3942bb647

View File

@ -267,8 +267,6 @@ void HoymilesRadio_CMT::sendEsbPacket(CommandAbstract* cmd)
_radio->stopListening(); _radio->stopListening();
uint8_t oldChannel;
oldChannel = _radio->getChannel();
if (cmd->getDataPayload()[0] == 0x56) { // @todo(tbnobody) Bad hack to identify ChannelChange Command if (cmd->getDataPayload()[0] == 0x56) { // @todo(tbnobody) Bad hack to identify ChannelChange Command
cmtSwitchDtuFreq(HOY_BOOT_FREQ / 1000); cmtSwitchDtuFreq(HOY_BOOT_FREQ / 1000);
} }
@ -280,7 +278,7 @@ void HoymilesRadio_CMT::sendEsbPacket(CommandAbstract* cmd)
if (!_radio->write(cmd->getDataPayload(), cmd->getDataSize())) { if (!_radio->write(cmd->getDataPayload(), cmd->getDataSize())) {
Hoymiles.getMessageOutput()->println("TX SPI Timeout"); Hoymiles.getMessageOutput()->println("TX SPI Timeout");
} }
_radio->setChannel(oldChannel); cmtSwitchDtuFreq(_inverterTargetFrequency);
_radio->startListening(); _radio->startListening();
_busyFlag = true; _busyFlag = true;
_rxTimeout.set(cmd->getTimeout()); _rxTimeout.set(cmd->getTimeout());