* basic CAD before TX, for sx126x wrappers
This commit is contained in:
@@ -121,7 +121,7 @@ void Dispatcher::checkRecv() {
|
|||||||
void Dispatcher::checkSend() {
|
void Dispatcher::checkSend() {
|
||||||
if (_mgr->getOutboundCount() == 0) return; // nothing waiting to send
|
if (_mgr->getOutboundCount() == 0) return; // nothing waiting to send
|
||||||
if (!millisHasNowPassed(next_tx_time)) return; // still in 'radio silence' phase (from airtime budget setting)
|
if (!millisHasNowPassed(next_tx_time)) return; // still in 'radio silence' phase (from airtime budget setting)
|
||||||
if (_radio->isReceiving()) return; // check if radio is currently mid-receive
|
if (_radio->isReceiving()) return; // LBT - check if radio is currently mid-receive, or if channel activity
|
||||||
|
|
||||||
outbound = _mgr->getNextOutbound(_ms->getMillis());
|
outbound = _mgr->getNextOutbound(_ms->getMillis());
|
||||||
if (outbound) {
|
if (outbound) {
|
||||||
|
|||||||
@@ -6,7 +6,14 @@
|
|||||||
class CustomSX1262Wrapper : public RadioLibWrapper {
|
class CustomSX1262Wrapper : public RadioLibWrapper {
|
||||||
public:
|
public:
|
||||||
CustomSX1262Wrapper(CustomSX1262& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
|
CustomSX1262Wrapper(CustomSX1262& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
|
||||||
bool isReceiving() override { return ((CustomSX1262 *)_radio)->isReceiving(); }
|
bool isReceiving() override {
|
||||||
|
if (((CustomSX1262 *)_radio)->isReceiving()) return true;
|
||||||
|
|
||||||
|
idle(); // put sx126x into standby
|
||||||
|
// do some basic CAD (blocks for ~12780 micros (on SF 10)!)
|
||||||
|
if (((CustomSX1262 *)_radio)->scanChannel() == RADIOLIB_LORA_DETECTED) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
float getLastRSSI() const override { return ((CustomSX1262 *)_radio)->getRSSI(); }
|
float getLastRSSI() const override { return ((CustomSX1262 *)_radio)->getRSSI(); }
|
||||||
float getLastSNR() const override { return ((CustomSX1262 *)_radio)->getSNR(); }
|
float getLastSNR() const override { return ((CustomSX1262 *)_radio)->getSNR(); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,14 @@
|
|||||||
class CustomSX1268Wrapper : public RadioLibWrapper {
|
class CustomSX1268Wrapper : public RadioLibWrapper {
|
||||||
public:
|
public:
|
||||||
CustomSX1268Wrapper(CustomSX1268& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
|
CustomSX1268Wrapper(CustomSX1268& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
|
||||||
bool isReceiving() override { return ((CustomSX1268 *)_radio)->isReceiving(); }
|
bool isReceiving() override {
|
||||||
|
if (((CustomSX1268 *)_radio)->isReceiving()) return true;
|
||||||
|
|
||||||
|
idle(); // put sx126x into standby
|
||||||
|
// do some basic CAD (blocks for ~12780 micros (on SF 10)!)
|
||||||
|
if (((CustomSX1268 *)_radio)->scanChannel() == RADIOLIB_LORA_DETECTED) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
float getLastRSSI() const override { return ((CustomSX1268 *)_radio)->getRSSI(); }
|
float getLastRSSI() const override { return ((CustomSX1268 *)_radio)->getRSSI(); }
|
||||||
float getLastSNR() const override { return ((CustomSX1268 *)_radio)->getSNR(); }
|
float getLastSNR() const override { return ((CustomSX1268 *)_radio)->getSNR(); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ void RadioLibWrapper::begin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadioLibWrapper::idle() {
|
||||||
|
_radio->standby();
|
||||||
|
state = STATE_IDLE; // need another startReceive()
|
||||||
|
}
|
||||||
|
|
||||||
int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
|
int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
|
||||||
if (state & STATE_INT_READY) {
|
if (state & STATE_INT_READY) {
|
||||||
int len = _radio->getPacketLength();
|
int len = _radio->getPacketLength();
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ protected:
|
|||||||
mesh::MainBoard* _board;
|
mesh::MainBoard* _board;
|
||||||
uint32_t n_recv, n_sent;
|
uint32_t n_recv, n_sent;
|
||||||
|
|
||||||
|
void idle();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RadioLibWrapper(PhysicalLayer& radio, mesh::MainBoard& board) : _radio(&radio), _board(&board) { n_recv = n_sent = 0; }
|
RadioLibWrapper(PhysicalLayer& radio, mesh::MainBoard& board) : _radio(&radio), _board(&board) { n_recv = n_sent = 0; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user