Using Kconfig-style #defines for battery type description.

pull/238/head
Silvano Seva 2023-12-26 10:43:51 +01:00
rodzic 0f4290cdfe
commit cc27cc28a4
10 zmienionych plików z 14 dodań i 14 usunięć

Wyświetl plik

@ -26,16 +26,16 @@
* Obtained by multiplying the values in volt by 256.
*/
#if defined BAT_LIPO_1S
#if defined CONFIG_BAT_LIPO_1S
static const uint16_t bat_v_min = 0x039C; // 3.61V
static const uint16_t bat_v_max = 0x0426; // 4.15V
#elif defined BAT_LIPO_2S
#elif defined CONFIG_BAT_LIPO_2S
static const uint16_t bat_v_min = 0x071A; // 7.10V
static const uint16_t bat_v_max = 0x0819; // 8.10V
#elif defined BAT_LIPO_3S
#elif defined CONFIG_BAT_LIPO_3S
static const uint16_t bat_v_min = 0x0AD4; // 10.83V
static const uint16_t bat_v_max = 0x0C73; // 12.45V
#elif defined BAT_NONE
#elif defined CONFIG_BAT_NONE
// Nothing to do, just avoid arising the compiler error
#else
#error Please define a battery type into platform/targets/.../hwconfig.h
@ -43,7 +43,7 @@ static const uint16_t bat_v_max = 0x0C73; // 12.45V
uint8_t battery_getCharge(uint16_t vbat)
{
#ifdef BAT_NONE
#ifdef CONFIG_BAT_NONE
/* Return full charge if no battery is present. */
(void) vbat;
return 100;

Wyświetl plik

@ -45,7 +45,7 @@ void _ui_drawMainTop(ui_state_t * ui_state)
local_time.minute, local_time.second);
#endif
// If the radio has no built-in battery, print input voltage
#ifdef BAT_NONE
#ifdef CONFIG_BAT_NONE
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_RIGHT,
color_white,"%.1fV", last_state.v_bat);
#else

Wyświetl plik

@ -43,7 +43,7 @@ extern "C" {
#define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */
#define BAT_LIPO_2S
#define CONFIG_BAT_LIPO_2S
#ifdef __cplusplus
}

Wyświetl plik

@ -43,7 +43,7 @@ extern "C" {
#define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */
#define BAT_LIPO_2S
#define CONFIG_BAT_LIPO_2S
#ifdef __cplusplus
}

Wyświetl plik

@ -47,7 +47,7 @@ extern "C" {
#define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */
#define BAT_LIPO_2S
#define CONFIG_BAT_LIPO_2S
#ifdef __cplusplus
}

Wyświetl plik

@ -46,7 +46,7 @@ extern "C" {
#define CONFIG_PIX_FMT_BW
/* Battery type */
#define BAT_NONE
#define CONFIG_BAT_NONE
#ifdef __cplusplus
}

Wyświetl plik

@ -41,7 +41,7 @@ extern "C" {
#define CONFIG_PIX_FMT_RGB565
/* Battery type */
#define BAT_LIPO_2S
#define CONFIG_BAT_LIPO_2S
/*
* To enable pwm for display backlight dimming uncomment this directive.

Wyświetl plik

@ -37,6 +37,6 @@
#define CONFIG_PIX_FMT_BW
/* Device has no battery */
#define BAT_NONE
#define CONFIG_BAT_NONE
#endif

Wyświetl plik

@ -26,7 +26,7 @@ extern "C" {
#define CONFIG_SCREEN_BRIGHTNESS
/* Battery type */
#define BAT_LIPO_2S
#define CONFIG_BAT_LIPO_2S
#ifdef __cplusplus
}

Wyświetl plik

@ -31,6 +31,6 @@
#define CONFIG_PIX_FMT_BW
#define GPS_PRESENT
#define BAT_LIPO_1S
#define CONFIG_BAT_LIPO_1S
#endif /* HWCONFIG_H */