Firmware flow
Evaluate current flags and a motion timeout
Selected CLAMPING branch from current-monitored motor firmware.
Each current comparison can set its own remembered flag. Both motors are stopped after both flags are set, or after the configured timeout, before the code changes the outputs and returns to idle.
This source fragment does not establish current calibration, independent per-motor cutoff, fail-safe behavior or suitability for a vehicle.
Read the implementation
Selected firmware excerpts. The diagram explains the code; it is not a hardware test.
Two unchanged source segments are shown separately; they are not a complete function. Source line 316, containing the stop call and its diagnostic string, is omitted from display. The flow follows the reviewed full branch at lines 309–321.
Excerpt segment 1: current flags and completion condition
case CLAMPING: {
float i1 = readCurrentA(PIN_CS_M1);
float i2 = readCurrentA(PIN_CS_M2);
if (i1 >= CURRENT_THRESHOLD_A) m1Reached = true;
if (i2 >= CURRENT_THRESHOLD_A) m2Reached = true;
if ((m1Reached && m2Reached) || (now - motionStart >= motionTimeout)) {Excerpt segment 2: indicator outputs and return to idle
setLedSolid(true); // LED ON solid
relayValue = RELAY_ON_LEVEL(); setOutputs();// D2 HIGH (or active level)
state = IDLE;
}
} break;Technical notes
Current checks
The CLAMPING branch reads both current inputs and remembers when each crosses its configured threshold. Both motors stop after both flags are set, or when the movement timeout expires.
Outputs and state
After stopping, the branch sets the indicator and relay outputs and returns to idle. Button handling timestamps raw input transitions; it does not implement the debounce constant declared elsewhere in the sketch.
Implementation limits
The current conversion uses configured scale values. The source does not establish calibration, independent per-motor cutoff or suitability for a vehicle; this is firmware inspection, not a hardware validation result.