Re #2671: added TX battery blinking on batter warning, fixed display problem when battery voltage lower than batlow value.

This commit is contained in:
Damjan Adamic
2015-08-11 22:22:18 +02:00
parent 806c343b80
commit 04a8570d48
3 changed files with 23 additions and 14 deletions
+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)