Commit Graph

17 Commits

Author SHA1 Message Date
devdesk
252f0e1ec2 docs: update readme with current config and web interface details
- Add Features section with key capabilities overview
- Fix stall detection config (8.0A threshold, sample-based approach)
- Add STALL_STABILIZE_MS, MIN_PWM_PERCENT, CURRENT_LOG_INTERVAL_MS
- Document web interface features and API endpoints
- Update stall protection description with debounce mechanism
2026-02-06 14:16:59 +02:00
devdesk
c7e28c5116 serial print dot on no output 2026-02-06 14:15:09 +02:00
devdesk
c8d990b1cd Remove pingpong mode completely
- Remove pingpong method declarations and member variables from motor.h
- Remove pingpong implementation (startPingpong, stopPingpong, updatePingpong, etc.) from motor.cpp
- Remove pingpong UI section, handlers, and routes from webserver.cpp
- Remove stopPingpong call from stall callback in main.cpp
2026-02-05 22:01:50 +02:00
devdesk
ca37f1939e Merge feature/simple-stall-detection: simple threshold-based stall detection 2026-02-05 21:29:44 +02:00
devdesk
dffb859826 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.
2026-02-05 21:29:38 +02:00
devdesk
3aec7250c9 Add branch plan documentation and sample current log data
- plans/remove-stall-detection-branch.md: Documents what was removed, data analysis, and next steps
- src/current_loggin.log: Sample current data showing clear stall signatures
2026-02-05 21:10:07 +02:00
devdesk
dd274202bb Add 'STOPPED (manual)' message to serial output 2026-02-05 21:06:00 +02:00
devdesk
fcfee5fa66 Remove all stall detection logic, add 100ms current logging
- Removed all STALL_* configuration parameters from config.h
- Simplified motor.h: removed stall-related methods and member variables
- Simplified motor.cpp: deleted checkStall(), resetStallDetection()
- Added frequent current logging (100ms) for data collection
- Removed stall callback system from main.cpp
- Simplified pingpong mode: time-based only, removed stall-return option
- Updated webserver: removed stall warning UI, removed stallReturn checkbox
- Updated status JSON: removed stalled and ppStallReturn fields

This version is for testing with new beefy PSU to collect current data
before designing new stall detection algorithm.
2026-02-05 20:59:38 +02:00
devdesk
241d1ae457 Fix stall oscillation loop in pingpong mode
When pingpong detected a stall and switched direction, only _stalled
and _stallStartTime were reset, leaving _stallCandidateCount and
_motorStartTime unchanged. This caused motor inrush current after
direction change to immediately trigger another stall, creating an
infinite oscillation loop.

Now calls resetStallDetection() which properly resets all stall state
including triggering the STALL_STABILIZE_MS grace period to ignore
inrush current.
2026-02-05 20:49:59 +02:00
devdesk
568339367e Update EMA during stabilization period to track startup current
Instead of seeding EMA with first reading after stabilization, now
continuously update EMA during the 500ms stabilization window. This
ensures EMA represents normal running current rather than potentially
high stall current if motor hits end stop immediately.
2026-02-05 18:29:33 +02:00
devdesk
80ce8ff63d Fix EMA chasing spike during detection window
Freeze EMA updates when any spike candidate is detected (delta > threshold),
not just after stall is confirmed. This prevents EMA from rising to meet
the spike before the confirmation time elapses.
2026-02-05 18:23:10 +02:00
devdesk
87a05fc80a Replace absolute stall threshold with delta-based detection
- Use exponential moving average (EMA) to track normal running current
- Detect stall when current spikes above average by STALL_DELTA_THRESHOLD (2.0A)
- Add stabilization period (500ms) after motor start to let EMA settle
- Stall confirmation requires spike to persist for STALL_CONFIRM_MS (100ms)
- EMA stops updating during stall to prevent threshold creep
- Removes dependency on absolute current threshold that varied with speed
2026-02-05 18:20:26 +02:00
devdesk
63ad41970c Fix current sensor showing ~1A at idle by calibrating ADC offset
- Add zero-current offset calibration at startup (16 samples averaged)
- Store per-channel offsets (_adcOffsetRight, _adcOffsetLeft)
- Subtract calibrated offset in readCurrentSense() before conversion
- Fixes ESP32 ADC inherent offset causing false ~1A readings at idle
2026-02-05 17:56:43 +02:00
devdesk
7a6617f9c0 Add stall-based pingpong return mode and calibration improvements
- Add MIN_PWM_PERCENT (20%) to ensure motor starts reliably
- Add CURRENT_CALIBRATION factor (0.33) for accurate current readings
- Add stall-based return option for pingpong mode (returns on stall instead of time)
- Update stall detection: 7A threshold, 1000ms confirm time
- Add DISABLE_STALL_DETECT config option
- Keep last speed setting when motor stops (UI improvement)
- Update webserver UI with 'Return on stall only' checkbox
2026-02-05 17:50:22 +02:00
devdesk
ba27db4f55 Add pingpong mode with speed, time, and randomness settings
- Add pingpong oscillation mode that alternates motor direction
- Settings: base speed (10-100%), time before return (0.5-10s)
- Randomness controls for both speed (0-50%) and time (0-50%)
- Web UI with sliders and start/stop buttons
- API endpoints: /pingpong/start and /pingpong/stop
- Real-time status polling shows pingpong active state
2026-02-05 17:06:12 +02:00
devdesk
e2fe9aa495 Update stall detection params and expand documentation
- Adjust stall current threshold to 4A and detection time to 2500ms
- Add comprehensive README with hardware specs, wiring diagrams
- Include current sensing circuit documentation and math
- Improve motor and webserver implementations
2026-02-05 16:59:47 +02:00
devdesk
6ccbc7faf5 feat: add ESP32 BTS7960 motor controller with web interface
- Implement MotorController class with PWM speed control (0-100%)
- Add bidirectional control (forward/reverse) via LEDC PWM at 20kHz
- Include optional current sensing and stall detection
- Create responsive web UI with speed slider and direction buttons
- Configure WiFi with static IP (10.81.2.185)
- Use built-in WebServer library for ESP32 Arduino 3.x compatibility
2026-02-05 15:08:47 +02:00