diff options
| author | Jean-François Milants <jf@codingfield.com> | 2021-04-04 15:19:41 (GMT) |
|---|---|---|
| committer | Jean-François Milants <jf@codingfield.com> | 2021-04-04 15:19:41 (GMT) |
| commit | f8b9a7c06081df68b34defd8df4a5ae39b390237 (patch) | |
| tree | 16a2719a570c6e92eb69e6dd075ab479d1c7d47d /src/displayapp | |
| parent | 04fc33e2d479161ec261f932b908dffbd73e227f (diff) | |
Fix music app :
- Enable LVGL animation (and disable groups, which were not used), and set the speed.
- Fix disc animation and progress display by initializing lastIncrement at 0 (a random value will be used otherwise, in release build)
Diffstat (limited to 'src/displayapp')
| -rw-r--r-- | src/displayapp/screens/Music.cpp | 22 | ||||
| -rw-r--r-- | src/displayapp/screens/Music.h | 2 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index b68f378..2a0aa05 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -98,24 +98,28 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus lv_label_set_text(txtTrackDuration, "--:--/--:--"); lv_label_set_align(txtTrackDuration, LV_ALIGN_IN_LEFT_MID); lv_obj_set_width(txtTrackDuration, LV_HOR_RES); - + constexpr uint8_t FONT_HEIGHT = 12; constexpr uint8_t LINE_PAD = 15; constexpr int8_t MIDDLE_OFFSET = -25; txtArtist = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL); + lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL_CIRC); + lv_label_set_anim_speed(txtArtist, 1); lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT); - lv_label_set_text(txtArtist, "Artist Name"); lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID); - lv_obj_set_width(txtArtist, LV_HOR_RES); - + lv_obj_set_width(txtArtist, LV_HOR_RES-12); + lv_label_set_text(txtArtist, "Artist Name"); + + txtTrack = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL); + lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC); + lv_label_set_anim_speed(txtTrack, 1); lv_obj_align(txtTrack, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 2 * FONT_HEIGHT + LINE_PAD); - lv_label_set_text(txtTrack, "This is a very long getTrack name"); + lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID); - lv_obj_set_width(txtTrack, LV_HOR_RES); - + lv_obj_set_width(txtTrack, LV_HOR_RES-12); + lv_label_set_text(txtTrack, "This is a very long getTrack name"); + /** Init animation */ imgDisc = lv_img_create(lv_scr_act(), nullptr); lv_img_set_src_arr(imgDisc, &disc); diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index 66bde21..c4f4cbe 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -76,7 +76,7 @@ namespace Pinetime { /** Last length */ int lastLength; /** Last time an animation update or timer was incremented */ - TickType_t lastIncrement; + TickType_t lastIncrement = 0; bool playing; |
