Code cleanup

This commit is contained in:
Thomas Basler 2022-06-18 12:26:37 +02:00
parent b4aad4b3c7
commit 865d00d3d0
2 changed files with 9 additions and 14 deletions

View File

@ -32,7 +32,7 @@ void HoymilesRadio::loop()
{
EVERY_N_MILLIS(4)
{
switchRxCh(1);
switchRxCh();
}
if (_packetReceived) {
@ -167,18 +167,14 @@ uint8_t HoymilesRadio::getTxNxtChannel()
return _txChLst[_txChIdx];
}
bool HoymilesRadio::switchRxCh(uint8_t addLoop)
void HoymilesRadio::switchRxCh()
{
_rxLoopCnt += addLoop;
if (_rxLoopCnt != 0) {
_rxLoopCnt--;
// portDISABLE_INTERRUPTS();
_radio->stopListening();
_radio->setChannel(getRxNxtChannel());
_radio->startListening();
// portENABLE_INTERRUPTS();
}
return (0 == _rxLoopCnt); // receive finished
// portDISABLE_INTERRUPTS();
_radio->stopListening();
_radio->setChannel(getRxNxtChannel());
_radio->startListening();
// portENABLE_INTERRUPTS();
}
serial_u HoymilesRadio::convertSerialToRadioId(serial_u serial)

View File

@ -34,7 +34,7 @@ private:
static void convertSerialToPacketId(uint8_t buffer[], serial_u serial);
uint8_t getRxNxtChannel();
uint8_t getTxNxtChannel();
bool switchRxCh(uint8_t addLoop = 0);
void switchRxCh();
void openReadingPipe();
void openWritingPipe(serial_u serial);
bool checkFragmentCrc(fragment_t* fragment);
@ -44,7 +44,6 @@ private:
std::unique_ptr<RF24> _radio;
uint8_t _rxChLst[4] = { 3, 23, 61, 75 };
uint8_t _rxChIdx;
uint16_t _rxLoopCnt;
uint8_t _txChLst[1] = { 40 };
uint8_t _txChIdx;