From ab052bde931ccf89522f9aef45bc8db9eee59be4 Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Wed, 27 Dec 2023 02:00:25 -0500 Subject: [PATCH 1/3] See ROGUE-MASTER.NET for the BEST FLIPPER FIRMWARE! --- application.fam | 2 +- dab_timer.c | 93 +++++++++++++++++++++++++------------------------ dab_timer.h | 44 +++++++++++++++++------ 3 files changed, 81 insertions(+), 58 deletions(-) diff --git a/application.fam b/application.fam index 3ad0235faa7..df09110e78e 100644 --- a/application.fam +++ b/application.fam @@ -10,6 +10,6 @@ App( fap_icon_assets="icons", fap_author="RogueMaster", # WITH REFACTORING/REMAKE HELP FROM GMMAN FOR CLOCK FUNCTIONALITY (See README) fap_weburl="https://github.com/RogueMaster/flipperzero-dabtimer", - fap_version=(1, 6), + fap_version=(1, 7), fap_description="A clock with stopwatch and 80 seconds alarm. 80 second alarm can be changed at 5 second intervals and so can the sound options.", ) diff --git a/dab_timer.c b/dab_timer.c index 5427c5548e2..57eff551b19 100644 --- a/dab_timer.c +++ b/dab_timer.c @@ -149,8 +149,8 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { char alertTime[4]; snprintf(alertTime, sizeof(alertTime), "%d", alert_time); furi_mutex_release(plugin_state->mutex); - if(plugin_state->faceType == 0 || plugin_state->faceType == 5) { - if(plugin_state->faceType == 5) { + if(plugin_state->faceType == FaceStylePwn || plugin_state->faceType == FaceStylePwnInverted) { + if(plugin_state->faceType == FaceStylePwnInverted) { canvas_draw_icon(canvas, 0, 0, &I_black); if(timer_start_timestamp != 0) { elements_button_left(canvas, "Reset"); @@ -207,9 +207,9 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { if(plugin_state->time_format == LocaleTimeFormat12h) canvas_draw_str_aligned(canvas, 117, 4, AlignCenter, AlignCenter, meridian_string); canvas_draw_str_aligned(canvas, 96, 20, AlignCenter, AlignTop, date_string); // DRAW DATE - } else if(plugin_state->faceType == 1 || plugin_state->faceType == 6) { + } else if(plugin_state->faceType == FaceStyleOriginal || plugin_state->faceType == FaceStyleOriginalInverted) { canvas_set_font(canvas, FontSecondary); - if(plugin_state->faceType == 6) { + if(plugin_state->faceType == FaceStyleOriginalInverted) { canvas_draw_icon(canvas, 0, 0, &I_black); if(timer_start_timestamp != 0) { elements_button_left(canvas, "Reset"); @@ -275,8 +275,8 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { canvas, 64, 38, AlignCenter, AlignTop, date_string); // DRAW DATE canvas_set_font(canvas, FontSecondary); } - } else if(plugin_state->faceType == 2 || plugin_state->faceType == 7) { - if(plugin_state->faceType == 7) { + } else if(plugin_state->faceType == FaceStyleOriginalSmall || plugin_state->faceType == FaceStyleOriginalSmallInverted) { + if(plugin_state->faceType == FaceStyleOriginalSmallInverted) { canvas_draw_icon(canvas, 0, 0, &I_black); if(timer_start_timestamp != 0) { elements_button_left(canvas, "Reset"); @@ -310,8 +310,8 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { canvas_draw_str_aligned( canvas, 64, 38, AlignCenter, AlignTop, date_string); // DRAW DATE canvas_set_font(canvas, FontSecondary); - } else if(plugin_state->faceType == 3 || plugin_state->faceType == 8) { - if(plugin_state->faceType == 8) { + } else if(plugin_state->faceType == FaceStyleCircle || plugin_state->faceType == FaceStyleCircleInverted) { + if(plugin_state->faceType == FaceStyleCircleInverted) { canvas_draw_icon(canvas, 0, 0, &I_black); if(timer_start_timestamp != 0) { // elements_button_left(canvas, "Reset"); @@ -364,7 +364,7 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { } furi_string_free(str); } else { - if(plugin_state->faceType == 9) { + if(plugin_state->faceType == FaceStyleBinaryInverted) { canvas_draw_icon(canvas, 0, 0, &I_black); if(timer_start_timestamp != 0) { // elements_button_left(canvas, "Reset"); @@ -400,14 +400,14 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { dab_timer_render_binary_face(canvas, curr_dt.second, 38, timer_start_timestamp); } } - if(plugin_state->faceType >= 5) { + if(plugin_state->faceType >= FaceStylePwnInverted) { canvas_set_color(canvas, ColorBlack); } - if(plugin_state->faceType < 5) { + if(plugin_state->faceType < FaceStylePwnInverted) { canvas_set_color(canvas, ColorWhite); } - if(plugin_state->faceType != 3 && plugin_state->faceType != 4 && plugin_state->faceType != 8 && - plugin_state->faceType != 9) { + if(plugin_state->faceType != FaceStyleCircle && plugin_state->faceType != FaceStyleBinary && plugin_state->faceType != FaceStyleCircleInverted && + plugin_state->faceType != FaceStyleBinaryInverted) { if(!plugin_state->desktop_settings->is_dumbmode && !plugin_state->w_test) { if(timer_running) { elements_button_center(canvas, "Stop"); @@ -416,13 +416,13 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { } } if(timer_running && !plugin_state->w_test) { - if(songSelect == 0) { + if(songSelect == SoundAlertOff) { elements_button_right(canvas, "S:OFF"); - } else if(songSelect == 1) { + } else if(songSelect == SoundAlertGoGoPoRa) { elements_button_right(canvas, "S:PoRa"); - } else if(songSelect == 2) { + } else if(songSelect == SoundAlertMario) { elements_button_right(canvas, "S:Mario"); - } else if(songSelect == 3) { + } else if(songSelect == SoundAlertByMin) { elements_button_right(canvas, "S:ByMin"); } } @@ -434,27 +434,27 @@ static void dab_timer_render_callback(Canvas* const canvas, void* ctx) { static void dab_timer_state_init(DabTimerState* const plugin_state) { memset(plugin_state, 0, sizeof(DabTimerState)); - plugin_state->songSelect = 2; + plugin_state->alert_time = 80; + plugin_state->date_format = locale_get_date_format(); + plugin_state->desktop_settings = malloc(sizeof(DesktopSettings)); + plugin_state->curEmotiveFace = 0; plugin_state->codeSequence = 0; + plugin_state->faceType = FaceStylePwn; plugin_state->lastexp_timestamp = 0; + plugin_state->songSelect = SoundAlertMario; + plugin_state->time_format = locale_get_time_format(); plugin_state->timer_start_timestamp = 0; plugin_state->timer_stopped_seconds = 0; plugin_state->timerSecs = 0; - plugin_state->faceType = 0; - plugin_state->curEmotiveFace = 0; - plugin_state->alert_time = 80; - plugin_state->desktop_settings = malloc(sizeof(DesktopSettings)); plugin_state->w_test = false; - plugin_state->time_format = locale_get_time_format(); - plugin_state->date_format = locale_get_date_format(); } void dab_timer_free(DabTimerState* plugin_state) { - furi_record_close(RECORD_NOTIFICATION); furi_record_close(RECORD_GUI); + furi_record_close(RECORD_NOTIFICATION); + free(plugin_state->desktop_settings); furi_message_queue_free(plugin_state->event_queue); furi_mutex_free(plugin_state->mutex); - free(plugin_state->desktop_settings); free(plugin_state); } @@ -544,7 +544,7 @@ int32_t dab_timer_app(void* p) { } } else { plugin_state->codeSequence = 0; - if(plugin_state->songSelect <= 2) { + if(plugin_state->songSelect < SoundAlertCount - 1) { plugin_state->songSelect = plugin_state->songSelect + 1; } else { plugin_state->songSelect = 0; @@ -564,7 +564,7 @@ int32_t dab_timer_app(void* p) { plugin_state->timer_stopped_seconds = 0; plugin_state->timerSecs = 0; } else { - if(plugin_state->faceType <= 8) { + if(plugin_state->faceType < FaceStyleCount - 1) { plugin_state->faceType = plugin_state->faceType + 1; } else { plugin_state->faceType = 0; @@ -578,10 +578,10 @@ int32_t dab_timer_app(void* p) { } else { plugin_state->codeSequence = 0; if(!plugin_state->desktop_settings->is_dumbmode) { - if(plugin_state->songSelect == 1 || - plugin_state->songSelect == 2 || - plugin_state->songSelect == 3) { - notification_message(notification, &clock_alert_startStop); + if(plugin_state->songSelect == SoundAlertMario || + plugin_state->songSelect == SoundAlertGoGoPoRa || + plugin_state->songSelect == SoundAlertByMin) { + notification_message(notification, &dab_timer_alert_startStop); } // START/STOP TIMER FuriHalRtcDateTime curr_dt; @@ -624,8 +624,9 @@ int32_t dab_timer_app(void* p) { plugin_state->desktop_settings->is_dumbmode = true; // MAKE SURE IT'S ON SO IT GETS TURNED OFF dab_timer_dumbmode_changed(plugin_state->desktop_settings); - if(plugin_state->songSelect == 1 || plugin_state->songSelect == 2 || - plugin_state->songSelect == 3) { + if(plugin_state->songSelect == SoundAlertMario || + plugin_state->songSelect == SoundAlertGoGoPoRa || + plugin_state->songSelect == SoundAlertByMin) { notification_message(notification, &sequence_success); notification_message(notification, &sequence_rainbow); notification_message(notification, &sequence_rainbow); @@ -656,12 +657,12 @@ int32_t dab_timer_app(void* p) { if(plugin_state->curEmotiveFace == 25) plugin_state->curEmotiveFace = 0; } if(plugin_state->timerSecs % 60 == 0 && plugin_state->timerSecs != 0 && - plugin_state->songSelect != 0 && + plugin_state->songSelect != SoundAlertOff && (plugin_state->timerSecs < plugin_state->alert_time || - plugin_state->songSelect == 3)) { - notification_message(notification, &clock_alert_perMin); + plugin_state->songSelect == SoundAlertByMin)) { + notification_message(notification, &dab_timer_alert_perMin); } - if(plugin_state->songSelect == 1) { + if(plugin_state->songSelect == SoundAlertGoGoPoRa) { if(plugin_state->timerSecs == plugin_state->alert_time) { FuriHalRtcDateTime curr_dt; furi_hal_rtc_get_datetime(&curr_dt); @@ -671,17 +672,17 @@ int32_t dab_timer_app(void* p) { plugin_state->lastexp_timestamp = curr_ts; dolphin_deed(getRandomDeed()); } - notification_message(notification, &clock_alert_pr1); + notification_message(notification, &dab_timer_alert_pr1); } if(plugin_state->timerSecs == plugin_state->alert_time + 1) { - notification_message(notification, &clock_alert_pr2); + notification_message(notification, &dab_timer_alert_pr2); } if(plugin_state->timerSecs == plugin_state->alert_time + 2) { - notification_message(notification, &clock_alert_pr3); + notification_message(notification, &dab_timer_alert_pr3); notification_message(notification, &sequence_rainbow); notification_message(notification, &sequence_rainbow); } - } else if(plugin_state->songSelect == 2) { + } else if(plugin_state->songSelect == SoundAlertMario) { if(plugin_state->timerSecs == plugin_state->alert_time) { FuriHalRtcDateTime curr_dt; furi_hal_rtc_get_datetime(&curr_dt); @@ -691,13 +692,13 @@ int32_t dab_timer_app(void* p) { plugin_state->lastexp_timestamp = curr_ts; dolphin_deed(getRandomDeed()); } - notification_message(notification, &clock_alert_mario1); + notification_message(notification, &dab_timer_alert_mario1); } if(plugin_state->timerSecs == plugin_state->alert_time + 1) { - notification_message(notification, &clock_alert_mario2); + notification_message(notification, &dab_timer_alert_mario2); } if(plugin_state->timerSecs == plugin_state->alert_time + 2) { - notification_message(notification, &clock_alert_mario3); + notification_message(notification, &dab_timer_alert_mario3); notification_message(notification, &sequence_rainbow); notification_message(notification, &sequence_rainbow); } @@ -711,7 +712,7 @@ int32_t dab_timer_app(void* p) { plugin_state->lastexp_timestamp = curr_ts; dolphin_deed(getRandomDeed()); } - notification_message(notification, &clock_alert_silent); + notification_message(notification, &dab_timer_alert_silent); notification_message(notification, &sequence_rainbow); notification_message(notification, &sequence_rainbow); } diff --git a/dab_timer.h b/dab_timer.h index 5001c3d9cc9..318f7dc0d71 100644 --- a/dab_timer.h +++ b/dab_timer.h @@ -41,6 +41,28 @@ typedef struct { InputEvent input; } PluginEvent; +typedef enum { + FaceStylePwn, + FaceStyleOriginal, + FaceStyleOriginalSmall, + FaceStyleCircle, + FaceStyleBinary, + FaceStylePwnInverted, + FaceStyleOriginalInverted, + FaceStyleOriginalSmallInverted, + FaceStyleCircleInverted, + FaceStyleBinaryInverted, + FaceStyleCount, +} FaceStyle; + +typedef enum { + SoundAlertOff, + SoundAlertByMin, + SoundAlertMario, + SoundAlertGoGoPoRa, + SoundAlertCount, +} SoundAlert; + typedef struct { FuriMutex* mutex; FuriMessageQueue* event_queue; @@ -54,15 +76,15 @@ typedef struct { uint16_t timer_stopped_seconds; uint16_t timerSecs; uint8_t alert_time; - uint8_t songSelect; uint8_t codeSequence; - uint8_t faceType; uint8_t curEmotiveFace; bool timer_running; bool w_test; + FaceStyle faceType; + SoundAlert songSelect; } DabTimerState; -const NotificationSequence clock_alert_silent = { +const NotificationSequence dab_timer_alert_silent = { &message_vibro_on, &message_red_255, &message_green_255, @@ -74,7 +96,7 @@ const NotificationSequence clock_alert_silent = { &message_display_backlight_on, NULL, }; -const NotificationSequence clock_alert_pr1 = { +const NotificationSequence dab_timer_alert_pr1 = { &message_vibro_on, &message_red_255, &message_green_255, @@ -96,7 +118,7 @@ const NotificationSequence clock_alert_pr1 = { &message_sound_off, NULL, }; -const NotificationSequence clock_alert_pr2 = { +const NotificationSequence dab_timer_alert_pr2 = { &message_vibro_on, &message_note_fs5, &message_delay_100, @@ -117,7 +139,7 @@ const NotificationSequence clock_alert_pr2 = { &message_sound_off, NULL, }; -const NotificationSequence clock_alert_pr3 = { +const NotificationSequence dab_timer_alert_pr3 = { &message_display_backlight_off, &message_note_g5, &message_delay_100, @@ -131,7 +153,7 @@ const NotificationSequence clock_alert_pr3 = { &message_delay_100, NULL, }; -const NotificationSequence clock_alert_mario1 = { +const NotificationSequence dab_timer_alert_mario1 = { &message_vibro_on, &message_red_255, &message_green_255, @@ -159,7 +181,7 @@ const NotificationSequence clock_alert_mario1 = { &message_sound_off, NULL, }; -const NotificationSequence clock_alert_mario2 = { +const NotificationSequence dab_timer_alert_mario2 = { &message_vibro_on, &message_display_backlight_off, &message_delay_100, @@ -179,7 +201,7 @@ const NotificationSequence clock_alert_mario2 = { &message_display_backlight_on, NULL, }; -const NotificationSequence clock_alert_mario3 = { +const NotificationSequence dab_timer_alert_mario3 = { &message_display_backlight_off, &message_note_g5, &message_delay_100, @@ -201,7 +223,7 @@ const NotificationSequence clock_alert_mario3 = { &message_sound_off, NULL, }; -const NotificationSequence clock_alert_perMin = { +const NotificationSequence dab_timer_alert_perMin = { &message_note_g5, &message_delay_100, &message_delay_50, @@ -214,7 +236,7 @@ const NotificationSequence clock_alert_perMin = { &message_sound_off, NULL, }; -const NotificationSequence clock_alert_startStop = { +const NotificationSequence dab_timer_alert_startStop = { &message_red_255, &message_green_255, &message_blue_255, From 8135ab5228bbbf44e551ca36fa135397bf764b58 Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Wed, 27 Dec 2023 08:26:58 -0500 Subject: [PATCH 2/3] See ROGUE-MASTER.NET for the BEST FLIPPER FIRMWARE! format_py --- application.fam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.fam b/application.fam index df09110e78e..6fc9b6b9ecb 100644 --- a/application.fam +++ b/application.fam @@ -8,7 +8,7 @@ App( fap_category="Main", fap_icon="dab_timer_icon_10px.png", fap_icon_assets="icons", - fap_author="RogueMaster", # WITH REFACTORING/REMAKE HELP FROM GMMAN FOR CLOCK FUNCTIONALITY (See README) + fap_author="RogueMaster", # WITH REFACTORING/REMAKE HELP FROM GMMAN FOR CLOCK FUNCTIONALITY (See README) fap_weburl="https://github.com/RogueMaster/flipperzero-dabtimer", fap_version=(1, 7), fap_description="A clock with stopwatch and 80 seconds alarm. 80 second alarm can be changed at 5 second intervals and so can the sound options.", From e879ad9982e879c521009630da9ed4213ee8d98e Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Wed, 27 Dec 2023 17:29:26 -0500 Subject: [PATCH 3/3] Latest Release RM1227-1725-0.93.9-e4c18d2 on PATREON - NEW RELEASE --- ReadMe.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 1bd11b45d67..f0da95c9594 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -27,10 +27,10 @@ This software is for experimental purposes only and is not meant for any illegal -## Latest Updates - [PATREON: Latest Release RM1226-1142-0.93.9-e59f801](https://www.patreon.com/RogueMaster?filters[tag]=Latest%20Release) +## Latest Updates - [PATREON: Latest Release RM1227-1725-0.93.9-e4c18d2](https://www.patreon.com/RogueMaster?filters[tag]=Latest%20Release) -- Last Synced/Checked OFW, changes in [commits](https://github.com/flipperdevices/flipperzero-firmware/commits/dev): `2023-12-27 01:10 EST` -- Last Synced/Checked Unleashed, changes in [changelog](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/CHANGELOG.md): `2023-12-27 01:10 EST` +- Last Synced/Checked OFW, changes in [commits](https://github.com/flipperdevices/flipperzero-firmware/commits/dev): `2023-12-27 17:25 EST` +- Last Synced/Checked Unleashed, changes in [changelog](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/CHANGELOG.md): `2023-12-27 17:25 EST` - OFW PR: NFC: [Update mf_classic_dict.nfc #3314 (By ry4000)](https://github.com/flipperdevices/flipperzero-firmware/pull/3314) - For Bandai Namco Passport / Sega Aime Card (Already part of key dictionairy lines 1918-1952.) - Added: [Smack My Dolphin Up! (By siberianbot)](https://github.com/siberianbot/smack-my-dolphin-up) - OFW: [About: cn,tw,mx certification information #3318 (By skotopes)](https://github.com/flipperdevices/flipperzero-firmware/pull/3318)