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.
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@@ -33,32 +33,18 @@ void setupWiFi() {
|
||||
}
|
||||
}
|
||||
|
||||
// Stall protection callback - stops motor immediately when stall detected
|
||||
// (unless pingpong with stallReturn is active - it handles stall by switching direction)
|
||||
void onMotorStall(float current) {
|
||||
if (motor.isPingpongActive() && motor.getPingpongStallReturn()) {
|
||||
// Pingpong will handle stall by switching direction
|
||||
Serial.printf("STALL DETECTED: Pingpong will switch direction (current: %.2fA)\n", current);
|
||||
return;
|
||||
}
|
||||
Serial.printf("STALL PROTECTION: Stopping motor (current: %.2fA)\n", current);
|
||||
motor.stop();
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
|
||||
Serial.println("\n=============================");
|
||||
Serial.println(" BTS7960 Motor Controller");
|
||||
Serial.println(" (Stall Detection Removed)");
|
||||
Serial.println("=============================\n");
|
||||
|
||||
// Initialize motor controller
|
||||
motor.begin();
|
||||
|
||||
// Register stall protection callback
|
||||
motor.setStallCallback(onMotorStall);
|
||||
|
||||
// Connect to WiFi
|
||||
setupWiFi();
|
||||
|
||||
@@ -72,6 +58,6 @@ void setup() {
|
||||
|
||||
void loop() {
|
||||
handleWebServer();
|
||||
motor.update(); // Update current sensing and stall detection
|
||||
motor.update(); // Update current sensing and logging
|
||||
delay(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user