Fix: Filter incoming packages from CMT module for the right destination address

The CMT module receives every package on it's target frequency. Compared to the NRF module to filtering takes place. Therefor it's required to check if the package destination id is really the id of our dtu
This commit is contained in:
Thomas Basler 2023-05-24 21:55:15 +02:00
parent e7198073af
commit 8f2a2b40b1

View File

@ -121,6 +121,13 @@ void HoymilesRadio_CMT::loop()
if (!_rxBuffer.empty()) {
fragment_t f = _rxBuffer.back();
if (checkFragmentCrc(&f)) {
serial_u dtuId = convertSerialToRadioId(_dtuSerial);
// The CMT RF module does not filter foreign packages by itself.
// Has to be done manually here.
if (memcmp(&f.fragment[5], &dtuId.b[1], 4) == 0) {
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(&f);
if (nullptr != inv) {
@ -133,6 +140,7 @@ void HoymilesRadio_CMT::loop()
} else {
Hoymiles.getMessageOutput()->println("Inverter Not found!");
}
}
} else {
Hoymiles.getMessageOutput()->println("Frame kaputt"); // ;-)