Replace stall/homing flow with signed slider drive control

This streamlines manual dual-motor operation by using spring-centered signed sliders and synchronized drive modes while keeping live current monitoring in the UI and API.
This commit is contained in:
devdesk
2026-02-20 14:30:46 +02:00
parent 4c30610af0
commit 25dc34c6e3
7 changed files with 542 additions and 554 deletions

View File

@@ -69,12 +69,6 @@ const MotorPins MOTOR2_PINS = {
// 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

View File

@@ -1,10 +0,0 @@
#ifndef HOMING_H
#define HOMING_H
// Coordinated movement functions (defined in main.cpp)
int toggleCoordinatedMovement(int speed);
void stopCoordinatedMovement();
int getCoordinatedState();
bool isCoordinatedMovementDone();
#endif

View File

@@ -4,9 +4,6 @@
#include <Arduino.h>
#include "config.h"
// Stall callback function type
typedef void (*StallCallback)();
class MotorController {
public:
// Constructor with pin configuration and motor name
@@ -25,11 +22,6 @@ public:
float getCurrentActive(); // Current from active direction
const char* getName(); // Get motor name for logging
// Stall detection
bool isStalled();
void setStallCallback(StallCallback callback);
void resetStallDetection();
private:
MotorPins _pins;
const char* _name;
@@ -43,19 +35,12 @@ private:
int _adcOffsetRight = 0;
int _adcOffsetLeft = 0;
// Stall detection state
bool _stalled = false;
int _stallConfirmCount = 0;
StallCallback _stallCallback = nullptr;
unsigned long _lastDirectionChangeTime = 0;
// Static flag to track if enable pins are already configured
static bool _enablePinsConfigured;
void applyMotorState();
float readCurrentSense(int pin);
void calibrateCurrentOffset();
void checkStall();
};
// Two motor controller instances