From 6e8802399b76e05c3699e9d7fbb905f93356f6dd Mon Sep 17 00:00:00 2001 From: anschrammh Date: Tue, 16 May 2023 08:42:09 +0200 Subject: [PATCH] music_player_screen slight timer update --- .../lv_port_win_codeblocks/LittlevGL.layout | 852 +++++++++--------- .../lv_port_win_codeblocks/main.c | 2 +- .../music_player_screen.c | 8 +- 3 files changed, 431 insertions(+), 431 deletions(-) diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout index dfee90e..173d4d6 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout @@ -2,34 +2,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - - - - - - - - + @@ -42,19 +122,19 @@ - + - + - + - + - + - + @@ -62,99 +142,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -162,9 +152,14 @@ - + - + + + + + + @@ -172,59 +167,14 @@ - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -232,23 +182,324 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + @@ -263,261 +514,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/main.c b/src/lvgl_win_sim/lv_port_win_codeblocks/main.c index c732ce1..1a7a706 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/main.c +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/main.c @@ -120,7 +120,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLi music_player_screen_set_playing_music_title_and_artist(&musicPlayerScreen, "Sun Is Up Hoho Haha", "Inna"); music_player_screen_notify_BLE_connection_state(&musicPlayerScreen, true); music_player_screen_set_music_duration(&musicPlayerScreen, 3*60+42); - music_player_screen_set_music_position(&musicPlayerScreen, 24); + music_player_screen_set_music_position(&musicPlayerScreen, 3*60+12); //music_player_screen_set_music_playing_state(&musicPlayerScreen, MUSIC_CONTROL_PLAY); altimeter_screen_register_measurement_cb(&altimeterScreen, &(alti_meas_cb)); diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/music_player_screen.c b/src/lvgl_win_sim/lv_port_win_codeblocks/music_player_screen.c index 51d794b..396ae0f 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/music_player_screen.c +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/music_player_screen.c @@ -175,9 +175,11 @@ void music_player_screen_set_music_position(MusicPlayerScreen_t * const musicPla return; } - if(positionInSeconds > musicPlayerScreen->currentMusicDuration) positionInSeconds = musicPlayerScreen->currentMusicDuration; + LV_LOG_USER("%d %d", musicPlayerScreen->currentMusicPosition , musicPlayerScreen->currentMusicDuration); + positionInSeconds = positionInSeconds > musicPlayerScreen->currentMusicDuration ? musicPlayerScreen->currentMusicDuration : positionInSeconds; musicPlayerScreen->currentMusicPosition = positionInSeconds; + //If the widget is currently displayed, we update it as well ! if(!musicPlayerScreen->playbackArc) return; @@ -201,6 +203,7 @@ void music_player_screen_set_music_playing_state(MusicPlayerScreen_t * const mus if(playingState != MUSIC_CONTROL_PAUSE && playingState != MUSIC_CONTROL_PLAY) return; musicPlayerScreen->currentPlayState = playingState; + if(musicPlayerScreen->currentPlayState == MUSIC_CONTROL_PLAY) lv_timer_resume(musicPlayerScreen->timePositionTimer); else @@ -397,6 +400,7 @@ void music_player_screen_create(MusicPlayerScreen_t * const musicPlayerScreen) lv_obj_align(musicPlayerScreen->playbackArc, LV_ALIGN_CENTER, 0,0); lv_obj_set_size(musicPlayerScreen->playbackArc, 240, 240); lv_obj_set_style_arc_color(musicPlayerScreen->playbackArc, lv_palette_main(LV_PALETTE_LIME), LV_PART_INDICATOR); + lv_obj_set_style_arc_color(musicPlayerScreen->playbackArc, lv_color_make(100,100,100), LV_PART_MAIN); music_player_screen_set_music_duration(musicPlayerScreen, musicPlayerScreen->currentMusicDuration); music_player_screen_set_music_position(musicPlayerScreen, musicPlayerScreen->currentMusicPosition); @@ -409,7 +413,7 @@ void music_player_screen_create(MusicPlayerScreen_t * const musicPlayerScreen) musicPlayerScreen->timePositionTimer = NULL; } musicPlayerScreen->timePositionTimer = lv_timer_create(&(track_position_update_cb), 1000, musicPlayerScreen); - lv_timer_pause(musicPlayerScreen->timePositionTimer); + if(musicPlayerScreen->currentPlayState != MUSIC_CONTROL_PLAY) lv_timer_pause(musicPlayerScreen->timePositionTimer); //We register the event callback to handle gestures lv_obj_add_event_cb(musicPlayerScreen->display, &(gesture_event_cb), LV_EVENT_GESTURE, musicPlayerScreen);