Explorar el Código

Merge cntdown_timer from https://github.com/xMasterX/all-the-plugins

Willy-JL hace 1 año
padre
commit
edfe8fffc5
Se han modificado 2 ficheros con 40 adiciones y 6 borrados
  1. 37 1
      cntdown_timer/utils/utils.c
  2. 3 5
      cntdown_timer/views/countdown_view.c

+ 37 - 1
cntdown_timer/utils/utils.c

@@ -10,6 +10,42 @@ static const NotificationSequence sequence_beep = {
     NULL,
 };
 
+static const NotificationSequence sequence_timeup = {
+    &message_force_display_brightness_setting_1f,
+    &message_display_backlight_on,
+    &message_vibro_on,
+
+    &message_note_c8,
+    &message_delay_50,
+    &message_sound_off,
+    &message_delay_50,
+    &message_delay_25,
+
+    &message_note_c8,
+    &message_delay_50,
+    &message_sound_off,
+    &message_delay_50,
+    &message_delay_25,
+
+    &message_note_c8,
+    &message_delay_50,
+    &message_sound_off,
+    &message_delay_50,
+    &message_delay_25,
+
+    &message_note_c8,
+    &message_delay_50,
+    &message_sound_off,
+    &message_delay_50,
+    &message_delay_25,
+
+    &message_vibro_off,
+    &message_display_backlight_off,
+    &message_delay_500,
+
+    NULL,
+};
+
 void notification_beep_once() {
     notification_message(furi_record_open(RECORD_NOTIFICATION), &sequence_beep);
     notification_off();
@@ -20,7 +56,7 @@ void notification_off() {
 }
 
 void notification_timeup() {
-    notification_message(furi_record_open(RECORD_NOTIFICATION), &sequence_audiovisual_alert);
+    notification_message(furi_record_open(RECORD_NOTIFICATION), &sequence_timeup);
 }
 
 void parse_sec_to_time_str(char* buffer, size_t len, int32_t sec) {

+ 3 - 5
cntdown_timer/views/countdown_view.c

@@ -93,7 +93,7 @@ static void countdown_timer_view_on_draw(Canvas* canvas, void* ctx) {
     char buffer[64];
 
     int32_t count = model->count;
-    int32_t expected_count = model->saved_count_setting;
+    int32_t expected_count = MAX(model->saved_count_setting, 1);
 
     CountDownViewSelect select = model->select;
 
@@ -307,13 +307,11 @@ static void handle_time_setting_select(InputKey key, CountDownTimView* cdv) {
         break;
 
     case InputKeyRight:
-        selection--;
-        selection = selection % 3;
+        selection = (3 + selection - 1) % 3;
         break;
 
     case InputKeyLeft:
-        selection++;
-        selection = selection % 3;
+        selection = (3 + selection + 1) % 3;
         break;
 
     default: