From 1464c65d104e9a5cf4bad32da6e5d75c4ced2c47 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sat, 17 Dec 2022 08:49:13 +0300 Subject: [PATCH 01/16] Create FUNDING.yml --- .github/FUNDING.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..98fbecc3f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +ko_fi: masterx +custom: ['https://boosty.to/mmxdev', 'https://destream.net/live/MMX/donate', 'https://pay.cloudtips.ru/p/7b3e9d65', 'https://yoomoney.ru/fundraise/XA49mgQLPA0.221209'] From f2e63848606d7bb40896bdce7e8bbf600e656cf6 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sat, 17 Dec 2022 08:53:03 +0300 Subject: [PATCH 02/16] add links to dev builds and releases in telegram --- ReadMe.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ReadMe.md b/ReadMe.md index 5e7e9ae1d..b0c51a5ce 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -27,6 +27,12 @@ Our Discord Community:

+## Dev builds +- https://dev.unleashedflip.com/ +- https://t.me/kotnehleb +## Releases in Telegram +- https://t.me/unleashed_fw + # What's changed * SubGHz regional TX restrictions removed * SubGHz frequency range can be extended in settings file (Warning: It can damage flipper's hardware) From 5e5d6cf1a0f6232548bdb54c043bc3a9f7289c3a Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 00:52:37 +0300 Subject: [PATCH 03/16] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39902ef08..6a5232e5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,10 @@ Now this file is actually should be created by user and will be not removed ever * XMR (Monero): `41xUz92suUu1u5Mu4qkrcs52gtfpu9rnZRdBpCJ244KRHf6xXSvVFevdf2cnjS7RAeYr5hn9MsEfxKoFDRSctFjG5fv1Mhn` * TON: `EQCOqcnYkvzOZUV_9bPE_8oTbOrOF03MnF-VcJyjisTZmpGf` +### Thanks to our sponsors: +callmezimbra, Quen0n, MERRON, grvpvl (lvpvrg), art_col, ThurstonWaffles, Moneron, UterGrooll, LUCFER, Northpirate, zloepuzo, T.Rat, Alexey B., ionelife, ... +and all other great people who supported our project and me (xMasterX), thanks to you all! + **Note: To avoid issues with .dfu, prefer installing using .tgz with qFlipper, web updater or by self update package, all needed assets will be installed** **Recommended option - Web Updater** From 0238da8ac98a76b1769794b3b195927de620be8a Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 00:53:08 +0300 Subject: [PATCH 04/16] Update SubGHz Bruteforcer --- applications/plugins/subbrute | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/plugins/subbrute b/applications/plugins/subbrute index f47f826a6..b6db4f5ab 160000 --- a/applications/plugins/subbrute +++ b/applications/plugins/subbrute @@ -1 +1 @@ -Subproject commit f47f826a689a94ea1b554743dd87ae0fb836427b +Subproject commit b6db4f5ab68551d5dc0762ed3ab5da7f225781da From f10e82c64dc8f42ce2ee66c92aefdaf574abeea8 Mon Sep 17 00:00:00 2001 From: Nikolay Minaylov Date: Mon, 19 Dec 2022 12:38:20 +0300 Subject: [PATCH 05/16] [FL-3024] Locale settings (#2137) * Locale settings * Time/date format fix * Locale: add docs, enums for HAL, cleanup. Co-authored-by: Aleksandr Kutuzov --- .../debug/locale_test/application.fam | 11 ++ applications/debug/locale_test/locale_test.c | 102 +++++++++++++ applications/services/locale/application.fam | 9 ++ applications/services/locale/locale.c | 109 +++++++++++++ applications/services/locale/locale.h | 107 +++++++++++++ applications/settings/system/application.fam | 2 +- .../settings/system/system_settings.c | 79 ++++++++++ firmware/targets/f7/api_symbols.csv | 19 ++- firmware/targets/f7/furi_hal/furi_hal_rtc.c | 74 +++++++-- .../targets/furi_hal_include/furi_hal_rtc.h | 143 +++++++++++++++++- 10 files changed, 636 insertions(+), 19 deletions(-) create mode 100644 applications/debug/locale_test/application.fam create mode 100644 applications/debug/locale_test/locale_test.c create mode 100644 applications/services/locale/application.fam create mode 100644 applications/services/locale/locale.c create mode 100644 applications/services/locale/locale.h diff --git a/applications/debug/locale_test/application.fam b/applications/debug/locale_test/application.fam new file mode 100644 index 000000000..e46eeff51 --- /dev/null +++ b/applications/debug/locale_test/application.fam @@ -0,0 +1,11 @@ +App( + appid="locale_test", + name="Locale Test", + apptype=FlipperAppType.DEBUG, + entry_point="locale_test_app", + cdefines=["APP_LOCALE"], + requires=["gui", "locale"], + stack_size=2 * 1024, + order=70, + fap_category="Debug", +) diff --git a/applications/debug/locale_test/locale_test.c b/applications/debug/locale_test/locale_test.c new file mode 100644 index 000000000..003df55dc --- /dev/null +++ b/applications/debug/locale_test/locale_test.c @@ -0,0 +1,102 @@ +#include +#include +#include +#include +#include +#include + +typedef struct { + Gui* gui; + ViewDispatcher* view_dispatcher; + View* view; +} LocaleTestApp; + +static void locale_test_view_draw_callback(Canvas* canvas, void* _model) { + UNUSED(_model); + + // Prepare canvas + canvas_set_color(canvas, ColorBlack); + canvas_set_font(canvas, FontSecondary); + + FuriString* tmp_string = furi_string_alloc(); + + float temp = 25.3f; + LocaleMeasurementUnits units = locale_get_measurement_unit(); + if(units == LocaleMeasurementUnitsMetric) { + furi_string_printf(tmp_string, "Temp: %5.1fC", (double)temp); + } else { + temp = locale_celsius_to_fahrenheit(temp); + furi_string_printf(tmp_string, "Temp: %5.1fF", (double)temp); + } + canvas_draw_str(canvas, 0, 10, furi_string_get_cstr(tmp_string)); + + FuriHalRtcDateTime datetime; + furi_hal_rtc_get_datetime(&datetime); + + locale_format_time(tmp_string, &datetime, locale_get_time_format(), false); + canvas_draw_str(canvas, 0, 25, furi_string_get_cstr(tmp_string)); + + locale_format_date(tmp_string, &datetime, locale_get_date_format(), "/"); + canvas_draw_str(canvas, 0, 40, furi_string_get_cstr(tmp_string)); + + furi_string_free(tmp_string); +} + +static bool locale_test_view_input_callback(InputEvent* event, void* context) { + UNUSED(event); + UNUSED(context); + return false; +} + +static uint32_t locale_test_exit(void* context) { + UNUSED(context); + return VIEW_NONE; +} + +static LocaleTestApp* locale_test_alloc() { + LocaleTestApp* app = malloc(sizeof(LocaleTestApp)); + + // Gui + app->gui = furi_record_open(RECORD_GUI); + + // View dispatcher + app->view_dispatcher = view_dispatcher_alloc(); + view_dispatcher_enable_queue(app->view_dispatcher); + view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); + + // Views + app->view = view_alloc(); + view_set_draw_callback(app->view, locale_test_view_draw_callback); + view_set_input_callback(app->view, locale_test_view_input_callback); + + view_set_previous_callback(app->view, locale_test_exit); + view_dispatcher_add_view(app->view_dispatcher, 0, app->view); + view_dispatcher_switch_to_view(app->view_dispatcher, 0); + + return app; +} + +static void locale_test_free(LocaleTestApp* app) { + furi_assert(app); + + // Free views + view_dispatcher_remove_view(app->view_dispatcher, 0); + + view_free(app->view); + view_dispatcher_free(app->view_dispatcher); + + // Close gui record + furi_record_close(RECORD_GUI); + app->gui = NULL; + + // Free rest + free(app); +} + +int32_t locale_test_app(void* p) { + UNUSED(p); + LocaleTestApp* app = locale_test_alloc(); + view_dispatcher_run(app->view_dispatcher); + locale_test_free(app); + return 0; +} diff --git a/applications/services/locale/application.fam b/applications/services/locale/application.fam new file mode 100644 index 000000000..c762d02d6 --- /dev/null +++ b/applications/services/locale/application.fam @@ -0,0 +1,9 @@ +App( + appid="locale", + name="LocaleSrv", + apptype=FlipperAppType.STARTUP, + entry_point="locale_on_system_start", + cdefines=["SRV_LOCALE"], + order=90, + sdk_headers=["locale.h"], +) diff --git a/applications/services/locale/locale.c b/applications/services/locale/locale.c new file mode 100644 index 000000000..07f56b1b0 --- /dev/null +++ b/applications/services/locale/locale.c @@ -0,0 +1,109 @@ +#include "locale.h" + +#define TAG "LocaleSrv" + +LocaleMeasurementUnits locale_get_measurement_unit(void) { + return (LocaleMeasurementUnits)furi_hal_rtc_get_locale_units(); +} + +void locale_set_measurement_unit(LocaleMeasurementUnits format) { + furi_hal_rtc_set_locale_units((FuriHalRtcLocaleUnits)format); +} + +LocaleTimeFormat locale_get_time_format(void) { + return (LocaleTimeFormat)furi_hal_rtc_get_locale_timeformat(); +} + +void locale_set_time_format(LocaleTimeFormat format) { + furi_hal_rtc_set_locale_timeformat((FuriHalRtcLocaleTimeFormat)format); +} + +LocaleDateFormat locale_get_date_format(void) { + return (LocaleDateFormat)furi_hal_rtc_get_locale_dateformat(); +} + +void locale_set_date_format(LocaleDateFormat format) { + furi_hal_rtc_set_locale_dateformat((FuriHalRtcLocaleDateFormat)format); +} + +float locale_fahrenheit_to_celsius(float temp_f) { + return (temp_f - 32.f) / 1.8f; +} + +float locale_celsius_to_fahrenheit(float temp_c) { + return (temp_c * 1.8f + 32.f); +} + +void locale_format_time( + FuriString* out_str, + const FuriHalRtcDateTime* datetime, + const LocaleTimeFormat format, + const bool show_seconds) { + furi_assert(out_str); + furi_assert(datetime); + + uint8_t hours = datetime->hour; + uint8_t am_pm = 0; + if(format == LocaleTimeFormat12h) { + if(hours > 12) { + hours -= 12; + am_pm = 2; + } else { + am_pm = 1; + } + } + + if(show_seconds) { + furi_string_printf(out_str, "%02u:%02u:%02u", hours, datetime->minute, datetime->second); + } else { + furi_string_printf(out_str, "%02u:%02u", hours, datetime->minute); + } + + if(am_pm > 0) { + furi_string_cat_printf(out_str, " %s", (am_pm == 1) ? ("AM") : ("PM")); + } +} + +void locale_format_date( + FuriString* out_str, + const FuriHalRtcDateTime* datetime, + const LocaleDateFormat format, + const char* separator) { + furi_assert(out_str); + furi_assert(datetime); + furi_assert(separator); + + if(format == LocaleDateFormatDMY) { + furi_string_printf( + out_str, + "%02u%s%02u%s%04u", + datetime->day, + separator, + datetime->month, + separator, + datetime->year); + } else if(format == LocaleDateFormatMDY) { + furi_string_printf( + out_str, + "%02u%s%02u%s%04u", + datetime->month, + separator, + datetime->day, + separator, + datetime->year); + } else { + furi_string_printf( + out_str, + "%04u%s%02u%s%02u", + datetime->year, + separator, + datetime->month, + separator, + datetime->day); + } +} + +int32_t locale_on_system_start(void* p) { + UNUSED(p); + return 0; +} diff --git a/applications/services/locale/locale.h b/applications/services/locale/locale.h new file mode 100644 index 000000000..5f2a4d87f --- /dev/null +++ b/applications/services/locale/locale.h @@ -0,0 +1,107 @@ +#pragma once + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + LocaleMeasurementUnitsMetric = 0, /**< Metric measurement units */ + LocaleMeasurementUnitsImperial = 1, /**< Imperial measurement units */ +} LocaleMeasurementUnits; + +typedef enum { + LocaleTimeFormat24h = 0, /**< 24-hour format */ + LocaleTimeFormat12h = 1, /**< 12-hour format */ +} LocaleTimeFormat; + +typedef enum { + LocaleDateFormatDMY = 0, /**< Day/Month/Year */ + LocaleDateFormatMDY = 1, /**< Month/Day/Year */ + LocaleDateFormatYMD = 2, /**< Year/Month/Day */ +} LocaleDateFormat; + +/** Get Locale measurement units + * + * @return The locale measurement units. + */ +LocaleMeasurementUnits locale_get_measurement_unit(); + +/** Set locale measurement units + * + * @param[in] format The locale measurements units + */ +void locale_set_measurement_unit(LocaleMeasurementUnits format); + +/** Convert Fahrenheit to Celsius + * + * @param[in] temp_f The Temperature in Fahrenheit + * + * @return The Temperature in Celsius + */ +float locale_fahrenheit_to_celsius(float temp_f); + +/** Convert Celsius to Fahrenheit + * + * @param[in] temp_c The Temperature in Celsius + * + * @return The Temperature in Fahrenheit + */ +float locale_celsius_to_fahrenheit(float temp_c); + +/** Get Locale time format + * + * @return The locale time format. + */ +LocaleTimeFormat locale_get_time_format(); + +/** Set Locale Time Format + * + * @param[in] format The Locale Time Format + */ +void locale_set_time_format(LocaleTimeFormat format); + +/** Format time to furi string + * + * @param[out] out_str The FuriString to store formatted time + * @param[in] datetime Pointer to the datetime + * @param[in] format The Locale Time Format + * @param[in] show_seconds The show seconds flag + */ +void locale_format_time( + FuriString* out_str, + const FuriHalRtcDateTime* datetime, + const LocaleTimeFormat format, + const bool show_seconds); + +/** Get Locale DateFormat + * + * @return The Locale DateFormat. + */ +LocaleDateFormat locale_get_date_format(); + +/** Set Locale DateFormat + * + * @param[in] format The Locale DateFormat + */ +void locale_set_date_format(LocaleDateFormat format); + +/** Format date to furi string + * + * @param[out] out_str The FuriString to store formatted date + * @param[in] datetime Pointer to the datetime + * @param[in] format The format + * @param[in] separator The separator + */ +void locale_format_date( + FuriString* out_str, + const FuriHalRtcDateTime* datetime, + const LocaleDateFormat format, + const char* separator); + +#ifdef __cplusplus +} +#endif diff --git a/applications/settings/system/application.fam b/applications/settings/system/application.fam index 0fc456b2f..69a8f1239 100644 --- a/applications/settings/system/application.fam +++ b/applications/settings/system/application.fam @@ -3,7 +3,7 @@ App( name="System", apptype=FlipperAppType.SETTINGS, entry_point="system_settings_app", - requires=["gui"], + requires=["gui", "locale"], stack_size=1 * 1024, order=70, ) diff --git a/applications/settings/system/system_settings.c b/applications/settings/system/system_settings.c index dfce11a22..5eade2115 100644 --- a/applications/settings/system/system_settings.c +++ b/applications/settings/system/system_settings.c @@ -1,6 +1,7 @@ #include "system_settings.h" #include #include +#include const char* const log_level_text[] = { "Default", @@ -70,6 +71,59 @@ static void heap_trace_mode_changed(VariableItem* item) { furi_hal_rtc_set_heap_track_mode(heap_trace_mode_value[index]); } +const char* const mesurement_units_text[] = { + "Metric", + "Imperial", +}; + +const uint32_t mesurement_units_value[] = { + LocaleMeasurementUnitsMetric, + LocaleMeasurementUnitsImperial, +}; + +static void mesurement_units_changed(VariableItem* item) { + // SystemSettings* app = variable_item_get_context(item); + uint8_t index = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, mesurement_units_text[index]); + locale_set_measurement_unit(mesurement_units_value[index]); +} + +const char* const time_format_text[] = { + "24h", + "12h", +}; + +const uint32_t time_format_value[] = { + LocaleTimeFormat24h, + LocaleTimeFormat12h, +}; + +static void time_format_changed(VariableItem* item) { + // SystemSettings* app = variable_item_get_context(item); + uint8_t index = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, time_format_text[index]); + locale_set_time_format(time_format_value[index]); +} + +const char* const date_format_text[] = { + "D/M/Y", + "M/D/Y", + "Y/M/D", +}; + +const uint32_t date_format_value[] = { + LocaleDateFormatDMY, + LocaleDateFormatMDY, + LocaleDateFormatYMD, +}; + +static void date_format_changed(VariableItem* item) { + // SystemSettings* app = variable_item_get_context(item); + uint8_t index = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, date_format_text[index]); + locale_set_date_format(date_format_value[index]); +} + static uint32_t system_settings_exit(void* context) { UNUSED(context); return VIEW_NONE; @@ -91,6 +145,31 @@ SystemSettings* system_settings_alloc() { uint8_t value_index; app->var_item_list = variable_item_list_alloc(); + item = variable_item_list_add( + app->var_item_list, + "Units", + COUNT_OF(mesurement_units_text), + mesurement_units_changed, + app); + value_index = value_index_uint32( + locale_get_measurement_unit(), mesurement_units_value, COUNT_OF(mesurement_units_value)); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, mesurement_units_text[value_index]); + + item = variable_item_list_add( + app->var_item_list, "Time Format", COUNT_OF(time_format_text), time_format_changed, app); + value_index = value_index_uint32( + locale_get_time_format(), time_format_value, COUNT_OF(time_format_value)); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, time_format_text[value_index]); + + item = variable_item_list_add( + app->var_item_list, "Date Format", COUNT_OF(date_format_text), date_format_changed, app); + value_index = value_index_uint32( + locale_get_date_format(), date_format_value, COUNT_OF(date_format_value)); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, date_format_text[value_index]); + item = variable_item_list_add( app->var_item_list, "Log Level", COUNT_OF(log_level_text), log_level_changed, app); value_index = value_index_uint32( diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index b3afb8427..d8db33a38 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,11.0,, +Version,+,11.1,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -29,6 +29,7 @@ Header,+,applications/services/gui/view_dispatcher.h,, Header,+,applications/services/gui/view_stack.h,, Header,+,applications/services/input/input.h,, Header,+,applications/services/loader/loader.h,, +Header,+,applications/services/locale/locale.h,, Header,+,applications/services/notification/notification.h,, Header,+,applications/services/notification/notification_messages.h,, Header,+,applications/services/power/power_service/power.h,, @@ -1265,6 +1266,9 @@ Function,+,furi_hal_rtc_get_boot_mode,FuriHalRtcBootMode, Function,+,furi_hal_rtc_get_datetime,void,FuriHalRtcDateTime* Function,+,furi_hal_rtc_get_fault_data,uint32_t, Function,+,furi_hal_rtc_get_heap_track_mode,FuriHalRtcHeapTrackMode, +Function,+,furi_hal_rtc_get_locale_dateformat,FuriHalRtcLocaleDateFormat, +Function,+,furi_hal_rtc_get_locale_timeformat,FuriHalRtcLocaleTimeFormat, +Function,+,furi_hal_rtc_get_locale_units,FuriHalRtcLocaleUnits, Function,+,furi_hal_rtc_get_log_level,uint8_t, Function,+,furi_hal_rtc_get_pin_fails,uint32_t, Function,+,furi_hal_rtc_get_register,uint32_t,FuriHalRtcRegister @@ -1278,6 +1282,9 @@ Function,+,furi_hal_rtc_set_datetime,void,FuriHalRtcDateTime* Function,+,furi_hal_rtc_set_fault_data,void,uint32_t Function,+,furi_hal_rtc_set_flag,void,FuriHalRtcFlag Function,+,furi_hal_rtc_set_heap_track_mode,void,FuriHalRtcHeapTrackMode +Function,+,furi_hal_rtc_set_locale_dateformat,void,FuriHalRtcLocaleDateFormat +Function,+,furi_hal_rtc_set_locale_timeformat,void,FuriHalRtcLocaleTimeFormat +Function,+,furi_hal_rtc_set_locale_units,void,FuriHalRtcLocaleUnits Function,+,furi_hal_rtc_set_log_level,void,uint8_t Function,+,furi_hal_rtc_set_pin_fails,void,uint32_t Function,+,furi_hal_rtc_set_register,void,"FuriHalRtcRegister, uint32_t" @@ -1736,6 +1743,16 @@ Function,+,loader_update_menu,void, Function,+,loading_alloc,Loading*, Function,+,loading_free,void,Loading* Function,+,loading_get_view,View*,Loading* +Function,+,locale_celsius_to_fahrenheit,float,float +Function,+,locale_fahrenheit_to_celsius,float,float +Function,+,locale_format_date,void,"FuriString*, const FuriHalRtcDateTime*, const LocaleDateFormat, const char*" +Function,+,locale_format_time,void,"FuriString*, const FuriHalRtcDateTime*, const LocaleTimeFormat, const _Bool" +Function,+,locale_get_date_format,LocaleDateFormat, +Function,+,locale_get_measurement_unit,LocaleMeasurementUnits, +Function,+,locale_get_time_format,LocaleTimeFormat, +Function,+,locale_set_date_format,void,LocaleDateFormat +Function,+,locale_set_measurement_unit,void,LocaleMeasurementUnits +Function,+,locale_set_time_format,void,LocaleTimeFormat Function,-,localtime,tm*,const time_t* Function,-,localtime_r,tm*,"const time_t*, tm*" Function,-,log,double,double diff --git a/firmware/targets/f7/furi_hal/furi_hal_rtc.c b/firmware/targets/f7/furi_hal/furi_hal_rtc.c index c38cbfec5..e5fa8c767 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_rtc.c +++ b/firmware/targets/f7/furi_hal/furi_hal_rtc.c @@ -29,12 +29,15 @@ typedef struct { uint8_t log_level : 4; uint8_t log_reserved : 4; uint8_t flags; - uint8_t boot_mode : 4; - uint8_t heap_track_mode : 2; - uint16_t reserved : 10; -} DeveloperReg; + FuriHalRtcBootMode boot_mode : 4; + FuriHalRtcHeapTrackMode heap_track_mode : 2; + FuriHalRtcLocaleUnits locale_units : 1; + FuriHalRtcLocaleTimeFormat locale_timeformat : 1; + FuriHalRtcLocaleDateFormat locale_dateformat : 2; + uint8_t reserved : 6; +} SystemReg; -_Static_assert(sizeof(DeveloperReg) == 4, "DeveloperReg size mismatch"); +_Static_assert(sizeof(SystemReg) == 4, "SystemReg size mismatch"); #define FURI_HAL_RTC_SECONDS_PER_MINUTE 60 #define FURI_HAL_RTC_SECONDS_PER_HOUR (FURI_HAL_RTC_SECONDS_PER_MINUTE * 60) @@ -172,7 +175,7 @@ void furi_hal_rtc_set_register(FuriHalRtcRegister reg, uint32_t value) { void furi_hal_rtc_set_log_level(uint8_t level) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; + SystemReg* data = (SystemReg*)&data_reg; data->log_level = level; furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); furi_log_set_level(level); @@ -180,13 +183,13 @@ void furi_hal_rtc_set_log_level(uint8_t level) { uint8_t furi_hal_rtc_get_log_level() { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; + SystemReg* data = (SystemReg*)&data_reg; return data->log_level; } void furi_hal_rtc_set_flag(FuriHalRtcFlag flag) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; + SystemReg* data = (SystemReg*)&data_reg; data->flags |= flag; furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); @@ -197,7 +200,7 @@ void furi_hal_rtc_set_flag(FuriHalRtcFlag flag) { void furi_hal_rtc_reset_flag(FuriHalRtcFlag flag) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; + SystemReg* data = (SystemReg*)&data_reg; data->flags &= ~flag; furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); @@ -208,34 +211,73 @@ void furi_hal_rtc_reset_flag(FuriHalRtcFlag flag) { bool furi_hal_rtc_is_flag_set(FuriHalRtcFlag flag) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; + SystemReg* data = (SystemReg*)&data_reg; return data->flags & flag; } void furi_hal_rtc_set_boot_mode(FuriHalRtcBootMode mode) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; + SystemReg* data = (SystemReg*)&data_reg; data->boot_mode = mode; furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); } FuriHalRtcBootMode furi_hal_rtc_get_boot_mode() { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; - return (FuriHalRtcBootMode)data->boot_mode; + SystemReg* data = (SystemReg*)&data_reg; + return data->boot_mode; } void furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackMode mode) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; + SystemReg* data = (SystemReg*)&data_reg; data->heap_track_mode = mode; furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); } FuriHalRtcHeapTrackMode furi_hal_rtc_get_heap_track_mode() { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); - DeveloperReg* data = (DeveloperReg*)&data_reg; - return (FuriHalRtcHeapTrackMode)data->heap_track_mode; + SystemReg* data = (SystemReg*)&data_reg; + return data->heap_track_mode; +} + +void furi_hal_rtc_set_locale_units(FuriHalRtcLocaleUnits value) { + uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); + SystemReg* data = (SystemReg*)&data_reg; + data->locale_units = value; + furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); +} + +FuriHalRtcLocaleUnits furi_hal_rtc_get_locale_units() { + uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); + SystemReg* data = (SystemReg*)&data_reg; + return data->locale_units; +} + +void furi_hal_rtc_set_locale_timeformat(FuriHalRtcLocaleTimeFormat value) { + uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); + SystemReg* data = (SystemReg*)&data_reg; + data->locale_timeformat = value; + furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); +} + +FuriHalRtcLocaleTimeFormat furi_hal_rtc_get_locale_timeformat() { + uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); + SystemReg* data = (SystemReg*)&data_reg; + return data->locale_timeformat; +} + +void furi_hal_rtc_set_locale_dateformat(FuriHalRtcLocaleDateFormat value) { + uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); + SystemReg* data = (SystemReg*)&data_reg; + data->locale_dateformat = value; + furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); +} + +FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat() { + uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); + SystemReg* data = (SystemReg*)&data_reg; + return data->locale_dateformat; } void furi_hal_rtc_set_datetime(FuriHalRtcDateTime* datetime) { diff --git a/firmware/targets/furi_hal_include/furi_hal_rtc.h b/firmware/targets/furi_hal_include/furi_hal_rtc.h index 5ce122271..fe095e749 100644 --- a/firmware/targets/furi_hal_include/furi_hal_rtc.h +++ b/firmware/targets/furi_hal_include/furi_hal_rtc.h @@ -59,53 +59,194 @@ typedef enum { FuriHalRtcRegisterMAX, /**< Service value, do not use */ } FuriHalRtcRegister; +typedef enum { + FuriHalRtcLocaleUnitsMetric = 0, /**< Metric measurement units */ + FuriHalRtcLocaleUnitsImperial = 1, /**< Imperial measurement units */ +} FuriHalRtcLocaleUnits; + +typedef enum { + FuriHalRtcLocaleTimeFormat24h = 0, /**< 24-hour format */ + FuriHalRtcLocaleTimeFormat12h = 1, /**< 12-hour format */ +} FuriHalRtcLocaleTimeFormat; + +typedef enum { + FuriHalRtcLocaleDateFormatDMY = 0, /**< Day/Month/Year */ + FuriHalRtcLocaleDateFormatMDY = 1, /**< Month/Day/Year */ + FuriHalRtcLocaleDateFormatYMD = 2, /**< Year/Month/Day */ +} FuriHalRtcLocaleDateFormat; + /** Early initialization */ void furi_hal_rtc_init_early(); -/** Early deinitialization */ +/** Early de-initialization */ void furi_hal_rtc_deinit_early(); /** Initialize RTC subsystem */ void furi_hal_rtc_init(); +/** Get RTC register content + * + * @param[in] reg The register identifier + * + * @return content of the register + */ uint32_t furi_hal_rtc_get_register(FuriHalRtcRegister reg); +/** Set register content + * + * @param[in] reg The register identifier + * @param[in] value The value to store into register + */ void furi_hal_rtc_set_register(FuriHalRtcRegister reg, uint32_t value); +/** Set Log Level value + * + * @param[in] level The level to store + */ void furi_hal_rtc_set_log_level(uint8_t level); +/** Get Log Level value + * + * @return The Log Level value + */ uint8_t furi_hal_rtc_get_log_level(); +/** Set RTC Flag + * + * @param[in] flag The flag to set + */ void furi_hal_rtc_set_flag(FuriHalRtcFlag flag); +/** Reset RTC Flag + * + * @param[in] flag The flag to reset + */ void furi_hal_rtc_reset_flag(FuriHalRtcFlag flag); +/** Check if RTC Flag is set + * + * @param[in] flag The flag to check + * + * @return true if set + */ bool furi_hal_rtc_is_flag_set(FuriHalRtcFlag flag); +/** Set RTC boot mode + * + * @param[in] mode The mode to set + */ void furi_hal_rtc_set_boot_mode(FuriHalRtcBootMode mode); +/** Get RTC boot mode + * + * @return The RTC boot mode. + */ FuriHalRtcBootMode furi_hal_rtc_get_boot_mode(); +/** Set Heap Track mode + * + * @param[in] mode The mode to set + */ void furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackMode mode); +/** Get RTC Heap Track mode + * + * @return The RTC heap track mode. + */ FuriHalRtcHeapTrackMode furi_hal_rtc_get_heap_track_mode(); +/** Set locale units + * + * @param[in] mode The RTC Locale Units + */ +void furi_hal_rtc_set_locale_units(FuriHalRtcLocaleUnits value); + +/** Get RTC Locale Units + * + * @return The RTC Locale Units. + */ +FuriHalRtcLocaleUnits furi_hal_rtc_get_locale_units(); + +/** Set RTC Locale Time Format + * + * @param[in] value The RTC Locale Time Format + */ +void furi_hal_rtc_set_locale_timeformat(FuriHalRtcLocaleTimeFormat value); + +/** Get RTC Locale Time Format + * + * @return The RTC Locale Time Format. + */ +FuriHalRtcLocaleTimeFormat furi_hal_rtc_get_locale_timeformat(); + +/** Set RTC Locale Date Format + * + * @param[in] value The RTC Locale Date Format + */ +void furi_hal_rtc_set_locale_dateformat(FuriHalRtcLocaleDateFormat value); + +/** Get RTC Locale Date Format + * + * @return The RTC Locale Date Format + */ +FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat(); + +/** Set RTC Date Time + * + * @param datetime The date time to set + */ void furi_hal_rtc_set_datetime(FuriHalRtcDateTime* datetime); +/** Get RTC Date Time + * + * @param datetime The datetime + */ void furi_hal_rtc_get_datetime(FuriHalRtcDateTime* datetime); +/** Validate Date Time + * + * @param datetime The datetime to validate + * + * @return { description_of_the_return_value } + */ bool furi_hal_rtc_validate_datetime(FuriHalRtcDateTime* datetime); +/** Set RTC Fault Data + * + * @param[in] value The value + */ void furi_hal_rtc_set_fault_data(uint32_t value); +/** Get RTC Fault Data + * + * @return RTC Fault Data value + */ uint32_t furi_hal_rtc_get_fault_data(); +/** Set Pin Fails count + * + * @param[in] value The Pin Fails count + */ void furi_hal_rtc_set_pin_fails(uint32_t value); +/** Get Pin Fails count + * + * @return Pin Fails Count + */ uint32_t furi_hal_rtc_get_pin_fails(); +/** Get UNIX Timestamp + * + * @return Unix Timestamp in seconds from UNIX epoch start + */ uint32_t furi_hal_rtc_get_timestamp(); +/** Convert DateTime to UNIX timestamp + * + * @param datetime The datetime + * + * @return UNIX Timestamp in seconds from UNIX epoch start + */ uint32_t furi_hal_rtc_datetime_to_timestamp(FuriHalRtcDateTime* datetime); #ifdef __cplusplus From 30801d4eb85a44c336211aa61665a89d740f593c Mon Sep 17 00:00:00 2001 From: Dmitry Eroshenko Date: Mon, 19 Dec 2022 17:01:30 +0700 Subject: [PATCH 06/16] Added Toshiba F-WSA20 and Senko TR828 Works for other models of the brands. Both fans purchased in Vietnam --- assets/resources/infrared/assets/fans.ir | 49 +++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/assets/resources/infrared/assets/fans.ir b/assets/resources/infrared/assets/fans.ir index a03377f05..6cd8ac946 100644 --- a/assets/resources/infrared/assets/fans.ir +++ b/assets/resources/infrared/assets/fans.ir @@ -1,6 +1,6 @@ Filetype: IR library file Version: 1 -# Last Updated 6th Dec, 2022 +# Last Updated 19th Dec, 2022 # name: POWER type: parsed @@ -1131,3 +1131,50 @@ frequency: 38000 duty_cycle: 0.330000 data: 1366 388 1295 387 446 1164 1368 387 1296 387 448 1164 518 1164 493 1189 517 1165 492 1189 493 1189 493 7851 1365 387 1270 388 446 1190 1365 387 1295 387 447 1192 490 1193 489 1193 489 1194 488 1194 488 1193 489 7855 1337 386 1296 386 448 1193 1338 386 1296 386 448 1193 489 1193 489 1193 489 1193 489 1193 489 1193 489 7855 1337 386 1297 386 448 1194 1337 386 1296 386 448 1194 488 1194 488 1194 488 1194 488 1194 488 1194 488 8160 1336 387 1296 387 447 1194 1337 387 1296 386 448 1194 488 1194 488 1194 488 1194 488 1194 488 1194 488 7855 1336 386 1297 387 447 1195 1336 386 1297 386 448 1195 486 1195 487 1195 487 1195 487 1196 486 1196 486 7881 1310 387 1272 397 436 1245 1286 397 1285 397 436 1246 436 1246 436 1247 435 1247 435 1248 434 1248 434 7934 1259 424 1259 424 408 1274 1258 424 1259 424 408 1274 408 1274 408 1274 408 1274 408 1274 408 1274 408 8239 1258 425 1258 424 408 1274 1258 424 1258 425 407 1273 408 1273 409 1273 408 1273 408 1274 408 1273 408 7907 1283 424 1258 424 409 1248 1283 399 1283 400 433 1247 434 1247 434 1247 434 1247 434 1247 434 1247 434 7905 1282 424 1258 425 407 1273 1257 425 1257 425 407 1273 407 1274 407 1274 407 1274 407 1275 406 1275 406 7958 1230 478 1204 478 353 1328 1204 478 1204 453 378 1327 353 1328 353 1302 379 1301 380 1301 380 1300 381 # +name: POWER +type: parsed +protocol: NECext +address: 4B 14 00 00 +command: 80 7F 00 00 +# +name: MODE +type: parsed +protocol: NECext +address: 4B 14 00 00 +command: 20 DF 00 00 +# +name: SWING +type: parsed +protocol: NECext +address: 4B 14 00 00 +command: C0 3F 00 00 +# +name: TIMER +type: parsed +protocol: NECext +address: 4B 14 00 00 +command: A0 5F 00 00 +# ON/Speed +name: POWER +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1280 423 1285 445 414 1287 1259 418 1279 450 409 1266 442 1260 437 1265 443 1259 438 1264 1282 421 438 8680 1284 419 1289 442 406 1268 1288 415 1282 447 412 1263 434 1267 440 1262 435 1266 441 1261 1285 444 415 8677 1287 415 1282 447 412 1263 1283 447 1261 442 406 1268 439 1262 435 1267 440 1262 435 1267 1289 413 435 8683 1281 421 1286 443 416 1259 1287 416 1281 448 411 1263 444 1258 439 1262 435 1267 440 1263 1283 419 440 8679 1285 417 1280 449 410 1292 1254 448 1260 443 416 1259 438 1264 444 1258 439 1263 444 1258 1288 415 444 8675 1289 413 1284 445 414 1262 1284 419 1288 440 408 1293 415 1261 436 1265 442 1260 437 1265 1281 422 437 8680 1284 418 1289 440 408 1267 1289 414 1283 445 414 1262 435 1266 442 1260 437 1265 442 1261 1285 418 441 8678 1286 417 1290 439 409 1267 1289 414 1283 445 414 1262 435 1267 440 1262 435 1267 440 1263 1283 420 439 +# +name: MODE +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1284 419 1288 442 417 1258 1288 415 1282 448 411 1264 443 1258 439 1263 444 1258 1288 415 444 1258 439 8679 1284 419 1288 441 407 1267 1289 441 1256 447 412 1262 435 1267 440 1262 435 1293 1263 413 435 1267 440 8679 1284 418 1289 441 407 1267 1289 414 1283 447 412 1262 435 1267 440 1261 436 1267 1289 413 435 1267 440 8678 1285 418 1289 440 408 1267 1289 440 1257 447 412 1262 435 1267 440 1262 435 1268 1288 414 434 1268 439 8679 1284 418 1289 440 408 1267 1289 413 1284 445 414 1261 436 1266 441 1260 437 1266 1290 412 436 1266 441 8676 1287 415 1282 448 411 1264 1282 421 1286 443 416 1258 439 1263 434 1267 440 1262 1284 419 440 1262 435 8683 1280 422 1285 444 415 1287 1259 444 1253 449 410 1292 415 1285 412 1264 443 1259 1287 416 443 1259 438 8680 1284 420 1287 414 434 1268 1288 415 1282 447 412 1289 408 1267 440 1262 435 1267 1289 414 434 1268 439 +# +name: SWING +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1281 422 1285 444 415 1260 1286 444 1263 439 409 1266 441 1261 1285 445 414 1261 436 1266 441 1261 436 8682 1281 421 1286 444 415 1260 1286 445 1262 439 409 1266 441 1261 1285 445 414 1261 436 1266 441 1260 437 8683 1280 422 1286 444 415 1261 1285 445 1262 440 408 1267 440 1262 1284 446 413 1262 435 1268 439 1262 435 8684 1279 423 1284 445 414 1261 1285 445 1263 439 409 1265 442 1260 1286 444 415 1260 437 1265 442 1259 438 8682 1281 421 1286 443 416 1259 1287 443 1254 448 411 1264 443 1259 1287 443 416 1259 438 1265 442 1260 437 8682 1281 421 1286 444 415 1260 1286 444 1253 450 409 1266 441 1261 1285 445 414 1261 436 1266 441 1261 436 8683 1290 413 1284 445 414 1262 1283 446 1261 441 407 1294 413 1262 1284 420 439 1263 434 1267 440 1262 435 +# +name: TIMER +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1283 420 1287 443 416 1259 1287 443 1254 449 410 1292 415 1260 437 1266 1290 439 409 1266 442 1261 436 8684 1290 413 1284 446 413 1263 1283 447 1261 442 417 1258 439 1263 444 1259 1287 442 417 1259 438 1264 443 8677 1287 416 1281 449 410 1265 1281 449 1259 444 415 1260 437 1265 442 1260 1286 443 416 1260 437 1265 442 8676 1288 415 1282 447 412 1263 1283 447 1261 442 417 1257 440 1263 434 1268 1288 441 418 1257 440 1263 434 8685 1289 414 1283 447 412 1263 1283 447 1261 442 417 1258 439 1263 445 1258 1288 442 417 1258 439 1264 444 8676 1288 415 1282 448 411 1264 1282 448 1260 444 415 1259 438 1264 443 1260 1286 417 442 1260 437 1265 442 8677 1286 416 1281 449 410 1265 1281 422 1285 444 415 1260 437 1265 442 1260 1286 417 442 1260 437 1265 442 From 94453d91003c38e7ebc946738056cbaefc414f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Mon, 19 Dec 2022 20:57:44 +0900 Subject: [PATCH 07/16] [FL-3046] Notification: fix recursive speaker acquire #2147 --- applications/services/notification/notification_app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 4f6d42aa0..b6579f547 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -150,7 +150,7 @@ void notification_vibro_off() { } void notification_sound_on(float freq, float volume) { - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(freq, volume); } } From 36e15a1352a6aa7068698647b71b7ccd56b8216f Mon Sep 17 00:00:00 2001 From: Konstantin Volkov <72250702+doomwastaken@users.noreply.github.com> Date: Mon, 19 Dec 2022 16:07:23 +0300 Subject: [PATCH 08/16] Doom/Unit_tests flashing proper firmware (#2133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doom: should fix all issues, needs review * fixed flash call and added port * increased timeout, full flash wasn't completing * turned serial back * added unit formatting and force flag for overwriting files * testing crash * fixed step names, added release flashing, removed unit_tests from updater tests * changed checkout method, added step validations * removed duplicated tag * fixed styling, stopped relying on shebang lines, removed debug output * moved format to the end, flash_usb_full copies resourses already * awaiting flipper after flashing and step status for file move Co-authored-by: Konstantin Volkov Co-authored-by: あく --- .github/workflows/amap_analyse.yml | 3 +- .github/workflows/build.yml | 5 +- .github/workflows/lint_c.yml | 4 +- .github/workflows/lint_python.yml | 6 ++- .github/workflows/merge_report.yml | 6 ++- .github/workflows/pvs_studio.yml | 5 +- .github/workflows/unit_tests.yml | 79 ++++++++++++++++++++++++------ scripts/testing/await_flipper.py | 2 +- 8 files changed, 85 insertions(+), 25 deletions(-) diff --git a/.github/workflows/amap_analyse.yml b/.github/workflows/amap_analyse.yml index 6231c5886..1340e4cde 100644 --- a/.github/workflows/amap_analyse.yml +++ b/.github/workflows/amap_analyse.yml @@ -11,6 +11,7 @@ on: env: TARGETS: f7 + FBT_TOOLCHAIN_PATH: /opt jobs: amap_analyse: @@ -78,7 +79,7 @@ jobs: - name: 'Upload report to DB' run: | - FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh + source scripts/toolchain/fbtenv.sh get_size() { SECTION="$1"; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99c272e60..2de0e57c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ on: env: TARGETS: f7 DEFAULT_TARGET: f7 + FBT_TOOLCHAIN_PATH: /runner/_work jobs: main: @@ -55,7 +56,7 @@ jobs: run: | set -e for TARGET in ${TARGETS}; do - FBT_TOOLCHAIN_PATH=/runner/_work ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \ + ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \ copro_dist updater_package ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }} done @@ -157,6 +158,6 @@ jobs: run: | set -e for TARGET in ${TARGETS}; do - FBT_TOOLCHAIN_PATH=/runner/_work ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \ + ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \ updater_package DEBUG=0 COMPACT=1 done diff --git a/.github/workflows/lint_c.yml b/.github/workflows/lint_c.yml index 71ec24ff6..a6fd5127c 100644 --- a/.github/workflows/lint_c.yml +++ b/.github/workflows/lint_c.yml @@ -11,6 +11,8 @@ on: env: TARGETS: f7 + FBT_TOOLCHAIN_PATH: /runner/_work + SET_GH_OUTPUT: 1 jobs: lint_c_cpp: @@ -30,7 +32,7 @@ jobs: - name: 'Check code formatting' id: syntax_check - run: SET_GH_OUTPUT=1 FBT_TOOLCHAIN_PATH=/runner/_work ./fbt lint + run: ./fbt lint - name: Report code formatting errors if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 44f233db8..66c36064c 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -9,6 +9,10 @@ on: - '*' pull_request: +env: + FBT_TOOLCHAIN_PATH: /runner/_work + SET_GH_OUTPUT: 1 + jobs: lint_python: runs-on: [self-hosted,FlipperZeroShell] @@ -26,4 +30,4 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: 'Check code formatting' - run: SET_GH_OUTPUT=1 FBT_TOOLCHAIN_PATH=/runner/_work ./fbt lint_py + run: ./fbt lint_py diff --git a/.github/workflows/merge_report.yml b/.github/workflows/merge_report.yml index b6c089056..13fab0948 100644 --- a/.github/workflows/merge_report.yml +++ b/.github/workflows/merge_report.yml @@ -4,6 +4,10 @@ on: push: branches: - dev + +env: + FBT_TOOLCHAIN_PATH: /runner/_work + jobs: merge_report: runs-on: [self-hosted,FlipperZeroShell] @@ -33,7 +37,7 @@ jobs: - name: 'Check ticket and report' run: | - FBT_TOOLCHAIN_PATH=/runner/_work source scripts/toolchain/fbtenv.sh + source scripts/toolchain/fbtenv.sh python3 -m pip install slack_sdk python3 scripts/merge_report_qa.py \ ${{ secrets.QA_REPORT_SLACK_TOKEN }} \ diff --git a/.github/workflows/pvs_studio.yml b/.github/workflows/pvs_studio.yml index 5473f19f0..5bb04afcb 100644 --- a/.github/workflows/pvs_studio.yml +++ b/.github/workflows/pvs_studio.yml @@ -12,6 +12,7 @@ on: env: TARGETS: f7 DEFAULT_TARGET: f7 + FBT_TOOLCHAIN_PATH: /runner/_work jobs: analyse_c_cpp: @@ -49,11 +50,11 @@ jobs: - name: 'Generate compile_comands.json' run: | - FBT_TOOLCHAIN_PATH=/runner/_work ./fbt COMPACT=1 version_json proto_ver icons firmware_cdb dolphin_internal dolphin_blocking _fap_icons + ./fbt COMPACT=1 version_json proto_ver icons firmware_cdb dolphin_internal dolphin_blocking _fap_icons - name: 'Static code analysis' run: | - FBT_TOOLCHAIN_PATH=/runner/_work source scripts/toolchain/fbtenv.sh + source scripts/toolchain/fbtenv.sh pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }} pvs-studio-analyzer analyze \ @.pvsoptions \ diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 308ec5929..361b647f7 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -6,6 +6,7 @@ on: env: TARGETS: f7 DEFAULT_TARGET: f7 + FBT_TOOLCHAIN_PATH: /opt jobs: run_units_on_test_bench: @@ -28,35 +29,81 @@ jobs: run: | echo "flipper=/dev/ttyACM0" >> $GITHUB_OUTPUT + - name: 'Flashing target firmware' + id: first_full_flash + run: | + ./fbt flash_usb_full PORT=${{steps.device.outputs.flipper}} FORCE=1 + source scripts/toolchain/fbtenv.sh + python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} + + - name: 'Validating updater' + id: second_full_flash + if: success() + run: | + ./fbt flash_usb_full PORT=${{steps.device.outputs.flipper}} FORCE=1 + source scripts/toolchain/fbtenv.sh + python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} + - name: 'Flash unit tests firmware' id: flashing + if: success() run: | - FBT_TOOLCHAIN_PATH=/opt ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1 + ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1 - name: 'Wait for flipper to finish updating' id: connect if: steps.flashing.outcome == 'success' run: | - . scripts/toolchain/fbtenv.sh - ./scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} - - - name: 'Format flipper SD card' - id: format - if: steps.connect.outcome == 'success' - run: | - . scripts/toolchain/fbtenv.sh - ./scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext + source scripts/toolchain/fbtenv.sh + python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} - name: 'Copy assets and unit tests data to flipper' id: copy - if: steps.format.outcome == 'success' + if: steps.connect.outcome == 'success' run: | - . scripts/toolchain/fbtenv.sh - ./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/resources /ext - ./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/unit_tests /ext/unit_tests + source scripts/toolchain/fbtenv.sh + python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/unit_tests /ext/unit_tests - name: 'Run units and validate results' if: steps.copy.outcome == 'success' run: | - . scripts/toolchain/fbtenv.sh - ./scripts/testing/units.py ${{steps.device.outputs.flipper}} + source scripts/toolchain/fbtenv.sh + python3 scripts/testing/units.py ${{steps.device.outputs.flipper}} + + - name: 'Get last release tag' + id: release_tag + if: success() + run: | + echo "tag=$(git tag -l --sort=-version:refname | grep -v "rc\|RC" | head -1)" >> $GITHUB_OUTPUT + + - name: 'Decontaminate previous build leftovers' + if: success() + run: | + if [ -d .git ]; then + git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" + fi + + - name: 'Checkout latest release' + uses: actions/checkout@v3 + if: success() + with: + fetch-depth: 0 + ref: ${{ steps.release_tag.outputs.tag }} + + - name: 'Flash last release' + if: success() + run: | + ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1 + + - name: 'Wait for flipper to finish updating' + if: success() + run: | + source scripts/toolchain/fbtenv.sh + python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} + + - name: 'Format flipper SD card' + id: format + if: success() + run: | + source scripts/toolchain/fbtenv.sh + python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext diff --git a/scripts/testing/await_flipper.py b/scripts/testing/await_flipper.py index 1f0d16194..efae6765d 100755 --- a/scripts/testing/await_flipper.py +++ b/scripts/testing/await_flipper.py @@ -24,7 +24,7 @@ def flp_serial_by_name(flp_name): return "" -UPDATE_TIMEOUT = 30 +UPDATE_TIMEOUT = 60 def main(): From da32d252db503a54234d32169e7bc7495d0a536b Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:54:59 +0300 Subject: [PATCH 09/16] Clock - use system locale settings --- applications/main/clock_app/application.fam | 13 --- applications/main/clock_app/clock_app.c | 25 +++-- applications/main/clock_app/clock_app.h | 5 +- applications/main/clock_app/clock_settings.h | 36 ------- .../main/clock_app/clock_settings_app.c | 102 ------------------ .../main/clock_app/clock_settings_filename.h | 3 - 6 files changed, 15 insertions(+), 169 deletions(-) delete mode 100644 applications/main/clock_app/clock_settings.h delete mode 100644 applications/main/clock_app/clock_settings_app.c delete mode 100644 applications/main/clock_app/clock_settings_filename.h diff --git a/applications/main/clock_app/application.fam b/applications/main/clock_app/application.fam index 245307368..9016973c5 100644 --- a/applications/main/clock_app/application.fam +++ b/applications/main/clock_app/application.fam @@ -5,21 +5,8 @@ App( entry_point="clock_app", cdefines=["APP_CLOCK"], requires=["gui"], - provides=["clock_settings"], icon="A_Clock_14", stack_size=2 * 1024, order=81, ) - -App( - appid="clock_settings", - name="Clock", - apptype=FlipperAppType.SETTINGS, - entry_point="clock_settings_app", - requires=["gui","clock"], - stack_size=1 * 1024, - order=20, -) - - diff --git a/applications/main/clock_app/clock_app.c b/applications/main/clock_app/clock_app.c index c5b4dd9e8..47b2ba8bd 100644 --- a/applications/main/clock_app/clock_app.c +++ b/applications/main/clock_app/clock_app.c @@ -33,7 +33,7 @@ static void clock_render_callback(Canvas* const canvas, void* ctx) { char meridian_string[MERIDIAN_LEN]; char timer_string[20]; - if(state->settings.time_format == H24) { + if(state->time_format == LocaleTimeFormat24h) { snprintf( time_string, TIME_LEN, CLOCK_TIME_FORMAT, curr_dt.hour, curr_dt.minute, curr_dt.second); } else { @@ -54,9 +54,12 @@ static void clock_render_callback(Canvas* const canvas, void* ctx) { pm12 ? MERIDIAN_STRING_PM : MERIDIAN_STRING_AM); } - if(state->settings.date_format == Iso) { + if(state->date_format == LocaleDateFormatYMD) { snprintf( date_string, DATE_LEN, CLOCK_ISO_DATE_FORMAT, curr_dt.year, curr_dt.month, curr_dt.day); + } else if(state->date_format == LocaleDateFormatMDY) { + snprintf( + date_string, DATE_LEN, CLOCK_RFC_DATE_FORMAT, curr_dt.month, curr_dt.day, curr_dt.year); } else { snprintf( date_string, DATE_LEN, CLOCK_RFC_DATE_FORMAT, curr_dt.day, curr_dt.month, curr_dt.year); @@ -84,7 +87,7 @@ static void clock_render_callback(Canvas* const canvas, void* ctx) { canvas_set_font(canvas, FontSecondary); canvas_draw_str_aligned(canvas, 64, 42, AlignCenter, AlignTop, date_string); - if(state->settings.time_format == H12) + if(state->time_format == LocaleTimeFormat12h) canvas_draw_str_aligned(canvas, 65, 12, AlignCenter, AlignCenter, meridian_string); } if(timer_running) { @@ -95,16 +98,12 @@ static void clock_render_callback(Canvas* const canvas, void* ctx) { } static void clock_state_init(ClockState* const state) { - LOAD_CLOCK_SETTINGS(&state->settings); - if(state->settings.time_format != H12 && state->settings.time_format != H24) { - state->settings.time_format = H12; - } - if(state->settings.date_format != Iso && state->settings.date_format != Rfc) { - state->settings.date_format = Iso; - } - FURI_LOG_D(TAG, "Time format: %s", state->settings.time_format == H12 ? "12h" : "24h"); - FURI_LOG_D( - TAG, "Date format: %s", state->settings.date_format == Iso ? "ISO 8601" : "RFC 5322"); + state->time_format = locale_get_time_format(); + + state->date_format = locale_get_date_format(); + + //FURI_LOG_D(TAG, "Time format: %s", state->settings.time_format == H12 ? "12h" : "24h"); + //FURI_LOG_D(TAG, "Date format: %s", state->settings.date_format == Iso ? "ISO 8601" : "RFC 5322"); //furi_hal_rtc_get_datetime(&state->datetime); } diff --git a/applications/main/clock_app/clock_app.h b/applications/main/clock_app/clock_app.h index c0c7436c8..693bdfac0 100644 --- a/applications/main/clock_app/clock_app.h +++ b/applications/main/clock_app/clock_app.h @@ -1,7 +1,7 @@ #pragma once #include -#include "clock_settings.h" +#include #define TAG "Clock" @@ -28,7 +28,8 @@ typedef struct { } PluginEvent; typedef struct { - ClockSettings settings; + LocaleDateFormat date_format; + LocaleTimeFormat time_format; FuriHalRtcDateTime datetime; FuriMutex* mutex; FuriMessageQueue* event_queue; diff --git a/applications/main/clock_app/clock_settings.h b/applications/main/clock_app/clock_settings.h deleted file mode 100644 index b2970f659..000000000 --- a/applications/main/clock_app/clock_settings.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "clock_settings_filename.h" - -#include -#include -#include -#include -#include - -#define CLOCK_SETTINGS_VER (1) -#define CLOCK_SETTINGS_PATH EXT_PATH(CLOCK_SETTINGS_FILE_NAME) -#define CLOCK_SETTINGS_MAGIC (0xC1) - -#define SAVE_CLOCK_SETTINGS(x) \ - saved_struct_save( \ - CLOCK_SETTINGS_PATH, (x), sizeof(ClockSettings), CLOCK_SETTINGS_MAGIC, CLOCK_SETTINGS_VER) - -#define LOAD_CLOCK_SETTINGS(x) \ - saved_struct_load( \ - CLOCK_SETTINGS_PATH, (x), sizeof(ClockSettings), CLOCK_SETTINGS_MAGIC, CLOCK_SETTINGS_VER) - -typedef enum { - H12 = 1, - H24 = 2, -} TimeFormat; - -typedef enum { - Iso = 1, // ISO 8601: yyyy-mm-dd - Rfc = 2, // RFC 5322: dd-mm-yyyy -} DateFormat; - -typedef struct { - TimeFormat time_format; - DateFormat date_format; -} ClockSettings; \ No newline at end of file diff --git a/applications/main/clock_app/clock_settings_app.c b/applications/main/clock_app/clock_settings_app.c deleted file mode 100644 index c9fd87eda..000000000 --- a/applications/main/clock_app/clock_settings_app.c +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include -#include "clock_settings.h" - -#define TAG "Clock" - -typedef struct { - ClockSettings clock_settings; - Gui* gui; - ViewDispatcher* view_dispatcher; - VariableItemList* variable_item_list; -} ClockAppSettings; - -static uint32_t clock_app_settings_exit(void* context) { - UNUSED(context); - return VIEW_NONE; -} - -#define TIME_FORMAT_COUNT 2 -const char* const time_format_text[TIME_FORMAT_COUNT] = { - "12h", - "24h", -}; - -const uint32_t time_format_value[TIME_FORMAT_COUNT] = {H12, H24}; - -#define DATE_FORMAT_COUNT 2 -const char* const date_format_text[DATE_FORMAT_COUNT] = { - "mm-dd", // ISO 8601 - "dd-mm", // RFC 5322 -}; - -const uint32_t date_format_value[DATE_FORMAT_COUNT] = {Iso, Rfc}; - -static void time_format_changed(VariableItem* item) { - ClockAppSettings* app = variable_item_get_context(item); - uint8_t index = variable_item_get_current_value_index(item); - variable_item_set_current_value_text(item, time_format_text[index]); - app->clock_settings.time_format = time_format_value[index]; -} - -static void date_format_changed(VariableItem* item) { - ClockAppSettings* app = variable_item_get_context(item); - uint8_t index = variable_item_get_current_value_index(item); - variable_item_set_current_value_text(item, date_format_text[index]); - app->clock_settings.date_format = date_format_value[index]; -} - -static ClockAppSettings* alloc_settings() { - ClockAppSettings* app = malloc(sizeof(ClockAppSettings)); - LOAD_CLOCK_SETTINGS(&app->clock_settings); - app->gui = furi_record_open(RECORD_GUI); - app->variable_item_list = variable_item_list_alloc(); - View* view = variable_item_list_get_view(app->variable_item_list); - view_set_previous_callback(view, clock_app_settings_exit); - - VariableItem* item; - uint8_t value_index; - - item = variable_item_list_add( - app->variable_item_list, "Clock format", TIME_FORMAT_COUNT, time_format_changed, app); - value_index = value_index_uint32( - (uint32_t)(app->clock_settings.time_format), time_format_value, TIME_FORMAT_COUNT); - //FURI_LOG_T(TAG, "Time format index: %u", value_index); - variable_item_set_current_value_index(item, value_index); - variable_item_set_current_value_text(item, time_format_text[value_index]); - - item = variable_item_list_add( - app->variable_item_list, "Date format", DATE_FORMAT_COUNT, date_format_changed, app); - value_index = value_index_uint32( - (uint32_t)(app->clock_settings.date_format), date_format_value, DATE_FORMAT_COUNT); - //FURI_LOG_T(TAG, "Date format index: %u", value_index); - variable_item_set_current_value_index(item, value_index); - variable_item_set_current_value_text(item, date_format_text[value_index]); - - app->view_dispatcher = view_dispatcher_alloc(); - view_dispatcher_enable_queue(app->view_dispatcher); - view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); - view_dispatcher_add_view(app->view_dispatcher, 0, view); - view_dispatcher_switch_to_view(app->view_dispatcher, 0); - - return app; -} - -static void free_settings(ClockAppSettings* app) { - view_dispatcher_remove_view(app->view_dispatcher, 0); - variable_item_list_free(app->variable_item_list); - view_dispatcher_free(app->view_dispatcher); - furi_record_close(RECORD_GUI); - SAVE_CLOCK_SETTINGS(&app->clock_settings); - free(app); -} - -extern int32_t clock_settings_app(void* p) { - UNUSED(p); - ClockAppSettings* app = alloc_settings(); - view_dispatcher_run(app->view_dispatcher); - free_settings(app); - return 0; -} diff --git a/applications/main/clock_app/clock_settings_filename.h b/applications/main/clock_app/clock_settings_filename.h deleted file mode 100644 index 7097134dc..000000000 --- a/applications/main/clock_app/clock_settings_filename.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define CLOCK_SETTINGS_FILE_NAME ".clock.settings" From 94e7bb7fe3162df30933068c3eb123d0606a7354 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:56:13 +0300 Subject: [PATCH 10/16] Add mouse jiggler to USB Keyboard&Mouse App --- applications/plugins/usbkeyboard/usb_hid.c | 21 +++ applications/plugins/usbkeyboard/usb_hid.h | 3 + .../usbkeyboard/views/usb_hid_mouse_jiggler.c | 130 ++++++++++++++++++ .../usbkeyboard/views/usb_hid_mouse_jiggler.h | 14 ++ 4 files changed, 168 insertions(+) create mode 100644 applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.c create mode 100644 applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.h diff --git a/applications/plugins/usbkeyboard/usb_hid.c b/applications/plugins/usbkeyboard/usb_hid.c index 60acb6e32..744d6463e 100644 --- a/applications/plugins/usbkeyboard/usb_hid.c +++ b/applications/plugins/usbkeyboard/usb_hid.c @@ -10,6 +10,7 @@ enum UsbDebugSubmenuIndex { UsbHidSubmenuIndexKeyboard, UsbHidSubmenuIndexMedia, UsbHidSubmenuIndexMouse, + UsbHidSubmenuIndexMouseJiggler, }; void usb_hid_submenu_callback(void* context, uint32_t index) { @@ -27,6 +28,9 @@ void usb_hid_submenu_callback(void* context, uint32_t index) { } else if(index == UsbHidSubmenuIndexMouse) { app->view_id = UsbHidViewMouse; view_dispatcher_switch_to_view(app->view_dispatcher, UsbHidViewMouse); + } else if(index == UsbHidSubmenuIndexMouseJiggler) { + app->view_id = UsbHidViewMouseJiggler; + view_dispatcher_switch_to_view(app->view_dispatcher, UsbHidViewMouseJiggler); } } @@ -76,6 +80,12 @@ UsbHid* usb_hid_app_alloc() { app->submenu, "Media", UsbHidSubmenuIndexMedia, usb_hid_submenu_callback, app); submenu_add_item( app->submenu, "Mouse", UsbHidSubmenuIndexMouse, usb_hid_submenu_callback, app); + submenu_add_item( + app->submenu, + "Mouse Jiggler", + UsbHidSubmenuIndexMouseJiggler, + usb_hid_submenu_callback, + app); view_set_previous_callback(submenu_get_view(app->submenu), usb_hid_exit); view_dispatcher_add_view( app->view_dispatcher, UsbHidViewSubmenu, submenu_get_view(app->submenu)); @@ -121,6 +131,15 @@ UsbHid* usb_hid_app_alloc() { view_dispatcher_add_view( app->view_dispatcher, UsbHidViewMouse, usb_hid_mouse_get_view(app->usb_hid_mouse)); + // Mouse jiggler view + app->hid_mouse_jiggler = hid_mouse_jiggler_alloc(app); + view_set_previous_callback( + hid_mouse_jiggler_get_view(app->hid_mouse_jiggler), usb_hid_exit_confirm_view); + view_dispatcher_add_view( + app->view_dispatcher, + UsbHidViewMouseJiggler, + hid_mouse_jiggler_get_view(app->hid_mouse_jiggler)); + // TODO switch to menu after Media is done app->view_id = UsbHidViewSubmenu; view_dispatcher_switch_to_view(app->view_dispatcher, app->view_id); @@ -147,6 +166,8 @@ void usb_hid_app_free(UsbHid* app) { usb_hid_media_free(app->usb_hid_media); view_dispatcher_remove_view(app->view_dispatcher, UsbHidViewMouse); usb_hid_mouse_free(app->usb_hid_mouse); + view_dispatcher_remove_view(app->view_dispatcher, UsbHidViewMouseJiggler); + hid_mouse_jiggler_free(app->hid_mouse_jiggler); view_dispatcher_free(app->view_dispatcher); // Close records furi_record_close(RECORD_GUI); diff --git a/applications/plugins/usbkeyboard/usb_hid.h b/applications/plugins/usbkeyboard/usb_hid.h index 90c214c48..77b70e59f 100644 --- a/applications/plugins/usbkeyboard/usb_hid.h +++ b/applications/plugins/usbkeyboard/usb_hid.h @@ -12,6 +12,7 @@ #include "views/usb_hid_keyboard.h" #include "views/usb_hid_media.h" #include "views/usb_hid_mouse.h" +#include "views/usb_hid_mouse_jiggler.h" typedef struct { Gui* gui; @@ -23,6 +24,7 @@ typedef struct { UsbHidKeyboard* usb_hid_keyboard; UsbHidMedia* usb_hid_media; UsbHidMouse* usb_hid_mouse; + HidMouseJiggler* hid_mouse_jiggler; uint32_t view_id; } UsbHid; @@ -32,5 +34,6 @@ typedef enum { UsbHidViewKeyboard, UsbHidViewMedia, UsbHidViewMouse, + UsbHidViewMouseJiggler, UsbHidViewExitConfirm, } UsbHidView; diff --git a/applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.c b/applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.c new file mode 100644 index 000000000..fe0c618d2 --- /dev/null +++ b/applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.c @@ -0,0 +1,130 @@ +#include "usb_hid_mouse_jiggler.h" +#include +#include +#include + +#include + +#define TAG "HidMouseJiggler" + +struct HidMouseJiggler { + View* view; + FuriTimer* timer; +}; + +typedef struct { + bool running; + uint8_t counter; +} HidMouseJigglerModel; + +static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) { + furi_assert(context); + HidMouseJigglerModel* model = context; + + // Header + canvas_set_font(canvas, FontPrimary); + elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse Jiggler"); + + canvas_set_font(canvas, FontPrimary); + elements_multiline_text(canvas, AlignLeft, 35, "Press Start\nto jiggle"); + canvas_set_font(canvas, FontSecondary); + + // Ok + canvas_draw_icon(canvas, 63, 25, &I_Space_65x18); + if(model->running) { + elements_slightly_rounded_box(canvas, 66, 27, 60, 13); + canvas_set_color(canvas, ColorWhite); + } + canvas_draw_icon(canvas, 74, 29, &I_Ok_btn_9x9); + if(model->running) { + elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Stop"); + } else { + elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Start"); + } + canvas_set_color(canvas, ColorBlack); + + // Back + canvas_draw_icon(canvas, 74, 49, &I_Pin_back_arrow_10x8); + elements_multiline_text_aligned(canvas, 91, 57, AlignLeft, AlignBottom, "Quit"); +} + +static void hid_mouse_jiggler_timer_callback(void* context) { + furi_assert(context); + HidMouseJiggler* hid_mouse_jiggler = context; + with_view_model( + hid_mouse_jiggler->view, + HidMouseJigglerModel * model, + { + if(model->running) { + model->counter++; + furi_hal_hid_mouse_move( + (model->counter % 2 == 0) ? MOUSE_MOVE_SHORT : -MOUSE_MOVE_SHORT, 0); + } + }, + false); +} + +static void hid_mouse_jiggler_enter_callback(void* context) { + furi_assert(context); + HidMouseJiggler* hid_mouse_jiggler = context; + + furi_timer_start(hid_mouse_jiggler->timer, 500); +} + +static void hid_mouse_jiggler_exit_callback(void* context) { + furi_assert(context); + HidMouseJiggler* hid_mouse_jiggler = context; + furi_timer_stop(hid_mouse_jiggler->timer); +} + +static bool hid_mouse_jiggler_input_callback(InputEvent* event, void* context) { + furi_assert(context); + HidMouseJiggler* hid_mouse_jiggler = context; + + bool consumed = false; + + if(event->key == InputKeyOk) { + with_view_model( + hid_mouse_jiggler->view, + HidMouseJigglerModel * model, + { model->running = !model->running; }, + true); + consumed = true; + } + + return consumed; +} + +HidMouseJiggler* hid_mouse_jiggler_alloc() { + HidMouseJiggler* hid_mouse_jiggler = malloc(sizeof(HidMouseJiggler)); + + hid_mouse_jiggler->view = view_alloc(); + view_set_context(hid_mouse_jiggler->view, hid_mouse_jiggler); + view_allocate_model( + hid_mouse_jiggler->view, ViewModelTypeLocking, sizeof(HidMouseJigglerModel)); + view_set_draw_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_draw_callback); + view_set_input_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_input_callback); + view_set_enter_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_enter_callback); + view_set_exit_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_exit_callback); + + hid_mouse_jiggler->timer = furi_timer_alloc( + hid_mouse_jiggler_timer_callback, FuriTimerTypePeriodic, hid_mouse_jiggler); + + return hid_mouse_jiggler; +} + +void hid_mouse_jiggler_free(HidMouseJiggler* hid_mouse_jiggler) { + furi_assert(hid_mouse_jiggler); + + furi_timer_stop(hid_mouse_jiggler->timer); + furi_timer_free(hid_mouse_jiggler->timer); + + view_free(hid_mouse_jiggler->view); + + free(hid_mouse_jiggler); +} + +View* hid_mouse_jiggler_get_view(HidMouseJiggler* hid_mouse_jiggler) { + furi_assert(hid_mouse_jiggler); + return hid_mouse_jiggler->view; +} diff --git a/applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.h b/applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.h new file mode 100644 index 000000000..24cf877a7 --- /dev/null +++ b/applications/plugins/usbkeyboard/views/usb_hid_mouse_jiggler.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +#define MOUSE_MOVE_SHORT 5 +#define MOUSE_MOVE_LONG 20 + +typedef struct HidMouseJiggler HidMouseJiggler; + +HidMouseJiggler* hid_mouse_jiggler_alloc(); + +void hid_mouse_jiggler_free(HidMouseJiggler* hid_mouse_jiggler); + +View* hid_mouse_jiggler_get_view(HidMouseJiggler* hid_mouse_jiggler); From 57f68c11e924845027c853ada3c741f9dd9b9695 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:57:56 +0300 Subject: [PATCH 11/16] Deduplicate fans.ir Thanks to @Amec0e --- assets/resources/infrared/assets/fans.ir | 72 ++++++++---------------- 1 file changed, 25 insertions(+), 47 deletions(-) diff --git a/assets/resources/infrared/assets/fans.ir b/assets/resources/infrared/assets/fans.ir index 6cd8ac946..7a07ca308 100644 --- a/assets/resources/infrared/assets/fans.ir +++ b/assets/resources/infrared/assets/fans.ir @@ -2,6 +2,31 @@ Filetype: IR library file Version: 1 # Last Updated 19th Dec, 2022 # +# ON/Speed +name: POWER +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1280 423 1285 445 414 1287 1259 418 1279 450 409 1266 442 1260 437 1265 443 1259 438 1264 1282 421 438 8680 1284 419 1289 442 406 1268 1288 415 1282 447 412 1263 434 1267 440 1262 435 1266 441 1261 1285 444 415 8677 1287 415 1282 447 412 1263 1283 447 1261 442 406 1268 439 1262 435 1267 440 1262 435 1267 1289 413 435 8683 1281 421 1286 443 416 1259 1287 416 1281 448 411 1263 444 1258 439 1262 435 1267 440 1263 1283 419 440 8679 1285 417 1280 449 410 1292 1254 448 1260 443 416 1259 438 1264 444 1258 439 1263 444 1258 1288 415 444 8675 1289 413 1284 445 414 1262 1284 419 1288 440 408 1293 415 1261 436 1265 442 1260 437 1265 1281 422 437 8680 1284 418 1289 440 408 1267 1289 414 1283 445 414 1262 435 1266 442 1260 437 1265 442 1261 1285 418 441 8678 1286 417 1290 439 409 1267 1289 414 1283 445 414 1262 435 1267 440 1262 435 1267 440 1263 1283 420 439 +# +name: MODE +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1284 419 1288 442 417 1258 1288 415 1282 448 411 1264 443 1258 439 1263 444 1258 1288 415 444 1258 439 8679 1284 419 1288 441 407 1267 1289 441 1256 447 412 1262 435 1267 440 1262 435 1293 1263 413 435 1267 440 8679 1284 418 1289 441 407 1267 1289 414 1283 447 412 1262 435 1267 440 1261 436 1267 1289 413 435 1267 440 8678 1285 418 1289 440 408 1267 1289 440 1257 447 412 1262 435 1267 440 1262 435 1268 1288 414 434 1268 439 8679 1284 418 1289 440 408 1267 1289 413 1284 445 414 1261 436 1266 441 1260 437 1266 1290 412 436 1266 441 8676 1287 415 1282 448 411 1264 1282 421 1286 443 416 1258 439 1263 434 1267 440 1262 1284 419 440 1262 435 8683 1280 422 1285 444 415 1287 1259 444 1253 449 410 1292 415 1285 412 1264 443 1259 1287 416 443 1259 438 8680 1284 420 1287 414 434 1268 1288 415 1282 447 412 1289 408 1267 440 1262 435 1267 1289 414 434 1268 439 +# +name: SWING +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1281 422 1285 444 415 1260 1286 444 1263 439 409 1266 441 1261 1285 445 414 1261 436 1266 441 1261 436 8682 1281 421 1286 444 415 1260 1286 445 1262 439 409 1266 441 1261 1285 445 414 1261 436 1266 441 1260 437 8683 1280 422 1286 444 415 1261 1285 445 1262 440 408 1267 440 1262 1284 446 413 1262 435 1268 439 1262 435 8684 1279 423 1284 445 414 1261 1285 445 1263 439 409 1265 442 1260 1286 444 415 1260 437 1265 442 1259 438 8682 1281 421 1286 443 416 1259 1287 443 1254 448 411 1264 443 1259 1287 443 416 1259 438 1265 442 1260 437 8682 1281 421 1286 444 415 1260 1286 444 1253 450 409 1266 441 1261 1285 445 414 1261 436 1266 441 1261 436 8683 1290 413 1284 445 414 1262 1283 446 1261 441 407 1294 413 1262 1284 420 439 1263 434 1267 440 1262 435 +# +name: TIMER +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 1283 420 1287 443 416 1259 1287 443 1254 449 410 1292 415 1260 437 1266 1290 439 409 1266 442 1261 436 8684 1290 413 1284 446 413 1263 1283 447 1261 442 417 1258 439 1263 444 1259 1287 442 417 1259 438 1264 443 8677 1287 416 1281 449 410 1265 1281 449 1259 444 415 1260 437 1265 442 1260 1286 443 416 1260 437 1265 442 8676 1288 415 1282 447 412 1263 1283 447 1261 442 417 1257 440 1263 434 1268 1288 441 418 1257 440 1263 434 8685 1289 414 1283 447 412 1263 1283 447 1261 442 417 1258 439 1263 445 1258 1288 442 417 1258 439 1264 444 8676 1288 415 1282 448 411 1264 1282 448 1260 444 415 1259 438 1264 443 1260 1286 417 442 1260 437 1265 442 8677 1286 416 1281 449 410 1265 1281 422 1285 444 415 1260 437 1265 442 1260 1286 417 442 1260 437 1265 442 +# name: POWER type: parsed protocol: NECext @@ -1131,50 +1156,3 @@ frequency: 38000 duty_cycle: 0.330000 data: 1366 388 1295 387 446 1164 1368 387 1296 387 448 1164 518 1164 493 1189 517 1165 492 1189 493 1189 493 7851 1365 387 1270 388 446 1190 1365 387 1295 387 447 1192 490 1193 489 1193 489 1194 488 1194 488 1193 489 7855 1337 386 1296 386 448 1193 1338 386 1296 386 448 1193 489 1193 489 1193 489 1193 489 1193 489 1193 489 7855 1337 386 1297 386 448 1194 1337 386 1296 386 448 1194 488 1194 488 1194 488 1194 488 1194 488 1194 488 8160 1336 387 1296 387 447 1194 1337 387 1296 386 448 1194 488 1194 488 1194 488 1194 488 1194 488 1194 488 7855 1336 386 1297 387 447 1195 1336 386 1297 386 448 1195 486 1195 487 1195 487 1195 487 1196 486 1196 486 7881 1310 387 1272 397 436 1245 1286 397 1285 397 436 1246 436 1246 436 1247 435 1247 435 1248 434 1248 434 7934 1259 424 1259 424 408 1274 1258 424 1259 424 408 1274 408 1274 408 1274 408 1274 408 1274 408 1274 408 8239 1258 425 1258 424 408 1274 1258 424 1258 425 407 1273 408 1273 409 1273 408 1273 408 1274 408 1273 408 7907 1283 424 1258 424 409 1248 1283 399 1283 400 433 1247 434 1247 434 1247 434 1247 434 1247 434 1247 434 7905 1282 424 1258 425 407 1273 1257 425 1257 425 407 1273 407 1274 407 1274 407 1274 407 1275 406 1275 406 7958 1230 478 1204 478 353 1328 1204 478 1204 453 378 1327 353 1328 353 1302 379 1301 380 1301 380 1300 381 # -name: POWER -type: parsed -protocol: NECext -address: 4B 14 00 00 -command: 80 7F 00 00 -# -name: MODE -type: parsed -protocol: NECext -address: 4B 14 00 00 -command: 20 DF 00 00 -# -name: SWING -type: parsed -protocol: NECext -address: 4B 14 00 00 -command: C0 3F 00 00 -# -name: TIMER -type: parsed -protocol: NECext -address: 4B 14 00 00 -command: A0 5F 00 00 -# ON/Speed -name: POWER -type: raw -frequency: 38000 -duty_cycle: 0.330000 -data: 1280 423 1285 445 414 1287 1259 418 1279 450 409 1266 442 1260 437 1265 443 1259 438 1264 1282 421 438 8680 1284 419 1289 442 406 1268 1288 415 1282 447 412 1263 434 1267 440 1262 435 1266 441 1261 1285 444 415 8677 1287 415 1282 447 412 1263 1283 447 1261 442 406 1268 439 1262 435 1267 440 1262 435 1267 1289 413 435 8683 1281 421 1286 443 416 1259 1287 416 1281 448 411 1263 444 1258 439 1262 435 1267 440 1263 1283 419 440 8679 1285 417 1280 449 410 1292 1254 448 1260 443 416 1259 438 1264 444 1258 439 1263 444 1258 1288 415 444 8675 1289 413 1284 445 414 1262 1284 419 1288 440 408 1293 415 1261 436 1265 442 1260 437 1265 1281 422 437 8680 1284 418 1289 440 408 1267 1289 414 1283 445 414 1262 435 1266 442 1260 437 1265 442 1261 1285 418 441 8678 1286 417 1290 439 409 1267 1289 414 1283 445 414 1262 435 1267 440 1262 435 1267 440 1263 1283 420 439 -# -name: MODE -type: raw -frequency: 38000 -duty_cycle: 0.330000 -data: 1284 419 1288 442 417 1258 1288 415 1282 448 411 1264 443 1258 439 1263 444 1258 1288 415 444 1258 439 8679 1284 419 1288 441 407 1267 1289 441 1256 447 412 1262 435 1267 440 1262 435 1293 1263 413 435 1267 440 8679 1284 418 1289 441 407 1267 1289 414 1283 447 412 1262 435 1267 440 1261 436 1267 1289 413 435 1267 440 8678 1285 418 1289 440 408 1267 1289 440 1257 447 412 1262 435 1267 440 1262 435 1268 1288 414 434 1268 439 8679 1284 418 1289 440 408 1267 1289 413 1284 445 414 1261 436 1266 441 1260 437 1266 1290 412 436 1266 441 8676 1287 415 1282 448 411 1264 1282 421 1286 443 416 1258 439 1263 434 1267 440 1262 1284 419 440 1262 435 8683 1280 422 1285 444 415 1287 1259 444 1253 449 410 1292 415 1285 412 1264 443 1259 1287 416 443 1259 438 8680 1284 420 1287 414 434 1268 1288 415 1282 447 412 1289 408 1267 440 1262 435 1267 1289 414 434 1268 439 -# -name: SWING -type: raw -frequency: 38000 -duty_cycle: 0.330000 -data: 1281 422 1285 444 415 1260 1286 444 1263 439 409 1266 441 1261 1285 445 414 1261 436 1266 441 1261 436 8682 1281 421 1286 444 415 1260 1286 445 1262 439 409 1266 441 1261 1285 445 414 1261 436 1266 441 1260 437 8683 1280 422 1286 444 415 1261 1285 445 1262 440 408 1267 440 1262 1284 446 413 1262 435 1268 439 1262 435 8684 1279 423 1284 445 414 1261 1285 445 1263 439 409 1265 442 1260 1286 444 415 1260 437 1265 442 1259 438 8682 1281 421 1286 443 416 1259 1287 443 1254 448 411 1264 443 1259 1287 443 416 1259 438 1265 442 1260 437 8682 1281 421 1286 444 415 1260 1286 444 1253 450 409 1266 441 1261 1285 445 414 1261 436 1266 441 1261 436 8683 1290 413 1284 445 414 1262 1283 446 1261 441 407 1294 413 1262 1284 420 439 1263 434 1267 440 1262 435 -# -name: TIMER -type: raw -frequency: 38000 -duty_cycle: 0.330000 -data: 1283 420 1287 443 416 1259 1287 443 1254 449 410 1292 415 1260 437 1266 1290 439 409 1266 442 1261 436 8684 1290 413 1284 446 413 1263 1283 447 1261 442 417 1258 439 1263 444 1259 1287 442 417 1259 438 1264 443 8677 1287 416 1281 449 410 1265 1281 449 1259 444 415 1260 437 1265 442 1260 1286 443 416 1260 437 1265 442 8676 1288 415 1282 447 412 1263 1283 447 1261 442 417 1257 440 1263 434 1268 1288 441 418 1257 440 1263 434 8685 1289 414 1283 447 412 1263 1283 447 1261 442 417 1258 439 1263 445 1258 1288 442 417 1258 439 1264 444 8676 1288 415 1282 448 411 1264 1282 448 1260 444 415 1259 438 1264 443 1260 1286 417 442 1260 437 1265 442 8677 1286 416 1281 449 410 1265 1281 422 1285 444 415 1260 437 1265 442 1260 1286 417 442 1260 437 1265 442 From 5d18b189ec8c3f6dfbbb0224634110ef4c4baf93 Mon Sep 17 00:00:00 2001 From: Max Andreev Date: Mon, 19 Dec 2022 18:28:53 +0300 Subject: [PATCH 12/16] Run map file analyser through repository dispatch (#2148) * Add ripository dispatch * Fix mistakes --- .github/workflows/amap_analyse.yml | 40 +++--------------------------- .github/workflows/build.yml | 8 ++++++ 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/.github/workflows/amap_analyse.yml b/.github/workflows/amap_analyse.yml index 1340e4cde..12155e71a 100644 --- a/.github/workflows/amap_analyse.yml +++ b/.github/workflows/amap_analyse.yml @@ -1,13 +1,8 @@ name: 'Analyze .map file with Amap' on: - push: - branches: - - dev - - "release*" - tags: - - '*' - pull_request: + repository_dispatch: + types: [make_map_analyse] env: TARGETS: f7 @@ -15,24 +10,9 @@ env: jobs: amap_analyse: - if: ${{ !github.event.pull_request.head.repo.fork }} runs-on: [self-hosted,FlipperZeroMacShell] - timeout-minutes: 15 + timeout-minutes: 5 steps: - - name: 'Wait Build workflow' - uses: fountainhead/action-wait-for-check@v1.0.0 - id: wait-for-build - with: - token: ${{ secrets.GITHUB_TOKEN }} - checkName: 'main' - ref: ${{ github.event.pull_request.head.sha || github.sha }} - intervalSeconds: 20 - - - name: 'Check Build workflow status' - if: steps.wait-for-build.outputs.conclusion == 'failure' - run: | - exit 1 - - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then @@ -43,18 +23,6 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: 'Get commit details' - run: | - if [[ ${{ github.event_name }} == 'pull_request' ]]; then - TYPE="pull" - elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then - TYPE="tag" - else - TYPE="other" - fi - python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" - name: 'Make artifacts directory' run: | @@ -69,7 +37,7 @@ jobs: chmod 600 ./deploy_key; rsync -avzP \ -e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \ - ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/" artifacts/; + ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${{ github.event.client_payload.branch_name }}/" artifacts/; rm ./deploy_key; - name: 'Make .map file analyze' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2de0e57c3..e81d325e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,6 +98,14 @@ jobs: artifacts/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/"; rm ./deploy_key; + - name: 'Trigger map file analyser' + if: ${{ !github.event.pull_request.head.repo.fork }} + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + event-type: make_map_analyse + client-payload: '{"branch_name": "${{steps.names.outputs.branch_name}}"}' + - name: 'Trigger update server reindex' if: ${{ !github.event.pull_request.head.repo.fork }} run: curl -X POST -F 'key=${{ secrets.REINDEX_KEY }}' ${{ secrets.REINDEX_URL }} From 8a09ac256989f3d8915946f5fa0701445b862821 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 18:45:27 +0300 Subject: [PATCH 13/16] Update SubGhz Bruteforcer --- applications/plugins/subbrute | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/plugins/subbrute b/applications/plugins/subbrute index b6db4f5ab..3403176fb 160000 --- a/applications/plugins/subbrute +++ b/applications/plugins/subbrute @@ -1 +1 @@ -Subproject commit b6db4f5ab68551d5dc0762ed3ab5da7f225781da +Subproject commit 3403176fb020e6dce3ed671fa81abfee1c0a63b3 From 22062faae2a73df901302ab681288199a44ab0a8 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 19:03:32 +0300 Subject: [PATCH 14/16] Update changelog --- CHANGELOG.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a5232e5b..dbdd06a6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,20 @@ ### New changes -* SubGHz: app launch times improved significantly, also setting_user file no longer overwritten by firmware updates, this update will remove this file (only this version, next ones will not touch it (if you skip this version file will be removed in any case on next update)), be sure to backup if you have custom changes in it! -Now this file is actually should be created by user and will be not removed every update! -* Plugins: Add POCSAG Pager [(by xMasterX & Shmuma)](https://github.com/xMasterX/flipper-pager) -* Misc fixes -* OFW: IR button overflow fix -* OFW: Weather Station: proper event flow for view redraw. -* OFW: Untangle NFC from Unit Tests +* API: Version was changed due to breaking changes - from 10.x to 11.x - Extra pack was updated, download it by using link below ([- Download latest extra apps pack](https://download-directory.github.io/?url=https://github.com/xMasterX/unleashed-extra-pack/tree/main/apps)) +* Plugins -> SubGHz Bruteforcer: Add support for PT2260, SMC5326, UNILARM, Honeywell(file only) protocols +* Plugins: Add mouse jiggler to USB Keyboard&Mouse App +* Clock: Use system locale settings +* Infrared: Update universal remote assets (by @Amec0e) + (PR #215 | by @airs0urce) +* SubGHz: Removing duplicate code in subghz FAAC scenes. (PR #208 | by @gid9798) +* Plugins -> Weather Station: Fix display of temps lower than -9 +* OFW: Notification: fix recursive speaker acquire +* OFW: Locale settings +* OFW: Audio support for SubGhz **(Breaking API change)** +* OFW: Dolphin: add new animation (Happy holidays) +* OFW: SubGhz: add SMC5326, UNILARM protocol +* OFW: Added support for IDTECK cards +* OFW: WS: fix protocol and add new (Oregon_v1, TX8300) +* OFW: VSCode: add task 'Serial console' and group task with sequence calling +* OFW: Dictionary stuff: iClass keys #### [🎲 Download latest extra apps pack](https://download-directory.github.io/?url=https://github.com/xMasterX/unleashed-extra-pack/tree/main/apps) From ef7052fbad5e776c09ca6df40517d013e02476d6 Mon Sep 17 00:00:00 2001 From: Max Andreev Date: Mon, 19 Dec 2022 19:42:06 +0300 Subject: [PATCH 15/16] Fix new amap workflow (#2151) * Fix amap workflow * get_env.py * Fix amap_analyse.yml --- .github/workflows/amap_analyse.yml | 14 ++++++++++++-- .github/workflows/build.yml | 14 ++++++++++++-- scripts/get_env.py | 9 +++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/amap_analyse.yml b/.github/workflows/amap_analyse.yml index 12155e71a..7e78dc980 100644 --- a/.github/workflows/amap_analyse.yml +++ b/.github/workflows/amap_analyse.yml @@ -24,6 +24,16 @@ jobs: with: fetch-depth: 0 + - name: 'Get commit details' + run: | + export COMMIT_HASH=${{ github.event.client_payload.commit_hash }} + export COMMIT_MSG=${{ github.event.client_payload.commit_msg }} + export BRANCH_NAME=${{ github.event.client_payload.branch_name }} + if [[ ${{ github.event.client_payload.event_type }} == "pr" ]]; then + export PULL_ID=${{ github.event.client_payload.pull_id }} + export PULL_NAME=${{ github.event.client_payload.pull_name }} + fi + - name: 'Make artifacts directory' run: | rm -rf artifacts @@ -43,7 +53,7 @@ jobs: - name: 'Make .map file analyze' run: | cd artifacts/ - /Applications/amap/Contents/MacOS/amap -f "flipper-z-f7-firmware-${SUFFIX}.elf.map" + /Applications/amap/Contents/MacOS/amap -f flipper-z-f7-firmware-${{ github.event.client_payload.suffix }}.elf.map - name: 'Upload report to DB' run: | @@ -67,5 +77,5 @@ jobs: ${{ secrets.AMAP_MARIADB_HOST }} \ ${{ secrets.AMAP_MARIADB_PORT }} \ ${{ secrets.AMAP_MARIADB_DATABASE }} \ - artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all + artifacts/flipper-z-f7-firmware-${{ github.event.client_payload.suffix }}.elf.map.all diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e81d325e9..52d4626d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,12 +99,22 @@ jobs: rm ./deploy_key; - name: 'Trigger map file analyser' - if: ${{ !github.event.pull_request.head.repo.fork }} + if: ${{ (github.event_name != 'pull_request') + && !github.event.pull_request.head.repo.fork }} uses: peter-evans/repository-dispatch@v2 with: token: ${{ secrets.GITHUB_TOKEN }} event-type: make_map_analyse - client-payload: '{"branch_name": "${{steps.names.outputs.branch_name}}"}' + client-payload: '{"branch_name": "${{steps.names.outputs.branch_name}}", "commit_hash": "${{steps.names.outputs.commit_hash}}", "commit_msg": "${{steps.names.outputs.commit_msg}}", "event_type": "push"}' + + - name: 'Trigger map file analyser' + if: ${{ (github.event_name == 'pull_request') + && !github.event.pull_request.head.repo.fork }} + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + event-type: make_map_analyse + client-payload: '{"branch_name": "${{steps.names.outputs.branch_name}}", "commit_hash": "${{steps.names.outputs.commit_hash}}", "commit_msg": "${{steps.names.outputs.commit_msg}}", "pull_id": "${{steps.names.outputs.pull_id}}", "pull_name": "${{steps.names.outputs.pull_name}}", "event_type": "pr"}' - name: 'Trigger update server reindex' if: ${{ !github.event.pull_request.head.repo.fork }} diff --git a/scripts/get_env.py b/scripts/get_env.py index e2da6eda5..c87de47a3 100644 --- a/scripts/get_env.py +++ b/scripts/get_env.py @@ -89,13 +89,18 @@ def add_envs(data, gh_env_file, gh_out_file, args): add_env("BRANCH_NAME", data["branch_name"], gh_env_file) add_env("DIST_SUFFIX", data["suffix"], gh_env_file) add_env("WORKFLOW_BRANCH_OR_TAG", data["branch_name"], gh_env_file) - add_set_output_var("branch_name", data["branch_name"], gh_out_file) + add_set_output_var("commit_msg", data["commit_comment"], gh_out_file) + add_set_output_var("commit_hash", data["commit_hash"], gh_out_file) add_set_output_var("commit_sha", data["commit_sha"], gh_out_file) - add_set_output_var("default_target", os.getenv("DEFAULT_TARGET"), gh_out_file) add_set_output_var("suffix", data["suffix"], gh_out_file) + add_set_output_var("branch_name", data["branch_name"], gh_out_file) + add_set_output_var("dist_suffix", data["suffix"], gh_out_file) + add_set_output_var("default_target", os.getenv("DEFAULT_TARGET"), gh_out_file) if args.type == "pull": add_env("PULL_ID", data["pull_id"], gh_env_file) add_env("PULL_NAME", data["pull_name"], gh_env_file) + add_set_output_var("pull_id", data["pull_id"], gh_out_file) + add_set_output_var("pull_name", data["pull_name"], gh_out_file) def main(): From cefff3566149d090188407fc02ef097af515345b Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Dec 2022 20:07:07 +0300 Subject: [PATCH 16/16] Move submenu_set_selected_item --- applications/main/infrared/scenes/infrared_scene_universal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/main/infrared/scenes/infrared_scene_universal.c b/applications/main/infrared/scenes/infrared_scene_universal.c index b70ffbd5c..09b77b1f7 100644 --- a/applications/main/infrared/scenes/infrared_scene_universal.c +++ b/applications/main/infrared/scenes/infrared_scene_universal.c @@ -23,7 +23,6 @@ void infrared_scene_universal_on_enter(void* context) { SubmenuIndexUniversalTV, infrared_scene_universal_submenu_callback, context); - submenu_set_selected_item(submenu, 0); submenu_add_item( submenu, @@ -53,6 +52,8 @@ void infrared_scene_universal_on_enter(void* context) { infrared_scene_universal_submenu_callback, context); + submenu_set_selected_item(submenu, 0); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewSubmenu); }