From 3fa5e18c5a2c17fc666c2b767d90187bb5f30c3a Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 26 Jul 2022 15:44:03 +0300 Subject: [PATCH] [FL-2692, FL-2604, FL-2632] New first start sequence (#1456) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * desktop: restored automatic power off & manual power off on slideshow view; assets: added frames for new first start sequence; docs: added info on slideshow compilation * desktop: restarting long timer on OK button release Co-authored-by: あく --- .../desktop/scenes/desktop_scene_slideshow.c | 8 +++++ applications/desktop/views/desktop_events.h | 1 + .../desktop/views/desktop_view_slideshow.c | 28 +++++++++++++++++- assets/slideshow/first_start/frame_00.png | Bin 0 -> 602 bytes assets/slideshow/first_start/frame_01.png | Bin 0 -> 558 bytes assets/slideshow/first_start/frame_02.png | Bin 0 -> 562 bytes assets/slideshow/first_start/frame_03.png | Bin 0 -> 595 bytes assets/slideshow/first_start/frame_04.png | Bin 0 -> 548 bytes assets/slideshow/first_start/frame_05.png | Bin 0 -> 579 bytes scripts/ReadMe.md | 13 ++++++++ 10 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 assets/slideshow/first_start/frame_00.png create mode 100644 assets/slideshow/first_start/frame_01.png create mode 100644 assets/slideshow/first_start/frame_02.png create mode 100644 assets/slideshow/first_start/frame_03.png create mode 100644 assets/slideshow/first_start/frame_04.png create mode 100644 assets/slideshow/first_start/frame_05.png diff --git a/applications/desktop/scenes/desktop_scene_slideshow.c b/applications/desktop/scenes/desktop_scene_slideshow.c index 18460a4c..cab7bf62 100644 --- a/applications/desktop/scenes/desktop_scene_slideshow.c +++ b/applications/desktop/scenes/desktop_scene_slideshow.c @@ -3,6 +3,7 @@ #include "../desktop_i.h" #include "../views/desktop_view_slideshow.h" #include "../views/desktop_events.h" +#include void desktop_scene_slideshow_callback(DesktopEvent event, void* context) { Desktop* desktop = (Desktop*)context; @@ -22,6 +23,7 @@ bool desktop_scene_slideshow_on_event(void* context, SceneManagerEvent event) { Desktop* desktop = (Desktop*)context; bool consumed = false; Storage* storage = NULL; + Power* power = NULL; if(event.type == SceneManagerEventTypeCustom) { switch(event.event) { @@ -32,6 +34,12 @@ bool desktop_scene_slideshow_on_event(void* context, SceneManagerEvent event) { scene_manager_previous_scene(desktop->scene_manager); consumed = true; break; + case DesktopSlideshowPoweroff: + power = furi_record_open(RECORD_POWER); + power_off(power); + furi_record_close(RECORD_POWER); + consumed = true; + break; default: break; diff --git a/applications/desktop/views/desktop_events.h b/applications/desktop/views/desktop_events.h index 4ff5f795..5d130be9 100644 --- a/applications/desktop/views/desktop_events.h +++ b/applications/desktop/views/desktop_events.h @@ -35,6 +35,7 @@ typedef enum { DesktopAnimationEventInteractAnimation, DesktopSlideshowCompleted, + DesktopSlideshowPoweroff, // Global events DesktopGlobalBeforeAppStarted, diff --git a/applications/desktop/views/desktop_view_slideshow.c b/applications/desktop/views/desktop_view_slideshow.c index 943206e1..26ae95ea 100644 --- a/applications/desktop/views/desktop_view_slideshow.c +++ b/applications/desktop/views/desktop_view_slideshow.c @@ -2,15 +2,19 @@ #include #include -#include "../desktop_i.h" #include "desktop_view_slideshow.h" +#include "../desktop_i.h" #include "../helpers/slideshow.h" #include "../helpers/slideshow_filename.h" +#define DESKTOP_SLIDESHOW_POWEROFF_SHORT 5000 +#define DESKTOP_SLIDESHOW_POWEROFF_LONG (60 * 60 * 1000) + struct DesktopSlideshowView { View* view; DesktopSlideshowViewCallback callback; void* context; + FuriTimer* timer; }; typedef struct { @@ -51,14 +55,32 @@ static bool desktop_view_slideshow_input(InputEvent* event, void* context) { instance->callback(DesktopSlideshowCompleted, instance->context); } view_commit_model(instance->view, true); + } else if(event->key == InputKeyOk) { + if(event->type == InputTypePress) { + furi_timer_start(instance->timer, DESKTOP_SLIDESHOW_POWEROFF_SHORT); + } else if(event->type == InputTypeRelease) { + furi_timer_stop(instance->timer); + furi_timer_start(instance->timer, DESKTOP_SLIDESHOW_POWEROFF_LONG); + } } return true; } +static void desktop_first_start_timer_callback(void* context) { + DesktopSlideshowView* instance = context; + instance->callback(DesktopSlideshowPoweroff, instance->context); +} + static void desktop_view_slideshow_enter(void* context) { DesktopSlideshowView* instance = context; + furi_assert(instance->timer == NULL); + instance->timer = + furi_timer_alloc(desktop_first_start_timer_callback, FuriTimerTypeOnce, instance); + + furi_timer_start(instance->timer, DESKTOP_SLIDESHOW_POWEROFF_LONG); + DesktopSlideshowViewModel* model = view_get_model(instance->view); model->slideshow = slideshow_alloc(); if(!slideshow_load(model->slideshow, SLIDESHOW_FS_PATH)) { @@ -70,6 +92,10 @@ static void desktop_view_slideshow_enter(void* context) { static void desktop_view_slideshow_exit(void* context) { DesktopSlideshowView* instance = context; + furi_timer_stop(instance->timer); + furi_timer_free(instance->timer); + instance->timer = NULL; + DesktopSlideshowViewModel* model = view_get_model(instance->view); slideshow_free(model->slideshow); view_commit_model(instance->view, false); diff --git a/assets/slideshow/first_start/frame_00.png b/assets/slideshow/first_start/frame_00.png new file mode 100644 index 0000000000000000000000000000000000000000..67f23bd31b596fdf57d3b8bff62b2e6d2a03070a GIT binary patch literal 602 zcmV-g0;TPx#1ZP1_K>z@;j|==^1poj522e~?MgRZ*00010!qa{L000SaNLh0L01FcU01FcV z0GgZ_0005qNklf1jQIb5Ot-FLBM) o8C$9X3)L09%Gjx{=!^ik1;ah0>A+VwJ^%m!07*qoM6N<$f@V(tCIA2c literal 0 HcmV?d00001 diff --git a/assets/slideshow/first_start/frame_01.png b/assets/slideshow/first_start/frame_01.png new file mode 100644 index 0000000000000000000000000000000000000000..5ac995c3976340eeb6607218c872e43363879ba0 GIT binary patch literal 558 zcmV+}0@3}6P)Px#1ZP1_K>z@;j|==^1poj522e~?MgRZ*00010!qa{L000SaNLh0L01FcU01FcV z0GgZ_00058Nkl(1eeS1-S74`v$I40wx#0;{eCP> z<93}+(EH{s4^7IT*9HP26;TpTXT>QbF<_C-XbLGabjDXl4FLyGCc3z-9}YA_7Jy#| za4p~h90LRS1k-t)&iFj+3wW53u;ak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*2%@Mw}Wqh(3~F_C3>Ur=97837Ke`3^1*>5{FWm1&Q|i?`{d2)aqXnaz1I4 zfahJsR?4HFWkh}jtuhDBXmlTcX;0@>KNuEP9SqO%I(+$1j}V`?e%GM0efWo{d^-%E huPx#1ZP1_K>z@;j|==^1poj522e~?MgRZ*00010!qa{L000SaNLh0L01FcU01FcV z0GgZ_0004}NklB4*$GWC(}0K=P`9o z@IeQ(Hz5HTfB@pa8_*1hU@<|yC!fL=!Mbq z2y6x#!_&O`?pn%cph^In7uBY##5im+#HL_yFhi9lIanb`a7ZYibd8^o5Hy-v60Ksr z@M_%b4=5kR&_HXqw!3Gv-4)DB#Ge(MGQ1<}Bb`^Uy;p0y0?R$5iw2s7$HME*VPl}+ zGlp}{t$shppyP5@SOD@5;6T$9*oc43z!Atk48=%C^JGw7Eq82z1=`sQoeR6`yLnT< zG->Y`>I4;A_!-)21+{$NwH&-MKK7>~sWtD>w1O;8^L2j6fnjMij&- m3WgS`1HQUa;bryT0NNKHvxH{lzhQO&0000Px#1ZP1_K>z@;j|==^1poj522e~?MgRZ*00010!qa{L000SaNLh0L01FcU01FcV z0GgZ_0005TNklYE7y$6^(psZLjkRC|#Z(ftTe>+2mZA>DLBv@y`2<46 z#ZwR(2(fAxp`e3(2PX-Z79F&&5W&IG(Lspc-6b~l6+B4p_}$%iANL3Td07iZ`HZ0y z)iV2q0RW9a!EczZ0@Nt)RvE0q@E`<0d^nrQd%I63_A`}K%)>4vK%4go21ZyXIs+Ncit=+QaTp)NCT^P7Eq2=XJ}4{uI1#}qR5tRa z4vL*iLI8@-K#l=pP_~1(N6uoglQ%F19l=%X#Oc$~37DV>xXl5-HGMEd;}`0WqH)d- z1EEJmAGH send assets/resources /ext ``` + + +# Slideshow creation + +Put fullscreen slideshow frames in .png format into `assets/slideshow/my_show` folder, named frame_xx.png, where xx is zero-padded frame number, starting with #0. + +Then run + +```bash +python scripts/slideshow.py -i assets/slideshow/my_show/ -o assets/slideshow/my_show/.slideshow +``` + +Upload generated .slideshow file to Flipper's internal storage and restart it. \ No newline at end of file