From 88fa9d912fde48d400c4a0c8a326dc6041ddcfa1 Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Mon, 12 Dec 2022 13:42:08 -0500 Subject: [PATCH] intravalometer upd --- applications/plugins/timelapse/.gitattributes | 2 - applications/plugins/timelapse/.gitignore | 2 - .../plugins/timelapse/application.fam | 4 + .../timelapse/icons/ButtonDown_7x4.png | Bin 0 -> 102 bytes .../timelapse/icons/ButtonLeft_4x7.png | Bin 0 -> 1415 bytes .../timelapse/icons/ButtonRight_4x7.png | Bin 0 -> 1839 bytes .../plugins/timelapse/icons/ButtonUp_7x4.png | Bin 0 -> 102 bytes .../plugins/timelapse/icons/Pin_star_7x7.png | Bin 0 -> 3600 bytes .../plugins/timelapse/icons/loading_10px.png | Bin 0 -> 4349 bytes applications/plugins/timelapse/zeitraffer.c | 582 +++++++++--------- 10 files changed, 304 insertions(+), 286 deletions(-) delete mode 100644 applications/plugins/timelapse/.gitattributes delete mode 100644 applications/plugins/timelapse/.gitignore create mode 100644 applications/plugins/timelapse/icons/ButtonDown_7x4.png create mode 100644 applications/plugins/timelapse/icons/ButtonLeft_4x7.png create mode 100644 applications/plugins/timelapse/icons/ButtonRight_4x7.png create mode 100644 applications/plugins/timelapse/icons/ButtonUp_7x4.png create mode 100644 applications/plugins/timelapse/icons/Pin_star_7x7.png create mode 100644 applications/plugins/timelapse/icons/loading_10px.png diff --git a/applications/plugins/timelapse/.gitattributes b/applications/plugins/timelapse/.gitattributes deleted file mode 100644 index cd63b2f7b..000000000 --- a/applications/plugins/timelapse/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -#* text=auto diff --git a/applications/plugins/timelapse/.gitignore b/applications/plugins/timelapse/.gitignore deleted file mode 100644 index 9df1745a1..000000000 --- a/applications/plugins/timelapse/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.vscode -dist diff --git a/applications/plugins/timelapse/application.fam b/applications/plugins/timelapse/application.fam index 9e9a119bd..ee725fe52 100644 --- a/applications/plugins/timelapse/application.fam +++ b/applications/plugins/timelapse/application.fam @@ -6,9 +6,13 @@ App( cdefines=["APP_ZEITRAFFER"], requires=[ "gui", + "input", + "notification", + "gpio" ], stack_size=2 * 1024, order=90, + fap_icon_assets="icons", fap_icon="zeitraffer.png", fap_category="GPIO", fap_description="Simple intervalometer app", diff --git a/applications/plugins/timelapse/icons/ButtonDown_7x4.png b/applications/plugins/timelapse/icons/ButtonDown_7x4.png new file mode 100644 index 0000000000000000000000000000000000000000..2954bb6a67d1c23c0bb5d765e8d2aa04b9b5adec GIT binary patch literal 102 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)I!3HFqj;YoHDIHH2#}J9|(o>FH3<^BV2haYO z-y5_sM4;GPjq%Ck6>60csmUj6EiNa>ORduPH4*)h!w|e3sE@(Z)z4*}Q$iC10Gods AV*mgE literal 0 HcmV?d00001 diff --git a/applications/plugins/timelapse/icons/ButtonLeft_4x7.png b/applications/plugins/timelapse/icons/ButtonLeft_4x7.png new file mode 100644 index 0000000000000000000000000000000000000000..0b4655d43247083aa705620e9836ac415b42ca46 GIT binary patch literal 1415 zcmbVM+iKK67*5rq)>aU2M7$VM1Vxif;vTv~W2u`S7ED{V3s&&L*<`XiG|9wd+THd> z5CnY!sdyuJtrvQyAo>KpiLcV|{Tkc)riAbluXfwSZCApL`ztB&p zx6LGKvks4K_4~)qD&oGa-YdJlW)hAKMNJd7<=t?6c^RI1>c$ifyjaM>^|&8!ey zB4!nh9u>5uen6Ve@<H5rru6h<2Ef#GQdQ*CmZOlQi~N!?9H`Rp;C% zU}CB21#?;r`&0|6C0}b-=jODa5|nEJ#ntxQ&{~jpgtwDta4hftr~G=#p@V36e4Zjh zq%J~{y26Jjn=1Nw-l*3%QW5YFE*v4z3gt0$&(*xf2en34c?JpH8+FYldo+Alvg8af-pG4(=!fyUi-Wsg z`g#n9VUcf(DFr{poMSNzw-lz>w+HV+n1ELr&SLA#LHUb0p(xWQ(1*vJ-i+1!`swxZ Z!O7;c$;lT_->m1Ovaz)0yuI`A$q$F8u*d)a literal 0 HcmV?d00001 diff --git a/applications/plugins/timelapse/icons/ButtonRight_4x7.png b/applications/plugins/timelapse/icons/ButtonRight_4x7.png new file mode 100644 index 0000000000000000000000000000000000000000..8e1c74c1c0038ea55172f19ac875003fc80c2d06 GIT binary patch literal 1839 zcmcIlO>f*p7#Yw)M6zw!O+@VZ{?d|D~WYi~8rHRY?X-&T}Yen`g$^+EJ;z+|RV zE@PoDvZ9%#+_}3bC_5Cj8jDGq541mi{7F+&KF}W65sr$Xn5H|YrMQ2(J7%Yc%;(zO z57ax000=TsQ+1Ke@+w#iw3au3cGGQWY740k2ijH>P(6tD)S)be>gX6Tj7`<`b>di- zgWp$8Y+?i31~CzF0&E4uRlA=C(Mp~K`{74jEchB|)4DDK!ZVhSwdFyw0YIZ1cDh0S{OvfO-U_~ zvmRF*m9sWDXNH)GOyqS1Skhxbr6}s*7t&@~kFM(NW5}qh?Lu@lJ}HE;FDiLdGO>LO z5pS*%E2grR)l^;|?O5b_?u0me&c1U}%jrk8*%=Wk%i)8yp2P|kuxmKg<=(u_`oQRI_0 zS`-DNysBx=#3&qSkgA@hJP>~D+ZM(s5jI6Owp`?yE=3e`YGUqkVOp#Cp=3wR3O4hX zX6BLsN3UBzV(vI5;|SZHgOb=HD0VFjpTyfFW}GnQuh>2*Q`k>*cAmA#iUT7EXSpo# zkPm5~#I-o^cpgfe#P$=4-Pi*SpT!-@nJgp8L347xe>5EKl`=_ZFc8XGy+_j=_R_7! z@vZZMowS1GJ?Zw)eetks%~G{BTR>T}9|jt0j3Btyb*C3-`C?fwY3EY`q*oYZ39DpM z&uJ;PCZPLs4QO1Jd_|A1PF)azZJ)RZ`^-VMWr6e#XUOA%3eLG_Ch@BDOHzMk*MF0G zCo7xMd?Mg*HMIXw%nNz?%60fZiZPlqb?GqUpXO`F&Yi!okZl(n>P@r1P2i)yk3DgRwbHeNn6e|;J^SK4TM LH~i+q&mR8;k>NTA literal 0 HcmV?d00001 diff --git a/applications/plugins/timelapse/icons/ButtonUp_7x4.png b/applications/plugins/timelapse/icons/ButtonUp_7x4.png new file mode 100644 index 0000000000000000000000000000000000000000..1be79328b40a93297a5609756328406565c437c0 GIT binary patch literal 102 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)I!3HFqj;YoHDIHH2#}J8d-yTOk1_O>mFaFD) zeWb+ZHz{mGZZ1QpXe09^4tcYT#4oe=UbmGC^A-KE*|F&zP#=S*tDnm{r-UX30HgpM AM*si- literal 0 HcmV?d00001 diff --git a/applications/plugins/timelapse/icons/Pin_star_7x7.png b/applications/plugins/timelapse/icons/Pin_star_7x7.png new file mode 100644 index 0000000000000000000000000000000000000000..42fdea86e489e278376e797b1110114697a0ad98 GIT binary patch literal 3600 zcmaJ@c|26@+dsBKS+Xz581Yn=F@s_63R|OV+mP%$Mbu7e(xV|@A;f_?)$#(@ArFM*L_{*^EuaSt<44aW%vOA5U@a* zpxNW@orjl;{a(6JI069tNCFaRYk@?9C{(g1!4D4r^!{wSAWYJ#g#OSfUdYk7Z~k$b zUjzVFWb!r(JLd`C1hAKdMGPCGqWK-g#P?;P92ze5@T0P$M{^HVdKq1hJ{{w5R_D9? zVByoyVAkB+#>b87sjR8Z4o0U?_&yQk#K}A#Ko=dQ2k(=Qw?Q?u)P!@2qlURb!jrA9 zym%S`V4jOX52HOY*yMOf1~>sqkNQE8rjcKfRkq4b04Na{28&GX;YdIO&Fc2eVnDML z@W}3o2S1Pu0Dg=RV=z!G0L=cd(B}dAijoE;fxf)`MZ7>P2atZq{2-^{3&71G0q|Mpou9$XIm2ssfWSCRf{>vb5T0(V+6I7hI057V(RMD7C0DLScinK2 zD?A8>kOnE00v^YOJsxbP>@3Apf^02Tc-#9ocEmKhxHN|Dwu@?Yj z*1BG9>lh?VO^%ODdQSPVel+H7`_7ZW`U(p}+toKXxdCD8PFBC`#6&L_rHSKFK%H;V z8KB=0@E%%o(H!8*J5H%h`P41Gq#yx+dBvvQ`q}QMt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wnM6iCmd~J_K!RE z3IX<}(I{{TBq%6IJxEiXO!b05b#-+i8ZZb9rp897`7=l~EM1M{ulQTR1n-Zd5-2nR znFQKV#JZCMXb3Pn*#Bffr2H#O^8e?g*k=ZzV<`}*y2egczkya(|38#S{1@#{L*xG& z@Bb<6Z_l9MA!ximIe>~|*UnRM#}x&Rq~ftOGS!|;_WOO1w%%kK+25N?0l_rYp`b%n zSR8@0V>$dc#mWk9LGq_zNjSWP2?ER(Q6~^Q;7Bc`rjaR9`S)2BNHb$2 z4GmLGq^`E^Z>|X$7eK_5Xur80|K%S2BX_4Eh!nPG6Fij=i1#p~l8K~IZDKdj&h+2rWiS41e>{oZ^Hg?oM~n|nus@7lwwCs$ z?D1C^P>lR^nmv=VFfp>H_q)5fd2lQ2GLzyiQ{d*V|Ea<2ASCPtaP|Sxo{WhCHW08d LwKgd=cDwXHDN#*w literal 0 HcmV?d00001 diff --git a/applications/plugins/timelapse/icons/loading_10px.png b/applications/plugins/timelapse/icons/loading_10px.png new file mode 100644 index 0000000000000000000000000000000000000000..4f626b3d58c1800c375ebbfd358db6c72374dbcf GIT binary patch literal 4349 zcmV zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3*dmfJcKME|jhUIH-#%fWa~@1U38Hvv*p4U(T< z$+pTY3QXh>8IdS8{`cRh{=-)|Tu{!(6mkd$UoN|B3g4vT{x#0`d>m80cl_1oHGR8F ztEV4a-)UaoT{pa2-tE44d!Chr?867b?OlI&UHg~o_VyU_WKp^nGQ1wHYop`w_?7N| z=j>^+XC-&L;sX8&=ccZ$tnaw7;uyO=7I;PedcKeAm3gJ398GC=^rIb>SJRni+hb~{ zyDoa_vEG|*nCQ$fk#}R7vFlp0(PY!?VYPM2I_vZ_(PrCivc@(utmUe?*`n8T^Lkv< zi3fMhokp{m<`e6su5bSK_3c7)HgS<=_m{7*%NPlR7B5=)m%9jvo>w0E<>2e}`bA(_ z#BrCnIkCZV)V)OY`kq@>tw39D^t`+M;n>dwa1qb;7^5u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Few`Gb6DM#`CQhjDHF1I; z^(4okd$urTqz+w3Jh{$dL2debbd`mr?I~K`a3HTm}0F39rNw0xZFW1~> zXSK|I1Wz%nZ|WDfzFR@kP`NmCt(M9qW3Z%c1)@0@E^YrYGzP*y_}nUUu)7 zfz|t9pQEuoV33)MbUW;hYcwWPPqlgvZ8v4RM&L5~^qTH!M8&0XRFR4$r9k4F0Qv`* zjSN5K%-HITkx^@-a72@mN7wCBqaTZ4)j;}bPNMFElAjJL9?t_vHEa!X4zq?d()uzDG>;=jT@6A6uzE zKeu`~wvrQzTm>xUoK{9;;xwMw8uJNFs=_wQSU1(^?s2D{=d#~C0|Trx~}tkBRc=5{)S zu^mc-5PxSG7wk|vIkFblujE&2ZoG0|O7qPAHR1Ywr1&aN)!(W8yF7g}iTGVPK2m!1 z^8_aSoE2Y>^Q-Fbx$9F-e1Du@5q{$xbNwtU)IBXualXR6QscM0kgSk6-?BnoX+eXQ zgUBV1@gnkgNraBftTnRx!uN*>$i_$nCgd7 z@A*s~x@C5=l4<_@?W3^I5*FK%sfCx5nuvN7U~i=jab0bb=19@W2*c15y>OM=j2-e` zaBlXREk(UI!YU!D3%`3jV({{uzE z1NsD#QilKl010qNS#tmY3ljhU3ljkVnw%H_000McNliru<_8W97bEcspQ``>07^+j zK~xyieUHHnz%U2{ZIu02zCNgslT_tpIBbCceH8$#X_DD)vF=f>R`<4hnp#pQ`(Us8 rrz))zzTsgFa-)vR)4GM #include #include "gpio_item.h" +#include "GPIO_Intervalometer_icons.h" -#define CONFIG_FILE_DIRECTORY_PATH "/ext/apps/Misc" -#define CONFIG_FILE_PATH CONFIG_FILE_DIRECTORY_PATH "/zeitraffer.conf" +#define CONFIG_FILE_DIRECTORY_PATH "/ext/apps_data/intravalometer" +#define CONFIG_FILE_PATH CONFIG_FILE_DIRECTORY_PATH "/intravalometer.conf" // Часть кода покрадена из https://github.com/zmactep/flipperzero-hello-world @@ -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, @@ -39,33 +41,63 @@ typedef struct { static void draw_callback(Canvas* canvas, void* ctx) { UNUSED(ctx); - char temp_str[36]; + char temp_str[36]; canvas_clear(canvas); canvas_set_font(canvas, FontPrimary); - switch(Count) { - case -1: - snprintf(temp_str, sizeof(temp_str), "Set: BULB %li sec", Time); - break; - case 0: - snprintf(temp_str, sizeof(temp_str), "Set: infinite, %li sec", Time); - break; - default: - snprintf(temp_str, sizeof(temp_str), "Set: %li frames, %li sec", Count, Time); - } - canvas_draw_str(canvas, 3, 15, temp_str); - snprintf(temp_str, sizeof(temp_str), "Left: %li frames, %li sec", WorkCount, WorkTime); - canvas_draw_str(canvas, 3, 35, temp_str); + switch (Count) { + case -1: + snprintf(temp_str,sizeof(temp_str),"Set: BULB %li sec",Time); + break; + case 0: + snprintf(temp_str,sizeof(temp_str),"Set: infinite, %li sec",Time); + break; + default: + snprintf(temp_str,sizeof(temp_str),"Set: %li frames, %li sec",Count,Time); + } + canvas_draw_str(canvas, 3, 15, temp_str); + snprintf(temp_str,sizeof(temp_str),"Left: %li frames, %li sec",WorkCount,WorkTime); + canvas_draw_str(canvas, 3, 35, temp_str); + + switch (Backlight) { + case 1: + canvas_draw_str(canvas, 13, 55, "ON"); + break; + case 2: + canvas_draw_str(canvas, 13, 55, "OFF"); + break; + default: + 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);} + + - switch(Backlight) { - case 1: - canvas_draw_str(canvas, 3, 55, "Backlight: ON"); - break; - case 2: - canvas_draw_str(canvas, 3, 55, "Backlight: OFF"); - break; - default: - canvas_draw_str(canvas, 3, 55, "Backlight: AUTO"); - } } static void input_callback(InputEvent* input_event, void* ctx) { @@ -87,7 +119,7 @@ static void timer_callback(FuriMessageQueue* event_queue) { int32_t zeitraffer_app(void* p) { UNUSED(p); - + // Текущее событие типа кастомного типа ZeitrafferEvent ZeitrafferEvent event; // Очередь событий на 8 элементов размера ZeitrafferEvent @@ -105,9 +137,9 @@ int32_t zeitraffer_app(void* p) { Gui* gui = furi_record_open(RECORD_GUI); // Подключаем view port к GUI в полноэкранном режиме gui_add_view_port(gui, view_port, GuiLayerFullscreen); - - // Конфигурим пины - gpio_item_configure_all_pins(GpioModeOutputPushPull); + + // Конфигурим пины + gpio_item_configure_all_pins(GpioModeOutputPushPull); // Создаем периодический таймер с коллбэком, куда в качестве // контекста будет передаваться наша очередь событий @@ -117,276 +149,262 @@ int32_t zeitraffer_app(void* p) { // Включаем нотификации NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION); + + + Storage* storage = furi_record_open(RECORD_STORAGE); + + // Загружаем настройки + FlipperFormat* load = flipper_format_file_alloc(storage); + + do { - Storage* storage = furi_record_open(RECORD_STORAGE); - - // Загружаем настройки - FlipperFormat* load = flipper_format_file_alloc(storage); - - do { - 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); - - } while(0); - - flipper_format_free(load); - + 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); + + } while(0); + + flipper_format_free(load); + // Бесконечный цикл обработки очереди событий while(1) { // Выбираем событие из очереди в переменную event (ждем бесконечно долго, если очередь пуста) // и проверяем, что у нас получилось это сделать furi_check(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk); - // Наше событие — это нажатие кнопки - if(event.type == EventTypeInput) { - if(event.input.type == InputTypeShort) { // Короткие нажатия + // Наше событие — это нажатие кнопки + if(event.type == EventTypeInput) { + if(event.input.type == InputTypeShort) { // Короткие нажатия + + if(event.input.key == InputKeyBack) { + if(Work) { // Если таймер запущен - нефиг мацать кнопки! + notification_message(notifications, &sequence_error); + } + else { + WorkCount = Count; + WorkTime = 3; + if (Count == 0) { + InfiniteShot = true; + WorkCount = 1; + } + else + InfiniteShot = false; + + notification_message(notifications, &sequence_success); + } + } + if(event.input.key == InputKeyRight) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Count++; + notification_message(notifications, &sequence_click); + } + } + if(event.input.key == InputKeyLeft) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Count--; + notification_message(notifications, &sequence_click); + } + } + if(event.input.key == InputKeyUp) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Time++; + notification_message(notifications, &sequence_click); + } + } + if(event.input.key == InputKeyDown) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Time--; + notification_message(notifications, &sequence_click); + } + } + if(event.input.key == InputKeyOk) { + + 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; + + if (WorkTime == 0) + WorkTime = Delay; + + if (Count == 0) { + InfiniteShot = true; + WorkCount = 1; + } + else + InfiniteShot = false; + + if (Count == -1) { + gpio_item_set_pin(4, true); + gpio_item_set_pin(5, true); + Bulb = true; + WorkCount = 1; + WorkTime = Time; + } + else + Bulb = false; + + notification_message(notifications, &sequence_success); + } + } + } + if(event.input.type == InputTypeLong) { // Длинные нажатия + // Если нажата кнопка "назад", то выходим из цикла, а следовательно и из приложения + if(event.input.key == InputKeyBack) { + if(furi_timer_is_running(timer)) { // А если работает таймер - не выходим :D + notification_message(notifications, &sequence_error); + } + else { + notification_message(notifications, &sequence_click); + gpio_item_set_all_pins(false); + furi_timer_stop(timer); + notification_message(notifications, &sequence_display_backlight_enforce_auto); + break; + } + } + if(event.input.key == InputKeyOk) { + // Нам ваша подсветка и нахой не нужна! Или нужна? + Backlight++; + if (Backlight > 2) Backlight = 0; + } - if(event.input.key == InputKeyBack) { - if(furi_timer_is_running( - timer)) { // Если таймер запущен - нефиг мацать кнопки! - notification_message(notifications, &sequence_error); - } else { - WorkCount = Count; - WorkTime = 3; - if(Count == 0) { - InfiniteShot = true; - WorkCount = 1; - } else - InfiniteShot = false; + } - notification_message(notifications, &sequence_success); - } - } - if(event.input.key == InputKeyRight) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Count++; - notification_message(notifications, &sequence_click); - } - } - if(event.input.key == InputKeyLeft) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Count--; - notification_message(notifications, &sequence_click); - } - } - if(event.input.key == InputKeyUp) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Time++; - notification_message(notifications, &sequence_click); - } - } - if(event.input.key == InputKeyDown) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Time--; - notification_message(notifications, &sequence_click); - } - } - if(event.input.key == InputKeyOk) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_click); - furi_timer_stop(timer); - } else { - furi_timer_start(timer, 1000); - - if(WorkCount == 0) WorkCount = Count; - - if(WorkTime == 0) WorkTime = Delay; - - if(Count == 0) { - InfiniteShot = true; - WorkCount = 1; - } else - InfiniteShot = false; - - if(Count == -1) { - gpio_item_set_pin(4, true); - gpio_item_set_pin(5, true); - Bulb = true; - WorkCount = 1; - WorkTime = Time; - } else - Bulb = false; - - notification_message(notifications, &sequence_success); - } - } - } - if(event.input.type == InputTypeLong) { // Длинные нажатия - // Если нажата кнопка "назад", то выходим из цикла, а следовательно и из приложения - if(event.input.key == InputKeyBack) { - if(furi_timer_is_running(timer)) { // А если работает таймер - не выходим :D - notification_message(notifications, &sequence_error); - } else { - notification_message(notifications, &sequence_click); - gpio_item_set_all_pins(false); - furi_timer_stop(timer); - notification_message( - notifications, &sequence_display_backlight_enforce_auto); - break; - } - } - if(event.input.key == InputKeyOk) { - // Нам ваша подсветка и нахой не нужна! Или нужна? - Backlight++; - if(Backlight > 2) Backlight = 0; - } - } - - if(event.input.type == InputTypeRepeat) { // Зажатые кнопки - if(event.input.key == InputKeyRight) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Count = Count + 10; - } - } - if(event.input.key == InputKeyLeft) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Count = Count - 10; - } - } - if(event.input.key == InputKeyUp) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Time = Time + 10; - } - } - if(event.input.key == InputKeyDown) { - if(furi_timer_is_running(timer)) { - notification_message(notifications, &sequence_error); - } else { - Time = Time - 10; - } - } - } + if(event.input.type == InputTypeRepeat) { // Зажатые кнопки + if(event.input.key == InputKeyRight) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Count = Count+10; + } + } + if(event.input.key == InputKeyLeft) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Count = Count-10; + } + } + if(event.input.key == InputKeyUp) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Time = Time+10; + } + } + if(event.input.key == InputKeyDown) { + if(furi_timer_is_running(timer)) { + notification_message(notifications, &sequence_error); + } + else { + Time = Time-10; + } + } + } } - + // Наше событие — это сработавший таймер - else if(event.type == EventTypeTick) { - WorkTime--; + else if(event.type == EventTypeTick) { + + WorkTime--; + + if( WorkTime < 1 ) { // фоткаем + notification_message(notifications, &sequence_blink_white_100); + if (Bulb) { + gpio_item_set_all_pins(false); WorkCount = 0; + } + else { + WorkCount--; + view_port_update(view_port); + notification_message(notifications, &sequence_click); + // Дрыгаем ногами + //gpio_item_set_all_pins(true); + gpio_item_set_pin(4, true); + gpio_item_set_pin(5, true); + furi_delay_ms(400); // На короткие нажатия фотик плохо реагирует + gpio_item_set_pin(4, false); + gpio_item_set_pin(5, false); + //gpio_item_set_all_pins(false); - if(WorkTime < 1) { // фоткаем - notification_message(notifications, &sequence_blink_white_100); - if(Bulb) { - gpio_item_set_all_pins(false); - WorkCount = 0; - } else { - WorkCount--; - view_port_update(view_port); - notification_message(notifications, &sequence_click); - // Дрыгаем ногами - //gpio_item_set_all_pins(true); - gpio_item_set_pin(4, true); - gpio_item_set_pin(5, true); - furi_delay_ms(400); // На короткие нажатия фотик плохо реагирует - gpio_item_set_pin(4, false); - gpio_item_set_pin(5, false); - //gpio_item_set_all_pins(false); - - if(InfiniteShot) WorkCount++; - - WorkTime = Time; - view_port_update(view_port); - } - } else { - // Отправляем нотификацию мигания синим светодиодом - notification_message(notifications, &sequence_blink_blue_100); - } - - if(WorkCount < 1) { // закончили - gpio_item_set_all_pins(false); - furi_timer_stop(timer); - notification_message(notifications, &sequence_audiovisual_alert); - WorkTime = 3; - 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); - } + if (InfiniteShot) WorkCount++; + + WorkTime = Time; + view_port_update(view_port); + } + } + else { + // Отправляем нотификацию мигания синим светодиодом + notification_message(notifications, &sequence_blink_blue_100); + } + + if( WorkCount < 1 ) { // закончили + gpio_item_set_all_pins(false); + furi_timer_stop(timer); + notification_message(notifications, &sequence_audiovisual_alert); + WorkTime = 3; + 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); + } + } - 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); - 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; - } + // Схороняем настройки + FlipperFormat* save = flipper_format_file_alloc(storage); - } while(0); + do { - flipper_format_free(save); + 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); - furi_record_close(RECORD_STORAGE); + flipper_format_free(save); + + furi_record_close(RECORD_STORAGE); // Очищаем таймер furi_timer_free(timer);