From 03de1c67393fcb99b5987514be6f470349c57c0f Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 4 Apr 2021 12:10:47 +0200 Subject: Add support for notification title. The notification buffer must contain the title and the message separated by a '\0' character. If the buffer does not contain any \0, the whole buffer is considered to be the message of the notification. A default title will be displayed in the notification app. --- src/components/ble/MusicService.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/components/ble/MusicService.cpp') diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index bd6e27fb..e37e3831 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -191,7 +191,6 @@ int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_ data[notifSize] = '\0'; os_mbuf_copydata(ctxt->om, 0, notifSize, data); char *s = (char *) &data[0]; - NRF_LOG_INFO("DATA : %s", s); if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msArtistCharUuid) == 0) { artistName = s; } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msTrackCharUuid) == 0) { -- cgit v1.2.3-70-g09d2 From f8b9a7c06081df68b34defd8df4a5ae39b390237 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 4 Apr 2021 17:19:41 +0200 Subject: 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) --- src/components/ble/MusicService.cpp | 2 +- src/displayapp/screens/Music.cpp | 22 +++++++++++++--------- src/displayapp/screens/Music.h | 2 +- src/libs/lv_conf.h | 4 ++-- 4 files changed, 17 insertions(+), 13 deletions(-) (limited to 'src/components/ble/MusicService.cpp') diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index bd6e27fb..b02e743a 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -164,7 +164,7 @@ Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask & artistName = "Waiting for"; albumName = ""; - trackName = "track information..."; + trackName = "track information.."; playing = false; repeat = false; shuffle = false; diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index b68f3781..2a0aa052 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 66bde21b..c4f4cbef 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; diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index 7a800b31..e16769cd 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -140,7 +140,7 @@ typedef int16_t lv_coord_t; *==================*/ /*1: Enable the Animations */ -#define LV_USE_ANIMATION 0 +#define LV_USE_ANIMATION 1 #if LV_USE_ANIMATION /*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ @@ -177,7 +177,7 @@ typedef void* lv_anim_user_data_t; #define LV_USE_IMG_TRANSFORM 0 /* 1: Enable object groups (for keyboard/encoder navigation) */ -#define LV_USE_GROUP 1 +#define LV_USE_GROUP 0 #if LV_USE_GROUP typedef void* lv_group_user_data_t; #endif /*LV_USE_GROUP*/ -- cgit v1.2.3-70-g09d2