some fixes
This commit is contained in:
@@ -42,6 +42,7 @@ lv_obj_t *display_timeout_slider = NULL;
|
||||
lv_obj_t *display_timeout_slider_label = NULL;
|
||||
lv_obj_t *display_rotation_list = NULL;
|
||||
lv_obj_t *display_vibe_onoff = NULL;
|
||||
lv_obj_t *display_block_return_maintile_onoff = NULL;
|
||||
|
||||
LV_IMG_DECLARE(brightness_64px);
|
||||
LV_IMG_DECLARE(exit_32px);
|
||||
@@ -59,6 +60,7 @@ static void display_brightness_setup_event_cb( lv_obj_t * obj, lv_event_t event
|
||||
static void display_timeout_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void display_rotation_event_handler(lv_obj_t * obj, lv_event_t event);
|
||||
static void display_vibe_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static void display_block_return_maintile_setup_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
|
||||
void display_settings_tile_setup( void ) {
|
||||
// get an app tile and copy mainstyle
|
||||
@@ -114,15 +116,6 @@ void display_settings_tile_setup( void ) {
|
||||
lv_label_set_text( exit_label_1, "display settings");
|
||||
lv_obj_align( exit_label_1, exit_btn_1, LV_ALIGN_OUT_RIGHT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *exit_btn_2 = lv_imgbtn_create( display_settings_tile_2, NULL);
|
||||
lv_imgbtn_set_src( exit_btn_2, LV_BTN_STATE_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn_2, LV_BTN_STATE_PRESSED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn_2, LV_BTN_STATE_CHECKED_RELEASED, &exit_32px);
|
||||
lv_imgbtn_set_src( exit_btn_2, LV_BTN_STATE_CHECKED_PRESSED, &exit_32px);
|
||||
lv_obj_add_style( exit_btn_2, LV_IMGBTN_PART_MAIN, &display_settings_style );
|
||||
lv_obj_align( exit_btn_2, display_settings_tile_2, LV_ALIGN_IN_TOP_LEFT, 10, STATUSBAR_HEIGHT + 10 );
|
||||
lv_obj_set_event_cb( exit_btn_2, exit_display_setup_event_cb );
|
||||
|
||||
lv_obj_t *up_btn_1 = lv_imgbtn_create( display_settings_tile_2, NULL);
|
||||
lv_imgbtn_set_src( up_btn_1, LV_BTN_STATE_RELEASED, &up_32px);
|
||||
lv_imgbtn_set_src( up_btn_1, LV_BTN_STATE_PRESSED, &up_32px);
|
||||
@@ -132,11 +125,6 @@ void display_settings_tile_setup( void ) {
|
||||
lv_obj_align( up_btn_1, display_settings_tile_2, LV_ALIGN_IN_TOP_RIGHT, -10, STATUSBAR_HEIGHT + 10 );
|
||||
lv_obj_set_event_cb( up_btn_1, up_display_setup_event_cb );
|
||||
|
||||
lv_obj_t *exit_label_2 = lv_label_create( display_settings_tile_2, NULL );
|
||||
lv_obj_add_style( exit_label_2, LV_OBJ_PART_MAIN, &display_settings_style );
|
||||
lv_label_set_text( exit_label_2, "display settings");
|
||||
lv_obj_align( exit_label_2, exit_btn_2, LV_ALIGN_OUT_RIGHT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *brightness_cont = lv_obj_create( display_settings_tile_1, NULL );
|
||||
lv_obj_set_size( brightness_cont, LV_HOR_RES_MAX , 48 );
|
||||
lv_obj_add_style( brightness_cont, LV_OBJ_PART_MAIN, &display_settings_style );
|
||||
@@ -202,6 +190,21 @@ void display_settings_tile_setup( void ) {
|
||||
lv_label_set_text( display_vibe_label, "vibe feedback");
|
||||
lv_obj_align( display_vibe_label, vibe_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
|
||||
lv_obj_t *block_return_maintile_cont = lv_obj_create( display_settings_tile_2, NULL );
|
||||
lv_obj_set_size(block_return_maintile_cont, LV_HOR_RES_MAX , 40 );
|
||||
lv_obj_add_style( block_return_maintile_cont, LV_OBJ_PART_MAIN, &display_settings_style );
|
||||
lv_obj_align( block_return_maintile_cont, vibe_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
|
||||
display_block_return_maintile_onoff = lv_switch_create( block_return_maintile_cont, NULL );
|
||||
lv_obj_add_protect( display_block_return_maintile_onoff, LV_PROTECT_CLICK_FOCUS);
|
||||
lv_obj_add_style( display_block_return_maintile_onoff, LV_SWITCH_PART_INDIC, mainbar_get_switch_style() );
|
||||
lv_switch_off( display_block_return_maintile_onoff, LV_ANIM_ON );
|
||||
lv_obj_align( display_block_return_maintile_onoff, block_return_maintile_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 );
|
||||
lv_obj_set_event_cb( display_block_return_maintile_onoff, display_block_return_maintile_setup_event_cb );
|
||||
lv_obj_t *display_block_return_maintile_label = lv_label_create( block_return_maintile_cont, NULL );
|
||||
lv_obj_add_style( display_block_return_maintile_label, LV_OBJ_PART_MAIN, &display_settings_style );
|
||||
lv_label_set_text( display_block_return_maintile_label, "block return maintile" );
|
||||
lv_obj_align( display_block_return_maintile_label, block_return_maintile_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 );
|
||||
|
||||
lv_slider_set_value( display_brightness_slider, display_get_brightness(), LV_ANIM_OFF );
|
||||
lv_slider_set_value( display_timeout_slider, display_get_timeout(), LV_ANIM_OFF );
|
||||
char temp[16]="";
|
||||
@@ -221,10 +224,16 @@ void display_settings_tile_setup( void ) {
|
||||
else
|
||||
lv_switch_off( display_vibe_onoff, LV_ANIM_OFF );
|
||||
|
||||
if ( display_get_block_return_maintile() )
|
||||
lv_switch_on( display_block_return_maintile_onoff, LV_ANIM_OFF );
|
||||
else
|
||||
lv_switch_off( display_block_return_maintile_onoff, LV_ANIM_OFF );
|
||||
|
||||
lv_tileview_add_element( display_settings_tile_1, brightness_cont );
|
||||
lv_tileview_add_element( display_settings_tile_1, timeout_cont );
|
||||
lv_tileview_add_element( display_settings_tile_1, rotation_cont );
|
||||
lv_tileview_add_element( display_settings_tile_2, vibe_cont );
|
||||
lv_tileview_add_element( display_settings_tile_2, block_return_maintile_cont );
|
||||
}
|
||||
|
||||
static void enter_display_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
@@ -266,6 +275,13 @@ static void display_vibe_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
}
|
||||
}
|
||||
|
||||
static void display_block_return_maintile_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_VALUE_CHANGED ): display_set_block_return_maintile( lv_slider_get_value( obj ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void display_brightness_setup_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch( event ) {
|
||||
case( LV_EVENT_VALUE_CHANGED ): display_set_brightness( lv_slider_get_value( obj ) );
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "hardware/wifictl.h"
|
||||
#include "hardware/motor.h"
|
||||
#include "webserver/webserver.h"
|
||||
|
||||
#include <WiFi.h>
|
||||
|
||||
@@ -401,6 +402,12 @@ static void wifi_autoon_onoff_event_handler( lv_obj_t * obj, lv_event_t event )
|
||||
static void wifi_webserver_onoff_event_handler( lv_obj_t * obj, lv_event_t event ) {
|
||||
switch (event) {
|
||||
case (LV_EVENT_VALUE_CHANGED): wifictl_set_webserver( lv_switch_get_state( obj ) );
|
||||
if ( lv_switch_get_state( obj ) ) {
|
||||
asyncwebserver_start();
|
||||
}
|
||||
else {
|
||||
asyncwebserver_end();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user