From 0fd26ee14826247ea77c1ee8ee121952ae6924c7 Mon Sep 17 00:00:00 2001 From: Astra Date: Mon, 2 Dec 2024 19:24:20 +0900 Subject: [PATCH 1/6] Increase system stack's reserved memory size --- targets/f7/stm32wb55xx_flash.ld | 2 +- targets/f7/stm32wb55xx_ram_fw.ld | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/f7/stm32wb55xx_flash.ld b/targets/f7/stm32wb55xx_flash.ld index 524da6fc3..ef61bb238 100644 --- a/targets/f7/stm32wb55xx_flash.ld +++ b/targets/f7/stm32wb55xx_flash.ld @@ -3,7 +3,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _stack_end = 0x20030000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ -_stack_size = 0x200; /* required amount of stack */ +_stack_size = 0x400; /* required amount of stack */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K diff --git a/targets/f7/stm32wb55xx_ram_fw.ld b/targets/f7/stm32wb55xx_ram_fw.ld index f0e8ad678..93579788d 100644 --- a/targets/f7/stm32wb55xx_ram_fw.ld +++ b/targets/f7/stm32wb55xx_ram_fw.ld @@ -3,7 +3,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _stack_end = 0x20030000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ -_stack_size = 0x200; /* required amount of stack */ +_stack_size = 0x400; /* required amount of stack */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K From dd6e0a9b721c09b82a127aadd0a1accba8b18f7c Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:53:09 +0300 Subject: [PATCH 2/6] keeloq jolly motors add full support with add manually thanks @pkooiman ! --- .../main/subghz/helpers/subghz_custom_event.h | 1 + .../resources/subghz/assets/keeloq_mfcodes | 117 +++++++++--------- .../subghz/scenes/subghz_scene_set_type.c | 11 ++ 3 files changed, 71 insertions(+), 58 deletions(-) diff --git a/applications/main/subghz/helpers/subghz_custom_event.h b/applications/main/subghz/helpers/subghz_custom_event.h index e28c018d8..093ca9526 100644 --- a/applications/main/subghz/helpers/subghz_custom_event.h +++ b/applications/main/subghz/helpers/subghz_custom_event.h @@ -82,6 +82,7 @@ typedef enum { SetTypeAllmatic868, SetTypeCenturion433, SetTypeMonarch433, + SetTypeJollyMotors433, SetTypeSommer_FM_434, SetTypeSommer_FM_868, SetTypeSommer_FM238_434, diff --git a/applications/main/subghz/resources/subghz/assets/keeloq_mfcodes b/applications/main/subghz/resources/subghz/assets/keeloq_mfcodes index 23b7a031a..97e1aab47 100644 --- a/applications/main/subghz/resources/subghz/assets/keeloq_mfcodes +++ b/applications/main/subghz/resources/subghz/assets/keeloq_mfcodes @@ -1,61 +1,62 @@ Filetype: Flipper SubGhz Keystore File Version: 0 Encryption: 1 -IV: 46 75 72 72 79 20 63 68 65 63 6B 20 3F 3F 21 21 -3FF98B52C38558ECDB26C3E86D118FAC9AF22EDDDE7649CB53726855CEBCCF9E -06B901C6E36E381B4A83554ED972288977F999C232106D337C3BE4A9A44608F8 -8153E6CAF4B272BA0EA168B9F0F29CF02CEB33E4ABBD4D5C858D1ADBFF474A25 -F61216CE3A7E500E0C9B2173F91C2E7B1BB7D7AA65D4150EAC28169116647DDD -A3ABC262415035A190447EC9C15CFD1AB1720560AB7C82D7447215342305299732776A9A6DEA4D359C52A23BFCE6B015 -5784D0E77A55E1361F47A1F6CFFBFAF715CFCAD2BD502ED266AA86DC47F98541 -E082BF64C75023F23FB333C53F2590F408FD932EB71DF4ED4D0E0EAF2AEBD488 -EFF328889D57D9F4B9111918F9C9BC641645104223009842FFF7B6F73E24E5B7 -BDCD1DBCBCA789C5A5C3623C0A287D791F1CACCBBD7D144E2EF1F92DA5513D90 -6310362BE6ED7CB5E3F4CA84D3093DF620BABD2C9D419A2BA5AA05F241EE7592 -4C6F97C553276D5403103A6BA6C4DBBE017A9E4159E6E5AC4C28ACD645DB1E8D4551CDC228A0457BEEF49179A081E1FD -861ECA071AEEF3854005FEC9BF22C7DB76D07B7930968314FFAC70995E28680E473F8A1A7E56E8776EDD1C6E2DD6DD26 -55ADDFBE97BCB0FB43EDEB9CAFF9F32DD788A6306D3702BC2923DA5C69F5F0A5 -AB838DA2B25547AA43DEB7FB40B15E289B9209057BE564E7CB78F0D5DCFC65FD -21BACE924E522AD0E97F0AAF64A9DB6A5F7BA09B3A1759AAFD4016F3ADD4353D -4B37D449E44BAE7F377EE5CE52E94882E42617417F77ECE9803D9435892167F2 -E63BA93D98BB3EEEAD34B38C5F271FB777AEABD9E6A05597AE09815E578AA811900AE9F144FBEC7DBFDDEC87D1ED368B -7DF24DCB7D73F1638FFD22325463B23C101653EE770F086D323BE90868A7E267 -18E533990C408061309323675116429652B3F4D228F00D704310E7AB26F6BAF4 -26042EC21D73490D9E7F968EDCC4CECF3989E6E982427DEB7012478E214CED8797A9BEBC481C81E9646214809A409B4A -AC4169C26E402720F1E2A0AD690AE2CF708CE203898BC7102178A738C70F361718E794F0D0CB1A2F1938EF35CCA11887 -6962CADB9BD1B86B779DF7F4D7E06E92EB42474C7FD9EA23879F9982D7127357 -23AEC0F6F9FF529DDDCD1CDAA77F7B136CE2CCD3AC8B949954D5D3B2ECFA8CBC -C6A3A849BC4A8DB438065255BD387DCD77AD7E7FEB3B0E11B6D3A43279AB9087 -CCB71F8BDC8B31F36D6141B3B57BF31B7EDF72B87593B7497871F5738A0B7E00 -345FE0FAD3F60C017D9793406981878EA2226072D624208AC33682793B415C41 -78AF1FCFDB780744708DBB547F7C3F095BA5FAFB34FA83BF4323B32829836ED1 -C2F19F077E71E710D39F5F11C1FE55C2A3CD6F33384CD8603288765F266F1BDF -084B1A9565AFC88900D0FF25413E659E17AAB649DB2B7A9F0381CB0DF6D2B8E5 -568CECD994676CF3D6B225DEF21D40787DCB41C101F52B0C5AA43ED66709D158 -0742E0AAB6504AC63A9C59FBDD980BD4C4760EFF3E556C8A6241442CDDD23A74 -37BB60EE11BEC7D25A607DE9B0B6D3EAD23321AFEB94995FAB42184A95D1CADA -42FD71B98A3BEE9CF372B03E158D51181BFAA9CF54F7300A93FE7665402B3D1F -9346B7D12346E264E84F91145EBF86C53DD0061E0FA6556FAE5F6FBB8CEB799E -430B0D7FC09C09051AEB667A370E6D9D9BDF0C0C553AD2791682D43CE5DC48B7 -5BBB5129797BC07CDC1D25A8A919A637B9FFF2F920BD42D1721018ABF8D34959AF877AFF450AD91548184E1A0D991CC8 -0BC8D3E1C2D9A8FB445FC55564471007A28C09C9CE602203176F1BFF02AC6328 -1C4CA912791BCD9CB231C64AB479AF240D02EC9F431D7C479B9A172E5B97F5CD -15A9CDF17E72255DE0942C09E67CD251C3D465246845F9C0B97A7EFEE4AF9110 -F95543395BFF39B0A093AC80D0EF1BEFA218A3769D074250414D1357105A4D34 -138D433824E691C6B67A08CF1DDE55FBCA2D65AC0B7D9320EA1FDCB1742B11BF -3BE3A385F1C0B8922C4E23EFF6912748DF715A4546CECB5E8972C1D1E47D0D3A -9ECA2554ED36700326F2E5140C434ADA8DFF55A53382F19541E9AAE45DA5CBF2 -5C75D528678AF199E191C49F310913F401014F97EEA5FA507C7310B48A98FDE3297EA398B08959951FF99EDDB64C5E0D -22A9C66645B3944925A496D9F2312429CC787B6314948B482EAD9360124F59DA -DA3A8571664DBBFC1DE97B53E7C141554A2FBCEBA980696D32409CC5ADB7FC41 -20A52AABC518FCC2FC75AE3F5CC7C4838AA4973111DA696B890D884A18098D91 -EBB7163F580A1A5D26F12FBE650A227791193BA9AFCE277584B171F2FE1C77CF -86369EE5277CB81B9417B6232F8D994FAEAB34D0D5363B143257C62B10CACAFD -2E2EAB32891E172A3C31D434703480E69793435BB198E6AA06AA066EE8234D85 -745FC576D77C41BAEFF15A822E6B4058A485A2CAA0A3B283928D17AC02299AD9 -1FF8D49F2F7D785D64B6FE365CD9C2BD958E9527F66BB8A85C9AEBC73ECFE064 -3CFB77F3E274C1EB2772CDFA7B5B17255C2554198BE60C058A3405AEC644FABC5AAECC8F9C7F4A4E5B2D5252E8C62628 -AE514C44B55A1A4744E1106FD226C587D1B71CA7B5DCF010265D769E22012866 -2B2D787A4B0F30CAB9CD3DBC7686165637F091B31745CAB53B369A804F76F9EE -EA4279C80F0B4AC0B32AB9E8B8CFB9C25FF81840BEE65B2160F85E56FA576C48 -E41D853750D68643E929F94F46BCDC050040935883E9A0C45BB238CDE06340DD745BDA7D6C16AE2B028E073EDDC0FC49 +IV: 46 75 72 69 20 63 68 65 63 6B 20 4F 77 4F 21 3F +796353C129CC2B688FE158D36E82001F7450D58DD763BCF4D6FA1CE6C3D598EA +1E7DDEB3B54A42B8993C32AF209CBCC9A1137CE334449F016B993D673EB15C69 +F9CB2DDC4E3D45694292C7DE45F1DC0BD74235B36F624AF39E8C3D211A713408 +538F46EF4250801434FEA469EE07E8C8BF71C6179442718A05455BB501D797C4 +F2BF384DBF7F828E025F020E47D1D637B497FB470444F0C6F9DC67C6830EDDE8A26A6EE89A321D3924D9099895AB2EA1 +2CA8A8A4866D5C2B715B520F641B41355A81BA73170842233806D8AA3E3F3D62 +80CF5DEF931CF902EE602319F7CD506D42E5FBC06ABBF9F05D474C8E8A2AAC4E +15CB465F7A646226C987BB4928E92A61F350ADCDDE355B717730ADDD1B738950 +86B7597ED3EDF6826124ABD7AE419197DC4A93FA064179ACAD853EC670F93995 +28263A286F1ADA0E851E8A27AFD7706CF3513D8A24D41CF7E24A925FE3D86305 +AF29A08AB877F12681706D71B82B8E2447DA18EBF9731EF3CE91FA5ECAC4E98F8FDC817E0F67C3D7348DD2AF128F1E62 +A675C5BB6AC41336B5F5A27FC062FBF30DC39B1E5C498F0FD823261C3177FA58416C5402554742370CB0DAFD2895F6F8 +0073790C26BD0224F5560161A4D4C4F8E05498E995FD2BF12EA9926A5127E9A5 +235ADFE253B51260DCF5C66F9CB9602B91A0C57BE14D1BE1E11EB309643B29DB +F9C2E3A926AAA108F474075F0B4EDFF3135492B1529EAB150CF78E748BF36E17 +50F442CC9D90B9FF8C786245EC442B911A28A04D829D0E45D7D2D4C5A3F5B864 +9EA00CD21C0BE1BB15A0CAD31097A44CAF42868F259E8ED25F361986C26161514FA85D78F3889B4185D2A1484C1DA88C +52DFE7D9052F29071922876723C30CF6FE6247D6439590C5C7C0493120ACA096 +D5AF176D59779A92F6EFB34F271D76D60780C3EA83306326E0119CD3B0417687 +C4CC4E589CCCEC609B4DE39F926F83CCFFCC966871B9A998514910A3F59E86FB56C476DFFB4181E3D22E86A760C4C137 +50A64FEDA64B61A5C123906426EF726D98AC70C15F38245A931B5649F0944930679513D9862091275F10A804EBB610DE +E7938C4F32E571582D73F855ACC40FF0153EFBAB6D184F2DBE8EAC63C4276D92 +7667993F35F1363C0A3AEB5222F07F91904B3F6FA375BF062B269B09706764CB +9DF764EE4A70D331BA8870F4D27C3E90E811A5E306BC72701A99A0377AC7B189 +324D0FBC096A489983C45E82B2745A83A3725A87D2D2CA676A521075065D5047 +8EA1A30AE08CEBD03A52EB2512C7C69CB824E0B9BE900E25F15FAB17ADBB1188 +CE379182103FC4E0442745F6F202AB6ED8EBC051B5F5537916938D9DB8FCD6BE +752BD22AA37D030C60E48CB57309AF631682AC4A0D67C3A7D1130EB056717FB6 +9ECFE7D24BF25BD543E1EAE8116D95C110BD4514EE279BCA71234865EB9166BD +14B3FA8704BA3B284C65F1A6FD114E53B883E12EAFB24B574F84585BD20157DA +D026E1E2CA70E33291482EEFCE11123540BBF591D400C92CEBB8CAF99A9DE882 +88E618EF5E76D1F5A60926D48D3D58FF67B4A92DE6EECA271EDAFC2419AE787B +74E14AD8ADE2BC575048325D1B3990669CDB35D840169B913043DAC938862AE4 +BEB5388B6A7D5C9EF65BDD7577D1DD654B7FAECE5A4CF0937BB7D0C0C5494CD0 +761356D494E3C947CBDCA887A30071A675FE1BE6E77FC9016DB9B5659B7FF9E7 +7503725DFC7212F5F719AFC9DF29F07321511BE4896E12D1D10C68BB07C6483A2CE5FFDFD074CFC279E42E6DD860C496 +BD03D78399DE44449AEE9F00EBCABBF419EDEA1701B9979A97D57AECB5139D1E +E80EB84DF9DA2E34B78F50D6488A30F8EFD11E7C6DBEB7CFEDE83BE5CA86B6DF +9332A130138F2AC11A12030CF43EFF77E7CABE761EDE14748112E13267496CE9 +E657F3C95EEF0AF92A5C49F66BD9C053A82493C7D6267F1E7C038473AE488116 +6F37491FFE130F90B77D7E5EA4AA75A1DB0CA3644F68B6502DFC302DDB80367B +3B37C5CCDD510873628D92B352907FEFF0AC2B38C751C2E46C3B97C3E365972B +A4C845187BEC75669234EE07B839DCFF618678D2EAA5596350F0936A400099A5 +2C961EF4F2454771B2646ECBAA1D0B7DAA2FD8ECC7228037A36E24FE30C43ABAA446C1B5968C0E2DD141C55557A4CCB8 +C4E0D43E9670C2B91F6AF03D60F216625CC19C697331BC443194D2BB88E042DF +3DC5584F43061AF79907D6342DF3344435B5AA6277B33D7DC56C429D1EB81BC4 +D9186791E907CBB9EF26EDDAEA9F0DBC8D24E213E55942ED5E1790B5A55F8758 +2B54CB727BBFD8567543448D2D24B3865329F89936D3B035ED2185BA88F1DF2E +A08F0D881AF001E52FF2CF9D232A9A566EB1900B351AFEEFEE666BEC40588F64 +46A11CA89BA1998A247275EEDF504DAFC5F97B41DFF4943F531A9F8F43DF19C5 +EF70A3858E84B13DF606317381B2E9DFFC346E96AF7C1DF0001586B8BF35808F +38EAF18DB8096C7427EBD36CBC5B0E945A3286278CC0227EB056F7ACB9E450D4 +28278D1DAA263E9A45ED17F67F6B6B0CF00F8C0F58F86C8161F8D4266FE556CB +0B0C79FDD7C9EA31FAA4AA829EDDD2A3453C05A74F5B53BBEAE83E1F4913FD1C18BD235D14D06D9E567DDB273E4C1F2A +7D663A93AE1B9A2E00E944B92838DED3376E09C5179C8F3037B2EAE9E7326C2A +D64EC2C7BD8CFA152368DF6BB75D66EF24EAA9C864A1386184B793C0585D82BC +51D8EB188E833891CCD15919FAC8FE56ACAB1007699F4FDCB53A6DDAB02E5CAA +650866D34DECD1D1F3559EFD8D2A4C1DB51C005F5932608CB6062B384D7A1F59C8E3FBF2C0A5AEFFB631D7B88A630AAB diff --git a/applications/main/subghz/scenes/subghz_scene_set_type.c b/applications/main/subghz/scenes/subghz_scene_set_type.c index a03c194f8..6c3e44894 100644 --- a/applications/main/subghz/scenes/subghz_scene_set_type.c +++ b/applications/main/subghz/scenes/subghz_scene_set_type.c @@ -29,6 +29,7 @@ static const char* submenu_names[SetTypeMAX] = { [SetTypeAllmatic868] = "KL: Allmatic 868MHz", [SetTypeCenturion433] = "KL: Centurion 433MHz", [SetTypeMonarch433] = "KL: Monarch 433MHz", + [SetTypeJollyMotors433] = "KL: Jolly Mot. 433MHz", [SetTypeSommer_FM_434] = "KL: Sommer 434MHz", [SetTypeSommer_FM_868] = "KL: Sommer 868MHz", [SetTypeSommer_FM238_434] = "KL: Sommer fm2 434Mhz", @@ -428,6 +429,16 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { .keeloq.cnt = 0x03, .keeloq.manuf = "Monarch"}; break; + case SetTypeJollyMotors433: + gen_info = (GenInfo){ + .type = GenKeeloq, + .mod = "AM650", + .freq = 433920000, + .keeloq.serial = (key & 0x000FFFFF), + .keeloq.btn = 0x02, + .keeloq.cnt = 0x03, + .keeloq.manuf = "Jolly_Motors"}; + break; case SetTypeElmesElectronic: gen_info = (GenInfo){ .type = GenKeeloq, From c9bc05199e24e059a394f97cb36f90a2927b2d4d Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:18:51 +0300 Subject: [PATCH 3/6] add auto power off timer setting [ci skip] by @Dmitry422 with little fixes by @xMasterX --- applications/services/desktop/desktop.c | 55 +++++++++++++++++++ applications/services/desktop/desktop_i.h | 3 + .../services/desktop/desktop_settings.c | 40 ++++++++++---- .../services/desktop/desktop_settings.h | 3 + .../scenes/desktop_settings_scene_start.c | 35 ++++++++++++ 5 files changed, 124 insertions(+), 12 deletions(-) diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index 1132760d5..8b24e38f0 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -19,6 +19,12 @@ static void desktop_auto_lock_arm(Desktop*); static void desktop_auto_lock_inhibit(Desktop*); static void desktop_start_auto_lock_timer(Desktop*); static void desktop_apply_settings(Desktop*); +//--- auto_power_off_timer +#include +static void desktop_start_auto_poweroff_timer(Desktop*); +static void desktop_auto_poweroff_arm(Desktop*); +static void desktop_auto_poweroff_inhibit(Desktop*); +//--- static void desktop_loader_callback(const void* message, void* context) { furi_assert(context); @@ -131,6 +137,9 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) { } desktop_auto_lock_inhibit(desktop); + //--- auto_power_off_timer + desktop_auto_poweroff_inhibit(desktop); + //-- desktop->app_running = true; furi_semaphore_release(desktop->animation_semaphore); @@ -138,6 +147,9 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) { } else if(event == DesktopGlobalAfterAppFinished) { animation_manager_load_and_continue_animation(desktop->animation_manager); desktop_auto_lock_arm(desktop); + //--- auto_power_off_timer + desktop_auto_poweroff_arm(desktop); + //--- desktop->app_running = false; } else if(event == DesktopGlobalAutoLock) { @@ -179,6 +191,9 @@ static void desktop_input_event_callback(const void* value, void* context) { Desktop* desktop = context; if(event->type == InputTypePress) { desktop_start_auto_lock_timer(desktop); + //--- m96yda + desktop_start_auto_poweroff_timer(desktop); + //--- } } @@ -213,6 +228,39 @@ static void desktop_auto_lock_inhibit(Desktop* desktop) { } } +//--- auto_power_off_timer +static void desktop_auto_poweroff_timer_callback(void* context) { + UNUSED(context); + Power* power = furi_record_open(RECORD_POWER); + power_off(power); +} + +static void desktop_start_auto_poweroff_timer(Desktop* desktop) { + furi_timer_start( + desktop->auto_poweroff_timer, furi_ms_to_ticks(desktop->settings.auto_poweroff_delay_ms)); +} + +static void desktop_stop_auto_poweroff_timer(Desktop* desktop) { + furi_timer_stop(desktop->auto_poweroff_timer); +} + +static void desktop_auto_poweroff_arm(Desktop* desktop) { + if(desktop->settings.auto_poweroff_delay_ms) { + desktop->input_events_subscription = furi_pubsub_subscribe( + desktop->input_events_pubsub, desktop_input_event_callback, desktop); + desktop_start_auto_poweroff_timer(desktop); + } +} + +static void desktop_auto_poweroff_inhibit(Desktop* desktop) { + desktop_stop_auto_poweroff_timer(desktop); + if(desktop->input_events_subscription) { + furi_pubsub_unsubscribe(desktop->input_events_pubsub, desktop->input_events_subscription); + desktop->input_events_subscription = NULL; + } +} +//--- + static void desktop_clock_timer_callback(void* context) { furi_assert(context); Desktop* desktop = context; @@ -238,6 +286,9 @@ static void desktop_apply_settings(Desktop* desktop) { if(!desktop->app_running && !desktop->locked) { desktop_auto_lock_arm(desktop); + //--- auto_power_off_timer + desktop_auto_poweroff_arm(desktop); + //--- } desktop->in_transition = false; @@ -373,6 +424,10 @@ static Desktop* desktop_alloc(void) { desktop->auto_lock_timer = furi_timer_alloc(desktop_auto_lock_timer_callback, FuriTimerTypeOnce, desktop); + //--- auto_power_off_timer + desktop->auto_poweroff_timer = + furi_timer_alloc(desktop_auto_poweroff_timer_callback, FuriTimerTypeOnce, desktop); + //--- desktop->status_pubsub = furi_pubsub_alloc(); diff --git a/applications/services/desktop/desktop_i.h b/applications/services/desktop/desktop_i.h index 1dc7c7d21..abf5cd579 100644 --- a/applications/services/desktop/desktop_i.h +++ b/applications/services/desktop/desktop_i.h @@ -75,6 +75,9 @@ struct Desktop { FuriTimer* auto_lock_timer; FuriTimer* update_clock_timer; + //--- auto_power_off_timer + FuriTimer* auto_poweroff_timer; + //--- AnimationManager* animation_manager; FuriSemaphore* animation_semaphore; diff --git a/applications/services/desktop/desktop_settings.c b/applications/services/desktop/desktop_settings.c index 828ec5f0d..45b9e5ee3 100644 --- a/applications/services/desktop/desktop_settings.c +++ b/applications/services/desktop/desktop_settings.c @@ -6,16 +6,20 @@ #define TAG "DesktopSettings" -#define DESKTOP_SETTINGS_VER_13 (13) -#define DESKTOP_SETTINGS_VER (14) +#define DESKTOP_SETTINGS_VER_14 (14) +#define DESKTOP_SETTINGS_VER (15) #define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME) #define DESKTOP_SETTINGS_MAGIC (0x17) typedef struct { - uint8_t reserved[11]; - DesktopSettings settings; -} DesktopSettingsV13; + uint32_t auto_lock_delay_ms; + uint8_t displayBatteryPercentage; + uint8_t dummy_mode; + uint8_t display_clock; + FavoriteApp favorite_apps[FavoriteAppNumber]; + FavoriteApp dummy_apps[DummyAppNumber]; +} DesktopSettingsV14; // Actual size of DesktopSettings v13 //static_assert(sizeof(DesktopSettingsV13) == 1234); @@ -37,21 +41,33 @@ void desktop_settings_load(DesktopSettings* settings) { DESKTOP_SETTINGS_MAGIC, DESKTOP_SETTINGS_VER); - } else if(version == DESKTOP_SETTINGS_VER_13) { - DesktopSettingsV13* settings_v13 = malloc(sizeof(DesktopSettingsV13)); + } else if(version == DESKTOP_SETTINGS_VER_14) { + DesktopSettingsV14* settings_v14 = malloc(sizeof(DesktopSettingsV14)); success = saved_struct_load( DESKTOP_SETTINGS_PATH, - settings_v13, - sizeof(DesktopSettingsV13), + settings_v14, + sizeof(DesktopSettingsV14), DESKTOP_SETTINGS_MAGIC, - DESKTOP_SETTINGS_VER_13); + DESKTOP_SETTINGS_VER_14); if(success) { - *settings = settings_v13->settings; + settings->auto_lock_delay_ms = settings_v14->auto_lock_delay_ms; + settings->auto_poweroff_delay_ms = 0; + settings->displayBatteryPercentage = settings_v14->displayBatteryPercentage; + settings->dummy_mode = settings_v14->dummy_mode; + settings->display_clock = settings_v14->display_clock; + memcpy( + settings_v14->favorite_apps, + settings->favorite_apps, + sizeof(settings_v14->favorite_apps)); + memcpy( + settings_v14->dummy_apps, + settings->dummy_apps, + sizeof(settings_v14->dummy_apps)); } - free(settings_v13); + free(settings_v14); } } while(false); diff --git a/applications/services/desktop/desktop_settings.h b/applications/services/desktop/desktop_settings.h index ba5a78840..e2e91d2dd 100644 --- a/applications/services/desktop/desktop_settings.h +++ b/applications/services/desktop/desktop_settings.h @@ -38,6 +38,9 @@ typedef struct { typedef struct { uint32_t auto_lock_delay_ms; + //--- auto_power_off_timer + uint32_t auto_poweroff_delay_ms; + //--- uint8_t displayBatteryPercentage; uint8_t dummy_mode; uint8_t display_clock; diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c index 04cb0182b..9954a2c28 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c @@ -28,6 +28,15 @@ typedef enum { DesktopSettingsDummyOkLong, } DesktopSettingsEntry; +// --- auto_power_off_timer +#define AUTO_POWEROFF_DELAY_COUNT 8 +const char* const auto_poweroff_delay_text[AUTO_POWEROFF_DELAY_COUNT] = + {"OFF", "5min", "10min", "15min", "30min", "45min", "60min", "90min"}; + +const uint32_t auto_poweroff_delay_value[AUTO_POWEROFF_DELAY_COUNT] = + {0, 300000, 600000, 900000, 1800000, 2700000, 3600000, 5400000}; +// --- + #define AUTO_LOCK_DELAY_COUNT 9 const char* const auto_lock_delay_text[AUTO_LOCK_DELAY_COUNT] = { "OFF", @@ -86,6 +95,16 @@ static void desktop_settings_scene_start_clock_enable_changed(VariableItem* item app->settings.display_clock = index; } +// --- auto_power_off_timer +static void desktop_settings_scene_start_auto_poweroff_delay_changed(VariableItem* item) { + DesktopSettingsApp* app = variable_item_get_context(item); + uint8_t index = variable_item_get_current_value_index(item); + + variable_item_set_current_value_text(item, auto_poweroff_delay_text[index]); + app->settings.auto_poweroff_delay_ms = auto_poweroff_delay_value[index]; +} +// --- + static void desktop_settings_scene_start_auto_lock_delay_changed(VariableItem* item) { DesktopSettingsApp* app = variable_item_get_context(item); uint8_t index = variable_item_get_current_value_index(item); @@ -115,6 +134,22 @@ void desktop_settings_scene_start_on_enter(void* context) { variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, auto_lock_delay_text[value_index]); + // --- auto_power_off_timer + item = variable_item_list_add( + variable_item_list, + "Auto PowerOff", + AUTO_POWEROFF_DELAY_COUNT, + desktop_settings_scene_start_auto_poweroff_delay_changed, + app); + + value_index = value_index_uint32( + app->settings.auto_poweroff_delay_ms, + auto_poweroff_delay_value, + AUTO_POWEROFF_DELAY_COUNT); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, auto_poweroff_delay_text[value_index]); + // --- + item = variable_item_list_add( variable_item_list, "Battery View", From d566f650bdf4f8f1669b41ebeb8fbc280cd677ec Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:20:41 +0300 Subject: [PATCH 4/6] fix order [ci skip] --- .../desktop_settings/scenes/desktop_settings_scene_start.c | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c index 9954a2c28..f674380af 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c @@ -9,6 +9,7 @@ typedef enum { DesktopSettingsPinSetup = 0, DesktopSettingsAutoLockDelay, + DesktopSettingsAutoPowerOff, DesktopSettingsBatteryDisplay, DesktopSettingsClockDisplay, DesktopSettingsChangeName, From 53fa3f85b30de8c236a768257fe8317143041bc8 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:51:06 +0300 Subject: [PATCH 5/6] upd changelog --- CHANGELOG.md | 7 ++++++- applications/services/desktop/desktop.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5058c114..f12e3bd56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ ## Main changes - Current API: 78.2 +* SubGHz: Jolly Motors support (with add manually) (Thanks @pkooiman !) +* Desktop: Auto Power Off Timer (by @Dmitry422 with some fixes by @xMasterX) +* OFW PR 4025: Increase system stack's reserved memory size (Fix USB UART Bridge Crash) (by @Astrrra) * OFW: merged gsurkov/vcp_break_support branch for usb uart bridge (WIP!!!) * Apps: **Check out more Apps updates and fixes by following** [this link](https://github.com/xMasterX/all-the-plugins/commits/dev) ## Other changes -* No changes yet :( +* OFW: NFC: Plantain parser Last payment amount fix +* OFW: NFC clipper: BART station ids for San Lorenzo, Bay Fair +* OFW: Fix typo for mf_classic_key_cahce_get_next_key() function

#### Known NFC post-refactor regressions list: - Mifare Mini clones reading is broken (original mini working fine) (OFW) diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index 8b24e38f0..9366d6508 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -191,7 +191,7 @@ static void desktop_input_event_callback(const void* value, void* context) { Desktop* desktop = context; if(event->type == InputTypePress) { desktop_start_auto_lock_timer(desktop); - //--- m96yda + //--- auto_power_off_timer desktop_start_auto_poweroff_timer(desktop); //--- } From 306b7285879abe05b1e3e7bfdca6442c86161b94 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 8 Dec 2024 13:39:34 +0300 Subject: [PATCH 6/6] fix wrong order --- applications/services/desktop/desktop_settings.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/applications/services/desktop/desktop_settings.c b/applications/services/desktop/desktop_settings.c index 45b9e5ee3..7a99dd365 100644 --- a/applications/services/desktop/desktop_settings.c +++ b/applications/services/desktop/desktop_settings.c @@ -58,13 +58,11 @@ void desktop_settings_load(DesktopSettings* settings) { settings->dummy_mode = settings_v14->dummy_mode; settings->display_clock = settings_v14->display_clock; memcpy( - settings_v14->favorite_apps, settings->favorite_apps, - sizeof(settings_v14->favorite_apps)); + settings_v14->favorite_apps, + sizeof(settings->favorite_apps)); memcpy( - settings_v14->dummy_apps, - settings->dummy_apps, - sizeof(settings_v14->dummy_apps)); + settings->dummy_apps, settings_v14->dummy_apps, sizeof(settings->dummy_apps)); } free(settings_v14);