@@ -44,9 +44,22 @@ uint16_t readThrottleRaw();
4444/** Get the most recently sampled raw throttle value (0..4095). */
4545uint16_t getLastThrottleRaw ();
4646
47- /** Convert raw pot reading (0..4095) to PWM microseconds. */
47+ /** Convert raw pot reading (0..4095) to PWM microseconds (full range) . */
4848int potRawToPwm (uint16_t raw );
4949
50+ /**
51+ * Convert raw pot reading (0..4095) to PWM microseconds using the
52+ * mode-specific maximum. In chill mode the full physical range maps to
53+ * ESC_MIN_PWM..CHILL_MODE_MAX_PWM; in sport mode it maps to the full
54+ * ESC_MIN_PWM..ESC_MAX_PWM range. This gives chill mode full granular
55+ * control over its limited output range instead of a hard clamp.
56+ *
57+ * @param raw Raw ADC value (0..4095)
58+ * @param performance_mode 0 = CHILL, 1 = SPORT
59+ * @return PWM microseconds in the mode's range
60+ */
61+ int potRawToModePwm (uint16_t raw , uint8_t performance_mode );
62+
5063/**
5164 * Apply mode-based ramp (us/tick) and clamp to the mode's max PWM.
5265 * Updates `prevPwm` with the final value.
@@ -86,10 +99,13 @@ bool throttleEngaged();
8699/**
87100 * Read throttle input and return smoothed PWM value.
88101 * This is the core throttle processing pipeline without any state logic.
102+ * Uses mode-aware mapping so the full physical range covers the mode's
103+ * PWM output range.
89104 *
105+ * @param performance_mode 0 = CHILL, 1 = SPORT
90106 * @return Smoothed PWM value from throttle input
91107 */
92- int getSmoothedThrottlePwm ();
108+ int getSmoothedThrottlePwm (uint8_t performance_mode );
93109
94110/**
95111 * Reset throttle state for clean startup/disarm.
@@ -107,8 +123,8 @@ void handleThrottle();
107123
108124/**
109125 * Calculate the cruise control PWM value from a raw pot reading.
110- * Uses the same mapping as normal throttle (full range then clamp to mode max).
111- * Also applies the absolute cruise max cap.
126+ * Uses the same mode-aware mapping as normal throttle, then applies
127+ * the absolute cruise max cap.
112128 *
113129 * @param potVal Raw potentiometer value (0..4095)
114130 * @param performance_mode 0 = CHILL, 1 = SPORT
0 commit comments