v1.4.0: BLE disconnect simulation with teardown support

Features:
- Add BLE disconnect simulation to test client reconnection behavior
- Support immediate disconnect, timed advertising pause, and full BLE teardown
- Add preset test buttons in admin UI (Quick Drop, 5s Pause, BLE Restart, 10s Restart)
- Add simulate_ble_disconnect MCP tool with duration_ms and teardown params
- Add POST /devices/{id}/disconnect API endpoint

Fixes:
- Fix treadmill distance not updating in admin UI (publish values periodically)
- Fix HR variation sending to non-heart_rate devices
- Fix BLE connection ID 0 being treated as "not connected"
- Clean up misleading startup log messages

Firmware: 1.1.0, API: 1.4.0, UI: 1.5.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 18:35:03 -05:00
parent 0a48a2928e
commit aab2526f99
11 changed files with 332 additions and 13 deletions

View File

@@ -4,7 +4,7 @@
// ============================================
// Firmware Version
// ============================================
#define FIRMWARE_VERSION "1.0.7"
#define FIRMWARE_VERSION "1.1.0"
// ============================================
// AP Mode Configuration

View File

@@ -44,13 +44,23 @@ public:
// State
bool isClientConnected() const { return deviceConnected; }
// Disconnect simulation
void disconnectClient(); // Force disconnect + immediate re-advertise
void disconnectClientForDuration(int ms); // Disconnect + pause advertising for duration
void teardownForDuration(int ms); // Full BLE deinit + reinit after duration
private:
BleService() = default;
bool deviceConnected = false;
unsigned long lastNotify = 0;
unsigned long advertisingResumeTime = 0; // When to resume advertising (0 = not paused)
bool advertisingPaused = false;
unsigned long teardownResumeTime = 0; // When to reinit BLE after teardown
bool teardownPending = false;
void initBLE();
void reinitBLE(); // Reinit BLE and restore services
};
#define bleService BleService::getInstance()