Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhedger <hedger@users.noreply.github.com>2022-07-26 15:44:03 +0300
committerGitHub <noreply@github.com>2022-07-26 15:44:03 +0300
commit3fa5e18c5a2c17fc666c2b767d90187bb5f30c3a (patch)
tree9bb44ad8ad44c4471aa2411cae9d0fbe3f446a46
parent056446dfed68931b9997cd3d7600f655809243c4 (diff)
[FL-2692, FL-2604, FL-2632] New first start sequence (#1456)
* 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: あく <alleteam@gmail.com>
-rw-r--r--applications/desktop/scenes/desktop_scene_slideshow.c8
-rw-r--r--applications/desktop/views/desktop_events.h1
-rw-r--r--applications/desktop/views/desktop_view_slideshow.c28
-rw-r--r--assets/slideshow/first_start/frame_00.pngbin0 -> 602 bytes
-rw-r--r--assets/slideshow/first_start/frame_01.pngbin0 -> 558 bytes
-rw-r--r--assets/slideshow/first_start/frame_02.pngbin0 -> 562 bytes
-rw-r--r--assets/slideshow/first_start/frame_03.pngbin0 -> 595 bytes
-rw-r--r--assets/slideshow/first_start/frame_04.pngbin0 -> 548 bytes
-rw-r--r--assets/slideshow/first_start/frame_05.pngbin0 -> 579 bytes
-rw-r--r--scripts/ReadMe.md13
10 files changed, 49 insertions, 1 deletions
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 <power/power_service/power.h>
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 <furi_hal.h>
#include <gui/elements.h>
-#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 00000000..67f23bd3
--- /dev/null
+++ b/assets/slideshow/first_start/frame_00.png
Binary files differ
diff --git a/assets/slideshow/first_start/frame_01.png b/assets/slideshow/first_start/frame_01.png
new file mode 100644
index 00000000..5ac995c3
--- /dev/null
+++ b/assets/slideshow/first_start/frame_01.png
Binary files differ
diff --git a/assets/slideshow/first_start/frame_02.png b/assets/slideshow/first_start/frame_02.png
new file mode 100644
index 00000000..dc1080ab
--- /dev/null
+++ b/assets/slideshow/first_start/frame_02.png
Binary files differ
diff --git a/assets/slideshow/first_start/frame_03.png b/assets/slideshow/first_start/frame_03.png
new file mode 100644
index 00000000..bd6ae73f
--- /dev/null
+++ b/assets/slideshow/first_start/frame_03.png
Binary files differ
diff --git a/assets/slideshow/first_start/frame_04.png b/assets/slideshow/first_start/frame_04.png
new file mode 100644
index 00000000..59f62dcc
--- /dev/null
+++ b/assets/slideshow/first_start/frame_04.png
Binary files differ
diff --git a/assets/slideshow/first_start/frame_05.png b/assets/slideshow/first_start/frame_05.png
new file mode 100644
index 00000000..3682c6d0
--- /dev/null
+++ b/assets/slideshow/first_start/frame_05.png
Binary files differ
diff --git a/scripts/ReadMe.md b/scripts/ReadMe.md
index 86b5b8af..d0630395 100644
--- a/scripts/ReadMe.md
+++ b/scripts/ReadMe.md
@@ -58,3 +58,16 @@ Run in the root folder of the repo:
```bash
python scripts/storage.py -p <flipper_cli_port> 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