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