Fix USB radio stalls and add durable replay timestamp recovery
This commit is contained in:
1 parent
f2c15225cc
commit
a8cf4fd12f
44 files changed
+4339
-148
No files matched your search
+9
-7
@@ -23,7 +23,8 @@
|
||||
#define MAX_PATH_SIZE 64
|
||||
#define MAX_TRANS_UNIT 255
|
||||
|
||||
#if defined(ARDUINO) && defined(NRF52_PLATFORM) && \
|
||||
#if defined(ARDUINO) && \
|
||||
(defined(NRF52_PLATFORM) || MESH_ESP32_TINYUSB_NONBLOCKING) && \
|
||||
((defined(MESH_DEBUG) && MESH_DEBUG) || \
|
||||
(defined(BRIDGE_DEBUG) && BRIDGE_DEBUG) || \
|
||||
(defined(POWERSAVING_DEBUG) && POWERSAVING_DEBUG))
|
||||
@@ -39,10 +40,11 @@ namespace mesh {
|
||||
// Adafruit_USBD_CDC::write() waits until the complete buffer has entered the
|
||||
// TinyUSB FIFO. That is normally convenient, but it can wait forever when a
|
||||
// host has opened the dedicated logging CDC without draining it. Keep debug
|
||||
// output best-effort on nRF52: format into one bounded record, preserve a
|
||||
// output best-effort on native TinyUSB: format into one bounded record, preserve a
|
||||
// visible truncation marker, and submit it only when the whole record fits in
|
||||
// the FIFO snapshot. The atomic flag also prevents two debug callers from both
|
||||
// relying on the same availableForWrite() result.
|
||||
// the available FIFO or ESP32 software queue. The atomic flag also prevents
|
||||
// overlapping debug formatter calls. The historical helper name
|
||||
// is retained for callers; ESP32 TinyUSB uses the same bounded formatter.
|
||||
inline size_t nrf52DebugPrintf(const char* format, ...) {
|
||||
if (format == nullptr || !isUsbLoggingEnabled()) return 0;
|
||||
|
||||
@@ -84,7 +86,7 @@ inline size_t nrf52DebugPrintf(const char* format, ...) {
|
||||
|
||||
#if MESH_DEBUG && ARDUINO
|
||||
#include <Arduino.h>
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#if defined(NRF52_PLATFORM) || MESH_ESP32_TINYUSB_NONBLOCKING
|
||||
#define MESH_DEBUG_PRINT(F, ...) do { mesh::nrf52DebugPrintf("DEBUG: " F, ##__VA_ARGS__); } while(0)
|
||||
#define MESH_DEBUG_PRINTLN(F, ...) do { mesh::nrf52DebugPrintf("DEBUG: " F "\n", ##__VA_ARGS__); } while(0)
|
||||
#else
|
||||
@@ -97,7 +99,7 @@ inline size_t nrf52DebugPrintf(const char* format, ...) {
|
||||
#endif
|
||||
|
||||
#if BRIDGE_DEBUG && ARDUINO
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#if defined(NRF52_PLATFORM) || MESH_ESP32_TINYUSB_NONBLOCKING
|
||||
#define BRIDGE_DEBUG_PRINTLN(F, ...) do { mesh::nrf52DebugPrintf("%s BRIDGE: " F, getLogDateTime(), ##__VA_ARGS__); } while(0)
|
||||
#else
|
||||
#define BRIDGE_DEBUG_PRINTLN(F, ...) do { if (mesh::isUsbLoggingEnabled() && mesh::usbLoggingPort().availableForWrite() > 0) { mesh::usbLoggingPort().printf("%s BRIDGE: " F, getLogDateTime(), ##__VA_ARGS__); } } while(0)
|
||||
@@ -108,7 +110,7 @@ inline size_t nrf52DebugPrintf(const char* format, ...) {
|
||||
|
||||
#if POWERSAVING_DEBUG && ARDUINO
|
||||
#include <Arduino.h>
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#if defined(NRF52_PLATFORM) || MESH_ESP32_TINYUSB_NONBLOCKING
|
||||
#define POWERSAVING_DEBUG_PRINT(F, ...) do { mesh::nrf52DebugPrintf("POWERSAVING: " F, ##__VA_ARGS__); } while(0)
|
||||
#define POWERSAVING_DEBUG_PRINTLN(F, ...) do { mesh::nrf52DebugPrintf("POWERSAVING: " F "\n", ##__VA_ARGS__); } while(0)
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user