diff --git a/lib/Hoymiles/src/HoymilesRadio_CMT.cpp b/lib/Hoymiles/src/HoymilesRadio_CMT.cpp index a06085cf1..6e0211a66 100644 --- a/lib/Hoymiles/src/HoymilesRadio_CMT.cpp +++ b/lib/Hoymiles/src/HoymilesRadio_CMT.cpp @@ -7,8 +7,6 @@ #include "crc.h" #include -#define HOY_BOOT_FREQ 868000000 // Hoymiles boot/init frequency after power up inverter or connection lost for 15 min - uint32_t HoymilesRadio_CMT::getFrequencyFromChannel(const uint8_t channel) const { return (_radio->getBaseFrequency() + channel * getChannelWidth()); @@ -199,6 +197,12 @@ uint32_t HoymilesRadio_CMT::getChannelWidth() return FH_OFFSET * CMT2300A_ONE_STEP_SIZE; } +uint32_t HoymilesRadio_CMT::getInvBootFrequency() +{ + // Hoymiles boot/init frequency after power up inverter or connection lost for 15 min + return 868000000; +} + void ARDUINO_ISR_ATTR HoymilesRadio_CMT::handleInt1() { _packetSent = true; @@ -218,7 +222,7 @@ void HoymilesRadio_CMT::sendEsbPacket(CommandAbstract& cmd) _radio->stopListening(); if (cmd.getDataPayload()[0] == 0x56) { // @todo(tbnobody) Bad hack to identify ChannelChange Command - cmtSwitchDtuFreq(HOY_BOOT_FREQ); + cmtSwitchDtuFreq(getInvBootFrequency()); } Hoymiles.getMessageOutput()->printf("TX %s %.2f MHz --> ", diff --git a/lib/Hoymiles/src/HoymilesRadio_CMT.h b/lib/Hoymiles/src/HoymilesRadio_CMT.h index 667f471bb..102600409 100644 --- a/lib/Hoymiles/src/HoymilesRadio_CMT.h +++ b/lib/Hoymiles/src/HoymilesRadio_CMT.h @@ -30,6 +30,8 @@ class HoymilesRadio_CMT : public HoymilesRadio { uint32_t getMaxFrequency() const; static uint32_t getChannelWidth(); + static uint32_t getInvBootFrequency(); + uint32_t getFrequencyFromChannel(const uint8_t channel) const; uint8_t getChannelFromFrequency(const uint32_t frequency) const;