Merge pull request #2697 from opentx/projectkk2glider/issue_2671_lcd_fixes

Projectkk2glider/issue 2671 lcd fixes
This commit is contained in:
Bertrand Songis
2015-08-11 22:49:34 +02:00
5 changed files with 25 additions and 16 deletions
+1 -1
View File
@@ -646,7 +646,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att) void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att)
{ {
lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1))); lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1)));
if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'v', att); if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'V', att);
} }
void putsVBat(coord_t x, coord_t y, LcdFlags att) void putsVBat(coord_t x, coord_t y, LcdFlags att)
+1 -1
View File
@@ -610,7 +610,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att) void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att)
{ {
lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1))); lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1)));
if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'v', att); if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'V', att);
} }
void putsVBat(coord_t x, coord_t y, LcdFlags att) void putsVBat(coord_t x, coord_t y, LcdFlags att)
+1 -1
View File
@@ -192,7 +192,7 @@ void perMain()
setTopRssi(TELEMETRY_RSSI()); setTopRssi(TELEMETRY_RSSI());
setTopBatteryValue(g_vbat100mV); setTopBatteryValue(g_vbat100mV);
int state = 5 * (g_vbat100mV - g_eeGeneral.vBatMin - 90) / (30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin); int state = 5 * (g_vbat100mV - g_eeGeneral.vBatMin - 90) / (30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin);
setTopBatteryState(state); setTopBatteryState(state, g_vbat100mV <= g_eeGeneral.vBatWarn);
topLcdRefreshEnd(); topLcdRefreshEnd();
#endif #endif
+1 -1
View File
@@ -354,7 +354,7 @@ void topLcdRefreshEnd(void);
void setTopFirstTimer(int32_t value); void setTopFirstTimer(int32_t value);
void setTopSecondTimer(uint32_t value); void setTopSecondTimer(uint32_t value);
void setTopRssi(uint32_t rssi); void setTopRssi(uint32_t rssi);
void setTopBatteryState(uint32_t state); void setTopBatteryState(int state, uint8_t blinking);
void setTopBatteryValue(uint32_t volts); void setTopBatteryValue(uint32_t volts);
#endif #endif
+21 -12
View File
@@ -34,6 +34,8 @@
* *
*/ */
#include "board_taranis.h"
#define CS1_HIGH() TOPLCD_GPIO->BSRRL = TOPLCD_GPIO_PIN_CS1 #define CS1_HIGH() TOPLCD_GPIO->BSRRL = TOPLCD_GPIO_PIN_CS1
#define CS1_LOW() TOPLCD_GPIO->BSRRH = TOPLCD_GPIO_PIN_CS1 #define CS1_LOW() TOPLCD_GPIO->BSRRH = TOPLCD_GPIO_PIN_CS1
#define CS2_HIGH() TOPLCD_GPIO->BSRRL = TOPLCD_GPIO_PIN_CS2 #define CS2_HIGH() TOPLCD_GPIO->BSRRL = TOPLCD_GPIO_PIN_CS2
@@ -334,19 +336,26 @@ void setTopRssi(uint32_t rssi)
setTopRssiBar(rssi); setTopRssiBar(rssi);
} }
void setTopBatteryState(uint32_t state) void setTopBatteryState(int state, uint8_t blinking)
{ {
Ht1621Data1[4] |= 0x40; // Battery border if (!blinking || BLINK_ON_PHASE) {
if (state > 0) // since the border can not be turned off,
Ht1621Data1[7] |= 0x80; // we blink the first bar even if the actual value is zero
if (state > 1) if (blinking && state < 1) {
Ht1621Data1[9] |= 0x80; state = 1;
if (state > 2) }
Ht1621Data1[5] |= 0x80; Ht1621Data1[4] |= 0x40; // Battery border // TODO this is not working for me, the border is ALWAYS on
if (state > 3) if (state > 0)
Ht1621Data1[10] |= 0x80; Ht1621Data1[7] |= 0x80;
if (state > 4) if (state > 1)
Ht1621Data1[4] |= 0x80; Ht1621Data1[9] |= 0x80;
if (state > 2)
Ht1621Data1[5] |= 0x80;
if (state > 3)
Ht1621Data1[10] |= 0x80;
if (state > 4)
Ht1621Data1[4] |= 0x80;
}
} }
void setTopBatteryValue(uint32_t volts) void setTopBatteryValue(uint32_t volts)