From 66159729f005def9707c9e7fef5cc51ca3dd60de 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 | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 5eb353f4..e086dea0 100644 --- a/src/main.c +++ b/src/main.c @@ -1576,8 +1576,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; @@ -1614,7 +1618,12 @@ 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; + if (len >= 19) { + // use message length to identify apps that support the newer protocol + d->float_conf.torquetilt_on_speed = onspd + 3; + } else { + d->float_conf.torquetilt_on_speed = onspd / 2; + } d->float_conf.torquetilt_off_speed = offspd + 3; } if (len >= 17) { @@ -1623,6 +1632,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 >= 19) { + 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 d55c6af3e73d373a535e2ad6d4f2c1d735b084b0 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 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index e086dea0..5f502437 100644 --- a/src/main.c +++ b/src/main.c @@ -1770,7 +1770,12 @@ static void cmd_runtime_tune_other(Data *d, unsigned char *cfg, int len) { d->float_conf.noseangling_speed = tiltspeed / 10; } d->float_conf.tiltback_variable = tiltvarrate / 100; - d->float_conf.tiltback_variable_max = tiltvarmax / 10; + if (tiltvarmax > 100) { + // numbers above 100 are negative + d->float_conf.tiltback_variable_max = (tiltvarmax - 100) / (-10); + } else { + d->float_conf.tiltback_variable_max = tiltvarmax / 10; + } d->float_conf.tiltback_variable_erpm = cfg[11] * 100; } @@ -1785,6 +1790,17 @@ 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->float_conf.parking_brake_mode = pbmode; + } + reconfigure(d); } From 1d96cb4ec50d0e1b144a386a1a95355da5a8c6a3 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 5f502437..e9e43d3b 100644 --- a/src/main.c +++ b/src/main.c @@ -1722,6 +1722,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); }