Skip to content

feat: update float ESP-NOW runtime flow#5

Open
Skeitt wants to merge 6 commits into
masterfrom
feat/new-espnow
Open

feat: update float ESP-NOW runtime flow#5
Skeitt wants to merge 6 commits into
masterfrom
feat/new-espnow

Conversation

@Skeitt
Copy link
Copy Markdown
Contributor

@Skeitt Skeitt commented Jun 1, 2026

  • add runtime profile, PID, balance and motor settings with persisted ESPA config and ESPB parser support

  • log and stream normalized syringe position alongside pressure and float depth

  • require acknowledged command handling, centralize LED states and clean obsolete espA_pool/build artifacts

  • update firmware docs and protocol/parser/storage tests for the current command contract

Skeitt and others added 6 commits May 29, 2026 22:57
- add runtime profile, PID, balance and motor settings with persisted ESPA config and ESPB parser support

- log and stream normalized syringe position alongside pressure and float depth

- require acknowledged command handling, centralize LED states and clean obsolete espA_pool/build artifacts

- update firmware docs and protocol/parser/storage tests for the current command contract
home (motor_pos=0) pushes water out → floats; negative positions move
toward the TOF and take on water → sinks. Simplify uToMotorPos to map
u in [0,1] onto negative travel, dropping the unused MOTOR_INVERT_LOGICAL
flag, and update balance() comments accordingly.
Mission log survives a power-cycle (cleared only at the start of a new
mission, no longer at boot), so a failed pool test can be read afterwards
over USB. Add a DUMP_LOG serial command to re-read it on demand without
clearing — solves the case where the monitor connects after boot.

emergencyStop() records reason + TOF distance to the flash log the instant
it fires (idempotent single write) instead of a posteriori in loop(), where
it was missed when measure() exited on phase timeout. Expose
lastStopReason()/lastStopTofMm(). TOF safety now debounces with
TOF_SAFETY_STOP_SAMPLES consecutive out-of-range reads to ignore single
glitches (bubbles, reflections) in water, and clamps the PID output to
[PID_U_MIN, PID_U_MAX] so the syringe never reaches the TOF safety limits.

Enable monitor echo + LF EOL so serial commands are visible and terminated
as the parser expects.
Default PID gains iterated against pool tests: Kp 0.17 was too weak (the
float barely moved), Kp 2.0 / Kd 0.13 oscillated (±15cm pumping). Settle on
Kp 1.0 / Ki 0 / Kd 0.5 as a damped starting point; fine-tune further at
runtime via PID_CONFIG_SET.

Reduce the descent kick-start from u=0.979 (near-full syringe, which drove
the float straight to the bottom before the PID could brake, ~26cm
overshoot) to PID_DESCENT_KICK_U=0.30, so the descent starts gently and the
PID takes over before overshooting the target.
Validated in the pool: the float converges on the target depth with ~±1cm
final oscillation. Ki vinces the buoyancy offset (recovery), Kd damps the
overshoot. Replaces the previous 1.0/0/0.5 starting point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants