Working ADC3 driver for 9XE additional analog inputs (driver source based on Michael Blandford's code)
This commit is contained in:
@@ -90,11 +90,13 @@ const pm_uchar icons[] PROGMEM = {
|
||||
#define ICON_REBOOT 91, 11
|
||||
#define ICON_ALTITUDE 102, 9
|
||||
|
||||
#define POT_SPACING 5
|
||||
|
||||
void drawPotsBars()
|
||||
{
|
||||
// Optimization by Mike Blandford
|
||||
uint8_t x, i, len ; // declare temporary variables
|
||||
for (x=LCD_W/2-5, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=5, i++) {
|
||||
for (x=LCD_W/2-(NUM_POTS/2)*POT_SPACING, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=POT_SPACING, i++) {
|
||||
if (IS_POT_AVAILABLE(i)) {
|
||||
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||
V_BAR(x, LCD_H-8, len)
|
||||
@@ -201,11 +203,15 @@ void displayTrims(uint8_t phase)
|
||||
void displaySliders()
|
||||
{
|
||||
for (uint8_t i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
if (i == POT3) {
|
||||
continue;
|
||||
}
|
||||
#if defined(REV9E)
|
||||
if (i < SLIDER1) continue; // TODO change and display more values
|
||||
coord_t x = ((i==SLIDER1 || i==SLIDER3) ? 3 : LCD_W-5);
|
||||
int8_t y = (i<SLIDER3 ? LCD_H/2+1 : 1);
|
||||
#else
|
||||
if (i == POT3) continue;
|
||||
coord_t x = ((i==POT1 || i==SLIDER1) ? 3 : LCD_W-5);
|
||||
int8_t y = (i>=SLIDER1 ? LCD_H/2+1 : 1);
|
||||
#endif
|
||||
lcd_vline(x, y, LCD_H/2-2);
|
||||
lcd_vline(x+1, y, LCD_H/2-2);
|
||||
y += LCD_H/2-4;
|
||||
|
||||
@@ -51,10 +51,18 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
STICK_SCROLL_DISABLE();
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
#if (NUM_STICKS+NUM_POTS) > 9
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + (i/3)*FH;
|
||||
const uint8_t x_coord[] = {0, 70, 154};
|
||||
uint8_t x = x_coord[i%3];
|
||||
lcd_outdezNAtt(x, y, i+1, LEADING0|LEFT, 2);
|
||||
lcd_putc(x+2*FW-2, y, ':');
|
||||
#else
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + (i/2)*FH;
|
||||
uint8_t x = i&1 ? 64+5 : 0;
|
||||
putsStrIdx(x, y, PSTR("A"), i+1);
|
||||
lcd_putc(lcdNextPos, y, ':');
|
||||
#endif
|
||||
lcd_outhex4(x+3*FW-1, y, anaIn(i));
|
||||
lcd_outdez8(x+10*FW-1, y, (int16_t)calibratedStick[CONVERT_MODE(i)]*25/256);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,11 @@ enum menuGeneralHwItems {
|
||||
ITEM_SETUP_HW_POT1,
|
||||
ITEM_SETUP_HW_POT2,
|
||||
CASE_REVPLUS(ITEM_SETUP_HW_POT3)
|
||||
CASE_REV9E(ITEM_SETUP_HW_POT4)
|
||||
ITEM_SETUP_HW_LS,
|
||||
ITEM_SETUP_HW_RS,
|
||||
CASE_REV9E(ITEM_SETUP_HW_LS2)
|
||||
CASE_REV9E(ITEM_SETUP_HW_RS2)
|
||||
ITEM_SETUP_HW_LABEL_SWITCHES,
|
||||
ITEM_SETUP_HW_SA,
|
||||
ITEM_SETUP_HW_SB,
|
||||
@@ -111,6 +114,10 @@ void menuGeneralHardware(uint8_t event)
|
||||
case ITEM_SETUP_HW_STICK4:
|
||||
case ITEM_SETUP_HW_LS:
|
||||
case ITEM_SETUP_HW_RS:
|
||||
#if defined(REV9E)
|
||||
case ITEM_SETUP_HW_LS2:
|
||||
case ITEM_SETUP_HW_RS2:
|
||||
#endif
|
||||
{
|
||||
int idx = (k<=ITEM_SETUP_HW_STICK4 ? k-ITEM_SETUP_HW_STICK1 : k-ITEM_SETUP_HW_LS+7);
|
||||
lcd_putsiAtt(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
|
||||
@@ -127,6 +134,9 @@ void menuGeneralHardware(uint8_t event)
|
||||
case ITEM_SETUP_HW_POT2:
|
||||
#if defined(REVPLUS)
|
||||
case ITEM_SETUP_HW_POT3:
|
||||
#endif
|
||||
#if defined(REV9E)
|
||||
case ITEM_SETUP_HW_POT4:
|
||||
#endif
|
||||
{
|
||||
int idx = k - ITEM_SETUP_HW_POT1;
|
||||
|
||||
Reference in New Issue
Block a user