diff --git a/src/gruvin9x.h b/src/gruvin9x.h index 508251b18..e961c142f 100644 --- a/src/gruvin9x.h +++ b/src/gruvin9x.h @@ -126,22 +126,24 @@ extern uint16_t DEBUG1; extern uint16_t DEBUG2; #if defined (PCBV4) -# define INP_P_KEY_DWN 0 -# define INP_P_KEY_UP 1 -# define INP_P_KEY_RGT 2 -# define INP_P_KEY_LFT 3 -# define INP_P_KEY_MEN 4 -# define INP_P_KEY_EXT 5 -// v4.1 will have hardware PPM. Won't make code change until v4.0 beta board is hardware patched -# define INP_J_TRM_LH_DWN 0 -# define INP_J_TRM_LH_UP 1 -# define INP_J_TRM_LV_DWN 2 -# define INP_J_TRM_LV_UP 3 -# define INP_J_TRM_RV_DWN 4 -# define INP_J_TRM_RV_UP 5 -# define INP_J_TRM_RH_DWN 6 +# define INP_P_SPARE6 7 +# define INP_P_SPARE5 6 +# define INP_P_KEY_EXT 5 +# define INP_P_KEY_MEN 4 +# define INP_P_KEY_LFT 3 +# define INP_P_KEY_RGT 2 +# define INP_P_KEY_UP 1 +# define INP_P_KEY_DWN 0 + # define INP_J_TRM_RH_UP 7 +# define INP_J_TRM_RH_DWN 6 +# define INP_J_TRM_RV_UP 5 +# define INP_J_TRM_RV_DWN 4 +# define INP_J_TRM_LV_UP 3 +# define INP_J_TRM_LV_DWN 2 +# define INP_J_TRM_LH_UP 1 +# define INP_J_TRM_LH_DWN 0 # define INP_E_PPM_IN 7 # define INP_E_ROT_ENC_1_B 6 @@ -172,19 +174,10 @@ extern uint16_t DEBUG2; # define INP_C_ElevDR 6 # define OUT_C_LIGHT 0 -# define OUT_B_Speaker 7 -# define INP_B_Trainer 5 - -//vinceofdrink@gmail hardwared ppm -//Orginal bitbang port for PPM -//G: The v4.1 board will have H/W PPM as standard. All v4.0 beta boards must be hacked likewise, but not yet. -# ifndef DPPMPB7_HARDWARE -# define INP_B_ID2 6 -# define OUT_B_PPM 0 -# else -# define OUT_B_PPM 6 // will be switched via internal MCU Timer/PWM hardware -# define INP_B_ID2 0 -# endif +# define OUT_B_Speaker 7 +# define OUT_B_PPM 6 // will be switched by TCNT1==OCR1B in hardware +# define INP_B_Trainer 5 +# define INP_B_ID2 0 #else // boards prior to v4 ... @@ -201,7 +194,7 @@ extern uint16_t DEBUG2; # ifndef DPPMPB7_HARDWARE # define OUT_B_PPM 0 # else -# define OUT_B_PPM 7 // will not be used +# define OUT_B_PPM 7 // will not be used # endif # define INP_D_TRM_LH_UP 7 diff --git a/src/lcd.cpp b/src/lcd.cpp index 24b3c43b4..46e83deb8 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -91,9 +91,6 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const char c, uint8_t mode) } q++; } -#if OUTDEZ_SPEED != 0 - lcd_lastPos = x + 2*FW; -#endif } else { uint8_t condense=0; @@ -112,10 +109,6 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const char c, uint8_t mode) if(p=0; i--) - { - if (val) lastDigit = i; - digits[i] = ((uint16_t)val % 10) + '0'; - val = (uint16_t)val / 10; - } - - switch(mode) - { - case MODE(LEADING0): - lastDigit = 5-len; - break; - default: - if (4-lastDigit < mode) - lastDigit = 4 - mode; - break; - } - - lcd_lastPos = x; - if (~flags & LEFT) // determine correct x-coord starting point for decimal aligned - { - // Starting point for regular unsigned, non-decimal number - lcd_lastPos -= (5-lastDigit) * (dblsize ? 2*FWNUM : FWNUM) + (dblsize ? 1 : 0); - if (mode>0 && !dblsize) lcd_lastPos -= dblsize ? 3 : 2; - if (neg) lcd_lastPos -= dblsize ? 2*FW : FW; - } - - if (neg) lcd_putcAtt(lcd_lastPos, y, '-', flags); // apply sign when required - - uint8_t xn = 0; - uint8_t ln = 2; - - for (int8_t i=lastDigit; i<5; i++) - { - lcd_putcAtt(lcd_lastPos-1, y, digits[i], flags); - - if (dblsize) { - lcd_lastPos--; - } - - // Draw decimal point - - // Use direct screen writes to save flash, function calls, stack, cpu load - -#if OUTDEZ_SPEED == 2 - bool inv = (flags & INVERS) ? true : (flags & BLINK ? BLINK_ON_PHASE : false); -#endif - - if (mode>0 && 4-i==mode) // .. then draw a d'point - { - if (dblsize) - { - xn = lcd_lastPos-1; - if (digits[i+1]=='2' || digits[i+1]=='3' || digits[i+1]=='1') ln++; - if (digits[i]=='2' || digits[i]=='4') { - if (digits[i+1]=='4') xn++; - else { xn--; ln++; } - } - } - else - { -#if OUTDEZ_SPEED == 2 - displayBuf[ y * (DISPLAY_W/8) + lcd_lastPos ] = (inv ? 0x40 ^ 0xff : 0x40); -#else - lcd_plot(lcd_lastPos, y+6); - if (flags & INVERS || (flags & BLINK && BLINK_ON_PHASE)) - lcd_vline(lcd_lastPos, y, 8); -#endif - lcd_lastPos += 2; - } - } - } - - if (xn) { - lcd_hline(xn, y+2*FH-3, ln); - lcd_hline(xn, y+2*FH-2, ln); - } -} - -#else - void lcd_outdezNAtt(uint8_t x, uint8_t y, int16_t val, uint8_t flags, uint8_t len) { uint8_t fw = FWNUM; @@ -378,8 +272,6 @@ void lcd_outdezNAtt(uint8_t x, uint8_t y, int16_t val, uint8_t flags, uint8_t le // TODO we could change the '-' to have one pixel removed at its left if (neg) { lcd_putcAtt(x, y, '-', flags); lcd_plot(x, y+3); } } -#endif - void lcd_mask(uint8_t *p, uint8_t mask, uint8_t att) { @@ -483,16 +375,11 @@ void putsTime(uint8_t x,uint8_t y,int16_t tme,uint8_t att,uint8_t att2) lcd_outdezNAtt(x, y, tme/60, att|LEADING0|LEFT, 2); lcd_putcAtt(lcd_lastPos-((att & DBLSIZE) ? 1 : 0), y, ':', att&att2); -#if OUTDEZ_SPEED != 0 - lcd_outdezNAtt(lcd_lastPos-((att & DBLSIZE) ? 5 : 0), y, tme%60, att2|LEADING0|LEFT, 2); -#else lcd_outdezNAtt(lcd_lastPos+FW, y, tme%60, att2|LEADING0|LEFT, 2); -#endif } void putsVolts(uint8_t x, uint8_t y, uint16_t volts, uint8_t att) { -// 215.94us vs 257.31us lcd_outdezAtt(x, y, (int16_t)volts, att|PREC1|UNSIGN); if (~att & NO_UNIT) lcd_putcAtt(lcd_lastPos, y, 'v', att); } diff --git a/src/lcd.h b/src/lcd.h index 1a695f6fb..93794a240 100644 --- a/src/lcd.h +++ b/src/lcd.h @@ -30,8 +30,6 @@ #define FWNUM 5 #define FH 8 -#define OUTDEZ_SPEED 0 - /* lcd common flags */ #define BLINK 0x01