From c5d077fc7a73893d67958c984483347e2d0b0741 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 11 May 2025 19:38:34 +0300 Subject: [PATCH 01/16] various fixes by WillyJL --- .../main/bad_usb/helpers/ducky_script.c | 4 +--- applications/main/nfc/nfc_cli.c | 19 ++----------------- lib/toolbox/cli/cli_registry.c | 4 ++-- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/applications/main/bad_usb/helpers/ducky_script.c b/applications/main/bad_usb/helpers/ducky_script.c index a64629af2..43621de78 100644 --- a/applications/main/bad_usb/helpers/ducky_script.c +++ b/applications/main/bad_usb/helpers/ducky_script.c @@ -213,9 +213,7 @@ static int32_t ducky_parse_line(BadUsbScript* bad_usb, FuriString* line) { // Main key char next_char = *line_cstr; - uint16_t main_key = ducky_get_keycode_by_name(line_cstr); - if(!main_key && next_char) main_key = BADUSB_ASCII_TO_KEY(bad_usb, next_char); - key = modifiers | main_key; + key = modifiers | ducky_get_keycode(bad_usb, line_cstr, true); if(key == 0 && next_char) ducky_error(bad_usb, "No keycode defined for %s", line_cstr); diff --git a/applications/main/nfc/nfc_cli.c b/applications/main/nfc/nfc_cli.c index 5b54d38db..2b4cdf6d3 100644 --- a/applications/main/nfc/nfc_cli.c +++ b/applications/main/nfc/nfc_cli.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -15,13 +14,12 @@ #define FLAG_EVENT (1 << 10) #define NFC_MAX_BUFFER_SIZE (256) -#define NFC_BASE_PROTOCOL_MAX (3) +#define NFC_BASE_PROTOCOL_MAX (2) #define POLLER_DONE (1 << 0) #define POLLER_ERR (1 << 1) static NfcProtocol BASE_PROTOCOL[NFC_BASE_PROTOCOL_MAX] = { NfcProtocolIso14443_4a, - NfcProtocolIso14443_4b, - NfcProtocolIso15693_3}; + NfcProtocolIso14443_4b}; typedef struct ApduContext { BitBuffer* tx_buffer; BitBuffer* rx_buffer; @@ -88,19 +86,6 @@ static NfcCommand trx_callback(NfcGenericEvent event, void* context) { furi_thread_flags_set(apdu_context->thread_id, POLLER_ERR); return NfcCommandStop; } - } else if(NfcProtocolIso15693_3 == event.protocol) { - Iso15693_3Error err = iso15693_3_poller_send_frame( - event.instance, - apdu_context->tx_buffer, - apdu_context->rx_buffer, - ISO15693_3_FDT_POLL_FC); - if(Iso15693_3ErrorNone == err) { - furi_thread_flags_set(apdu_context->thread_id, POLLER_DONE); - return NfcCommandContinue; - } else { - furi_thread_flags_set(apdu_context->thread_id, POLLER_ERR); - return NfcCommandStop; - } } else { // should never reach here furi_crash("Unknown protocol"); diff --git a/lib/toolbox/cli/cli_registry.c b/lib/toolbox/cli/cli_registry.c index 91f7c4046..45661ee90 100644 --- a/lib/toolbox/cli/cli_registry.c +++ b/lib/toolbox/cli/cli_registry.c @@ -136,9 +136,9 @@ void cli_registry_reload_external_commands( FURI_LOG_T(TAG, "Plugin: %s", plugin_filename); furi_string_set_str(plugin_name, plugin_filename); - furi_check(furi_string_end_with_str(plugin_name, ".fal")); + if(!furi_string_end_with_str(plugin_name, ".fal")) continue; furi_string_replace_all_str(plugin_name, ".fal", ""); - furi_check(furi_string_start_with_str(plugin_name, config->fal_prefix)); + if(!furi_string_start_with_str(plugin_name, config->fal_prefix)) continue; furi_string_replace_at(plugin_name, 0, strlen(config->fal_prefix), ""); CliRegistryCommand command = { From 604141cac3d67e7b18c0409749dbdf90fa10d9cd Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 11 May 2025 19:44:29 +0300 Subject: [PATCH 02/16] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd2192f53..201cd4d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ * OFW PR 4212: Remove stupid "!" that broke subghz chat cli (by @GameLord2011) * Apps: **Check out more Apps updates and fixes by following** [this link](https://github.com/xMasterX/all-the-plugins/commits/dev) ## Other changes +* CLI: Various fixes (by @WillyJL) +* BadUSB: Fix key combos main keys being case sensitive (by @WillyJL) * System: log level none after update * Docs: Some updates on subghz remotes programming

From 78e2adbf5c9123cd2c7ffe96fe23d96a4bad6ea3 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 12 May 2025 01:06:13 +0300 Subject: [PATCH 03/16] fix desktop anim switch override by favourites --- applications/services/desktop/views/desktop_view_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index 9ea144364..73210a5af 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -73,8 +73,9 @@ bool desktop_main_input_callback(InputEvent* event, void* context) { } else if(event->key == InputKeyOk) { if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context); + } else { + main_view->callback(DesktopMainEventOpenFavoriteOkLong, main_view->context); } - main_view->callback(DesktopMainEventOpenFavoriteOkLong, main_view->context); } } } else { From 02bc2f0ce79d3786b1ed860a2818c6927ac184be Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 12 May 2025 01:06:44 +0300 Subject: [PATCH 04/16] upd changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 201cd4d6d..e1aa07dc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * OFW PR 4212: Remove stupid "!" that broke subghz chat cli (by @GameLord2011) * Apps: **Check out more Apps updates and fixes by following** [this link](https://github.com/xMasterX/all-the-plugins/commits/dev) ## Other changes +* Desktop: DEBUG - fix desktop anim switch override by favourite apps * CLI: Various fixes (by @WillyJL) * BadUSB: Fix key combos main keys being case sensitive (by @WillyJL) * System: log level none after update From e108405fe42d2fe343ddc00cc8d897e6fc5bb20d Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Wed, 14 May 2025 01:55:18 +0300 Subject: [PATCH 05/16] add 462750000 to default subghz freqs --- .../main/subghz/helpers/subghz_frequency_analyzer_worker.c | 3 ++- documentation/SubGHzSettings.md | 1 + lib/subghz/subghz_setting.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/applications/main/subghz/helpers/subghz_frequency_analyzer_worker.c b/applications/main/subghz/helpers/subghz_frequency_analyzer_worker.c index 81b785ab9..40660b5fe 100644 --- a/applications/main/subghz/helpers/subghz_frequency_analyzer_worker.c +++ b/applications/main/subghz/helpers/subghz_frequency_analyzer_worker.c @@ -118,7 +118,8 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) { for(size_t i = 0; i < subghz_setting_get_frequency_count(instance->setting); i++) { uint32_t current_frequency = subghz_setting_get_frequency(instance->setting, i); if(furi_hal_subghz_is_frequency_valid(current_frequency) && - (((current_frequency != 467750000) && (current_frequency != 464000000)) && + (((current_frequency != 462750000) && (current_frequency != 467750000) && + (current_frequency != 464000000)) && (current_frequency <= 920000000))) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_switch_to_idle(&furi_hal_spi_bus_handle_subghz); diff --git a/documentation/SubGHzSettings.md b/documentation/SubGHzSettings.md index a93618778..95e19bdbf 100644 --- a/documentation/SubGHzSettings.md +++ b/documentation/SubGHzSettings.md @@ -60,6 +60,7 @@ if you need your custom one, make sure it doesn't listed here 434775000, /* LPD433 last channels */ 438900000, 440175000, + 462750000, 464000000, 467750000, diff --git a/lib/subghz/subghz_setting.c b/lib/subghz/subghz_setting.c index ab8c77910..8f41f576c 100644 --- a/lib/subghz/subghz_setting.c +++ b/lib/subghz/subghz_setting.c @@ -66,6 +66,7 @@ static const uint32_t subghz_frequency_list[] = { 434775000, /* LPD433 last channels */ 438900000, 440175000, + 462750000, 464000000, 467750000, From 069d0435b1a709d098621bc0331094f10f68e54b Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Wed, 14 May 2025 01:55:55 +0300 Subject: [PATCH 06/16] upd changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1aa07dc3..0a294a927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Current API: 86.0 * SubGHz: Add keeloq ironlogic (aka il100) smart clone cloners support (thanks to Vitaly for RAWs) * SubGHz: Fix CAME 24bit decoder +* SubGHz: Add 462.750 MHz to default subghz freqs list * SubGHz: Tune holtek ht12x to decode holtek only and not conflict with came 12bit * SubGHz: Fix Rename scene bug, that was replacing file name with random name when Rename is opened then closed then opened again * NFC: Ultralight C - Attempt of authentication with default key (PR #898 | by @mishamyte) From e538bd7c8e6d6f245f4f1cbfdfcb41fb0a3715e7 Mon Sep 17 00:00:00 2001 From: Methodius Date: Wed, 14 May 2025 16:32:17 +0300 Subject: [PATCH 07/16] tm01x dallas write support --- lib/ibutton/protocols/blanks/rw1990.c | 4 ++ lib/ibutton/protocols/blanks/tm01x.c | 58 +++++++++++++++++++ lib/ibutton/protocols/blanks/tm01x.h | 7 +++ lib/ibutton/protocols/blanks/tm2004.c | 2 + .../protocols/dallas/protocol_ds1990.c | 5 +- lib/one_wire/one_wire_host.c | 46 +++++++++++---- lib/one_wire/one_wire_host.h | 4 ++ targets/f18/api_symbols.csv | 4 +- targets/f7/api_symbols.csv | 4 +- 9 files changed, 120 insertions(+), 14 deletions(-) create mode 100644 lib/ibutton/protocols/blanks/tm01x.c create mode 100644 lib/ibutton/protocols/blanks/tm01x.h diff --git a/lib/ibutton/protocols/blanks/rw1990.c b/lib/ibutton/protocols/blanks/rw1990.c index d8017ca83..6edb4777c 100644 --- a/lib/ibutton/protocols/blanks/rw1990.c +++ b/lib/ibutton/protocols/blanks/rw1990.c @@ -38,6 +38,8 @@ static bool rw1990_read_and_compare(OneWireHost* host, const uint8_t* data, size } bool rw1990_write_v1(OneWireHost* host, const uint8_t* data, size_t data_size) { + onewire_host_set_timings_default(host); + // Unlock sequence onewire_host_reset(host); onewire_host_write(host, RW1990_1_CMD_WRITE_RECORD_FLAG); @@ -67,6 +69,8 @@ bool rw1990_write_v1(OneWireHost* host, const uint8_t* data, size_t data_size) { } bool rw1990_write_v2(OneWireHost* host, const uint8_t* data, size_t data_size) { + onewire_host_set_timings_default(host); + // Unlock sequence onewire_host_reset(host); onewire_host_write(host, RW1990_2_CMD_WRITE_RECORD_FLAG); diff --git a/lib/ibutton/protocols/blanks/tm01x.c b/lib/ibutton/protocols/blanks/tm01x.c new file mode 100644 index 000000000..6bdcb43d0 --- /dev/null +++ b/lib/ibutton/protocols/blanks/tm01x.c @@ -0,0 +1,58 @@ +#include +#include +#include +#include "tm01x.h" + +// Commands for TM01x +#define TM01X_CMD_WRITE_FLAG 0xC1 +#define TM01X_CMD_WRITE_ROM 0xC5 +#define TM01X_CMD_READ_ROM 0x33 + +#define TM01X_CMD_FINALIZE_CYFRAL 0xCA +#define TM01X_CMD_FINALIZE_METAKOM 0xCB + +static void tm01x_write_byte(OneWireHost* host, uint8_t value) { + for(uint8_t bitMask = 0x01; bitMask; bitMask <<= 1) { + onewire_host_write_bit(host, (bool)(bitMask & value)); + furi_delay_us(5000); // 5ms pause after each bit + } +} + +// Helper function to read and verify written data +static bool tm01x_read_and_verify(OneWireHost* host, const uint8_t* data, size_t data_size) { + bool success = false; + + if(onewire_host_reset(host)) { + success = true; + onewire_host_write(host, TM01X_CMD_READ_ROM); + + for(size_t i = 0; i < data_size; ++i) { + if(data[i] != onewire_host_read(host)) { + success = false; + break; + } + } + } + + return success; +} + +bool tm01x_write_dallas(OneWireHost* host, const uint8_t* data, size_t data_size) { + // Set TM01x specific timings + onewire_host_set_timings_tm01x(host); + + // Write sequence + onewire_host_reset(host); + onewire_host_write(host, TM01X_CMD_WRITE_FLAG); + onewire_host_write_bit(host, true); + furi_delay_us(5000); + + onewire_host_reset(host); + onewire_host_write(host, TM01X_CMD_WRITE_ROM); + + for(size_t i = 0; i < data_size; ++i) { + tm01x_write_byte(host, data[i]); + } + + return tm01x_read_and_verify(host, data, data_size); +} diff --git a/lib/ibutton/protocols/blanks/tm01x.h b/lib/ibutton/protocols/blanks/tm01x.h new file mode 100644 index 000000000..1d66e215b --- /dev/null +++ b/lib/ibutton/protocols/blanks/tm01x.h @@ -0,0 +1,7 @@ +#pragma once + +#include +#include + +// Function to write Dallas protocol to TM01x +bool tm01x_write_dallas(OneWireHost* host, const uint8_t* data, size_t data_size); diff --git a/lib/ibutton/protocols/blanks/tm2004.c b/lib/ibutton/protocols/blanks/tm2004.c index a275dda0a..a93b69410 100644 --- a/lib/ibutton/protocols/blanks/tm2004.c +++ b/lib/ibutton/protocols/blanks/tm2004.c @@ -9,6 +9,8 @@ #define TM2004_ANSWER_READ_MEMORY 0xF5 bool tm2004_write(OneWireHost* host, const uint8_t* data, size_t data_size) { + onewire_host_set_timings_default(host); + onewire_host_reset(host); onewire_host_write(host, TM2004_CMD_WRITE_ROM); // Starting writing from address 0x0000 diff --git a/lib/ibutton/protocols/dallas/protocol_ds1990.c b/lib/ibutton/protocols/dallas/protocol_ds1990.c index 5ed2171c6..44fd60192 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1990.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1990.c @@ -7,7 +7,7 @@ #include "../blanks/rw1990.h" #include "../blanks/tm2004.h" - +#include "../blanks/tm01x.h" #define DS1990_FAMILY_CODE 0x01U #define DS1990_FAMILY_NAME "DS1990" @@ -66,7 +66,8 @@ bool dallas_ds1990_write_id(OneWireHost* host, iButtonProtocolData* protocol_dat return rw1990_write_v1(host, data->rom_data.bytes, sizeof(DallasCommonRomData)) || rw1990_write_v2(host, data->rom_data.bytes, sizeof(DallasCommonRomData)) || - tm2004_write(host, data->rom_data.bytes, sizeof(DallasCommonRomData)); + tm2004_write(host, data->rom_data.bytes, sizeof(DallasCommonRomData)) || + tm01x_write_dallas(host, data->rom_data.bytes, sizeof(DallasCommonRomData)); } static bool dallas_ds1990_reset_callback(bool is_short, void* context) { diff --git a/lib/one_wire/one_wire_host.c b/lib/one_wire/one_wire_host.c index f3f3d953e..62d325cf5 100644 --- a/lib/one_wire/one_wire_host.c +++ b/lib/one_wire/one_wire_host.c @@ -8,16 +8,16 @@ #include "one_wire_host.h" typedef struct { - uint16_t a; - uint16_t b; - uint16_t c; - uint16_t d; - uint16_t e; - uint16_t f; - uint16_t g; - uint16_t h; - uint16_t i; - uint16_t j; + uint16_t a; // Write 1 low time + uint16_t b; // Write 1 high time + uint16_t c; // Write 0 low time + uint16_t d; // Write 0 high time + uint16_t e; // Read low time + uint16_t f; // Read high time + uint16_t g; // Reset pre-delay + uint16_t h; // Reset pulse + uint16_t i; // Presence detect + uint16_t j; // Reset post-delay } OneWireHostTimings; static const OneWireHostTimings onewire_host_timings_normal = { @@ -46,6 +46,20 @@ static const OneWireHostTimings onewire_host_timings_overdrive = { .j = 40, }; +// TM01x specific timings +static const OneWireHostTimings onewire_host_timings_tm01x = { + .a = 5, + .b = 80, + .c = 70, + .d = 10, + .e = 5, + .f = 70, + .g = 0, + .h = 740, + .i = 140, + .j = 410, +}; + struct OneWireHost { const GpioPin* gpio_pin; const OneWireHostTimings* timings; @@ -354,3 +368,15 @@ void onewire_host_set_overdrive(OneWireHost* host, bool set) { host->timings = set ? &onewire_host_timings_overdrive : &onewire_host_timings_normal; } + +void onewire_host_set_timings_default(OneWireHost* host) { + furi_check(host); + + host->timings = &onewire_host_timings_normal; +} + +void onewire_host_set_timings_tm01x(OneWireHost* host) { + furi_check(host); + + host->timings = &onewire_host_timings_tm01x; +} diff --git a/lib/one_wire/one_wire_host.h b/lib/one_wire/one_wire_host.h index 9f9bd4ffd..e61dc63e2 100644 --- a/lib/one_wire/one_wire_host.h +++ b/lib/one_wire/one_wire_host.h @@ -125,6 +125,10 @@ bool onewire_host_search(OneWireHost* host, uint8_t* new_addr, OneWireHostSearch */ void onewire_host_set_overdrive(OneWireHost* host, bool set); +void onewire_host_set_timings_default(OneWireHost* host); + +void onewire_host_set_timings_tm01x(OneWireHost* host); + #ifdef __cplusplus } #endif diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index 23c9edb63..634ab079e 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,86.0,, +Version,+,86.1,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/bt/bt_service/bt_keys_storage.h,, Header,+,applications/services/cli/cli.h,, @@ -2281,6 +2281,8 @@ Function,+,onewire_host_reset,_Bool,OneWireHost* Function,+,onewire_host_reset_search,void,OneWireHost* Function,+,onewire_host_search,_Bool,"OneWireHost*, uint8_t*, OneWireHostSearchMode" Function,+,onewire_host_set_overdrive,void,"OneWireHost*, _Bool" +Function,+,onewire_host_set_timings_default,void,OneWireHost* +Function,+,onewire_host_set_timings_tm01x,void,OneWireHost* Function,+,onewire_host_start,void,OneWireHost* Function,+,onewire_host_stop,void,OneWireHost* Function,+,onewire_host_target_search,void,"OneWireHost*, uint8_t" diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index d142a6374..17e4fd37e 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,86.0,, +Version,+,86.1,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/bt/bt_service/bt_keys_storage.h,, @@ -2919,6 +2919,8 @@ Function,+,onewire_host_reset,_Bool,OneWireHost* Function,+,onewire_host_reset_search,void,OneWireHost* Function,+,onewire_host_search,_Bool,"OneWireHost*, uint8_t*, OneWireHostSearchMode" Function,+,onewire_host_set_overdrive,void,"OneWireHost*, _Bool" +Function,+,onewire_host_set_timings_default,void,OneWireHost* +Function,+,onewire_host_set_timings_tm01x,void,OneWireHost* Function,+,onewire_host_start,void,OneWireHost* Function,+,onewire_host_stop,void,OneWireHost* Function,+,onewire_host_target_search,void,"OneWireHost*, uint8_t" From fdab87795fdab40bb1a012d1aa8c258873c75c31 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Wed, 14 May 2025 18:37:22 +0300 Subject: [PATCH 08/16] upd changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a294a927..cfc073b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Main changes - Current API: 86.0 +* iButton: TM01x Dallas write support (PR #899 | by @Leptopt1los) * SubGHz: Add keeloq ironlogic (aka il100) smart clone cloners support (thanks to Vitaly for RAWs) * SubGHz: Fix CAME 24bit decoder * SubGHz: Add 462.750 MHz to default subghz freqs list From 5471b211d2a8691e7871875d0acada6f4c4b9e81 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 16 May 2025 17:48:35 +0300 Subject: [PATCH 09/16] Infrared: Add text scroll to remote buttons OFW PR 4210 by 956MB https://github.com/flipperdevices/flipperzero-firmware/pull/4210/files --- .../services/gui/modules/button_menu.c | 116 +++++++++++++----- 1 file changed, 88 insertions(+), 28 deletions(-) diff --git a/applications/services/gui/modules/button_menu.c b/applications/services/gui/modules/button_menu.c index d9c178dd2..5204c6f22 100644 --- a/applications/services/gui/modules/button_menu.c +++ b/applications/services/gui/modules/button_menu.c @@ -10,6 +10,7 @@ #include #include +#define SCROLL_INTERVAL (333) #define ITEM_FIRST_OFFSET 17 #define ITEM_NEXT_OFFSET 4 #define ITEM_HEIGHT 14 @@ -35,13 +36,56 @@ typedef struct { ButtonMenuItemArray_t items; size_t position; const char* header; + size_t scroll_counter; + FuriTimer* scroll_timer; } ButtonMenuModel; +static void button_menu_draw_text( + Canvas* canvas, + uint8_t item_x, + uint8_t item_y, + const char* text, + bool selected, + ButtonMenuModel* model) { + FuriString* disp_str; + disp_str = furi_string_alloc_set(text); + bool draw_static = true; + + if(selected) { + size_t text_width = canvas_string_width(canvas, furi_string_get_cstr(disp_str)); + if(text_width >= ITEM_WIDTH - 8) { + elements_scrollable_text_line( + canvas, + item_x + 4, + item_y + ITEM_HEIGHT - 4, + ITEM_WIDTH - 8, + disp_str, + model->scroll_counter, + false); + draw_static = false; + } + } + + if(draw_static) { + elements_string_fit_width(canvas, disp_str, ITEM_WIDTH - 6); + canvas_draw_str_aligned( + canvas, + item_x + (ITEM_WIDTH / 2), + item_y + (ITEM_HEIGHT / 2), + AlignCenter, + AlignCenter, + furi_string_get_cstr(disp_str)); + } + + furi_string_free(disp_str); +} + static void button_menu_draw_control_button( Canvas* canvas, uint8_t item_position, const char* text, - bool selected) { + bool selected, + ButtonMenuModel* model) { furi_assert(canvas); furi_assert(text); @@ -54,20 +98,16 @@ static void button_menu_draw_control_button( elements_slightly_rounded_box(canvas, item_x, item_y, ITEM_WIDTH, ITEM_HEIGHT); canvas_set_color(canvas, ColorWhite); } - canvas_draw_str_aligned( - canvas, - item_x + (ITEM_WIDTH / 2), - item_y + (ITEM_HEIGHT / 2), - AlignCenter, - AlignCenter, - text); + + button_menu_draw_text(canvas, item_x, item_y, text, selected, model); } static void button_menu_draw_common_button( Canvas* canvas, uint8_t item_position, const char* text, - bool selected) { + bool selected, + ButtonMenuModel* model) { furi_assert(canvas); furi_assert(text); @@ -83,19 +123,7 @@ static void button_menu_draw_common_button( canvas_draw_rframe(canvas, item_x, item_y, ITEM_WIDTH, ITEM_HEIGHT, 5); } - FuriString* disp_str; - disp_str = furi_string_alloc_set(text); - elements_string_fit_width(canvas, disp_str, ITEM_WIDTH - 6); - - canvas_draw_str_aligned( - canvas, - item_x + (ITEM_WIDTH / 2), - item_y + (ITEM_HEIGHT / 2), - AlignCenter, - AlignCenter, - furi_string_get_cstr(disp_str)); - - furi_string_free(disp_str); + button_menu_draw_text(canvas, item_x, item_y, text, selected, model); } static void button_menu_view_draw_callback(Canvas* canvas, void* _model) { @@ -120,9 +148,17 @@ static void button_menu_view_draw_callback(Canvas* canvas, void* _model) { if(model->header) { FuriString* disp_str; disp_str = furi_string_alloc_set(model->header); - elements_string_fit_width(canvas, disp_str, ITEM_WIDTH - 6); - canvas_draw_str_aligned( - canvas, 32, 10, AlignCenter, AlignCenter, furi_string_get_cstr(disp_str)); + size_t header_width = canvas_string_width(canvas, furi_string_get_cstr(disp_str)); + + if(header_width >= ITEM_WIDTH - 8) { + elements_scrollable_text_line( + canvas, 3, 13, ITEM_WIDTH - 8, disp_str, model->scroll_counter, false); + } else { + elements_string_fit_width(canvas, disp_str, ITEM_WIDTH - 8); + canvas_draw_str_aligned( + canvas, 32, 10, AlignCenter, AlignCenter, furi_string_get_cstr(disp_str)); + } + furi_string_free(disp_str); } @@ -137,13 +173,15 @@ static void button_menu_view_draw_callback(Canvas* canvas, void* _model) { canvas, item_position % BUTTONS_PER_SCREEN, ButtonMenuItemArray_cref(it)->label, - (item_position == model->position)); + (item_position == model->position), + model); } else if(ButtonMenuItemArray_cref(it)->type == ButtonMenuItemTypeCommon) { button_menu_draw_common_button( canvas, item_position % BUTTONS_PER_SCREEN, ButtonMenuItemArray_cref(it)->label, - (item_position == model->position)); + (item_position == model->position), + model); } } } @@ -158,8 +196,10 @@ static void button_menu_process_up(ButtonMenu* button_menu) { { if(model->position > 0) { model->position--; + model->scroll_counter = 0; } else { model->position = ButtonMenuItemArray_size(model->items) - 1; + model->scroll_counter = 0; } }, true); @@ -174,8 +214,10 @@ static void button_menu_process_down(ButtonMenu* button_menu) { { if(model->position < (ButtonMenuItemArray_size(model->items) - 1)) { model->position++; + model->scroll_counter = 0; } else { model->position = 0; + model->scroll_counter = 0; } }, true); @@ -193,8 +235,10 @@ static void button_menu_process_right(ButtonMenu* button_menu) { position_candidate -= position_candidate % BUTTONS_PER_SCREEN; if(position_candidate < (ButtonMenuItemArray_size(model->items))) { model->position = position_candidate; + model->scroll_counter = 0; } else { model->position = 0; + model->scroll_counter = 0; } } }, @@ -217,6 +261,7 @@ static void button_menu_process_left(ButtonMenu* button_menu) { }; position_candidate -= position_candidate % BUTTONS_PER_SCREEN; model->position = position_candidate; + model->scroll_counter = 0; } }, true); @@ -314,6 +359,7 @@ void button_menu_reset(ButtonMenu* button_menu) { ButtonMenuItemArray_reset(model->items); model->position = 0; model->header = NULL; + model->scroll_counter = 0; }, true); } @@ -351,6 +397,12 @@ ButtonMenuItem* button_menu_add_item( return item; } +static void button_menu_process_timer_callback(void* context) { + ButtonMenu* button_menu = context; + with_view_model( + button_menu->view, ButtonMenuModel * model, { model->scroll_counter++; }, true); +} + ButtonMenu* button_menu_alloc(void) { ButtonMenu* button_menu = malloc(sizeof(ButtonMenu)); button_menu->view = view_alloc(); @@ -367,6 +419,10 @@ ButtonMenu* button_menu_alloc(void) { ButtonMenuItemArray_init(model->items); model->position = 0; model->header = NULL; + model->scroll_counter = 0; + model->scroll_timer = furi_timer_alloc( + button_menu_process_timer_callback, FuriTimerTypePeriodic, button_menu); + furi_timer_start(model->scroll_timer, SCROLL_INTERVAL); }, true); @@ -380,7 +436,11 @@ void button_menu_free(ButtonMenu* button_menu) { with_view_model( button_menu->view, ButtonMenuModel * model, - { ButtonMenuItemArray_clear(model->items); }, + { + ButtonMenuItemArray_clear(model->items); + furi_timer_stop(model->scroll_timer); + furi_timer_free(model->scroll_timer); + }, true); view_free(button_menu->view); free(button_menu); From 04d66f71622fab522dddcec16810cb72f781ed5a Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 16 May 2025 17:50:24 +0300 Subject: [PATCH 10/16] upd changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfc073b9d..398f242ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * SubGHz: Tune holtek ht12x to decode holtek only and not conflict with came 12bit * SubGHz: Fix Rename scene bug, that was replacing file name with random name when Rename is opened then closed then opened again * NFC: Ultralight C - Attempt of authentication with default key (PR #898 | by @mishamyte) +* OFW PR 4210: Infrared: Add text scroll to remote buttons (by @956MB) * OFW PR 4205: fix sample durations when using external CC1101 (by @Aerosnail) * OFW PR 4206: Stop JS PWM on exit (by @portasynthinca3) * OFW PR 4212: Remove stupid "!" that broke subghz chat cli (by @GameLord2011) From ee3e7bc3bf4ef14898fb48c87cb5e80c7c9ccb5a Mon Sep 17 00:00:00 2001 From: Dmitry422 Date: Mon, 19 May 2025 00:37:28 +0700 Subject: [PATCH 11/16] RGB vibro control tune + Display backlight always ON option. --- applications/services/notification/notification_app.c | 5 ++++- .../notification_settings/notification_settings_app.c | 10 ++++++++-- lib/drivers/SK6805.c | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index ef9677f31..c82f53afd 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -377,7 +377,10 @@ static void notification_reset_notification_layer( app->settings.display_brightness * 0xFF * app->current_night_shift * 1.0f); // --- NIGHT SHIFT END--- } - furi_timer_start(app->display_timer, notification_settings_display_off_delay_ticks(app)); + if(app->settings.display_off_delay_ms > 0) { + furi_timer_start( + app->display_timer, notification_settings_display_off_delay_ticks(app)); + } } } diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c index 3713d7e26..e9ccc90f6 100644 --- a/applications/settings/notification_settings/notification_settings_app.c +++ b/applications/settings/notification_settings/notification_settings_app.c @@ -84,8 +84,9 @@ const float volume_value[VOLUME_COUNT] = { 0.55f, 0.60f, 0.65f, 0.70f, 0.75f, 0.80f, 0.85f, 0.90f, 0.95f, 1.00f, }; -#define DELAY_COUNT 11 +#define DELAY_COUNT 12 const char* const delay_text[DELAY_COUNT] = { + "Always ON", "1s", "5s", "10s", @@ -99,7 +100,7 @@ const char* const delay_text[DELAY_COUNT] = { "30min", }; const uint32_t delay_value[DELAY_COUNT] = - {1000, 5000, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000, 1800000}; + {0, 1000, 5000, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000, 1800000}; #define VIBRO_COUNT 2 const char* const vibro_text[VIBRO_COUNT] = { @@ -303,6 +304,11 @@ static void screen_changed(VariableItem* item) { variable_item_set_current_value_text(item, delay_text[index]); app->notification->settings.display_off_delay_ms = delay_value[index]; + + // Switch off current backlight delay timer if user choose "Always ON" + if((delay_value[index] == 0) & (furi_timer_is_running(app->notification->display_timer))) { + furi_timer_stop(app->notification->display_timer); + } notification_message(app->notification, &sequence_display_backlight_on); } diff --git a/lib/drivers/SK6805.c b/lib/drivers/SK6805.c index 2ad8e18d3..43130b777 100644 --- a/lib/drivers/SK6805.c +++ b/lib/drivers/SK6805.c @@ -58,7 +58,7 @@ void SK6805_set_led_color(uint8_t led_index, uint8_t r, uint8_t g, uint8_t b) { void SK6805_update(void) { SK6805_init(); FURI_CRITICAL_ENTER(); - furi_delay_us(100); + furi_delay_us(150); uint32_t end; /* Последовательная отправка цветов светодиодов */ for(uint8_t lednumber = 0; lednumber < SK6805_LED_COUNT; lednumber++) { From 08205f9ff9b036548f90bda9bb4de7ac308ad417 Mon Sep 17 00:00:00 2001 From: Dmitry422 Date: Mon, 19 May 2025 23:43:40 +0700 Subject: [PATCH 12/16] RGB backlight bug removed. --- 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 c82f53afd..c0ab417b3 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -231,7 +231,7 @@ static void rainbow_timer_callback(void* context) { break; } - rgb_backlight_update(app->settings.led_brightness * app->current_night_shift); + rgb_backlight_update(app->settings.display_brightness * app->current_night_shift); } } From 82c7231c5795c71460c516931b82c044c8d127a8 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Tue, 20 May 2025 03:04:57 +0300 Subject: [PATCH 13/16] upd changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 398f242ed..dbf2738d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * SubGHz: Add 462.750 MHz to default subghz freqs list * SubGHz: Tune holtek ht12x to decode holtek only and not conflict with came 12bit * SubGHz: Fix Rename scene bug, that was replacing file name with random name when Rename is opened then closed then opened again +* Display: Backlight option "always on" and RGB bug removed (PR #900 | by @Dmitry422) * NFC: Ultralight C - Attempt of authentication with default key (PR #898 | by @mishamyte) * OFW PR 4210: Infrared: Add text scroll to remote buttons (by @956MB) * OFW PR 4205: fix sample durations when using external CC1101 (by @Aerosnail) From b3523424347c3512c6c6539da05b0c2976c3f178 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Wed, 21 May 2025 17:34:37 +0300 Subject: [PATCH 14/16] rename and extend ignore alarms option in subghz --- .../main/subghz/scenes/subghz_scene_receiver_config.c | 8 ++++---- lib/subghz/protocols/gangqi.c | 3 ++- lib/subghz/protocols/hollarm.c | 3 ++- lib/subghz/protocols/kia.c | 2 +- lib/subghz/protocols/scher_khan.c | 2 +- lib/subghz/types.h | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_receiver_config.c b/applications/main/subghz/scenes/subghz_scene_receiver_config.c index f82a45976..e3806eac6 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver_config.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver_config.c @@ -9,7 +9,7 @@ enum SubGhzSettingIndex { SubGhzSettingIndexModulation, SubGhzSettingIndexBinRAW, SubGhzSettingIndexIgnoreStarline, - SubGhzSettingIndexIgnoreCars, + SubGhzSettingIndexIgnoreAlarms, SubGhzSettingIndexIgnoreMagellan, SubGhzSettingIndexIgnorePrinceton, SubGhzSettingIndexIgnoreNiceFlorS, @@ -306,7 +306,7 @@ static void subghz_scene_receiver_config_set_starline(VariableItem* item) { } static void subghz_scene_receiver_config_set_auto_alarms(VariableItem* item) { - subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_AutoAlarms); + subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFlag_Alarms); } static void subghz_scene_receiver_config_set_magellan(VariableItem* item) { @@ -459,13 +459,13 @@ void subghz_scene_receiver_config_on_enter(void* context) { item = variable_item_list_add( subghz->variable_item_list, - "Ignore Cars", + "Ignore Alarms", COMBO_BOX_COUNT, subghz_scene_receiver_config_set_auto_alarms, subghz); value_index = subghz_scene_receiver_config_ignore_filter_get_index( - subghz->ignore_filter, SubGhzProtocolFlag_AutoAlarms); + subghz->ignore_filter, SubGhzProtocolFlag_Alarms); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, combobox_text[value_index]); diff --git a/lib/subghz/protocols/gangqi.c b/lib/subghz/protocols/gangqi.c index 720a4d54a..905c22982 100644 --- a/lib/subghz/protocols/gangqi.c +++ b/lib/subghz/protocols/gangqi.c @@ -62,7 +62,8 @@ const SubGhzProtocol subghz_protocol_gangqi = { .name = SUBGHZ_PROTOCOL_GANGQI_NAME, .type = SubGhzProtocolTypeStatic, .flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | - SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send, + SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send | + SubGhzProtocolFlag_Alarms, .decoder = &subghz_protocol_gangqi_decoder, .encoder = &subghz_protocol_gangqi_encoder, diff --git a/lib/subghz/protocols/hollarm.c b/lib/subghz/protocols/hollarm.c index fc76affa0..a4cb73352 100644 --- a/lib/subghz/protocols/hollarm.c +++ b/lib/subghz/protocols/hollarm.c @@ -62,7 +62,8 @@ const SubGhzProtocol subghz_protocol_hollarm = { .name = SUBGHZ_PROTOCOL_HOLLARM_NAME, .type = SubGhzProtocolTypeStatic, .flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | - SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send, + SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send | + SubGhzProtocolFlag_Alarms, .decoder = &subghz_protocol_hollarm_decoder, .encoder = &subghz_protocol_hollarm_encoder, diff --git a/lib/subghz/protocols/kia.c b/lib/subghz/protocols/kia.c index 6988a0ef2..1edd367c2 100644 --- a/lib/subghz/protocols/kia.c +++ b/lib/subghz/protocols/kia.c @@ -64,7 +64,7 @@ const SubGhzProtocol subghz_protocol_kia = { .name = SUBGHZ_PROTOCOL_KIA_NAME, .type = SubGhzProtocolTypeDynamic, .flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable | - SubGhzProtocolFlag_AutoAlarms, + SubGhzProtocolFlag_Alarms, .decoder = &subghz_protocol_kia_decoder, .encoder = &subghz_protocol_kia_encoder, diff --git a/lib/subghz/protocols/scher_khan.c b/lib/subghz/protocols/scher_khan.c index 53b7935d6..d1aad4ee6 100644 --- a/lib/subghz/protocols/scher_khan.c +++ b/lib/subghz/protocols/scher_khan.c @@ -70,7 +70,7 @@ const SubGhzProtocol subghz_protocol_scher_khan = { .name = SUBGHZ_PROTOCOL_SCHER_KHAN_NAME, .type = SubGhzProtocolTypeDynamic, .flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_FM | SubGhzProtocolFlag_Decodable | - SubGhzProtocolFlag_Save | SubGhzProtocolFlag_AutoAlarms, + SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Alarms, .decoder = &subghz_protocol_scher_khan_decoder, .encoder = &subghz_protocol_scher_khan_encoder, diff --git a/lib/subghz/types.h b/lib/subghz/types.h index b133a62bb..31264a0ad 100644 --- a/lib/subghz/types.h +++ b/lib/subghz/types.h @@ -126,7 +126,7 @@ typedef enum { SubGhzProtocolFlag_Send = (1 << 9), SubGhzProtocolFlag_BinRAW = (1 << 10), SubGhzProtocolFlag_StarLine = (1 << 11), - SubGhzProtocolFlag_AutoAlarms = (1 << 12), + SubGhzProtocolFlag_Alarms = (1 << 12), SubGhzProtocolFlag_Magellan = (1 << 13), SubGhzProtocolFlag_Princeton = (1 << 14), SubGhzProtocolFlag_NiceFlorS = (1 << 15), From 350dea6535441a8dd52871eb5accb7ca508f90cb Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 22 May 2025 01:09:33 +0300 Subject: [PATCH 15/16] show cnt value in phox --- lib/subghz/protocols/phoenix_v2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/subghz/protocols/phoenix_v2.c b/lib/subghz/protocols/phoenix_v2.c index 2fabed73d..770f5dea5 100644 --- a/lib/subghz/protocols/phoenix_v2.c +++ b/lib/subghz/protocols/phoenix_v2.c @@ -321,11 +321,12 @@ void subghz_protocol_decoder_phoenix_v2_get_string(void* context, FuriString* ou "%s %dbit\r\n" "Key:%02lX%08lX\r\n" "Sn:0x%07lX \r\n" - "Btn:%X\r\n", + "Btn:%X Cnt: 0x%04lX\r\n", instance->generic.protocol_name, instance->generic.data_count_bit, (uint32_t)(instance->generic.data >> 32) & 0xFFFFFFFF, (uint32_t)(instance->generic.data & 0xFFFFFFFF), instance->generic.serial, - instance->generic.btn); + instance->generic.btn, + instance->generic.cnt); } From 92ca0cf1a866e0d4bf316e234b4ece21ce91f864 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 22 May 2025 01:14:40 +0300 Subject: [PATCH 16/16] upd changelog --- CHANGELOG.md | 2 ++ lib/subghz/protocols/phoenix_v2.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf2738d2..bd219b010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Main changes - Current API: 86.0 * iButton: TM01x Dallas write support (PR #899 | by @Leptopt1los) +* SubGHz: Rename and extend Alarms ignore option (add Hollarm & GangQi) +* SubGHz: V2 Phoenix show counter value * SubGHz: Add keeloq ironlogic (aka il100) smart clone cloners support (thanks to Vitaly for RAWs) * SubGHz: Fix CAME 24bit decoder * SubGHz: Add 462.750 MHz to default subghz freqs list diff --git a/lib/subghz/protocols/phoenix_v2.c b/lib/subghz/protocols/phoenix_v2.c index 770f5dea5..9e88324c4 100644 --- a/lib/subghz/protocols/phoenix_v2.c +++ b/lib/subghz/protocols/phoenix_v2.c @@ -319,7 +319,7 @@ void subghz_protocol_decoder_phoenix_v2_get_string(void* context, FuriString* ou furi_string_cat_printf( output, "%s %dbit\r\n" - "Key:%02lX%08lX\r\n" + "Key:%05lX%08lX\r\n" "Sn:0x%07lX \r\n" "Btn:%X Cnt: 0x%04lX\r\n", instance->generic.protocol_name,