some code and optical cleanup
This commit is contained in:
@@ -131,6 +131,7 @@ void weather_setup_tile_setup( uint32_t tile_num ) {
|
||||
lv_obj_add_style( weather_autosync_cont, LV_OBJ_PART_MAIN, &weather_setup_style );
|
||||
lv_obj_align( weather_autosync_cont, weather_lat_cont, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5 );
|
||||
weather_autosync_onoff = lv_switch_create( weather_autosync_cont, NULL );
|
||||
lv_obj_add_style( weather_autosync_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( weather_autosync_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( weather_autosync_onoff, weather_autosync_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( weather_autosync_onoff, weather_autosync_onoff_event_handler );
|
||||
@@ -144,6 +145,7 @@ void weather_setup_tile_setup( uint32_t tile_num ) {
|
||||
lv_obj_add_style( weather_wind_cont, LV_OBJ_PART_MAIN, &weather_setup_style );
|
||||
lv_obj_align( weather_wind_cont, weather_autosync_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
weather_wind_onoff = lv_switch_create( weather_wind_cont, NULL);
|
||||
lv_obj_add_style( weather_wind_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( weather_wind_onoff, LV_ANIM_ON);
|
||||
lv_obj_align( weather_wind_onoff, weather_wind_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0);
|
||||
lv_obj_set_event_cb( weather_wind_onoff, weather_wind_onoff_event_handler);
|
||||
|
||||
@@ -31,6 +31,6 @@
|
||||
/*
|
||||
* firmeware version string
|
||||
*/
|
||||
#define __FIRMWARE__ "2020073007"
|
||||
#define __FIRMWARE__ "2020073016"
|
||||
|
||||
#endif // _CONFIG_H
|
||||
|
||||
@@ -28,6 +28,7 @@ lv_app_entry_t app_entry[ MAX_APPS_ICON ];
|
||||
|
||||
static lv_obj_t *app_cont = NULL;
|
||||
static lv_obj_t *app_label = NULL;
|
||||
static uint32_t app_tile_num;
|
||||
static lv_style_t *style;
|
||||
static lv_style_t appstyle;
|
||||
|
||||
@@ -35,8 +36,8 @@ LV_FONT_DECLARE(Ubuntu_72px);
|
||||
LV_FONT_DECLARE(Ubuntu_16px);
|
||||
|
||||
void app_tile_setup( void ) {
|
||||
|
||||
app_cont = mainbar_get_tile_obj( mainbar_add_tile( 1, 0 ) );
|
||||
app_tile_num = mainbar_add_tile( 1, 0 );
|
||||
app_cont = mainbar_get_tile_obj( app_tile_num );
|
||||
style = mainbar_get_style();
|
||||
|
||||
lv_style_copy( &appstyle, style);
|
||||
@@ -85,3 +86,7 @@ lv_obj_t *app_tile_register_app( const char* appname ) {
|
||||
log_e("no space for an app icon");
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
uint32_t app_tile_get_tile_num( void ) {
|
||||
return( app_tile_num );
|
||||
}
|
||||
|
||||
@@ -46,7 +46,23 @@
|
||||
bool active;
|
||||
} lv_app_entry_t;
|
||||
|
||||
/*
|
||||
* @brief setup the app tile
|
||||
*/
|
||||
void app_tile_setup( void );
|
||||
/*
|
||||
* @brief register an app icon an the app tile
|
||||
*
|
||||
* @param appname app name
|
||||
*
|
||||
* @return lv_obj_t icon container, here you can set your own icon with imgbtn
|
||||
*/
|
||||
lv_obj_t *app_tile_register_app( const char* appname );
|
||||
/*
|
||||
* @brief get the tile number for the app tile
|
||||
*
|
||||
* @return tile number
|
||||
*/
|
||||
uint32_t app_tile_get_tile_num( void );
|
||||
|
||||
#endif // _APP_TILE_H
|
||||
@@ -30,6 +30,7 @@ static lv_obj_t *main_cont = NULL;
|
||||
static lv_obj_t *clock_cont = NULL;
|
||||
static lv_obj_t *timelabel = NULL;
|
||||
static lv_obj_t *datelabel = NULL;
|
||||
uint32_t main_tile_num;
|
||||
|
||||
static lv_style_t *style;
|
||||
static lv_style_t timestyle;
|
||||
@@ -37,14 +38,15 @@ static lv_style_t datestyle;
|
||||
|
||||
lv_widget_entry_t widget_entry[ MAX_WIDGET_NUM ];
|
||||
|
||||
lv_task_t * task;
|
||||
|
||||
LV_FONT_DECLARE(Ubuntu_72px);
|
||||
LV_FONT_DECLARE(Ubuntu_16px);
|
||||
|
||||
void main_tile_setup( void ) {
|
||||
lv_task_t * task;
|
||||
void main_tile_task( lv_task_t * task );
|
||||
|
||||
main_cont = mainbar_get_tile_obj( mainbar_add_tile( 0, 0 ) );
|
||||
void main_tile_setup( void ) {
|
||||
main_tile_num = mainbar_add_tile( 0, 0 );
|
||||
main_cont = mainbar_get_tile_obj( main_tile_num );
|
||||
style = mainbar_get_style();
|
||||
|
||||
lv_style_copy( ×tyle, style);
|
||||
@@ -110,9 +112,11 @@ lv_obj_t *main_tile_register_widget( void ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
uint32_t main_tile_get_tile_num( void ) {
|
||||
return( main_tile_num );
|
||||
}
|
||||
|
||||
|
||||
void main_tile_task( lv_task_t * task ) {
|
||||
time_t now;
|
||||
struct tm info;
|
||||
|
||||
@@ -33,8 +33,21 @@
|
||||
bool active;
|
||||
} lv_widget_entry_t;
|
||||
|
||||
/*
|
||||
* @brief setup the app tile
|
||||
*/
|
||||
void main_tile_setup( void );
|
||||
void main_tile_task( lv_task_t * task );
|
||||
/*
|
||||
* @brief register an widget icon an the main tile
|
||||
*
|
||||
* @return lv_obj_t icon container, here you can set your own icon with imgbtn or NULL if failed
|
||||
*/
|
||||
lv_obj_t *main_tile_register_widget( void );
|
||||
/*
|
||||
* @brief get the tile number for the main tile
|
||||
*
|
||||
* @return tile number
|
||||
*/
|
||||
uint32_t main_tile_get_tile_num( void );
|
||||
|
||||
#endif // _MAIL_TILE_H
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "setup_tile/time_settings/time_settings.h"
|
||||
#include "setup_tile/update/update.h"
|
||||
|
||||
static lv_style_t mainbarstyle;
|
||||
static lv_style_t mainbar_style;
|
||||
static lv_style_t mainbar_switch_style;
|
||||
|
||||
static lv_obj_t *mainbar = NULL;
|
||||
|
||||
static lv_tile_t *tile = NULL;
|
||||
@@ -45,18 +47,21 @@ static uint32_t tile_entrys = 0;
|
||||
static uint32_t app_tile_pos = MAINBAR_APP_TILE_X_START;
|
||||
|
||||
void mainbar_setup( void ) {
|
||||
lv_style_init( &mainbarstyle );
|
||||
lv_style_set_radius(&mainbarstyle, LV_OBJ_PART_MAIN, 0);
|
||||
lv_style_set_bg_color(&mainbarstyle, LV_OBJ_PART_MAIN, LV_COLOR_GRAY);
|
||||
lv_style_set_bg_opa(&mainbarstyle, LV_OBJ_PART_MAIN, LV_OPA_0);
|
||||
lv_style_set_border_width(&mainbarstyle, LV_OBJ_PART_MAIN, 0);
|
||||
lv_style_set_text_color(&mainbarstyle, LV_OBJ_PART_MAIN, LV_COLOR_WHITE);
|
||||
lv_style_set_image_recolor(&mainbarstyle, LV_OBJ_PART_MAIN, LV_COLOR_WHITE);
|
||||
lv_style_init( &mainbar_style );
|
||||
lv_style_set_radius(&mainbar_style, LV_OBJ_PART_MAIN, 0);
|
||||
lv_style_set_bg_color(&mainbar_style, LV_OBJ_PART_MAIN, LV_COLOR_GRAY);
|
||||
lv_style_set_bg_opa(&mainbar_style, LV_OBJ_PART_MAIN, LV_OPA_0);
|
||||
lv_style_set_border_width(&mainbar_style, LV_OBJ_PART_MAIN, 0);
|
||||
lv_style_set_text_color(&mainbar_style, LV_OBJ_PART_MAIN, LV_COLOR_WHITE);
|
||||
lv_style_set_image_recolor(&mainbar_style, LV_OBJ_PART_MAIN, LV_COLOR_WHITE);
|
||||
|
||||
lv_style_init( &mainbar_switch_style );
|
||||
lv_style_set_bg_color( &mainbar_switch_style, LV_STATE_CHECKED, 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);
|
||||
lv_obj_add_style( mainbar, LV_OBJ_PART_MAIN, &mainbarstyle );
|
||||
lv_obj_add_style( mainbar, LV_OBJ_PART_MAIN, &mainbar_style );
|
||||
lv_page_set_scrlbar_mode(mainbar, LV_SCRLBAR_MODE_OFF);
|
||||
}
|
||||
|
||||
@@ -85,7 +90,7 @@ uint32_t mainbar_add_tile( uint16_t x, uint16_t y ) {
|
||||
tile[ tile_entrys - 1 ].tile = my_tile;
|
||||
lv_obj_set_size( tile[ tile_entrys - 1 ].tile, LV_HOR_RES, LV_VER_RES);
|
||||
lv_obj_reset_style_list( tile[ tile_entrys - 1 ].tile, LV_OBJ_PART_MAIN );
|
||||
lv_obj_add_style( tile[ tile_entrys - 1 ].tile, LV_OBJ_PART_MAIN, &mainbarstyle );
|
||||
lv_obj_add_style( tile[ tile_entrys - 1 ].tile, LV_OBJ_PART_MAIN, &mainbar_style );
|
||||
lv_obj_set_pos( tile[ tile_entrys - 1 ].tile, tile_pos_table[ tile_entrys - 1 ].x * LV_HOR_RES , tile_pos_table[ tile_entrys - 1 ].y * LV_VER_RES );
|
||||
lv_tileview_add_element( mainbar, tile[ tile_entrys - 1 ].tile );
|
||||
lv_tileview_set_valid_positions( mainbar, tile_pos_table, tile_entrys );
|
||||
@@ -95,9 +100,14 @@ uint32_t mainbar_add_tile( uint16_t x, uint16_t y ) {
|
||||
}
|
||||
|
||||
lv_style_t *mainbar_get_style( void ) {
|
||||
return( &mainbarstyle );
|
||||
return( &mainbar_style );
|
||||
}
|
||||
|
||||
lv_style_t *mainbar_get_switch_style( void ) {
|
||||
return( &mainbar_switch_style );
|
||||
}
|
||||
|
||||
|
||||
uint32_t mainbar_add_app_tile( uint16_t x, uint16_t y ) {
|
||||
uint32_t retval = -1;
|
||||
|
||||
|
||||
@@ -83,5 +83,11 @@
|
||||
* @return lv_style_t
|
||||
*/
|
||||
lv_style_t *mainbar_get_style( void );
|
||||
/*
|
||||
* @brief get main tile switch style
|
||||
*
|
||||
* @return lv_style_t
|
||||
*/
|
||||
lv_style_t *mainbar_get_switch_style( void );
|
||||
|
||||
#endif // _MAINBAR_H
|
||||
@@ -24,14 +24,6 @@
|
||||
|
||||
#include <TTGO.h>
|
||||
|
||||
/*
|
||||
* @brief setup the battery setup tile
|
||||
*
|
||||
* @param tile pointer to the tile obj
|
||||
* @param style pointer to the style obj
|
||||
* @param hres horizonal resolution
|
||||
* @param vres vertical resolution
|
||||
*/
|
||||
void battery_settings_tile_setup( void );
|
||||
|
||||
#endif // _BATTERY_SETTINGS_H
|
||||
@@ -24,14 +24,6 @@
|
||||
|
||||
#include <TTGO.h>
|
||||
|
||||
/*
|
||||
* @brief setup the display setup tile
|
||||
*
|
||||
* @param tile pointer to the tile obj
|
||||
* @param style pointer to the style obj
|
||||
* @param hres horizonal resolution
|
||||
* @param vres vertical resolution
|
||||
*/
|
||||
void display_settings_tile_setup( void );
|
||||
|
||||
#endif // _DISPLAY_SETTINGS_H
|
||||
@@ -82,6 +82,7 @@ void move_settings_tile_setup( void ) {
|
||||
lv_obj_add_style( stepcounter_cont, LV_OBJ_PART_MAIN, &move_settings_style );
|
||||
lv_obj_align( stepcounter_cont, move_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 );
|
||||
stepcounter_onoff = lv_switch_create( stepcounter_cont, NULL );
|
||||
lv_obj_add_style( stepcounter_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( stepcounter_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( stepcounter_onoff, stepcounter_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( stepcounter_onoff, stepcounter_onoff_event_handler );
|
||||
@@ -95,6 +96,7 @@ void move_settings_tile_setup( void ) {
|
||||
lv_obj_add_style( doubleclick_cont, LV_OBJ_PART_MAIN, &move_settings_style );
|
||||
lv_obj_align( doubleclick_cont, stepcounter_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
doubleclick_onoff = lv_switch_create( doubleclick_cont, NULL );
|
||||
lv_obj_add_style( doubleclick_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( doubleclick_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( doubleclick_onoff, doubleclick_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( doubleclick_onoff, doubleclick_onoff_event_handler );
|
||||
|
||||
@@ -48,14 +48,19 @@
|
||||
|
||||
/*
|
||||
* @brief setup the setup tile
|
||||
*
|
||||
* @param tile pointer to the tile obj
|
||||
* @param style pointer to the style obj
|
||||
* @param hres horizonal resolution
|
||||
* @param vres vertical resolution
|
||||
*/
|
||||
void setup_tile_setup( void );
|
||||
/*
|
||||
* @brief register an setup icon an the setup tile
|
||||
*
|
||||
* @return lv_obj_t icon container, here you can set your own icon with imgbtn
|
||||
*/
|
||||
lv_obj_t *setup_tile_register_setup( void );
|
||||
/*
|
||||
* @brief get the tile number for the setup tile
|
||||
*
|
||||
* @return tile number
|
||||
*/
|
||||
uint32_t setup_get_tile_num( void );
|
||||
|
||||
#endif // _SETUP_H
|
||||
@@ -86,6 +86,7 @@ void time_settings_tile_setup( void ) {
|
||||
lv_obj_add_style( wifisync_cont, LV_OBJ_PART_MAIN, &time_settings_style );
|
||||
lv_obj_align( wifisync_cont, time_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 );
|
||||
wifisync_onoff = lv_switch_create( wifisync_cont, NULL );
|
||||
lv_obj_add_style( wifisync_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( wifisync_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( wifisync_onoff, wifisync_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( wifisync_onoff, wifisync_onoff_event_handler );
|
||||
@@ -99,6 +100,7 @@ void time_settings_tile_setup( void ) {
|
||||
lv_obj_add_style( daylight_cont, LV_OBJ_PART_MAIN, &time_settings_style );
|
||||
lv_obj_align( daylight_cont, wifisync_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
daylight_onoff = lv_switch_create( daylight_cont, NULL );
|
||||
lv_obj_add_style( daylight_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( daylight_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( daylight_onoff, daylight_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( daylight_onoff, daylight_onoff_event_handler );
|
||||
|
||||
@@ -24,14 +24,6 @@
|
||||
|
||||
#include <TTGO.h>
|
||||
|
||||
/*
|
||||
* @brief setup the display setup tile
|
||||
*
|
||||
* @param tile pointer to the tile obj
|
||||
* @param style pointer to the style obj
|
||||
* @param hres horizonal resolution
|
||||
* @param vres vertical resolution
|
||||
*/
|
||||
void time_settings_tile_setup( void );
|
||||
|
||||
#endif // _TIME_SETTINGS_H
|
||||
@@ -171,8 +171,11 @@ void update_Task( void * pvParameters ) {
|
||||
log_i("start update task");
|
||||
|
||||
if ( xEventGroupGetBits( update_event_handle) & UPDATE_GET_VERSION_REQUEST ) {
|
||||
if ( update_check_new_version() > atol( __FIRMWARE__ ) ) {
|
||||
lv_label_set_text( update_status_label, "new version available" );
|
||||
int64_t firmware_version = update_check_new_version();
|
||||
if ( firmware_version > atol( __FIRMWARE__ ) && firmware_version > 0 ) {
|
||||
char version_msg[48] = "";
|
||||
snprintf( version_msg, sizeof( version_msg ), "new version: %lld", firmware_version );
|
||||
lv_label_set_text( update_status_label, (const char*)version_msg );
|
||||
lv_obj_align( update_status_label, update_btn, LV_ALIGN_OUT_BOTTOM_MID, 0, 15 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ uint64_t update_check_new_version( void ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
check_version_client.printf( "GET /ttgo-t-watch2020_v1.version.json HTTP/1.1\r\n"
|
||||
"Host: %s\r\n"
|
||||
check_version_client.printf( "GET /" FIRMWARE_VERSION_FILE " HTTP/1.1\r\n"
|
||||
"Host: " FIRMWARE_HOST "\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Pragma: no-cache\r\n"
|
||||
"Cache-Control: no-cache\r\n"
|
||||
"User-Agent: ESP32-" __FIRMWARE__ "\r\n"
|
||||
"Accept: text/html,application/json\r\n\r\n", FIRMWARE_HOST );
|
||||
"Accept: text/html,application/json\r\n\r\n" );
|
||||
|
||||
uint64_t startMillis = millis();
|
||||
while ( check_version_client.available() == 0 ) {
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
|
||||
#include <TTGO.h>
|
||||
|
||||
#define FIRMWARE_HOST "www.neo-guerillaz.de"
|
||||
#define FIRMWARE_HOST_PORT 80
|
||||
#define FIRMWARE_HOST "www.neo-guerillaz.de"
|
||||
#define FIRMWARE_HOST_PORT 80
|
||||
#define FIRMWARE_VERSION_FILE "ttgo-t-watch2020_v1.version.json"
|
||||
|
||||
uint64_t update_check_new_version();
|
||||
|
||||
|
||||
@@ -97,8 +97,9 @@ void wlan_settings_tile_setup( void ) {
|
||||
lv_label_set_text( exit_label, "wlan settings");
|
||||
lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 );
|
||||
|
||||
/*Copy the first switch and turn it ON*/
|
||||
/*Copy the first switch and turn it ON*/
|
||||
wifi_onoff = lv_switch_create( wifi_settings_tile, NULL );
|
||||
lv_obj_add_style( wifi_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( wifi_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( wifi_onoff, exit_label, LV_ALIGN_OUT_RIGHT_MID, 30, 0 );
|
||||
lv_obj_set_event_cb( wifi_onoff, wifi_onoff_event_handler);
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
{"version":"2020073007","url":"http://www.neo-guerillaz.de/ttgo-t-watch2020_v1.ino.bin"}
|
||||
{"version":"2020073016","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
|
||||
|
||||
Reference in New Issue
Block a user