fix clipped ssid/ip label #75

This commit is contained in:
sharandac
2020-08-27 12:53:59 +02:00
parent daea3e145c
commit 467e5cf0e6
8 changed files with 32 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ src_filter =
+<*>
lib_deps =
TTGO TWatch Library@>=1.2.0
; https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library.git
ESP Async WebServer@>=1.2.0
AsyncTCP@>=1.1.1
ArduinoJson@>=6.15.2

View File

@@ -32,6 +32,6 @@
/*
* firmeware version string
*/
#define __FIRMWARE__ "2020082604"
#define __FIRMWARE__ "2020082701"
#endif // _CONFIG_H

View File

@@ -41,6 +41,7 @@
static lv_obj_t *statusbar = NULL;
static lv_obj_t *statusbar_wifi = NULL;
static lv_obj_t *statusbar_wifilabel = NULL;
static lv_obj_t *statusbar_wifiiplabel = NULL;
static lv_obj_t *statusbar_bluetooth = NULL;
static lv_obj_t *statusbar_stepcounterlabel = NULL;
static lv_style_t statusbarstyle[ STATUSBAR_STYLE_NUM ];
@@ -171,6 +172,13 @@ void statusbar_setup( void )
lv_label_set_text(statusbar_wifilabel, "");
lv_obj_align(statusbar_wifilabel, statusbar_wifi, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
/*Create a label on the Image button*/
statusbar_wifiiplabel = lv_label_create(statusbar, NULL);
lv_obj_reset_style_list( statusbar_wifiiplabel, LV_OBJ_PART_MAIN );
lv_obj_add_style( statusbar_wifiiplabel, LV_OBJ_PART_MAIN, &statusbarstyle[ STATUSBAR_STYLE_GREEN ] );
lv_label_set_text(statusbar_wifiiplabel, "");
lv_obj_align(statusbar_wifiiplabel, statusbar_wifilabel, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
lv_obj_t *statusbar_stepicon = lv_img_create(statusbar, NULL );
lv_img_set_src( statusbar_stepicon, &foot_16px );
lv_obj_reset_style_list( statusbar_stepicon, LV_OBJ_PART_MAIN );
@@ -189,7 +197,7 @@ void statusbar_setup( void )
statusbar_style_icon( STATUSBAR_BLUETOOTH, STATUSBAR_STYLE_GRAY );
blectl_register_cb( BLECTL_CONNECT | BLECTL_DISCONNECT | BLECTL_PIN_AUTH , statusbar_blectl_event_cb );
wifictl_register_cb( WIFICTL_CONNECT | WIFICTL_DISCONNECT | WIFICTL_OFF | WIFICTL_ON | WIFICTL_SCAN | WIFICTL_WPS_SUCCESS | WIFICTL_WPS_FAILED, statusbar_wifictl_event_cb );
wifictl_register_cb( WIFICTL_CONNECT | WIFICTL_DISCONNECT | WIFICTL_OFF | WIFICTL_ON | WIFICTL_SCAN | WIFICTL_WPS_SUCCESS | WIFICTL_WPS_FAILED | WIFICTL_CONNECT_IP, statusbar_wifictl_event_cb );
statusbar_task = lv_task_create( statusbar_update_task, 500, LV_TASK_PRIO_MID, NULL );
}
@@ -216,6 +224,10 @@ void statusbar_wifictl_event_cb( EventBits_t event, char* msg ) {
statusbar_wifi_set_state( true, msg );
statusbar_show_icon( STATUSBAR_WIFI );
break;
case WIFICTL_CONNECT_IP: statusbar_style_icon( STATUSBAR_WIFI, STATUSBAR_STYLE_WHITE );
statusbar_wifi_set_ip_state( true, msg );
statusbar_show_icon( STATUSBAR_WIFI );
break;
case WIFICTL_DISCONNECT: statusbar_style_icon( STATUSBAR_WIFI, STATUSBAR_STYLE_GRAY );
statusbar_wifi_set_state( true, msg );
statusbar_show_icon( STATUSBAR_WIFI );
@@ -280,7 +292,17 @@ void statusbar_wifi_set_state( bool state, const char *wifiname ) {
lv_imgbtn_set_state( statusbar_wifi, LV_BTN_STATE_CHECKED_RELEASED );
}
lv_label_set_text( statusbar_wifilabel, wifiname);
lv_label_set_text( statusbar_wifiiplabel, "" );
lv_obj_align( statusbar_wifilabel, statusbar_wifi, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
lv_obj_align( statusbar_wifiiplabel, statusbar_wifilabel, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
}
/*
*
*/
void statusbar_wifi_set_ip_state( bool state, const char *ip ) {
lv_label_set_text( statusbar_wifiiplabel, ip );
lv_obj_align( statusbar_wifiiplabel, statusbar_wifilabel, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
}
/*

View File

@@ -26,7 +26,7 @@
#include "config.h"
#define STATUSBAR_HEIGHT 26
#define STATUSBAR_EXPAND_HEIGHT 128
#define STATUSBAR_EXPAND_HEIGHT 160
typedef struct {
lv_obj_t *icon;
@@ -104,6 +104,7 @@
* @param wifiname label to displayed text like "scan","connecting" and so on
*/
void statusbar_wifi_set_state( bool state, const char *wifiname );
void statusbar_wifi_set_ip_state( bool state, const char *ip );
void statusbar_bluetooth_set_state( bool state );
/*
* @brief hide the statusbar

View File

@@ -115,10 +115,8 @@ void wifictl_setup( void ) {
wifictl_save_config();
}
wifictl_clear_event( WIFICTL_OFF_REQUEST | WIFICTL_ON_REQUEST | WIFICTL_SCAN | WIFICTL_WPS_REQUEST );
String label( wifiname );
label.concat(' ');
label.concat( WiFi.localIP().toString() );
wifictl_send_event_cb( WIFICTL_CONNECT, (char *)label.c_str() );
wifictl_send_event_cb( WIFICTL_CONNECT, (char*)WiFi.SSID().c_str() );
wifictl_send_event_cb( WIFICTL_CONNECT_IP, (char*)WiFi.localIP().toString().c_str() );
if ( wifictl_config.webserver ) {
asyncwebserver_start();
}

View File

@@ -54,7 +54,8 @@
} wifictl_event_t;
#define WIFICTL_CONNECT _BV(0)
#define WIFICTL_DISCONNECT _BV(1)
#define WIFICTL_CONNECT_IP _BV(1)
#define WIFICTL_DISCONNECT _BV(2)
#define WIFICTL_ON _BV(3)
#define WIFICTL_OFF _BV(4)
#define WIFICTL_ACTIVE _BV(5)

Binary file not shown.

View File

@@ -1 +1 @@
{"version":"2020082604","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
{"version":"2020082701","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}