mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* Repeater/Room server: new diagnostics, stats.n_full_events now repurposed to 'err_events' (bit flags)
* new Radio::isInRecvMode() method
This commit is contained in:
parent
62a5115cc9
commit
177dd90ca1
8 changed files with 46 additions and 9 deletions
|
|
@ -44,6 +44,10 @@ void RadioLibWrapper::startRecv() {
|
|||
}
|
||||
}
|
||||
|
||||
bool RadioLibWrapper::isInRecvMode() const {
|
||||
return (state & ~STATE_INT_READY) == STATE_RX;
|
||||
}
|
||||
|
||||
int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
|
||||
if (state & STATE_INT_READY) {
|
||||
int len = _radio->getPacketLength();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public:
|
|||
bool startSendRaw(const uint8_t* bytes, int len) override;
|
||||
bool isSendComplete() override;
|
||||
void onSendFinished() override;
|
||||
bool isInRecvMode() const override;
|
||||
|
||||
uint32_t getPacketsRecv() const { return n_recv; }
|
||||
uint32_t getPacketsSent() const { return n_sent; }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
static uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||
static esp_now_peer_info_t peerInfo;
|
||||
static bool is_send_complete = false;
|
||||
static volatile bool is_send_complete = false;
|
||||
static esp_err_t last_send_result;
|
||||
static uint8_t rx_buf[256];
|
||||
static uint8_t last_rx_len = 0;
|
||||
|
|
@ -44,6 +44,8 @@ void ESPNOWRadio::init() {
|
|||
peerInfo.channel = 0;
|
||||
peerInfo.encrypt = false;
|
||||
|
||||
is_send_complete = true;
|
||||
|
||||
// Add peer
|
||||
if (esp_now_add_peer(&peerInfo) == ESP_OK) {
|
||||
ESPNOW_DEBUG_PRINTLN("init success");
|
||||
|
|
@ -86,6 +88,11 @@ bool ESPNOWRadio::isSendComplete() {
|
|||
return is_send_complete;
|
||||
}
|
||||
void ESPNOWRadio::onSendFinished() {
|
||||
is_send_complete = true;
|
||||
}
|
||||
|
||||
bool ESPNOWRadio::isInRecvMode() const {
|
||||
return is_send_complete; // if NO send in progress, then we're in Rx mode
|
||||
}
|
||||
|
||||
float ESPNOWRadio::getLastRSSI() const { return 0; }
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ public:
|
|||
bool startSendRaw(const uint8_t* bytes, int len) override;
|
||||
bool isSendComplete() override;
|
||||
void onSendFinished() override;
|
||||
bool isInRecvMode() const override;
|
||||
|
||||
uint32_t getPacketsRecv() const { return n_recv; }
|
||||
uint32_t getPacketsSent() const { return n_sent; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue