From 4cef332aeb74af577e59cdbbaa563cba03034842 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Thu, 12 Nov 2026 22:01:10 -0600 Subject: [PATCH] Remove duplicate Galaxy torque reset actions --- openpilot/starpilot/galaxy/settings.py | 2 ++ .../galaxy/tests/test_settings_defaults.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/openpilot/starpilot/galaxy/settings.py b/openpilot/starpilot/galaxy/settings.py index 5fe5d85028..18b6f65d7f 100644 --- a/openpilot/starpilot/galaxy/settings.py +++ b/openpilot/starpilot/galaxy/settings.py @@ -654,6 +654,8 @@ class SettingsGateway: system_long=_qualified(ctx, "long"), lateral_context=_qualified(ctx, "lane") or (page == "lane" and _qualified(ctx, "lane_live")), metric=ctx.metric, configure_while_driving=True) + if page == "torque": + state = replace(state, rows=tuple(row for row in state.rows if row.key not in ("torque:factor:reset", "torque:friction:reset"))) if ctx.editing_saved_vehicle: from opendbc.car.values import PLATFORMS platform = PLATFORMS[ctx.cp.carFingerprint] diff --git a/openpilot/starpilot/galaxy/tests/test_settings_defaults.py b/openpilot/starpilot/galaxy/tests/test_settings_defaults.py index c5fc8144fd..f7192ff1f1 100644 --- a/openpilot/starpilot/galaxy/tests/test_settings_defaults.py +++ b/openpilot/starpilot/galaxy/tests/test_settings_defaults.py @@ -39,6 +39,25 @@ class TestSettingsDefaults(TestCase): def confirm(self, intent): return self.gateway.confirm(intent['intent'], self.session, self.generation) + def test_torque_sliders_keep_defaults_without_duplicate_reset_rows(self): + from openpilot.starpilot.lateral.tests.test_lane_runtime import ioniq_candidate + _, cp = ioniq_candidate() + self.context.value = AuthorityContext(True, cp, cp.as_reader().as_builder().to_bytes()) + for label in ('Lat Accel', 'Friction'): + page = self.page('torque') + self.assertFalse(any('Reset to Default' in row['label'] for row in page['rows'])) + index = next(i for i, row in enumerate(page['rows']) if row['label'] == label) + row = page['rows'][index] + previous = float(row['value']) + direction = -1 if previous >= row['maximum'] else 1 + intent = self.gateway.preview(page['view'], index, direction, self.session, self.generation) + self.assertTrue(self.confirm(intent)) + row, intent = self.reset('torque', label) + self.assertEqual(row['defaultValue'], 'Vehicle/learned') + self.assertTrue(self.confirm(intent)) + restored = next(row for row in self.page('torque')['rows'] if row['label'] == label) + self.assertAlmostEqual(float(restored['value']), previous) + def test_boolean_and_numeric_defaults_are_owner_values(self): self.params.put_bool('LaneCentering', True, block=True) self.params.put_bool('LaneCenteringPauseOnSignal', False, block=True)