diff --git a/src/app/crypto_ticker/crypto_ticker_main.cpp b/src/app/crypto_ticker/crypto_ticker_main.cpp index 6c786da..f3f316c 100644 --- a/src/app/crypto_ticker/crypto_ticker_main.cpp +++ b/src/app/crypto_ticker/crypto_ticker_main.cpp @@ -104,7 +104,7 @@ void crypto_ticker_main_setup( uint32_t tile_num ) { lv_obj_t *crypto_ticker_main_last_price_cont = lv_obj_create( crypto_ticker_main_tile, NULL ); - lv_obj_set_size(crypto_ticker_main_last_price_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(crypto_ticker_main_last_price_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( crypto_ticker_main_last_price_cont, LV_OBJ_PART_MAIN, &crypto_ticker_main_style ); lv_obj_align( crypto_ticker_main_last_price_cont, crypto_ticker_main_update_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 20 ); lv_obj_t *crypto_ticker_main_last_price_label = lv_label_create( crypto_ticker_main_last_price_cont, NULL); @@ -118,7 +118,7 @@ void crypto_ticker_main_setup( uint32_t tile_num ) { lv_obj_align( crypto_ticker_main_last_price_value_label, NULL, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_t *crypto_ticker_main_price_change_cont = lv_obj_create( crypto_ticker_main_tile, NULL ); - lv_obj_set_size(crypto_ticker_main_price_change_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(crypto_ticker_main_price_change_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( crypto_ticker_main_price_change_cont, LV_OBJ_PART_MAIN, &crypto_ticker_main_style ); lv_obj_align( crypto_ticker_main_price_change_cont, crypto_ticker_main_last_price_cont, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5 ); lv_obj_t *crypto_ticker_main_price_change_label = lv_label_create( crypto_ticker_main_price_change_cont, NULL); @@ -132,7 +132,7 @@ void crypto_ticker_main_setup( uint32_t tile_num ) { lv_obj_align( crypto_ticker_main_price_change_value_label, NULL, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_t *crypto_ticker_main_volume_cont = lv_obj_create( crypto_ticker_main_tile, NULL ); - lv_obj_set_size(crypto_ticker_main_volume_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(crypto_ticker_main_volume_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( crypto_ticker_main_volume_cont, LV_OBJ_PART_MAIN, &crypto_ticker_main_style ); lv_obj_align( crypto_ticker_main_volume_cont, crypto_ticker_main_price_change_cont, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5 ); lv_obj_t *crypto_ticker_main_volume_label = lv_label_create( crypto_ticker_main_volume_cont, NULL); @@ -142,7 +142,7 @@ void crypto_ticker_main_setup( uint32_t tile_num ) { crypto_ticker_main_volume_value_label = lv_label_create( crypto_ticker_main_volume_cont , NULL); lv_label_set_text( crypto_ticker_main_volume_value_label, ""); lv_obj_reset_style_list( crypto_ticker_main_volume_value_label, LV_OBJ_PART_MAIN ); - lv_obj_set_width( crypto_ticker_main_volume_value_label, LV_HOR_RES /4 * 2 ); + lv_obj_set_width( crypto_ticker_main_volume_value_label, lv_disp_get_hor_res( NULL ) /4 * 2 ); lv_obj_align( crypto_ticker_main_volume_value_label, NULL, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); diff --git a/src/app/crypto_ticker/crypto_ticker_setup.cpp b/src/app/crypto_ticker/crypto_ticker_setup.cpp index e89fcfc..f3242cd 100644 --- a/src/app/crypto_ticker/crypto_ticker_setup.cpp +++ b/src/app/crypto_ticker/crypto_ticker_setup.cpp @@ -55,7 +55,7 @@ void crypto_ticker_setup_setup( uint32_t tile_num ) { lv_obj_add_style( crypto_ticker_setup_tile, LV_OBJ_PART_MAIN, &crypto_ticker_setup_style ); lv_obj_t *exit_cont = lv_obj_create( crypto_ticker_setup_tile, NULL ); - lv_obj_set_size( exit_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size( exit_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( exit_cont, LV_OBJ_PART_MAIN, &crypto_ticker_setup_style ); lv_obj_align( exit_cont, crypto_ticker_setup_tile, LV_ALIGN_IN_TOP_MID, 0, 10 ); @@ -75,7 +75,7 @@ void crypto_ticker_setup_setup( uint32_t tile_num ) { lv_obj_t *crypto_ticker_symbol_cont = lv_obj_create( crypto_ticker_setup_tile, NULL ); - lv_obj_set_size(crypto_ticker_symbol_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(crypto_ticker_symbol_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( crypto_ticker_symbol_cont, LV_OBJ_PART_MAIN, &crypto_ticker_setup_style ); lv_obj_align( crypto_ticker_symbol_cont, exit_cont, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 20 ); lv_obj_t *crypto_ticker_symbol_label = lv_label_create( crypto_ticker_symbol_cont, NULL); @@ -93,7 +93,7 @@ void crypto_ticker_setup_setup( uint32_t tile_num ) { lv_obj_t *crypto_ticker_autosync_switch_cont = lv_obj_create( crypto_ticker_setup_tile, NULL ); - lv_obj_set_size( crypto_ticker_autosync_switch_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size( crypto_ticker_autosync_switch_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( crypto_ticker_autosync_switch_cont, LV_OBJ_PART_MAIN, &crypto_ticker_setup_style ); lv_obj_align( crypto_ticker_autosync_switch_cont, crypto_ticker_symbol_cont, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0 ); diff --git a/src/app/example_app/example_app_setup.cpp b/src/app/example_app/example_app_setup.cpp index 7d58d22..eff68b0 100644 --- a/src/app/example_app/example_app_setup.cpp +++ b/src/app/example_app/example_app_setup.cpp @@ -49,7 +49,7 @@ void example_app_setup_setup( uint32_t tile_num ) { lv_obj_add_style( example_app_setup_tile, LV_OBJ_PART_MAIN, &example_app_setup_style ); lv_obj_t *exit_cont = lv_obj_create( example_app_setup_tile, NULL ); - lv_obj_set_size( exit_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size( exit_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( exit_cont, LV_OBJ_PART_MAIN, &example_app_setup_style ); lv_obj_align( exit_cont, example_app_setup_tile, LV_ALIGN_IN_TOP_MID, 0, 10 ); @@ -68,7 +68,7 @@ void example_app_setup_setup( uint32_t tile_num ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *example_app_foobar_switch_cont = lv_obj_create( example_app_setup_tile, NULL ); - lv_obj_set_size( example_app_foobar_switch_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size( example_app_foobar_switch_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( example_app_foobar_switch_cont, LV_OBJ_PART_MAIN, &example_app_setup_style ); lv_obj_align( example_app_foobar_switch_cont, exit_cont, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0 ); diff --git a/src/app/weather/weather_forecast.cpp b/src/app/weather/weather_forecast.cpp index 62a100d..b3cd4a0 100644 --- a/src/app/weather/weather_forecast.cpp +++ b/src/app/weather/weather_forecast.cpp @@ -106,7 +106,7 @@ void weather_forecast_tile_setup( uint32_t tile_num ) { lv_obj_align( weather_forecast_update_label, weather_forecast_location_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0 ); lv_obj_t * weater_forecast_cont = lv_obj_create( weather_forecast_tile, NULL ); - lv_obj_set_size( weater_forecast_cont, LV_HOR_RES_MAX , 96 ); + lv_obj_set_size( weater_forecast_cont, lv_disp_get_hor_res( NULL ) , 96 ); lv_obj_add_style( weater_forecast_cont, LV_OBJ_PART_MAIN, &weather_forecast_style ); lv_obj_align( weater_forecast_cont, weather_forecast_tile, LV_ALIGN_CENTER, 0, 0 ); diff --git a/src/app/weather/weather_setup.cpp b/src/app/weather/weather_setup.cpp index d7bd3e2..ae37992 100644 --- a/src/app/weather/weather_setup.cpp +++ b/src/app/weather/weather_setup.cpp @@ -86,7 +86,7 @@ void weather_setup_tile_setup( uint32_t tile_num ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); /* lv_obj_t *weather_geolocation_cont = lv_obj_create( weather_setup_tile, NULL ); - lv_obj_set_size( weather_geolocation_cont, LV_HOR_RES_MAX , 32); + lv_obj_set_size( weather_geolocation_cont, lv_disp_get_hor_res( NULL ) , 32); lv_obj_add_style( weather_geolocation_cont, LV_OBJ_PART_MAIN, &weather_setup_style ); lv_obj_align( weather_geolocation_cont, weather_setup_tile, LV_ALIGN_IN_TOP_MID, 0, 49 ); weather_geolocation_onoff = lv_switch_create( weather_geolocation_cont, NULL ); @@ -101,7 +101,7 @@ void weather_setup_tile_setup( uint32_t tile_num ) { lv_obj_align( weather_geolocation_label, weather_geolocation_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); */ lv_obj_t *weather_apikey_cont = lv_obj_create( weather_setup_tile, NULL ); - lv_obj_set_size(weather_apikey_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(weather_apikey_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( weather_apikey_cont, LV_OBJ_PART_MAIN, &weather_setup_style ); lv_obj_align( weather_apikey_cont, weather_setup_tile, LV_ALIGN_IN_TOP_MID, 0, 49 ); lv_obj_t *weather_apikey_label = lv_label_create( weather_apikey_cont, NULL); @@ -118,7 +118,7 @@ void weather_setup_tile_setup( uint32_t tile_num ) { lv_obj_set_event_cb( weather_apikey_textfield, weather_textarea_event_cb ); lv_obj_t *weather_lat_cont = lv_obj_create( weather_setup_tile, NULL ); - lv_obj_set_size(weather_lat_cont, LV_HOR_RES_MAX / 2 , 40 ); + lv_obj_set_size(weather_lat_cont, lv_disp_get_hor_res( NULL ) / 2 , 40 ); lv_obj_add_style( weather_lat_cont, LV_OBJ_PART_MAIN, &weather_setup_style ); lv_obj_align( weather_lat_cont, weather_apikey_cont, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0 ); lv_obj_t *weather_lat_label = lv_label_create( weather_lat_cont, NULL); @@ -130,12 +130,12 @@ void weather_setup_tile_setup( uint32_t tile_num ) { lv_textarea_set_pwd_mode( weather_lat_textfield, false); lv_textarea_set_one_line( weather_lat_textfield, true); lv_textarea_set_cursor_hidden( weather_lat_textfield, true); - lv_obj_set_width( weather_lat_textfield, LV_HOR_RES / 4 ); + lv_obj_set_width( weather_lat_textfield, lv_disp_get_hor_res( NULL ) / 4 ); lv_obj_align( weather_lat_textfield, weather_lat_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_set_event_cb( weather_lat_textfield, weather_textarea_event_cb ); lv_obj_t *weather_lon_cont = lv_obj_create( weather_setup_tile, NULL ); - lv_obj_set_size(weather_lon_cont, LV_HOR_RES_MAX / 2 , 40 ); + lv_obj_set_size(weather_lon_cont, lv_disp_get_hor_res( NULL ) / 2 , 40 ); lv_obj_add_style( weather_lon_cont, LV_OBJ_PART_MAIN, &weather_setup_style ); lv_obj_align( weather_lon_cont, weather_apikey_cont, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 0 ); lv_obj_t *weather_lon_label = lv_label_create( weather_lon_cont, NULL); @@ -147,12 +147,12 @@ void weather_setup_tile_setup( uint32_t tile_num ) { lv_textarea_set_pwd_mode( weather_lon_textfield, false); lv_textarea_set_one_line( weather_lon_textfield, true); lv_textarea_set_cursor_hidden( weather_lon_textfield, true); - lv_obj_set_width( weather_lon_textfield, LV_HOR_RES / 4 ); + lv_obj_set_width( weather_lon_textfield, lv_disp_get_hor_res( NULL ) / 4 ); lv_obj_align( weather_lon_textfield, weather_lon_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_set_event_cb( weather_lon_textfield, weather_textarea_event_cb ); lv_obj_t *weather_autosync_cont = lv_obj_create( weather_setup_tile, NULL ); - lv_obj_set_size( weather_autosync_cont, LV_HOR_RES_MAX , 32); + lv_obj_set_size( weather_autosync_cont, lv_disp_get_hor_res( NULL ) , 32); 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 ); @@ -167,7 +167,7 @@ void weather_setup_tile_setup( uint32_t tile_num ) { lv_obj_align( weather_autosync_label, weather_autosync_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *weather_wind_cont = lv_obj_create( weather_setup_tile, NULL); - lv_obj_set_size( weather_wind_cont, LV_HOR_RES_MAX, 32); + lv_obj_set_size( weather_wind_cont, lv_disp_get_hor_res( NULL ), 32); 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); @@ -182,7 +182,7 @@ void weather_setup_tile_setup( uint32_t tile_num ) { lv_obj_align( weather_wind_label, weather_wind_cont, LV_ALIGN_IN_LEFT_MID, 5, 0); lv_obj_t *weather_imperial_cont = lv_obj_create( weather_setup_tile, NULL); - lv_obj_set_size( weather_imperial_cont, LV_HOR_RES_MAX, 32); + lv_obj_set_size( weather_imperial_cont, lv_disp_get_hor_res( NULL ), 32); lv_obj_add_style( weather_imperial_cont, LV_OBJ_PART_MAIN, &weather_setup_style ); lv_obj_align( weather_imperial_cont, weather_wind_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); weather_imperial_onoff = lv_switch_create( weather_imperial_cont, NULL); diff --git a/src/gui/keyboard.cpp b/src/gui/keyboard.cpp index 6e7f7d9..e2c5772 100644 --- a/src/gui/keyboard.cpp +++ b/src/gui/keyboard.cpp @@ -20,6 +20,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" +#include #include "keyboard.h" @@ -45,17 +46,17 @@ void keyboard_setup( void ) { kb_screen = lv_cont_create( lv_scr_act(), NULL ); lv_obj_add_style( kb_screen, LV_OBJ_PART_MAIN, &kb_style ); - lv_obj_set_size( kb_screen, LV_HOR_RES_MAX , LV_VER_RES_MAX - 20 ); + lv_obj_set_size( kb_screen, lv_disp_get_hor_res( NULL ) , lv_disp_get_ver_res( NULL ) - 20 ); lv_obj_align( kb_screen, lv_scr_act(), LV_ALIGN_CENTER, 0, 20); kb_textarea = lv_textarea_create( kb_screen, NULL ); lv_obj_add_protect( kb_textarea, LV_PROTECT_CLICK_FOCUS); - lv_obj_set_size( kb_textarea, LV_HOR_RES_MAX - 10, 60 ); + lv_obj_set_size( kb_textarea, lv_disp_get_hor_res( NULL ) - 10, 60 ); lv_textarea_set_one_line( kb_textarea, true); lv_obj_align( kb_textarea, kb_screen, LV_ALIGN_IN_TOP_MID, 0, 5 ); kb = lv_keyboard_create( lv_scr_act() , NULL); - lv_obj_set_size (kb, LV_HOR_RES, ( LV_VER_RES / 4 ) * 3 - 20); + lv_obj_set_size (kb, lv_disp_get_hor_res( NULL ), ( lv_disp_get_ver_res( NULL ) / 4 ) * 3 - 20); lv_obj_align( kb, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0 ); lv_keyboard_set_cursor_manage( kb, true); lv_obj_set_event_cb( kb, kb_event_cb ); diff --git a/src/gui/mainbar/main_tile/main_tile.cpp b/src/gui/mainbar/main_tile/main_tile.cpp index fbb93a6..5e176ce 100644 --- a/src/gui/mainbar/main_tile/main_tile.cpp +++ b/src/gui/mainbar/main_tile/main_tile.cpp @@ -59,7 +59,7 @@ void main_tile_setup( void ) { lv_style_set_text_font( &datestyle, LV_STATE_DEFAULT, &Ubuntu_16px); clock_cont = mainbar_obj_create( main_cont ); - lv_obj_set_size( clock_cont, LV_HOR_RES , LV_VER_RES / 2 ); + lv_obj_set_size( clock_cont, lv_disp_get_hor_res( NULL ) , lv_disp_get_ver_res( NULL ) / 2 ); lv_obj_add_style( clock_cont, LV_OBJ_PART_MAIN, style ); lv_obj_align( clock_cont, main_cont, LV_ALIGN_CENTER, 0, 0 ); diff --git a/src/gui/mainbar/mainbar.cpp b/src/gui/mainbar/mainbar.cpp index 3c7208d..5ce17bd 100644 --- a/src/gui/mainbar/mainbar.cpp +++ b/src/gui/mainbar/mainbar.cpp @@ -113,10 +113,10 @@ uint32_t mainbar_add_tile( uint16_t x, uint16_t y ) { tile[ tile_entrys - 1 ].tile = my_tile; tile[ tile_entrys - 1 ].activate_cb = NULL; tile[ tile_entrys - 1 ].hibernate_cb = NULL; - lv_obj_set_size( tile[ tile_entrys - 1 ].tile, LV_HOR_RES, LV_VER_RES); + lv_obj_set_size( tile[ tile_entrys - 1 ].tile, lv_disp_get_hor_res( NULL ), 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, &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_obj_set_pos( tile[ tile_entrys - 1 ].tile, tile_pos_table[ tile_entrys - 1 ].x * lv_disp_get_hor_res( NULL ) , 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 ); log_i("add tile: x=%d, y=%d", tile_pos_table[ tile_entrys - 1 ].x, tile_pos_table[ tile_entrys - 1 ].y ); diff --git a/src/gui/mainbar/setup_tile/battery_settings/battery_settings.cpp b/src/gui/mainbar/setup_tile/battery_settings/battery_settings.cpp index 48911a4..24963ad 100644 --- a/src/gui/mainbar/setup_tile/battery_settings/battery_settings.cpp +++ b/src/gui/mainbar/setup_tile/battery_settings/battery_settings.cpp @@ -97,7 +97,7 @@ void battery_settings_tile_setup( void ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *battery_silence_wakeup_switch_cont = lv_obj_create( battery_settings_tile, NULL ); - lv_obj_set_size(battery_silence_wakeup_switch_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(battery_silence_wakeup_switch_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( battery_silence_wakeup_switch_cont, LV_OBJ_PART_MAIN, &battery_settings_style ); lv_obj_align( battery_silence_wakeup_switch_cont, battery_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); battery_silence_wakeup_switch = lv_switch_create( battery_silence_wakeup_switch_cont, NULL ); @@ -112,7 +112,7 @@ void battery_settings_tile_setup( void ) { lv_obj_align( battery_silence_wakeup_label, battery_silence_wakeup_switch_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *battery_setup_label_cont = lv_obj_create( battery_settings_tile, NULL ); - lv_obj_set_size(battery_setup_label_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(battery_setup_label_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( battery_setup_label_cont, LV_OBJ_PART_MAIN, &battery_settings_style ); lv_obj_align( battery_setup_label_cont, battery_silence_wakeup_switch_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *battery_setup_label = lv_label_create( battery_setup_label_cont, NULL); @@ -121,7 +121,7 @@ void battery_settings_tile_setup( void ) { lv_obj_align( battery_setup_label, battery_setup_label_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *battery_percent_switch_cont = lv_obj_create( battery_settings_tile, NULL ); - lv_obj_set_size(battery_percent_switch_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(battery_percent_switch_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( battery_percent_switch_cont, LV_OBJ_PART_MAIN, &battery_settings_style ); lv_obj_align( battery_percent_switch_cont, battery_setup_label_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); battery_percent_switch = lv_switch_create( battery_percent_switch_cont, NULL ); @@ -136,7 +136,7 @@ void battery_settings_tile_setup( void ) { lv_obj_align( stepcounter_label, battery_percent_switch_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *battery_experimental_switch_cont = lv_obj_create( battery_settings_tile, NULL ); - lv_obj_set_size(battery_experimental_switch_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(battery_experimental_switch_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( battery_experimental_switch_cont, LV_OBJ_PART_MAIN, &battery_settings_style ); lv_obj_align( battery_experimental_switch_cont, battery_percent_switch_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); battery_experimental_switch = lv_switch_create( battery_experimental_switch_cont, NULL ); diff --git a/src/gui/mainbar/setup_tile/battery_settings/battery_view.cpp b/src/gui/mainbar/setup_tile/battery_settings/battery_view.cpp index 24e42bd..eda97ef 100644 --- a/src/gui/mainbar/setup_tile/battery_settings/battery_view.cpp +++ b/src/gui/mainbar/setup_tile/battery_settings/battery_view.cpp @@ -87,7 +87,7 @@ void battery_view_tile_setup( uint32_t tile_num ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *battery_design_cont = lv_obj_create( battery_view_tile, NULL ); - lv_obj_set_size( battery_design_cont, LV_HOR_RES_MAX , 25 ); + lv_obj_set_size( battery_design_cont, lv_disp_get_hor_res( NULL ) , 25 ); lv_obj_add_style( battery_design_cont, LV_OBJ_PART_MAIN, &battery_view_style ); lv_obj_align( battery_design_cont, battery_view_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); lv_obj_t *battery_design_cap_label = lv_label_create( battery_design_cont, NULL); @@ -100,7 +100,7 @@ void battery_view_tile_setup( uint32_t tile_num ) { lv_obj_align( battery_view_design_cap, battery_design_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_t *battery_current_cont = lv_obj_create( battery_view_tile, NULL ); - lv_obj_set_size( battery_current_cont, LV_HOR_RES_MAX , 25 ); + lv_obj_set_size( battery_current_cont, lv_disp_get_hor_res( NULL ) , 25 ); lv_obj_add_style( battery_current_cont, LV_OBJ_PART_MAIN, &battery_view_style ); lv_obj_align( battery_current_cont, battery_design_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *battery_current_cap_label = lv_label_create( battery_current_cont, NULL); @@ -113,7 +113,7 @@ void battery_view_tile_setup( uint32_t tile_num ) { lv_obj_align( battery_view_current_cap, battery_current_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_t *battery_voltage_cont = lv_obj_create( battery_view_tile, NULL ); - lv_obj_set_size( battery_voltage_cont, LV_HOR_RES_MAX , 25 ); + lv_obj_set_size( battery_voltage_cont, lv_disp_get_hor_res( NULL ) , 25 ); lv_obj_add_style( battery_voltage_cont, LV_OBJ_PART_MAIN, &battery_view_style ); lv_obj_align( battery_voltage_cont, battery_current_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *battery_voltage_label = lv_label_create( battery_voltage_cont, NULL); @@ -126,7 +126,7 @@ void battery_view_tile_setup( uint32_t tile_num ) { lv_obj_align( battery_view_voltage, battery_voltage_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_t *battery_charge_cont = lv_obj_create( battery_view_tile, NULL ); - lv_obj_set_size( battery_charge_cont, LV_HOR_RES_MAX , 25 ); + lv_obj_set_size( battery_charge_cont, lv_disp_get_hor_res( NULL ) , 25 ); lv_obj_add_style( battery_charge_cont, LV_OBJ_PART_MAIN, &battery_view_style ); lv_obj_align( battery_charge_cont, battery_voltage_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 5 ); lv_obj_t *battery_charge_label = lv_label_create( battery_charge_cont, NULL); @@ -139,7 +139,7 @@ void battery_view_tile_setup( uint32_t tile_num ) { lv_obj_align( charge_view_current, battery_charge_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_t *battery_discharge_cont = lv_obj_create( battery_view_tile, NULL ); - lv_obj_set_size( battery_discharge_cont, LV_HOR_RES_MAX , 25 ); + lv_obj_set_size( battery_discharge_cont, lv_disp_get_hor_res( NULL ) , 25 ); lv_obj_add_style( battery_discharge_cont, LV_OBJ_PART_MAIN, &battery_view_style ); lv_obj_align( battery_discharge_cont, battery_charge_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *battery_discharge_label = lv_label_create( battery_discharge_cont, NULL); @@ -152,7 +152,7 @@ void battery_view_tile_setup( uint32_t tile_num ) { lv_obj_align( discharge_view_current, battery_discharge_cont, LV_ALIGN_IN_RIGHT_MID, -5, 0 ); lv_obj_t *vbus_voltage_cont = lv_obj_create( battery_view_tile, NULL ); - lv_obj_set_size( vbus_voltage_cont, LV_HOR_RES_MAX , 25 ); + lv_obj_set_size( vbus_voltage_cont, lv_disp_get_hor_res( NULL ) , 25 ); lv_obj_add_style( vbus_voltage_cont, LV_OBJ_PART_MAIN, &battery_view_style ); lv_obj_align( vbus_voltage_cont, battery_discharge_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *vbus_voltage_label = lv_label_create( vbus_voltage_cont, NULL); diff --git a/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_message.cpp b/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_message.cpp index 788bd31..8da0747 100644 --- a/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_message.cpp +++ b/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_message.cpp @@ -104,7 +104,7 @@ void bluetooth_message_tile_setup( void ) { lv_obj_align( bluetooth_message_sender_label, bluetooth_message_img, LV_ALIGN_OUT_BOTTOM_LEFT, 5, 5 ); bluetooth_message_page = lv_page_create( bluetooth_message_tile, NULL); - lv_obj_set_size( bluetooth_message_page, LV_HOR_RES_MAX - 20, 160 ); + lv_obj_set_size( bluetooth_message_page, lv_disp_get_hor_res( NULL ) - 20, 160 ); lv_obj_add_style( bluetooth_message_page, LV_OBJ_PART_MAIN, &bluetooth_message_style ); lv_page_set_scrlbar_mode( bluetooth_message_page, LV_SCRLBAR_MODE_DRAG ); lv_obj_align( bluetooth_message_page, bluetooth_message_sender_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5 ); diff --git a/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_settings.cpp b/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_settings.cpp index 94d869e..5fd37af 100644 --- a/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_settings.cpp +++ b/src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_settings.cpp @@ -92,7 +92,7 @@ void bluetooth_settings_tile_setup( void ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *bluetooth_advertising_cont = lv_obj_create( bluetooth_settings_tile, NULL ); - lv_obj_set_size( bluetooth_advertising_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size( bluetooth_advertising_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( bluetooth_advertising_cont, LV_OBJ_PART_MAIN, &bluetooth_settings_style ); lv_obj_align( bluetooth_advertising_cont, bluetooth_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); bluetooth_advertising_onoff = lv_switch_create( bluetooth_advertising_cont, NULL ); @@ -107,7 +107,7 @@ void bluetooth_settings_tile_setup( void ) { lv_obj_align( bluetooth_advertising_label, bluetooth_advertising_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *bluettoth_info_label_cont = lv_obj_create( bluetooth_settings_tile, NULL ); - lv_obj_set_size(bluettoth_info_label_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(bluettoth_info_label_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( bluettoth_info_label_cont, LV_OBJ_PART_MAIN, &bluetooth_settings_style ); lv_obj_align( bluettoth_info_label_cont, bluetooth_advertising_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *bluetooth_info_label = lv_label_create( bluettoth_info_label_cont, NULL); @@ -116,7 +116,7 @@ void bluetooth_settings_tile_setup( void ) { lv_obj_align( bluetooth_info_label, bluettoth_info_label_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *bluetooth_standby_cont = lv_obj_create( bluetooth_settings_tile, NULL ); - lv_obj_set_size( bluetooth_standby_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size( bluetooth_standby_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( bluetooth_standby_cont, LV_OBJ_PART_MAIN, &bluetooth_settings_style ); lv_obj_align( bluetooth_standby_cont, bluettoth_info_label_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); bluetooth_standby_onoff = lv_switch_create( bluetooth_standby_cont, NULL ); diff --git a/src/gui/mainbar/setup_tile/display_settings/display_setting.cpp b/src/gui/mainbar/setup_tile/display_settings/display_setting.cpp index a433dc2..f816127 100644 --- a/src/gui/mainbar/setup_tile/display_settings/display_setting.cpp +++ b/src/gui/mainbar/setup_tile/display_settings/display_setting.cpp @@ -126,7 +126,7 @@ void display_settings_tile_setup( void ) { lv_obj_set_event_cb( up_btn_1, up_display_setup_event_cb ); 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_set_size( brightness_cont, lv_disp_get_hor_res( NULL ) , 48 ); lv_obj_add_style( brightness_cont, LV_OBJ_PART_MAIN, &display_settings_style ); lv_obj_align( brightness_cont, display_settings_tile_1, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); display_brightness_slider = lv_slider_create( brightness_cont, NULL ); @@ -134,7 +134,7 @@ void display_settings_tile_setup( void ) { lv_obj_add_style( display_brightness_slider, LV_SLIDER_PART_INDIC, mainbar_get_slider_style() ); lv_obj_add_style( display_brightness_slider, LV_SLIDER_PART_KNOB, mainbar_get_slider_style() ); lv_slider_set_range( display_brightness_slider, DISPLAY_MIN_BRIGHTNESS, DISPLAY_MAX_BRIGHTNESS ); - lv_obj_set_size( display_brightness_slider, LV_HOR_RES_MAX - 100 , 10 ); + lv_obj_set_size( display_brightness_slider, lv_disp_get_hor_res( NULL ) - 100 , 10 ); lv_obj_align( display_brightness_slider, brightness_cont, LV_ALIGN_IN_RIGHT_MID, -30, 0 ); lv_obj_set_event_cb( display_brightness_slider, display_brightness_setup_event_cb ); lv_obj_t *brightness_icon = lv_img_create( brightness_cont, NULL ); @@ -142,7 +142,7 @@ void display_settings_tile_setup( void ) { lv_obj_align( brightness_icon, brightness_cont, LV_ALIGN_IN_LEFT_MID, 15, 0 ); lv_obj_t *timeout_cont = lv_obj_create( display_settings_tile_1, NULL ); - lv_obj_set_size( timeout_cont, LV_HOR_RES_MAX , 58 ); + lv_obj_set_size( timeout_cont, lv_disp_get_hor_res( NULL ) , 58 ); lv_obj_add_style( timeout_cont, LV_OBJ_PART_MAIN, &display_settings_style ); lv_obj_align( timeout_cont, brightness_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); display_timeout_slider = lv_slider_create( timeout_cont, NULL ); @@ -150,7 +150,7 @@ void display_settings_tile_setup( void ) { lv_obj_add_style( display_timeout_slider, LV_SLIDER_PART_INDIC, mainbar_get_slider_style() ); lv_obj_add_style( display_timeout_slider, LV_SLIDER_PART_KNOB, mainbar_get_slider_style() ); lv_slider_set_range( display_timeout_slider, DISPLAY_MIN_TIMEOUT, DISPLAY_MAX_TIMEOUT ); - lv_obj_set_size(display_timeout_slider, LV_HOR_RES_MAX - 100 , 10 ); + lv_obj_set_size(display_timeout_slider, lv_disp_get_hor_res( NULL ) - 100 , 10 ); lv_obj_align( display_timeout_slider, timeout_cont, LV_ALIGN_IN_TOP_RIGHT, -30, 10 ); lv_obj_set_event_cb( display_timeout_slider, display_timeout_setup_event_cb ); display_timeout_slider_label = lv_label_create( timeout_cont, NULL ); @@ -162,7 +162,7 @@ void display_settings_tile_setup( void ) { lv_obj_align( timeout_icon, timeout_cont, LV_ALIGN_IN_LEFT_MID, 15, 0 ); lv_obj_t *rotation_cont = lv_obj_create( display_settings_tile_1, NULL ); - lv_obj_set_size(rotation_cont, LV_HOR_RES_MAX , 40 ); + lv_obj_set_size(rotation_cont, lv_disp_get_hor_res( NULL ) , 40 ); lv_obj_add_style( rotation_cont, LV_OBJ_PART_MAIN, &display_settings_style ); lv_obj_align( rotation_cont, timeout_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *display_rotation_label = lv_label_create( rotation_cont, NULL ); @@ -176,7 +176,7 @@ void display_settings_tile_setup( void ) { lv_obj_set_event_cb(display_rotation_list, display_rotation_event_handler); lv_obj_t *vibe_cont = lv_obj_create( display_settings_tile_2, NULL ); - lv_obj_set_size(vibe_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(vibe_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( vibe_cont, LV_OBJ_PART_MAIN, &display_settings_style ); lv_obj_align( vibe_cont, display_settings_tile_2, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); display_vibe_onoff = lv_switch_create( vibe_cont, NULL ); @@ -191,7 +191,7 @@ void display_settings_tile_setup( void ) { 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_set_size(block_return_maintile_cont, lv_disp_get_hor_res( NULL ) , 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 ); diff --git a/src/gui/mainbar/setup_tile/move_settings/move_settings.cpp b/src/gui/mainbar/setup_tile/move_settings/move_settings.cpp index e3b5c50..3e982ff 100644 --- a/src/gui/mainbar/setup_tile/move_settings/move_settings.cpp +++ b/src/gui/mainbar/setup_tile/move_settings/move_settings.cpp @@ -79,7 +79,7 @@ void move_settings_tile_setup( void ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *stepcounter_cont = lv_obj_create( move_settings_tile, NULL ); - lv_obj_set_size(stepcounter_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(stepcounter_cont, lv_disp_get_hor_res( NULL ) , 40); 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 ); @@ -94,7 +94,7 @@ void move_settings_tile_setup( void ) { lv_obj_align( stepcounter_label, stepcounter_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *doubleclick_cont = lv_obj_create( move_settings_tile, NULL ); - lv_obj_set_size(doubleclick_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(doubleclick_cont, lv_disp_get_hor_res( NULL ) , 40); 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 ); diff --git a/src/gui/mainbar/setup_tile/time_settings/time_settings.cpp b/src/gui/mainbar/setup_tile/time_settings/time_settings.cpp index ce054a8..5c29b18 100644 --- a/src/gui/mainbar/setup_tile/time_settings/time_settings.cpp +++ b/src/gui/mainbar/setup_tile/time_settings/time_settings.cpp @@ -83,7 +83,7 @@ void time_settings_tile_setup( void ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *wifisync_cont = lv_obj_create( time_settings_tile, NULL ); - lv_obj_set_size(wifisync_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(wifisync_cont, lv_disp_get_hor_res( NULL ) , 40); 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 ); @@ -98,7 +98,7 @@ void time_settings_tile_setup( void ) { lv_obj_align( wifisync_label, wifisync_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *daylight_cont = lv_obj_create( time_settings_tile, NULL ); - lv_obj_set_size(daylight_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(daylight_cont, lv_disp_get_hor_res( NULL ) , 40); 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 ); @@ -113,7 +113,7 @@ void time_settings_tile_setup( void ) { lv_obj_align( daylight_label, daylight_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *utczone_cont = lv_obj_create( time_settings_tile, NULL ); - lv_obj_set_size(utczone_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(utczone_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( utczone_cont, LV_OBJ_PART_MAIN, &time_settings_style ); lv_obj_align( utczone_cont, daylight_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *utczone_label = lv_label_create( utczone_cont, NULL); diff --git a/src/gui/mainbar/setup_tile/update/update.cpp b/src/gui/mainbar/setup_tile/update/update.cpp index 1f70831..74a2b0e 100644 --- a/src/gui/mainbar/setup_tile/update/update.cpp +++ b/src/gui/mainbar/setup_tile/update/update.cpp @@ -114,7 +114,7 @@ void update_tile_setup( void ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *update_version_cont = lv_obj_create( update_settings_tile, NULL ); - lv_obj_set_size(update_version_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(update_version_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( update_version_cont, LV_OBJ_PART_MAIN, &update_settings_style ); lv_obj_align( update_version_cont, update_settings_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); lv_obj_t *update_version_label = lv_label_create( update_version_cont, NULL); diff --git a/src/gui/mainbar/setup_tile/update/update_setup.cpp b/src/gui/mainbar/setup_tile/update/update_setup.cpp index af0a004..77c6cbf 100644 --- a/src/gui/mainbar/setup_tile/update/update_setup.cpp +++ b/src/gui/mainbar/setup_tile/update/update_setup.cpp @@ -77,7 +77,7 @@ void update_setup_tile_setup( uint32_t tile_num ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *update_check_autosync_cont = lv_obj_create( update_setup_tile, NULL ); - lv_obj_set_size(update_check_autosync_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(update_check_autosync_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( update_check_autosync_cont, LV_OBJ_PART_MAIN, &update_setup_style ); lv_obj_align( update_check_autosync_cont, update_setup_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); @@ -93,7 +93,7 @@ void update_setup_tile_setup( uint32_t tile_num ) { lv_obj_align( update_check_autosync_label, update_check_autosync_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *update_check_url_cont = lv_obj_create( update_setup_tile, NULL ); - lv_obj_set_size(update_check_url_cont, LV_HOR_RES_MAX , 60); + lv_obj_set_size(update_check_url_cont, lv_disp_get_hor_res( NULL ) , 60); lv_obj_add_style( update_check_url_cont, LV_OBJ_PART_MAIN, &update_setup_style ); lv_obj_align( update_check_url_cont, update_check_autosync_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); lv_obj_t *update_check_url_label = lv_label_create( update_check_url_cont, NULL); @@ -105,7 +105,7 @@ void update_setup_tile_setup( uint32_t tile_num ) { lv_textarea_set_pwd_mode( update_check_url_textfield, false); lv_textarea_set_one_line( update_check_url_textfield, true); lv_textarea_set_cursor_hidden( update_check_url_textfield, true); - lv_obj_set_width( update_check_url_textfield, LV_HOR_RES - 10 ); + lv_obj_set_width( update_check_url_textfield, lv_disp_get_hor_res( NULL ) - 10 ); lv_obj_align( update_check_url_textfield, update_check_url_cont, LV_ALIGN_IN_BOTTOM_MID, 0, 0 ); lv_obj_set_event_cb( update_check_url_textfield, update_check_url_textarea_event_cb ); diff --git a/src/gui/mainbar/setup_tile/wlan_settings/wlan_settings.cpp b/src/gui/mainbar/setup_tile/wlan_settings/wlan_settings.cpp index 9fa3174..479e69a 100644 --- a/src/gui/mainbar/setup_tile/wlan_settings/wlan_settings.cpp +++ b/src/gui/mainbar/setup_tile/wlan_settings/wlan_settings.cpp @@ -130,7 +130,7 @@ void wlan_settings_tile_setup( void ) { lv_obj_set_event_cb( wifi_onoff, wifi_onoff_event_handler); wifiname_list = lv_list_create( wifi_settings_tile, NULL); - lv_obj_set_size( wifiname_list, LV_HOR_RES_MAX, 160); + lv_obj_set_size( wifiname_list, lv_disp_get_hor_res( NULL ), 160); lv_style_init( &wifi_list_style ); lv_style_set_border_width( &wifi_list_style , LV_OBJ_PART_MAIN, 0); lv_style_set_radius( &wifi_list_style , LV_OBJ_PART_MAIN, 0); @@ -235,13 +235,13 @@ void wlan_password_tile_setup( uint32_t wifi_password_tile_num ) { lv_textarea_set_pwd_mode( wifi_password_pass_textfield, false); lv_textarea_set_one_line( wifi_password_pass_textfield, true); lv_textarea_set_cursor_hidden( wifi_password_pass_textfield, true); - lv_obj_set_width( wifi_password_pass_textfield, LV_HOR_RES ); + lv_obj_set_width( wifi_password_pass_textfield, lv_disp_get_hor_res( NULL ) ); lv_obj_align( wifi_password_pass_textfield, wifi_password_tile, LV_ALIGN_IN_TOP_LEFT, 0, 75); lv_obj_set_event_cb( wifi_password_pass_textfield, wlan_password_event_cb ); lv_obj_t *mac_label = lv_label_create( wifi_password_tile, NULL); lv_obj_add_style( mac_label, LV_IMGBTN_PART_MAIN, &wifi_password_style ); - lv_obj_set_width( mac_label, LV_HOR_RES); + lv_obj_set_width( mac_label, lv_disp_get_hor_res( NULL ) ); lv_obj_align( mac_label, wifi_password_tile, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); lv_label_set_text_fmt( mac_label, "MAC: %s", WiFi.macAddress().c_str()); @@ -328,7 +328,7 @@ void wlan_setup_tile_setup( uint32_t wifi_setup_tile_num ) { lv_obj_align( exit_label, exit_btn, LV_ALIGN_OUT_RIGHT_MID, 5, 0 ); lv_obj_t *wifi_autoon_onoff_cont = lv_obj_create( wifi_setup_tile, NULL ); - lv_obj_set_size(wifi_autoon_onoff_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(wifi_autoon_onoff_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( wifi_autoon_onoff_cont, LV_OBJ_PART_MAIN, &wifi_setup_style ); lv_obj_align( wifi_autoon_onoff_cont, wifi_setup_tile, LV_ALIGN_IN_TOP_RIGHT, 0, 75 ); @@ -344,7 +344,7 @@ void wlan_setup_tile_setup( uint32_t wifi_setup_tile_num ) { lv_obj_align( wifi_autoon_label, wifi_autoon_onoff_cont, LV_ALIGN_IN_LEFT_MID, 5, 0 ); lv_obj_t *wifi_webserver_onoff_cont = lv_obj_create( wifi_setup_tile, NULL ); - lv_obj_set_size(wifi_webserver_onoff_cont, LV_HOR_RES_MAX , 40); + lv_obj_set_size(wifi_webserver_onoff_cont, lv_disp_get_hor_res( NULL ) , 40); lv_obj_add_style( wifi_webserver_onoff_cont, LV_OBJ_PART_MAIN, &wifi_setup_style ); lv_obj_align( wifi_webserver_onoff_cont, wifi_autoon_onoff_cont, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 ); diff --git a/src/gui/screenshot.cpp b/src/gui/screenshot.cpp index 07a2321..fe6ce17 100644 --- a/src/gui/screenshot.cpp +++ b/src/gui/screenshot.cpp @@ -27,7 +27,7 @@ uint16_t *png; static void screenshot_disp_flush( lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p ); void screenshot_setup( void ) { - png = (uint16_t*)ps_malloc( LV_HOR_RES_MAX * LV_VER_RES_MAX * sizeof( lv_color_t ) ); + png = (uint16_t*)ps_malloc( lv_disp_get_hor_res( NULL ) * lv_disp_get_ver_res( NULL ) * sizeof( lv_color_t ) ); if ( png == NULL ) { log_e("error memory alloc"); while(1); @@ -50,7 +50,7 @@ void screenshot_save( void ) { SPIFFS.remove( SCREENSHOT_FILE_NAME ); fs::File file = SPIFFS.open( SCREENSHOT_FILE_NAME, FILE_WRITE ); - file.write( (uint8_t *)png, LV_HOR_RES_MAX * LV_VER_RES_MAX * 2 ); + file.write( (uint8_t *)png, lv_disp_get_hor_res( NULL ) * lv_disp_get_ver_res( NULL ) * 2 ); file.close(); } @@ -61,7 +61,7 @@ static void screenshot_disp_flush( lv_disp_drv_t *disp_drv, const lv_area_t *are for(y = area->y1; y <= area->y2; y++) { for(x = area->x1; x <= area->x2; x++) { - *(png + (y * LV_HOR_RES_MAX + x )) = *data; + *(png + (y * lv_disp_get_hor_res( NULL ) + x )) = *data; data++; } } diff --git a/src/gui/screenshot.h b/src/gui/screenshot.h index 9055a1e..7831105 100644 --- a/src/gui/screenshot.h +++ b/src/gui/screenshot.h @@ -39,6 +39,7 @@ */ void screenshot_save( void ); +/* struct PNG_IMAGE { uint8_t png[ 8 ]; uint32_t IHDR_len; @@ -59,5 +60,6 @@ uint8_t IEND[ 4 ]; uint32_t IEND_crc; } __attribute__((packed)); +*/ #endif // _SCREENSHOT_H \ No newline at end of file diff --git a/src/gui/splashscreen.cpp b/src/gui/splashscreen.cpp index 3513370..b337393 100644 --- a/src/gui/splashscreen.cpp +++ b/src/gui/splashscreen.cpp @@ -39,12 +39,12 @@ void splash_screen_stage_one( void ) { lv_style_set_text_color(&style, LV_OBJ_PART_MAIN, LV_COLOR_WHITE); lv_obj_t *background = lv_bar_create(lv_scr_act(), NULL); - lv_obj_set_size( background, LV_HOR_RES_MAX, LV_VER_RES_MAX ); + lv_obj_set_size( background, lv_disp_get_hor_res( NULL ), lv_disp_get_ver_res( NULL ) ); lv_obj_add_style( background, LV_OBJ_PART_MAIN, &style ); lv_obj_align(background, NULL, LV_ALIGN_CENTER, 0, 0); preload = lv_bar_create( background, NULL); - lv_obj_set_size(preload, LV_HOR_RES_MAX - 40, 20); + lv_obj_set_size(preload, lv_disp_get_hor_res( NULL ) - 40, 20); lv_obj_add_style( preload, LV_OBJ_PART_MAIN, &style ); lv_obj_align(preload, NULL, LV_ALIGN_CENTER, 0, 0); lv_bar_set_anim_time(preload, 2000); diff --git a/src/hardware/touch.cpp b/src/hardware/touch.cpp index 93cb916..b5209c7 100644 --- a/src/hardware/touch.cpp +++ b/src/hardware/touch.cpp @@ -79,10 +79,10 @@ static bool touch_getXY( int16_t &x, int16_t &y ) { } // issue https://github.com/sharandac/My-TTGO-Watch/issues/18 fix - float temp_x = ( x - ( LV_HOR_RES_MAX / 2 ) ) * 1.15; - float temp_y = ( y - ( LV_VER_RES_MAX / 2 ) ) * 1.0; - x = temp_x + ( LV_HOR_RES_MAX / 2 ); - y = temp_y + ( LV_VER_RES_MAX / 2 ); + float temp_x = ( x - ( lv_disp_get_hor_res( NULL ) / 2 ) ) * 1.15; + float temp_y = ( y - ( lv_disp_get_ver_res( NULL ) / 2 ) ) * 1.0; + x = temp_x + ( lv_disp_get_hor_res( NULL ) / 2 ); + y = temp_y + ( lv_disp_get_ver_res( NULL ) / 2 ); return( true ); }