|
@@ -44,21 +44,21 @@ static void draw_callback(Canvas* canvas, void* ctx) {
|
|
|
char temp_str[36];
|
|
char temp_str[36];
|
|
|
canvas_clear(canvas);
|
|
canvas_clear(canvas);
|
|
|
canvas_set_font(canvas, FontPrimary);
|
|
canvas_set_font(canvas, FontPrimary);
|
|
|
- switch (Count) {
|
|
|
|
|
|
|
+ switch(Count) {
|
|
|
case -1:
|
|
case -1:
|
|
|
- snprintf(temp_str,sizeof(temp_str),"Set: BULB %li sec",Time);
|
|
|
|
|
|
|
+ snprintf(temp_str, sizeof(temp_str), "Set: BULB %li sec", Time);
|
|
|
break;
|
|
break;
|
|
|
case 0:
|
|
case 0:
|
|
|
- snprintf(temp_str,sizeof(temp_str),"Set: infinite, %li sec",Time);
|
|
|
|
|
|
|
+ snprintf(temp_str, sizeof(temp_str), "Set: infinite, %li sec", Time);
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
- snprintf(temp_str,sizeof(temp_str),"Set: %li frames, %li sec",Count,Time);
|
|
|
|
|
|
|
+ snprintf(temp_str, sizeof(temp_str), "Set: %li frames, %li sec", Count, Time);
|
|
|
}
|
|
}
|
|
|
canvas_draw_str(canvas, 3, 15, temp_str);
|
|
canvas_draw_str(canvas, 3, 15, temp_str);
|
|
|
- snprintf(temp_str,sizeof(temp_str),"Left: %li frames, %li sec",WorkCount,WorkTime);
|
|
|
|
|
|
|
+ snprintf(temp_str, sizeof(temp_str), "Left: %li frames, %li sec", WorkCount, WorkTime);
|
|
|
canvas_draw_str(canvas, 3, 35, temp_str);
|
|
canvas_draw_str(canvas, 3, 35, temp_str);
|
|
|
|
|
|
|
|
- switch (Backlight) {
|
|
|
|
|
|
|
+ switch(Backlight) {
|
|
|
case 1:
|
|
case 1:
|
|
|
canvas_draw_str(canvas, 13, 55, "ON");
|
|
canvas_draw_str(canvas, 13, 55, "ON");
|
|
|
break;
|
|
break;
|
|
@@ -69,34 +69,32 @@ static void draw_callback(Canvas* canvas, void* ctx) {
|
|
|
canvas_draw_str(canvas, 13, 55, "AUTO");
|
|
canvas_draw_str(canvas, 13, 55, "AUTO");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(Work){
|
|
|
|
|
|
|
+ if(Work) {
|
|
|
canvas_draw_icon(canvas, 85, 41, &I_ButtonUpHollow_7x4);
|
|
canvas_draw_icon(canvas, 85, 41, &I_ButtonUpHollow_7x4);
|
|
|
canvas_draw_icon(canvas, 85, 57, &I_ButtonDownHollow_7x4);
|
|
canvas_draw_icon(canvas, 85, 57, &I_ButtonDownHollow_7x4);
|
|
|
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeftHollow_4x7);
|
|
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeftHollow_4x7);
|
|
|
canvas_draw_icon(canvas, 72, 48, &I_ButtonRightHollow_4x7);
|
|
canvas_draw_icon(canvas, 72, 48, &I_ButtonRightHollow_4x7);
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } else {
|
|
|
canvas_draw_icon(canvas, 85, 41, &I_ButtonUp_7x4);
|
|
canvas_draw_icon(canvas, 85, 41, &I_ButtonUp_7x4);
|
|
|
canvas_draw_icon(canvas, 85, 57, &I_ButtonDown_7x4);
|
|
canvas_draw_icon(canvas, 85, 57, &I_ButtonDown_7x4);
|
|
|
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
|
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
|
|
canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
|
canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
canvas_draw_icon(canvas, 3, 48, &I_Pin_star_7x7);
|
|
canvas_draw_icon(canvas, 3, 48, &I_Pin_star_7x7);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
canvas_set_font(canvas, FontPrimary);
|
|
canvas_set_font(canvas, FontPrimary);
|
|
|
canvas_draw_str(canvas, 65, 55, "F");
|
|
canvas_draw_str(canvas, 65, 55, "F");
|
|
|
|
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
|
canvas_set_font(canvas, FontPrimary);
|
|
|
canvas_draw_str(canvas, 85, 55, "S");
|
|
canvas_draw_str(canvas, 85, 55, "S");
|
|
|
|
|
|
|
|
-
|
|
|
|
|
//canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
|
//canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
|
|
//canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
|
//canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
|
|
|
|
|
|
|
- if(Work) {canvas_draw_icon(canvas, 106, 46, &I_loading_10px);}
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(Work) {
|
|
|
|
|
+ canvas_draw_icon(canvas, 106, 46, &I_loading_10px);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void input_callback(InputEvent* input_event, void* ctx) {
|
|
static void input_callback(InputEvent* input_event, void* ctx) {
|
|
@@ -118,7 +116,7 @@ static void timer_callback(FuriMessageQueue* event_queue) {
|
|
|
|
|
|
|
|
int32_t zeitraffer_app(void* p) {
|
|
int32_t zeitraffer_app(void* p) {
|
|
|
UNUSED(p);
|
|
UNUSED(p);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Текущее событие типа кастомного типа ZeitrafferEvent
|
|
// Текущее событие типа кастомного типа ZeitrafferEvent
|
|
|
ZeitrafferEvent event;
|
|
ZeitrafferEvent event;
|
|
|
// Очередь событий на 8 элементов размера ZeitrafferEvent
|
|
// Очередь событий на 8 элементов размера ZeitrafferEvent
|
|
@@ -136,7 +134,7 @@ int32_t zeitraffer_app(void* p) {
|
|
|
Gui* gui = furi_record_open(RECORD_GUI);
|
|
Gui* gui = furi_record_open(RECORD_GUI);
|
|
|
// Подключаем view port к GUI в полноэкранном режиме
|
|
// Подключаем view port к GUI в полноэкранном режиме
|
|
|
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
|
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Конфигурим пины
|
|
// Конфигурим пины
|
|
|
gpio_item_configure_all_pins(GpioModeOutputPushPull);
|
|
gpio_item_configure_all_pins(GpioModeOutputPushPull);
|
|
|
|
|
|
|
@@ -148,58 +146,72 @@ int32_t zeitraffer_app(void* p) {
|
|
|
|
|
|
|
|
// Включаем нотификации
|
|
// Включаем нотификации
|
|
|
NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
|
|
NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Загружаем настройки
|
|
// Загружаем настройки
|
|
|
FlipperFormat* load = flipper_format_file_alloc(storage);
|
|
FlipperFormat* load = flipper_format_file_alloc(storage);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
do {
|
|
do {
|
|
|
- if(!storage_simply_mkdir(storage, CONFIG_FILE_DIRECTORY_PATH)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_file_open_existing(load, CONFIG_FILE_PATH)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_read_int32(load, "Time", &Time, 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_read_int32(load, "Count", &Count, 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_read_int32(load, "Backlight", &Backlight, 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_read_int32(load, "Delay", &Delay, 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
|
|
+ if(!storage_simply_mkdir(storage, CONFIG_FILE_DIRECTORY_PATH)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_file_open_existing(load, CONFIG_FILE_PATH)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_read_int32(load, "Time", &Time, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_read_int32(load, "Count", &Count, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_read_int32(load, "Backlight", &Backlight, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_read_int32(load, "Delay", &Delay, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
notification_message(notifications, &sequence_success);
|
|
notification_message(notifications, &sequence_success);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
} while(0);
|
|
} while(0);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
flipper_format_free(load);
|
|
flipper_format_free(load);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Бесконечный цикл обработки очереди событий
|
|
// Бесконечный цикл обработки очереди событий
|
|
|
while(1) {
|
|
while(1) {
|
|
|
// Выбираем событие из очереди в переменную event (ждем бесконечно долго, если очередь пуста)
|
|
// Выбираем событие из очереди в переменную event (ждем бесконечно долго, если очередь пуста)
|
|
|
// и проверяем, что у нас получилось это сделать
|
|
// и проверяем, что у нас получилось это сделать
|
|
|
furi_check(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk);
|
|
furi_check(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk);
|
|
|
|
|
|
|
|
- // Наше событие — это нажатие кнопки
|
|
|
|
|
|
|
+ // Наше событие — это нажатие кнопки
|
|
|
if(event.type == EventTypeInput) {
|
|
if(event.type == EventTypeInput) {
|
|
|
if(event.input.type == InputTypeShort) { // Короткие нажатия
|
|
if(event.input.type == InputTypeShort) { // Короткие нажатия
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if(event.input.key == InputKeyBack) {
|
|
if(event.input.key == InputKeyBack) {
|
|
|
if(Work) { // Если таймер запущен - нефиг мацать кнопки!
|
|
if(Work) { // Если таймер запущен - нефиг мацать кнопки!
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
WorkCount = Count;
|
|
WorkCount = Count;
|
|
|
WorkTime = 3;
|
|
WorkTime = 3;
|
|
|
- if (Count == 0) {
|
|
|
|
|
- InfiniteShot = true;
|
|
|
|
|
|
|
+ if(Count == 0) {
|
|
|
|
|
+ InfiniteShot = true;
|
|
|
WorkCount = 1;
|
|
WorkCount = 1;
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ } else
|
|
|
InfiniteShot = false;
|
|
InfiniteShot = false;
|
|
|
-
|
|
|
|
|
- notification_message(notifications, &sequence_success);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ notification_message(notifications, &sequence_success);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(event.input.key == InputKeyRight) {
|
|
if(event.input.key == InputKeyRight) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
Count++;
|
|
Count++;
|
|
|
notification_message(notifications, &sequence_click);
|
|
notification_message(notifications, &sequence_click);
|
|
|
}
|
|
}
|
|
@@ -207,17 +219,15 @@ int32_t zeitraffer_app(void* p) {
|
|
|
if(event.input.key == InputKeyLeft) {
|
|
if(event.input.key == InputKeyLeft) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
Count--;
|
|
Count--;
|
|
|
- notification_message(notifications, &sequence_click);
|
|
|
|
|
|
|
+ notification_message(notifications, &sequence_click);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(event.input.key == InputKeyUp) {
|
|
if(event.input.key == InputKeyUp) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
Time++;
|
|
Time++;
|
|
|
notification_message(notifications, &sequence_click);
|
|
notification_message(notifications, &sequence_click);
|
|
|
}
|
|
}
|
|
@@ -225,49 +235,41 @@ int32_t zeitraffer_app(void* p) {
|
|
|
if(event.input.key == InputKeyDown) {
|
|
if(event.input.key == InputKeyDown) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
Time--;
|
|
Time--;
|
|
|
notification_message(notifications, &sequence_click);
|
|
notification_message(notifications, &sequence_click);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(event.input.key == InputKeyOk) {
|
|
if(event.input.key == InputKeyOk) {
|
|
|
-
|
|
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_click);
|
|
notification_message(notifications, &sequence_click);
|
|
|
- furi_timer_stop(timer);
|
|
|
|
|
|
|
+ furi_timer_stop(timer);
|
|
|
Work = false;
|
|
Work = false;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
furi_timer_start(timer, 1000);
|
|
furi_timer_start(timer, 1000);
|
|
|
Work = true;
|
|
Work = true;
|
|
|
-
|
|
|
|
|
- if (WorkCount == 0)
|
|
|
|
|
- WorkCount = Count;
|
|
|
|
|
-
|
|
|
|
|
- if (WorkTime == 0)
|
|
|
|
|
- WorkTime = Delay;
|
|
|
|
|
-
|
|
|
|
|
- if (Count == 1)
|
|
|
|
|
- WorkTime = Time;
|
|
|
|
|
-
|
|
|
|
|
- if (Count == 0) {
|
|
|
|
|
- InfiniteShot = true;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(WorkCount == 0) WorkCount = Count;
|
|
|
|
|
+
|
|
|
|
|
+ if(WorkTime == 0) WorkTime = Delay;
|
|
|
|
|
+
|
|
|
|
|
+ if(Count == 1) WorkTime = Time;
|
|
|
|
|
+
|
|
|
|
|
+ if(Count == 0) {
|
|
|
|
|
+ InfiniteShot = true;
|
|
|
WorkCount = 1;
|
|
WorkCount = 1;
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ } else
|
|
|
InfiniteShot = false;
|
|
InfiniteShot = false;
|
|
|
-
|
|
|
|
|
- if (Count == -1) {
|
|
|
|
|
- gpio_item_set_pin(4, true);
|
|
|
|
|
- gpio_item_set_pin(5, true);
|
|
|
|
|
- Bulb = true;
|
|
|
|
|
- WorkCount = 1;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(Count == -1) {
|
|
|
|
|
+ gpio_item_set_pin(4, true);
|
|
|
|
|
+ gpio_item_set_pin(5, true);
|
|
|
|
|
+ Bulb = true;
|
|
|
|
|
+ WorkCount = 1;
|
|
|
WorkTime = Time;
|
|
WorkTime = Time;
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- Bulb = false;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ } else
|
|
|
|
|
+ Bulb = false;
|
|
|
|
|
+
|
|
|
notification_message(notifications, &sequence_success);
|
|
notification_message(notifications, &sequence_success);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -277,70 +279,64 @@ int32_t zeitraffer_app(void* p) {
|
|
|
if(event.input.key == InputKeyBack) {
|
|
if(event.input.key == InputKeyBack) {
|
|
|
if(furi_timer_is_running(timer)) { // А если работает таймер - не выходим :D
|
|
if(furi_timer_is_running(timer)) { // А если работает таймер - не выходим :D
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
notification_message(notifications, &sequence_click);
|
|
notification_message(notifications, &sequence_click);
|
|
|
gpio_item_set_all_pins(false);
|
|
gpio_item_set_all_pins(false);
|
|
|
furi_timer_stop(timer);
|
|
furi_timer_stop(timer);
|
|
|
- notification_message(notifications, &sequence_display_backlight_enforce_auto);
|
|
|
|
|
|
|
+ notification_message(
|
|
|
|
|
+ notifications, &sequence_display_backlight_enforce_auto);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(event.input.key == InputKeyOk) {
|
|
if(event.input.key == InputKeyOk) {
|
|
|
// Нам ваша подсветка и нахой не нужна! Или нужна?
|
|
// Нам ваша подсветка и нахой не нужна! Или нужна?
|
|
|
Backlight++;
|
|
Backlight++;
|
|
|
- if (Backlight > 2) Backlight = 0;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(Backlight > 2) Backlight = 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(event.input.type == InputTypeRepeat) { // Зажатые кнопки
|
|
if(event.input.type == InputTypeRepeat) { // Зажатые кнопки
|
|
|
if(event.input.key == InputKeyRight) {
|
|
if(event.input.key == InputKeyRight) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- Count = Count+10;
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Count = Count + 10;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(event.input.key == InputKeyLeft) {
|
|
if(event.input.key == InputKeyLeft) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- Count = Count-10;
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Count = Count - 10;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(event.input.key == InputKeyUp) {
|
|
if(event.input.key == InputKeyUp) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- Time = Time+10;
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Time = Time + 10;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(event.input.key == InputKeyDown) {
|
|
if(event.input.key == InputKeyDown) {
|
|
|
if(furi_timer_is_running(timer)) {
|
|
if(furi_timer_is_running(timer)) {
|
|
|
notification_message(notifications, &sequence_error);
|
|
notification_message(notifications, &sequence_error);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- Time = Time-10;
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Time = Time - 10;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Наше событие — это сработавший таймер
|
|
// Наше событие — это сработавший таймер
|
|
|
else if(event.type == EventTypeTick) {
|
|
else if(event.type == EventTypeTick) {
|
|
|
-
|
|
|
|
|
WorkTime--;
|
|
WorkTime--;
|
|
|
-
|
|
|
|
|
- if( WorkTime < 1 ) { // фоткаем
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(WorkTime < 1) { // фоткаем
|
|
|
notification_message(notifications, &sequence_blink_white_100);
|
|
notification_message(notifications, &sequence_blink_white_100);
|
|
|
- if (Bulb) {
|
|
|
|
|
- gpio_item_set_all_pins(false); WorkCount = 0;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ if(Bulb) {
|
|
|
|
|
+ gpio_item_set_all_pins(false);
|
|
|
|
|
+ WorkCount = 0;
|
|
|
|
|
+ } else {
|
|
|
WorkCount--;
|
|
WorkCount--;
|
|
|
view_port_update(view_port);
|
|
view_port_update(view_port);
|
|
|
notification_message(notifications, &sequence_click);
|
|
notification_message(notifications, &sequence_click);
|
|
@@ -353,62 +349,78 @@ int32_t zeitraffer_app(void* p) {
|
|
|
gpio_item_set_pin(5, false);
|
|
gpio_item_set_pin(5, false);
|
|
|
//gpio_item_set_all_pins(false);
|
|
//gpio_item_set_all_pins(false);
|
|
|
|
|
|
|
|
- if (InfiniteShot) WorkCount++;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(InfiniteShot) WorkCount++;
|
|
|
|
|
+
|
|
|
WorkTime = Time;
|
|
WorkTime = Time;
|
|
|
view_port_update(view_port);
|
|
view_port_update(view_port);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
// Отправляем нотификацию мигания синим светодиодом
|
|
// Отправляем нотификацию мигания синим светодиодом
|
|
|
notification_message(notifications, &sequence_blink_blue_100);
|
|
notification_message(notifications, &sequence_blink_blue_100);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if( WorkCount < 1 ) { // закончили
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(WorkCount < 1) { // закончили
|
|
|
Work = false;
|
|
Work = false;
|
|
|
gpio_item_set_all_pins(false);
|
|
gpio_item_set_all_pins(false);
|
|
|
- furi_timer_stop(timer);
|
|
|
|
|
|
|
+ furi_timer_stop(timer);
|
|
|
notification_message(notifications, &sequence_audiovisual_alert);
|
|
notification_message(notifications, &sequence_audiovisual_alert);
|
|
|
WorkTime = 3;
|
|
WorkTime = 3;
|
|
|
WorkCount = 0;
|
|
WorkCount = 0;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- switch (Backlight) { // чо по подсветке?
|
|
|
|
|
- case 1:
|
|
|
|
|
- notification_message(notifications, &sequence_display_backlight_on);
|
|
|
|
|
- break;
|
|
|
|
|
- case 2:
|
|
|
|
|
- notification_message(notifications, &sequence_display_backlight_off);
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- notification_message(notifications, &sequence_display_backlight_enforce_auto);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ switch(Backlight) { // чо по подсветке?
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ notification_message(notifications, &sequence_display_backlight_on);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ notification_message(notifications, &sequence_display_backlight_off);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ notification_message(notifications, &sequence_display_backlight_enforce_auto);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
- if (Time < 1) Time = 1; // Не даём открутить таймер меньше единицы
|
|
|
|
|
- if (Count < -1) Count = 0; // А тут даём, бо 0 кадров это бесконечная съёмка, а -1 кадров - BULB
|
|
|
|
|
|
|
+ if(Time < 1) Time = 1; // Не даём открутить таймер меньше единицы
|
|
|
|
|
+ if(Count < -1)
|
|
|
|
|
+ Count = 0; // А тут даём, бо 0 кадров это бесконечная съёмка, а -1 кадров - BULB
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// Схороняем настройки
|
|
// Схороняем настройки
|
|
|
FlipperFormat* save = flipper_format_file_alloc(storage);
|
|
FlipperFormat* save = flipper_format_file_alloc(storage);
|
|
|
|
|
|
|
|
do {
|
|
do {
|
|
|
|
|
+ if(!flipper_format_file_open_always(save, CONFIG_FILE_PATH)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_write_header_cstr(save, "Zeitraffer", 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_write_comment_cstr(
|
|
|
|
|
+ save,
|
|
|
|
|
+ "Zeitraffer app settings: № of frames, interval time, backlight type, Delay")) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_write_int32(save, "Time", &Time, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_write_int32(save, "Count", &Count, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_write_int32(save, "Backlight", &Backlight, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!flipper_format_write_int32(save, "Delay", &Delay, 1)) {
|
|
|
|
|
+ notification_message(notifications, &sequence_error);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if(!flipper_format_file_open_always(save, CONFIG_FILE_PATH)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_write_header_cstr(save, "Zeitraffer", 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_write_comment_cstr(save, "Zeitraffer app settings: № of frames, interval time, backlight type, Delay")) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_write_int32(save, "Time", &Time, 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_write_int32(save, "Count", &Count, 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_write_int32(save, "Backlight", &Backlight, 1)) {notification_message(notifications, &sequence_error); break;}
|
|
|
|
|
- if(!flipper_format_write_int32(save, "Delay", &Delay, 1)) {
|
|
|
|
|
- notification_message(notifications, &sequence_error);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
} while(0);
|
|
} while(0);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
flipper_format_free(save);
|
|
flipper_format_free(save);
|
|
|
furi_record_close(RECORD_STORAGE);
|
|
furi_record_close(RECORD_STORAGE);
|
|
|
|
|
|