mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 06:11:24 +03:00
battery current rename
This commit is contained in:
parent
47357fb113
commit
b19be17f01
@ -1894,9 +1894,9 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
if (g_reduced_service)
|
||||
{
|
||||
BOARD_ADC_GetBatteryInfo(&g_battery_current_voltage, &g_battery_current);
|
||||
BOARD_ADC_GetBatteryInfo(&g_usb_current_voltage, &g_usb_current);
|
||||
|
||||
if (g_battery_current > 500 || g_battery_calibration[3] < g_battery_current_voltage)
|
||||
if (g_usb_current > 500 || g_battery_calibration[3] < g_usb_current_voltage)
|
||||
{
|
||||
#ifdef ENABLE_OVERLAY
|
||||
overlay_FLASH_RebootToBootloader();
|
||||
@ -1914,7 +1914,7 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
if ((g_battery_check_counter & 1) == 0)
|
||||
{
|
||||
BOARD_ADC_GetBatteryInfo(&g_battery_voltages[g_battery_voltage_index++], &g_battery_current);
|
||||
BOARD_ADC_GetBatteryInfo(&g_battery_voltages[g_battery_voltage_index++], &g_usb_current);
|
||||
if (g_battery_voltage_index > 3)
|
||||
g_battery_voltage_index = 0;
|
||||
BATTERY_GetReadings(true);
|
||||
|
@ -733,15 +733,15 @@ static void DrawSpectrum() {
|
||||
|
||||
static void UpdateBatteryInfo() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[i], &gBatteryCurrent);
|
||||
BOARD_ADC_GetBatteryInfo(&g_battery_voltages[i], &g_usb_current);
|
||||
}
|
||||
|
||||
uint16_t voltage = Mid(gBatteryVoltages, ARRAY_SIZE(gBatteryVoltages));
|
||||
gBatteryDisplayLevel = 0;
|
||||
uint16_t voltage = Mid(g_battery_voltages, ARRAY_SIZE(g_battery_voltages));
|
||||
g_battery_display_level = 0;
|
||||
|
||||
for (int i = ARRAY_SIZE(gBatteryCalibration) - 1; i >= 0; --i) {
|
||||
if (gBatteryCalibration[i] < voltage) {
|
||||
gBatteryDisplayLevel = i + 1;
|
||||
for (int i = ARRAY_SIZE(g_battery_calibration) - 1; i >= 0; --i) {
|
||||
if (g_battery_calibration[i] < voltage) {
|
||||
g_battery_display_level = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -753,7 +753,7 @@ static void DrawStatus() {
|
||||
for (int i = 126; i >= 116; i--) {
|
||||
g_status_line[i] = 0b01000010;
|
||||
}
|
||||
uint8_t v = gBatteryDisplayLevel;
|
||||
uint8_t v = g_battery_display_level;
|
||||
v <<= 1;
|
||||
for (int i = 125; i >= 116; i--) {
|
||||
if (126 - i <= v) {
|
||||
@ -768,7 +768,7 @@ static void DrawF(uint32_t f) {
|
||||
sprintf(String, "%u.%05u", f / 100000, f % 100000);
|
||||
|
||||
if (currentState == STILL && kbd.current == KEY_PTT) {
|
||||
if (gBatteryDisplayLevel == 6) {
|
||||
if (g_battery_display_level == 6) {
|
||||
sprintf(String, "VOLTAGE HIGH");
|
||||
} else if (!IsTXAllowed()) {
|
||||
sprintf(String, "DISABLED");
|
||||
@ -1021,7 +1021,7 @@ void OnKeyDownStill(key_code_t key) {
|
||||
case KEY_PTT:
|
||||
// start transmit
|
||||
UpdateBatteryInfo();
|
||||
if (gBatteryDisplayLevel != 6 && IsTXAllowed()) {
|
||||
if (g_battery_display_level != 6 && IsTXAllowed()) {
|
||||
ToggleTX(true);
|
||||
}
|
||||
redrawScreen = true;
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -22,8 +22,8 @@
|
||||
#include "ui/ui.h"
|
||||
|
||||
uint16_t g_battery_calibration[6];
|
||||
uint16_t g_battery_current_voltage;
|
||||
uint16_t g_battery_current;
|
||||
uint16_t g_usb_current_voltage;
|
||||
uint16_t g_usb_current;
|
||||
uint16_t g_battery_voltages[4];
|
||||
uint16_t g_battery_voltage_average;
|
||||
uint8_t g_battery_display_level;
|
||||
@ -109,7 +109,7 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
||||
if ((g_screen_to_display == DISPLAY_MENU) && g_menu_cursor == MENU_VOL)
|
||||
g_update_display = true;
|
||||
|
||||
if (g_battery_current < 501)
|
||||
if (g_usb_current < 501)
|
||||
{
|
||||
if (g_charging_with_type_c)
|
||||
{
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint16_t g_battery_calibration[6];
|
||||
extern uint16_t g_battery_current_voltage;
|
||||
extern uint16_t g_battery_current;
|
||||
extern uint16_t g_usb_current_voltage;
|
||||
extern uint16_t g_usb_current;
|
||||
extern uint16_t g_battery_voltages[4];
|
||||
extern uint16_t g_battery_voltage_average;
|
||||
extern uint8_t g_battery_display_level;
|
||||
|
4
main.c
4
main.c
@ -83,7 +83,7 @@ void Main(void)
|
||||
|
||||
BK4819_Init();
|
||||
|
||||
BOARD_ADC_GetBatteryInfo(&g_battery_current_voltage, &g_battery_current);
|
||||
BOARD_ADC_GetBatteryInfo(&g_usb_current_voltage, &g_usb_current);
|
||||
|
||||
BOARD_EEPROM_Init();
|
||||
|
||||
@ -97,7 +97,7 @@ void Main(void)
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_battery_voltages); i++)
|
||||
BOARD_ADC_GetBatteryInfo(&g_battery_voltages[i], &g_battery_current);
|
||||
BOARD_ADC_GetBatteryInfo(&g_battery_voltages[i], &g_usb_current);
|
||||
|
||||
BATTERY_GetReadings(false);
|
||||
|
||||
|
@ -955,7 +955,7 @@ void UI_DisplayMenu(void)
|
||||
sprintf(String, "%u.%02uV\n%u%%\ncurr %u",
|
||||
g_battery_voltage_average / 100, g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average),
|
||||
g_battery_current);
|
||||
g_usb_current);
|
||||
break;
|
||||
|
||||
case MENU_SIDE1_SHORT:
|
||||
|
@ -72,7 +72,7 @@ void UI_DisplayWelcome(void)
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
|
||||
#if 0
|
||||
sprintf(WelcomeString2, "Current %u", g_battery_current); // needs scaling into mA
|
||||
sprintf(WelcomeString2, "Current %u", g_usb_current); // needs scaling into mA
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user