Code cleanup
This commit is contained in:
parent
b4aad4b3c7
commit
865d00d3d0
@ -32,7 +32,7 @@ void HoymilesRadio::loop()
|
|||||||
{
|
{
|
||||||
EVERY_N_MILLIS(4)
|
EVERY_N_MILLIS(4)
|
||||||
{
|
{
|
||||||
switchRxCh(1);
|
switchRxCh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_packetReceived) {
|
if (_packetReceived) {
|
||||||
@ -167,18 +167,14 @@ uint8_t HoymilesRadio::getTxNxtChannel()
|
|||||||
return _txChLst[_txChIdx];
|
return _txChLst[_txChIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HoymilesRadio::switchRxCh(uint8_t addLoop)
|
void HoymilesRadio::switchRxCh()
|
||||||
{
|
{
|
||||||
_rxLoopCnt += addLoop;
|
|
||||||
if (_rxLoopCnt != 0) {
|
|
||||||
_rxLoopCnt--;
|
|
||||||
// portDISABLE_INTERRUPTS();
|
// portDISABLE_INTERRUPTS();
|
||||||
_radio->stopListening();
|
_radio->stopListening();
|
||||||
_radio->setChannel(getRxNxtChannel());
|
_radio->setChannel(getRxNxtChannel());
|
||||||
_radio->startListening();
|
_radio->startListening();
|
||||||
// portENABLE_INTERRUPTS();
|
// portENABLE_INTERRUPTS();
|
||||||
}
|
|
||||||
return (0 == _rxLoopCnt); // receive finished
|
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_u HoymilesRadio::convertSerialToRadioId(serial_u serial)
|
serial_u HoymilesRadio::convertSerialToRadioId(serial_u serial)
|
||||||
|
|||||||
@ -34,7 +34,7 @@ private:
|
|||||||
static void convertSerialToPacketId(uint8_t buffer[], serial_u serial);
|
static void convertSerialToPacketId(uint8_t buffer[], serial_u serial);
|
||||||
uint8_t getRxNxtChannel();
|
uint8_t getRxNxtChannel();
|
||||||
uint8_t getTxNxtChannel();
|
uint8_t getTxNxtChannel();
|
||||||
bool switchRxCh(uint8_t addLoop = 0);
|
void switchRxCh();
|
||||||
void openReadingPipe();
|
void openReadingPipe();
|
||||||
void openWritingPipe(serial_u serial);
|
void openWritingPipe(serial_u serial);
|
||||||
bool checkFragmentCrc(fragment_t* fragment);
|
bool checkFragmentCrc(fragment_t* fragment);
|
||||||
@ -44,7 +44,6 @@ private:
|
|||||||
std::unique_ptr<RF24> _radio;
|
std::unique_ptr<RF24> _radio;
|
||||||
uint8_t _rxChLst[4] = { 3, 23, 61, 75 };
|
uint8_t _rxChLst[4] = { 3, 23, 61, 75 };
|
||||||
uint8_t _rxChIdx;
|
uint8_t _rxChIdx;
|
||||||
uint16_t _rxLoopCnt;
|
|
||||||
|
|
||||||
uint8_t _txChLst[1] = { 40 };
|
uint8_t _txChLst[1] = { 40 };
|
||||||
uint8_t _txChIdx;
|
uint8_t _txChIdx;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user