mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Fix build for non-FreeRTOS and non-SX1262 platforms
- Replace vTaskDelay(1) with YIELD_TASK() macro for platform compatibility (FreeRTOS: vTaskDelay, others: delay) - Make getCodingRate() and getFreqMHz() non-pure virtual with defaults (default CR4/8, default freq 0.0f for unknown platforms) - Add getCodingRate() and getFreqMHz() to CustomSTM32WLxWrapper All environments now build successfully.
This commit is contained in:
parent
4276d84070
commit
56a2d93aa4
3 changed files with 20 additions and 6 deletions
|
|
@ -2,6 +2,13 @@
|
|||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include "RadioLibWrappers.h"
|
||||
|
||||
// Platform-safe yield for use in busy-wait loops
|
||||
#ifdef NRF52_PLATFORM
|
||||
#define YIELD_TASK() vTaskDelay(1)
|
||||
#else
|
||||
#define YIELD_TASK() delay(1)
|
||||
#endif
|
||||
|
||||
#define STATE_IDLE 0
|
||||
#define STATE_RX 1
|
||||
#define STATE_TX_WAIT 3
|
||||
|
|
@ -194,17 +201,17 @@ bool RadioLibWrapper::isChannelActive() {
|
|||
uint32_t max_backoff = min(base_ms * (1u << _busy_count), (uint32_t)16000);
|
||||
uint32_t backoff_until = millis() + random(max_backoff / 2, max_backoff);
|
||||
while (millis() < backoff_until) {
|
||||
vTaskDelay(1);
|
||||
YIELD_TASK();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
vTaskDelay(1);
|
||||
YIELD_TASK();
|
||||
}
|
||||
// Channel free: reset busy counter and add small jitter
|
||||
_busy_count = 0;
|
||||
uint32_t jitter_until = millis() + random(0, 500);
|
||||
while (millis() < jitter_until) {
|
||||
vTaskDelay(1);
|
||||
YIELD_TASK();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue