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
This commit is contained in:
devdesk
2026-02-05 16:59:47 +02:00
parent 6ccbc7faf5
commit e2fe9aa495
5 changed files with 203 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
#include "motor.h"
// Set to true to enable current sensing (requires R_IS and L_IS connected)
#define CURRENT_SENSING_ENABLED false
#define CURRENT_SENSING_ENABLED true
MotorController motor;
@@ -62,10 +62,19 @@ void MotorController::stop() {
void MotorController::update() {
#if CURRENT_SENSING_ENABLED
static unsigned long lastPrintTime = 0;
// Read current sensors
_currentRight = readCurrentSense(R_IS_PIN);
_currentLeft = readCurrentSense(L_IS_PIN);
// Log current readings every 500ms when motor is running
if ((_direction != 0 || _speed != 0) && (millis() - lastPrintTime > 500)) {
lastPrintTime = millis();
Serial.printf("Current: R=%.2fA L=%.2fA Active=%.2fA (threshold=%.1fA)\n",
_currentRight, _currentLeft, getCurrentActive(), STALL_CURRENT_THRESHOLD);
}
// Check for stall condition
checkStall();
#endif