From 8aa129395f93367b9f967d4e0c4bf7dc680f23ca Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:54:09 +0100 Subject: [PATCH 1/5] [FL-3871] Infrared: check for negative timings (#3788) --- lib/flipper_format/flipper_format_stream.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/flipper_format/flipper_format_stream.c b/lib/flipper_format/flipper_format_stream.c index 83e77a4e2..b9d33169c 100644 --- a/lib/flipper_format/flipper_format_stream.c +++ b/lib/flipper_format/flipper_format_stream.c @@ -400,7 +400,11 @@ bool flipper_format_stream_read_value_line( }; break; case FlipperStreamValueUint32: { uint32_t* data = _data; - scan_values = sscanf(furi_string_get_cstr(value), "%" PRIu32, &data[i]); + // Minus sign is allowed in scanf() for unsigned numbers, resulting in unintentionally huge values with no error reported + if(!furi_string_start_with(value, "-")) { + scan_values = + sscanf(furi_string_get_cstr(value), "%" PRIu32, &data[i]); + } }; break; case FlipperStreamValueHexUint64: { uint64_t* data = _data; From 05a0d0105bd3d684cb48f2020f0cc845592deff5 Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 16 Jul 2024 15:17:38 +0300 Subject: [PATCH 2/5] ufbt: synced .clang-format rules with main (#3787) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- scripts/ufbt/project_template/.clang-format | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/ufbt/project_template/.clang-format b/scripts/ufbt/project_template/.clang-format index ad3484ba0..c42068920 100644 --- a/scripts/ufbt/project_template/.clang-format +++ b/scripts/ufbt/project_template/.clang-format @@ -11,9 +11,9 @@ AlignConsecutiveAssignments: AlignFunctionPointers: false PadOperators: true AlignConsecutiveBitFields: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false + Enabled: true + AcrossEmptyLines: true + AcrossComments: true AlignCompound: false AlignFunctionPointers: false PadOperators: true @@ -25,10 +25,10 @@ AlignConsecutiveDeclarations: AlignFunctionPointers: false PadOperators: true AlignConsecutiveMacros: - Enabled: false + Enabled: true AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: true + AlignCompound: true AlignFunctionPointers: false PadOperators: true AlignConsecutiveShortCaseStatements: @@ -47,7 +47,7 @@ AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortCompoundRequirementOnASingleLine: true -AllowShortEnumsOnASingleLine: true +AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLambdasOnASingleLine: All @@ -108,6 +108,7 @@ ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH + - M_EACH IfMacros: - KJ_IF_MAYBE IncludeBlocks: Preserve @@ -136,7 +137,7 @@ IndentRequiresClause: false IndentWidth: 4 IndentWrappedFunctionNames: true InsertBraces: false -InsertNewlineAtEOF: false +InsertNewlineAtEOF: true InsertTrailingCommas: None IntegerLiteralSeparator: Binary: 0 @@ -179,7 +180,7 @@ ReferenceAlignment: Pointer ReflowComments: false RemoveBracesLLVM: false RemoveParentheses: Leave -RemoveSemicolon: false +RemoveSemicolon: true RequiresClausePosition: OwnLine RequiresExpressionIndentation: OuterScope SeparateDefinitionBlocks: Leave @@ -226,7 +227,7 @@ SpacesInParensOptions: InEmptyParentheses: false Other: false SpacesInSquareBrackets: false -Standard: c++03 +Standard: c++20 StatementAttributeLikeMacros: - Q_EMIT StatementMacros: From 03221e990f146a34f7ed3e98905d1ed636d3bc44 Mon Sep 17 00:00:00 2001 From: GreenBean <87831454+GreenBean657@users.noreply.github.com> Date: Tue, 16 Jul 2024 05:27:33 -0700 Subject: [PATCH 3/5] Update tv.ir (#3789) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds definitions for Emerson TV Universal Remote Co-authored-by: あく --- .../infrared/resources/infrared/assets/tv.ir | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/applications/main/infrared/resources/infrared/assets/tv.ir b/applications/main/infrared/resources/infrared/assets/tv.ir index 5eab4c65c..4d5868cce 100644 --- a/applications/main/infrared/resources/infrared/assets/tv.ir +++ b/applications/main/infrared/resources/infrared/assets/tv.ir @@ -1867,3 +1867,41 @@ protocol: NEC address: 04 00 00 00 command: 09 00 00 00 # +# Emerson TV +# +name: Power +type: parsed +protocol: NECext +address: 84 E0 00 00 +command: 20 DF 00 00 +# +name: Ch_next +type: parsed +protocol: NECext +address: 84 E0 00 00 +command: 50 AF 00 00 +# +name: Ch_prev +type: parsed +protocol: NECext +address: 84 E0 00 00 +command: 51 AE 00 00 +# +name: Vol_up +type: parsed +protocol: NECext +address: 84 E0 00 00 +command: 60 9F 00 00 +# +name: Vol_dn +type: parsed +protocol: NECext +address: 84 E0 00 00 +command: 61 9E 00 00 +# +name: Mute +type: parsed +protocol: NECext +address: 84 E0 00 00 +command: 64 9B 00 00 + From 31919965a1e8200635f4cda0075396b4a4520b8e Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 16 Jul 2024 17:41:30 +0300 Subject: [PATCH 4/5] VSCode fixes: .gitignore & clangd (#3790) * vscode: fine-tuned .gitignore to allow extra untracked files in .vscode folder * vscode: temporary disabled toolchain-provided clangd * Update sublime project to match vscode config Co-authored-by: Aleksandr Kutuzov --- .sublime-project | 22 +++++++++++-------- .vscode/.gitignore | 8 +++---- .vscode/example/settings.json.tmpl | 2 +- .../project_template/.vscode/settings.json | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.sublime-project b/.sublime-project index 5d751aaf6..da2ef41a1 100644 --- a/.sublime-project +++ b/.sublime-project @@ -6,16 +6,20 @@ } ], "settings": { - "LSP": { - "clangd": { - "initializationOptions": { - "clangd.compile-commands-dir": "build/latest", - "clangd.header-insertion": "never", - "clangd.query-driver": "**", - "clangd.clang-tidy": true, - }, + "LSP": { + "clangd": { "enabled": true, + "initializationOptions": { + // Use with toolchain version 39+ + // Set `"binary": "custom",` option in LSP-clangd config to use toolchain clangd + // "custom_command": ["toolchain/current/bin/clangd"], + + "clangd.compile-commands-dir": "build/latest", + "clangd.header-insertion": "never", + "clangd.query-driver": "**/arm-none-eabi-*", + "clangd.clang-tidy": true, + }, }, - }, + }, }, } diff --git a/.vscode/.gitignore b/.vscode/.gitignore index 481efcdef..bd4df47d6 100644 --- a/.vscode/.gitignore +++ b/.vscode/.gitignore @@ -1,5 +1,3 @@ -/c_cpp_properties.json -/extensions.json -/launch.json -/settings.json -/tasks.json +* +!example/ +!ReadMe.md diff --git a/.vscode/example/settings.json.tmpl b/.vscode/example/settings.json.tmpl index 5e5b5dcf4..5e0da6897 100644 --- a/.vscode/example/settings.json.tmpl +++ b/.vscode/example/settings.json.tmpl @@ -12,7 +12,7 @@ "SConstruct": "python", "*.fam": "python" }, - "clangd.path": "${workspaceFolder}/toolchain/current/bin/clangd@FBT_PLATFORM_EXECUTABLE_EXT@", + // "clangd.path": "${workspaceFolder}/toolchain/current/bin/clangd@FBT_PLATFORM_EXECUTABLE_EXT@", "clangd.arguments": [ "--query-driver=**/arm-none-eabi-*", "--compile-commands-dir=${workspaceFolder}/build/latest", diff --git a/scripts/ufbt/project_template/.vscode/settings.json b/scripts/ufbt/project_template/.vscode/settings.json index d304752a9..b93ad82f1 100644 --- a/scripts/ufbt/project_template/.vscode/settings.json +++ b/scripts/ufbt/project_template/.vscode/settings.json @@ -19,7 +19,7 @@ "[python]": { "editor.defaultFormatter": "ms-python.black-formatter" }, - "clangd.path": "@UFBT_TOOLCHAIN_CLANGD@", + // "clangd.path": "@UFBT_TOOLCHAIN_CLANGD@", "clangd.arguments": [ "--query-driver=**/arm-none-eabi-*", "--compile-commands-dir=${workspaceFolder}/.vscode", From 79d82da9b27839c42c71a2c00e495e67ff097870 Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 16 Jul 2024 17:51:28 +0300 Subject: [PATCH 5/5] Disabled ISR runtime stats collection for updater builds (#3791) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * furi: disabled runtime stats collection for updater builds * added comment for potential space saving optimization Co-authored-by: あく --- targets/f7/furi_hal/furi_hal_interrupt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/targets/f7/furi_hal/furi_hal_interrupt.c b/targets/f7/furi_hal/furi_hal_interrupt.c index 6e14e09c8..35c40c259 100644 --- a/targets/f7/furi_hal/furi_hal_interrupt.c +++ b/targets/f7/furi_hal/furi_hal_interrupt.c @@ -13,10 +13,15 @@ #define FURI_HAL_INTERRUPT_DEFAULT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 5) +#ifdef FURI_RAM_EXEC +#define FURI_HAL_INTERRUPT_ACCOUNT_START() +#define FURI_HAL_INTERRUPT_ACCOUNT_END() +#else #define FURI_HAL_INTERRUPT_ACCOUNT_START() const uint32_t _isr_start = DWT->CYCCNT; #define FURI_HAL_INTERRUPT_ACCOUNT_END() \ const uint32_t _time_in_isr = DWT->CYCCNT - _isr_start; \ furi_hal_interrupt.counter_time_in_isr_total += _time_in_isr; +#endif typedef struct { FuriHalInterruptISR isr; @@ -372,6 +377,7 @@ void LPUART1_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdLpUart1); } +// Potential space-saver for updater build const char* furi_hal_interrupt_get_name(uint8_t exception_number) { int32_t id = (int32_t)exception_number - 16;