From b0ae67e2e5a0b76e6a2da2c2b74020dd0d89f274 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 16 Mar 2013 20:50:31 +0000 Subject: [PATCH] Issue232 fixed (Steps for sky9x rotary encoder) --- src/general_menus.cpp | 9 +++++++-- src/myeeprom.h | 3 ++- src/open9x.h | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 7ebeb4c7f..3c2ca2d9c 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -952,6 +952,7 @@ enum menuGeneralHwItems { ITEM_SETUP_HW_STICK_LH_GAIN, ITEM_SETUP_HW_STICK_RV_GAIN, ITEM_SETUP_HW_STICK_RH_GAIN, + ITEM_SETUP_HW_ROTARY_ENCODER, IF_BLUETOOTH(ITEM_SETUP_HW_BT_BAUDRATE) ITEM_SETUP_HW_MAX }; @@ -987,7 +988,7 @@ void menuGeneralHardware(uint8_t event) lcd_puts(INDENT_WIDTH+3*FW, y, PSTR("Gain")); uint8_t mask = (1<<(k-ITEM_SETUP_HW_STICK_LV_GAIN)); uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0); - lcd_putcAtt(15*FW, y, val ? '2' : '1', attr); + lcd_putcAtt(GENERAL_HW_PARAM_OFS, y, val ? '2' : '1', attr); if (attr) { CHECK_INCDEC_GENVAR(event, val, 0, 1); if (checkIncDec_Ret) { @@ -998,9 +999,13 @@ void menuGeneralHardware(uint8_t event) break; } + case ITEM_SETUP_HW_ROTARY_ENCODER: + g_eeGeneral.rotarySteps = selectMenuItem(GENERAL_HW_PARAM_OFS, y, PSTR("Rotary Encoder"), PSTR("\0062steps4steps"), g_eeGeneral.rotarySteps, 0, 1, attr, event); + break; + #if defined(BLUETOOTH) case ITEM_SETUP_HW_BT_BAUDRATE: - g_eeGeneral.btBaudrate = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event); + g_eeGeneral.btBaudrate = selectMenuItem(GENERAL_HW_PARAM_OFS, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event); if (attr && checkIncDec_Ret) { btInit(); } diff --git a/src/myeeprom.h b/src/myeeprom.h index e7bd4bcb2..2d7a3cdaf 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -146,7 +146,8 @@ enum BeeperMode { int8_t temperatureCalib; \ uint8_t btBaudrate; \ uint8_t optrexDisplay; \ - uint8_t sticksGain; + uint8_t sticksGain; \ + uint8_t rotarySteps; #else #define EXTRA_GENERAL_FIELDS #endif diff --git a/src/open9x.h b/src/open9x.h index 9e0b27e31..0107157ec 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -733,9 +733,9 @@ extern void setTrimValue(uint8_t phase, uint8_t idx, int16_t trim); #endif #if defined(PCBGRUVIN9X) - #define ROTARY_ENCODER_GRANULARITY 1 + #define ROTARY_ENCODER_GRANULARITY (1) #else - #define ROTARY_ENCODER_GRANULARITY 2 + #define ROTARY_ENCODER_GRANULARITY (2 << g_eeGeneral.rotarySteps) #endif #if defined(GVARS)