diff --git a/.ci_files/rgb.patch b/.ci_files/rgb.patch index afd2391603..7011c9801d 100644 --- a/.ci_files/rgb.patch +++ b/.ci_files/rgb.patch @@ -1,5 +1,5 @@ diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c -index 2f947fe..03c4c76 100644 +index 5769ced..c5d3088 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -9,6 +9,7 @@ @@ -10,7 +10,7 @@ index 2f947fe..03c4c76 100644 #define TAG "NotificationSrv" -@@ -579,6 +580,7 @@ int32_t notification_srv(void* p) { +@@ -589,6 +590,7 @@ int32_t notification_srv(void* p) { break; case SaveSettingsMessage: notification_save_settings(app); @@ -19,7 +19,7 @@ index 2f947fe..03c4c76 100644 } diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c -index 565d4f1..bae9299 100644 +index 1955012..19d953d 100644 --- a/applications/settings/notification_settings/notification_settings_app.c +++ b/applications/settings/notification_settings/notification_settings_app.c @@ -3,6 +3,7 @@ @@ -30,10 +30,20 @@ index 565d4f1..bae9299 100644 #define MAX_NOTIFICATION_SETTINGS 4 -@@ -162,6 +163,14 @@ static void vibro_changed(VariableItem* item) { +@@ -20,6 +21,8 @@ static const NotificationSequence sequence_note_c = { + NULL, + }; + ++static VariableItem* temp_item; ++ + #define CONTRAST_COUNT 11 + const char* const contrast_text[CONTRAST_COUNT] = { + "-5", +@@ -156,6 +159,59 @@ static void vibro_changed(VariableItem* item) { notification_message(app->notification, &sequence_single_vibro); } ++// Set RGB backlight color +static void color_changed(VariableItem* item) { + NotificationAppSettings* app = variable_item_get_context(item); + uint8_t index = variable_item_get_current_value_index(item); @@ -41,31 +51,102 @@ index 565d4f1..bae9299 100644 + variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index)); + notification_message(app->notification, &sequence_display_backlight_on); +} ++ ++// TODO: refactor and fix this ++static void color_set_custom_red(VariableItem* item) { ++ NotificationAppSettings* app = variable_item_get_context(item); ++ uint8_t index = variable_item_get_current_value_index(item); ++ rgb_backlight_set_custom_color(index, 0); ++ char valtext[4] = {}; ++ snprintf(valtext, sizeof(valtext), "%d", index); ++ variable_item_set_current_value_text(item, valtext); ++ rgb_backlight_set_color(13); ++ rgb_backlight_update(app->notification->settings.display_brightness * 0xFF, true); ++ // Set to custom color explicitly ++ variable_item_set_current_value_index(temp_item, 13); ++ variable_item_set_current_value_text(temp_item, rgb_backlight_get_color_text(13)); ++ notification_message(app->notification, &sequence_display_backlight_on); ++} ++static void color_set_custom_green(VariableItem* item) { ++ NotificationAppSettings* app = variable_item_get_context(item); ++ uint8_t index = variable_item_get_current_value_index(item); ++ rgb_backlight_set_custom_color(index, 1); ++ char valtext[4] = {}; ++ snprintf(valtext, sizeof(valtext), "%d", index); ++ variable_item_set_current_value_text(item, valtext); ++ rgb_backlight_set_color(13); ++ rgb_backlight_update(app->notification->settings.display_brightness * 0xFF, true); ++ // Set to custom color explicitly ++ variable_item_set_current_value_index(temp_item, 13); ++ variable_item_set_current_value_text(temp_item, rgb_backlight_get_color_text(13)); ++ notification_message(app->notification, &sequence_display_backlight_on); ++} ++static void color_set_custom_blue(VariableItem* item) { ++ NotificationAppSettings* app = variable_item_get_context(item); ++ uint8_t index = variable_item_get_current_value_index(item); ++ rgb_backlight_set_custom_color(index, 2); ++ char valtext[4] = {}; ++ snprintf(valtext, sizeof(valtext), "%d", index); ++ variable_item_set_current_value_text(item, valtext); ++ rgb_backlight_set_color(13); ++ rgb_backlight_update(app->notification->settings.display_brightness * 0xFF, true); ++ // Set to custom color explicitly ++ variable_item_set_current_value_index(temp_item, 13); ++ variable_item_set_current_value_text(temp_item, rgb_backlight_get_color_text(13)); ++ notification_message(app->notification, &sequence_display_backlight_on); ++} + static uint32_t notification_app_settings_exit(void* context) { UNUSED(context); return VIEW_NONE; -@@ -187,7 +196,13 @@ static NotificationAppSettings* alloc_settings() { +@@ -180,8 +236,40 @@ static NotificationAppSettings* alloc_settings() { + variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, contrast_text[value_index]); - item = variable_item_list_add( -- app->variable_item_list, "LCD Backlight", BACKLIGHT_COUNT, backlight_changed, app); ++ // RGB Colors ++ item = variable_item_list_add( + app->variable_item_list, "LCD Color", rgb_backlight_get_color_count(), color_changed, app); + value_index = rgb_backlight_get_settings()->display_color_index; + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index)); ++ temp_item = item; + ++ // Custom Color - REFACTOR THIS + item = variable_item_list_add( ++ app->variable_item_list, "Custom Red", 255, color_set_custom_red, app); ++ value_index = rgb_backlight_get_settings()->custom_r; ++ variable_item_set_current_value_index(item, value_index); ++ char valtext[4] = {}; ++ snprintf(valtext, sizeof(valtext), "%d", value_index); ++ variable_item_set_current_value_text(item, valtext); ++ ++ item = variable_item_list_add( ++ app->variable_item_list, "Custom Green", 255, color_set_custom_green, app); ++ value_index = rgb_backlight_get_settings()->custom_g; ++ variable_item_set_current_value_index(item, value_index); ++ snprintf(valtext, sizeof(valtext), "%d", value_index); ++ variable_item_set_current_value_text(item, valtext); ++ ++ item = variable_item_list_add( ++ app->variable_item_list, "Custom Blue", 255, color_set_custom_blue, app); ++ value_index = rgb_backlight_get_settings()->custom_b; ++ variable_item_set_current_value_index(item, value_index); ++ snprintf(valtext, sizeof(valtext), "%d", value_index); ++ variable_item_set_current_value_text(item, valtext); ++ // End of RGB ++ + item = variable_item_list_add( +- app->variable_item_list, "LCD Backlight", BACKLIGHT_COUNT, backlight_changed, app); + app->variable_item_list, "LCD Brightness", BACKLIGHT_COUNT, backlight_changed, app); value_index = value_index_float( app->notification->settings.display_brightness, backlight_value, BACKLIGHT_COUNT); variable_item_set_current_value_index(item, value_index); diff --git a/applications/settings/notification_settings/rgb_backlight.c b/applications/settings/notification_settings/rgb_backlight.c new file mode 100644 -index 0000000..269b544 +index 0000000..98f0d3a --- /dev/null +++ b/applications/settings/notification_settings/rgb_backlight.c -@@ -0,0 +1,171 @@ +@@ -0,0 +1,217 @@ +/* + RGB backlight FlipperZero driver + Copyright (C) 2022-2023 Victor Nikitchuk (https://github.com/quen0n) @@ -88,9 +169,9 @@ index 0000000..269b544 +#include +#include + -+#define RGB_BACKLIGHT_SETTINGS_VERSION 5 ++#define RGB_BACKLIGHT_SETTINGS_VERSION 6 +#define RGB_BACKLIGHT_SETTINGS_FILE_NAME ".rgb_backlight.settings" -+#define RGB_BACKLIGHT_SETTINGS_PATH EXT_PATH(RGB_BACKLIGHT_SETTINGS_FILE_NAME) ++#define RGB_BACKLIGHT_SETTINGS_PATH INT_PATH(RGB_BACKLIGHT_SETTINGS_FILE_NAME) + +#define COLOR_COUNT (sizeof(colors) / sizeof(RGBBacklightColor)) + @@ -99,11 +180,14 @@ index 0000000..269b544 +static RGBBacklightSettings rgb_settings = { + .version = RGB_BACKLIGHT_SETTINGS_VERSION, + .display_color_index = 0, ++ .custom_r = 254, ++ .custom_g = 254, ++ .custom_b = 254, + .settings_is_loaded = false}; + +static const RGBBacklightColor colors[] = { + {"Orange", 255, 60, 0}, -+ {"Yellow", 255, 150, 0}, ++ {"Yellow", 255, 144, 0}, + {"Spring", 167, 255, 0}, + {"Lime", 0, 255, 0}, + {"Aqua", 0, 255, 127}, @@ -114,7 +198,8 @@ index 0000000..269b544 + {"Magenta", 210, 0, 210}, + {"Pink", 255, 0, 127}, + {"Red", 255, 0, 0}, -+ {"White", 150, 150, 110}, ++ {"White", 254, 210, 200}, ++ {"Custom", 0, 0, 0}, +}; + +uint8_t rgb_backlight_get_color_count(void) { @@ -126,18 +211,28 @@ index 0000000..269b544 +} + +void rgb_backlight_load_settings(void) { -+ //Не загружать данные из внутренней памяти при загрузке в режиме DFU -+ FuriHalRtcBootMode bm = furi_hal_rtc_get_boot_mode(); -+ if(bm == FuriHalRtcBootModeDfu) { ++ // Do not load settings if we are in other boot modes than normal ++ if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) { + rgb_settings.settings_is_loaded = true; + return; + } + ++ // Wait for all required services to start and create their records ++ uint8_t timeout = 0; ++ while(!furi_record_exists(RECORD_STORAGE)) { ++ timeout++; ++ if(timeout > 150) { ++ rgb_settings.settings_is_loaded = true; ++ return; ++ } ++ furi_delay_ms(5); ++ } ++ + RGBBacklightSettings settings; + File* file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); + const size_t settings_size = sizeof(RGBBacklightSettings); + -+ FURI_LOG_I(TAG, "loading settings from \"%s\"", RGB_BACKLIGHT_SETTINGS_PATH); ++ FURI_LOG_D(TAG, "loading settings from \"%s\"", RGB_BACKLIGHT_SETTINGS_PATH); + bool fs_result = + storage_file_open(file, RGB_BACKLIGHT_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING); + @@ -150,7 +245,7 @@ index 0000000..269b544 + } + + if(fs_result) { -+ FURI_LOG_I(TAG, "load success"); ++ FURI_LOG_D(TAG, "load success"); + if(settings.version != RGB_BACKLIGHT_SETTINGS_VERSION) { + FURI_LOG_E( + TAG, @@ -175,7 +270,7 @@ index 0000000..269b544 + File* file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); + const size_t settings_size = sizeof(RGBBacklightSettings); + -+ FURI_LOG_I(TAG, "saving settings to \"%s\"", RGB_BACKLIGHT_SETTINGS_PATH); ++ FURI_LOG_D(TAG, "saving settings to \"%s\"", RGB_BACKLIGHT_SETTINGS_PATH); + + memcpy(&settings, &rgb_settings, settings_size); + @@ -191,7 +286,7 @@ index 0000000..269b544 + } + + if(fs_result) { -+ FURI_LOG_I(TAG, "save success"); ++ FURI_LOG_D(TAG, "save success"); + } else { + FURI_LOG_E(TAG, "save failed, %s", storage_file_get_error_desc(file)); + } @@ -213,36 +308,68 @@ index 0000000..269b544 + rgb_settings.display_color_index = color_index; +} + -+void rgb_backlight_update(uint8_t brightness) { ++void rgb_backlight_set_custom_color(uint8_t color, uint8_t index) { ++ if(index > 2) return; ++ if(index == 0) { ++ rgb_settings.custom_r = color; ++ } else if(index == 1) { ++ rgb_settings.custom_g = color; ++ } else if(index == 2) { ++ rgb_settings.custom_b = color; ++ } ++} ++ ++void rgb_backlight_update(uint8_t brightness, bool bypass) { + if(!rgb_settings.settings_is_loaded) { + rgb_backlight_load_settings(); + } + -+ static uint8_t last_color_index = 255; -+ static uint8_t last_brightness = 123; ++ if(!bypass) { ++ static uint8_t last_color_index = 255; ++ static uint8_t last_brightness = 123; + -+ if(last_brightness == brightness && last_color_index == rgb_settings.display_color_index) -+ return; ++ if(last_brightness == brightness && last_color_index == rgb_settings.display_color_index) { ++ return; ++ } + -+ last_brightness = brightness; -+ last_color_index = rgb_settings.display_color_index; ++ last_brightness = brightness; ++ last_color_index = rgb_settings.display_color_index; ++ } + + for(uint8_t i = 0; i < SK6805_get_led_count(); i++) { -+ uint8_t r = colors[rgb_settings.display_color_index].red * (brightness / 255.0f); -+ uint8_t g = colors[rgb_settings.display_color_index].green * (brightness / 255.0f); -+ uint8_t b = colors[rgb_settings.display_color_index].blue * (brightness / 255.0f); ++ if(rgb_settings.display_color_index == 13) { ++ uint8_t r = rgb_settings.custom_r * (brightness / 255.0f); ++ uint8_t g = rgb_settings.custom_g * (brightness / 255.0f); ++ uint8_t b = rgb_settings.custom_b * (brightness / 255.0f); + -+ SK6805_set_led_color(i, r, g, b); ++ SK6805_set_led_color(i, r, g, b); ++ } else { ++ if((colors[rgb_settings.display_color_index].red == 0) && ++ (colors[rgb_settings.display_color_index].green == 0) && ++ (colors[rgb_settings.display_color_index].blue == 0)) { ++ uint8_t r = colors[0].red * (brightness / 255.0f); ++ uint8_t g = colors[0].green * (brightness / 255.0f); ++ uint8_t b = colors[0].blue * (brightness / 255.0f); ++ ++ SK6805_set_led_color(i, r, g, b); ++ } else { ++ uint8_t r = colors[rgb_settings.display_color_index].red * (brightness / 255.0f); ++ uint8_t g = colors[rgb_settings.display_color_index].green * (brightness / 255.0f); ++ uint8_t b = colors[rgb_settings.display_color_index].blue * (brightness / 255.0f); ++ ++ SK6805_set_led_color(i, r, g, b); ++ } ++ } + } + + SK6805_update(); +} diff --git a/applications/settings/notification_settings/rgb_backlight.h b/applications/settings/notification_settings/rgb_backlight.h new file mode 100644 -index 0000000..b63d223 +index 0000000..68dacda --- /dev/null +++ b/applications/settings/notification_settings/rgb_backlight.h -@@ -0,0 +1,79 @@ +@@ -0,0 +1,91 @@ +/* + RGB backlight FlipperZero driver + Copyright (C) 2022-2023 Victor Nikitchuk (https://github.com/quen0n) @@ -274,6 +401,9 @@ index 0000000..b63d223 +typedef struct { + uint8_t version; + uint8_t display_color_index; ++ uint8_t custom_r; ++ uint8_t custom_g; ++ uint8_t custom_b; + bool settings_is_loaded; +} RGBBacklightSettings; + @@ -298,8 +428,9 @@ index 0000000..b63d223 + * @brief Применить текущие настройки RGB-подсветки + * + * @param brightness Яркость свечения (0-255) ++ * @param bypass Применить настройки принудительно + */ -+void rgb_backlight_update(uint8_t brightness); ++void rgb_backlight_update(uint8_t brightness, bool bypass); + +/** + * @brief Установить цвет RGB-подсветки @@ -309,6 +440,14 @@ index 0000000..b63d223 +void rgb_backlight_set_color(uint8_t color_index); + +/** ++ * @brief Set custom color values by index - 0=R 1=G 2=B ++ * ++ * @param color - color value (0-255) ++ * @param index - color index (0-2) 0=R 1=G 2=B ++ */ ++void rgb_backlight_set_custom_color(uint8_t color, uint8_t index); ++ ++/** + * @brief Получить количество доступных цветов + * + * @return Число доступных вариантов цвета @@ -324,7 +463,7 @@ index 0000000..b63d223 +const char* rgb_backlight_get_color_text(uint8_t index); \ No newline at end of file diff --git a/firmware/targets/f7/furi_hal/furi_hal_light.c b/firmware/targets/f7/furi_hal/furi_hal_light.c -index 83e1603..cad5b86 100644 +index 83e1603..45798ca 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_light.c +++ b/firmware/targets/f7/furi_hal/furi_hal_light.c @@ -3,6 +3,7 @@ @@ -353,7 +492,7 @@ index 83e1603..cad5b86 100644 - uint8_t prev = lp5562_get_channel_value(&furi_hal_i2c_handle_power, LP5562ChannelWhite); - lp5562_execute_ramp( - &furi_hal_i2c_handle_power, LP5562Engine1, LP5562ChannelWhite, prev, value, 100); -+ rgb_backlight_update(value); ++ rgb_backlight_update(value, false); + } else { + furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); + if(light & LightRed) { diff --git a/CHANGELOG.md b/CHANGELOG.md index b0a3c0d053..fc228c8da4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,13 @@ ## New changes -**Summary: BLE Core2 (Copro) crashes should be fixed with this update, Apple BLE Spam app and other apps updated to the latest versions, NFC file sort crashes has been fixed, other fixes and improvements see below:** -* SubGHz: Nice Flor S - added custom button code 0x3 -* NFC: Fixes out of memory crash if we open folder with more than 300 files in it -* LF RFID: Fixed logic in `t5577_write_with_pass` (by @baugp | PR #612) -* Infrared: Updated universal assets (by @amec0e | PR #607 #619) -* **Apple BLE Spam app** updated to latest version (by @Willy-JL) -> (app can be found in builds ` `, `e`, `n`, `r`) -* OFW: Fix spelling across some project files -* OFW: CCID: Support PC To Reader Transfer Block data -* OFW: Firmware: bigger thread name storage. Notification app: better BacklightEnforce edge cases handling. -* OFW: Lib: update stm32wb_copro to 1.17.3 release -* OFW: FuriHal ble: length fix for fw version prop -* OFW: add documentation SubGhz Bin_RAW file format -* OFW: fbt: glob improvements -* OFW: HEX input UI improvements -* OFW: Ble: fix null-ptr dereference in bt_change_profile -* OFW: Add the coding in the shell animation -* OFW: FuriHal,BleGlue: prevent sleep while HCI command executed, proper bt api rpc locking. Fixes random system lockups. -* OFW: fbt: reworked tool path handling -* OFW: Gui: handle view port lockup and notify developer about it -* OFW: Added `fal_embedded` parameter for PLUGIN apps -* OFW: Fix multiline aligned text going out of bounds (again) -* OFW: Add Initial CCID support -* OFW: Add confirmation before exiting USB-UART -* OFW: Add extended I2C HAL functions -> **Breaking API change 38.x -> 39.x** -* OFW: New clock switch schema, **fixes random core2 crashes** +* SubGHz: Add 4 more systems to Add Manually (untested!) +* SubGHz: Add Manually fixes +* SubGHz: Added NiceFlor-S to ignore options, removed colons. (by @G2Dolphin | PR #620) +* Misc code cleanup +* RGB: Fix white color on reboot, move settings, add custom color option +* **BLE Spam app** updated to latest version (Android, Windows support) (by @Willy-JL) -> (app can be found in builds ` `, `e`, `n`, `r`) +* OFW: Fix double arrows and add proper indication +* OFW: SubGHz: add manually fix 12-bits is 0xFFF (or 0xFF0) CAME/NICE 12-bit +* OFW: Fix various crashes if debug libraries used ---- diff --git a/applications/main/bad_usb/helpers/ducky_script.c b/applications/main/bad_usb/helpers/ducky_script.c index c2789eba54..0d8c77c01a 100644 --- a/applications/main/bad_usb/helpers/ducky_script.c +++ b/applications/main/bad_usb/helpers/ducky_script.c @@ -294,7 +294,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil return delay_val; } else if(delay_val < 0) { // Script error bad_usb->st.error_line = bad_usb->st.line_cur - 1; - FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur - 1U); + FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur - 1U); return SCRIPT_STATE_ERROR; } else { return (delay_val + bad_usb->defdelay); @@ -333,7 +333,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil return delay_val; } else if(delay_val < 0) { bad_usb->st.error_line = bad_usb->st.line_cur; - FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur); + FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur); return SCRIPT_STATE_ERROR; } else { return (delay_val + bad_usb->defdelay); diff --git a/applications/main/bad_usb/helpers/ducky_script.h b/applications/main/bad_usb/helpers/ducky_script.h index c8705dbdd1..dca61ed4e4 100644 --- a/applications/main/bad_usb/helpers/ducky_script.h +++ b/applications/main/bad_usb/helpers/ducky_script.h @@ -24,10 +24,10 @@ typedef enum { typedef struct { BadUsbWorkerState state; - uint16_t line_cur; - uint16_t line_nb; + size_t line_cur; + size_t line_nb; uint32_t delay_remain; - uint16_t error_line; + size_t error_line; char error[64]; } BadUsbState; diff --git a/applications/main/bad_usb/views/bad_usb_view.c b/applications/main/bad_usb/views/bad_usb_view.c index fa75b50d03..588b260c45 100644 --- a/applications/main/bad_usb/views/bad_usb_view.c +++ b/applications/main/bad_usb/views/bad_usb_view.c @@ -82,7 +82,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { canvas_set_font(canvas, FontPrimary); canvas_draw_str_aligned(canvas, 127, 33, AlignRight, AlignBottom, "ERROR:"); canvas_set_font(canvas, FontSecondary); - furi_string_printf(disp_str, "line %u", model->state.error_line); + furi_string_printf(disp_str, "line %zu", model->state.error_line); canvas_draw_str_aligned( canvas, 127, 46, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); furi_string_reset(disp_str); @@ -105,7 +105,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { } canvas_set_font(canvas, FontBigNumbers); furi_string_printf( - disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb); + disp_str, "%zu", ((model->state.line_cur - 1) * 100) / model->state.line_nb); canvas_draw_str_aligned( canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); furi_string_reset(disp_str); @@ -124,7 +124,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { } canvas_set_font(canvas, FontBigNumbers); furi_string_printf( - disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb); + disp_str, "%zu", ((model->state.line_cur - 1) * 100) / model->state.line_nb); canvas_draw_str_aligned( canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); furi_string_reset(disp_str); @@ -142,7 +142,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { } canvas_set_font(canvas, FontBigNumbers); furi_string_printf( - disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb); + disp_str, "%zu", ((model->state.line_cur - 1) * 100) / model->state.line_nb); canvas_draw_str_aligned( canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); furi_string_reset(disp_str); diff --git a/applications/main/subghz/helpers/subghz_custom_event.h b/applications/main/subghz/helpers/subghz_custom_event.h index 5f1a02673b..fec4c66c5a 100644 --- a/applications/main/subghz/helpers/subghz_custom_event.h +++ b/applications/main/subghz/helpers/subghz_custom_event.h @@ -25,8 +25,12 @@ typedef enum { SubmenuIndexStilmatic, SubmenuIndexDTMNeo433, SubmenuIndexGibidi433, + SubmenuIndexNiceMHouse_433_92, + SubmenuIndexJCM_433_92, + SubmenuIndexNormstahl_433_92, SubmenuIndexGSN, SubmenuIndexAprimatic, + SubmenuIndexHCS101_433_92, SubmenuIndexANMotorsAT4, SubmenuIndexAlutechAT4N, SubmenuIndexNiceFlo12bit, @@ -51,9 +55,9 @@ typedef enum { SubmenuIndexGateTX, SubmenuIndexDoorHan_315_00, SubmenuIndexDoorHan_433_92, - SubmenuIndexLiftMaster_315_00, - SubmenuIndexLiftMaster_390_00, - SubmenuIndexLiftMaster_433_00, + SubmenuIndexSecPlus_v1_315_00, + SubmenuIndexSecPlus_v1_390_00, + SubmenuIndexSecPlus_v1_433_00, SubmenuIndexSecPlus_v2_310_00, SubmenuIndexSecPlus_v2_315_00, SubmenuIndexSecPlus_v2_390_00, diff --git a/applications/main/subghz/scenes/subghz_scene_receiver_config.c b/applications/main/subghz/scenes/subghz_scene_receiver_config.c index d09b63c4ed..09c3976cc3 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver_config.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver_config.c @@ -12,6 +12,7 @@ enum SubGhzSettingIndex { SubGhzSettingIndexIgnoreCars, SubGhzSettingIndexIgnoreMagellan, SubGhzSettingIndexIgnorePrinceton, + SubGhzSettingIndexIgnoreNiceFlorS, SubGhzSettingIndexSound, SubGhzSettingIndexResetToDefault, SubGhzSettingIndexLock, @@ -278,6 +279,10 @@ static void subghz_scene_receiver_config_set_princeton(VariableItem* item) { subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_Princeton); } +static void subghz_scene_receiver_config_set_niceflors(VariableItem* item) { + subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_NiceFlorS); +} + static void subghz_scene_receiver_config_var_list_enter_callback(void* context, uint32_t index) { furi_assert(context); SubGhz* subghz = context; @@ -336,7 +341,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { item = variable_item_list_add( subghz->variable_item_list, - "Frequency:", + "Frequency", subghz_setting_get_frequency_count(setting), subghz_scene_receiver_config_set_frequency, subghz); @@ -356,7 +361,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { item = variable_item_list_add( subghz->variable_item_list, - "Modulation:", + "Modulation", subghz_setting_get_preset_count(setting), subghz_scene_receiver_config_set_preset, subghz); @@ -371,7 +376,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { // Hopping item = variable_item_list_add( subghz->variable_item_list, - "Hopping:", + "Hopping", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_hopping_running, subghz); @@ -385,7 +390,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { SubGhzCustomEventManagerSet) { item = variable_item_list_add( subghz->variable_item_list, - "Bin RAW:", + "Bin RAW", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_bin_raw, subghz); @@ -399,7 +404,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { SubGhzCustomEventManagerSet) { item = variable_item_list_add( subghz->variable_item_list, - "Ignore Starline:", + "Ignore Starline", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_starline, subghz); @@ -411,7 +416,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { item = variable_item_list_add( subghz->variable_item_list, - "Ignore Cars:", + "Ignore Cars", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_auto_alarms, subghz); @@ -423,7 +428,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { item = variable_item_list_add( subghz->variable_item_list, - "Ignore Magellan:", + "Ignore Magellan", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_magellan, subghz); @@ -435,7 +440,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { item = variable_item_list_add( subghz->variable_item_list, - "Ignore Princeton:", + "Ignore Princeton", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_princeton, subghz); @@ -444,12 +449,24 @@ void subghz_scene_receiver_config_on_enter(void* context) { subghz->ignore_filter, SubGhzProtocolFlag_Princeton); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, combobox_text[value_index]); + + item = variable_item_list_add( + subghz->variable_item_list, + "Ignore Nice Flor-S / Nice One", + COMBO_BOX_COUNT, + subghz_scene_receiver_config_set_niceflors, + subghz); + + value_index = subghz_scene_receiver_config_ignore_filter_get_index( + subghz->ignore_filter, SubGhzProtocolFlag_NiceFlorS); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, combobox_text[value_index]); } // Enable speaker, will send all incoming noises and signals to speaker so you can listen how your remote sounds like :) item = variable_item_list_add( subghz->variable_item_list, - "Sound:", + "Sound", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_speaker, subghz); diff --git a/applications/main/subghz/scenes/subghz_scene_set_type.c b/applications/main/subghz/scenes/subghz_scene_set_type.c index 062bc813a5..28db55d754 100644 --- a/applications/main/subghz/scenes/subghz_scene_set_type.c +++ b/applications/main/subghz/scenes/subghz_scene_set_type.c @@ -67,6 +67,12 @@ void subghz_scene_set_type_on_enter(void* context) { SubmenuIndexAlutechAT4N, subghz_scene_set_type_submenu_callback, subghz); + submenu_add_item( + subghz->submenu, + "KL: HCS101 433MHz", + SubmenuIndexHCS101_433_92, + subghz_scene_set_type_submenu_callback, + subghz); submenu_add_item( subghz->submenu, "KL: DoorHan 315MHz", @@ -163,6 +169,24 @@ void subghz_scene_set_type_on_enter(void* context) { SubmenuIndexElmesElectronic, subghz_scene_set_type_submenu_callback, subghz); + submenu_add_item( + subghz->submenu, + "KL: Normstahl 433MHz", + SubmenuIndexNormstahl_433_92, + subghz_scene_set_type_submenu_callback, + subghz); + submenu_add_item( + subghz->submenu, + "KL: JCM Tech 433MHz", + SubmenuIndexJCM_433_92, + subghz_scene_set_type_submenu_callback, + subghz); + submenu_add_item( + subghz->submenu, + "KL: Nice Mhouse 433MHz", + SubmenuIndexNiceMHouse_433_92, + subghz_scene_set_type_submenu_callback, + subghz); submenu_add_item( subghz->submenu, "KL: Nice Smilo 433MHz", @@ -278,19 +302,19 @@ void subghz_scene_set_type_on_enter(void* context) { submenu_add_item( subghz->submenu, "Security+1.0 315MHz", - SubmenuIndexLiftMaster_315_00, + SubmenuIndexSecPlus_v1_315_00, subghz_scene_set_type_submenu_callback, subghz); submenu_add_item( subghz->submenu, "Security+1.0 390MHz", - SubmenuIndexLiftMaster_390_00, + SubmenuIndexSecPlus_v1_390_00, subghz_scene_set_type_submenu_callback, subghz); submenu_add_item( subghz->submenu, "Security+1.0 433MHz", - SubmenuIndexLiftMaster_433_00, + SubmenuIndexSecPlus_v1_433_00, subghz_scene_set_type_submenu_callback, subghz); submenu_add_item( @@ -351,7 +375,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { subghz->txrx, "AM650", 315000000, SUBGHZ_PROTOCOL_PRINCETON_NAME, key, 24, 400); break; case SubmenuIndexNiceFlo12bit: - key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4 + key = (key & 0x00000FF0) | 0x1; //btn 0x1, 0x2, 0x4 generated_protocol = subghz_txrx_gen_data_protocol( subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 12); break; @@ -361,7 +385,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 24); break; case SubmenuIndexCAME12bit: - key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4 + key = (key & 0x00000FF0) | 0x1; //btn 0x1, 0x2, 0x4 generated_protocol = subghz_txrx_gen_data_protocol( subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_CAME_NAME, key, 12); break; @@ -371,7 +395,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_CAME_NAME, key, 24); break; case SubmenuIndexCAME12bit868: - key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4 + key = (key & 0x00000FF0) | 0x1; //btn 0x1, 0x2, 0x4 generated_protocol = subghz_txrx_gen_data_protocol( subghz->txrx, "AM650", 868350000, SUBGHZ_PROTOCOL_CAME_NAME, key, 12); break; @@ -702,31 +726,71 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); } break; - case SubmenuIndexLiftMaster_315_00: + case SubmenuIndexNiceMHouse_433_92: + generated_protocol = subghz_txrx_gen_keeloq_protocol( + subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003, "NICE_MHOUSE"); + if(!generated_protocol) { + furi_string_set( + subghz->error_str, "Function requires\nan SD card with\nfresh databases."); + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); + } + break; + case SubmenuIndexJCM_433_92: + generated_protocol = subghz_txrx_gen_keeloq_protocol( + subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003, "JCM_Tech"); + if(!generated_protocol) { + furi_string_set( + subghz->error_str, "Function requires\nan SD card with\nfresh databases."); + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); + } + break; + case SubmenuIndexNormstahl_433_92: + generated_protocol = subghz_txrx_gen_keeloq_protocol( + subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003, "Normstahl"); + if(!generated_protocol) { + furi_string_set( + subghz->error_str, "Function requires\nan SD card with\nfresh databases."); + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); + } + break; + case SubmenuIndexHCS101_433_92: + generated_protocol = subghz_txrx_gen_keeloq_protocol( + subghz->txrx, "AM650", 433920000, key & 0x000FFFFF, 0x2, 0x0003, "HCS101"); + if(!generated_protocol) { + furi_string_set( + subghz->error_str, "Function requires\nan SD card with\nfresh databases."); + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); + } + break; + case SubmenuIndexSecPlus_v1_315_00: generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 315000000); break; - case SubmenuIndexLiftMaster_390_00: + case SubmenuIndexSecPlus_v1_390_00: generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 390000000); break; - case SubmenuIndexLiftMaster_433_00: + case SubmenuIndexSecPlus_v1_433_00: generated_protocol = subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 433920000); break; case SubmenuIndexSecPlus_v2_310_00: + key = (key & 0x7FFFF3FC); // 850LM pairing generated_protocol = subghz_txrx_gen_secplus_v2_protocol( subghz->txrx, "AM650", 310000000, key, 0x68, 0xE500000); break; case SubmenuIndexSecPlus_v2_315_00: + key = (key & 0x7FFFF3FC); // 850LM pairing generated_protocol = subghz_txrx_gen_secplus_v2_protocol( subghz->txrx, "AM650", 315000000, key, 0x68, 0xE500000); break; case SubmenuIndexSecPlus_v2_390_00: + key = (key & 0x7FFFF3FC); // 850LM pairing generated_protocol = subghz_txrx_gen_secplus_v2_protocol( subghz->txrx, "AM650", 390000000, key, 0x68, 0xE500000); break; case SubmenuIndexSecPlus_v2_433_00: + key = (key & 0x7FFFF3FC); // 850LM pairing generated_protocol = subghz_txrx_gen_secplus_v2_protocol( subghz->txrx, "AM650", 433920000, key, 0x68, 0xE500000); break; diff --git a/applications/main/subghz/subghz_cli.c b/applications/main/subghz/subghz_cli.c index 177dad1ac4..dc379296af 100644 --- a/applications/main/subghz/subghz_cli.c +++ b/applications/main/subghz/subghz_cli.c @@ -558,7 +558,7 @@ void subghz_cli_command_decode_raw(Cli* cli, FuriString* args, void* context) { } } - printf("\r\nPackets received \033[0;32m%u\033[0m\r\n", instance->packet_count); + printf("\r\nPackets received \033[0;32m%zu\033[0m\r\n", instance->packet_count); // Cleanup subghz_receiver_free(receiver); diff --git a/applications/main/subghz/subghz_last_settings.c b/applications/main/subghz/subghz_last_settings.c index 2109024ad5..fe072a1efe 100644 --- a/applications/main/subghz/subghz_last_settings.c +++ b/applications/main/subghz/subghz_last_settings.c @@ -303,7 +303,7 @@ void subghz_last_settings_log(SubGhzLastSettings* instance) { TAG, "Frequency: %03ld.%02ld, FeedbackLevel: %ld, FATrigger: %.2f, External: %s, ExtPower: %s, TimestampNames: %s, ExtPowerAmp: %s,\n" "Hopping: %s,\nPreset: %ld, RSSI: %.2f, " - "Starline: %s, Cars: %s, Magellan: %s, BinRAW: %s", + "Starline: %s, Cars: %s, Magellan: %s, NiceFloR-S: %s, BinRAW: %s", instance->frequency / 1000000 % 1000, instance->frequency / 10000 % 100, instance->frequency_analyzer_feedback_level, @@ -321,5 +321,7 @@ void subghz_last_settings_log(SubGhzLastSettings* instance) { instance->ignore_filter, SubGhzProtocolFlag_AutoAlarms), subghz_last_settings_log_filter_get_index( instance->ignore_filter, SubGhzProtocolFlag_Magellan), + subghz_last_settings_log_filter_get_index( + instance->ignore_filter, SubGhzProtocolFlag_NiceFlorS), subghz_last_settings_log_filter_get_index(instance->filter, SubGhzProtocolFlag_BinRAW)); } diff --git a/applications/services/gui/modules/byte_input.c b/applications/services/gui/modules/byte_input.c index 037d31a5d7..5bf387b265 100644 --- a/applications/services/gui/modules/byte_input.c +++ b/applications/services/gui/modules/byte_input.c @@ -226,16 +226,33 @@ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) { canvas_invert_color(canvas); } } else { - canvas_draw_glyph( - canvas, - text_x + 2 + byte_position * 14, - text_y, - byte_input_get_nibble_text(model->bytes[i], true)); - canvas_draw_glyph( - canvas, - text_x + 8 + byte_position * 14, - text_y, - byte_input_get_nibble_text(model->bytes[i], false)); + if(model->first_visible_byte > 0 && i == model->first_visible_byte) { + canvas_draw_icon( + canvas, + text_x + 2 + byte_position * 14, + text_y - 7, + &I_More_data_placeholder_5x7); + } else { + canvas_draw_glyph( + canvas, + text_x + 2 + byte_position * 14, + text_y, + byte_input_get_nibble_text(model->bytes[i], true)); + } + if(model->bytes_count - model->first_visible_byte > max_drawable_bytes && + i == model->first_visible_byte + MIN(model->bytes_count, max_drawable_bytes) - 1) { + canvas_draw_icon( + canvas, + text_x + 8 + byte_position * 14, + text_y - 7, + &I_More_data_placeholder_5x7); + } else { + canvas_draw_glyph( + canvas, + text_x + 8 + byte_position * 14, + text_y, + byte_input_get_nibble_text(model->bytes[i], false)); + } } if(draw_index_line) { @@ -260,14 +277,6 @@ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) { snprintf(str, 20, "%u", (model->selected_byte + 1)); canvas_draw_str(canvas, text_x + 75, text_y2, str); } - - if(model->bytes_count - model->first_visible_byte > max_drawable_bytes) { - canvas_draw_icon(canvas, 123, 21, &I_ButtonRightSmall_3x5); - } - - if(model->first_visible_byte > 0) { - canvas_draw_icon(canvas, 1, 21, &I_ButtonLeftSmall_3x5); - } } /** Draw input box (selected view) @@ -306,27 +315,36 @@ static void byte_input_draw_input_selected(Canvas* canvas, ByteInputModel* model byte_input_get_nibble_text(model->bytes[i], false)); canvas_invert_color(canvas); } else { - canvas_draw_glyph( - canvas, - text_x + 2 + byte_position * 14, - text_y, - byte_input_get_nibble_text(model->bytes[i], true)); - canvas_draw_glyph( - canvas, - text_x + 8 + byte_position * 14, - text_y, - byte_input_get_nibble_text(model->bytes[i], false)); + if(model->first_visible_byte > 0 && i == model->first_visible_byte) { + canvas_draw_icon( + canvas, + text_x + 2 + byte_position * 14, + text_y - 7, + &I_More_data_placeholder_5x7); + } else { + canvas_draw_glyph( + canvas, + text_x + 2 + byte_position * 14, + text_y, + byte_input_get_nibble_text(model->bytes[i], true)); + } + if(model->bytes_count - model->first_visible_byte > max_drawable_bytes && + i == model->first_visible_byte + MIN(model->bytes_count, max_drawable_bytes) - 1) { + canvas_draw_icon( + canvas, + text_x + 8 + byte_position * 14, + text_y - 7, + &I_More_data_placeholder_5x7); + } else { + canvas_draw_glyph( + canvas, + text_x + 8 + byte_position * 14, + text_y, + byte_input_get_nibble_text(model->bytes[i], false)); + } } } - if(model->bytes_count - model->first_visible_byte > max_drawable_bytes) { - canvas_draw_icon(canvas, 123, 21, &I_ButtonRightSmall_3x5); - } - - if(model->first_visible_byte > 0) { - canvas_draw_icon(canvas, 1, 21, &I_ButtonLeftSmall_3x5); - } - canvas_invert_color(canvas); } diff --git a/applications/services/storage/storage_external_api.c b/applications/services/storage/storage_external_api.c index 2ba58f9c66..ed69b49a57 100644 --- a/applications/services/storage/storage_external_api.c +++ b/applications/services/storage/storage_external_api.c @@ -869,7 +869,7 @@ bool storage_simply_remove_recursive(Storage* storage, const char* path) { while(storage_dir_read(dir, &fileinfo, name, MAX_NAME_LENGTH)) { if(file_info_is_dir(&fileinfo)) { - furi_string_cat_printf(cur_dir, "/%s", name); + furi_string_cat_printf(cur_dir, "/%s", name); //-V576 go_deeper = true; break; } diff --git a/applications/system/storage_move_to_sd/storage_move_to_sd.c b/applications/system/storage_move_to_sd/storage_move_to_sd.c index 5aaacd736e..4a0f3f4ad0 100644 --- a/applications/system/storage_move_to_sd/storage_move_to_sd.c +++ b/applications/system/storage_move_to_sd/storage_move_to_sd.c @@ -28,14 +28,6 @@ static void storage_move_to_sd_remove_region() { if(storage_common_exists(storage, INT_PATH(".region_data"))) { storage_common_remove(storage, INT_PATH(".region_data")); } - if(storage_common_exists(storage, EXT_PATH("apps/Misc/totp.conf"))) { - storage_common_rename( - storage, EXT_PATH("apps/Misc/totp.conf"), EXT_PATH("authenticator/totp.conf")); - } - if(storage_common_exists(storage, EXT_PATH("apps/Misc/barcodegen.save"))) { - storage_common_remove(storage, EXT_PATH("apps/Misc/barcodegen.save")); - storage_common_remove(storage, EXT_PATH("apps/Misc")); - } furi_record_close(RECORD_STORAGE); } diff --git a/assets/icons/Common/More_data_placeholder_5x7.png b/assets/icons/Common/More_data_placeholder_5x7.png new file mode 100644 index 0000000000..85025d9f0a Binary files /dev/null and b/assets/icons/Common/More_data_placeholder_5x7.png differ diff --git a/firmware/targets/f7/furi_hal/furi_hal_clock.c b/firmware/targets/f7/furi_hal/furi_hal_clock.c index 86c8fd4676..945dc323b2 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_clock.c +++ b/firmware/targets/f7/furi_hal/furi_hal_clock.c @@ -118,7 +118,6 @@ void furi_hal_clock_init() { NVIC_EnableIRQ(SysTick_IRQn); LL_RCC_SetCLK48ClockSource(LL_RCC_CLK48_CLKSOURCE_PLLSAI1); - LL_RCC_HSI_EnableInStopMode(); // Ensure that MR is capable of work in STOP0 LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSI); LL_RCC_SetSMPSPrescaler(LL_RCC_SMPS_DIV_1); LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE); @@ -133,7 +132,7 @@ void furi_hal_clock_switch_hse2hsi() { ; LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI); - furi_assert(LL_RCC_GetSMPSClockSource() == LL_RCC_SMPS_CLKSOURCE_HSI); + furi_assert(LL_RCC_GetSMPSClockSelection() == LL_RCC_SMPS_CLKSOURCE_HSI); while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI) ; diff --git a/firmware/targets/f7/furi_hal/furi_hal_power.c b/firmware/targets/f7/furi_hal/furi_hal_power.c index c14de85697..0eb93e664b 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_power.c +++ b/firmware/targets/f7/furi_hal/furi_hal_power.c @@ -65,6 +65,10 @@ void furi_hal_power_init() { LL_PWR_SetPowerMode(FURI_HAL_POWER_STOP_MODE); LL_C2_PWR_SetPowerMode(FURI_HAL_POWER_STOP_MODE); +#if FURI_HAL_POWER_STOP_MODE == LL_PWR_MODE_STOP0 + LL_RCC_HSI_EnableInStopMode(); // Ensure that MR is capable of work in STOP0 +#endif + furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); // Find and init gauge if(bq27220_init(&furi_hal_i2c_handle_power)) { @@ -206,8 +210,11 @@ static inline void furi_hal_power_deep_sleep() { while(LL_HSEM_1StepLock(HSEM, CFG_HW_RCC_SEMID)) ; - if(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE) { + if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSI) { furi_hal_clock_switch_hsi2hse(); + } else { + // Ensure that we are already on HSE + furi_check(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSE); } LL_HSEM_ReleaseLock(HSEM, CFG_HW_RCC_SEMID, 0); diff --git a/firmware/targets/f7/furi_hal/furi_hal_usb_ccid.c b/firmware/targets/f7/furi_hal/furi_hal_usb_ccid.c index e9906fed46..5c35c69f88 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_usb_ccid.c +++ b/firmware/targets/f7/furi_hal/furi_hal_usb_ccid.c @@ -331,13 +331,12 @@ void CALLBACK_CCID_IccPowerOn( if(callbacks[CCID_SLOT_INDEX] != NULL) { callbacks[CCID_SLOT_INDEX]->icc_power_on_callback( responseDataBlock->abData, &responseDataBlock->dwLength, NULL); + responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | + CCID_ICCSTATUS_PRESENTANDACTIVE; } else { responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_PRESENTANDINACTIVE; } - - responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | - CCID_ICCSTATUS_PRESENTANDACTIVE; } else { responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_NOICCPRESENT; @@ -366,13 +365,12 @@ void CALLBACK_CCID_XfrBlock( responseDataBlock->abData, &responseDataBlock->dwLength, NULL); + responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | + CCID_ICCSTATUS_PRESENTANDACTIVE; } else { responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_PRESENTANDINACTIVE; } - - responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | - CCID_ICCSTATUS_PRESENTANDACTIVE; } else { responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_NOICCPRESENT; @@ -413,11 +411,11 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { usb_dev, ep, &ReceiveBuffer, sizeof(ccid_bulk_message_header_t) + CCID_DATABLOCK_SIZE); //minimum request size is header size furi_assert((uint16_t)bytes_read >= sizeof(ccid_bulk_message_header_t)); - ccid_bulk_message_header_t* message = (ccid_bulk_message_header_t*)&ReceiveBuffer; + ccid_bulk_message_header_t* message = (ccid_bulk_message_header_t*)&ReceiveBuffer; //-V641 if(message->bMessageType == PC_TO_RDR_ICCPOWERON) { struct pc_to_rdr_icc_power_on* requestDataBlock = - (struct pc_to_rdr_icc_power_on*)message; + (struct pc_to_rdr_icc_power_on*)message; //-V641 struct rdr_to_pc_data_block* responseDataBlock = (struct rdr_to_pc_data_block*)&SendBuffer; @@ -432,9 +430,9 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { (sizeof(uint8_t) * responseDataBlock->dwLength)); } else if(message->bMessageType == PC_TO_RDR_ICCPOWEROFF) { struct pc_to_rdr_icc_power_off* requestIccPowerOff = - (struct pc_to_rdr_icc_power_off*)message; + (struct pc_to_rdr_icc_power_off*)message; //-V641 struct rdr_to_pc_slot_status* responseSlotStatus = - (struct rdr_to_pc_slot_status*)&SendBuffer; + (struct rdr_to_pc_slot_status*)&SendBuffer; //-V641 CALLBACK_CCID_GetSlotStatus( requestIccPowerOff->bSlot, requestIccPowerOff->bSeq, responseSlotStatus); @@ -443,9 +441,9 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { usb_dev, CCID_IN_EPADDR, responseSlotStatus, sizeof(struct rdr_to_pc_slot_status)); } else if(message->bMessageType == PC_TO_RDR_GETSLOTSTATUS) { struct pc_to_rdr_get_slot_status* requestSlotStatus = - (struct pc_to_rdr_get_slot_status*)message; + (struct pc_to_rdr_get_slot_status*)message; //-V641 struct rdr_to_pc_slot_status* responseSlotStatus = - (struct rdr_to_pc_slot_status*)&SendBuffer; + (struct rdr_to_pc_slot_status*)&SendBuffer; //-V641 CALLBACK_CCID_GetSlotStatus( requestSlotStatus->bSlot, requestSlotStatus->bSeq, responseSlotStatus); @@ -474,9 +472,9 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { (sizeof(uint8_t) * responseDataBlock->dwLength)); } else if(message->bMessageType == PC_TO_RDR_SETPARAMETERS) { struct pc_to_rdr_set_parameters_t0* requestSetParametersT0 = - (struct pc_to_rdr_set_parameters_t0*)message; + (struct pc_to_rdr_set_parameters_t0*)message; //-V641 struct rdr_to_pc_parameters_t0* responseSetParametersT0 = - (struct rdr_to_pc_parameters_t0*)&SendBuffer; + (struct rdr_to_pc_parameters_t0*)&SendBuffer; //-V641 furi_assert(requestSetParametersT0->dwLength <= CCID_DATABLOCK_SIZE); furi_assert( diff --git a/firmware/targets/f7/src/update.c b/firmware/targets/f7/src/update.c index 378e74a5cc..e9228a6e95 100644 --- a/firmware/targets/f7/src/update.c +++ b/firmware/targets/f7/src/update.c @@ -70,7 +70,8 @@ static bool flipper_update_load_stage(const FuriString* work_dir, UpdateManifest if((f_stat(furi_string_get_cstr(loader_img_path), &stat) != FR_OK) || (f_open(&file, furi_string_get_cstr(loader_img_path), FA_OPEN_EXISTING | FA_READ) != - FR_OK)) { + FR_OK) || + (stat.fsize == 0)) { furi_string_free(loader_img_path); return false; } @@ -83,7 +84,7 @@ static bool flipper_update_load_stage(const FuriString* work_dir, UpdateManifest uint32_t crc = 0; do { uint16_t size_read = 0; - if(f_read(&file, img + bytes_read, MAX_READ, &size_read) != FR_OK) { + if(f_read(&file, img + bytes_read, MAX_READ, &size_read) != FR_OK) { //-V769 break; } crc = crc32_calc_buffer(crc, img + bytes_read, size_read); diff --git a/furi/core/check.c b/furi/core/check.c index f7dcfc5959..8888eddfb3 100644 --- a/furi/core/check.c +++ b/furi/core/check.c @@ -153,18 +153,18 @@ FURI_NORETURN void __furi_crash() { __furi_print_heap_info(); __furi_print_bt_stack_info(); -#ifndef FURI_DEBUG // Check if debug enabled by DAP // https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/Debug-register-support-in-the-SCS/Debug-Halting-Control-and-Status-Register--DHCSR?lang=en bool debug = CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk; +#ifdef FURI_NDEBUG if(debug) { #endif furi_hal_console_puts("\r\nSystem halted. Connect debugger for more info\r\n"); furi_hal_console_puts("\033[0m\r\n"); furi_hal_debug_enable(); - RESTORE_REGISTERS_AND_HALT_MCU(true); -#ifndef FURI_DEBUG + RESTORE_REGISTERS_AND_HALT_MCU(debug); +#ifdef FURI_NDEBUG } else { uint32_t ptr = (uint32_t)__furi_check_message; if(ptr < FLASH_BASE || ptr > (FLASH_BASE + FLASH_SIZE)) { diff --git a/furi/core/memmgr_heap.c b/furi/core/memmgr_heap.c index 3b4fdafa07..82667debc8 100644 --- a/furi/core/memmgr_heap.c +++ b/furi/core/memmgr_heap.c @@ -115,8 +115,9 @@ static size_t xBlockAllocatedBit = 0; #include /* Allocation tracking types */ -DICT_DEF2(MemmgrHeapAllocDict, uint32_t, uint32_t) -DICT_DEF2( +DICT_DEF2(MemmgrHeapAllocDict, uint32_t, uint32_t) //-V1048 + +DICT_DEF2( //-V1048 MemmgrHeapThreadDict, uint32_t, M_DEFAULT_OPLIST, diff --git a/lib/flipper_application/elf/elf_file.c b/lib/flipper_application/elf/elf_file.c index 7ac4c655dc..9b8b4c8f5f 100644 --- a/lib/flipper_application/elf/elf_file.c +++ b/lib/flipper_application/elf/elf_file.c @@ -853,7 +853,7 @@ ElfProcessSectionResult elf_process_section( if(process_section(elf->fd, section_header.sh_offset, section_header.sh_size, context)) { result = ElfProcessSectionResultSuccess; } else { - result = ElfProcessSectionResultCannotProcess; + result = ElfProcessSectionResultCannotProcess; //-V1048 } } diff --git a/lib/flipper_application/elf/elf_file_i.h b/lib/flipper_application/elf/elf_file_i.h index 39cadfdc6f..e1b97b631c 100644 --- a/lib/flipper_application/elf/elf_file_i.h +++ b/lib/flipper_application/elf/elf_file_i.h @@ -6,7 +6,7 @@ extern "C" { #endif -DICT_DEF2(AddressCache, int, M_DEFAULT_OPLIST, Elf32_Addr, M_DEFAULT_OPLIST) +DICT_DEF2(AddressCache, int, M_DEFAULT_OPLIST, Elf32_Addr, M_DEFAULT_OPLIST) //-V1048 /** * Callable elf entry type diff --git a/lib/lfrfid/lfrfid_worker.c b/lib/lfrfid/lfrfid_worker.c index 1e491c6b78..cbc7b02e37 100644 --- a/lib/lfrfid/lfrfid_worker.c +++ b/lib/lfrfid/lfrfid_worker.c @@ -118,7 +118,6 @@ void lfrfid_worker_start_thread(LFRFIDWorker* worker) { } void lfrfid_worker_stop_thread(LFRFIDWorker* worker) { - furi_assert(worker->mode_index == LFRFIDWorkerIdle); furi_thread_flags_set(furi_thread_get_id(worker->thread), LFRFIDEventStopThread); furi_thread_join(worker->thread); } diff --git a/lib/nfc/protocols/slix.c b/lib/nfc/protocols/slix.c index dbff2f2188..4b15f4b977 100644 --- a/lib/nfc/protocols/slix.c +++ b/lib/nfc/protocols/slix.c @@ -197,7 +197,7 @@ ReturnCode slix_get_random(NfcVData* data) { } ReturnCode slix_unlock(NfcVData* data, uint32_t password_id) { - furi_assert(rand); + furi_assert(data); uint16_t received = 0; uint8_t rxBuf[32]; diff --git a/lib/subghz/protocols/nice_flor_s.c b/lib/subghz/protocols/nice_flor_s.c index 8c4a228585..3f56ba1078 100644 --- a/lib/subghz/protocols/nice_flor_s.c +++ b/lib/subghz/protocols/nice_flor_s.c @@ -80,7 +80,7 @@ const SubGhzProtocol subghz_protocol_nice_flor_s = { .type = SubGhzProtocolTypeDynamic, .flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_868 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | - SubGhzProtocolFlag_Send, + SubGhzProtocolFlag_Send | SubGhzProtocolFlag_NiceFlorS, .decoder = &subghz_protocol_nice_flor_s_decoder, .encoder = &subghz_protocol_nice_flor_s_encoder, diff --git a/lib/subghz/types.h b/lib/subghz/types.h index 8999e1d549..0dc219bbfa 100644 --- a/lib/subghz/types.h +++ b/lib/subghz/types.h @@ -129,6 +129,7 @@ typedef enum { SubGhzProtocolFlag_AutoAlarms = (1 << 12), SubGhzProtocolFlag_Magellan = (1 << 13), SubGhzProtocolFlag_Princeton = (1 << 14), + SubGhzProtocolFlag_NiceFlorS = (1 << 15), } SubGhzProtocolFlag; struct SubGhzProtocol { diff --git a/lib/u8g2/u8g2_glue.c b/lib/u8g2/u8g2_glue.c index 9463d13183..230bd2a1bc 100644 --- a/lib/u8g2/u8g2_glue.c +++ b/lib/u8g2/u8g2_glue.c @@ -2,8 +2,8 @@ #include -#define CONTRAST_ERC 31 -#define CONTRAST_MGG 27 +#define CONTRAST_ERC 32 +#define CONTRAST_MGG 28 uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr) { UNUSED(u8x8);