Add isChannelActive() function to radio interface

This commit is contained in:
GUVWAF
2022-04-20 20:04:44 +02:00
parent 616c7d7b0e
commit 6d01f9aa89
4 changed files with 42 additions and 0 deletions

View File

@@ -226,6 +226,23 @@ void SX126xInterface<T>::startReceive()
#endif
}
/** Could we send right now (i.e. either not actively receving or transmitting)? */
template<typename T>
bool SX126xInterface<T>::isChannelActive()
{
// check if we can detect a LoRa preamble on the current channel
int16_t result;
setStandby();
result = lora.scanChannel();
if (result == PREAMBLE_DETECTED)
return true;
assert(result != ERR_WRONG_MODEM);
return false;
}
/** Could we send right now (i.e. either not actively receving or transmitting)? */
template<typename T>
bool SX126xInterface<T>::isActivelyReceiving()