From 6ded23f26bc01580ab7d506941bf72eaee7d77a9 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 5 Jul 2021 09:04:06 +1000 Subject: [PATCH] Reset logical switch v2 range if v1 changes (PR #383) * Reset logical switch v2 range if v1 changes Use the v1 handler to update v2 range if the v2 source box has already been created, so that the min/max values are updated from the default. * Move invalidate, add bounds checking for v2 range * Out of range check doesn't need to be inclusive * Remove range check as is inconsistent with buggy B&W behaviour --- radio/src/gui/colorlcd/model_logical_switches.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/colorlcd/model_logical_switches.cpp b/radio/src/gui/colorlcd/model_logical_switches.cpp index 16b6a6ec1..cbe2d968d 100644 --- a/radio/src/gui/colorlcd/model_logical_switches.cpp +++ b/radio/src/gui/colorlcd/model_logical_switches.cpp @@ -161,7 +161,14 @@ class LogicalSwitchEditPage: public Page [=](int32_t newValue) { cs->v1 = newValue; SET_DIRTY(); - v2Edit->invalidate(); + if (v2Edit != nullptr) + { + int16_t v2_min = 0, v2_max = 0; + getMixSrcRange(cs->v1, v2_min, v2_max); + v2Edit->setMin(v2_min); + v2Edit->setMax(v2_max); + v2Edit->invalidate(); + } }); grid.nextLine();