From f1b2f980815fd4433fc1ec60a8a3980eec6966f8 Mon Sep 17 00:00:00 2001 From: Dado Mista Date: Mon, 20 Oct 2025 20:22:23 -0700 Subject: [PATCH 1/3] RT_TUNE: add mahonykp, turntilt start angle, and faster on/off speed It allows setting mahony kp roll and turntilt start angle. It also allows for higher atr on/off speeds in cfg[18]. Torquetilt speeds can now also be set to higher values (up to 18). Feature: Allow external apps to change features like mahonykp, turntilt start angle, and set faster on/off speeds --- src/main.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 5db10f18..ef703b96 100644 --- a/src/main.c +++ b/src/main.c @@ -1538,8 +1538,12 @@ static void cmd_runtime_tune(Data *d, unsigned char *cfg, int len) { split(cfg[7], &h1, &h2); d->float_conf.atr_angle_limit = h1 + 5; - d->float_conf.atr_on_speed = (h2 & 0x3) + 3; - d->float_conf.atr_off_speed = (h2 >> 2) + 2; + if (h2 > 0) { + // kept for compatibility reasons + // wider ranges can be set with byte[18] + d->float_conf.atr_on_speed = (h2 & 0x3) + 3; + d->float_conf.atr_off_speed = (h2 >> 2) + 2; + } split(cfg[8], &h1, &h2); d->float_conf.atr_response_boost = ((float) h1) / 10 + 1; @@ -1576,7 +1580,7 @@ static void cmd_runtime_tune(Data *d, unsigned char *cfg, int len) { split(cfg[15], &h1, &h2); float onspd = h1; float offspd = h2; - d->float_conf.torquetilt_on_speed = onspd / 2; + d->float_conf.torquetilt_on_speed = onspd + 3; d->float_conf.torquetilt_off_speed = offspd + 3; } if (len >= 17) { @@ -1585,6 +1589,20 @@ static void cmd_runtime_tune(Data *d, unsigned char *cfg, int len) { d->float_conf.kp2_brake = ((float) h2) / 10; beep_alert(d, 1, 1); } + if (len >= 18) { + split(cfg[17], &h1, &h2); + if (h1 > 0) { + d->float_conf.mahony_kp_roll = ((float) h1) / 10 + 1.0; + } + if (h2 > 0) { + d->float_conf.turntilt_start_angle = h2; + } + split(cfg[18], &h1, &h2); + if ((h1 > 0) && (h2 > 0)) { + d->float_conf.atr_on_speed = h1 * 2; + d->float_conf.atr_off_speed = h2 * 2; + } + } reconfigure(d); } From 2c06bd1e8120fab3a1446867086046f7a805c143 Mon Sep 17 00:00:00 2001 From: Dado Mista Date: Wed, 16 Apr 2025 23:16:57 -0700 Subject: [PATCH 2/3] TUNE_OTHER: Flags for DMF, SensorBeep and Parking Brake Mode, Negative VarTilt Stays Backwards compatible with older apps Feature: Allow external apps to set DMF, SensorBeep and Parking Brake Mode, as well as negative variable tilt --- src/main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index ef703b96..57b55ace 100644 --- a/src/main.c +++ b/src/main.c @@ -1727,7 +1727,12 @@ static void cmd_runtime_tune_other(Data *d, unsigned char *cfg, int len) { if (tiltspeed > 0) { d->float_conf.noseangling_speed = tiltspeed / 10; } - d->float_conf.tiltback_variable = tiltvarrate / 100; + if (tiltvarrate > 100) { + // numbers above 100 are negative + d->float_conf.tiltback_variable = (tiltvarrate - 100) / (-100); + } else { + d->float_conf.tiltback_variable = tiltvarrate / 100; + } d->float_conf.tiltback_variable_max = tiltvarmax / 10; d->float_conf.tiltback_variable_erpm = cfg[11] * 100; } @@ -1743,6 +1748,18 @@ static void cmd_runtime_tune_other(Data *d, unsigned char *cfg, int len) { } } + if (len >= 15) { + int flags2 = cfg[14]; + // bits 0 & 1: + d->float_conf.fault_moving_fault_disabled = ((flags2 & 0x1) == 0x1); + d->float_conf.is_footbeep_enabled = ((flags2 & 0x2) == 0x2); + d->switch_warn_beep_erpm = d->float_conf.is_footbeep_enabled ? 2000 : 100000; + // bits 2 & 3: + int pbmode = (flags2 >> 2) & 0x3; + d->motor_control.parking_brake_mode = pbmode; + d->float_conf.parking_brake_mode = pbmode; + } + reconfigure(d); } From 287d0eff17f4d841b098b79a5a626db6d766cd1b Mon Sep 17 00:00:00 2001 From: Dado Mista Date: Thu, 21 May 2026 08:39:42 -0700 Subject: [PATCH 3/3] TUNE_TILT: Allow setting speed pushback in km/h Feature: Allow external apps to set speed pushback threshold on the fly --- src/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.c b/src/main.c index 57b55ace..4f0ff11c 100644 --- a/src/main.c +++ b/src/main.c @@ -1680,6 +1680,9 @@ static void cmd_runtime_tune_tilt(Data *d, unsigned char *cfg, int len) { d->float_conf.tiltback_duty = (float) cfg[2] / 100.0; d->float_conf.tiltback_duty_angle = (float) cfg[3] / 10.0; d->float_conf.tiltback_duty_speed = (float) cfg[4] / 10.0; + if (len >= 6) { + d->float_conf.tiltback_speed = (float) cfg[5]; + } beep_alert(d, 3, 0); }