Fix: Endless loop when CMT module was configured but not connected
This commit is contained in:
parent
481bc00f28
commit
1416efc6f9
@ -63,11 +63,11 @@ void HoymilesRadio_CMT::init(int8_t pin_sdio, int8_t pin_clk, int8_t pin_cs, int
|
||||
|
||||
cmtSwitchDtuFreq(_inverterTargetFrequency); // start dtu at work freqency, for fast Rx if inverter is already on and frequency switched
|
||||
|
||||
if (_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("Connection successful");
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Connection error!!");
|
||||
if (!_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("CMT: Connection error!!");
|
||||
return;
|
||||
}
|
||||
Hoymiles.getMessageOutput()->println("CMT: Connection successful");
|
||||
|
||||
if (pin_gpio2 >= 0) {
|
||||
attachInterrupt(digitalPinToInterrupt(pin_gpio2), std::bind(&HoymilesRadio_CMT::handleInt1, this), RISING);
|
||||
@ -109,7 +109,7 @@ void HoymilesRadio_CMT::loop()
|
||||
_radio->read(f.fragment, f.len);
|
||||
_rxBuffer.push(f);
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Buffer full");
|
||||
Hoymiles.getMessageOutput()->println("CMT: Buffer full");
|
||||
_radio->flush_rx();
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,11 +23,11 @@ void HoymilesRadio_NRF::init(SPIClass* initialisedSpiBus, uint8_t pinCE, uint8_t
|
||||
_radio->setAddressWidth(5);
|
||||
_radio->setRetries(0, 0);
|
||||
_radio->maskIRQ(true, true, false); // enable only receiving interrupts
|
||||
if (_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("Connection successful");
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Connection error!!");
|
||||
if (!_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("NRF: Connection error!!");
|
||||
return;
|
||||
}
|
||||
Hoymiles.getMessageOutput()->println("NRF: Connection successful");
|
||||
|
||||
attachInterrupt(digitalPinToInterrupt(pinIRQ), std::bind(&HoymilesRadio_NRF::handleIntr, this), FALLING);
|
||||
|
||||
@ -60,7 +60,7 @@ void HoymilesRadio_NRF::loop()
|
||||
_radio->read(f.fragment, f.len);
|
||||
_rxBuffer.push(f);
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Buffer full");
|
||||
Hoymiles.getMessageOutput()->println("NRF: Buffer full");
|
||||
_radio->flush_rx();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user