diff --git a/CHANGELOG.md b/CHANGELOG.md index 4645d3755..758dd18ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### Added: - UL: Sub-GHz: Add keeloq ironlogic aka il100 smart clone cloners support (by @xMasterX & Vitaly) +- UL: iButton: Add TM01x Dallas write support (by @Leptopt1los) +- UL: Display: Backlight option "Always ON" (by @Dmitry422) ### Updated: - Apps: @@ -11,6 +13,10 @@ - Seos Compatible: Add support for reading Seader files that have SIO, Add custom zero key ADF OID (by @bettse) - UL: Sub-GHz Playlist: Add support for custom modulation presets (by @xMasterX) - OFW: Infrared: Add text scroll to remote buttons (by @956MB) +- Sub-GHz: + - UL: Rename and extend Alarms ignore option with Hollarm & GangQi (by @xMasterX) + - UL: Add 462.750 MHz to default subghz freqs list (by @xMasterX) + - UL: V2 Phoenix show counter value (by @xMasterX) ### Fixed: - CLI: 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/applications/main/subghz/scenes/subghz_scene_receiver_config.c b/applications/main/subghz/scenes/subghz_scene_receiver_config.c index e5e7c1d05..b444d1581 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver_config.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver_config.c @@ -15,7 +15,7 @@ enum SubGhzSettingIndex { SubGhzSettingIndexDeleteOldSignals, SubGhzSettingIndexAutosave, SubGhzSettingIndexIgnoreStarline, - SubGhzSettingIndexIgnoreCars, + SubGhzSettingIndexIgnoreAlarms, SubGhzSettingIndexIgnoreMagellan, SubGhzSettingIndexIgnorePrinceton, SubGhzSettingIndexIgnoreNiceFlorS, @@ -416,7 +416,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, SubGhzProtocolFilter_AutoAlarms); + subghz_scene_receiver_config_set_ignore_filter(item, SubGhzProtocolFilter_Alarms); } static void subghz_scene_receiver_config_set_magellan(VariableItem* item) { @@ -618,13 +618,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, SubGhzProtocolFilter_AutoAlarms); + subghz->ignore_filter, SubGhzProtocolFilter_Alarms); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, combobox_text[value_index]); diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c index 2462b32bd..638e4cfbe 100644 --- a/applications/settings/notification_settings/notification_settings_app.c +++ b/applications/settings/notification_settings/notification_settings_app.c @@ -80,8 +80,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", @@ -95,7 +96,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] = { diff --git a/documentation/SubGHzSettings.md b/documentation/SubGHzSettings.md index 5454ede00..e2f3febe7 100644 --- a/documentation/SubGHzSettings.md +++ b/documentation/SubGHzSettings.md @@ -72,6 +72,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/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/lib/subghz/protocols/gangqi.c b/lib/subghz/protocols/gangqi.c index 7c529bfb5..e2f901be6 100644 --- a/lib/subghz/protocols/gangqi.c +++ b/lib/subghz/protocols/gangqi.c @@ -68,6 +68,8 @@ const SubGhzProtocol subghz_protocol_gangqi = { .decoder = &subghz_protocol_gangqi_decoder, .encoder = &subghz_protocol_gangqi_encoder, + + .filter = SubGhzProtocolFilter_Alarms, }; void* subghz_protocol_encoder_gangqi_alloc(SubGhzEnvironment* environment) { diff --git a/lib/subghz/protocols/hollarm.c b/lib/subghz/protocols/hollarm.c index 721421cc0..73cda529d 100644 --- a/lib/subghz/protocols/hollarm.c +++ b/lib/subghz/protocols/hollarm.c @@ -68,6 +68,8 @@ const SubGhzProtocol subghz_protocol_hollarm = { .decoder = &subghz_protocol_hollarm_decoder, .encoder = &subghz_protocol_hollarm_encoder, + + .filter = SubGhzProtocolFilter_Alarms, }; void* subghz_protocol_encoder_hollarm_alloc(SubGhzEnvironment* environment) { diff --git a/lib/subghz/protocols/kia.c b/lib/subghz/protocols/kia.c index 63a6036df..6d8daf2f4 100644 --- a/lib/subghz/protocols/kia.c +++ b/lib/subghz/protocols/kia.c @@ -70,7 +70,7 @@ const SubGhzProtocol subghz_protocol_kia = { .decoder = &subghz_protocol_kia_decoder, .encoder = &subghz_protocol_kia_encoder, - .filter = SubGhzProtocolFilter_AutoAlarms, + .filter = SubGhzProtocolFilter_Alarms, }; void* subghz_protocol_decoder_kia_alloc(SubGhzEnvironment* environment) { diff --git a/lib/subghz/protocols/phoenix_v2.c b/lib/subghz/protocols/phoenix_v2.c index 3ddccfca0..1c32ffbc6 100644 --- a/lib/subghz/protocols/phoenix_v2.c +++ b/lib/subghz/protocols/phoenix_v2.c @@ -321,13 +321,14 @@ 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\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); } diff --git a/lib/subghz/protocols/scher_khan.c b/lib/subghz/protocols/scher_khan.c index 9734e2434..6cd44f2ab 100644 --- a/lib/subghz/protocols/scher_khan.c +++ b/lib/subghz/protocols/scher_khan.c @@ -77,7 +77,7 @@ const SubGhzProtocol subghz_protocol_scher_khan = { .decoder = &subghz_protocol_scher_khan_decoder, .encoder = &subghz_protocol_scher_khan_encoder, - .filter = SubGhzProtocolFilter_AutoAlarms, + .filter = SubGhzProtocolFilter_Alarms, }; void* subghz_protocol_decoder_scher_khan_alloc(SubGhzEnvironment* environment) { diff --git a/lib/subghz/subghz_setting.c b/lib/subghz/subghz_setting.c index 31b538766..dfbb0f62f 100644 --- a/lib/subghz/subghz_setting.c +++ b/lib/subghz/subghz_setting.c @@ -62,6 +62,7 @@ static const uint32_t subghz_frequency_list[] = { 434775000, /* LPD433 last channels */ 438900000, 440175000, + 462750000, 464000000, 467750000, diff --git a/lib/subghz/types.h b/lib/subghz/types.h index 4514afeb5..d14aa45c4 100644 --- a/lib/subghz/types.h +++ b/lib/subghz/types.h @@ -138,7 +138,7 @@ typedef enum { typedef enum { SubGhzProtocolFilter_StarLine = (1 << 0), - SubGhzProtocolFilter_AutoAlarms = (1 << 1), + SubGhzProtocolFilter_Alarms = (1 << 1), SubGhzProtocolFilter_Magellan = (1 << 2), SubGhzProtocolFilter_Princeton = (1 << 3), SubGhzProtocolFilter_NiceFlorS = (1 << 4), diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index 3128fd412..7464daa75 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -2283,6 +2283,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 a153a1efd..030d3b8a7 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -2995,6 +2995,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"