From 77010ee7e34dde3818c3100d1d70260997f029b0 Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 9 Sep 2016 20:41:48 +0200 Subject: [PATCH 1/7] TRACE test --- radio/src/switches.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index ff55bda32..1c684eab6 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -863,6 +863,7 @@ void checkSwitches() continue; } if (!(g_model.potsWarnEnabled & (1 << i))) { + TRACE("POT:%d WANT:%d GOT:%d STATUS:%s", i, g_model.potsWarnPosition[i],GET_LOWRES_POT_POSITION(i), (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) ? "FAIL" : "PASS"); if (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) { #if defined(COLORLCD) char s[8]; From 19fd1f25564ecff91aed093ba15bd5ad99269df4 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 10 Sep 2016 10:40:54 +0200 Subject: [PATCH 2/7] Finaly working on X9E, tested both man and auto --- radio/src/opentx.h | 2 +- radio/src/switches.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 70951f67f..03d906a3d 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -302,7 +302,7 @@ void memswap(void * a, void * b, uint8_t size); #define POT_CONFIG(x) ((g_eeGeneral.potsConfig >> (2*((x)-POT1)))&0x03) #define IS_POT_MULTIPOS(x) (IS_POT(x) && POT_CONFIG(x)==POT_MULTIPOS_SWITCH) #define IS_POT_WITHOUT_DETENT(x) (IS_POT(x) && POT_CONFIG(x)==POT_WITHOUT_DETENT) - #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER1))))) + #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))) #define IS_POT_AVAILABLE(x) (IS_POT(x) && POT_CONFIG(x)!=POT_NONE) #define IS_POT_OR_SLIDER_AVAILABLE(x) (IS_POT_AVAILABLE(x) || IS_SLIDER_AVAILABLE(x)) #define IS_MULTIPOS_CALIBRATED(cal) (cal->count>0 && cal->count 1)) { @@ -859,11 +859,10 @@ void checkSwitches() x = 60; } for (int i=0; i 1) ? "FAIL" : "PASS"); if (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) { #if defined(COLORLCD) char s[8]; From df7882e14f7c9335a45c4b5abe088aa25b6e61be Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 10 Sep 2016 11:12:45 +0200 Subject: [PATCH 3/7] Yes, commit-check would have been a good idea :s --- radio/src/opentx.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 03d906a3d..545a89be1 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -297,12 +297,15 @@ #endif void memswap(void * a, void * b, uint8_t size); - +#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBHORUS) + #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER1))))) +#elif defined(PCBX9E) + #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))) +#endif #if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || defined(PCBHORUS) #define POT_CONFIG(x) ((g_eeGeneral.potsConfig >> (2*((x)-POT1)))&0x03) #define IS_POT_MULTIPOS(x) (IS_POT(x) && POT_CONFIG(x)==POT_MULTIPOS_SWITCH) #define IS_POT_WITHOUT_DETENT(x) (IS_POT(x) && POT_CONFIG(x)==POT_WITHOUT_DETENT) - #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))) #define IS_POT_AVAILABLE(x) (IS_POT(x) && POT_CONFIG(x)!=POT_NONE) #define IS_POT_OR_SLIDER_AVAILABLE(x) (IS_POT_AVAILABLE(x) || IS_SLIDER_AVAILABLE(x)) #define IS_MULTIPOS_CALIBRATED(cal) (cal->count>0 && cal->count Date: Sat, 10 Sep 2016 19:31:18 +0200 Subject: [PATCH 4/7] The 4 sliders are now treated equally :) WARNING : -you WILL need to go in hardware menu to add the 2 missing sliders . definition - you also NEED to go to calibration (where you will now see the 4 sliders) --- radio/src/gui/212x64/radio_hardware.cpp | 14 +++++++------- radio/src/opentx.h | 7 ++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/radio/src/gui/212x64/radio_hardware.cpp b/radio/src/gui/212x64/radio_hardware.cpp index f6dd41b0a..cab76d3d0 100644 --- a/radio/src/gui/212x64/radio_hardware.cpp +++ b/radio/src/gui/212x64/radio_hardware.cpp @@ -2,7 +2,7 @@ * Copyright (C) OpenTX * * Based on code named - * th9x - http://code.google.com/p/th9x + * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * @@ -103,8 +103,6 @@ void menuRadioHardware(event_t event) case ITEM_RADIO_HARDWARE_STICK2: case ITEM_RADIO_HARDWARE_STICK3: case ITEM_RADIO_HARDWARE_STICK4: - case ITEM_RADIO_HARDWARE_LS: - case ITEM_RADIO_HARDWARE_RS: { int idx = (k<=ITEM_RADIO_HARDWARE_STICK4 ? k-ITEM_RADIO_HARDWARE_STICK1 : k-ITEM_RADIO_HARDWARE_LS+MIXSRC_SLIDER1-MIXSRC_Rud); lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0); @@ -115,14 +113,16 @@ void menuRadioHardware(event_t event) break; } #if defined(PCBX9E) + case ITEM_RADIO_HARDWARE_LS: + case ITEM_RADIO_HARDWARE_RS: case ITEM_RADIO_HARDWARE_LS2: case ITEM_RADIO_HARDWARE_RS2: { - int idx = k - ITEM_RADIO_HARDWARE_LS2; + int idx = k - ITEM_RADIO_HARDWARE_LS; uint8_t mask = (0x01 << idx); - lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_XPOTS+2+idx+1, menuHorizontalPosition < 0 ? attr : 0); - if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+2+idx]) || (attr && menuHorizontalPosition == 0)) - editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+2+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0); + lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_XPOTS+idx+1, menuHorizontalPosition < 0 ? attr : 0); + if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+idx]) || (attr && menuHorizontalPosition == 0)) + editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0); else lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx; diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 545a89be1..4be887528 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -297,16 +297,13 @@ #endif void memswap(void * a, void * b, uint8_t size); -#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBHORUS) - #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER1))))) -#elif defined(PCBX9E) - #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))) -#endif + #if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || defined(PCBHORUS) #define POT_CONFIG(x) ((g_eeGeneral.potsConfig >> (2*((x)-POT1)))&0x03) #define IS_POT_MULTIPOS(x) (IS_POT(x) && POT_CONFIG(x)==POT_MULTIPOS_SWITCH) #define IS_POT_WITHOUT_DETENT(x) (IS_POT(x) && POT_CONFIG(x)==POT_WITHOUT_DETENT) #define IS_POT_AVAILABLE(x) (IS_POT(x) && POT_CONFIG(x)!=POT_NONE) + #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))) #define IS_POT_OR_SLIDER_AVAILABLE(x) (IS_POT_AVAILABLE(x) || IS_SLIDER_AVAILABLE(x)) #define IS_MULTIPOS_CALIBRATED(cal) (cal->count>0 && cal->count Date: Sat, 10 Sep 2016 20:14:01 +0200 Subject: [PATCH 5/7] Fix --- radio/src/opentx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 4be887528..70951f67f 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -302,8 +302,8 @@ void memswap(void * a, void * b, uint8_t size); #define POT_CONFIG(x) ((g_eeGeneral.potsConfig >> (2*((x)-POT1)))&0x03) #define IS_POT_MULTIPOS(x) (IS_POT(x) && POT_CONFIG(x)==POT_MULTIPOS_SWITCH) #define IS_POT_WITHOUT_DETENT(x) (IS_POT(x) && POT_CONFIG(x)==POT_WITHOUT_DETENT) + #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER1))))) #define IS_POT_AVAILABLE(x) (IS_POT(x) && POT_CONFIG(x)!=POT_NONE) - #define IS_SLIDER_AVAILABLE(x) ((x) == SLIDER1 || (x) == SLIDER2 || (IS_SLIDER(x) && (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))) #define IS_POT_OR_SLIDER_AVAILABLE(x) (IS_POT_AVAILABLE(x) || IS_SLIDER_AVAILABLE(x)) #define IS_MULTIPOS_CALIBRATED(cal) (cal->count>0 && cal->count Date: Sun, 11 Sep 2016 09:39:06 +0200 Subject: [PATCH 6/7] Fixes --- radio/src/gui/212x64/radio_hardware.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/radio/src/gui/212x64/radio_hardware.cpp b/radio/src/gui/212x64/radio_hardware.cpp index cab76d3d0..8fec7b471 100644 --- a/radio/src/gui/212x64/radio_hardware.cpp +++ b/radio/src/gui/212x64/radio_hardware.cpp @@ -112,17 +112,19 @@ void menuRadioHardware(event_t event) lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); break; } -#if defined(PCBX9E) + case ITEM_RADIO_HARDWARE_LS: case ITEM_RADIO_HARDWARE_RS: +#if defined(PCBX9E) case ITEM_RADIO_HARDWARE_LS2: case ITEM_RADIO_HARDWARE_RS2: +#endif { int idx = k - ITEM_RADIO_HARDWARE_LS; uint8_t mask = (0x01 << idx); - lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_XPOTS+idx+1, menuHorizontalPosition < 0 ? attr : 0); - if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+idx]) || (attr && menuHorizontalPosition == 0)) - editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0); + lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_POTS+idx+1, menuHorizontalPosition < 0 ? attr : 0); + if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_POTS+idx]) || (attr && menuHorizontalPosition == 0)) + editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_POTS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0); else lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx; @@ -131,7 +133,7 @@ void menuRadioHardware(event_t event) g_eeGeneral.slidersConfig |= (potType << idx); break; } -#endif + case ITEM_RADIO_HARDWARE_LABEL_POTS: lcdDrawTextAlignedLeft(y, STR_POTS); break; From 5590feac0f3c80ddd2a19a75569c09427a5b7be3 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 11 Sep 2016 13:14:03 +0200 Subject: [PATCH 7/7] Make column handling consistent. Simu tested on x9d, x9d+, x9e --- radio/src/gui/212x64/radio_hardware.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/src/gui/212x64/radio_hardware.cpp b/radio/src/gui/212x64/radio_hardware.cpp index 8fec7b471..613799a6c 100644 --- a/radio/src/gui/212x64/radio_hardware.cpp +++ b/radio/src/gui/212x64/radio_hardware.cpp @@ -63,11 +63,11 @@ enum menuRadioHwItems { #define HW_SETTINGS_COLUMN 15*FW #if defined(PCBX9E) - #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 + #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #elif defined(PCBX9DP) - #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0 + #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #else - #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0 + #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #endif #if defined(PCBX9E)