Skip to content

Commit a083c75

Browse files
feat(firmware): friendly Slow/Medium/Fast speed presets (data-chosen), raise cap
Add a "Speed" preset select (Motion Tuning) mapping Slow/Medium/Fast to 1200 / 2600 / 5500 steps/s, and demote the raw Speed slider to the advanced group (mirrors the Ropener pattern). Raise stepper_max_speed 1200 -> 5500 so Fast is reachable. Values chosen from an accelerometer resonance sweep of this mechanism (external measurement tool, not shipped): vibration is flat and quiet across the range EXCEPT a violent drivetrain resonance at ~2900-3300 (worst 3000-3100, peak ~1 g). All three presets avoid parking in that band; ramps cross it only transiently, which measured harmless (clean position tracking). The motor holds torque with no step loss all the way to 9000, but 6000+ free-run vibration exceeds the vib-stall threshold, so the product cap sits at 5500 (Fast) to stay clear of false trips. The select reads/writes global_speed (single source of truth, restored on boot); changing speed auto-flags the StallGuard calibration stale (SG_RESULT is speed-dependent). Verified on hardware: Slow->1200, Medium->2600, Fast->5500.
1 parent c9a4601 commit a083c75

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

‎firmware/esphome/Glasscalibur-esphome.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ substitutions:
3939
stepper_rsense: "220 mOhm"
4040
stepper_vsense: "false"
4141
stepper_deceleration: "inf" # immediate stop
42-
stepper_max_speed: "1200 steps/s"
42+
stepper_max_speed: "5500 steps/s"
4343
stepper_acceleration: "100 steps/s^2"
4444
stepper_config_dump: "false"
4545
motor_direction_default: "COUNTERCLOCKWISE"

‎firmware/esphome/glasscalibur-product.yaml‎

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,11 @@ number:
10201020
# core numbers into the reorganized groups, tightens the current cap, and adds
10211021
# its own tamper/vibration tuning numbers.
10221022

1023-
# Move core's Speed + Acceleration into the product Motion Tuning group (above
1024-
# Schedule). Core's own group_motion is left empty and does not render.
1023+
# Acceleration lives in Motion Tuning. The raw Speed slider is driven by the
1024+
# friendly Slow/Medium/Fast preset select (below) and moves to the advanced
1025+
# group for power users; core's own group_motion is left empty and doesn't render.
10251026
- id: !extend num_speed
1026-
web_server: { sorting_weight: 1, sorting_group_id: group_tuning }
1027+
web_server: { sorting_weight: 8, sorting_group_id: group_sg_adv }
10271028
- id: !extend num_accel
10281029
web_server: { sorting_weight: 2, sorting_group_id: group_tuning }
10291030

@@ -1283,6 +1284,40 @@ switch:
12831284
# motor_direction_default substitution) and there is no runtime direction
12841285
# control, so drop core's "Motor Direction" select.
12851286
select:
1287+
# Friendly speed presets. Values were chosen from an accelerometer resonance
1288+
# sweep of this mechanism: there is a violent drivetrain resonance at ~2900-3300
1289+
# (worst 3000-3100) that all three presets stay clear of. Slow 1200 is silent;
1290+
# Medium 2600 sits just below the band; Fast 5500 is well above it (ramps only
1291+
# cross the band transiently, which is harmless). Like Motor Direction on other
1292+
# boards this holds no state of its own — it reads/writes global_speed (the
1293+
# single source of truth, restored on boot). The raw Speed slider lives in the
1294+
# advanced group. Changing speed re-flags the StallGuard calibration as stale
1295+
# automatically (SG_RESULT is speed-dependent; see Calibration Status).
1296+
- platform: template
1297+
name: "Speed"
1298+
id: sel_speed
1299+
icon: "mdi:speedometer"
1300+
entity_category: CONFIG
1301+
web_server: { sorting_weight: 1, sorting_group_id: group_tuning }
1302+
update_interval: 1s
1303+
options: ["Slow", "Medium", "Fast"]
1304+
lambda: |-
1305+
const int sp = id(global_speed);
1306+
if (sp <= 1900) return std::string("Slow"); // 1200
1307+
if (sp <= 4050) return std::string("Medium"); // 2600
1308+
return std::string("Fast"); // 5500
1309+
set_action:
1310+
- lambda: |-
1311+
int s = 5500; // Fast
1312+
if (x.find("Slow") != std::string::npos) s = 1200;
1313+
else if (x.find("Medium") != std::string::npos) s = 2600;
1314+
id(global_speed) = s;
1315+
- stepper.set_speed: { id: driver, speed: !lambda "return id(global_speed);" }
1316+
- lambda: |-
1317+
// Persist immediately so the choice survives an unplug seconds later.
1318+
global_speed->update();
1319+
global_preferences->sync();
1320+
12861321
- id: !remove sel_direction
12871322

12881323
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)