Move HOY_BOOT_FREQ from define to function

This commit is contained in:
Thomas Basler 2024-01-13 14:36:59 +01:00
parent 58f0121c11
commit 16cd1a90d5
2 changed files with 9 additions and 3 deletions

View File

@ -7,8 +7,6 @@
#include "crc.h"
#include <FunctionalInterrupt.h>
#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 --> ",

View File

@ -30,6 +30,8 @@ public:
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;