fix: prevent ESP32 KISS modem stalls under USB backpressure

Switch ESP32-S3 KISS modem environments to HWCDC and move outbound KISS writes to a non-blocking queued frame path so loop() and TX completion keep progressing when the host reads slowly. Add native backpressure regression tests and correct the native_kiss_modem test filter so this suite runs directly with pio test.
This commit is contained in:
ViezeVingertjes
2026-07-18 22:43:55 +02:00
parent 795989b918
commit fb2c61f862
15 changed files with 701 additions and 46 deletions
+9 -1
View File
@@ -20,6 +20,8 @@
#define NOISE_FLOOR_CALIB_INTERVAL_MS 2000
#define AGC_RESET_INTERVAL_MS 30000
#define USB_TX_TIMEOUT_MS 50
#define USB_TX_BUFFER_SIZE 1024
StdRNG rng;
mesh::LocalIdentity identity;
@@ -111,6 +113,12 @@ void setup() {
uint32_t start = millis();
while (!Serial && millis() - start < 3000) delay(10);
delay(100);
#if defined(ESP32)
Serial.setTxTimeoutMs(USB_TX_TIMEOUT_MS);
#if ARDUINO_USB_MODE
Serial.setTxBufferSize(USB_TX_BUFFER_SIZE);
#endif
#endif
modem = new KissModem(Serial, identity, rng, radio_driver, board, sensors);
#endif
@@ -126,7 +134,7 @@ void setup() {
void loop() {
modem->loop();
if (!modem->isActuallyTransmitting()) {
if (!modem->isActuallyTransmitting() && !modem->isHostOutputBackedUp()) {
if (!modem->isTxBusy()) {
if ((uint32_t)(millis() - next_agc_reset_ms) >= AGC_RESET_INTERVAL_MS) {
radio_driver.resetAGC();