Re #2671: added TX battery blinking on batter warning, fixed display problem when battery voltage lower than batlow value.
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user