fmt and upds
@@ -26,7 +26,7 @@ void gpio_item_configure_pin(uint8_t index, GpioMode mode, GpioPull pull) {
|
||||
|
||||
void gpio_item_configure_all_pins(GpioMode mode) {
|
||||
GpioPull pull = GpioPullNo;
|
||||
if(mode == GpioModeInput){
|
||||
if(mode == GpioModeInput) {
|
||||
pull = GpioPullDown;
|
||||
}
|
||||
for(uint8_t i = 0; i < GPIO_ITEM_COUNT; i++) {
|
||||
|
||||
@@ -56,7 +56,7 @@ void gpio_scene_start_on_enter(void* context) {
|
||||
variable_item_list_add(var_item_list, "USB-UART Bridge", 0, NULL, NULL);
|
||||
|
||||
variable_item_list_add(var_item_list, "GPIO Manual Control", 0, NULL, NULL);
|
||||
|
||||
|
||||
variable_item_list_add(var_item_list, "GPIO Manual Read", 0, NULL, NULL);
|
||||
|
||||
item = variable_item_list_add(
|
||||
|
||||
@@ -26,32 +26,25 @@ static void gpio_reader_draw_callback(Canvas* canvas, void* _model) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
elements_multiline_text_aligned(
|
||||
canvas, 64, 16, AlignCenter, AlignTop, "A7 A6 A4 B3 B2 C3 C1 C0");
|
||||
elements_multiline_text_aligned(
|
||||
canvas, 64, 40, AlignCenter, AlignTop, "Pull Up");
|
||||
elements_multiline_text_aligned(canvas, 64, 40, AlignCenter, AlignTop, "Pull Up");
|
||||
int charOffset = 10;
|
||||
for(uint8_t i = 0; i < GPIO_ITEM_COUNT; i++) {
|
||||
bool high = gpio_item_get_pin(i);
|
||||
if(high) {
|
||||
elements_multiline_text_aligned(
|
||||
canvas, charOffset, 25, AlignCenter, AlignTop, "1");
|
||||
elements_multiline_text_aligned(canvas, charOffset, 25, AlignCenter, AlignTop, "1");
|
||||
} else {
|
||||
elements_multiline_text_aligned(
|
||||
canvas, charOffset, 25, AlignCenter, AlignTop, "0");
|
||||
}
|
||||
|
||||
if(model->pullUp[i]) {
|
||||
elements_multiline_text_aligned(
|
||||
canvas, charOffset, 50, AlignCenter, AlignTop, "1");
|
||||
} else {
|
||||
elements_multiline_text_aligned(
|
||||
canvas, charOffset, 50, AlignCenter, AlignTop, "0");
|
||||
}
|
||||
if(i == model->pin_idx) {
|
||||
elements_multiline_text_aligned(
|
||||
canvas, charOffset, 53, AlignCenter, AlignTop, "_");
|
||||
elements_multiline_text_aligned(canvas, charOffset, 25, AlignCenter, AlignTop, "0");
|
||||
}
|
||||
|
||||
if(model->pullUp[i]) {
|
||||
elements_multiline_text_aligned(canvas, charOffset, 50, AlignCenter, AlignTop, "1");
|
||||
} else {
|
||||
elements_multiline_text_aligned(canvas, charOffset, 50, AlignCenter, AlignTop, "0");
|
||||
}
|
||||
if(i == model->pin_idx) {
|
||||
elements_multiline_text_aligned(canvas, charOffset, 53, AlignCenter, AlignTop, "_");
|
||||
}
|
||||
|
||||
|
||||
charOffset += 16;
|
||||
}
|
||||
//~ free(charOffset);
|
||||
@@ -93,7 +86,7 @@ static bool gpio_reader_process_right(GpioReader* gpio_reader) {
|
||||
gpio_reader->view,
|
||||
GpioReaderModel * model,
|
||||
{
|
||||
if(model->pin_idx < GPIO_ITEM_COUNT-1) {
|
||||
if(model->pin_idx < GPIO_ITEM_COUNT - 1) {
|
||||
model->pin_idx++;
|
||||
}
|
||||
},
|
||||
@@ -109,11 +102,11 @@ static bool gpio_reader_process_ok(GpioReader* gpio_reader, InputEvent* event) {
|
||||
GpioReaderModel * model,
|
||||
{
|
||||
if(event->type == InputTypePress) {
|
||||
if(model->pullUp[model->pin_idx]){
|
||||
if(model->pullUp[model->pin_idx]) {
|
||||
gpio_item_configure_pin(model->pin_idx, GpioModeInput, GpioPullDown);
|
||||
model->pullUp[model->pin_idx] = 0;
|
||||
consumed = true;
|
||||
}else{
|
||||
} else {
|
||||
gpio_item_configure_pin(model->pin_idx, GpioModeInput, GpioPullUp);
|
||||
model->pullUp[model->pin_idx] = 1;
|
||||
consumed = true;
|
||||
@@ -149,7 +142,10 @@ View* gpio_reader_get_view(GpioReader* gpio_reader) {
|
||||
return gpio_reader->view;
|
||||
}
|
||||
|
||||
void gpio_reader_set_ok_callback(GpioReader* gpio_reader, GpioReaderOkCallback callback, void* context) {
|
||||
void gpio_reader_set_ok_callback(
|
||||
GpioReader* gpio_reader,
|
||||
GpioReaderOkCallback callback,
|
||||
void* context) {
|
||||
furi_assert(gpio_reader);
|
||||
furi_assert(callback);
|
||||
with_view_model(
|
||||
|
||||
@@ -11,4 +11,7 @@ void gpio_reader_free(GpioReader* gpio_reader);
|
||||
|
||||
View* gpio_reader_get_view(GpioReader* gpio_reader);
|
||||
|
||||
void gpio_reader_set_ok_callback(GpioReader* gpio_reader, GpioReaderOkCallback callback, void* context);
|
||||
void gpio_reader_set_ok_callback(
|
||||
GpioReader* gpio_reader,
|
||||
GpioReaderOkCallback callback,
|
||||
void* context);
|
||||
|
||||
@@ -39,34 +39,33 @@ 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 (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");
|
||||
}
|
||||
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, 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) {
|
||||
@@ -88,7 +87,7 @@ static void timer_callback(FuriMessageQueue* event_queue) {
|
||||
|
||||
int32_t zeitraffer_app(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
|
||||
// Текущее событие типа кастомного типа ZeitrafferEvent
|
||||
ZeitrafferEvent event;
|
||||
// Очередь событий на 8 элементов размера ZeitrafferEvent
|
||||
@@ -106,9 +105,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);
|
||||
|
||||
// Создаем периодический таймер с коллбэком, куда в качестве
|
||||
// контекста будет передаваться наша очередь событий
|
||||
@@ -118,260 +117,276 @@ 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 {
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
// Бесконечный цикл обработки очереди событий
|
||||
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.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.type == EventTypeInput) {
|
||||
if(event.input.type == InputTypeShort) { // Короткие нажатия
|
||||
|
||||
}
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Наше событие — это сработавший таймер
|
||||
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);
|
||||
else if(event.type == EventTypeTick) {
|
||||
WorkTime--;
|
||||
|
||||
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(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 (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 {
|
||||
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;
|
||||
}
|
||||
|
||||
do {
|
||||
} while(0);
|
||||
|
||||
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);
|
||||
flipper_format_free(save);
|
||||
|
||||
flipper_format_free(save);
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
// Очищаем таймер
|
||||
furi_timer_free(timer);
|
||||
|
||||
@@ -85,19 +85,19 @@ int32_t usb_hid_autofire_app(void* p) {
|
||||
}
|
||||
|
||||
switch(event.input.key) {
|
||||
case InputKeyOk:
|
||||
btn_left_autofire = !btn_left_autofire;
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
if(autofire_delay > 0) {
|
||||
autofire_delay -= 10;
|
||||
}
|
||||
break;
|
||||
case InputKeyRight:
|
||||
autofire_delay += 10;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case InputKeyOk:
|
||||
btn_left_autofire = !btn_left_autofire;
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
if(autofire_delay > 0) {
|
||||
autofire_delay -= 10;
|
||||
}
|
||||
break;
|
||||
case InputKeyRight:
|
||||
autofire_delay += 10;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,15 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
|
||||
{"Sniff",
|
||||
{"beacon", "deauth", "esp", "pmkid", "probe", "pwn", "raw", "bt", "skim"},
|
||||
9,
|
||||
{"sniffbeacon", "sniffdeauth", "sniffesp", "sniffpmkid", "sniffprobe", "sniffpwn", "sniffraw", "sniffbt", "sniffskim"},
|
||||
{"sniffbeacon",
|
||||
"sniffdeauth",
|
||||
"sniffesp",
|
||||
"sniffpmkid",
|
||||
"sniffprobe",
|
||||
"sniffpwn",
|
||||
"sniffraw",
|
||||
"sniffbt",
|
||||
"sniffskim"},
|
||||
NO_ARGS,
|
||||
FOCUS_CONSOLE_END,
|
||||
SHOW_STOPSCAN_TIP},
|
||||
|
||||
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -1,14 +0,0 @@
|
||||
Filetype: Flipper Animation
|
||||
Version: 1
|
||||
|
||||
Width: 128
|
||||
Height: 64
|
||||
Passive frames: 11
|
||||
Active frames: 0
|
||||
Frames order: 0 1 2 3 4 5 6 7 8 9 10
|
||||
Active cycles: 0
|
||||
Frame rate: 7
|
||||
Duration: 3600
|
||||
Active cooldown: 0
|
||||
|
||||
Bubble slots: 0
|
||||