Skip to content

Commit

Permalink
Interface
Browse files Browse the repository at this point in the history
  • Loading branch information
theageoflove committed Dec 10, 2022
1 parent 1c32c89 commit ca66038
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 4 deletions.
1 change: 1 addition & 0 deletions application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ App(
],
stack_size=2 * 1024,
order=90,
fap_icon_assets="icons",
fap_icon="zeitraffer.png",
fap_category="Misc",
fap_description="Simple intervalometer app",
Expand Down
Binary file added icons/ButtonDown_7x4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/ButtonLeft_4x7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/ButtonRight_4x7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/ButtonUp_7x4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Pin_star_7x7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/loading_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 37 additions & 4 deletions zeitraffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <notification/notification_messages.h>
#include <flipper_format/flipper_format.h>
#include "gpio_item.h"
#include "zeitraffer_icons.h"

#define CONFIG_FILE_DIRECTORY_PATH "/ext/apps/Misc"
#define CONFIG_FILE_PATH CONFIG_FILE_DIRECTORY_PATH "/zeitraffer.conf"
Expand All @@ -19,6 +20,7 @@ bool InfiniteShot = false; // Бесконечная съёмка
bool Bulb = false; // Режим BULB
int32_t Backlight = 0; // Подсветка: вкл/выкл/авто
int32_t Delay = 3; // Задержка на отскочить
bool Work = false;

const NotificationSequence sequence_click = {
&message_note_c7,
Expand Down Expand Up @@ -58,15 +60,44 @@ static void draw_callback(Canvas* canvas, void* ctx) {

switch (Backlight) {
case 1:
canvas_draw_str(canvas, 3, 55, "Backlight: ON");
canvas_draw_str(canvas, 13, 55, "ON");
break;
case 2:
canvas_draw_str(canvas, 3, 55, "Backlight: OFF");
canvas_draw_str(canvas, 13, 55, "OFF");
break;
default:
canvas_draw_str(canvas, 3, 55, "Backlight: AUTO");
canvas_draw_str(canvas, 13, 55, "AUTO");
}

//canvas_draw_icon(canvas, 90, 17, &I_ButtonUp_7x4);
//canvas_draw_icon(canvas, 100, 17, &I_ButtonDown_7x4);
//canvas_draw_icon(canvas, 27, 17, &I_ButtonLeftSmall_3x5);
//canvas_draw_icon(canvas, 37, 17, &I_ButtonRightSmall_3x5);
//canvas_draw_icon(canvas, 3, 48, &I_Pin_star_7x7);

canvas_draw_icon(canvas, 85, 41, &I_ButtonUp_7x4);
canvas_draw_icon(canvas, 85, 57, &I_ButtonDown_7x4);
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
canvas_draw_icon(canvas, 3, 48, &I_Pin_star_7x7);

canvas_set_font(canvas, FontPrimary);
canvas_draw_str(canvas, 65, 55, "F");

canvas_set_font(canvas, FontPrimary);
canvas_draw_str(canvas, 85, 55, "S");


canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);




if(Work) {canvas_draw_icon(canvas, 106, 46, &I_loading_10px);}



}

static void input_callback(InputEvent* input_event, void* ctx) {
Expand Down Expand Up @@ -149,7 +180,7 @@ int32_t zeitraffer_app(void* p) {
if(event.input.type == InputTypeShort) { // Короткие нажатия

if(event.input.key == InputKeyBack) {
if(furi_timer_is_running(timer)) { // Если таймер запущен - нефиг мацать кнопки!
if(Work) { // Если таймер запущен - нефиг мацать кнопки!
notification_message(notifications, &sequence_error);
}
else {
Expand Down Expand Up @@ -206,9 +237,11 @@ int32_t zeitraffer_app(void* p) {
if(furi_timer_is_running(timer)) {
notification_message(notifications, &sequence_click);
furi_timer_stop(timer);
Work = false;
}
else {
furi_timer_start(timer, 1000);
Work = true;

if (WorkCount == 0)
WorkCount = Count;
Expand Down

0 comments on commit ca66038

Please sign in to comment.