Merge pull request #2697 from opentx/projectkk2glider/issue_2671_lcd_fixes
Projectkk2glider/issue 2671 lcd fixes
This commit is contained in:
@@ -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)
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -192,7 +192,7 @@ void perMain()
|
||||
setTopRssi(TELEMETRY_RSSI());
|
||||
setTopBatteryValue(g_vbat100mV);
|
||||
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();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ void topLcdRefreshEnd(void);
|
||||
void setTopFirstTimer(int32_t value);
|
||||
void setTopSecondTimer(uint32_t value);
|
||||
void setTopRssi(uint32_t rssi);
|
||||
void setTopBatteryState(uint32_t state);
|
||||
void setTopBatteryState(int state, uint8_t blinking);
|
||||
void setTopBatteryValue(uint32_t volts);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "board_taranis.h"
|
||||
|
||||
#define CS1_HIGH() TOPLCD_GPIO->BSRRL = TOPLCD_GPIO_PIN_CS1
|
||||
#define CS1_LOW() TOPLCD_GPIO->BSRRH = TOPLCD_GPIO_PIN_CS1
|
||||
#define CS2_HIGH() TOPLCD_GPIO->BSRRL = TOPLCD_GPIO_PIN_CS2
|
||||
@@ -334,19 +336,26 @@ void setTopRssi(uint32_t rssi)
|
||||
setTopRssiBar(rssi);
|
||||
}
|
||||
|
||||
void setTopBatteryState(uint32_t state)
|
||||
void setTopBatteryState(int state, uint8_t blinking)
|
||||
{
|
||||
Ht1621Data1[4] |= 0x40; // Battery border
|
||||
if (state > 0)
|
||||
Ht1621Data1[7] |= 0x80;
|
||||
if (state > 1)
|
||||
Ht1621Data1[9] |= 0x80;
|
||||
if (state > 2)
|
||||
Ht1621Data1[5] |= 0x80;
|
||||
if (state > 3)
|
||||
Ht1621Data1[10] |= 0x80;
|
||||
if (state > 4)
|
||||
Ht1621Data1[4] |= 0x80;
|
||||
if (!blinking || BLINK_ON_PHASE) {
|
||||
// since the border can not be turned off,
|
||||
// we blink the first bar even if the actual value is zero
|
||||
if (blinking && state < 1) {
|
||||
state = 1;
|
||||
}
|
||||
Ht1621Data1[4] |= 0x40; // Battery border // TODO this is not working for me, the border is ALWAYS on
|
||||
if (state > 0)
|
||||
Ht1621Data1[7] |= 0x80;
|
||||
if (state > 1)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user