feat: add simple stall detection with threshold + debounce

- Add STALL_THRESHOLD (8A) and STALL_CONFIRM_SAMPLES (3) config
- Add 500ms stabilization delay after direction change to prevent false positives
- Add stall warning banner in web UI
- Stop motor and pingpong when stall detected

Algorithm: If active current > 8A for 3 consecutive samples (300ms),
and motor has been running for at least 500ms, trigger stall callback.
This commit is contained in:
devdesk
2026-02-05 21:29:38 +02:00
parent 3aec7250c9
commit dffb859826
5 changed files with 119 additions and 2 deletions

View File

@@ -40,6 +40,12 @@
// Current logging interval for data collection
#define CURRENT_LOG_INTERVAL_MS 100 // Log current readings every 100ms
// Simple Stall Detection
// Based on clean data: Running ~2A, Stall ~17A (8.5x difference)
#define STALL_THRESHOLD 8.0f // Amps - midpoint between 2A run and 17A stall
#define STALL_CONFIRM_SAMPLES 3 // Debounce: 3 samples = 300ms at 100ms interval
#define STALL_STABILIZE_MS 500 // Ignore current spikes for 500ms after direction change
// Web Server
#define HTTP_PORT 80