add update and battery settings
This commit is contained in:
@@ -15,8 +15,6 @@ framework = arduino
|
||||
board_build.f_flash = 80000000L
|
||||
monitor_speed = 115200
|
||||
build_flags =
|
||||
; -DLOG_LOCAL_LEVEL=ESP_LOG_INFO
|
||||
; -DSPI_FREQUENCY=80000000L
|
||||
-DBOARD_HAS_PSRAM
|
||||
-mfix-esp32-psram-cache-issue
|
||||
src_filter =
|
||||
|
||||
@@ -185,7 +185,7 @@ void weather_forecast_sync_request( void ) {
|
||||
|
||||
void weather_forecast_sync_Task( void * pvParameters ) {
|
||||
weather_config_t *weather_config = weather_get_config();
|
||||
uint32_t retval = -1;
|
||||
int32_t retval = -1;
|
||||
|
||||
log_i("start weather forecast task");
|
||||
|
||||
|
||||
@@ -31,6 +31,6 @@
|
||||
/*
|
||||
* firmeware version string
|
||||
*/
|
||||
#define __FIRMWARE__ "2020073022"
|
||||
#define __FIRMWARE__ "2020073109"
|
||||
|
||||
#endif // _CONFIG_H
|
||||
|
||||
97
src/gui/images/info_update_16px.c
Normal file
97
src/gui/images/info_update_16px.c
Normal file
@@ -0,0 +1,97 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
#ifndef LV_ATTRIBUTE_IMG_INFO_UPDATE_16PX
|
||||
#define LV_ATTRIBUTE_IMG_INFO_UPDATE_16PX
|
||||
#endif
|
||||
|
||||
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_INFO_UPDATE_16PX uint8_t info_update_16px_map[] = {
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
/*Pixel format: Alpha 8 bit, Red: 3 bit, Green: 3 bit, Blue: 2 bit*/
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x13, 0x3c, 0x13, 0x9c, 0x13, 0xdb, 0x13, 0xfb, 0x13, 0xf7, 0x13, 0xd0, 0x13, 0x8b, 0x13, 0x24, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x13, 0x00, 0x13, 0x0f, 0x13, 0xab, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xfb, 0x13, 0x83, 0x13, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x13, 0x0f, 0x13, 0xd0, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xa7, 0x13, 0x03, 0x00, 0x00,
|
||||
0x13, 0x00, 0x13, 0xb0, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0x77, 0x13, 0x00,
|
||||
0x13, 0x47, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xf7, 0x13, 0x18,
|
||||
0x13, 0xa8, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0x73,
|
||||
0x13, 0xec, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xb3,
|
||||
0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xd4,
|
||||
0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xd4,
|
||||
0x13, 0xec, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xb3,
|
||||
0x13, 0xa8, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0x73,
|
||||
0x13, 0x44, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xf7, 0x13, 0x18,
|
||||
0x13, 0x00, 0x13, 0xb0, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0x74, 0x13, 0x00,
|
||||
0x00, 0x00, 0x13, 0x0f, 0x13, 0xd0, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xa7, 0x13, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x13, 0x00, 0x13, 0x0f, 0x13, 0xab, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xfb, 0x13, 0x80, 0x13, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x13, 0x3c, 0x13, 0x9b, 0x13, 0xdb, 0x13, 0xfb, 0x13, 0xf7, 0x13, 0xcf, 0x13, 0x8b, 0x13, 0x24, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
#endif
|
||||
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0
|
||||
/*Pixel format: Alpha 8 bit, Red: 5 bit, Green: 6 bit, Blue: 5 bit*/
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x1f, 0x04, 0x3c, 0x1f, 0x04, 0x9c, 0x1f, 0x04, 0xdb, 0x1f, 0x04, 0xfb, 0x1f, 0x04, 0xf7, 0x1f, 0x04, 0xd0, 0x1f, 0x04, 0x8b, 0x1f, 0x04, 0x24, 0x1f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1f, 0x04, 0x00, 0x1f, 0x04, 0x0f, 0x1f, 0x04, 0xab, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xfb, 0x1f, 0x04, 0x83, 0x1f, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1f, 0x04, 0x0f, 0x1f, 0x04, 0xd0, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xa7, 0x1f, 0x04, 0x03, 0x00, 0x00, 0x00,
|
||||
0x1f, 0x04, 0x00, 0x1f, 0x04, 0xb0, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0x77, 0x3f, 0x04, 0x00,
|
||||
0x1f, 0x04, 0x47, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xf7, 0x1f, 0x04, 0x18,
|
||||
0x1f, 0x04, 0xa8, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0x73,
|
||||
0x1f, 0x04, 0xec, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xb3,
|
||||
0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xd4,
|
||||
0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xd4,
|
||||
0x1f, 0x04, 0xec, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xb3,
|
||||
0x1f, 0x04, 0xa8, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0x73,
|
||||
0x1f, 0x04, 0x44, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xf7, 0x1f, 0x04, 0x18,
|
||||
0xff, 0x03, 0x00, 0x1f, 0x04, 0xb0, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0x74, 0x3f, 0x04, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1f, 0x04, 0x0f, 0x1f, 0x04, 0xd0, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xa7, 0x1f, 0x04, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1f, 0x04, 0x00, 0x1f, 0x04, 0x0f, 0x1f, 0x04, 0xab, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xfb, 0x1f, 0x04, 0x80, 0x1f, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x1f, 0x04, 0x3c, 0x1f, 0x04, 0x9b, 0x1f, 0x04, 0xdb, 0x1f, 0x04, 0xfb, 0x1f, 0x04, 0xf7, 0x1f, 0x04, 0xcf, 0x1f, 0x04, 0x8b, 0x1f, 0x04, 0x24, 0x1f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
#endif
|
||||
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP != 0
|
||||
/*Pixel format: Alpha 8 bit, Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 color bytes are swapped*/
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x00, 0x04, 0x1f, 0x3c, 0x04, 0x1f, 0x9c, 0x04, 0x1f, 0xdb, 0x04, 0x1f, 0xfb, 0x04, 0x1f, 0xf7, 0x04, 0x1f, 0xd0, 0x04, 0x1f, 0x8b, 0x04, 0x1f, 0x24, 0x04, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x04, 0x1f, 0x00, 0x04, 0x1f, 0x0f, 0x04, 0x1f, 0xab, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xfb, 0x04, 0x1f, 0x83, 0x04, 0x1f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x04, 0x1f, 0x0f, 0x04, 0x1f, 0xd0, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xa7, 0x04, 0x1f, 0x03, 0x00, 0x00, 0x00,
|
||||
0x04, 0x1f, 0x00, 0x04, 0x1f, 0xb0, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0x77, 0x04, 0x3f, 0x00,
|
||||
0x04, 0x1f, 0x47, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xf7, 0x04, 0x1f, 0x18,
|
||||
0x04, 0x1f, 0xa8, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0x73,
|
||||
0x04, 0x1f, 0xec, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xb3,
|
||||
0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xd4,
|
||||
0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xd4,
|
||||
0x04, 0x1f, 0xec, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xb3,
|
||||
0x04, 0x1f, 0xa8, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0x73,
|
||||
0x04, 0x1f, 0x44, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xf7, 0x04, 0x1f, 0x18,
|
||||
0x03, 0xff, 0x00, 0x04, 0x1f, 0xb0, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0x74, 0x04, 0x3f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x04, 0x1f, 0x0f, 0x04, 0x1f, 0xd0, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xa7, 0x04, 0x1f, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x04, 0x1f, 0x00, 0x04, 0x1f, 0x0f, 0x04, 0x1f, 0xab, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xfb, 0x04, 0x1f, 0x80, 0x04, 0x1f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x00, 0x04, 0x1f, 0x3c, 0x04, 0x1f, 0x9b, 0x04, 0x1f, 0xdb, 0x04, 0x1f, 0xfb, 0x04, 0x1f, 0xf7, 0x04, 0x1f, 0xcf, 0x04, 0x1f, 0x8b, 0x04, 0x1f, 0x24, 0x04, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
#endif
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7b, 0x00, 0x00, 0xff, 0x80, 0x00, 0x3c, 0xff, 0x80, 0x00, 0x9c, 0xff, 0x80, 0x00, 0xdb, 0xff, 0x80, 0x00, 0xfb, 0xff, 0x80, 0x00, 0xf7, 0xff, 0x80, 0x00, 0xd0, 0xff, 0x80, 0x00, 0x8b, 0xff, 0x80, 0x00, 0x24, 0xff, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x81, 0x00, 0x00, 0xff, 0x81, 0x00, 0x0f, 0xff, 0x80, 0x00, 0xab, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xfb, 0xff, 0x80, 0x00, 0x83, 0xff, 0x81, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x00, 0x0f, 0xff, 0x80, 0x00, 0xd0, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xa7, 0xff, 0x80, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0xb0, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0x77, 0xff, 0x83, 0x00, 0x00,
|
||||
0xff, 0x80, 0x00, 0x47, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xf7, 0xff, 0x80, 0x00, 0x18,
|
||||
0xff, 0x80, 0x00, 0xa8, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0x73,
|
||||
0xff, 0x80, 0x00, 0xec, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xb3,
|
||||
0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xd4,
|
||||
0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xd4,
|
||||
0xff, 0x80, 0x00, 0xec, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xb3,
|
||||
0xff, 0x80, 0x00, 0xa8, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0x73,
|
||||
0xff, 0x80, 0x00, 0x44, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xf7, 0xff, 0x80, 0x00, 0x18,
|
||||
0xff, 0x7c, 0x00, 0x00, 0xff, 0x80, 0x00, 0xb0, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0x74, 0xff, 0x83, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x00, 0x0f, 0xff, 0x80, 0x00, 0xd0, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xa7, 0xff, 0x80, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x81, 0x00, 0x00, 0xff, 0x81, 0x00, 0x0f, 0xff, 0x80, 0x00, 0xab, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xfb, 0xff, 0x80, 0x00, 0x80, 0xff, 0x81, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7b, 0x00, 0x00, 0xff, 0x80, 0x00, 0x3c, 0xff, 0x80, 0x00, 0x9b, 0xff, 0x80, 0x00, 0xdb, 0xff, 0x80, 0x00, 0xfb, 0xff, 0x80, 0x00, 0xf7, 0xff, 0x80, 0x00, 0xcf, 0xff, 0x81, 0x00, 0x8b, 0xff, 0x80, 0x00, 0x24, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
#endif
|
||||
};
|
||||
|
||||
const lv_img_dsc_t info_update_16px = {
|
||||
.header.always_zero = 0,
|
||||
.header.w = 16,
|
||||
.header.h = 16,
|
||||
.data_size = 256 * LV_IMG_PX_SIZE_ALPHA_BYTE,
|
||||
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
|
||||
.data = info_update_16px_map,
|
||||
};
|
||||
|
||||
65
src/gui/images/info_update_8px.c
Normal file
65
src/gui/images/info_update_8px.c
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
#endif
|
||||
|
||||
#ifndef LV_ATTRIBUTE_IMG_INFO_UPDATE_8PX
|
||||
#define LV_ATTRIBUTE_IMG_INFO_UPDATE_8PX
|
||||
#endif
|
||||
|
||||
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_INFO_UPDATE_8PX uint8_t info_update_8px_map[] = {
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
/*Pixel format: Alpha 8 bit, Red: 3 bit, Green: 3 bit, Blue: 2 bit*/
|
||||
0x0a, 0x00, 0x13, 0x2f, 0x13, 0xb7, 0x13, 0xf4, 0x13, 0xf0, 0x13, 0xab, 0x13, 0x20, 0x00, 0x00,
|
||||
0x13, 0x30, 0x13, 0xf4, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xe8, 0x13, 0x1f,
|
||||
0x13, 0xbb, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xa0,
|
||||
0x13, 0xfb, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xe0,
|
||||
0x13, 0xfb, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xe0,
|
||||
0x13, 0xbb, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xa0,
|
||||
0x13, 0x30, 0x13, 0xf3, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xff, 0x13, 0xe8, 0x13, 0x1f,
|
||||
0x0a, 0x00, 0x13, 0x2f, 0x13, 0xb4, 0x13, 0xf4, 0x13, 0xf0, 0x13, 0xab, 0x13, 0x20, 0x00, 0x00,
|
||||
#endif
|
||||
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0
|
||||
/*Pixel format: Alpha 8 bit, Red: 5 bit, Green: 6 bit, Blue: 5 bit*/
|
||||
0x11, 0x02, 0x00, 0x1f, 0x04, 0x2f, 0x1f, 0x04, 0xb7, 0x1f, 0x04, 0xf4, 0x1f, 0x04, 0xf0, 0x1f, 0x04, 0xab, 0x1f, 0x04, 0x20, 0x00, 0x00, 0x00,
|
||||
0x1f, 0x04, 0x30, 0x1f, 0x04, 0xf4, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xe8, 0x1f, 0x04, 0x1f,
|
||||
0x1f, 0x04, 0xbb, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xa0,
|
||||
0x1f, 0x04, 0xfb, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xe0,
|
||||
0x1f, 0x04, 0xfb, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xe0,
|
||||
0x1f, 0x04, 0xbb, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xa0,
|
||||
0x1f, 0x04, 0x30, 0x1f, 0x04, 0xf3, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xff, 0x1f, 0x04, 0xe8, 0x1f, 0x04, 0x1f,
|
||||
0x11, 0x02, 0x00, 0x1f, 0x04, 0x2f, 0x1f, 0x04, 0xb4, 0x1f, 0x04, 0xf4, 0x1f, 0x04, 0xf0, 0x1f, 0x04, 0xab, 0x1f, 0x04, 0x20, 0x00, 0x00, 0x00,
|
||||
#endif
|
||||
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP != 0
|
||||
/*Pixel format: Alpha 8 bit, Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 color bytes are swapped*/
|
||||
0x02, 0x11, 0x00, 0x04, 0x1f, 0x2f, 0x04, 0x1f, 0xb7, 0x04, 0x1f, 0xf4, 0x04, 0x1f, 0xf0, 0x04, 0x1f, 0xab, 0x04, 0x1f, 0x20, 0x00, 0x00, 0x00,
|
||||
0x04, 0x1f, 0x30, 0x04, 0x1f, 0xf4, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xe8, 0x04, 0x1f, 0x1f,
|
||||
0x04, 0x1f, 0xbb, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xa0,
|
||||
0x04, 0x1f, 0xfb, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xe0,
|
||||
0x04, 0x1f, 0xfb, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xe0,
|
||||
0x04, 0x1f, 0xbb, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xa0,
|
||||
0x04, 0x1f, 0x30, 0x04, 0x1f, 0xf3, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xff, 0x04, 0x1f, 0xe8, 0x04, 0x1f, 0x1f,
|
||||
0x02, 0x11, 0x00, 0x04, 0x1f, 0x2f, 0x04, 0x1f, 0xb4, 0x04, 0x1f, 0xf4, 0x04, 0x1f, 0xf0, 0x04, 0x1f, 0xab, 0x04, 0x1f, 0x20, 0x00, 0x00, 0x00,
|
||||
#endif
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
0x89, 0x42, 0x00, 0x00, 0xff, 0x80, 0x00, 0x2f, 0xff, 0x80, 0x00, 0xb7, 0xff, 0x80, 0x00, 0xf4, 0xff, 0x80, 0x00, 0xf0, 0xff, 0x80, 0x00, 0xab, 0xff, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0x80, 0x00, 0x30, 0xff, 0x80, 0x00, 0xf4, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xe8, 0xff, 0x80, 0x00, 0x1f,
|
||||
0xff, 0x80, 0x00, 0xbb, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xa0,
|
||||
0xff, 0x80, 0x00, 0xfb, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xe0,
|
||||
0xff, 0x80, 0x00, 0xfb, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xe0,
|
||||
0xff, 0x80, 0x00, 0xbb, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xa0,
|
||||
0xff, 0x80, 0x00, 0x30, 0xff, 0x80, 0x00, 0xf3, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x00, 0xe8, 0xff, 0x80, 0x00, 0x1f,
|
||||
0x89, 0x42, 0x00, 0x00, 0xff, 0x80, 0x00, 0x2f, 0xff, 0x80, 0x00, 0xb4, 0xff, 0x80, 0x00, 0xf4, 0xff, 0x80, 0x00, 0xf0, 0xff, 0x80, 0x00, 0xab, 0xff, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||
#endif
|
||||
};
|
||||
|
||||
const lv_img_dsc_t info_update_8px = {
|
||||
.header.always_zero = 0,
|
||||
.header.w = 8,
|
||||
.header.h = 8,
|
||||
.data_size = 64 * LV_IMG_PX_SIZE_ALPHA_BYTE,
|
||||
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
|
||||
.data = info_update_8px_map,
|
||||
};
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
static lv_style_t mainbar_style;
|
||||
static lv_style_t mainbar_switch_style;
|
||||
static lv_style_t mainbar_slider_style;
|
||||
|
||||
static lv_obj_t *mainbar = NULL;
|
||||
|
||||
@@ -58,6 +59,9 @@ void mainbar_setup( void ) {
|
||||
lv_style_init( &mainbar_switch_style );
|
||||
lv_style_set_bg_color( &mainbar_switch_style, LV_STATE_CHECKED, LV_COLOR_GREEN );
|
||||
|
||||
lv_style_init( &mainbar_slider_style );
|
||||
lv_style_set_bg_color( &mainbar_slider_style, LV_STATE_DEFAULT, LV_COLOR_GREEN );
|
||||
|
||||
mainbar = lv_tileview_create( lv_scr_act(), NULL);
|
||||
lv_tileview_set_valid_positions(mainbar, tile_pos_table, tile_entrys );
|
||||
lv_tileview_set_edge_flash( mainbar, false);
|
||||
@@ -71,16 +75,33 @@ uint32_t mainbar_add_tile( uint16_t x, uint16_t y ) {
|
||||
|
||||
if ( tile_pos_table == NULL ) {
|
||||
tile_pos_table = ( lv_point_t * )malloc( sizeof( lv_point_t ) * tile_entrys );
|
||||
if ( tile_pos_table == NULL ) {
|
||||
log_e("tile_pos_table malloc faild");
|
||||
while(true);
|
||||
}
|
||||
tile = ( lv_tile_t * )malloc( sizeof( lv_tile_t ) * tile_entrys );
|
||||
if ( tile == NULL ) {
|
||||
log_e("tile malloc faild");
|
||||
while(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
tile_pos_table = ( lv_point_t * )realloc( tile_pos_table, sizeof( lv_point_t ) * tile_entrys );
|
||||
tile = ( lv_tile_t * )realloc( tile, sizeof( lv_tile_t ) * tile_entrys );
|
||||
}
|
||||
lv_point_t *new_tile_pos_table;
|
||||
lv_tile_t *new_tile;
|
||||
|
||||
if ( tile_pos_table == NULL || tile == NULL ) {
|
||||
log_e("memory alloc faild");
|
||||
while(true);
|
||||
new_tile_pos_table = ( lv_point_t * )realloc( tile_pos_table, sizeof( lv_point_t ) * tile_entrys );
|
||||
if ( new_tile_pos_table == NULL ) {
|
||||
log_e("tile_pos_table realloc faild");
|
||||
while(true);
|
||||
}
|
||||
tile_pos_table = new_tile_pos_table;
|
||||
|
||||
new_tile = ( lv_tile_t * )realloc( tile, sizeof( lv_tile_t ) * tile_entrys );
|
||||
if ( new_tile == NULL ) {
|
||||
log_e("tile realloc faild");
|
||||
while(true);
|
||||
}
|
||||
tile = new_tile;
|
||||
}
|
||||
|
||||
tile_pos_table[ tile_entrys - 1 ].x = x;
|
||||
@@ -107,6 +128,9 @@ lv_style_t *mainbar_get_switch_style( void ) {
|
||||
return( &mainbar_switch_style );
|
||||
}
|
||||
|
||||
lv_style_t *mainbar_get_slider_style( void ) {
|
||||
return( &mainbar_slider_style );
|
||||
}
|
||||
|
||||
uint32_t mainbar_add_app_tile( uint16_t x, uint16_t y ) {
|
||||
uint32_t retval = -1;
|
||||
|
||||
@@ -58,6 +58,16 @@
|
||||
/*
|
||||
* @brief add a independent app tile formation
|
||||
*
|
||||
* predefine tiles
|
||||
*
|
||||
* +---+---+ 1 = main tile
|
||||
* | 1 | 2 | 2 = app tile
|
||||
* +---+---+ 3 = note tile
|
||||
* | 3 | 4 | 4 = setup tile
|
||||
* +---+---+
|
||||
*
|
||||
* app tile
|
||||
*
|
||||
* +---+---+ +---+ +---+---+
|
||||
* | n |n+1| | n | | n |n+1|
|
||||
* +---+---+ +---+ +---+---+
|
||||
@@ -72,6 +82,7 @@
|
||||
uint32_t mainbar_add_app_tile( uint16_t x, uint16_t y );
|
||||
/*
|
||||
* @brief get the lv_obj_t for a specific tile number
|
||||
*
|
||||
* @param tile_number tile number
|
||||
*
|
||||
* @return lv_obj_t
|
||||
@@ -89,5 +100,11 @@
|
||||
* @return lv_style_t
|
||||
*/
|
||||
lv_style_t *mainbar_get_switch_style( void );
|
||||
/*
|
||||
* @brief get main tile slider style
|
||||
*
|
||||
* @return lv_style_t
|
||||
*/
|
||||
lv_style_t *mainbar_get_slider_style( void );
|
||||
|
||||
#endif // _MAINBAR_H
|
||||
@@ -20,38 +20,41 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <TTGO.h>
|
||||
#include "battery_settings.h"
|
||||
#include "battery_view.h"
|
||||
|
||||
#include "gui/mainbar/mainbar.h"
|
||||
#include "gui/mainbar/setup_tile/setup.h"
|
||||
#include "gui/statusbar.h"
|
||||
#include "hardware/pmu.h"
|
||||
#include "hardware/display.h"
|
||||
#include "hardware/motor.h"
|
||||
#include "hardware/pmu.h"
|
||||
|
||||
lv_obj_t *battery_settings_tile=NULL;
|
||||
lv_style_t battery_settings_style;
|
||||
uint32_t battery_tile_num;
|
||||
uint32_t battery_settings_tile_num;
|
||||
|
||||
lv_obj_t *battery_design_cap;
|
||||
lv_obj_t *battery_current_cap;
|
||||
lv_obj_t *battery_voltage;
|
||||
lv_obj_t *charge_current;
|
||||
lv_obj_t *discharge_current;
|
||||
lv_obj_t *vbus_voltage;
|
||||
lv_task_t *battery_task;
|
||||
lv_obj_t *battery_setup_icon_cont = NULL;
|
||||
lv_obj_t *battery_setup_info_img = NULL;
|
||||
|
||||
lv_obj_t *battery_percent_switch = NULL;
|
||||
lv_obj_t *battery_experimental_switch = NULL;
|
||||
|
||||
LV_IMG_DECLARE(exit_32px);
|
||||
LV_IMG_DECLARE(battery_icon_64px);
|
||||
LV_IMG_DECLARE(info_update_16px);
|
||||
|
||||
static void enter_battery_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void exit_battery_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
void battery_update_task( lv_task_t *task );
|
||||
static void battery_percent_switch_event_handler( lv_obj_t * obj, lv_event_t event );
|
||||
static void battery_experimental_switch_event_handler( lv_obj_t * obj, lv_event_t event );
|
||||
|
||||
void battery_settings_tile_setup( void ) {
|
||||
// get an app tile and copy mainstyle
|
||||
battery_tile_num = mainbar_add_app_tile( 1, 2 );
|
||||
battery_settings_tile = mainbar_get_tile_obj( battery_tile_num );
|
||||
battery_settings_tile_num = mainbar_add_app_tile( 1, 2 );
|
||||
battery_settings_tile = mainbar_get_tile_obj( battery_settings_tile_num + 1 );
|
||||
|
||||
battery_view_tile_setup( battery_settings_tile_num );
|
||||
|
||||
lv_style_copy( &battery_settings_style, mainbar_get_style() );
|
||||
lv_style_set_bg_color( &battery_settings_style, LV_OBJ_PART_MAIN, LV_COLOR_GRAY);
|
||||
@@ -60,7 +63,8 @@ void battery_settings_tile_setup( void ) {
|
||||
lv_obj_add_style( battery_settings_tile, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
|
||||
// register an setup icon an set an callback
|
||||
lv_obj_t *battery_setup = lv_imgbtn_create ( setup_tile_register_setup(), NULL);
|
||||
battery_setup_icon_cont = setup_tile_register_setup();
|
||||
lv_obj_t *battery_setup = lv_imgbtn_create ( battery_setup_icon_cont, NULL);
|
||||
lv_imgbtn_set_src( battery_setup, LV_BTN_STATE_RELEASED, &battery_icon_64px);
|
||||
lv_imgbtn_set_src( battery_setup, LV_BTN_STATE_PRESSED, &battery_icon_64px);
|
||||
lv_imgbtn_set_src( battery_setup, LV_BTN_STATE_CHECKED_RELEASED, &battery_icon_64px);
|
||||
@@ -69,7 +73,11 @@ void battery_settings_tile_setup( void ) {
|
||||
lv_obj_align( battery_setup, NULL, LV_ALIGN_CENTER, 0, 0 );
|
||||
lv_obj_set_event_cb( battery_setup, enter_battery_setup_event_cb );
|
||||
|
||||
// create the battery settings */
|
||||
battery_setup_info_img = lv_img_create( battery_setup_icon_cont, NULL );
|
||||
lv_img_set_src( battery_setup_info_img, &info_update_16px );
|
||||
lv_obj_align( battery_setup_info_img, battery_setup_icon_cont, LV_ALIGN_IN_TOP_RIGHT, 0, 0 );
|
||||
lv_obj_set_hidden( battery_setup_info_img, true );
|
||||
|
||||
lv_obj_t *exit_btn = lv_imgbtn_create( battery_settings_tile, NULL);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_PRESSED, &exit_32px);
|
||||
@@ -79,96 +87,85 @@ void battery_settings_tile_setup( void ) {
|
||||
lv_obj_align( exit_btn, battery_settings_tile, LV_ALIGN_IN_TOP_LEFT, 10, STATUSBAR_HEIGHT + 10 );
|
||||
lv_obj_set_event_cb( exit_btn, exit_battery_setup_event_cb );
|
||||
|
||||
lv_obj_t *exit_label = lv_label_create( battery_settings_tile, NULL);
|
||||
lv_obj_add_style( exit_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( exit_label, "battery");
|
||||
lv_obj_t *exit_label = lv_label_create( battery_settings_tile, NULL );
|
||||
lv_obj_add_style( exit_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( exit_label, "battery settings");
|
||||
lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *battery_design_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size( battery_design_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_design_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_design_cont, battery_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 );
|
||||
lv_obj_t *battery_design_cap_label = lv_label_create( battery_design_cont, NULL);
|
||||
lv_obj_add_style( battery_design_cap_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_design_cap_label, "designed cap");
|
||||
lv_obj_align( battery_design_cap_label, battery_design_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
battery_design_cap = lv_label_create( battery_design_cont, NULL);
|
||||
lv_obj_add_style( battery_design_cap, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_design_cap, "300mAh");
|
||||
lv_obj_align( battery_design_cap, battery_design_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_t *battery_setup_label_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size(battery_setup_label_cont, LV_HOR_RES_MAX , 40);
|
||||
lv_obj_add_style( battery_setup_label_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_setup_label_cont, battery_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 );
|
||||
lv_obj_t *battery_setup_label = lv_label_create( battery_setup_label_cont, NULL);
|
||||
lv_obj_add_style( battery_setup_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_setup_label, "experimental functions");
|
||||
lv_obj_align( battery_setup_label, battery_setup_label_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *battery_current_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size( battery_current_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_current_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_current_cont, battery_design_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *battery_current_cap_label = lv_label_create( battery_current_cont, NULL);
|
||||
lv_obj_add_style( battery_current_cap_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_current_cap_label, "charged capacity");
|
||||
lv_obj_align( battery_current_cap_label, battery_current_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
battery_current_cap = lv_label_create( battery_current_cont, NULL);
|
||||
lv_obj_add_style( battery_current_cap, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_current_cap, "300mAh");
|
||||
lv_obj_align( battery_current_cap, battery_current_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_t *battery_percent_switch_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size(battery_percent_switch_cont, LV_HOR_RES_MAX , 40);
|
||||
lv_obj_add_style( battery_percent_switch_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_percent_switch_cont, battery_setup_label_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
battery_percent_switch = lv_switch_create( battery_percent_switch_cont, NULL );
|
||||
lv_obj_add_style( battery_percent_switch, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( battery_percent_switch, LV_ANIM_ON );
|
||||
lv_obj_align( battery_percent_switch, battery_percent_switch_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( battery_percent_switch, battery_percent_switch_event_handler );
|
||||
lv_obj_t *stepcounter_label = lv_label_create( battery_percent_switch_cont, NULL);
|
||||
lv_obj_add_style( stepcounter_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( stepcounter_label, "calculated percent");
|
||||
lv_obj_align( stepcounter_label, battery_percent_switch_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *battery_voltage_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size( battery_voltage_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_voltage_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_voltage_cont, battery_current_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *battery_voltage_label = lv_label_create( battery_voltage_cont, NULL);
|
||||
lv_obj_add_style( battery_voltage_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_voltage_label, "battery voltage");
|
||||
lv_obj_align( battery_voltage_label, battery_voltage_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
battery_voltage = lv_label_create( battery_voltage_cont, NULL);
|
||||
lv_obj_add_style( battery_voltage, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_voltage, "2.4mV");
|
||||
lv_obj_align( battery_voltage, battery_voltage_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_t *battery_experimental_switch_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size(battery_experimental_switch_cont, LV_HOR_RES_MAX , 40);
|
||||
lv_obj_add_style( battery_experimental_switch_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_experimental_switch_cont, battery_percent_switch_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
battery_experimental_switch = lv_switch_create( battery_experimental_switch_cont, NULL );
|
||||
lv_obj_add_style( battery_experimental_switch, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( battery_experimental_switch, LV_ANIM_ON );
|
||||
lv_obj_align( battery_experimental_switch, battery_experimental_switch_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( battery_experimental_switch, battery_experimental_switch_event_handler );
|
||||
lv_obj_t *doubleclick_label = lv_label_create( battery_experimental_switch_cont, NULL);
|
||||
lv_obj_add_style( doubleclick_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( doubleclick_label, "power save");
|
||||
lv_obj_align( doubleclick_label, battery_experimental_switch_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *battery_charge_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size( battery_charge_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_charge_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_charge_cont, battery_voltage_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 5 );
|
||||
lv_obj_t *battery_charge_label = lv_label_create( battery_charge_cont, NULL);
|
||||
lv_obj_add_style( battery_charge_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_charge_label, "charge current");
|
||||
lv_obj_align( battery_charge_label, battery_charge_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
charge_current = lv_label_create( battery_charge_cont, NULL);
|
||||
lv_obj_add_style( charge_current, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( charge_current, "100mA");
|
||||
lv_obj_align( charge_current, battery_charge_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
if ( pmu_get_calculated_percent() )
|
||||
lv_switch_on( battery_percent_switch, LV_ANIM_OFF);
|
||||
else
|
||||
lv_switch_off( battery_percent_switch, LV_ANIM_OFF);
|
||||
|
||||
lv_obj_t *battery_discharge_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size( battery_discharge_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_discharge_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( battery_discharge_cont, battery_charge_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *battery_discharge_label = lv_label_create( battery_discharge_cont, NULL);
|
||||
lv_obj_add_style( battery_discharge_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( battery_discharge_label, "discharge current");
|
||||
lv_obj_align( battery_discharge_label, battery_discharge_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
discharge_current = lv_label_create( battery_discharge_cont, NULL);
|
||||
lv_obj_add_style( discharge_current, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( discharge_current, "100mA");
|
||||
lv_obj_align( discharge_current, battery_discharge_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
if ( pmu_get_experimental_power_save() ) {
|
||||
lv_switch_on( battery_experimental_switch, LV_ANIM_OFF);
|
||||
lv_obj_set_hidden( battery_setup_info_img, false );
|
||||
}
|
||||
else
|
||||
lv_switch_off( battery_experimental_switch, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
lv_obj_t *vbus_voltage_cont = lv_obj_create( battery_settings_tile, NULL );
|
||||
lv_obj_set_size( vbus_voltage_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( vbus_voltage_cont, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_obj_align( vbus_voltage_cont, battery_discharge_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *vbus_voltage_label = lv_label_create( vbus_voltage_cont, NULL);
|
||||
lv_obj_add_style( vbus_voltage_label, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( vbus_voltage_label, "VBUS voltage");
|
||||
lv_obj_align( vbus_voltage_label, vbus_voltage_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
vbus_voltage = lv_label_create( vbus_voltage_cont, NULL);
|
||||
lv_obj_add_style( vbus_voltage, LV_OBJ_PART_MAIN, &battery_settings_style );
|
||||
lv_label_set_text( vbus_voltage, "2.4mV");
|
||||
lv_obj_align( vbus_voltage, vbus_voltage_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
static void battery_percent_switch_event_handler( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_VALUE_CHANGED ): motor_vibe( 1 );
|
||||
pmu_set_calculated_percent( lv_switch_get_state( obj ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
battery_task = lv_task_create(battery_update_task, 1000, LV_TASK_PRIO_LOWEST, NULL );
|
||||
static void battery_experimental_switch_event_handler( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_VALUE_CHANGED ): motor_vibe( 1 );
|
||||
pmu_set_experimental_power_save( lv_switch_get_state( obj ) );
|
||||
if ( pmu_get_experimental_power_save() )
|
||||
lv_obj_set_hidden( battery_setup_info_img, false );
|
||||
else
|
||||
lv_obj_set_hidden( battery_setup_info_img, true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void enter_battery_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
mainbar_jump_to_tilenumber( battery_tile_num, LV_ANIM_OFF );
|
||||
mainbar_jump_to_tilenumber( battery_settings_tile_num, LV_ANIM_OFF );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -177,38 +174,7 @@ static void enter_battery_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
static void exit_battery_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
mainbar_jump_to_tilenumber( setup_get_tile_num() , LV_ANIM_OFF );
|
||||
mainbar_jump_to_tilenumber( battery_settings_tile_num, LV_ANIM_OFF );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void battery_update_task( lv_task_t *task ) {
|
||||
char temp[16]="";
|
||||
TTGOClass *ttgo = TTGOClass::getWatch();
|
||||
|
||||
if ( pmu_get_byttery_percent( ttgo ) >= 0 ) {
|
||||
snprintf( temp, sizeof( temp ), "%0.1fmAh", ttgo->power->getCoulombData() );
|
||||
}
|
||||
else {
|
||||
snprintf( temp, sizeof( temp ), "unknown" );
|
||||
}
|
||||
lv_label_set_text( battery_current_cap, temp );
|
||||
lv_obj_align( battery_current_cap, lv_obj_get_parent( battery_current_cap ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.2fV", ttgo->power->getBattVoltage() / 1000 );
|
||||
lv_label_set_text( battery_voltage, temp );
|
||||
lv_obj_align( battery_voltage, lv_obj_get_parent( battery_voltage ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.1fmA", ttgo->power->getBattChargeCurrent() );
|
||||
lv_label_set_text( charge_current, temp );
|
||||
lv_obj_align( charge_current, lv_obj_get_parent( charge_current ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.1fmA", ttgo->power->getBattDischargeCurrent() );
|
||||
lv_label_set_text( discharge_current, temp );
|
||||
lv_obj_align( discharge_current, lv_obj_get_parent( discharge_current ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.2fV", ttgo->power->getVbusVoltage() / 1000 );
|
||||
lv_label_set_text( vbus_voltage, temp );
|
||||
lv_obj_align( vbus_voltage, lv_obj_get_parent( vbus_voltage ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
}
|
||||
|
||||
224
src/gui/mainbar/setup_tile/battery_settings/battery_view.cpp
Normal file
224
src/gui/mainbar/setup_tile/battery_settings/battery_view.cpp
Normal file
@@ -0,0 +1,224 @@
|
||||
/****************************************************************************
|
||||
* Tu May 22 21:23:51 2020
|
||||
* Copyright 2020 Dirk Brosswick
|
||||
* Email: dirk.brosswick@googlemail.com
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <TTGO.h>
|
||||
#include "battery_settings.h"
|
||||
|
||||
#include "gui/mainbar/mainbar.h"
|
||||
#include "gui/mainbar/setup_tile/setup.h"
|
||||
#include "gui/statusbar.h"
|
||||
#include "hardware/pmu.h"
|
||||
#include "hardware/motor.h"
|
||||
|
||||
lv_obj_t *battery_view_tile=NULL;
|
||||
lv_style_t battery_view_style;
|
||||
uint32_t battery_view_tile_num;
|
||||
|
||||
lv_obj_t *battery_view_design_cap;
|
||||
lv_obj_t *battery_view_current_cap;
|
||||
lv_obj_t *battery_view_voltage;
|
||||
lv_obj_t *charge_view_current;
|
||||
lv_obj_t *discharge_view_current;
|
||||
lv_obj_t *vbus_view_voltage;
|
||||
lv_task_t *battery_view_task;
|
||||
|
||||
LV_IMG_DECLARE(exit_32px);
|
||||
LV_IMG_DECLARE(setup_32px);
|
||||
|
||||
static void enter_battery_settings_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void enter_battery_view_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void exit_battery_view_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
void battery_view_update_task( lv_task_t *task );
|
||||
|
||||
void battery_view_tile_setup( uint32_t tile_num ) {
|
||||
// get an app tile and copy mainstyle
|
||||
battery_view_tile_num = tile_num;
|
||||
battery_view_tile = mainbar_get_tile_obj( battery_view_tile_num );
|
||||
|
||||
lv_style_copy( &battery_view_style, mainbar_get_style() );
|
||||
lv_style_set_bg_color( &battery_view_style, LV_OBJ_PART_MAIN, LV_COLOR_GRAY);
|
||||
lv_style_set_bg_opa( &battery_view_style, LV_OBJ_PART_MAIN, LV_OPA_100);
|
||||
lv_style_set_border_width( &battery_view_style, LV_OBJ_PART_MAIN, 0);
|
||||
lv_obj_add_style( battery_view_tile, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
|
||||
// create the battery settings */
|
||||
lv_obj_t *exit_btn = lv_imgbtn_create( battery_view_tile, NULL);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_PRESSED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_CHECKED_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_CHECKED_PRESSED, &exit_32px);
|
||||
lv_obj_add_style( exit_btn, LV_IMGBTN_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( exit_btn, battery_view_tile, LV_ALIGN_IN_TOP_LEFT, 10, STATUSBAR_HEIGHT + 10 );
|
||||
lv_obj_set_event_cb( exit_btn, exit_battery_view_event_cb );
|
||||
|
||||
// create the battery settings */
|
||||
lv_obj_t *setup_btn = lv_imgbtn_create( battery_view_tile, NULL);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_RELEASED, &setup_32px);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_PRESSED, &setup_32px);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_CHECKED_RELEASED, &setup_32px);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_CHECKED_PRESSED, &setup_32px);
|
||||
lv_obj_add_style( setup_btn, LV_IMGBTN_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( setup_btn, battery_view_tile, LV_ALIGN_IN_TOP_RIGHT, -10, STATUSBAR_HEIGHT + 10 );
|
||||
lv_obj_set_event_cb( setup_btn, enter_battery_settings_event_cb );
|
||||
|
||||
lv_obj_t *exit_label = lv_label_create( battery_view_tile, NULL);
|
||||
lv_obj_add_style( exit_label, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( exit_label, "battery");
|
||||
lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *battery_design_cont = lv_obj_create( battery_view_tile, NULL );
|
||||
lv_obj_set_size( battery_design_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_design_cont, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( battery_design_cont, battery_view_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 );
|
||||
lv_obj_t *battery_design_cap_label = lv_label_create( battery_design_cont, NULL);
|
||||
lv_obj_add_style( battery_design_cap_label, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_design_cap_label, "designed cap");
|
||||
lv_obj_align( battery_design_cap_label, battery_design_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
battery_view_design_cap = lv_label_create( battery_design_cont, NULL);
|
||||
lv_obj_add_style( battery_view_design_cap, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_view_design_cap, "300mAh");
|
||||
lv_obj_align( battery_view_design_cap, battery_design_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
lv_obj_t *battery_current_cont = lv_obj_create( battery_view_tile, NULL );
|
||||
lv_obj_set_size( battery_current_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_current_cont, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( battery_current_cont, battery_design_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *battery_current_cap_label = lv_label_create( battery_current_cont, NULL);
|
||||
lv_obj_add_style( battery_current_cap_label, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_current_cap_label, "charged capacity");
|
||||
lv_obj_align( battery_current_cap_label, battery_current_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
battery_view_current_cap = lv_label_create( battery_current_cont, NULL);
|
||||
lv_obj_add_style( battery_view_current_cap, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_view_current_cap, "300mAh");
|
||||
lv_obj_align( battery_view_current_cap, battery_current_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
lv_obj_t *battery_voltage_cont = lv_obj_create( battery_view_tile, NULL );
|
||||
lv_obj_set_size( battery_voltage_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_voltage_cont, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( battery_voltage_cont, battery_current_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *battery_voltage_label = lv_label_create( battery_voltage_cont, NULL);
|
||||
lv_obj_add_style( battery_voltage_label, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_voltage_label, "battery voltage");
|
||||
lv_obj_align( battery_voltage_label, battery_voltage_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
battery_view_voltage = lv_label_create( battery_voltage_cont, NULL);
|
||||
lv_obj_add_style( battery_view_voltage, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_view_voltage, "2.4mV");
|
||||
lv_obj_align( battery_view_voltage, battery_voltage_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
lv_obj_t *battery_charge_cont = lv_obj_create( battery_view_tile, NULL );
|
||||
lv_obj_set_size( battery_charge_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_charge_cont, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( battery_charge_cont, battery_voltage_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 5 );
|
||||
lv_obj_t *battery_charge_label = lv_label_create( battery_charge_cont, NULL);
|
||||
lv_obj_add_style( battery_charge_label, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_charge_label, "charge current");
|
||||
lv_obj_align( battery_charge_label, battery_charge_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
charge_view_current = lv_label_create( battery_charge_cont, NULL);
|
||||
lv_obj_add_style( charge_view_current, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( charge_view_current, "100mA");
|
||||
lv_obj_align( charge_view_current, battery_charge_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
lv_obj_t *battery_discharge_cont = lv_obj_create( battery_view_tile, NULL );
|
||||
lv_obj_set_size( battery_discharge_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( battery_discharge_cont, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( battery_discharge_cont, battery_charge_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *battery_discharge_label = lv_label_create( battery_discharge_cont, NULL);
|
||||
lv_obj_add_style( battery_discharge_label, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( battery_discharge_label, "discharge current");
|
||||
lv_obj_align( battery_discharge_label, battery_discharge_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
discharge_view_current = lv_label_create( battery_discharge_cont, NULL);
|
||||
lv_obj_add_style( discharge_view_current, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( discharge_view_current, "100mA");
|
||||
lv_obj_align( discharge_view_current, battery_discharge_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
lv_obj_t *vbus_voltage_cont = lv_obj_create( battery_view_tile, NULL );
|
||||
lv_obj_set_size( vbus_voltage_cont, LV_HOR_RES_MAX , 25 );
|
||||
lv_obj_add_style( vbus_voltage_cont, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_obj_align( vbus_voltage_cont, battery_discharge_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
lv_obj_t *vbus_voltage_label = lv_label_create( vbus_voltage_cont, NULL);
|
||||
lv_obj_add_style( vbus_voltage_label, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( vbus_voltage_label, "VBUS voltage");
|
||||
lv_obj_align( vbus_voltage_label, vbus_voltage_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
vbus_view_voltage = lv_label_create( vbus_voltage_cont, NULL);
|
||||
lv_obj_add_style( vbus_view_voltage, LV_OBJ_PART_MAIN, &battery_view_style );
|
||||
lv_label_set_text( vbus_view_voltage, "2.4mV");
|
||||
lv_obj_align( vbus_view_voltage, vbus_voltage_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
battery_view_task = lv_task_create(battery_view_update_task, 1000, LV_TASK_PRIO_LOWEST, NULL );
|
||||
}
|
||||
|
||||
static void enter_battery_view_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
mainbar_jump_to_tilenumber( battery_view_tile_num, LV_ANIM_OFF );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void enter_battery_settings_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
mainbar_jump_to_tilenumber( battery_view_tile_num + 1, LV_ANIM_OFF );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void exit_battery_view_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
mainbar_jump_to_tilenumber( setup_get_tile_num() , LV_ANIM_OFF );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void battery_view_update_task( lv_task_t *task ) {
|
||||
char temp[16]="";
|
||||
TTGOClass *ttgo = TTGOClass::getWatch();
|
||||
|
||||
if ( pmu_get_battery_percent( ttgo ) >= 0 ) {
|
||||
snprintf( temp, sizeof( temp ), "%0.1fmAh", ttgo->power->getCoulombData() );
|
||||
}
|
||||
else {
|
||||
snprintf( temp, sizeof( temp ), "unknown" );
|
||||
}
|
||||
lv_label_set_text( battery_view_current_cap, temp );
|
||||
lv_obj_align( battery_view_current_cap, lv_obj_get_parent( battery_view_current_cap ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.2fV", ttgo->power->getBattVoltage() / 1000 );
|
||||
lv_label_set_text( battery_view_voltage, temp );
|
||||
lv_obj_align( battery_view_voltage, lv_obj_get_parent( battery_view_voltage ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.1fmA", ttgo->power->getBattChargeCurrent() );
|
||||
lv_label_set_text( charge_view_current, temp );
|
||||
lv_obj_align( charge_view_current, lv_obj_get_parent( charge_view_current ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.1fmA", ttgo->power->getBattDischargeCurrent() );
|
||||
lv_label_set_text( discharge_view_current, temp );
|
||||
lv_obj_align( discharge_view_current, lv_obj_get_parent( discharge_view_current ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
|
||||
snprintf( temp, sizeof( temp ), "%0.2fV", ttgo->power->getVbusVoltage() / 1000 );
|
||||
lv_label_set_text( vbus_view_voltage, temp );
|
||||
lv_obj_align( vbus_view_voltage, lv_obj_get_parent( vbus_view_voltage ), LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
}
|
||||
29
src/gui/mainbar/setup_tile/battery_settings/battery_view.h
Normal file
29
src/gui/mainbar/setup_tile/battery_settings/battery_view.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/****************************************************************************
|
||||
* Tu May 22 21:23:51 2020
|
||||
* Copyright 2020 Dirk Brosswick
|
||||
* Email: dirk.brosswick@googlemail.com
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef _BATTERY_VIEW_H
|
||||
#define _BATTERY_VIEW_H
|
||||
|
||||
#include <TTGO.h>
|
||||
|
||||
void battery_view_tile_setup( uint32_t tile_num );
|
||||
|
||||
#endif // _BATTERY_VIEW_H
|
||||
@@ -88,6 +88,8 @@ void display_settings_tile_setup( void ) {
|
||||
lv_obj_add_style( brightness_cont, LV_OBJ_PART_MAIN, &display_settings_style );
|
||||
lv_obj_align( brightness_cont, display_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 );
|
||||
display_brightness_slider = lv_slider_create( brightness_cont, NULL );
|
||||
lv_obj_add_style( display_brightness_slider, LV_SLIDER_PART_INDIC, mainbar_get_slider_style() );
|
||||
lv_obj_add_style( display_brightness_slider, LV_SLIDER_PART_KNOB, mainbar_get_slider_style() );
|
||||
lv_slider_set_range( display_brightness_slider, DISPLAY_MIN_BRIGHTNESS, DISPLAY_MAX_BRIGHTNESS );
|
||||
lv_obj_set_size( display_brightness_slider, LV_HOR_RES_MAX - 100 , 10 );
|
||||
lv_obj_align( display_brightness_slider, brightness_cont, LV_ALIGN_IN_RIGHT_MID, -30, 0 );
|
||||
@@ -101,6 +103,8 @@ void display_settings_tile_setup( void ) {
|
||||
lv_obj_add_style( timeout_cont, LV_OBJ_PART_MAIN, &display_settings_style );
|
||||
lv_obj_align( timeout_cont, brightness_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
display_timeout_slider = lv_slider_create( timeout_cont, NULL );
|
||||
lv_obj_add_style( display_timeout_slider, LV_SLIDER_PART_INDIC, mainbar_get_slider_style() );
|
||||
lv_obj_add_style( display_timeout_slider, LV_SLIDER_PART_KNOB, mainbar_get_slider_style() );
|
||||
lv_slider_set_range( display_timeout_slider, DISPLAY_MIN_TIMEOUT, DISPLAY_MAX_TIMEOUT );
|
||||
lv_obj_set_size(display_timeout_slider, LV_HOR_RES_MAX - 100 , 10 );
|
||||
lv_obj_align( display_timeout_slider, timeout_cont, LV_ALIGN_IN_TOP_RIGHT, -30, 10 );
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <HTTPUpdate.h>
|
||||
|
||||
#include "update.h"
|
||||
#include "update_setup.h"
|
||||
#include "update_check_version.h"
|
||||
|
||||
#include "gui/mainbar/mainbar.h"
|
||||
@@ -47,18 +48,23 @@ lv_obj_t *update_status_label = NULL;
|
||||
lv_obj_t *update_setup_icon_cont = NULL;
|
||||
lv_obj_t *update_info_img = NULL;
|
||||
|
||||
static void enter_update_setup_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void enter_update_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void exit_update_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void update_event_handler(lv_obj_t * obj, lv_event_t event );
|
||||
|
||||
LV_IMG_DECLARE(exit_32px);
|
||||
LV_IMG_DECLARE(setup_32px);
|
||||
LV_IMG_DECLARE(update_64px);
|
||||
LV_IMG_DECLARE(info_1_16px);
|
||||
|
||||
void update_tile_setup( void ) {
|
||||
// get an app tile and copy mainstyle
|
||||
update_tile_num = mainbar_add_app_tile( 1, 1 );
|
||||
update_tile_num = mainbar_add_app_tile( 1, 2 );
|
||||
update_settings_tile = mainbar_get_tile_obj( update_tile_num );
|
||||
|
||||
update_setup_tile_setup( update_tile_num + 1 );
|
||||
|
||||
lv_style_copy( &update_settings_style, mainbar_get_style() );
|
||||
lv_style_set_bg_color( &update_settings_style, LV_OBJ_PART_MAIN, LV_COLOR_GRAY);
|
||||
lv_style_set_bg_opa( &update_settings_style, LV_OBJ_PART_MAIN, LV_OPA_100);
|
||||
@@ -81,6 +87,15 @@ void update_tile_setup( void ) {
|
||||
lv_obj_align( update_info_img, update_setup_icon_cont, LV_ALIGN_IN_TOP_RIGHT, 0, 0 );
|
||||
lv_obj_set_hidden( update_info_img, true );
|
||||
|
||||
lv_obj_t *setup_btn = lv_imgbtn_create( update_settings_tile, NULL);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_RELEASED, &setup_32px);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_PRESSED, &setup_32px);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_CHECKED_RELEASED, &setup_32px);
|
||||
lv_imgbtn_set_src( setup_btn, LV_BTN_STATE_CHECKED_PRESSED, &setup_32px);
|
||||
lv_obj_add_style( setup_btn, LV_IMGBTN_PART_MAIN, &update_settings_style );
|
||||
lv_obj_align( setup_btn, update_settings_tile, LV_ALIGN_IN_TOP_RIGHT, -10, STATUSBAR_HEIGHT + 10 );
|
||||
lv_obj_set_event_cb( setup_btn, enter_update_setup_setup_event_cb );
|
||||
|
||||
lv_obj_t *exit_btn = lv_imgbtn_create( update_settings_tile, NULL);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_PRESSED, &exit_32px);
|
||||
@@ -121,13 +136,23 @@ void update_tile_setup( void ) {
|
||||
|
||||
// regster callback
|
||||
WiFi.onEvent( [](WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
update_check_version();
|
||||
if ( update_setup_get_autosync() ) {
|
||||
update_check_version();
|
||||
}
|
||||
}, WiFiEvent_t::SYSTEM_EVENT_STA_GOT_IP );
|
||||
|
||||
update_event_handle = xEventGroupCreate();
|
||||
xEventGroupClearBits( update_event_handle, UPDATE_REQUEST );
|
||||
}
|
||||
|
||||
static void enter_update_setup_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
mainbar_jump_to_tilenumber( update_tile_num + 1, LV_ANIM_OFF );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void enter_update_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
|
||||
149
src/gui/mainbar/setup_tile/update/update_setup.cpp
Normal file
149
src/gui/mainbar/setup_tile/update/update_setup.cpp
Normal file
@@ -0,0 +1,149 @@
|
||||
/****************************************************************************
|
||||
* July 31 07:31:12 2020
|
||||
* Copyright 2020 Dirk Brosswick
|
||||
* Email: dirk.brosswick@googlemail.com
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include "update.h"
|
||||
#include "update_setup.h"
|
||||
|
||||
#include "gui/mainbar/mainbar.h"
|
||||
#include "gui/mainbar/main_tile/main_tile.h"
|
||||
#include "gui/statusbar.h"
|
||||
#include "gui/keyboard.h"
|
||||
|
||||
#include "hardware/motor.h"
|
||||
|
||||
update_config_t update_config;
|
||||
|
||||
lv_obj_t *update_setup_tile = NULL;
|
||||
lv_style_t update_setup_style;
|
||||
uint32_t update_setup_tile_num;
|
||||
|
||||
lv_obj_t *update_check_autosync_onoff = NULL;
|
||||
|
||||
LV_IMG_DECLARE(exit_32px);
|
||||
LV_IMG_DECLARE(setup_32px);
|
||||
|
||||
static void exit_update_check_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void update_check_autosync_onoff_event_handler( lv_obj_t * obj, lv_event_t event );
|
||||
void update_read_config( void );
|
||||
void update_save_config( void );
|
||||
|
||||
void update_setup_tile_setup( uint32_t tile_num ) {
|
||||
|
||||
update_read_config();
|
||||
|
||||
update_setup_tile_num = tile_num;
|
||||
update_setup_tile = mainbar_get_tile_obj( update_setup_tile_num );
|
||||
|
||||
lv_style_copy( &update_setup_style, mainbar_get_style() );
|
||||
lv_style_set_bg_color( &update_setup_style, LV_OBJ_PART_MAIN, LV_COLOR_GRAY);
|
||||
lv_style_set_bg_opa( &update_setup_style, LV_OBJ_PART_MAIN, LV_OPA_100);
|
||||
lv_style_set_border_width( &update_setup_style, LV_OBJ_PART_MAIN, 0);
|
||||
lv_obj_add_style( update_setup_tile, LV_OBJ_PART_MAIN, &update_setup_style );
|
||||
|
||||
lv_obj_t *exit_btn = lv_imgbtn_create( update_setup_tile, NULL);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_PRESSED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_CHECKED_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn, LV_BTN_STATE_CHECKED_PRESSED, &exit_32px);
|
||||
lv_obj_add_style( exit_btn, LV_IMGBTN_PART_MAIN, &update_setup_style );
|
||||
lv_obj_align( exit_btn, update_setup_tile, LV_ALIGN_IN_TOP_LEFT, 10, STATUSBAR_HEIGHT + 10 );
|
||||
lv_obj_set_event_cb( exit_btn, exit_update_check_setup_event_cb );
|
||||
|
||||
lv_obj_t *exit_label = lv_label_create( update_setup_tile, NULL);
|
||||
lv_obj_add_style( exit_label, LV_OBJ_PART_MAIN, &update_setup_style );
|
||||
lv_label_set_text( exit_label, "update settings");
|
||||
lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *update_check_autosync_cont = lv_obj_create( update_setup_tile, NULL );
|
||||
lv_obj_set_size(update_check_autosync_cont, LV_HOR_RES_MAX , 40);
|
||||
lv_obj_add_style( update_check_autosync_cont, LV_OBJ_PART_MAIN, &update_setup_style );
|
||||
lv_obj_align( update_check_autosync_cont, update_setup_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 );
|
||||
|
||||
update_check_autosync_onoff = lv_switch_create( update_check_autosync_cont, NULL );
|
||||
lv_obj_add_style( update_check_autosync_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( update_check_autosync_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( update_check_autosync_onoff, update_check_autosync_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( update_check_autosync_onoff, update_check_autosync_onoff_event_handler );
|
||||
lv_obj_t *update_check_autosync_label = lv_label_create( update_check_autosync_cont, NULL);
|
||||
lv_obj_add_style( update_check_autosync_label, LV_OBJ_PART_MAIN, &update_setup_style );
|
||||
lv_label_set_text( update_check_autosync_label, "check for updates");
|
||||
lv_obj_align( update_check_autosync_label, update_check_autosync_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
|
||||
if ( update_config.autosync)
|
||||
lv_switch_on( update_check_autosync_onoff, LV_ANIM_OFF);
|
||||
else
|
||||
lv_switch_off( update_check_autosync_onoff, LV_ANIM_OFF);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void update_check_autosync_onoff_event_handler( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch (event) {
|
||||
case (LV_EVENT_VALUE_CHANGED): motor_vibe( 1 );
|
||||
update_config.autosync = lv_switch_get_state( obj );
|
||||
update_save_config();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void exit_update_check_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_CLICKED ): motor_vibe( 1 );
|
||||
mainbar_jump_to_tilenumber( update_setup_tile_num - 1, false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void update_save_config( void ) {
|
||||
fs::File file = SPIFFS.open( UPDATE_CONFIG_FILE, FILE_WRITE );
|
||||
|
||||
if ( !file ) {
|
||||
log_e("Can't save file: %s", UPDATE_CONFIG_FILE );
|
||||
}
|
||||
else {
|
||||
file.write( (uint8_t *)&update_config, sizeof( update_config ) );
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void update_read_config( void ) {
|
||||
fs::File file = SPIFFS.open( UPDATE_CONFIG_FILE, FILE_READ );
|
||||
|
||||
if (!file) {
|
||||
log_e("Can't open file: %s!", UPDATE_CONFIG_FILE );
|
||||
}
|
||||
else {
|
||||
int filesize = file.size();
|
||||
if ( filesize > sizeof( update_config ) ) {
|
||||
log_e("Failed to read configfile. Wrong filesize!" );
|
||||
}
|
||||
else {
|
||||
file.read( (uint8_t *)&update_config, filesize );
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
bool update_setup_get_autosync( void ) {
|
||||
return( update_config.autosync );
|
||||
}
|
||||
36
src/gui/mainbar/setup_tile/update/update_setup.h
Normal file
36
src/gui/mainbar/setup_tile/update/update_setup.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
* July 31 07:31:12 2020
|
||||
* Copyright 2020 Dirk Brosswick
|
||||
* Email: dirk.brosswick@googlemail.com
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef _UPDATE_SETUP_H
|
||||
#define _UPDATE_SETUP_H
|
||||
|
||||
#include <TTGO.h>
|
||||
|
||||
#define UPDATE_CONFIG_FILE "/update.cfg"
|
||||
|
||||
typedef struct {
|
||||
bool autosync = true;
|
||||
} update_config_t;
|
||||
|
||||
void update_setup_tile_setup( uint32_t tile_num );
|
||||
bool update_setup_get_autosync( void );
|
||||
|
||||
#endif // _UPDATE_SETUP_H
|
||||
@@ -29,11 +29,13 @@
|
||||
#include "gui/statusbar.h"
|
||||
|
||||
EventGroupHandle_t bma_event_handle = NULL;
|
||||
|
||||
void IRAM_ATTR bma_irq( void );
|
||||
|
||||
bma_config_t bma_config[ BMA_CONFIG_NUM ];
|
||||
|
||||
__NOINIT_ATTR uint32_t stepcounter_valid;
|
||||
__NOINIT_ATTR uint32_t stepcounter;
|
||||
|
||||
void IRAM_ATTR bma_irq( void );
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
@@ -45,6 +47,12 @@ void bma_setup( TTGOClass *ttgo ) {
|
||||
bma_config[ i ].enable = true;
|
||||
}
|
||||
|
||||
if ( stepcounter_valid != 0xa5a5a5a5 ) {
|
||||
stepcounter = 0;
|
||||
stepcounter_valid = 0xa5a5a5a5;
|
||||
log_e("stepcounter not valid. reset");
|
||||
}
|
||||
|
||||
bma_read_config();
|
||||
|
||||
ttgo->bma->begin();
|
||||
@@ -101,7 +109,8 @@ void bma_loop( TTGOClass *ttgo ) {
|
||||
}
|
||||
|
||||
if ( !powermgm_get_event( POWERMGM_STANDBY ) && xEventGroupGetBitsFromISR( bma_event_handle ) & BMA_EVENT_INT ) {
|
||||
statusbar_update_stepcounter( ttgo->bma->getCounter() );
|
||||
stepcounter =+ ttgo->bma->getCounter();
|
||||
statusbar_update_stepcounter( stepcounter );
|
||||
xEventGroupClearBitsFromISR( bma_event_handle, BMA_EVENT_INT );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define DISPLAY_MIN_TIMEOUT 15
|
||||
#define DISPLAY_MAX_TIMEOUT 300
|
||||
|
||||
#define DISPLAY_MIN_BRIGHTNESS 32
|
||||
#define DISPLAY_MIN_BRIGHTNESS 8
|
||||
#define DISPLAY_MAX_BRIGHTNESS 255
|
||||
|
||||
#define DISPLAY_MIN_ROTATE 0
|
||||
|
||||
@@ -12,12 +12,16 @@ EventGroupHandle_t pmu_event_handle = NULL;
|
||||
|
||||
void IRAM_ATTR pmu_irq( void );
|
||||
|
||||
pmu_config_t pmu_config;
|
||||
|
||||
/*
|
||||
* init the pmu: AXP202
|
||||
*/
|
||||
void pmu_setup( TTGOClass *ttgo ) {
|
||||
pmu_event_handle = xEventGroupCreate();
|
||||
|
||||
pmu_read_config();
|
||||
|
||||
// Turn on the IRQ used
|
||||
ttgo->power->adc1Enable( AXP202_BATT_VOL_ADC1 | AXP202_BATT_CUR_ADC1 | AXP202_VBUS_VOL_ADC1 | AXP202_VBUS_CUR_ADC1, AXP202_ON);
|
||||
ttgo->power->enableIRQ( AXP202_VBUS_REMOVED_IRQ | AXP202_VBUS_CONNECT_IRQ | AXP202_CHARGING_FINISHED_IRQ | AXP202_TIMER_TIMEOUT_IRQ, AXP202_ON );
|
||||
@@ -62,6 +66,61 @@ void IRAM_ATTR pmu_irq( void ) {
|
||||
setCpuFrequencyMhz(240);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void pmu_save_config( void ) {
|
||||
fs::File file = SPIFFS.open( PMU_CONFIG_FILE, FILE_WRITE );
|
||||
|
||||
if ( !file ) {
|
||||
log_e("Can't save file: %s", PMU_CONFIG_FILE );
|
||||
}
|
||||
else {
|
||||
file.write( (uint8_t *)&pmu_config, sizeof( pmu_config ) );
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void pmu_read_config( void ) {
|
||||
fs::File file = SPIFFS.open( PMU_CONFIG_FILE, FILE_READ );
|
||||
|
||||
if (!file) {
|
||||
log_e("Can't open file: %s!", PMU_CONFIG_FILE );
|
||||
}
|
||||
else {
|
||||
int filesize = file.size();
|
||||
if ( filesize > sizeof( pmu_config ) ) {
|
||||
log_e("Failed to read configfile. Wrong filesize!" );
|
||||
}
|
||||
else {
|
||||
file.read( (uint8_t *)&pmu_config, filesize );
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool pmu_get_calculated_percent( void ) {
|
||||
return( pmu_config.compute_percent );
|
||||
}
|
||||
|
||||
bool pmu_get_experimental_power_save( void ) {
|
||||
return( pmu_config.experimental_power_save );
|
||||
}
|
||||
|
||||
void pmu_set_calculated_percent( bool value ) {
|
||||
pmu_config.compute_percent = value;
|
||||
pmu_save_config();
|
||||
}
|
||||
|
||||
void pmu_set_experimental_power_save( bool value ) {
|
||||
pmu_config.experimental_power_save = value;
|
||||
pmu_save_config();
|
||||
}
|
||||
|
||||
/*
|
||||
* loop routine for handling IRQ in main loop
|
||||
*/
|
||||
@@ -110,16 +169,21 @@ void pmu_loop( TTGOClass *ttgo ) {
|
||||
if ( !powermgm_get_event( POWERMGM_STANDBY ) ) {
|
||||
if ( nextmillis < millis() || updatetrigger == true ) {
|
||||
nextmillis = millis() + 1000;
|
||||
statusbar_update_battery( pmu_get_byttery_percent( ttgo ), ttgo->power->isChargeing(), ttgo->power->isVBUSPlug() );
|
||||
statusbar_update_battery( pmu_get_battery_percent( ttgo ), ttgo->power->isChargeing(), ttgo->power->isVBUSPlug() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t pmu_get_byttery_percent( TTGOClass *ttgo ) {
|
||||
// discharg coulumb higher then charge coulumb, battery state unknow and set to zero
|
||||
if ( ttgo->power->getBattChargeCoulomb() < ttgo->power->getBattDischargeCoulomb() || ttgo->power->getBattVoltage() < 3200 ) {
|
||||
ttgo->power->ClearCoulombcounter();
|
||||
return( -1 );
|
||||
int32_t pmu_get_battery_percent( TTGOClass *ttgo ) {
|
||||
if ( pmu_get_calculated_percent() ) {
|
||||
if ( ttgo->power->getBattChargeCoulomb() < ttgo->power->getBattDischargeCoulomb() || ttgo->power->getBattVoltage() < 3200 ) {
|
||||
ttgo->power->ClearCoulombcounter();
|
||||
return( -1 );
|
||||
}
|
||||
return( ( ttgo->power->getCoulombData() / PMU_BATTERY_CAP ) * 100 );
|
||||
}
|
||||
return( ( ttgo->power->getCoulombData() / PMU_BATTERY_CAP ) * 100 );
|
||||
else {
|
||||
return( ttgo->power->getBattPercentage() );
|
||||
}
|
||||
// discharg coulumb higher then charge coulumb, battery state unknow and set to zero
|
||||
}
|
||||
@@ -26,6 +26,13 @@
|
||||
|
||||
#define PMU_BATTERY_CAP 300
|
||||
|
||||
#define PMU_CONFIG_FILE "/pmu.cfg"
|
||||
|
||||
typedef struct {
|
||||
bool compute_percent = false;
|
||||
bool experimental_power_save = false;
|
||||
} pmu_config_t;
|
||||
|
||||
/*
|
||||
* @brief setup pmu: axp202
|
||||
*
|
||||
@@ -46,6 +53,12 @@
|
||||
*
|
||||
* @return charge in percent or -1 if unknown
|
||||
*/
|
||||
uint32_t pmu_get_byttery_percent( TTGOClass *ttgo );
|
||||
int32_t pmu_get_battery_percent( TTGOClass *ttgo );
|
||||
void pmu_save_config( void );
|
||||
void pmu_read_config( void );
|
||||
bool pmu_get_calculated_percent( void );
|
||||
bool pmu_get_experimental_power_save( void );
|
||||
void pmu_set_calculated_percent( bool value );
|
||||
void pmu_set_experimental_power_save( bool value );
|
||||
|
||||
#endif // _PMU_H
|
||||
@@ -70,7 +70,14 @@ void powermgm_loop( TTGOClass *ttgo ) {
|
||||
|
||||
if ( powermgm_get_event( POWERMGM_STANDBY ) ) {
|
||||
powermgm_clear_event( POWERMGM_STANDBY );
|
||||
ttgo->power->setDCDC3Voltage( 3300 );
|
||||
if ( pmu_get_experimental_power_save() ) {
|
||||
ttgo->power->setDCDC3Voltage( 3000 );
|
||||
log_e("enable 3.0V voltage");
|
||||
}
|
||||
else {
|
||||
ttgo->power->setDCDC3Voltage( 3300 );
|
||||
log_e("enable 3.3V voltage");
|
||||
}
|
||||
// normal wake up from standby
|
||||
if ( powermgm_get_event( POWERMGM_PMU_BUTTON | POWERMGM_PMU_BATTERY | POWERMGM_BMA_WAKEUP ) ) {
|
||||
log_i("wakeup");
|
||||
@@ -89,7 +96,11 @@ void powermgm_loop( TTGOClass *ttgo ) {
|
||||
lv_disp_trig_activity(NULL);
|
||||
if ( bma_get_config( BMA_STEPCOUNTER ) )
|
||||
ttgo->bma->enableStepCountInterrupt( true );
|
||||
wifictl_on();
|
||||
|
||||
if ( ttgo->power->getBattVoltage() > 3300 ) {
|
||||
wifictl_on();
|
||||
}
|
||||
|
||||
ttgo->power->clearTimerStatus();
|
||||
ttgo->power->offTimer();
|
||||
}
|
||||
@@ -104,9 +115,16 @@ void powermgm_loop( TTGOClass *ttgo ) {
|
||||
ttgo->bma->enableStepCountInterrupt( false );
|
||||
powermgm_set_event( POWERMGM_STANDBY );
|
||||
powermgm_clear_event( POWERMGM_SILENCE_WAKEUP );
|
||||
ttgo->power->setDCDC3Voltage( 3000 );
|
||||
ttgo->power->clearTimerStatus();
|
||||
ttgo->power->setTimer( 60 );
|
||||
if ( pmu_get_experimental_power_save() ) {
|
||||
ttgo->power->setDCDC3Voltage( 2700 );
|
||||
log_e("enable 2.7V standby voltage");
|
||||
}
|
||||
else {
|
||||
ttgo->power->setDCDC3Voltage( 3000 );
|
||||
log_e("enable 3.0V standby voltage");
|
||||
}
|
||||
setCpuFrequencyMhz( 10 );
|
||||
gpio_wakeup_enable ((gpio_num_t)AXP202_INT, GPIO_INTR_LOW_LEVEL);
|
||||
gpio_wakeup_enable ((gpio_num_t)BMA423_INT1, GPIO_INTR_HIGH_LEVEL);
|
||||
|
||||
@@ -52,6 +52,7 @@ void wifictl_Task( void * pvParameters );
|
||||
void wifictl_setup( void ) {
|
||||
if ( wifi_init == true )
|
||||
return;
|
||||
|
||||
wifi_init = true;
|
||||
powermgm_clear_event( POWERMGM_WIFI_ACTIVE | POWERMGM_WIFI_OFF_REQUEST | POWERMGM_WIFI_ON_REQUEST | POWERMGM_WIFI_CONNECTED | POWERMGM_WIFI_SCAN );
|
||||
|
||||
@@ -122,14 +123,6 @@ void wifictl_setup( void ) {
|
||||
statusbar_hide_icon( STATUSBAR_WIFI );
|
||||
statusbar_wifi_set_state( false, "" );
|
||||
}, WiFiEvent_t::SYSTEM_EVENT_STA_STOP );
|
||||
|
||||
// start Wifo controll task
|
||||
xTaskCreate( wifictl_Task, /* Function to implement the task */
|
||||
"wifictl Task", /* Name of the task */
|
||||
2000, /* Stack size in words */
|
||||
NULL, /* Task input parameter */
|
||||
1, /* Priority of the task */
|
||||
&_wifictl_Task ); /* Task handle. */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -172,6 +165,9 @@ void wifictl_load_network( void ) {
|
||||
*
|
||||
*/
|
||||
bool wifictl_is_known( const char* networkname ) {
|
||||
if ( wifi_init == false )
|
||||
return( false );
|
||||
|
||||
for( int entry = 0 ; entry < NETWORKLIST_ENTRYS; entry++ ) {
|
||||
if( !strcmp( networkname, wifictl_networklist[ entry ].ssid ) ) {
|
||||
return( true );
|
||||
@@ -184,6 +180,9 @@ bool wifictl_is_known( const char* networkname ) {
|
||||
*
|
||||
*/
|
||||
bool wifictl_delete_network( const char *ssid ) {
|
||||
if ( wifi_init == false )
|
||||
return( false );
|
||||
|
||||
for( int entry = 0 ; entry < NETWORKLIST_ENTRYS; entry++ ) {
|
||||
if( !strcmp( ssid, wifictl_networklist[ entry ].ssid ) ) {
|
||||
wifictl_networklist[ entry ].ssid[ 0 ] = '\0';
|
||||
@@ -199,6 +198,9 @@ bool wifictl_delete_network( const char *ssid ) {
|
||||
*
|
||||
*/
|
||||
bool wifictl_insert_network( const char *ssid, const char *password ) {
|
||||
if ( wifi_init == false )
|
||||
return( false );
|
||||
|
||||
// check if existin
|
||||
for( int entry = 0 ; entry < NETWORKLIST_ENTRYS; entry++ ) {
|
||||
if( !strcmp( ssid, wifictl_networklist[ entry ].ssid ) ) {
|
||||
@@ -229,13 +231,19 @@ bool wifictl_insert_network( const char *ssid, const char *password ) {
|
||||
void wifictl_on( void ) {
|
||||
if ( wifi_init == false )
|
||||
return;
|
||||
if ( powermgm_get_event( POWERMGM_WIFI_OFF_REQUEST ) || powermgm_get_event( POWERMGM_WIFI_ON_REQUEST )) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
powermgm_set_event( POWERMGM_WIFI_ON_REQUEST );
|
||||
vTaskResume( _wifictl_Task );
|
||||
}
|
||||
|
||||
if ( powermgm_get_event( POWERMGM_WIFI_OFF_REQUEST ) || powermgm_get_event( POWERMGM_WIFI_ON_REQUEST )) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
powermgm_set_event( POWERMGM_WIFI_ON_REQUEST );
|
||||
xTaskCreate( wifictl_Task, /* Function to implement the task */
|
||||
"wifictl Task", /* Name of the task */
|
||||
2000, /* Stack size in words */
|
||||
NULL, /* Task input parameter */
|
||||
1, /* Priority of the task */
|
||||
&_wifictl_Task ); /* Task handle. */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -244,13 +252,19 @@ void wifictl_on( void ) {
|
||||
void wifictl_off( void ) {
|
||||
if ( wifi_init == false )
|
||||
return;
|
||||
if ( powermgm_get_event( POWERMGM_WIFI_OFF_REQUEST ) || powermgm_get_event( POWERMGM_WIFI_ON_REQUEST )) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
powermgm_set_event( POWERMGM_WIFI_OFF_REQUEST );
|
||||
vTaskResume( _wifictl_Task );
|
||||
}
|
||||
|
||||
if ( powermgm_get_event( POWERMGM_WIFI_OFF_REQUEST ) || powermgm_get_event( POWERMGM_WIFI_ON_REQUEST )) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
powermgm_set_event( POWERMGM_WIFI_OFF_REQUEST );
|
||||
xTaskCreate( wifictl_Task, /* Function to implement the task */
|
||||
"wifictl Task", /* Name of the task */
|
||||
2000, /* Stack size in words */
|
||||
NULL, /* Task input parameter */
|
||||
1, /* Priority of the task */
|
||||
&_wifictl_Task ); /* Task handle. */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -260,19 +274,16 @@ void wifictl_Task( void * pvParameters ) {
|
||||
if ( wifi_init == false )
|
||||
return;
|
||||
|
||||
while( true ) {
|
||||
vTaskDelay( 125 );
|
||||
if ( powermgm_get_event( POWERMGM_WIFI_ON_REQUEST ) ) {
|
||||
statusbar_wifi_set_state( true, "activate" );
|
||||
WiFi.mode( WIFI_STA );
|
||||
powermgm_clear_event( POWERMGM_WIFI_OFF_REQUEST | POWERMGM_WIFI_ACTIVE | POWERMGM_WIFI_CONNECTED | POWERMGM_WIFI_SCAN | POWERMGM_WIFI_ON_REQUEST );
|
||||
}
|
||||
else if ( powermgm_get_event( POWERMGM_WIFI_OFF_REQUEST ) ) {
|
||||
statusbar_wifi_set_state( false, "" );
|
||||
WiFi.mode( WIFI_OFF );
|
||||
esp_wifi_stop();
|
||||
powermgm_clear_event( POWERMGM_WIFI_OFF_REQUEST | POWERMGM_WIFI_ACTIVE | POWERMGM_WIFI_CONNECTED | POWERMGM_WIFI_SCAN | POWERMGM_WIFI_ON_REQUEST );
|
||||
}
|
||||
vTaskSuspend( _wifictl_Task );
|
||||
if ( powermgm_get_event( POWERMGM_WIFI_ON_REQUEST ) ) {
|
||||
statusbar_wifi_set_state( true, "activate" );
|
||||
WiFi.mode( WIFI_STA );
|
||||
powermgm_clear_event( POWERMGM_WIFI_OFF_REQUEST | POWERMGM_WIFI_ACTIVE | POWERMGM_WIFI_CONNECTED | POWERMGM_WIFI_SCAN | POWERMGM_WIFI_ON_REQUEST );
|
||||
}
|
||||
else if ( powermgm_get_event( POWERMGM_WIFI_OFF_REQUEST ) ) {
|
||||
statusbar_wifi_set_state( false, "" );
|
||||
WiFi.mode( WIFI_OFF );
|
||||
esp_wifi_stop();
|
||||
powermgm_clear_event( POWERMGM_WIFI_OFF_REQUEST | POWERMGM_WIFI_ACTIVE | POWERMGM_WIFI_CONNECTED | POWERMGM_WIFI_SCAN | POWERMGM_WIFI_ON_REQUEST );
|
||||
}
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
{"version":"2020073022","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
|
||||
{"version":"2020073109","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
|
||||
|
||||
Reference in New Issue
Block a user