From 80b63a9d37b0617d583621f16f9a79004188a368 Mon Sep 17 00:00:00 2001 From: "gruvin@gmail.com" Date: Wed, 22 Aug 2012 07:09:27 +0000 Subject: [PATCH] Issue 105 -- DSM2 range check mode completed. However, I don't like that the only place I could find to turn off range check mode when the SETUP menus is exited, was in popMenu ... void popMenu() { if (g_menuStackPtr>0) { #ifdef DSM2 s_rangecheck_mode = 0; #endif ... } It was the only way I could find to trap the event of [EXIT long] being pressed while in the RANGE field and s_editMode==true. But this solution gets executed for all menu exits -- not just menuProcModels. It works, but there must be a more eloquent method? --- src/menus.cpp | 3 +++ src/model_menus.cpp | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/menus.cpp b/src/menus.cpp index d53b20a88..7e16fa6e5 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -476,6 +476,9 @@ uint8_t m_posHorz; void popMenu() { if (g_menuStackPtr>0) { +#ifdef DSM2 + s_rangecheck_mode = 0; +#endif g_menuStackPtr = g_menuStackPtr-1; AUDIO_KEYPAD_UP(); m_posHorz = 0; diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 7186cb679..6e240f3ca 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -797,10 +797,7 @@ void menuProcModel(uint8_t event) if (IS_DSM2_PROTOCOL(protocol)) { // RANGE CHECK lcd_putsnAtt(MODEL_PARAM_OFS+4*FW, y, PSTR(" RANGE0) - s_rangecheck_mode = true; - else - s_rangecheck_mode = false; + s_rangecheck_mode = (attr && m_posHorz==1 && s_editMode>0); // [MENU] key toggles range check mode } if (attr && (m_posHorz==0 && (s_editMode>0 || p1valdiff)))