add WT32-SC01 support

This commit is contained in:
sharandac
2022-07-21 09:59:46 +02:00
parent 67502fe8f8
commit 50384c4ad9
75 changed files with 70955 additions and 120 deletions
+1
View File
@@ -1,6 +1,7 @@
.pio
.vscode
deploy.sh
change.log
.gitignore
data/tile_map.ods
firmware_fork_list.json
+13 -2
View File
@@ -9,7 +9,7 @@
# My-TTGO-Watch
A GUI named hedge for smartwatch like devices based on ESP32. Currently support for T-Watch2020 (V1,V2,V3), T-Watch2021 (V1 and V2, no ota-updates), M5Paper, M5Core2 and native Linux support for testing.
A GUI named hedge for smartwatch like devices based on ESP32. Currently support for T-Watch2020 (V1,V2,V3), T-Watch2021 (V1 and V2, no ota-updates), M5Paper, M5Core2, WT32-SC01 and native Linux support for testing.
## Features
@@ -51,6 +51,11 @@ A GUI named hedge for smartwatch like devices based on ESP32. Currently support
Clone this repository and open it with platformIO. Select the right env and then build and upload.
Or follow the great step by step [tutorial](https://www.youtube.com/watch?v=wUGADCnerCs) from [ShotokuTech](https://github.com/ShotokuTech).
Please check out
https://github.com/sharandac/My-TTGO-Watch/blob/709ed0c5863435aa966c1d6f44552ddc0909a57c/src/hardware/wifictl.cpp#L256-L261
to setup your wifi when wps or input via display is not possible.
If you are interested in native Linux support, please install sdl2, curl and mosquitto dev lib and change the env to emulator_* in platformIO.
```bash
@@ -119,13 +124,19 @@ Cf. [contribution guide](CONTRIBUTING.md)
![screenshot](images/image2.png)
![screenshot](images/image3.png)
## M5Core2 ( experimental )
## M5Core2
![screenshot](images/m5core2_img1.png)
![screenshot](images/m5core2_img2.png)
![screenshot](images/m5core2_img3.png)
![screenshot](images/m5core2_img4.png)
## WT32-SC01
![screenshot](images/WT32-SC01_img1.png)
![screenshot](images/WT32-SC01_img2.png)
![screenshot](images/WT32-SC01_img3.png)
## TTGO T-Watch 2021
![screenshot](images/twatch2021_img1.png)
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

@@ -1,13 +1,17 @@
./bg3_540px.png
./bg_480px.png
./bg1_240px.png
./bg_540px.png
./bg2_240px.png
./rounddisplaymask_240px.png
./bg2_480px.png
./bg_240px.png
./bg1_480px.png
./bg1_540px.png
./bg_320px.png
./bg2_540px.png
./bg1_320px.png
./bg3_240px.png
./bg2_320px.png
./bg3_480px.png
./bg3_320px.png
@@ -1,13 +1,17 @@
./bg3_540px.c
./bg3_480px.c
./bg1_320px.c
./bg1_480px.c
./bg2_540px.c
./bg_540px.c
./bg1_540px.c
./rounddisplaymask_240px.c
./bg_320px.c
./bg2_480px.c
./bg3_320px.c
./bg1_240px.c
./bg_240px.c
./bg3_240px.c
./bg2_320px.c
./bg2_240px.c
./bg_480px.c
Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 22 KiB

+102 -5
View File
@@ -119,6 +119,41 @@ build_src_filter =
+<*>
+<../hal/sdl2>
[env:emulator_WT32-SC01]
platform = native@^1.1.3
extra_scripts = support/sdl2_build_extra.py
build_type = release
build_flags =
${env.build_flags}
; Add recursive dirs for hal headers search
;!python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
-lSDL2
-llibcurl
-llibmosquitto
-D LV_CONF_SKIP
-D LV_HOR_RES_MAX=480
-D LV_VER_RES_MAX=320
-D LV_MEM_CUSTOM=1
-D LV_USE_USER_DATA=1
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_DRV_NO_CONF
-D USE_MONITOR
-D MONITOR_ZOOM=2
-D USE_MOUSE
-D NATIVE_64BIT
-D WT32_SC01
-D LV_FONT_MONTSERRAT_32=1
-D LV_FONT_MONTSERRAT_22=1
lib_archive = false
lib_deps =
${env.lib_deps}
https://github.com/lvgl/lvgl.git#v7.11.0
lv_drivers@~7.11.0
ArduinoJson@>=6.15.2
build_src_filter =
+<*>
+<../hal/sdl2>
[env:emulator_twatch2020]
platform = native@^1.1.3
extra_scripts = support/sdl2_build_extra.py
@@ -263,7 +298,6 @@ monitor_speed = 115200
monitor_filters =
default
esp32_exception_decoder
; board_build.partitions = huge_app.csv
board_build.partitions = twatch2021_4MB.csv
board_build.embed_txtfiles =
src/gui/mainbar/setup_tile/time_settings/timezones.json
@@ -326,7 +360,6 @@ monitor_speed = 115200
monitor_filters =
default
esp32_exception_decoder
; board_build.partitions = huge_app.csv
board_build.partitions = twatch2021_4MB.csv
board_build.embed_txtfiles =
src/gui/mainbar/setup_tile/time_settings/timezones.json
@@ -335,8 +368,8 @@ build_type = release
build_flags =
-D BOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-DARDUNIO_NG
-DVERSION_2
-D ARDUNIO_NG
-D VERSION_2
-DUSER_SETUP_LOADED=1
-DGC9A01_DRIVER=1
-DTFT_WIDTH=240
@@ -351,7 +384,7 @@ build_flags =
-DSPI_FREQUENCY=80000000
-D LILYGO_WATCH_2021
-D LV_LVGL_H_INCLUDE_SIMPLE
-DCORE_DEBUG_LEVEL=3
-D CORE_DEBUG_LEVEL=3
-D SERIAL_RX_BUFFER_SIZE=256
-ffunction-sections
-fdata-sections
@@ -375,6 +408,70 @@ lib_deps =
https://github.com/mobizt/ESP-Mail-Client
h2zero/NimBLE-Arduino @ ^1.3.8
[env:WT32-SC01]
; overrides the default arduino-esp32 framework with an custom built arduino-esp32 framework
; the custom arduino-esp32 framework provides better power managment, dynamic frquency scaling and 80Mhz Flash/SPIRAM support
; built from https://github.com/Jason2866/esp32-arduino-lib-builder
platform_packages = framework-arduinoespressif32 @ https://github.com/sharandac/arduino-esp32-hedge-ng
platform = [email protected]
board = esp32dev
framework = arduino
lib_archive = true
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_speed = 115200
monitor_filters =
default
esp32_exception_decoder
board_build.partitions = twatch2021_4MB.csv
board_build.embed_txtfiles =
src/gui/mainbar/setup_tile/time_settings/timezones.json
src/utils/osm_map/osmtileserver.json
build_type = release
build_flags =
-D BOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-DARDUNIO_NG
-DUSER_SETUP_LOADED=1
-DST7796_DRIVER=1
-DTFT_WIDTH=480
-DTFT_HEIGHT=320
-DUSE_HSPI_PORT=1
-DPIN_SDA=18
-DPIN_SCL=19
-DTFT_MISO=12
-DTFT_MOSI=13
-DTFT_SCLK=14
-DTFT_CS=15
-DTFT_DC=21
-DTFT_RST=22
-DTFT_LED=23
-DSPI_FREQUENCY=80000000
-D WT32_SC01
-D LV_LVGL_H_INCLUDE_SIMPLE
-D CORE_DEBUG_LEVEL=3
-D SERIAL_RX_BUFFER_SIZE=256
-ffunction-sections
-fdata-sections
-Wl,--gc-sections
-Os
build_src_filter =
+<*>
lib_deps =
https://github.com/lvgl/lvgl.git#v7.11.0
ESP Async WebServer@>=1.2.0
AsyncTCP@>=1.1.1
ArduinoJson@>=6.15.2
luc-github/ESP32SSDP
PubSubClient@>=2.8
nailbuster/ESP8266FtpServer
https://github.com/tobozo/ESP32-targz/archive/refs/heads/1.0.5-beta.zip
https://github.com/mobizt/ESP-Mail-Client
Bodmer/TFT_eSPI
https://github.com/adafruit/Adafruit_FT6206_Library
mikalhart/TinyGPSPlus
h2zero/NimBLE-Arduino @ ^1.3.8
[env:t-watch2020-v1]
; overrides the default arduino-esp32 framework with an custom built arduino-esp32 framework
; the custom arduino-esp32 framework provides better power managment, dynamic frquency scaling and 80Mhz Flash/SPIRAM support
+4 -2
View File
@@ -7,8 +7,8 @@
#ifdef NATIVE_64BIT
#else
#if defined( M5PAPER ) || defined( M5CORE2 ) || defined( LILYGO_WATCH_2021 )
#if defined( M5PAPER )
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#define IR_BUTTONS_START 16
#define IR_BUTTONS_TRESHOLD 8
@@ -44,6 +44,8 @@
InfraButton** buttons = nullptr;
size_t buttonCount = 0;
};
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
/**
* NEW_HARDWARE_TAG or not defined
+1 -1
View File
@@ -33,7 +33,7 @@
return;
}
#else
#if defined( M5PAPER ) || defined( M5CORE2 ) || defined( LILYGO_WATCH_2021 )
#if defined( M5PAPER ) || defined( M5CORE2 ) || defined( LILYGO_WATCH_2021 ) || defined( WT32_SC01 )
void IRController_setup( void ) {
return;
}
+7 -1
View File
@@ -25,7 +25,9 @@
#ifdef NATIVE_64BIT
void IRController_setup( void );
#else
#if defined( M5PAPER ) || defined( M5CORE2 ) || defined( LILYGO_WATCH_2021 )
#if defined( M5PAPER )
void IRController_setup( void );
#elif defined( M5CORE2 )
void IRController_setup( void );
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
enum IRControlSettingsAction {
@@ -39,6 +41,10 @@
void IRController_setup( void );
void IRController_build_UI(IRControlSettingsAction settingsAction);
void execute_ir_cmd(InfraButton* config);
#elif defined( LILYGO_WATCH_2021 )
void IRController_setup( void );
#elif defined( WT32_SC01 )
void IRController_setup( void );
#else
/**
* NEW_HARDWARE_TAG or not defined
+6 -2
View File
@@ -65,8 +65,12 @@ void calendar_app_setup( void ) {
static void calendar_enter_event_cb( lv_obj_t * obj, lv_event_t event ) {
switch( event ) {
case( LV_EVENT_CLICKED ):
mainbar_jump_to_tilenumber( calendar_overview_get_tile(), LV_ANIM_OFF, true );
break;
/**
* switch to the current date
*/
calendar_overview_refresh_showed_ui();
mainbar_jump_to_tilenumber( calendar_overview_get_tile(), LV_ANIM_OFF, true );
break;
}
}
+10 -11
View File
@@ -82,12 +82,11 @@ static int calendar_day = 0;
static void calendar_overview_exit_event_cb( lv_obj_t * obj, lv_event_t event );
static void calendar_overview_date_event_cb( lv_obj_t * obj, lv_event_t event );
static int calendar_overview_highlight_day_callback( void *data, int argc, char **argv, char **azColName );
int calendar_overview_highlight_day( int year, int month );
void calendar_overview_build_ui( void );
void calendar_overview_refresh_showed_ui( void );
void calendar_overview_refresh_today_ui( void );
void calendar_overview_activate_cb( void );
void calendar_overview_hibernate_cb( void );
static int calendar_overview_highlight_day( int year, int month );
static void calendar_overview_build_ui( void );
static void calendar_overview_refresh_today_ui( void );
static void calendar_overview_activate_cb( void );
static void calendar_overview_hibernate_cb( void );
/**
* setup routine for application
*/
@@ -118,7 +117,7 @@ void calendar_overview_setup( void ) {
}
}
void calendar_overview_build_ui( void ) {
static void calendar_overview_build_ui( void ) {
/**
* get calendar object from tile number
*/
@@ -176,7 +175,7 @@ void calendar_overview_refresh_showed_ui( void ) {
lv_calendar_set_showed_date( calendar_overview, &today);
}
void calendar_overview_refresh_today_ui( void ) {
static void calendar_overview_refresh_today_ui( void ) {
/**
* Set today's date
*/
@@ -193,7 +192,7 @@ void calendar_overview_refresh_today_ui( void ) {
lv_calendar_set_today_date( calendar_overview, &today);
}
void calendar_overview_activate_cb( void ) {
static void calendar_overview_activate_cb( void ) {
/**
* open calendar date base
*/
@@ -209,7 +208,7 @@ void calendar_overview_activate_cb( void ) {
}
}
void calendar_overview_hibernate_cb( void ) {
static void calendar_overview_hibernate_cb( void ) {
/**
* close calendar date base
*/
@@ -282,7 +281,7 @@ static int calendar_overview_highlight_day_callback( void *data, int argc, char
return 0;
}
int calendar_overview_highlight_day( int year, int month ) {
static int calendar_overview_highlight_day( int year, int month ) {
int hitcounter = 0;
/**
* clear calendar_overview_highlight_table table
+4
View File
@@ -32,5 +32,9 @@
* @return calendar overview tile number
*/
uint32_t calendar_overview_get_tile( void );
/**
* @brief refresh calendar date ui
*/
void calendar_overview_refresh_showed_ui( void );
#endif // _CALENDAR_OVREVIEW_H
+16 -4
View File
@@ -117,16 +117,28 @@ void powermeter_main_task( lv_task_t * task );
lv_label_set_text( id_label, doc["id"] );
}
if ( doc["all"].containsKey("power") ) {
wf_label_printf( voltage_label, "%0.2fkW", atof( doc["all"]["power"] ) );
const char * unit = "kW";
if( doc.containsKey("PowerUnit") )
unit = doc["PowerUnit"];
wf_label_printf( power_label, "%0.2fkW", atof( doc["all"]["power"] ), unit );
}
if ( doc["channel0"].containsKey("power") ) {
wf_label_printf( voltage_label, "%0.2fkW", atof( doc["channel0"]["power"] ) );
const char * unit = "kW";
if( doc.containsKey("PowerUnit") )
unit = doc["PowerUnit"];
wf_label_printf( power_label, "%0.2f%s", atof( doc["channel0"]["power"] ), unit );
}
if ( doc["channel0"].containsKey("voltage") ) {
wf_label_printf( voltage_label, "%0.1fV", atof( doc["channel0"]["voltage"] ) );
const char * unit = "V";
if( doc.containsKey("VoltageUnit") )
unit = doc["VoltageUnit"];
wf_label_printf( voltage_label, "%0.1f%s", atof( doc["channel0"]["voltage"] ), unit );
}
if ( doc["channel0"].containsKey("current") ) {
wf_label_printf( voltage_label, "%0.1fA", atof( doc["channel0"]["current"] ) );
const char * unit = "A";
if( doc.containsKey("CurrentUnit") )
unit = doc["CurrentUnit"];
wf_label_printf( current_label, "%0.1f%s", atof( doc["channel0"]["current"] ), unit );
}
lv_obj_align( id_label, id_cont, LV_ALIGN_IN_RIGHT_MID, -THEME_PADDING, 0 );
+12
View File
@@ -38,6 +38,7 @@
#ifdef NATIVE_64BIT
#include "utils/logging.h"
#include "utils/millis.h"
#else
#include <Arduino.h>
#include "esp_task_wdt.h"
@@ -60,6 +61,7 @@ lv_obj_t *weather_forecast_temperature_label[ WEATHER_MAX_FORECAST ];
lv_obj_t *weather_forecast_wind_label[ WEATHER_MAX_FORECAST ];
static weather_forcast_t *weather_forecast = NULL;
static uint64_t weather_last_update = 0;
LV_IMG_DECLARE(refresh_32px);
LV_IMG_DECLARE(owm01d_64px);
@@ -138,6 +140,16 @@ static void weather_forecast_activate_cb( void ) {
wf_image_button_fade_in( exit_btn, 300, 0 );
wf_image_button_fade_in( setup_btn, 300, 100 );
wf_image_button_fade_in( reload_btn, 300, 200 );
if( weather_last_update != 0 ) {
if( weather_last_update <= millis() - ( 15 * 60 * 1000 ) ) {
weather_sync_request();
weather_last_update = millis();
}
}
else {
weather_sync_request();
weather_last_update = millis();
}
}
bool weather_button_event_cb( EventBits_t event, void *arg ) {
+9 -2
View File
@@ -72,8 +72,15 @@
#define HARDWARE_NAME "m5stack-core2"
#define RES_X_MAX 320
#define RES_Y_MAX 240
// #define ENABLE_WEBSERVER /** @brief To disable built-in webserver, comment this line */
#define ENABLE_FTPSERVER /** @brief To disable built-in ftpserver, comment this line */
#elif defined( WT32_SC01 )
#undef LILYGO_WATCH_LVGL
#define HARDWARE_NAME "wt32-sc01"
#define RES_X_MAX 480
#define RES_Y_MAX 320
#define USE_PSRAM_ALLOC_LVGL /** @brief enabled LVGL to use PSRAM */
#define ENABLE_FTPSERVER /** @brief To disable built-in ftpserver, comment this line */
#define NO_WATCHFACE
#else
#error "no destination hardware version defined"
#endif
@@ -85,7 +92,7 @@
/**
* firmeware version string
*/
#define __FIRMWARE__ "2022070501"
#define __FIRMWARE__ "2022072101"
/**
* Allows to include config.h from C code
*/
+11 -1
View File
@@ -91,6 +91,16 @@
const lv_img_dsc_t bg1 = bg1_540px;
const lv_img_dsc_t bg2 = bg2_540px;
const lv_img_dsc_t bg3 = bg3_540px;
#elif defined( WT32_SC01 )
LV_IMG_DECLARE( bg_480px );
LV_IMG_DECLARE( bg1_480px );
LV_IMG_DECLARE( bg2_480px );
LV_IMG_DECLARE( bg3_480px );
const lv_img_dsc_t bg = bg_480px;
const lv_img_dsc_t bg1 = bg1_480px;
const lv_img_dsc_t bg2 = bg2_480px;
const lv_img_dsc_t bg3 = bg3_480px;
#else
LV_IMG_DECLARE( bg_240px );
LV_IMG_DECLARE( bg1_240px );
@@ -167,7 +177,7 @@ void gui_setup( void ) {
style_settings_tile_setup();
notify_settings_tile_setup();
wlan_settings_tile_setup();
#if defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 ) || defined( M5CORE2 ) || defined( NATIVE_64BIT )
#if defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 ) || defined( M5CORE2 ) || defined( NATIVE_64BIT ) || defined( WT32_SC01 )
touch_settings_tile_setup();
#endif
time_settings_tile_setup();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -63,7 +63,8 @@ void app_tile_setup( void ) {
#elif defined( LILYGO_WATCH_2021 )
app_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles, 0, "app tile", ws_get_mainbar_style() );
#else
#error "no app tiles setup"
app_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles, 0, "app tile", ws_get_mainbar_style() );
#warning "not app tile setup"
#endif
app_cont[ tiles ] = mainbar_get_tile_obj( app_tile_num[ tiles ] );
mainbar_add_tile_button_cb( app_tile_num[ tiles ], app_tile_button_event_cb );
+8
View File
@@ -49,6 +49,14 @@
#define APP_ICON_X_OFFSET 0
#define APP_ICON_Y_OFFSET -16
#define MAX_APPS_TILES 7
#elif defined( WT32_SC01 )
#define MAX_APPS_ICON_HORZ 5
#define MAX_APPS_ICON_VERT 2
#define APP_ICON_X_CLEARENCE 16
#define APP_ICON_Y_CLEARENCE 36
#define APP_ICON_X_OFFSET 0
#define APP_ICON_Y_OFFSET 0
#define MAX_APPS_TILES 3
#else
#define MAX_APPS_ICON_HORZ 3
#define MAX_APPS_ICON_VERT 2
+3 -1
View File
@@ -68,7 +68,9 @@ void note_tile_setup( void ) {
note_tile_num = mainbar_add_tile( 0, 1, "note tile", ws_get_mainbar_style() );
note_cont = mainbar_get_tile_obj( note_tile_num );
#else
#error "no note tiles setup"
note_tile_num = mainbar_add_tile( 0, 1, "note tile", ws_get_mainbar_style() );
note_cont = mainbar_get_tile_obj( note_tile_num );
#warning "no note tiles setup"
#endif
style = ws_get_mainbar_style();
@@ -0,0 +1,106 @@
/****************************************************************************
* Tu May 22 21:23:51 2020
* Copyright 2020 Dirk Brosswick
* Email: [email protected]
****************************************************************************/
/*
* 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 "battery_calibration.h"
#include "battery_settings.h"
#include "battery_view.h"
#include "battery_history.h"
#include "gui/mainbar/mainbar.h"
#include "gui/mainbar/setup_tile/setup_tile.h"
#include "gui/statusbar.h"
#include "gui/widget_factory.h"
#include "gui/widget_styles.h"
#include "hardware/pmu.h"
#include "hardware/powermgm.h"
#ifdef NATIVE_64BIT
#include "utils/logging.h"
#include "utils/millis.h"
#else
#endif
lv_obj_t *battery_calibration_tile = NULL;
lv_obj_t *battery_calibration_page = NULL;
lv_obj_t *battery_calibration_info_label = NULL;
lv_obj_t *battery_calibration_store_switch = NULL;
lv_style_t battery_calibration__style;
uint32_t battery_calibration_tile_num;
static void battery_calibration_store_switch_event_cb( lv_obj_t *obj, lv_event_t event );
static bool battery_calibration_button_event_cb( EventBits_t event, void *arg );
static bool battery_calibration_pmu_event_cb( EventBits_t event, void *arg );
void battery_calibration_tile_setup( uint32_t tile_num ) {
battery_calibration_tile_num = tile_num + 3;
battery_calibration_page = lv_page_create( mainbar_get_tile_obj( battery_calibration_tile_num ), NULL);
lv_obj_set_size( battery_calibration_page, lv_disp_get_hor_res( NULL ) - 30 , lv_disp_get_ver_res( NULL ) - 50 );
lv_obj_add_style( battery_calibration_page, LV_OBJ_PART_MAIN, SETUP_STYLE );
lv_page_set_scrlbar_mode( battery_calibration_page, LV_SCRLBAR_MODE_DRAG );
lv_obj_align( battery_calibration_page, mainbar_get_tile_obj( battery_calibration_tile_num ), LV_ALIGN_CENTER, 0, THEME_PADDING );
battery_calibration_info_label = lv_label_create( battery_calibration_page, NULL );
lv_label_set_long_mode( battery_calibration_info_label, LV_LABEL_LONG_BREAK );
lv_obj_set_width( battery_calibration_info_label, lv_page_get_width_fit ( battery_calibration_page ) );
lv_obj_add_style( battery_calibration_info_label, LV_OBJ_PART_MAIN, SETUP_STYLE );
lv_label_set_text( battery_calibration_info_label, "Test message from bar.");
battery_calibration_store_switch = wf_add_switch( mainbar_get_tile_obj( battery_calibration_tile_num ), false ,battery_calibration_store_switch_event_cb );
lv_obj_align( battery_calibration_store_switch, mainbar_get_tile_obj( battery_calibration_tile_num ), LV_ALIGN_IN_BOTTOM_MID, 0, -10 );
lv_obj_set_hidden( battery_calibration_store_switch, true );
mainbar_add_slide_element( battery_calibration_page );
mainbar_add_slide_element( battery_calibration_info_label );
pmu_register_cb( PMUCTL_CALIBRATION_START | PMUCTL_CALIBRATION_UPDATE, battery_calibration_pmu_event_cb, "pmu battery calibration");
}
static void battery_calibration_store_switch_event_cb( lv_obj_t *obj, lv_event_t event ) {
switch( event ) {
case( LV_EVENT_VALUE_CHANGED ): pmu_battery_calibration_loop( true, lv_switch_get_state( obj ) );
powermgm_set_lightsleep( false );
powermgm_set_normal_mode();
log_i("start calibration");
break;
}
}
static bool battery_calibration_pmu_event_cb( EventBits_t event, void *arg ) {
calibration_data_t *calibration_data = (calibration_data_t*)arg;
switch( event ) {
case PMUCTL_CALIBRATION_START:
wf_label_printf( battery_calibration_info_label, "battery calibration started" );
break;
case PMUCTL_CALIBRATION_UPDATE:
wf_label_printf( battery_calibration_info_label, "battery = %.0fmV\nmin = %.0fmV\nmax = %.0fmV\nmaxCharge = %.0fmV\nchargingOffset = %.0fmV\nVBUS = %s\ncharging = %s\ncalibration run = %s\nstore = %s", calibration_data->batteryVoltage, calibration_data->minVoltage, calibration_data->maxVoltage, calibration_data->maxVoltageCharge, calibration_data->chargingVoltageOffset, calibration_data->VBUS ? "true":"false", calibration_data->charging ? "true":"false", calibration_data->run ? "true":"false", calibration_data->store ? "true":"false" );
if( calibration_data->VBUS && !calibration_data->charging )
lv_obj_set_hidden( battery_calibration_store_switch, false );
else
lv_obj_set_hidden( battery_calibration_store_switch, true );
break;
}
return( true );
}
@@ -0,0 +1,32 @@
/****************************************************************************
* Tu May 22 21:23:51 2020
* Copyright 2020 Dirk Brosswick
* Email: [email protected]
****************************************************************************/
/*
* 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_CALIBRATION_H
#define _BATTERY_CALIBRATION_H
/**
* @brief system battery hirtory tile setup
*
* @param tile_num
*/
void battery_calibration_tile_setup( uint32_t tile_num );
#endif // _BATTERY_CALIBRATION_H
@@ -50,6 +50,7 @@ lv_chart_series_t *battery_history_voltage_series = NULL;
lv_chart_series_t *battery_history_charge_series = NULL;
lv_chart_series_t *battery_history_discharge_series = NULL;
static bool battery_history_button_event_cb( EventBits_t event, void *arg );
static bool battery_history_powermgm_loop_cb( EventBits_t event, void *arg );
void battery_history_tile_setup( uint32_t tile_num ) {
@@ -111,10 +112,22 @@ void battery_history_tile_setup( uint32_t tile_num ) {
lv_chart_set_y_range( battery_history_current_chart, lv_chart_get_series_axis( battery_history_current_chart, battery_history_charge_series ), 0, 300 );
lv_chart_set_y_range( battery_history_current_chart, lv_chart_get_series_axis( battery_history_current_chart, battery_history_discharge_series ), 0, 300 );
mainbar_add_tile_button_cb( battery_history_tile_num, battery_history_button_event_cb );
mainbar_add_slide_element( battery_history_voltage_chart );
mainbar_add_slide_element( battery_history_current_chart );
}
static bool battery_history_button_event_cb( EventBits_t event, void *arg ) {
switch( event ) {
case BUTTON_EXIT:
mainbar_jump_back();
break;
}
return( true );
}
void battery_history_start_chart_logging( void ) {
static bool activate = false;
@@ -20,6 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "battery_calibration.h"
#include "battery_settings.h"
#include "battery_view.h"
#include "battery_history.h"
@@ -67,11 +68,12 @@ void battery_set_experimental_indicator( void );
void battery_settings_tile_setup( void ) {
// get an app tile and copy mainstyle
battery_settings_tile_num = mainbar_add_setup_tile( 3, 1, "battery setup" );
battery_settings_tile_num = mainbar_add_setup_tile( 4, 1, "battery setup" );
battery_settings_tile = mainbar_get_tile_obj( battery_settings_tile_num );
battery_view_tile_setup( battery_settings_tile_num );
battery_history_tile_setup( battery_settings_tile_num );
battery_calibration_tile_setup( battery_settings_tile_num );
battery_setup_icon = setup_register( "battery", &battery_icon_64px, enter_battery_setup_event_cb );
setup_hide_indicator( battery_setup_icon );
@@ -48,11 +48,12 @@ 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_task_t *battery_view_task = NULL;
void battery_view_update_task( lv_task_t *task );
void battery_activate_cb( void );
void battery_hibernate_cb( void );
static void battery_view_update_task( lv_task_t *task );
static bool battery_view_button_cb( EventBits_t event, void *arg );
static void battery_activate_cb( void );
static void battery_hibernate_cb( void );
void battery_view_tile_setup( uint32_t tile_num ) {
// get an app tile and copy mainstyle
@@ -137,21 +138,37 @@ void battery_view_tile_setup( uint32_t tile_num ) {
lv_label_set_text( vbus_view_voltage, "2.4mV");
lv_obj_align( vbus_view_voltage, vbus_voltage_cont, LV_ALIGN_IN_RIGHT_MID, -THEME_PADDING, 0 );
mainbar_add_tile_button_cb( battery_view_tile_num, battery_view_button_cb );
mainbar_add_tile_activate_cb( tile_num, battery_activate_cb );
mainbar_add_tile_activate_cb( tile_num + 1, battery_activate_cb );
mainbar_add_tile_hibernate_cb( tile_num, battery_hibernate_cb );
mainbar_add_tile_hibernate_cb( tile_num + 1, battery_hibernate_cb );
}
void battery_activate_cb( void ) {
battery_view_task = lv_task_create(battery_view_update_task, 1000, LV_TASK_PRIO_LOWEST, NULL );
static bool battery_view_button_cb( EventBits_t event, void *arg ) {
switch( event ) {
case BUTTON_EXIT:
mainbar_jump_back();
break;
}
return( true );
}
void battery_hibernate_cb( void ) {
lv_task_del( battery_view_task );
static void battery_activate_cb( void ) {
if( !battery_view_task )
battery_view_task = lv_task_create( battery_view_update_task, 1000, LV_TASK_PRIO_LOWEST, NULL );
}
void battery_view_update_task( lv_task_t *task ) {
static void battery_hibernate_cb( void ) {
if( battery_view_task ) {
lv_task_del( battery_view_task );
battery_view_task = NULL;
}
}
static void battery_view_update_task( lv_task_t *task ) {
char temp[16]="";
if ( pmu_get_battery_percent( ) >= 0 ) {
+9 -6
View File
@@ -63,15 +63,18 @@ void setup_tile_setup( void ) {
setup_entry = (icon_t*)MALLOC_ASSERT( sizeof( icon_t ) * MAX_SETUP_ICON, "error while setup_entry alloc" );
for ( int tiles = 0 ; tiles < MAX_SETUP_TILES ; tiles++ ) {
#if defined( M5PAPER )
#if defined( M5PAPER )
setup_tile_num[ tiles ] = mainbar_add_tile( 0, 2 + tiles, "setup tile", ws_get_mainbar_style() );
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 ) || defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 ) || defined( M5CORE2 )
setup_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles , 1, "setup tile", ws_get_mainbar_style() );
#elif defined( LILYGO_WATCH_2021 )
#elif defined( LILYGO_WATCH_2021 )
setup_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles , 1, "setup tile", ws_get_mainbar_style() );
#else
#error "no setup tiles set"
#endif
#elif defined( WT32_SC01 )
setup_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles , 1, "setup tile", ws_get_mainbar_style() );
#else
setup_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles , 1, "setup tile", ws_get_mainbar_style() );
#warning "no setup tiles set"
#endif
setup_cont[ tiles ] = mainbar_get_tile_obj( setup_tile_num[ tiles ] );
mainbar_add_tile_button_cb( setup_tile_num[ tiles ], setup_tile_button_event_cb );
}
+14 -6
View File
@@ -49,14 +49,22 @@
#define SETUP_ICON_X_OFFSET 0
#define SETUP_ICON_Y_OFFSET -16
#define MAX_SETUP_TILES 6
#else
#define MAX_SETUP_ICON_HORZ 4
#define MAX_SETUP_ICON_VERT 5
#define SETUP_ICON_X_CLEARENCE 48
#define SETUP_ICON_Y_CLEARENCE 72
#elif defined( WT32_SC01 )
#define MAX_SETUP_ICON_HORZ 5
#define MAX_SETUP_ICON_VERT 2
#define SETUP_ICON_X_CLEARENCE 16
#define SETUP_ICON_Y_CLEARENCE 36
#define SETUP_ICON_X_OFFSET 0
#define SETUP_ICON_Y_OFFSET 0
#define MAX_SETUP_TILES 1
#define MAX_SETUP_TILES 2
#else
#define MAX_SETUP_ICON_HORZ 3
#define MAX_SETUP_ICON_VERT 2
#define SETUP_ICON_X_CLEARENCE 8
#define SETUP_ICON_Y_CLEARENCE 36
#define SETUP_ICON_X_OFFSET 0
#define SETUP_ICON_Y_OFFSET 0
#define MAX_SETUP_TILES 4
#endif
#define MAX_SETUP_ICON ( MAX_SETUP_ICON_HORZ * MAX_SETUP_ICON_VERT * MAX_SETUP_TILES )
@@ -43,6 +43,8 @@
#endif
#elif defined( M5CORE2 )
#define FIRMWARE_UPDATE_URL "http://www.neo-guerillaz.de/m5stack-core2.version.json"
#elif defined( WT32_SC01 )
#define FIRMWARE_UPDATE_URL "http://www.neo-guerillaz.de/wt32-sc01.version.json"
#endif
#if !defined( FIRMWARE_UPDATE_URL )
@@ -252,7 +252,6 @@ static void update_event_handler(lv_obj_t * obj, lv_event_t event) {
log_i("System reboot by user");
motor_vibe(20);
delay(20);
display_standby();
SPIFFS.end();
log_i("SPIFFS unmounted!");
delay(500);
@@ -380,7 +379,6 @@ void update_Task( void * pvParameters ) {
log_i("System reboot by user");
motor_vibe(20);
delay(20);
display_standby();
SPIFFS.end();
log_i("SPIFFS unmounted!");
delay(500);
@@ -279,7 +279,6 @@ static void reboot_utilities_event_cb( lv_obj_t * obj, lv_event_t event ) {
log_i("System reboot by user");
motor_vibe(20);
delay(20);
display_standby();
SPIFFS.end();
log_i("SPIFFS unmounted!");
delay(500);
+1
View File
@@ -36,6 +36,7 @@
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#error "not splashscreen pre hardware setup"
#endif
+23
View File
@@ -312,6 +312,29 @@ lv_obj_t * wf_add_switch(lv_obj_t *parent, bool on){
return _switch;
}
lv_obj_t * wf_add_switch(lv_obj_t *parent, bool on, lv_event_cb_t event_cb ){
lv_obj_t *_switch = lv_switch_create( parent, NULL );
//TODO: must it be here?
lv_obj_add_protect( _switch, LV_PROTECT_CLICK_FOCUS);
if (on) {
lv_switch_on( _switch, LV_ANIM_OFF );
} else {
lv_switch_off( _switch, LV_ANIM_OFF );
}
lv_obj_add_style( _switch, LV_SWITCH_PART_INDIC, ws_get_switch_style() );
#if defined( BIG_THEME )
lv_obj_set_size( _switch, 70, 35 );
#elif defined( MID_THEME )
lv_obj_set_size( _switch, 50, 25 );
#endif
lv_obj_set_ext_click_area(_switch, CLICKABLE_PADDING, CLICKABLE_PADDING, CLICKABLE_PADDING, CLICKABLE_PADDING);
lv_obj_set_event_cb( _switch, event_cb );
return _switch;
}
lv_obj_t * wf_add_labeled_switch(lv_obj_t *parent, char const * text, lv_obj_t ** ret_switch_obj){
lv_obj_t *container = wf_add_container(parent, LV_LAYOUT_PRETTY_MID, LV_FIT_PARENT, LV_FIT_TIGHT );
wf_add_label( container, text);
+1
View File
@@ -153,6 +153,7 @@ lv_obj_t * wf_add_roller(lv_obj_t *parent, char const * data, lv_roller_mode_t m
* @return returns pointer to the added object
*/
lv_obj_t * wf_add_switch(lv_obj_t *parent, bool on = false);
lv_obj_t * wf_add_switch(lv_obj_t *parent, bool on, lv_event_cb_t event_cb );
/**
* @brief Creates and adds a container with a label and a switch to a container
+1
View File
@@ -32,6 +32,7 @@
#if defined( M5PAPER )
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for blebatctl"
#endif
+3 -2
View File
@@ -31,10 +31,11 @@
#include "utils/logging.h"
#else
#include <Arduino.h>
#ifdef M5PAPER
#if defined( M5PAPER )
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for blestepctl"
#endif
+3 -2
View File
@@ -24,9 +24,10 @@
#ifdef NATIVE_64BIT
#include "utils/logging.h"
#else
#ifdef M5PAPER
#if defined( M5PAPER )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#else // NEW_HARDWARE_TAG
#elif defined( WT32_SC01 )
#else
#endif
#endif
+1
View File
@@ -39,6 +39,7 @@
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for blegadgetbridge"
#endif
+2
View File
@@ -44,6 +44,7 @@
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for blectl"
#endif
@@ -505,6 +506,7 @@ void blectl_off( void ) {
#else
#ifdef M5PAPER
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
NimBLEServer *blectl_get_ble_server( void ) {
return pServer;
+6
View File
@@ -63,6 +63,7 @@ bool button_send_cb( EventBits_t event, void *arg );
}
#elif defined( LILYGO_WATCH_2021 )
#include <twatch2021_config.h>
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for button"
#endif
@@ -107,6 +108,8 @@ void button_setup( void ) {
pinMode( BTN_1, INPUT_PULLUP );
pinMode( BTN_2, INPUT );
pinMode( BTN_3, INPUT );
#elif defined( WT32_SC01 )
#endif
#endif
/*
@@ -395,6 +398,7 @@ bool button_powermgm_loop_cb( EventBits_t event, void *arg ) {
if ( refresh_button ) button_send_cb( BUTTON_REFRESH, (void*)NULL );
}
#elif defined( WT32_SC01 )
#endif
/**
* prevent "warning: variable 'temp_button_irq_flag' set but not used" in some platform conditions
@@ -475,6 +479,8 @@ bool button_powermgm_event_cb( EventBits_t event, void *arg ) {
retval = true;
break;
}
#elif defined( WT32_SC01 )
retval = true;
#endif
#endif
+9 -1
View File
@@ -38,8 +38,9 @@
#include <twatch2021_config.h>
#include <QMC5883LCompass.h>
QMC5883LCompass compass;
#elif defined( WT32_SC01 )
#else
#error "no hardware driver for display"
#warning "no hardware driver for compass"
#endif
#endif
@@ -66,6 +67,7 @@ void compass_setup( void ) {
#elif defined( LILYGO_WATCH_2021 )
compass.init();
compass_off();
#elif defined( WT32_SC01 )
#else
#endif
#endif
@@ -95,6 +97,7 @@ static bool compass_powermgm_event_cb( EventBits_t event, void *arg ) {
default:
break;
}
#elif defined( WT32_SC01 )
#else
#endif
#endif
@@ -118,6 +121,7 @@ static bool compass_powermgm_loop_event_cb( EventBits_t event, void *arg ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
compass.setCalibration( calibrationData[0][0], calibrationData[0][1], calibrationData[1][0], calibrationData[1][1], calibrationData[2][0], calibrationData[2][1] );
#elif defined( WT32_SC01 )
#endif
#endif
compass_calibrated = true;
@@ -167,6 +171,7 @@ static bool compass_get_data( compass_data_t *compass_data ) {
compass.getDirection( compass_data->direction, compass_data->azimuth );
compass_data->direction[3] = '\0';
log_d("x=%d, y=%d, z=%d, azimuth=%d, bearing=%d, direction=%s", compass_data->x, compass_data->y, compass_data->z, compass_data->azimuth, compass_data->bearing, compass_data->direction );
#elif defined( WT32_SC01 )
#else
#endif
#endif
@@ -240,6 +245,7 @@ void compass_on( void ) {
compass.setMode( 0x01, 0x0C, 0x10, 0x00 );
if( compass_calibrated )
compass.setCalibration( calibrationData[0][0], calibrationData[0][1], calibrationData[1][0], calibrationData[1][1], calibrationData[2][0], calibrationData[2][1] );
#elif defined( WT32_SC01 )
#else
#endif
#endif
@@ -257,6 +263,7 @@ void compass_off( void ) {
compass.init();
compass.setReset();
compass.setMode( 0x00, 0x0C, 0x10, 0x00 );
#elif defined( WT32_SC01 )
#else
#endif
#endif
@@ -298,6 +305,7 @@ bool compass_available( void ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
retval = true;
#elif defined( WT32_SC01 )
#else
#endif
#endif
+6 -2
View File
@@ -38,9 +38,11 @@ bool pmu_config_t::onSave(JsonDocument& doc) {
doc["designed_battery_cap"] = designed_battery_cap;
doc["pmu_logging"] = pmu_logging;
doc["powermgm_resume_interval"] = powermgm_resume_interval;
doc["battery_monitor_interval"] = battery_monitor_interval;
doc["battery_voltage_lowest"] = battery_voltage_lowest;
doc["battery_voltage_highest"] = battery_voltage_highest;
doc["battery_run_calibration"] = battery_run_calibration;
doc["battery_chargingoffset"] = battery_chargingoffset;
doc["battery_calibrated"] = battery_calibrated;
return true;
}
@@ -58,9 +60,11 @@ bool pmu_config_t::onLoad(JsonDocument& doc) {
experimental_normal_voltage = doc["experimental_normal_voltage"] | EXPERIMENTALNORMALVOLTAGE;
experimental_power_save_voltage = doc["experimental_power_save_voltage"] | EXPERIMENTALPOWERSAVEVOLTAGE;
powermgm_resume_interval = doc["powermgm_resume_interval"] | POWERMGMRESUMEINTERVAL;
battery_monitor_interval = doc["battery_monitor_interval"] | BATTERY_MONITOR_INTERVAL;
battery_voltage_lowest = doc["battery_voltage_lowest"] | BATTERY_LOWEST;
battery_voltage_highest = doc["battery_voltage_highest"] | BATTERY_HIGHEST;
battery_run_calibration = doc["battery_run_calibration"] | false;
battery_chargingoffset = doc["battery_chargingoffset"] | BATTERY_CHARGING_OFFSET;
battery_calibrated = doc["battery_calibrated"] | false;
pmu_logging = doc["pmu_logging"] | false;
return true;
+11 -1
View File
@@ -41,17 +41,25 @@
* is needed when the device has noch PMU
*/
#if defined( M5PAPER )
#define BATTERY_MONITOR_INTERVAL 60
#define BATTERY_LOWEST 3000
#define BATTERY_HIGHEST 4350
#define BATTERY_CHARGING_OFFSET 0
#elif defined( M5CORE2 )
#define BATTERY_MONITOR_INTERVAL 60
#define BATTERY_LOWEST 3000
#define BATTERY_HIGHEST 4190
#define BATTERY_CHARGING_OFFSET 0
#elif defined( LILYGO_WATCH_2021 )
#define BATTERY_MONITOR_INTERVAL 60
#define BATTERY_LOWEST 3000
#define BATTERY_HIGHEST 4350
#define BATTERY_CHARGING_OFFSET 400
#else
#define BATTERY_MONITOR_INTERVAL 60
#define BATTERY_LOWEST 3000
#define BATTERY_HIGHEST 4200
#define BATTERY_CHARGING_OFFSET 0
#endif
/**
* @brief pmu config structure
@@ -67,9 +75,11 @@
int32_t experimental_normal_voltage = EXPERIMENTALNORMALVOLTAGE;
int32_t experimental_power_save_voltage = EXPERIMENTALPOWERSAVEVOLTAGE;
int32_t powermgm_resume_interval = POWERMGMRESUMEINTERVAL;
int32_t battery_monitor_interval = BATTERY_MONITOR_INTERVAL;
float battery_voltage_lowest = BATTERY_LOWEST;
float battery_voltage_highest = BATTERY_HIGHEST;
bool battery_run_calibration = false;
float battery_chargingoffset = BATTERY_CHARGING_OFFSET;
bool battery_calibrated = false;
bool high_charging_target_voltage = false;
bool compute_percent = false;
bool experimental_power_save = false;
+7
View File
@@ -42,6 +42,13 @@
#elif defined( LILYGO_WATCH_2021 )
#define TOUCH_X_SCALE 1.0
#define TOUCH_Y_SCALE 1.0
#elif defined( WT32_SC01 )
#define TOUCH_X_SCALE 1.0
#define TOUCH_Y_SCALE 1.0
#else
#define TOUCH_X_SCALE 1.0
#define TOUCH_Y_SCALE 1.0
#warning "no special hardware configuration for touch"
#endif
#endif
/**
+77 -15
View File
@@ -37,8 +37,9 @@
#include <TTGO.h>
#elif defined( LILYGO_WATCH_2021 )
#include <twatch2021_config.h>
#elif defined( WT32_SC01 )
#else
#error "no hardware driver for display"
#error "no hardware driver for display, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
@@ -48,9 +49,11 @@ callback_t *display_callback = NULL;
static uint8_t dest_brightness = 0;
static uint8_t brightness = 0;
bool display_powermgm_event_cb( EventBits_t event, void *arg );
bool display_powermgm_loop_cb( EventBits_t event, void *arg );
bool display_send_event_cb( EventBits_t event, void *arg );
static bool display_powermgm_event_cb( EventBits_t event, void *arg );
static bool display_powermgm_loop_cb( EventBits_t event, void *arg );
static bool display_send_event_cb( EventBits_t event, void *arg );
static void display_standby( void );
static void display_wakeup( bool silence );
void display_setup( void ) {
/**
@@ -78,6 +81,13 @@ void display_setup( void ) {
ledcSetup(0, 4000, 8);
ledcAttachPin(TFT_LED, 0);
ledcWrite(0, 0XFF);
#elif defined( WT32_SC01 )
pinMode(TFT_LED, OUTPUT);
ledcSetup(0, 4000, 8);
ledcAttachPin(TFT_LED, 0);
ledcWrite(0, 0x0 );
#else
#error "no display init function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
/**
@@ -87,13 +97,12 @@ void display_setup( void ) {
/**
* register powermgm and pwermgm loop callback functions
*/
// powermgm_register_cb( POWERMGM_SILENCE_WAKEUP | POWERMGM_STANDBY | POWERMGM_WAKEUP, display_powermgm_event_cb, "powermgm display" );
powermgm_register_cb_with_prio( POWERMGM_STANDBY, display_powermgm_event_cb, "powermgm display", CALL_CB_FIRST );
powermgm_register_cb_with_prio( POWERMGM_SILENCE_WAKEUP | POWERMGM_WAKEUP, display_powermgm_event_cb, "powermgm display", CALL_CB_LAST );
powermgm_register_loop_cb( POWERMGM_WAKEUP, display_powermgm_loop_cb, "powermgm display loop" );
}
bool display_powermgm_event_cb( EventBits_t event, void *arg ) {
static bool display_powermgm_event_cb( EventBits_t event, void *arg ) {
switch( event ) {
case POWERMGM_STANDBY: display_standby();
break;
@@ -105,12 +114,9 @@ bool display_powermgm_event_cb( EventBits_t event, void *arg ) {
return( true );
}
bool display_powermgm_loop_cb( EventBits_t event, void *arg ) {
display_loop();
return( true );
}
static bool display_powermgm_loop_cb( EventBits_t event, void *arg ) {
bool retval = false;
void display_loop( void ) {
#ifdef NATIVE_64BIT
#else
#if defined( M5PAPER )
@@ -137,6 +143,8 @@ void display_loop( void ) {
dest_brightness = display_get_brightness();
}
}
retval = true;
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
/**
@@ -163,6 +171,8 @@ void display_loop( void ) {
dest_brightness = display_get_brightness();
}
}
retval = true;
#elif defined( LILYGO_WATCH_2021 )
/**
* check if backlight adjust has change
@@ -188,8 +198,41 @@ void display_loop( void ) {
dest_brightness = display_get_brightness();
}
}
retval = true;
#elif defined( WT32_SC01 )
/**
* check if backlight adjust has change
*/
if ( dest_brightness != brightness ) {
if ( brightness < dest_brightness ) {
brightness++;
ledcWrite(0, brightness );
}
else {
brightness--;
ledcWrite(0, brightness );
}
}
/**
* check timeout
*/
if ( display_get_timeout() != DISPLAY_MAX_TIMEOUT ) {
if ( lv_disp_get_inactive_time(NULL) > ( ( display_get_timeout() * 1000 ) - display_get_brightness() * 8 ) ) {
dest_brightness = ( ( display_get_timeout() * 1000 ) - lv_disp_get_inactive_time( NULL ) ) / 8 ;
}
else {
dest_brightness = display_get_brightness();
}
}
retval = true;
#else
#error "no display init function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
return( retval );
}
bool display_register_cb( EventBits_t event, CALLBACK_FUNC callback_func, const char *id ) {
@@ -203,11 +246,11 @@ bool display_register_cb( EventBits_t event, CALLBACK_FUNC callback_func, const
return( callback_register( display_callback, event, callback_func, id ) );
}
bool display_send_event_cb( EventBits_t event, void *arg ) {
static bool display_send_event_cb( EventBits_t event, void *arg ) {
return( callback_send( display_callback, event, arg ) );
}
void display_standby( void ) {
static void display_standby( void ) {
#ifdef NATIVE_64BIT
#else
#if defined( M5PAPER )
@@ -229,12 +272,16 @@ void display_standby( void ) {
#endif
#elif defined( LILYGO_WATCH_2021 )
ledcWrite( 0, 0 );
#elif defined( WT32_SC01 )
ledcWrite( 0, 0 );
#else
#error "no display statndby function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
log_d("go standby");
}
void display_wakeup( bool silence ) {
static void display_wakeup( bool silence ) {
/**
* wakeup with or without display
*/
@@ -265,6 +312,12 @@ void display_wakeup( bool silence ) {
ledcWrite( 0, 0 );
brightness = 0;
dest_brightness = 0;
#elif defined( WT32_SC01 )
ledcWrite( 0, 0 );
brightness = 0;
dest_brightness = 0;
#else
#error "no silence display wakeup function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
log_d("go silence wakeup");
@@ -295,7 +348,13 @@ void display_wakeup( bool silence ) {
#elif defined( LILYGO_WATCH_2021 )
ledcWrite( 0, 0 );
brightness = 0;
dest_brightness = display_get_brightness();;
dest_brightness = display_get_brightness();
#elif defined( WT32_SC01 )
ledcWrite( 0, 0 );
brightness = 0;
dest_brightness = display_get_brightness();
#else
#error "no display wakeup function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
log_d("go wakeup");
@@ -373,6 +432,9 @@ void display_set_rotation( uint32_t rotation ) {
TTGOClass *ttgo = TTGOClass::getWatch();
display_config.rotation = rotation;
ttgo->tft->setRotation( rotation / 90 );
#elif defined( WT32_SC01 )
#else
#warning "no display set rotation function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
display_config.rotation = rotation;
-14
View File
@@ -36,12 +36,6 @@
* @param ttgo pointer to an TTGOClass
*/
void display_setup( void );
/**
* @brief display loop
*
* @param ttgo pointer to an TTGOClass
*/
void display_loop( void );
/**
* @brief save config for display to spiffs
*/
@@ -146,14 +140,6 @@
* @return true is vibe feedback is enabled, false otherwise
*/
bool display_get_vibe( void );
/**
* @brief set display into standby
*/
void display_standby( void );
/**
* @brief set display into normal mode or leave it in standby if a silence wakeup occur
*/
void display_wakeup( bool silence );
/**
* @brief registers a callback function which is called on a corresponding event
*
+54 -6
View File
@@ -55,9 +55,13 @@
#include "TFT_eSPI.h"
#include <twatch2021_config.h>
TFT_eSPI tft = TFT_eSPI();
#elif defined( WT32_SC01 )
#include "TFT_eSPI.h"
TFT_eSPI tft = TFT_eSPI();
#else
#error "no hardware driver for framebuffer, please setup minimal drivers ( framebuffer/touch )"
#error "no hardware driver for framebuffer, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
@@ -116,14 +120,24 @@ void framebuffer_setup( void ) {
#elif defined( LILYGO_WATCH_2021 )
framebuffer_use_dma = true;
pinMode(TFT_LED, OUTPUT);
ledcSetup(0, 4000, 8);
ledcAttachPin(TFT_LED, 0);
ledcWrite(0, 0);
pinMode( TFT_LED, OUTPUT );
ledcSetup( 0, 4000, 8 );
ledcAttachPin( TFT_LED, 0 );
ledcWrite( 0, 0 );
tft.init();
tft.fillScreen(TFT_BLACK);
tft.fillScreen( TFT_BLACK );
tft.initDMA();
#elif defined( WT32_SC01 )
framebuffer_use_dma = true;
tft.init();
tft.setSwapBytes( true );
tft.fillScreen( TFT_BLACK );
tft.initDMA();
tft.setRotation( 1 );
ledcWrite(0, 0xff );
#else
#error "no framebuffer init function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
/*
@@ -231,7 +245,12 @@ bool framebuffer_powermgm_loop_cb( EventBits_t event, void *arg ) {
max_y = 0;
}
}
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#error "no framebuffer powermgm loop event function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
return( true );
@@ -252,7 +271,12 @@ void framebuffer_refresh( void ) {
max_x = 0;
min_y = FRAMEBUFFER_BUFFER_H;
max_y = 0;
#elif defined( M5CORE2 )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#error "no framebuffer refresh function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
}
@@ -376,6 +400,30 @@ static void framebuffer_flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area,
tft.flush();
tft.endWrite();
}
#elif defined( WT32_SC01 )
/**
* get buffer size
*/
uint32_t size = (area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1) ;
/**
* stop/wait last transmission
* start data trnsmission
* set the working window
* and start DMA transfer if enabled
*/
if ( framebuffer_use_dma ) {
tft.endWrite();
tft.startWrite();
tft.pushImageDMA( area->x1, area->y1, (area->x2 - area->x1 + 1), (area->y2 - area->y1 + 1), ( uint16_t *)color_p );
}
else {
tft.startWrite();
tft.pushImage( area->x1, area->y1, (area->x2 - area->x1 + 1), (area->y2 - area->y1 + 1), ( uint16_t *)color_p );
tft.flush();
tft.endWrite();
}
#else
#error "no LVGL display driver function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
lv_disp_flush_ready( disp_drv );
+3
View File
@@ -42,6 +42,9 @@
#elif defined( LILYGO_WATCH_2021 )
#define FRAMEBUFFER_BUFFER_W RES_X_MAX
#define FRAMEBUFFER_BUFFER_H 10
#elif defined( WT32_SC01 )
#define FRAMEBUFFER_BUFFER_W RES_X_MAX
#define FRAMEBUFFER_BUFFER_H 40
#endif
#endif
+23
View File
@@ -66,6 +66,8 @@
#elif defined( LILYGO_WATCH_2021 )
#include <twatch2021_config.h>
#include <Wire.h>
#elif defined( WT32_SC01 )
#include <Wire.h>
#else
#error "no hardware init"
#endif
@@ -79,6 +81,7 @@ void hardware_attach_lvgl_ticker( void ) {
#else
#if defined( M5PAPER )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
tickTicker->attach_ms( 5, []() {
lv_tick_inc(5);
@@ -92,6 +95,7 @@ void hardware_attach_lvgl_ticker_slow( void ) {
#else
#if defined( M5PAPER )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
tickTicker->attach_ms(250, []() {
lv_tick_inc(250);
@@ -105,6 +109,7 @@ void hardware_detach_lvgl_ticker( void ) {
#else
#if defined( M5PAPER )
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
tickTicker->detach();
#endif
@@ -191,6 +196,24 @@ void hardware_setup( void ) {
log_i("I2C device at: 0x%02x", address );
}
#elif defined( WT32_SC01 )
/**
* lvgl init
*/
lv_init();
/**
* setup wire interface
*/
// Wire.begin( IICSDA, IICSCL, 1000000 );
Wire.begin( PIN_SDA, PIN_SCL );
/**
* scan i2c devices
*/
for( uint8_t address = 1; address < 127; address++ ) {
Wire.beginTransmission(address);
if ( Wire.endTransmission() == 0 )
log_i("I2C device at: 0x%02x", address );
}
#endif
/**
* init lvgl ticker
+24
View File
@@ -67,6 +67,7 @@
Wire.write(data, len);
return (0 != Wire.endTransmission());
}
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for bma/axis sensor"
@@ -140,6 +141,10 @@ void bma_setup( void ) {
log_w("stepcounter not valid. reset");
}
stepcounter = stepcounter + stepcounter_before_reset;
#elif defined( WT32_SC01 )
stepcounter = 0;
stepcounter_before_reset = 0;
stepcounter_valid = 0xa5a5a5a5;
#endif
#endif
/*
@@ -211,6 +216,8 @@ void bma_setup( void ) {
bma.enableStepCountInterrupt();
bma.enableTiltInterrupt();
bma.enableWakeupInterrupt();
#elif defined( WT32_SC01 )
#endif
#endif
/*
@@ -249,6 +256,8 @@ bool bma_powermgm_event_cb( EventBits_t event, void *arg ) {
case POWERMGM_DISABLE_INTERRUPTS:
detachInterrupt( BMA_INT_1 );
break;
#elif defined( WT32_SC01 )
#endif
#endif
}
@@ -318,6 +327,7 @@ bool bma_powermgm_loop_cb( EventBits_t event , void *arg ) {
if ( bma.isStepCounter() ) {
BMA_stepcounter = true;
}
#elif defined( WT32_SC01 )
#endif
#endif
@@ -370,6 +380,8 @@ void bma_notify_stepcounter( void ) {
stepcounter_before_reset = ttgo->bma->getCounter();
#elif defined( LILYGO_WATCH_2021 )
stepcounter_before_reset = bma.getCounter();
#elif defined( WT32_SC01 )
#endif
#endif
val = stepcounter + stepcounter_before_reset;
@@ -391,6 +403,8 @@ void bma_standby( void ) {
ttgo->bma->enableStepCountInterrupt( false );
#elif defined( LILYGO_WATCH_2021 )
bma.enableStepCountInterrupt( false );
#elif defined( WT32_SC01 )
#endif
#endif
}
@@ -406,6 +420,8 @@ void bma_standby( void ) {
#elif defined( LILYGO_WATCH_2021 )
gpio_wakeup_enable ( (gpio_num_t)BMA_INT_1, GPIO_INTR_POSEDGE );
esp_sleep_enable_gpio_wakeup ();
#elif defined( WT32_SC01 )
#endif
#endif
}
@@ -425,6 +441,8 @@ void bma_wakeup( void ) {
ttgo->bma->enableStepCountInterrupt( true );
#elif defined( LILYGO_WATCH_2021 )
bma.enableStepCountInterrupt( true );
#elif defined( WT32_SC01 )
#endif
#endif
}
@@ -461,6 +479,7 @@ void bma_wakeup( void ) {
ttgo->bma->resetStepCounter();
#elif defined( LILYGO_WATCH_2021 )
bma.resetStepCounter();
#elif defined( WT32_SC01 )
#endif
#endif
stepcounter_before_reset = 0;
@@ -491,6 +510,7 @@ void bma_reload_settings( void ) {
bma.enableStepCountInterrupt( bma_config.enable[ BMA_STEPCOUNTER ] );
bma.enableWakeupInterrupt( bma_config.enable[ BMA_DOUBLECLICK ] );
bma.enableTiltInterrupt( bma_config.enable[ BMA_TILT ] );
#elif defined( WT32_SC01 )
#endif
#endif
}
@@ -613,6 +633,8 @@ void bma_set_rotate_tilt( uint32_t rotation ) {
bma.setRemapAxes(&remap_data);
break;
}
#elif defined( WT32_SC01 )
#endif
#endif
}
@@ -631,6 +653,8 @@ void bma_reset_stepcounter( void ) {
ttgo->bma->resetStepCounter();
#elif defined( LILYGO_WATCH_2021 )
bma.resetStepCounter();
#elif defined( WT32_SC01 )
#endif
#endif
/**
+5
View File
@@ -101,6 +101,8 @@
*/
portEXIT_CRITICAL_ISR(&timerMux);
}
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for motor/vibe"
#endif
@@ -156,6 +158,8 @@ void motor_setup( void ) {
timerAttachInterrupt(timer, &onTimer, true);
timerAlarmWrite(timer, 10000, true);
timerAlarmEnable(timer);
#elif defined( WT32_SC01 )
#endif
#endif
/*
@@ -197,6 +201,7 @@ bool motor_powermgm_event_cb( EventBits_t event, void *arg ) {
timerDetachInterrupt(timer);
break;
}
#elif defined( WT32_SC01 )
#endif
#endif
return( true );
+124 -6
View File
@@ -24,6 +24,8 @@
#include "powermgm.h"
#include "blectl.h"
#include "callback.h"
#include "utils/alloc.h"
#include "utils/filepath_convert.h"
#ifdef NATIVE_64BIT
#include "utils/logging.h"
@@ -35,6 +37,7 @@
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#else
#include <Arduino.h>
#if defined( M5PAPER )
#include <M5EPD.h>
static uint64_t next_wakeup = 0;
@@ -45,6 +48,8 @@
#include "TTGO.h"
#elif defined( LILYGO_WATCH_2021 )
#include <twatch2021_config.h>
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for pmu"
#endif
@@ -163,6 +168,8 @@ void pmu_setup( void ) {
pinMode( CHARGE, INPUT_PULLUP );
pinMode( BAT_ADC, INPUT );
attachInterrupt( CHARGE, &pmu_irq, CHANGE );
#elif defined( WT32_SC01 )
#endif
#endif
/*
@@ -216,7 +223,7 @@ bool pmu_powermgm_event_cb( EventBits_t event, void *arg ) {
case POWERMGM_DISABLE_INTERRUPTS:
detachInterrupt( AXP202_INT );
retval = true;
break;
break;
#endif
#endif
}
@@ -291,7 +298,6 @@ void pmu_loop( void ) {
if ( temp_pmu_irq_flag ) {
log_e("hello Mc Fly, witch AXP irq on M5Core2?");
}
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
@@ -430,6 +436,10 @@ void pmu_loop( void ) {
battery = percent > 0 ? true : false;
log_e("hello Mc Fly, witch PMU irq on T-Watch2021?");
}
#elif defined( WT32_SC01 )
static bool plug = false;
static bool charging = false;
static bool battery = percent > 0 ? true : false;
#endif
#endif
/*
@@ -458,6 +468,7 @@ void pmu_loop( void ) {
pmu_update = true;
percent = tmp_percent;
}
pmu_battery_calibration_loop( false, false );
}
/*
* check if update flag is set
@@ -805,10 +816,12 @@ int32_t pmu_get_battery_percent( void ) {
#elif defined( LILYGO_WATCH_2021 )
float mV = pmu_get_battery_voltage();
if( pmu_is_charging() )
mV = mV - 400.0;
mV = mV - pmu_config.battery_chargingoffset;
int32_t tmp_percent = pmu_get_voltage2percent( mV );
if( tmp_percent )
percent = tmp_percent;
#elif defined( WT32_SC01 )
percent = 100;
#endif
#endif
return( percent );
@@ -820,7 +833,7 @@ static int32_t pmu_get_voltage2percent( float mV ) {
* mV to percent main conversation table
* 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
*/
const float QcmMain[] = { 3000, 3450, 3680, 3740, 3770, 3790, 3820, 3920, 3980, 4060, 4120 };
const float QcmMain[] = { 3000, 3490, 3680, 3745, 3780, 3810, 3845, 3890, 3950, 4050, 4220 };
size_t size = ( sizeof( QcmMain ) / sizeof( float ) ) - 1;
float Qcm[ size ];
/**
@@ -829,7 +842,7 @@ static int32_t pmu_get_voltage2percent( float mV ) {
if( pmu_config.battery_voltage_highest < pmu_config.battery_voltage_lowest ) {
pmu_config.battery_voltage_highest = QcmMain[ size ];
pmu_config.battery_voltage_lowest = QcmMain[ 0 ];
log_e("lowest and highest battery voltage not valid, reset");
log_w("lowest and highest battery voltage not valid, reset");
}
float scale = ( pmu_config.battery_voltage_highest - pmu_config.battery_voltage_lowest ) / ( QcmMain[ size ] - QcmMain[ 0 ] );
/**
@@ -883,11 +896,98 @@ float pmu_get_battery_voltage( void ) {
* calc voltage
*/
voltage = ( ( battery * 3300 * 2 ) / 4096 ) + 200;
#elif defined( WT32_SC01 )
voltage = 3700.0;
#endif
#endif
return( voltage );
}
calibration_data_t *pmu_battery_calibration_loop( bool start_calibration, bool store ) {
calibration_data_t *retval = NULL;
static calibration_data_t calibration_data;
if( start_calibration ) {
/**
* set min/max start values in mV
*/
calibration_data.maxVoltage = pmu_config.battery_voltage_highest;
calibration_data.minVoltage = pmu_config.battery_voltage_lowest;
calibration_data.maxVoltageCharge = 0.0;
/**
* set calibration time
*/
calibration_data.nextmillis = millis() + 60 * 1000;
calibration_data.run = false;
calibration_data.store = store;
retval = &calibration_data;
}
else if( calibration_data.nextmillis != 0 ) {
/**
* check if next data is coming AND we are not in standby
*/
if( calibration_data.nextmillis < millis() && powermgm_get_event( POWERMGM_WAKEUP | POWERMGM_SILENCE_WAKEUP ) ) {
/**
* set next watchpoint
*/
calibration_data.nextmillis = millis() + 60 * 1000;
/**
* collect pmu data
*/
calibration_data.batteryVoltage = pmu_get_battery_voltage();
calibration_data.charging = pmu_is_charging();
calibration_data.VBUS = pmu_is_charging() || pmu_is_vbus_plug();
/**
* only measure if not charging and no VBUS connected
*/
if( !calibration_data.charging && !calibration_data.VBUS ) {
if( !calibration_data.run ) {
calibration_data.run = true;
calibration_data.maxVoltage = 0;
calibration_data.minVoltage = 10000;
pmu_send_cb( PMUCTL_CALIBRATION_START, (void*)&calibration_data );
}
if( calibration_data.batteryVoltage < calibration_data.minVoltage ) {
calibration_data.minVoltage = calibration_data.batteryVoltage;
}
if( calibration_data.batteryVoltage > calibration_data.maxVoltage ) {
calibration_data.maxVoltage = calibration_data.batteryVoltage;
}
calibration_data.chargingVoltageOffset = calibration_data.maxVoltageCharge - calibration_data.maxVoltage;
/**
* store new min/max while calibration if enabled
*/
if( calibration_data.store ) {
pmu_config.battery_voltage_lowest = calibration_data.minVoltage;
pmu_config.battery_voltage_highest = calibration_data.maxVoltage;
pmu_config.battery_chargingoffset = calibration_data.chargingVoltageOffset;
pmu_config.save();
}
}
else {
if( calibration_data.batteryVoltage > calibration_data.maxVoltageCharge )
calibration_data.maxVoltageCharge = calibration_data.batteryVoltage;
}
pmu_send_cb( PMUCTL_CALIBRATION_UPDATE, (void*)&calibration_data );
retval = &calibration_data;
}
}
else {
calibration_data.maxVoltage = pmu_config.battery_voltage_highest;
calibration_data.minVoltage = pmu_config.battery_voltage_lowest;
calibration_data.maxVoltageCharge = pmu_config.battery_voltage_highest + pmu_config.battery_chargingoffset;
calibration_data.chargingVoltageOffset = pmu_config.battery_chargingoffset;
calibration_data.batteryVoltage = pmu_get_battery_voltage();
calibration_data.charging = pmu_is_charging();
calibration_data.VBUS = pmu_is_charging() || pmu_is_vbus_plug();
pmu_send_cb( PMUCTL_CALIBRATION_UPDATE, (void*)&calibration_data );
retval = &calibration_data;
}
return( retval );
}
float pmu_get_battery_charge_current( void ) {
float current = 0.0f;
@@ -900,6 +1000,8 @@ float pmu_get_battery_charge_current( void ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
current = ttgo->power->getBattChargeCurrent();
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#endif
#endif
@@ -920,6 +1022,8 @@ float pmu_get_battery_discharge_current( void ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
current = ttgo->power->getBattDischargeCurrent();
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#endif
#endif
@@ -941,6 +1045,9 @@ float pmu_get_vbus_voltage( void ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
voltage = ttgo->power->getVbusVoltage();
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
voltage = 5.0f;
#endif
#endif
@@ -959,6 +1066,8 @@ float pmu_get_coulumb_data( void ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
coulumb_data = ttgo->power->getCoulombData();
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#endif
#endif
@@ -979,6 +1088,8 @@ bool pmu_is_charging( void ) {
charging = ttgo->power->isChargeing();
#elif defined( LILYGO_WATCH_2021 )
charging = digitalRead( CHARGE ) ? false : true;
#elif defined( WT32_SC01 )
charging = true;
#endif
#endif
@@ -993,10 +1104,17 @@ bool pmu_is_vbus_plug( void ) {
#else
#if defined( M5PAPER )
#elif defined( M5CORE2 )
plug = M5.Axp.isVBUS();
plug = M5.Axp.isACIN();
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
plug = ttgo->power->isVBUSPlug();
#elif defined( LILYGO_WATCH_2021 )
if( pmu_get_battery_voltage() > 4300 )
plug = true;
else
plug = false;
#elif defined( WT32_SC01 )
plug = true;
#endif
#endif
+25
View File
@@ -34,6 +34,8 @@
#define PMUCTL_TIMER_TIMEOUT _BV(3) /** @brief event mask for pmuctl timer timeout, no callback arg */
#define PMUCTL_UP_PRESS _BV(4) /** @brief event mask for pmuctl up press, no callback arg */
#define PMUCTL_DOWN _BV(5) /** @brief event mask for pmuctl down press, no callback arg */
#define PMUCTL_CALIBRATION_START _BV(6) /** @brief event mask for pmuctl calibration start event */
#define PMUCTL_CALIBRATION_UPDATE _BV(7) /** @brief event mask for pmuctl calibration new data event */
/**
* PMU status mask
*/
@@ -46,6 +48,21 @@
*/
#define PMU_CHARGE_LOG_FILENAME "/pmu_charge.csv" /** @brief defines csv logfile while charging when pmu logging is enabled */
#define PMU_DISCHARGE_LOG_FILENAME "/pmu_discharge.csv"/** @brief defines csv logfile while discharging when pmu logging is enabled */
/**
*
*/
typedef struct {
bool run = false;
bool store = false;
bool charging = false;
bool VBUS = false;
int64_t nextmillis = 0;
float batteryVoltage;
float minVoltage;
float maxVoltage;
float maxVoltageCharge;
float chargingVoltageOffset;
} calibration_data_t;
/**
* @brief setup pmu: axp202
*/
@@ -201,5 +218,13 @@
* @brief set normal voltage (3.3V) for update/flashing
*/
void pmu_set_safe_voltage_for_update( void );
/**
* @brief start battery voltage range calibration
*
* @param start_calibration true to start, only works when store is false
* @param store true to store values, only works when start_calibration is false
* @return pointer to the current calibration data or NULL
*/
calibration_data_t *pmu_battery_calibration_loop( bool start_calibration, bool store );
#endif // _PMU_H
+1 -1
View File
@@ -63,7 +63,7 @@ void powermgm_setup( void ) {
powermgm_status = xEventGroupCreate();
powermgm_tickTicker = new Ticker();
#if defined( LILYGO_WATCH_2021 )
#if defined( LILYGO_WATCH_2021 ) || defined( WT32_SC01 )
powermgm_tickTicker->attach_ms( 100, []() {
powermgm_resume_from_ISR();
});
+21
View File
@@ -49,6 +49,8 @@
#include <Wire.h>
PCF8563_Class rtc;
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for rtcctl"
#endif
@@ -113,6 +115,7 @@ void rtcctl_setup( void ) {
// pinMode( RTC_Int, INPUT);
// attachInterrupt( RTC_Int, &rtcctl_irq, GPIO_INTR_POSEDGE );
#endif
#elif defined( WT32_SC01 )
#endif
#endif
@@ -179,6 +182,8 @@ void set_next_alarm( void ) {
ttgo->rtc->setAlarm( PCF8563_NO_ALARM, PCF8563_NO_ALARM, PCF8563_NO_ALARM, PCF8563_NO_ALARM );
#elif defined( LILYGO_WATCH_2021 )
rtc.setAlarm( PCF8563_NO_ALARM, PCF8563_NO_ALARM, PCF8563_NO_ALARM, PCF8563_NO_ALARM );
#elif defined( WT32_SC01 )
#else
#warning "no alarm rtcctl function"
#endif
@@ -228,6 +233,8 @@ void set_next_alarm( void ) {
ttgo->rtc->setAlarm( alarm_tm.tm_hour, alarm_tm.tm_min, alarm_tm.tm_mday, PCF8563_NO_ALARM );
#elif defined( LILYGO_WATCH_2021 )
rtc.setAlarm( alarm_tm.tm_hour, alarm_tm.tm_min, alarm_tm.tm_mday, PCF8563_NO_ALARM );
#elif defined( WT32_SC01 )
#else
#warning "no alarm rtcctl function"
#endif
@@ -250,6 +257,8 @@ void rtcctl_set_next_alarm( void ) {
ttgo->rtc->disableAlarm();
#elif defined( LILYGO_WATCH_2021 )
rtc.disableAlarm();
#elif defined( WT32_SC01 )
#else
#warning "no alarm rtcctl function"
#endif
@@ -271,6 +280,8 @@ void rtcctl_set_next_alarm( void ) {
ttgo->rtc->enableAlarm();
#elif defined( LILYGO_WATCH_2021 )
rtc.enableAlarm();
#elif defined( WT32_SC01 )
#else
#warning "no alarm rtcctl function"
#endif
@@ -292,6 +303,7 @@ bool rtcctl_powermgm_event_cb( EventBits_t event, void *arg ) {
#elif defined( LILYGO_WATCH_2021 ) && defined( VERSION_2 )
// gpio_wakeup_enable( (gpio_num_t)RTC_Int, GPIO_INTR_POSEDGE );
// esp_sleep_enable_gpio_wakeup ();
#elif defined( WT32_SC01 )
#else
#warning "no rtcctl powermgm standby event"
#endif
@@ -310,6 +322,7 @@ bool rtcctl_powermgm_event_cb( EventBits_t event, void *arg ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
attachInterrupt( RTC_INT_PIN, &rtcctl_irq, FALLING );
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#warning "no rtcctl powermgm enable interrupts event"
#endif
@@ -324,6 +337,7 @@ bool rtcctl_powermgm_event_cb( EventBits_t event, void *arg ) {
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
detachInterrupt( RTC_INT_PIN );
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#warning "no rtcctl powermgm disable interrupts event"
#endif
@@ -398,6 +412,7 @@ void rtcctl_set_alarm( rtcctl_alarm_t *data ) {
ttgo->rtc->disableAlarm();
#elif defined( LILYGO_WATCH_2021 )
rtc.disableAlarm();
#elif defined( WT32_SC01 )
#else
#warning "no rtcctl alarm function"
#endif
@@ -430,6 +445,8 @@ void rtcctl_set_alarm( rtcctl_alarm_t *data ) {
ttgo->rtc->enableAlarm();
#elif defined( LILYGO_WATCH_2021 )
rtc.enableAlarm();
#elif defined( WT32_SC01 )
#else
#warning "no rtcctl alarm function"
#endif
@@ -448,6 +465,8 @@ void rtcctl_set_alarm( rtcctl_alarm_t *data ) {
ttgo->rtc->enableAlarm();
#elif defined( LILYGO_WATCH_2021 )
rtc.enableAlarm();
#elif defined( WT32_SC01 )
#else
#warning "no rtcctl alarm function"
#endif
@@ -521,6 +540,7 @@ void rtcctl_syncToSystem( void ) {
ttgo->rtc->syncToSystem();
#elif defined( LILYGO_WATCH_2021 )
rtc.syncToSystem();
#elif defined( WT32_SC01 )
#endif
#endif
}
@@ -580,6 +600,7 @@ void rtcctl_syncToRtc( void ) {
ttgo->rtc->syncToRtc();
#elif defined( LILYGO_WATCH_2021 )
rtc.syncToRtc();
#elif defined( WT32_SC01 )
#endif
#endif
}
+9 -4
View File
@@ -30,8 +30,8 @@
#include "esp_bt.h"
#include "esp_task_wdt.h"
#include "sdcard.h"
#if defined( M5PAPER )
#if defined( M5PAPER )
#elif defined( M5CORE2 )
#include <M5Core2.h>
@@ -42,7 +42,8 @@
#if defined( LILYGO_WATCH_HAS_SDCARD )
SPIClass *sdhander = nullptr;
#endif
#elif defined( LILYGO_WATCH_2021 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for sd_card"
#endif
@@ -60,7 +61,6 @@ void sdcard_setup( void ) {
#else
#if defined( M5PAPER )
#elif defined( M5CORE2 )
/**
* as small hack to reduce internal heap memory
@@ -99,6 +99,8 @@ void sdcard_setup( void ) {
sdcard_mounted = true;
#endif
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#endif
#endif
powermgm_register_cb( POWERMGM_SILENCE_WAKEUP | POWERMGM_STANDBY | POWERMGM_WAKEUP, sdcard_powermgm_event_cb, "sdcard powermgm" );
@@ -111,7 +113,6 @@ bool sdcard_powermgm_event_cb( EventBits_t event, void *arg ) {
return( true );
#if defined( M5PAPER )
#elif defined( M5CORE2 )
retval = true;
/*
@@ -193,6 +194,10 @@ bool sdcard_powermgm_event_cb( EventBits_t event, void *arg ) {
break;
}
#endif
#elif defined( LILYGO_WATCH_2021 )
retval = true;
#elif defined( WT32_SC01 )
retval = true;
#else
switch( event ) {
case POWERMGM_SILENCE_WAKEUP:
+11
View File
@@ -32,6 +32,7 @@
#include <M5EPD.h>
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for sensor"
#endif
@@ -52,6 +53,7 @@ void sensor_setup( void ) {
*/
M5.SHT30.Begin();
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
#endif
/**
@@ -97,6 +99,8 @@ bool sensor_powermgm_loop_cb( EventBits_t event, void *arg ) {
retval = true;
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
retval = true;
#elif defined( WT32_SC01 )
retval = true;
#else
#warning "not sensor powermgm loop"
retval = true;
@@ -134,6 +138,8 @@ bool sensor_powermgm_event_cb( EventBits_t event, void *arg ) {
}
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
retval = true;
#elif defined( WT32_SC01 )
retval = true;
#else
#warning "not sensor powermgm"
retval = true;
@@ -151,6 +157,7 @@ bool sensor_get_available( void ) {
#ifdef M5PAPER
retval = true;
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
#endif
@@ -173,6 +180,7 @@ float sensor_get_temperature( void ) {
#ifdef M5PAPER
temperature = M5.SHT30.GetTemperature();
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
#endif
@@ -195,6 +203,7 @@ float sensor_get_humidity( void ) {
#ifdef M5PAPER
humidity = M5.SHT30.GetAbsHumidity();
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
#endif
@@ -217,6 +226,7 @@ float sensor_get_relativ_humidity( void ) {
#ifdef M5PAPER
relativ_humidity = M5.SHT30.GetRelHumidity();
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
#endif
@@ -238,6 +248,7 @@ float sensor_get_pressure( void ) {
#else
#ifdef M5PAPER
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
#elif defined( WT32_SC01 )
#endif
#endif
+1
View File
@@ -57,6 +57,7 @@
AudioFileSourcePROGMEM *progmem_file;
#elif defined( LILYGO_WATCH_2020_V2 )
#elif defined( LILYGO_WATCH_2021 )
#elif defined( WT32_SC01 )
#else
#warning "no hardware driver for sound"
#endif
+53 -5
View File
@@ -50,8 +50,12 @@ touch_config_t touch_config;
#include <CST8165/CST816S.h>
CST816S_Class TouchSensor;
#elif defined( WT32_SC01 )
#include <Adafruit_FT6206.h>
Adafruit_FT6206 ctp = Adafruit_FT6206();
#else
#error "no hardware driver for touch, please setup minimal drivers ( framebuffer/touch )"
#error "no hardware driver for touch, please setup minimal drivers ( display/framebuffer/touch )"
#endif
volatile bool DRAM_ATTR touch_irq_flag = false;
portMUX_TYPE DRAM_ATTR Touch_IRQ_Mux = portMUX_INITIALIZER_UNLOCKED;
@@ -142,6 +146,11 @@ void touch_setup( void ) {
attachInterrupt( TOUCH_INT, &touch_irq, FALLING );
#elif defined( LILYGO_WATCH_2021 )
ASSERT( TouchSensor.begin( Wire, Touch_Res, Touch_Int, CTP_SLAVER_ADDR ), "touch controler failed" );
#elif defined( WT32_SC01 )
pinMode( GPIO_NUM_39, INPUT );
ASSERT( ctp.begin(40), "Couldn't start FT6206 touchscreen controller");
#else
#error "no touch init implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
xSemaphores = xSemaphoreCreateMutex();
#endif
@@ -198,7 +207,9 @@ bool touch_powermgm_loop_event_cb( EventBits_t event, void *arg ) {
touch_irq_flag = false;
portEXIT_CRITICAL(&Touch_IRQ_Mux);
#if defined ( M5CORE2 )
#if defined( M5PAPER )
retval = true;
#elif defined ( M5CORE2 )
switch( event ) {
case POWERMGM_STANDBY:
if( M5.Touch.ispressed() )
@@ -214,8 +225,28 @@ bool touch_powermgm_loop_event_cb( EventBits_t event, void *arg ) {
retval = true;
break;
}
#else
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
retval = true;
#elif defined( LILYGO_WATCH_2021 )
retval = true;
#elif defined( WT32_SC01 )
switch( event ) {
case POWERMGM_STANDBY:
if( ctp.touched() )
powermgm_set_event( POWERMGM_WAKEUP_REQUEST );
retval = true;
break;
case POWERMGM_WAKEUP:
retval = true;
break;
case POWERMGM_SILENCE_WAKEUP:
if ( ctp.touched() )
powermgm_set_event( POWERMGM_WAKEUP_REQUEST );
retval = true;
break;
}
#else
#error "no touch powermgm loop event implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
return( retval );
@@ -259,7 +290,7 @@ bool touch_powermgm_event_cb( EventBits_t event, void *arg ) {
retval = true;
break;
}
#elif defined( M5CORE2 )
#elif defined( M5CORE2 ) || defined( WT32_SC01 )
switch( event ) {
case POWERMGM_STANDBY: log_d("go standby");
/**
@@ -315,6 +346,8 @@ bool touch_powermgm_event_cb( EventBits_t event, void *arg ) {
retval = true;
break;
}
#else
#error "no touch powermgm event implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
return( retval );
@@ -377,7 +410,6 @@ bool touch_getXY( int16_t &x, int16_t &y ) {
touched = false;
return( false );
}
#elif defined( LILYGO_WATCH_2020_V1 ) || defined( LILYGO_WATCH_2020_V2 ) || defined( LILYGO_WATCH_2020_V3 )
TTGOClass *ttgo = TTGOClass::getWatch();
static bool touch_press = false;
@@ -419,6 +451,18 @@ bool touch_getXY( int16_t &x, int16_t &y ) {
else {
return( false );
}
#elif defined( WT32_SC01 )
if ( ctp.touched() ) {
TS_Point p = ctp.getPoint();
x = TFT_WIDTH - map( p.y, 0, TFT_WIDTH, TFT_WIDTH, 0 );
y = map( p.x, 0, TFT_HEIGHT, TFT_HEIGHT, 0 );
return( true );
}
else {
return( false );
}
#else
#error "no touch getXY function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
return( true );
@@ -523,6 +567,10 @@ static bool touch_read(lv_indev_drv_t * drv, lv_indev_data_t*data) {
}
#elif defined( LILYGO_WATCH_2021 )
data->state = touch_getXY( data->point.x, data->point.y ) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
#elif defined( WT32_SC01 )
data->state = touch_getXY( data->point.x, data->point.y ) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
#else
#error "no LVGL Input driver function implemented, please setup minimal drivers ( display/framebuffer/touch )"
#endif
#endif
if( data->state == LV_INDEV_STATE_PR ) {
+4 -3
View File
@@ -254,10 +254,11 @@ void wifictl_setup( void ) {
*/
wifictl_set_event( WIFICTL_OFF );
/**
* change here your network for first use if WPS noch work
* change here your network for first use if WPS not work
* or setup via display not possible
*/
if( !wifictl_is_known( "karlshorst_BGN" ) )
wifictl_insert_network( "karlshorst_BGN", "RK.5-xQ23fram" );
if( !wifictl_is_known( "foo" ) )
wifictl_insert_network( "foo", "bar" );
}
bool wifictl_powermgm_event_cb( EventBits_t event, void *arg ) {