MOSS: a small, mostly 3D-printed litter-picking rover. Cleaner streets, one maker at a time.
Python
firmware v3: ramp defaults back to 30/15 ms per % (Laurent 28/09: 0 -> 70 % in 2 s); the limit stays 100; MOSS_RAMP_MS tunes it live
openclaw6e635e48cd28
diff --git a/firmware/MOSS_QTPY_MDD3A/Control.h b/firmware/MOSS_QTPY_MDD3A/Control.hindex b7f9e55..27bf7b6 100644--- a/firmware/MOSS_QTPY_MDD3A/Control.h+++ b/firmware/MOSS_QTPY_MDD3A/Control.h@@ -2,9 +2,9 @@// MOSS V0.4 control logic - same protocol as the V0.3 bench firmware (arm /// drive L R / stop / status / zero / test), plus a configurable ramp:// ramp UP DOWN milliseconds per 1 % of PWM, rise and fall separately-// Defaults below: 0 -> 100 % in 1.0 s, 100 -> 0 in 0.5 s (10/10: the first-// drive on the floor with the arm mounted, Laurent: "100 %", the 25 % bench-// limit and the 30 ms rise never got the tracks moving); tune with "ramp".+// Defaults below: 0 -> 70 % in 2.1 s (the slope asked for a rover carrying an+// arm), 70 -> 0 in 1.05 s; 0 -> 100 % takes 3 s. Tune at runtime with "ramp"+// (the host passes MOSS_RAMP_MS), no reflash.// MAX_PERCENT stays a compile-time limit, not a serial command: 100 since// 10/10 (the commissioning 25 % was the bench on blocks, 05/10); the host// side caps lower with MOSS_MAX_PCT when it wants to.@@ -18,8 +18,8 @@ constexpr int MAX_PERCENT = 100; // Full PWM = the motors' rated 12 V (bench 05/constexpr uint32_t COMMAND_TIMEOUT_MS = 300;constexpr uint32_t ARM_TIMEOUT_MS = 10000;constexpr uint32_t TEST_MS = 1000;-constexpr uint32_t RAMP_RISE_MS_DEFAULT = 10; // ms per 1 % up (0 -> 100 % in 1.0 s)-constexpr uint32_t RAMP_FALL_MS_DEFAULT = 5; // ms per 1 % down (100 -> 0 % in 0.5 s)+constexpr uint32_t RAMP_RISE_MS_DEFAULT = 30; // ms per 1 % up (0 -> 70 % in 2.1 s, 100 % in 3 s)+constexpr uint32_t RAMP_FALL_MS_DEFAULT = 15; // ms per 1 % down (70 -> 0 % in 1.05 s)constexpr uint32_t RAMP_MS_MIN = 1, RAMP_MS_MAX = 500;constexpr uint32_t REVERSE_DWELL_MS = 100; // at zero before changing directiondiff --git a/firmware/tests/control_v04_test.cpp b/firmware/tests/control_v04_test.cppindex b7152bd..aa0560d 100644--- a/firmware/tests/control_v04_test.cpp+++ b/firmware/tests/control_v04_test.cpp@@ -12,7 +12,7 @@ Reply cmd(Control& c, const char* s, uint32_t t) {int main() {Control c;assert(c.mode == OFF && c.left == 0 && c.right == 0);- assert(c.rampRiseMs == 10 && c.rampFallMs == 5);+ assert(c.rampRiseMs == 30 && c.rampFallMs == 15);assert(cmd(c,"drive 10 10",0)==NOT_ARMED);assert(cmd(c,"arm",10)==OK);assert(cmd(c,"drive 15 -20",20)==OK && c.left==15 && c.right==-20);