mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 04:15:26 +03:00
REVPRO fixes
This commit is contained in:
parent
efeb02b6c6
commit
324fe4e341
9 changed files with 122 additions and 82 deletions
|
@ -922,6 +922,7 @@ void menuGeneralSdManager(uint8_t _event)
|
|||
s_pgOfs = 0;
|
||||
m_posVert = 1;
|
||||
reusableBuffer.sdmanager.offset = 65535;
|
||||
killEvents(_event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1211,14 +1212,8 @@ void menuGeneralDiagKeys(uint8_t event)
|
|||
lcd_puts(14*FW, 3*FH, STR_VTRIM);
|
||||
|
||||
for(uint8_t i=0; i<9; i++) {
|
||||
#if !defined(PCBTARANIS)
|
||||
uint8_t y = i*FH-FH;
|
||||
if(i==(SW_ID0-SW_BASE)) continue; //ignore ID0
|
||||
putsSwitches(8*FW, y, i+1, 0); //ohne off,on
|
||||
displayKeyState(11*FW+2, y, (EnumKeys)(SW_BASE+i));
|
||||
#else
|
||||
uint8_t y = i*FH;
|
||||
#endif
|
||||
uint8_t y;
|
||||
|
||||
if (i<8) {
|
||||
y = i/2*FH+FH*4;
|
||||
lcd_img(14*FW, y, sticks, i/2, 0);
|
||||
|
@ -1230,6 +1225,14 @@ void menuGeneralDiagKeys(uint8_t event)
|
|||
lcd_putsiAtt(0, y, STR_VKEYS, i, 0);
|
||||
displayKeyState(5*FW+2, y, (EnumKeys)(KEY_MENU+i));
|
||||
}
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
if (i != SW_ID0-SW_BASE) {
|
||||
y = i*FH-FH;
|
||||
putsSwitches(8*FW, y, i+1, 0); //ohne off,on
|
||||
displayKeyState(11*FW+2, y, (EnumKeys)(SW_BASE+i));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODERS) || defined(ROTARY_ENCODER_NAVIGATION)
|
||||
|
@ -1364,6 +1367,7 @@ void menuGeneralHardware(uint8_t event)
|
|||
}
|
||||
|
||||
#elif defined(PCBSKY9X)
|
||||
|
||||
enum menuGeneralHwItems {
|
||||
ITEM_SETUP_HW_OPTREX_DISPLAY,
|
||||
ITEM_SETUP_HW_STICKS_GAINS_LABELS,
|
||||
|
@ -1371,7 +1375,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_ROTARY_ENCODERS(ITEM_SETUP_HW_ROTARY_ENCODER)
|
||||
IF_BLUETOOTH(ITEM_SETUP_HW_BT_BAUDRATE)
|
||||
ITEM_SETUP_HW_MAX
|
||||
};
|
||||
|
@ -1379,7 +1383,7 @@ enum menuGeneralHwItems {
|
|||
#define GENERAL_HW_PARAM_OFS (2+(15*FW))
|
||||
void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, 0, IF_BLUETOOTH(0)});
|
||||
MENU(STR_HARDWARE, menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, IF_ROTARY_ENCODERS(0) IF_BLUETOOTH(0)});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
|
@ -1418,9 +1422,11 @@ void menuGeneralHardware(uint8_t event)
|
|||
break;
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
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;
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
case ITEM_SETUP_HW_BT_BAUDRATE:
|
||||
|
|
|
@ -1929,6 +1929,12 @@ enum menuModelPhaseItems {
|
|||
ITEM_MODEL_PHASE_GV3,
|
||||
ITEM_MODEL_PHASE_GV4,
|
||||
ITEM_MODEL_PHASE_GV5,
|
||||
#if defined(CPUARM)
|
||||
ITEM_MODEL_PHASE_GV6,
|
||||
ITEM_MODEL_PHASE_GV7,
|
||||
ITEM_MODEL_PHASE_GV8,
|
||||
ITEM_MODEL_PHASE_GV9,
|
||||
#endif
|
||||
#endif
|
||||
ITEM_MODEL_PHASE_MAX
|
||||
};
|
||||
|
@ -4291,7 +4297,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
|||
uint8_t new_cstate = cswFamily(cs->func);
|
||||
if (cstate != new_cstate) {
|
||||
if (new_cstate == LS_FAMILY_TIMER) {
|
||||
cs->v1 = cs->v2 = -119;
|
||||
cs->v1 = cs->v2 = 0;
|
||||
}
|
||||
else if (new_cstate == LS_FAMILY_STAY) {
|
||||
cs->v1 = 0; cs->v2 = -129; cs->v3 = 0;
|
||||
|
|
|
@ -182,12 +182,23 @@ void menuStatisticsDebug(uint8_t event)
|
|||
lcd_outdezAtt(MENU_DEBUG_COL_OFS, 5*FH, (maxMixerDuration)/20, PREC2|LEFT);
|
||||
lcd_puts(lcdLastPos, 5*FH, "ms");
|
||||
lcd_putsLeft(6*FH, STR_FREESTACKMINB);
|
||||
|
||||
#if LCD_W >= 212
|
||||
lcd_putsAtt(MENU_DEBUG_COL_OFS-1, 6*FH+1, "[Main]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(0), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, 6*FH+1, "[Mix]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(1), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, 6*FH+1, "[Audio]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(2), UNSIGN|LEFT);
|
||||
#else
|
||||
lcdLastPos = MENU_DEBUG_COL_OFS;
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(0), UNSIGN|LEFT);
|
||||
lcdLastPos += FW/2;
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(1), UNSIGN|LEFT);
|
||||
lcdLastPos += FW/2;
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(2), UNSIGN|LEFT);
|
||||
#endif
|
||||
|
||||
#else
|
||||
lcd_putsLeft(1*FH, STR_TMR1LATMAXUS);
|
||||
lcd_outdez8(MENU_DEBUG_COL_OFS , 1*FH, g_tmr1Latency_max/2 );
|
||||
|
|
|
@ -304,6 +304,8 @@ void watchdogSetTimeout(uint32_t timeout)
|
|||
watchdogTimeout = timeout;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO remove definitely?
|
||||
void opentxBootloader()
|
||||
{
|
||||
BACKLIGHT_ON();
|
||||
|
@ -318,6 +320,8 @@ void opentxBootloader()
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
void per10ms()
|
||||
{
|
||||
g_tmr10ms++;
|
||||
|
@ -5674,7 +5678,8 @@ int main(void)
|
|||
opentxInit(mcusr);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if 0
|
||||
// TODO remove definitely?
|
||||
if (BOOTLOADER_REQUEST()) {
|
||||
pwrOff(); // Only turn power off if necessary
|
||||
|
||||
|
@ -5692,7 +5697,9 @@ int main(void)
|
|||
|
||||
opentxBootloader();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
CoInitOS();
|
||||
|
||||
#if defined(CPUARM) && defined(DEBUG)
|
||||
|
|
|
@ -153,7 +153,7 @@ void simuSetKey(uint8_t key, bool state)
|
|||
KEY_CASE(KEY_UP, GPIO_BUTTON_UP, PIN_BUTTON_UP)
|
||||
KEY_CASE(KEY_DOWN, GPIO_BUTTON_DOWN, PIN_BUTTON_DOWN)
|
||||
#endif
|
||||
#if defined(PCBSKY9X)
|
||||
#if defined(PCBSKY9X) && !defined(REVX)
|
||||
KEY_CASE(BTN_REa, PIOB->PIO_PDSR, 0x40)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
KEY_CASE(BTN_REa, pind, 0x20)
|
||||
|
|
|
@ -203,7 +203,7 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*)
|
|||
#endif
|
||||
};
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#if defined(PCBSKY9X) && !defined(REVX)
|
||||
Coproc_temp = 23;
|
||||
Coproc_maxtemp = 28;
|
||||
#endif
|
||||
|
|
|
@ -579,13 +579,6 @@ void boardInit()
|
|||
|
||||
PIOC->PIO_PER = PIO_PC25 ; // Enable bit C25 (USB-detect)
|
||||
|
||||
#if defined(REVX)
|
||||
if (usbPlugged()) {
|
||||
lcdInit() ;
|
||||
opentxBootloader();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(REVA)
|
||||
// On REVB, PA21 is used as AD8, and measures current consumption.
|
||||
pioptr = PIOA ;
|
||||
|
|
|
@ -48,60 +48,80 @@ extern uint16_t ResetReason;
|
|||
#define FIRMWARE_ADDRESS 0x00400000
|
||||
|
||||
#if defined(REVA)
|
||||
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
|
||||
#define GPIO_BUTTON_EXIT PIOA->PIO_PDSR
|
||||
#define GPIO_BUTTON_UP PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_DOWN PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_RIGHT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_LEFT PIOC->PIO_PDSR
|
||||
#define PIN_BUTTON_MENU 0x00000040
|
||||
#define PIN_BUTTON_EXIT 0x80000000
|
||||
#define PIN_BUTTON_UP 0x00000004
|
||||
#define PIN_BUTTON_DOWN 0x00000008
|
||||
#define PIN_BUTTON_RIGHT 0x00000010
|
||||
#define PIN_BUTTON_LEFT 0x00000020
|
||||
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
|
||||
#define GPIO_BUTTON_EXIT PIOA->PIO_PDSR
|
||||
#define GPIO_BUTTON_UP PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_DOWN PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_RIGHT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_LEFT PIOC->PIO_PDSR
|
||||
#define PIN_BUTTON_MENU 0x00000040
|
||||
#define PIN_BUTTON_EXIT 0x80000000
|
||||
#define PIN_BUTTON_UP 0x00000004
|
||||
#define PIN_BUTTON_DOWN 0x00000008
|
||||
#define PIN_BUTTON_RIGHT 0x00000010
|
||||
#define PIN_BUTTON_LEFT 0x00000020
|
||||
#else
|
||||
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
|
||||
#define GPIO_BUTTON_EXIT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_UP PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_DOWN PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_RIGHT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_LEFT PIOC->PIO_PDSR
|
||||
#define PIN_BUTTON_MENU 0x00000020
|
||||
#define PIN_BUTTON_EXIT 0x01000000
|
||||
#define PIN_BUTTON_UP 0x00000002
|
||||
#define PIN_BUTTON_DOWN 0x00000020
|
||||
#define PIN_BUTTON_RIGHT 0x00000010
|
||||
#define PIN_BUTTON_LEFT 0x00000008
|
||||
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
|
||||
#define GPIO_BUTTON_EXIT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_UP PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_DOWN PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_RIGHT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_LEFT PIOC->PIO_PDSR
|
||||
#define PIN_BUTTON_MENU 0x00000020
|
||||
#define PIN_BUTTON_EXIT 0x01000000
|
||||
#define PIN_BUTTON_UP 0x00000002
|
||||
#define PIN_BUTTON_DOWN 0x00000020
|
||||
#define PIN_BUTTON_RIGHT 0x00000010
|
||||
#define PIN_BUTTON_LEFT 0x00000008
|
||||
#endif
|
||||
|
||||
#define GPIO_TRIM_LH_L PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_LV_DN PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_RV_UP PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_RH_L PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_LH_R PIOB->PIO_PDSR
|
||||
#define GPIO_TRIM_LV_UP PIOC->PIO_PDSR
|
||||
#define GPIO_TRIM_RV_DN PIOC->PIO_PDSR
|
||||
#define GPIO_TRIM_RH_R PIOC->PIO_PDSR
|
||||
|
||||
#if defined(REVA)
|
||||
#define PIN_TRIM_LH_L 0x00000080
|
||||
#define PIN_TRIM_LV_DN 0x08000000
|
||||
#define PIN_TRIM_RV_UP 0x40000000
|
||||
#define PIN_TRIM_RH_L 0x20000000
|
||||
#define PIN_TRIM_LH_R 0x00000010
|
||||
#define PIN_TRIM_LV_UP 0x10000000
|
||||
#define PIN_TRIM_RV_DN 0x00000400
|
||||
#define PIN_TRIM_RH_R 0x00000200
|
||||
#if defined(REVX)
|
||||
#define GPIO_TRIM_LH_L PIOB->PIO_PDSR
|
||||
#define GPIO_TRIM_LV_DN PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_RV_UP PIOC->PIO_PDSR
|
||||
#define GPIO_TRIM_RH_L PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_LH_R PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_LV_UP PIOC->PIO_PDSR
|
||||
#define GPIO_TRIM_RV_DN PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_RH_R PIOC->PIO_PDSR
|
||||
#else
|
||||
#define PIN_TRIM_LH_L 0x00800000
|
||||
#define PIN_TRIM_LV_DN 0x01000000
|
||||
#define PIN_TRIM_RV_UP 0x00000002
|
||||
#define PIN_TRIM_RH_L 0x00000001
|
||||
#define PIN_TRIM_LH_R 0x00000010
|
||||
#define PIN_TRIM_LV_UP 0x10000000
|
||||
#define PIN_TRIM_RV_DN 0x00000400
|
||||
#define PIN_TRIM_RH_R 0x00000200
|
||||
#define GPIO_TRIM_LH_L PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_LV_DN PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_RV_UP PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_RH_L PIOA->PIO_PDSR
|
||||
#define GPIO_TRIM_LH_R PIOB->PIO_PDSR
|
||||
#define GPIO_TRIM_LV_UP PIOC->PIO_PDSR
|
||||
#define GPIO_TRIM_RV_DN PIOC->PIO_PDSR
|
||||
#define GPIO_TRIM_RH_R PIOC->PIO_PDSR
|
||||
#endif
|
||||
|
||||
#if defined(REVX)
|
||||
#define PIN_TRIM_LH_L 0x00000010
|
||||
#define PIN_TRIM_LV_DN 0x01000000
|
||||
#define PIN_TRIM_RV_UP 0x00000400
|
||||
#define PIN_TRIM_RH_L 0x00000001
|
||||
#define PIN_TRIM_LH_R 0x00800000
|
||||
#define PIN_TRIM_LV_UP 0x10000000
|
||||
#define PIN_TRIM_RV_DN 0x00000002
|
||||
#define PIN_TRIM_RH_R 0x00000200
|
||||
#elif defined(REVA)
|
||||
#define PIN_TRIM_LH_L 0x00000080
|
||||
#define PIN_TRIM_LV_DN 0x08000000
|
||||
#define PIN_TRIM_RV_UP 0x40000000
|
||||
#define PIN_TRIM_RH_L 0x20000000
|
||||
#define PIN_TRIM_LH_R 0x00000010
|
||||
#define PIN_TRIM_LV_UP 0x10000000
|
||||
#define PIN_TRIM_RV_DN 0x00000400
|
||||
#define PIN_TRIM_RH_R 0x00000200
|
||||
#else
|
||||
#define PIN_TRIM_LH_L 0x00800000
|
||||
#define PIN_TRIM_LV_DN 0x01000000
|
||||
#define PIN_TRIM_RV_UP 0x00000002
|
||||
#define PIN_TRIM_RH_L 0x00000001
|
||||
#define PIN_TRIM_LH_R 0x00000010
|
||||
#define PIN_TRIM_LV_UP 0x10000000
|
||||
#define PIN_TRIM_RV_DN 0x00000400
|
||||
#define PIN_TRIM_RH_R 0x00000200
|
||||
#endif
|
||||
|
||||
void usbMassStorage();
|
||||
|
|
|
@ -88,26 +88,23 @@ uint32_t readKeys()
|
|||
|
||||
uint32_t readTrims()
|
||||
{
|
||||
register uint32_t a = PIOA->PIO_PDSR;
|
||||
register uint32_t b = PIOB->PIO_PDSR;
|
||||
register uint32_t c = PIOC->PIO_PDSR;
|
||||
register uint32_t result = 0;
|
||||
|
||||
if (~a & PIN_TRIM_LH_L)
|
||||
if (~GPIO_TRIM_LH_L & PIN_TRIM_LH_L)
|
||||
result |= 0x01;
|
||||
if (~a & PIN_TRIM_LV_DN)
|
||||
if (~GPIO_TRIM_LV_DN & PIN_TRIM_LV_DN)
|
||||
result |= 0x04;
|
||||
if (~a & PIN_TRIM_RV_UP)
|
||||
if (~GPIO_TRIM_RV_UP & PIN_TRIM_RV_UP)
|
||||
result |= 0x20;
|
||||
if (~a & PIN_TRIM_RH_L)
|
||||
if (~GPIO_TRIM_RH_L & PIN_TRIM_RH_L)
|
||||
result |= 0x40;
|
||||
if (~b & PIN_TRIM_LH_R)
|
||||
if (~GPIO_TRIM_LH_R & PIN_TRIM_LH_R)
|
||||
result |= 0x02;
|
||||
if (~c & PIN_TRIM_LV_UP)
|
||||
if (~GPIO_TRIM_LV_UP & PIN_TRIM_LV_UP)
|
||||
result |= 0x08;
|
||||
if (~c & PIN_TRIM_RV_DN)
|
||||
if (~GPIO_TRIM_RV_DN & PIN_TRIM_RV_DN)
|
||||
result |= 0x10;
|
||||
if (~c & PIN_TRIM_RH_R)
|
||||
if (~GPIO_TRIM_RH_R & PIN_TRIM_RH_R)
|
||||
result |= 0x80;
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue