kopia lustrzana https://github.com/OpenRTX/OpenRTX
Using Kconfig-style #defines for battery type description.
rodzic
0f4290cdfe
commit
cc27cc28a4
|
@ -26,16 +26,16 @@
|
||||||
* Obtained by multiplying the values in volt by 256.
|
* 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_min = 0x039C; // 3.61V
|
||||||
static const uint16_t bat_v_max = 0x0426; // 4.15V
|
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_min = 0x071A; // 7.10V
|
||||||
static const uint16_t bat_v_max = 0x0819; // 8.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_min = 0x0AD4; // 10.83V
|
||||||
static const uint16_t bat_v_max = 0x0C73; // 12.45V
|
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
|
// Nothing to do, just avoid arising the compiler error
|
||||||
#else
|
#else
|
||||||
#error Please define a battery type into platform/targets/.../hwconfig.h
|
#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)
|
uint8_t battery_getCharge(uint16_t vbat)
|
||||||
{
|
{
|
||||||
#ifdef BAT_NONE
|
#ifdef CONFIG_BAT_NONE
|
||||||
/* Return full charge if no battery is present. */
|
/* Return full charge if no battery is present. */
|
||||||
(void) vbat;
|
(void) vbat;
|
||||||
return 100;
|
return 100;
|
||||||
|
|
|
@ -45,7 +45,7 @@ void _ui_drawMainTop(ui_state_t * ui_state)
|
||||||
local_time.minute, local_time.second);
|
local_time.minute, local_time.second);
|
||||||
#endif
|
#endif
|
||||||
// If the radio has no built-in battery, print input voltage
|
// 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,
|
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
color_white,"%.1fV", last_state.v_bat);
|
color_white,"%.1fV", last_state.v_bat);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
#define CONFIG_SCREEN_BRIGHTNESS
|
#define CONFIG_SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define CONFIG_BAT_LIPO_2S
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
#define CONFIG_SCREEN_BRIGHTNESS
|
#define CONFIG_SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define CONFIG_BAT_LIPO_2S
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ extern "C" {
|
||||||
#define CONFIG_SCREEN_BRIGHTNESS
|
#define CONFIG_SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define CONFIG_BAT_LIPO_2S
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ extern "C" {
|
||||||
#define CONFIG_PIX_FMT_BW
|
#define CONFIG_PIX_FMT_BW
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_NONE
|
#define CONFIG_BAT_NONE
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ extern "C" {
|
||||||
#define CONFIG_PIX_FMT_RGB565
|
#define CONFIG_PIX_FMT_RGB565
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define CONFIG_BAT_LIPO_2S
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To enable pwm for display backlight dimming uncomment this directive.
|
* To enable pwm for display backlight dimming uncomment this directive.
|
||||||
|
|
|
@ -37,6 +37,6 @@
|
||||||
#define CONFIG_PIX_FMT_BW
|
#define CONFIG_PIX_FMT_BW
|
||||||
|
|
||||||
/* Device has no battery */
|
/* Device has no battery */
|
||||||
#define BAT_NONE
|
#define CONFIG_BAT_NONE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,7 @@ extern "C" {
|
||||||
#define CONFIG_SCREEN_BRIGHTNESS
|
#define CONFIG_SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define CONFIG_BAT_LIPO_2S
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,6 @@
|
||||||
#define CONFIG_PIX_FMT_BW
|
#define CONFIG_PIX_FMT_BW
|
||||||
#define GPS_PRESENT
|
#define GPS_PRESENT
|
||||||
|
|
||||||
#define BAT_LIPO_1S
|
#define CONFIG_BAT_LIPO_1S
|
||||||
|
|
||||||
#endif /* HWCONFIG_H */
|
#endif /* HWCONFIG_H */
|
||||||
|
|
Ładowanie…
Reference in New Issue