fix(system): enhance system stability, watchdog, and safe shutdown
- Increase F9PSerialReadTask stack size to 8192 to prevent stack overflows - Add timeout to BluetoothSerial flush() to avoid infinite blocking loops - Implement Task Watchdog Timer (TWDT) for F9PSerialReadTask for auto-recovery - Add power-fail interrupt handling via GPIO 27 to safely close SD card logs - Enable hardware reset reason logging to SD card on startup
This commit is contained in:
@@ -30,7 +30,8 @@ const char * _spp_server_name = "ESP32SPP";
|
||||
//#define RX_QUEUE_SIZE 512 //Original
|
||||
//#define TX_QUEUE_SIZE 32
|
||||
|
||||
#define SPP_TX_QUEUE_TIMEOUT 1000
|
||||
// #define SPP_TX_QUEUE_TIMEOUT 1000
|
||||
#define SPP_TX_QUEUE_TIMEOUT 10
|
||||
#define SPP_TX_DONE_TIMEOUT 1000
|
||||
#define SPP_CONGESTED_TIMEOUT 1000
|
||||
|
||||
@@ -763,8 +764,10 @@ size_t BluetoothSerial::write(const uint8_t *buffer, size_t size)
|
||||
void BluetoothSerial::flush()
|
||||
{
|
||||
if (_spp_tx_queue != NULL){
|
||||
while(uxQueueMessagesWaiting(_spp_tx_queue) > 0){
|
||||
int timeout = 20;
|
||||
while(uxQueueMessagesWaiting(_spp_tx_queue) > 0 && timeout > 0){
|
||||
delay(100);
|
||||
timeout--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user