Free EEPROM = available + temp - current model
Low EEPROM warning displayed on model change [ersky9x] Rotary Encoder
This commit is contained in:
@@ -347,6 +347,10 @@ ifeq ($(PCB), ARM)
|
|||||||
ifeq ($(SDCARD), YES)
|
ifeq ($(SDCARD), YES)
|
||||||
SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c ersky9x/diskio.c
|
SRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c ersky9x/diskio.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ROTARY_ENCODERS), YES)
|
||||||
|
CPPDEFS += -DROTARY_ENCODERS
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PCB), V4)
|
ifeq ($(PCB), V4)
|
||||||
|
|||||||
@@ -415,6 +415,46 @@ void end_ppm_capture()
|
|||||||
NVIC_DisableIRQ(TC3_IRQn) ;
|
NVIC_DisableIRQ(TC3_IRQn) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init_rotary_encoder()
|
||||||
|
{
|
||||||
|
configure_pins( PIO_PC19 | PIO_PC21, PIN_ENABLE | PIN_INPUT | PIN_PORTC | PIN_PULLUP ) ; // 19 and 21 are rotary encoder
|
||||||
|
configure_pins( PIO_PB6, PIN_ENABLE | PIN_INPUT | PIN_PORTB | PIN_PULLUP ) ; // rotary encoder switch
|
||||||
|
PIOC->PIO_IER = PIO_PC19 | PIO_PC21 ;
|
||||||
|
NVIC_EnableIRQ(PIOC_IRQn) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void stop_rotary_encoder()
|
||||||
|
{
|
||||||
|
NVIC_DisableIRQ(PIOC_IRQn) ;
|
||||||
|
PIOC->PIO_IDR = PIO_PC19 | PIO_PC21 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
volatile uint32_t Rotary_position ;
|
||||||
|
extern "C" void PIOC_IRQHandler()
|
||||||
|
{
|
||||||
|
register uint32_t dummy;
|
||||||
|
|
||||||
|
dummy = PIOC->PIO_ISR ; // Read and clear status register
|
||||||
|
(void) dummy ; // Discard value - prevents compiler warning
|
||||||
|
|
||||||
|
dummy = PIOC->PIO_PDSR ; // Read Rotary encoder (PC19, PC21)
|
||||||
|
dummy >>= 19 ;
|
||||||
|
dummy &= 0x05 ; // pick out the three bits
|
||||||
|
if ( dummy != ( Rotary_position & 0x05 ) )
|
||||||
|
{
|
||||||
|
if ( ( Rotary_position & 0x01 ) ^ ( ( dummy & 0x04) >> 2 ) )
|
||||||
|
{
|
||||||
|
incRotaryEncoder(0, -1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
incRotaryEncoder(0, +1);
|
||||||
|
}
|
||||||
|
Rotary_position &= ~0x45 ;
|
||||||
|
Rotary_position |= dummy ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void TC2_IRQHandler()
|
extern "C" void TC2_IRQHandler()
|
||||||
{
|
{
|
||||||
register uint32_t dummy;
|
register uint32_t dummy;
|
||||||
@@ -733,6 +773,8 @@ void board_init()
|
|||||||
|
|
||||||
eeprom_init();
|
eeprom_init();
|
||||||
|
|
||||||
|
init_rotary_encoder();
|
||||||
|
|
||||||
init_SDcard();
|
init_SDcard();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -980,6 +1022,10 @@ void readKeysAndTrims()
|
|||||||
{
|
{
|
||||||
register uint32_t i;
|
register uint32_t i;
|
||||||
|
|
||||||
|
#if defined(ROTARY_ENCODERS)
|
||||||
|
keys[BTN_RE1].input(PIOB->PIO_PDSR & 0x40, BTN_RE1);
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t enuk = KEY_MENU;
|
uint8_t enuk = KEY_MENU;
|
||||||
uint8_t in = ~read_keys();
|
uint8_t in = ~read_keys();
|
||||||
for (i = 1; i < 7; i++) {
|
for (i = 1; i < 7; i++) {
|
||||||
@@ -1106,6 +1152,7 @@ void usb_mode()
|
|||||||
// This might be replaced by a software reset
|
// This might be replaced by a software reset
|
||||||
// Any interrupts that have been enabled must be disabled here
|
// Any interrupts that have been enabled must be disabled here
|
||||||
// BEFORE calling sam_boot()
|
// BEFORE calling sam_boot()
|
||||||
|
stop_rotary_encoder();
|
||||||
endPdcUsartReceive() ; // Terminate any serial reception
|
endPdcUsartReceive() ; // Terminate any serial reception
|
||||||
end_ppm_capture() ;
|
end_ppm_capture() ;
|
||||||
end_spi() ;
|
end_spi() ;
|
||||||
|
|||||||
@@ -106,11 +106,11 @@ inline void board_init()
|
|||||||
EICRA = (1<<ISC30) | (1<<ISC20); // do the same for encoder 1
|
EICRA = (1<<ISC30) | (1<<ISC20); // do the same for encoder 1
|
||||||
EIFR = (3<<INTF2);
|
EIFR = (3<<INTF2);
|
||||||
|
|
||||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||||
EIMSK = (3<<INT5); // enable the ONE rot. enc. ext. int. pairs.
|
EIMSK = (3<<INT5); // enable the ONE rot. enc. ext. int. pairs.
|
||||||
#else
|
#else
|
||||||
EIMSK = (3<<INT5) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
|
EIMSK = (3<<INT5) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
|
||||||
#endif
|
#endif
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -156,7 +156,7 @@ ISR(USART1_RX_vect)
|
|||||||
resh = (resh >> 1) & 0x01;
|
resh = (resh >> 1) & 0x01;
|
||||||
res = ((resh << 8) | resl);
|
res = ((resh << 8) | resl);
|
||||||
if((res == 0x180) | (res == 0x1C0)){ //button REb filter
|
if((res == 0x180) | (res == 0x1C0)){ //button REb filter
|
||||||
keys[BTN_REa].input((res & 0x1C0) == 0x1C0, BTN_REa);
|
keys[BTN_RE1].input((res & 0x1C0) == 0x1C0, BTN_RE1);
|
||||||
} else if((res & 0x100) == 0x100){ //rotary filter
|
} else if((res & 0x100) == 0x100){ //rotary filter
|
||||||
vpotToChange = res & 0xEF;
|
vpotToChange = res & 0xEF;
|
||||||
vpot_mod_state = 1;
|
vpot_mod_state = 1;
|
||||||
@@ -275,9 +275,9 @@ void readKeysAndTrims()
|
|||||||
uint8_t enuk = KEY_MENU;
|
uint8_t enuk = KEY_MENU;
|
||||||
|
|
||||||
#if !defined(EXTRA_ROTARY_ENCODERS)
|
#if !defined(EXTRA_ROTARY_ENCODERS)
|
||||||
keys[BTN_REa].input(~PIND & 0x20, BTN_REa);
|
keys[BTN_RE1].input(~PIND & 0x20, BTN_RE1);
|
||||||
#endif //!EXTRA_ROTARY_ENCODERS
|
#endif //!EXTRA_ROTARY_ENCODERS
|
||||||
keys[BTN_REb].input(~PIND & 0x10, BTN_REb);
|
keys[BTN_RE2].input(~PIND & 0x10, BTN_RE2);
|
||||||
|
|
||||||
uint8_t tin = ~PINL;
|
uint8_t tin = ~PINL;
|
||||||
uint8_t in;
|
uint8_t in;
|
||||||
|
|||||||
+6
-7
@@ -39,9 +39,7 @@
|
|||||||
uint8_t s_write_err = 0; // error reasons
|
uint8_t s_write_err = 0; // error reasons
|
||||||
uint8_t s_sync_write = false;
|
uint8_t s_sync_write = false;
|
||||||
uint8_t s_eeDirtyMsk;
|
uint8_t s_eeDirtyMsk;
|
||||||
#if defined(PCBV4) && !defined(REV0)
|
|
||||||
uint16_t s_eeDirtyTime10ms;
|
uint16_t s_eeDirtyTime10ms;
|
||||||
#endif
|
|
||||||
|
|
||||||
RlcFile theFile; //used for any file operation
|
RlcFile theFile; //used for any file operation
|
||||||
EeFs eeFs;
|
EeFs eeFs;
|
||||||
@@ -49,9 +47,7 @@ EeFs eeFs;
|
|||||||
void eeDirty(uint8_t msk)
|
void eeDirty(uint8_t msk)
|
||||||
{
|
{
|
||||||
s_eeDirtyMsk |= msk;
|
s_eeDirtyMsk |= msk;
|
||||||
#if defined(PCBV4) && !defined(REV0)
|
|
||||||
s_eeDirtyTime10ms = get_tmr10ms();
|
s_eeDirtyTime10ms = get_tmr10ms();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t eeprom_pointer;
|
uint16_t eeprom_pointer;
|
||||||
@@ -164,13 +160,15 @@ static void EeFsFlush()
|
|||||||
|
|
||||||
uint16_t EeFsGetFree()
|
uint16_t EeFsGetFree()
|
||||||
{
|
{
|
||||||
uint16_t ret = 0;
|
int16_t ret = 0;
|
||||||
uint8_t i = eeFs.freeList;
|
uint8_t i = eeFs.freeList;
|
||||||
while( i ){
|
while (i) {
|
||||||
ret += BS-1;
|
ret += BS-1;
|
||||||
i = EeFsGetLink(i);
|
i = EeFsGetLink(i);
|
||||||
}
|
}
|
||||||
return ret;
|
ret += eeFs.files[FILE_TMP].size;
|
||||||
|
ret -= eeFs.files[FILE_MODEL(g_eeGeneral.currModel)].size;
|
||||||
|
return (ret > 0 ? ret : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// free one or more blocks
|
/// free one or more blocks
|
||||||
@@ -867,6 +865,7 @@ void eeLoadModel(uint8_t id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pulsesStarted()) {
|
if (pulsesStarted()) {
|
||||||
|
checkLowEEPROM();
|
||||||
checkTHR();
|
checkTHR();
|
||||||
checkSwitches();
|
checkSwitches();
|
||||||
resumePulses();
|
resumePulses();
|
||||||
|
|||||||
+3
-1
@@ -38,8 +38,10 @@
|
|||||||
|
|
||||||
#if defined(PCBV4) && !defined(REV0)
|
#if defined(PCBV4) && !defined(REV0)
|
||||||
#define WRITE_DELAY_10MS 500
|
#define WRITE_DELAY_10MS 500
|
||||||
extern uint16_t s_eeDirtyTime10ms;
|
#else
|
||||||
|
#define WRITE_DELAY_10MS 200
|
||||||
#endif
|
#endif
|
||||||
|
extern uint16_t s_eeDirtyTime10ms;
|
||||||
|
|
||||||
//
|
//
|
||||||
// bs=16 128 blocks verlust link:128 16files:16*8 128 sum 256
|
// bs=16 128 blocks verlust link:128 16files:16*8 128 sum 256
|
||||||
|
|||||||
@@ -760,11 +760,11 @@ void menuProcDiagKeys(uint8_t event)
|
|||||||
lcd_putcAtt(5*FW+2, y, t+'0', t);
|
lcd_putcAtt(5*FW+2, y, t+'0', t);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (PCBV4)
|
#if defined (ROTARY_ENCODERS)
|
||||||
for(uint8_t i=0; i<2; i++) {
|
for(uint8_t i=0; i<2; i++) {
|
||||||
uint8_t y = i*FH + FH;
|
uint8_t y = i*FH + FH;
|
||||||
lcd_putsiAtt(14*FW, y, STR_RE1RE2, i, 0);
|
lcd_putsiAtt(14*FW, y, STR_RE1RE2, i, 0);
|
||||||
lcd_outdezNAtt(18*FW, y, g_rotenc[i], LEFT|(keyState((EnumKeys)(BTN_REa+i)) ? INVERS : 0));
|
lcd_outdezNAtt(18*FW, y, g_rotenc[i], LEFT|(keyState((EnumKeys)(BTN_RE1+i)) ? INVERS : 0));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -178,8 +178,8 @@ void menuMainView(uint8_t event)
|
|||||||
killEvents(KEY_DOWN);
|
killEvents(KEY_DOWN);
|
||||||
break;
|
break;
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
case EVT_KEY_LONG(BTN_REa):
|
case EVT_KEY_LONG(BTN_RE1):
|
||||||
case EVT_KEY_LONG(BTN_REb):
|
case EVT_KEY_LONG(BTN_RE2):
|
||||||
if (navigationRotaryEncoder(event)) {
|
if (navigationRotaryEncoder(event)) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
if (s_inflight_value && !s_inflight_enable) {
|
if (s_inflight_value && !s_inflight_enable) {
|
||||||
@@ -189,8 +189,8 @@ void menuMainView(uint8_t event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no break
|
// no break
|
||||||
case EVT_KEY_BREAK(BTN_REa):
|
case EVT_KEY_BREAK(BTN_RE1):
|
||||||
case EVT_KEY_BREAK(BTN_REb):
|
case EVT_KEY_BREAK(BTN_RE2):
|
||||||
s_inflight_enable = false;
|
s_inflight_enable = false;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+3
-3
@@ -227,12 +227,12 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
if (!(s_warning || s_sdcard_error || s_menu_count))
|
if (!(s_warning || s_sdcard_error || s_menu_count))
|
||||||
check_rotary_encoder();
|
check_rotary_encoder();
|
||||||
if (m_posVert < 0 && (event==EVT_KEY_FIRST(BTN_REa) || event==EVT_KEY_FIRST(BTN_REb) || event==EVT_KEY_FIRST(KEY_MENU))) {
|
if (m_posVert < 0 && (event==EVT_KEY_FIRST(BTN_RE1) || event==EVT_KEY_FIRST(BTN_RE2) || event==EVT_KEY_FIRST(KEY_MENU))) {
|
||||||
popMenu();
|
popMenu();
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (g_eeGeneral.reNavigation && event == EVT_KEY_BREAK(BTN_REa+g_eeGeneral.reNavigation-1)) {
|
if (g_eeGeneral.reNavigation && event == EVT_KEY_BREAK(BTN_RE1+g_eeGeneral.reNavigation-1)) {
|
||||||
if (s_editMode > 0 && (maxcol & ZCHAR)) {
|
if (s_editMode > 0 && (maxcol & ZCHAR)) {
|
||||||
if (m_posHorz < maxcol-ZCHAR) {
|
if (m_posHorz < maxcol-ZCHAR) {
|
||||||
m_posHorz++;
|
m_posHorz++;
|
||||||
@@ -670,7 +670,7 @@ void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t
|
|||||||
{
|
{
|
||||||
*value = (((uint8_t)(*value)) & ((1 << bitshift) - 1)) + ((i_shift + checkIncDecModel(event, (((uint8_t)(*value)) >> bitshift)-i_shift, i_min, i_max)) << bitshift);
|
*value = (((uint8_t)(*value)) & ((1 << bitshift) - 1)) + ((i_shift + checkIncDecModel(event, (((uint8_t)(*value)) >> bitshift)-i_shift, i_min, i_max)) << bitshift);
|
||||||
|
|
||||||
if (g_eeGeneral.reNavigation && event == EVT_KEY_LONG(BTN_REa+g_eeGeneral.reNavigation-1)) {
|
if (g_eeGeneral.reNavigation && event == EVT_KEY_LONG(BTN_RE1+g_eeGeneral.reNavigation-1)) {
|
||||||
if (value == s_inflight_value) {
|
if (value == s_inflight_value) {
|
||||||
s_inflight_value = NULL;
|
s_inflight_value = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -82,8 +82,8 @@ void menuProcDebug(uint8_t event);
|
|||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
extern int8_t scrollRE;
|
extern int8_t scrollRE;
|
||||||
extern int16_t p1valdiff;
|
extern int16_t p1valdiff;
|
||||||
#define IS_RE_NAVIGATION_EVT_TYPE(event, type) (g_eeGeneral.reNavigation && event==type(BTN_REa + g_eeGeneral.reNavigation - 1))
|
#define IS_RE_NAVIGATION_EVT_TYPE(event, type) (g_eeGeneral.reNavigation && event==type(BTN_RE1 + g_eeGeneral.reNavigation - 1))
|
||||||
#define IS_RE_NAVIGATION_EVT(event) (g_eeGeneral.reNavigation && (event&EVT_KEY_MASK)==(BTN_REa + g_eeGeneral.reNavigation - 1))
|
#define IS_RE_NAVIGATION_EVT(event) (g_eeGeneral.reNavigation && (event&EVT_KEY_MASK)==(BTN_RE1 + g_eeGeneral.reNavigation - 1))
|
||||||
#else
|
#else
|
||||||
#define IS_RE_NAVIGATION_EVT_TYPE(event, type) (0)
|
#define IS_RE_NAVIGATION_EVT_TYPE(event, type) (0)
|
||||||
#define IS_RE_NAVIGATION_EVT(event) (0)
|
#define IS_RE_NAVIGATION_EVT(event) (0)
|
||||||
|
|||||||
+18
-17
@@ -269,13 +269,13 @@ void menuProcModelSelect(uint8_t event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
case EVT_KEY_BREAK(BTN_REa):
|
case EVT_KEY_BREAK(BTN_RE1):
|
||||||
case EVT_KEY_BREAK(BTN_REb):
|
case EVT_KEY_BREAK(BTN_RE2):
|
||||||
if (navigationRotaryEncoder(_event))
|
if (navigationRotaryEncoder(_event))
|
||||||
s_editMode = (s_editMode == 0 && sub == g_eeGeneral.currModel) ? -1 : 0;
|
s_editMode = (s_editMode == 0 && sub == g_eeGeneral.currModel) ? -1 : 0;
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_LONG(BTN_REa):
|
case EVT_KEY_LONG(BTN_RE1):
|
||||||
case EVT_KEY_LONG(BTN_REb):
|
case EVT_KEY_LONG(BTN_RE2):
|
||||||
if (!navigationRotaryEncoder(_event))
|
if (!navigationRotaryEncoder(_event))
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -518,13 +518,13 @@ void EditName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, boo
|
|||||||
if (next<size-1) next++;
|
if (next<size-1) next++;
|
||||||
break;
|
break;
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
case EVT_KEY_LONG(BTN_REa):
|
case EVT_KEY_LONG(BTN_RE1):
|
||||||
case EVT_KEY_LONG(BTN_REb):
|
case EVT_KEY_LONG(BTN_RE2):
|
||||||
if (!navigationRotaryEncoder(event))
|
if (!navigationRotaryEncoder(event))
|
||||||
break;
|
break;
|
||||||
if (v==0) {
|
if (v==0) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
killEvents(BTN_REa);
|
killEvents(BTN_RE1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// no break
|
// no break
|
||||||
@@ -914,10 +914,11 @@ void menuProcPhasesAll(uint8_t event)
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
case EVT_KEY_BREAK(BTN_REa):
|
case EVT_KEY_BREAK(BTN_RE1):
|
||||||
case EVT_KEY_BREAK(BTN_REb):
|
case EVT_KEY_BREAK(BTN_RE2):
|
||||||
if (!navigationRotaryEncoder(event))
|
if (!navigationRotaryEncoder(event))
|
||||||
break;
|
break;
|
||||||
|
// no break
|
||||||
#endif
|
#endif
|
||||||
case EVT_KEY_FIRST(KEY_MENU):
|
case EVT_KEY_FIRST(KEY_MENU):
|
||||||
if (sub == MAX_PHASES) {
|
if (sub == MAX_PHASES) {
|
||||||
@@ -1119,8 +1120,8 @@ void menuProcCurveOne(uint8_t event)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
case EVT_KEY_BREAK(BTN_REa):
|
case EVT_KEY_BREAK(BTN_RE1):
|
||||||
case EVT_KEY_BREAK(BTN_REb):
|
case EVT_KEY_BREAK(BTN_RE2):
|
||||||
if (!navigationRotaryEncoder(event))
|
if (!navigationRotaryEncoder(event))
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -1713,10 +1714,10 @@ void menuProcExpoMix(uint8_t expo, uint8_t _event_)
|
|||||||
}
|
}
|
||||||
// no break
|
// no break
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
case EVT_KEY_BREAK(BTN_REa):
|
case EVT_KEY_BREAK(BTN_RE1):
|
||||||
case EVT_KEY_BREAK(BTN_REb):
|
case EVT_KEY_BREAK(BTN_RE2):
|
||||||
case EVT_KEY_LONG(BTN_REa):
|
case EVT_KEY_LONG(BTN_RE1):
|
||||||
case EVT_KEY_LONG(BTN_REb):
|
case EVT_KEY_LONG(BTN_RE2):
|
||||||
if (sub == 0)
|
if (sub == 0)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -2098,8 +2099,8 @@ void menuProcCurvesAll(uint8_t event)
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
case EVT_KEY_BREAK(BTN_REa):
|
case EVT_KEY_BREAK(BTN_RE1):
|
||||||
case EVT_KEY_BREAK(BTN_REb):
|
case EVT_KEY_BREAK(BTN_RE2):
|
||||||
if (!navigationRotaryEncoder(event))
|
if (!navigationRotaryEncoder(event))
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+17
-11
@@ -750,7 +750,7 @@ uint8_t getTrimFlightPhase(uint8_t phase, uint8_t idx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBV4)
|
#if defined(PCBV4) && defined(ROTARY_ENCODERS)
|
||||||
uint8_t getRotaryEncoderFlightPhase(uint8_t idx)
|
uint8_t getRotaryEncoderFlightPhase(uint8_t idx)
|
||||||
{
|
{
|
||||||
uint8_t phase = s_perout_flight_phase;
|
uint8_t phase = s_perout_flight_phase;
|
||||||
@@ -797,7 +797,13 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
|
|||||||
*value = limit((int16_t)-1024, (int16_t)(*value + (inc * 8)), (int16_t)+1024);
|
*value = limit((int16_t)-1024, (int16_t)(*value + (inc * 8)), (int16_t)+1024);
|
||||||
eeDirty(EE_MODEL);
|
eeDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBARM) && defined(ROTARY_ENCODERS)
|
||||||
|
void incRotaryEncoder(uint8_t idx, int8_t inc)
|
||||||
|
{
|
||||||
|
g_rotenc[idx] += inc;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKY) || defined(PCBARM)
|
#if defined(FRSKY) || defined(PCBARM)
|
||||||
@@ -934,9 +940,8 @@ void doSplash()
|
|||||||
#if !defined(PCBARM)
|
#if !defined(PCBARM)
|
||||||
void checkLowEEPROM()
|
void checkLowEEPROM()
|
||||||
{
|
{
|
||||||
if(g_eeGeneral.disableMemoryWarning) return;
|
if (g_eeGeneral.disableMemoryWarning) return;
|
||||||
if(EeFsGetFree() < 200)
|
if (EeFsGetFree() < 100) {
|
||||||
{
|
|
||||||
alert(STR_EEPROMWARN, STR_EEPROMLOWMEM);
|
alert(STR_EEPROMWARN, STR_EEPROMLOWMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2062,10 +2067,10 @@ void perOut(uint8_t tick10ms)
|
|||||||
char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE];
|
char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(PCBARM) && !defined(REVA) && !defined(SIMU)) || (defined(PCBV4) && !defined(REV0) && !defined(SIMU))
|
#if defined(SIMU)
|
||||||
#define TIME_TO_WRITE (s_eeDirtyMsk && (get_tmr10ms() - s_eeDirtyTime10ms) >= WRITE_DELAY_10MS)
|
|
||||||
#else
|
|
||||||
#define TIME_TO_WRITE s_eeDirtyMsk
|
#define TIME_TO_WRITE s_eeDirtyMsk
|
||||||
|
#else
|
||||||
|
#define TIME_TO_WRITE (s_eeDirtyMsk && (get_tmr10ms() - s_eeDirtyTime10ms) >= WRITE_DELAY_10MS)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOLD_FONT
|
#ifdef BOLD_FONT
|
||||||
@@ -2858,14 +2863,15 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
|
|||||||
AUDIO_WARNING2();
|
AUDIO_WARNING2();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (PCBV4)
|
#if defined(ROTARY_ENCODERS)
|
||||||
// Rotary encoder interrupts
|
// Rotary encoder interrupts
|
||||||
volatile uint8_t g_rotenc[2] = {0};
|
volatile uint8_t g_rotenc[2] = {0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SIMU
|
#ifndef SIMU
|
||||||
|
|
||||||
#if defined (PCBV4)
|
#if defined(PCBV4) && defined(ROTARY_ENCODERS)
|
||||||
|
|
||||||
#if !defined(EXTRA_ROTARY_ENCODERS)
|
#if !defined(EXTRA_ROTARY_ENCODERS)
|
||||||
ISR(INT2_vect)
|
ISR(INT2_vect)
|
||||||
{
|
{
|
||||||
@@ -2877,7 +2883,7 @@ ISR(INT3_vect)
|
|||||||
uint8_t input = PIND & 0b00001100;
|
uint8_t input = PIND & 0b00001100;
|
||||||
if (input == 0 || input == 0b00001100) incRotaryEncoder(0, +1);
|
if (input == 0 || input == 0b00001100) incRotaryEncoder(0, +1);
|
||||||
}
|
}
|
||||||
#endif //EXTRA_ROTARY_ENCODERS
|
#endif //!EXTRA_ROTARY_ENCODERS
|
||||||
|
|
||||||
ISR(INT5_vect)
|
ISR(INT5_vect)
|
||||||
{
|
{
|
||||||
@@ -2889,7 +2895,7 @@ ISR(INT6_vect)
|
|||||||
uint8_t input = PINE & 0b01100000;
|
uint8_t input = PINE & 0b01100000;
|
||||||
if (input == 0 || input == 0b01100000) incRotaryEncoder(1, -1);
|
if (input == 0 || input == 0b01100000) incRotaryEncoder(1, -1);
|
||||||
}
|
}
|
||||||
#endif //PCBV4
|
#endif //PCBV4+ROTARY_ENCODERS
|
||||||
|
|
||||||
#if !defined(PCBARM)
|
#if !defined(PCBARM)
|
||||||
extern unsigned char __bss_end ;
|
extern unsigned char __bss_end ;
|
||||||
|
|||||||
+4
-4
@@ -310,8 +310,8 @@ enum EnumKeys {
|
|||||||
TRM_RH_DWN ,
|
TRM_RH_DWN ,
|
||||||
TRM_RH_UP ,
|
TRM_RH_UP ,
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
BTN_REa,
|
BTN_RE1,
|
||||||
BTN_REb,
|
BTN_RE2,
|
||||||
#endif
|
#endif
|
||||||
//SW_NC ,
|
//SW_NC ,
|
||||||
//SW_ON ,
|
//SW_ON ,
|
||||||
@@ -546,7 +546,7 @@ int16_t getRotaryEncoder(uint8_t idx);
|
|||||||
void incRotaryEncoder(uint8_t idx, int8_t inc);
|
void incRotaryEncoder(uint8_t idx, int8_t inc);
|
||||||
inline bool navigationRotaryEncoder(uint8_t event)
|
inline bool navigationRotaryEncoder(uint8_t event)
|
||||||
{
|
{
|
||||||
return g_eeGeneral.reNavigation == ((event & EVT_KEY_MASK) - BTN_REa + 1);
|
return g_eeGeneral.reNavigation == ((event & EVT_KEY_MASK) - BTN_RE1 + 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -820,7 +820,7 @@ inline bool isFunctionActive(uint8_t func)
|
|||||||
extern char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE]; // text buffer for frsky telem. user data experiments
|
extern char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE]; // text buffer for frsky telem. user data experiments
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (PCBV4)
|
#if defined (ROTARY_ENCODERS)
|
||||||
// Global rotary encoder registers -- 8-bit, 0-255
|
// Global rotary encoder registers -- 8-bit, 0-255
|
||||||
extern volatile uint8_t g_rotenc[2];
|
extern volatile uint8_t g_rotenc[2];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
|||||||
ISTR(VBEEPMODE)
|
ISTR(VBEEPMODE)
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
ISTR(VRENAVIG)
|
ISTR(VRENAVIG)
|
||||||
|
ISTR(RE1RE2)
|
||||||
#endif
|
#endif
|
||||||
ISTR(VFILTERADC)
|
ISTR(VFILTERADC)
|
||||||
ISTR(TRNMODE)
|
ISTR(TRNMODE)
|
||||||
@@ -88,7 +89,6 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
|||||||
ISTR(DSM2MODE)
|
ISTR(DSM2MODE)
|
||||||
#endif
|
#endif
|
||||||
#if defined(PCBV4)
|
#if defined(PCBV4)
|
||||||
ISTR(RE1RE2)
|
|
||||||
ISTR(DATETIME)
|
ISTR(DATETIME)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|||||||
+8
-5
@@ -71,7 +71,8 @@ extern const pm_char STR_OPEN9X[];
|
|||||||
#endif
|
#endif
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
#define OFS_VRENAVIG (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE))
|
#define OFS_VRENAVIG (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE))
|
||||||
#define OFS_VFILTERADC (OFS_VRENAVIG + sizeof(TR_VRENAVIG))
|
#define OFS_RE1RE2 (OFS_VRENAVIG + sizeof(TR_VRENAVIG))
|
||||||
|
#define OFS_VFILTERADC (OFS_RE1RE2 + sizeof(TR_RE1RE2))
|
||||||
#else
|
#else
|
||||||
#define OFS_VFILTERADC (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE))
|
#define OFS_VFILTERADC (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE))
|
||||||
#endif
|
#endif
|
||||||
@@ -127,8 +128,7 @@ extern const pm_char STR_OPEN9X[];
|
|||||||
#define OFS_ENDDSM2 (OFS_VTMRMODES + sizeof(TR_VTMRMODES))
|
#define OFS_ENDDSM2 (OFS_VTMRMODES + sizeof(TR_VTMRMODES))
|
||||||
#endif
|
#endif
|
||||||
#if defined(PCBV4)
|
#if defined(PCBV4)
|
||||||
#define OFS_RE1RE2 (OFS_ENDDSM2)
|
#define OFS_DATETIME (OFS_ENDDSM2)
|
||||||
#define OFS_DATETIME (OFS_RE1RE2 + sizeof(TR_RE1RE2))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STR_OFFON (STR_OPEN9X + OFS_OFFON)
|
#define STR_OFFON (STR_OPEN9X + OFS_OFFON)
|
||||||
@@ -138,7 +138,6 @@ extern const pm_char STR_OPEN9X[];
|
|||||||
#define STR_VBEEPLEN (STR_OPEN9X + OFS_VBEEPLEN)
|
#define STR_VBEEPLEN (STR_OPEN9X + OFS_VBEEPLEN)
|
||||||
#endif
|
#endif
|
||||||
#define STR_VBEEPMODE (STR_OPEN9X + OFS_VBEEPMODE)
|
#define STR_VBEEPMODE (STR_OPEN9X + OFS_VBEEPMODE)
|
||||||
#define STR_VRENAVIG (STR_OPEN9X + OFS_VRENAVIG)
|
|
||||||
#define STR_VFILTERADC (STR_OPEN9X + OFS_VFILTERADC)
|
#define STR_VFILTERADC (STR_OPEN9X + OFS_VFILTERADC)
|
||||||
#define STR_TRNMODE (STR_OPEN9X + OFS_TRNMODE)
|
#define STR_TRNMODE (STR_OPEN9X + OFS_TRNMODE)
|
||||||
#define STR_TRNCHN (STR_OPEN9X + OFS_TRNCHN)
|
#define STR_TRNCHN (STR_OPEN9X + OFS_TRNCHN)
|
||||||
@@ -188,8 +187,12 @@ extern const pm_char STR_OPEN9X[];
|
|||||||
#define STR_DSM2MODE (STR_OPEN9X + OFS_DSM2MODE)
|
#define STR_DSM2MODE (STR_OPEN9X + OFS_DSM2MODE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBV4)
|
#if defined(ROTARY_ENCODERS)
|
||||||
|
#define STR_VRENAVIG (STR_OPEN9X + OFS_VRENAVIG)
|
||||||
#define STR_RE1RE2 (STR_OPEN9X + OFS_RE1RE2)
|
#define STR_RE1RE2 (STR_OPEN9X + OFS_RE1RE2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBV4)
|
||||||
#define STR_DATETIME (STR_OPEN9X + OFS_DATETIME)
|
#define STR_DATETIME (STR_OPEN9X + OFS_DATETIME)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user