[sky9x] Rotary encoder button may be used to clear alarms / warnings
This commit is contained in:
@@ -1068,14 +1068,6 @@ void menuGeneralCalib(uint8_t event)
|
||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i])>50) {
|
||||
g_eeGeneral.calibMid[i] = reusableBuffer.calib.midVals[i];
|
||||
int16_t v = reusableBuffer.calib.midVals[i] - reusableBuffer.calib.loVals[i];
|
||||
|
||||
// Stick tolerance varies between transmitters, Higher is better
|
||||
#if defined (PCB9XR) || defined (PCB9XR128)
|
||||
#define STICK_TOLERANCE 16
|
||||
#else
|
||||
#define STICK_TOLERANCE 64
|
||||
#endif
|
||||
|
||||
g_eeGeneral.calibSpanNeg[i] = v - v/STICK_TOLERANCE;
|
||||
v = reusableBuffer.calib.hiVals[i] - reusableBuffer.calib.midVals[i];
|
||||
g_eeGeneral.calibSpanPos[i] = v - v/STICK_TOLERANCE;
|
||||
|
||||
+15
-7
@@ -292,14 +292,22 @@ void menuChannelsMonitor(uint8_t event);
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
#if defined(ROTARY_ENCODERS) || defined(PCBX9D)
|
||||
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT || lastCursorMove < 0)
|
||||
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT || lastCursorMove > 0)
|
||||
#define REPEAT_LAST_CURSOR_MOVE() if (lastCursorMove) lastCursorMove *= 2; else m_posHorz = 0
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#define KEY_MOVE_UP KEY_PLUS
|
||||
#define KEY_MOVE_DOWN KEY_MINUS
|
||||
#else
|
||||
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT)
|
||||
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
|
||||
#define REPEAT_LAST_CURSOR_MOVE() m_posHorz = 0;
|
||||
#define KEY_MOVE_UP KEY_UP
|
||||
#define KEY_MOVE_DOWN KEY_DOWN
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS) || defined(PCBX9D)
|
||||
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT || lastCursorMove < 0)
|
||||
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT || lastCursorMove > 0)
|
||||
#define REPEAT_LAST_CURSOR_MOVE() if (lastCursorMove) lastCursorMove *= 2; else m_posHorz = 0
|
||||
#else
|
||||
#define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_LEFT)
|
||||
#define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_RIGHT)
|
||||
#define REPEAT_LAST_CURSOR_MOVE() m_posHorz = 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+4
-7
@@ -1259,14 +1259,11 @@ char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultN
|
||||
#define ZLEN(s) zlen(s, sizeof(s))
|
||||
#endif
|
||||
|
||||
// TODO perhaps better in menus.h ?
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBACT)
|
||||
#define KEY_MOVE_UP KEY_PLUS
|
||||
#define KEY_MOVE_DOWN KEY_MINUS
|
||||
// Stick tolerance varies between transmitters, Higher is better
|
||||
#if defined (PCB9XR) || defined (PCB9XR128)
|
||||
#define STICK_TOLERANCE 16
|
||||
#else
|
||||
#define KEY_MOVE_UP KEY_UP
|
||||
#define KEY_MOVE_DOWN KEY_DOWN
|
||||
#define STICK_TOLERANCE 64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -236,4 +236,10 @@ void eepromInit();
|
||||
void rotencInit();
|
||||
void rotencEnd();
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
#define rotencDown() (!(PIOB->PIO_PDSR & 0x40))
|
||||
#else
|
||||
#define rotencDown() 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -113,7 +113,7 @@ uint32_t readTrims()
|
||||
|
||||
uint8_t keyDown()
|
||||
{
|
||||
return ~readKeys() & 0x7E ;
|
||||
return (~readKeys() & 0x7E) || rotencDown();
|
||||
}
|
||||
|
||||
void readKeysAndTrims()
|
||||
@@ -121,7 +121,7 @@ void readKeysAndTrims()
|
||||
register uint32_t i;
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
keys[BTN_REa].input(!(PIOB->PIO_PDSR & 0x40), BTN_REa);
|
||||
keys[BTN_REa].input(rotencDown(), BTN_REa);
|
||||
#endif
|
||||
|
||||
uint8_t enuk = KEY_MENU;
|
||||
|
||||
Reference in New Issue
Block a user