Commit Graph
40 Commits
Author SHA1 Message Date
MX 663eb937b7 Merge remote-tracking branch 'OFW/dev' into dev 2026-10-01 20:54:50 +03:00
MMX 9af1a6d807 Fixes of various valid issues found by code scan (#4456) 2026-10-01 19:26:14 +03:00
Mykhailo ShevchukandClaude Opus 5 c74f6b1d57 iButton: choose which blank types a write may try, and show the current one (#1153)
* iButton: choose which blank types a write may try, and show the current one

A Dallas key carries no hint of which blank is in front of the reader, so a
write attempt walks the blank types in turn and keeps the one whose read-back
matches. Until now that chain was hidden inside dallas_ds1990_write_id(): the
app could not say which type it was attempting, and the user could not stop it
attempting one. Mirrors the LFRFID write-target design.

iButtonWriteTarget names the four writers (RW1990.1, RW1990.2, TM2004, TM01x)
and a protocol declares which of them apply to it, so DS1420 no longer has to
repeat DS1990's chain by hand. The group walks that mask, announcing each
target before it is tried - from outside the critical section, because the
announcement reaches the UI thread.

Settings > Write Blanks toggles them, stored via saved_struct and honoured by
the app and the CLI. Honouring it is opt-in: a worker starts at
ibutton_write_targets_default(), which is all four, matching the behaviour
before this existed.

ibutton_protocols_write_id() keeps its signature and delegates with no context,
so the API change is additive (88.12) and existing FAPs still link.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* iButton: address review of the write-target work

Every Dallas protocol now goes through write_targets. ds_generic, ds1971,
ds1992 and ds1996 each had a write_id that called tm2004_write() directly, so
they took a fallback branch that consulted neither mask and wrote a TM2004
with TM2004 switched off - the setting covered two protocols out of six. With
all six converted the fallback branch, the write_id slot in the Dallas
descriptor and the "zero means it writes itself" sentinel all go away, and the
ROM comes from get_editable_data() rather than a cast onto the front of the
protocol's data.

A mask that resolves to nothing no longer looks like an empty reader: the
worker reports iButtonWorkerWriteNoEnabledTarget, and the write screen
distinguishes "no blanks enabled" from "no enabled blank can write this key" -
reachable without disabling everything, since DS1420 cannot use TM01x. The CLI
says so too instead of spinning.

Settings are saved on Back while the plugin is still mapped, and a failure
raises a storage error dialog instead of only a log line, which is what the
plugin ABI comment always claimed happened.

Also: iButtonWriteTargetContext moves beside the types it is built from, so
ibutton_protocols.h stops pulling protocol_group_base.h and protocol_common_i.h
into the SDK tree; write_chip_name is cleared per write session; the settings
loader masks on read and no longer logs "unreadable (OK)" for a corrupt file;
static asserts pin the enum bit positions the saved mask depends on; and the
success screen names the blank that accepted the key.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* iButton: simplify the write-target code

The blank name on the write screen was always one target behind. Worker, app
and GUI threads all run at Normal priority, so posting the progress event does
not yield, and the next line masks the scheduler for most of a second - the
label queued before a target was painted only once that target had finished.
A 1 ms delay after the announcement is what actually lets the screen repaint.

Nothing-enabled is terminal, not something a retry can fix while the screen is
up, so it now reports once and drops the worker to idle instead of rebuilding
the screen and re-blinking every second forever.

The write context is normalised once at the API boundary, so the group stops
testing it for NULL twice; write_chip_name's 16-byte buffer and its snprintf
become the target itself, with the name derived on read; and the four places a
write reports collapse into one helper.

ibutton_protocols_get_write_targets, _write_id_targets, ibutton_write_target_write
and ibutton_write_targets_default have no caller outside lib/ibutton, so they
drop to '-' and stop costing FAP export thunks - the same treatment
lfrfid_write_target_type already gets.

Also: write_id's doc block had been orphaned by an insertion above it; the four
bit-position asserts collapse into one; .write_targets sits with the data fields
in all six descriptors rather than where write_id used to be; read() and
write_copy() stop the bus outside their critical sections, matching write_id;
and a dead scene-state enum, an overstated settings comment and three verbose
blocks go.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* iButton: let the write screen keep up with the blank being tried

The label showed only TM01x - the last blank of the pass. Announcing a target
and then masking the scheduler microseconds later just queues the events up, so
the app got to paint once, at the end, with the final name. 1 ms was nowhere
near a widget rebuild plus a GUI frame; 50 ms lets each one land, costing
200 ms on a pass where all four are tried and fail.

With nothing enabled the scene also flashed up a writing screen that the first
tick immediately replaced with an error. It already knows the mask before the
worker starts, so it now says so directly. The narrower case - something
enabled, but nothing that fits this key - still needs the worker to answer,
since the app cannot ask which blanks a protocol supports.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* iButton: changelog for the write-target selection

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* iButton: address review of the write-target selection

Honour the documented NULL write_ctx instead of dereferencing it, and let
ibutton_protocols_write_id() be the NULL case it describes.

The blank-type setting governs Write ID only, so an empty list no longer
blocks Full Writing, which rewrites the same chip and never consults it.

Do not crash on a write result this build has not heard of: the app is a
separate .fap, so a newer firmware must not take an older one down with it.
The switch keeps no default, so -Wswitch still catches in-tree additions.

Drop an unreadable settings file rather than fail every later read, which
left the settings page presenting defaults as a saved choice and skipping
the save that would have replaced it. Make the setter read-modify-write so
a setting added beside this one is not zeroed.

Clear the blank-type label when a pass gives up, reset the app-wide Popup
before the plugin error uses it, name the remedy instead of printing a
PluginManagerError ordinal, return before touching the bus when no target
is enabled, and check the ROM size the blank writers assume.

Export ibutton_write_targets_default(), which an exported header already
told apps a worker starts from.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* iButton: simplify the write-target selection

Derive the WriteId feature from write_targets instead of storing the same
fact twice in all six Dallas tables, which also deletes the runtime checks
that existed to catch the two disagreeing.

Charge the announce delay to the callback that repaints, not to the 1-Wire
path: the CLI registers a write callback but drops the progress result, so
it paid 50 ms per target for a name it never prints.

Drop the read-modify-write in the settings setter - it read a value it
overwrote on the next line, costing a stat and a full load on every save.
A static assert on the struct size forces the question when a second
setting is actually added.

Stop deleting an unreadable settings file from inside the getter: it is a
filesystem write on a read path, and "unreadable" includes a version a
newer firmware wrote. The page now saves on the way out even when nothing
changed, which replaces a bad file without destroying a good one.

Remove the "none enabled at all" branch and the scene state behind it. The
early return in on_enter means that event can only arrive with targets
enabled, so the distinction was unreachable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 20:08:28 +03:00
Leptopt1losandhedger f78a8328d1 tm01x dallas write support (#4230)
Co-authored-by: hedger <hedger@nanode.su>
2025-09-29 21:13:33 +04:00
MMX 0f713bc6e4 Merge pull request #899 from Leptopt1los/tm01x-dallas-write-support
TM01x Dallas write support
2025-05-14 18:36:02 +03:00
Methodius e538bd7c8e tm01x dallas write support 2025-05-14 16:32:17 +03:00
hedger 5fcaef25b0 Stricter constness for const data (#4126)
* libs: stricter constness for saving RAM with .rodata section; fbt: sdk: fixed signature generation for nested const params

* hal: additional fixes for constness in USB subsystem

* debug apps: additional usb-related fixes

* mjs: more consts for token parser

* fatfs: const driver struct

* hal: more consts for ble & nfc vars

* hal: made FuriHalSpiBusHandle static

* hal: made FuriHalI2cBusHandle static

* usb: restored previous api

* linter fixes

* API fixes
2025-03-31 19:23:32 +04:00
MX b38d239eb8 Merge remote-tracking branch 'OFW/hedger/more-constness' into dev [ci skip] 2025-02-24 21:18:11 +03:00
hedger b0835220ac libs: stricter constness for saving RAM with .rodata section; fbt: sdk: fixed signature generation for nested const params 2025-02-22 16:05:56 +00:00
MX aef8a97ab4 Merge remote-tracking branch 'OFW/dev' into dev 2025-02-20 18:40:54 +03:00
AstraandAleksandr Kutuzov 2817666eb9 [FL-3774] Fix 5V on GPIO (#4103)
* Move OTG controls to the power service
* Accessor: add missing power service import
* Power: add is_otg_enabled to info and properly handle OTG enable with VBUS voltage present
* Power: method naming
* Power: add backward compatibility with old-style use of furi_hal_power
* Scripts: lower MIN_GAP_PAGES to 1
* SubGhz: fix incorrect logging tag
* SubGhz: delegate OTG management to power service
* Power: fix condition race, various improvements

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2025-02-20 12:37:52 +09:00
MX 80ad381eef extra checks [ci skip] 2024-09-09 05:13:02 +03:00
MX 8189062771 merge fixes 2024-08-02 16:47:12 +03:00
MX e74e6cdd02 Merge remote-tracking branch 'OFW/dev' into dev 2024-07-31 22:38:15 +03:00
Astraandあく 01b402ba2b [FL-3827] iButton ID writing (#3734)
* Function naming corrections and enabled writing ID for all dallas blanks
* Enable ID writing for ds1971 and ds1996
* Sync API Symbols

Co-authored-by: あく <alleteam@gmail.com>
2024-08-01 01:59:41 +09:00
MX 726cb770d0 formatting 2024-07-15 20:02:45 +03:00
hedgerandあく ffa3996a5e [FL-3867] Code formatting update (#3765)
* clang-format: AllowShortEnumsOnASingleLine: false
* clang-format: InsertNewlineAtEOF: true
* clang-format: Standard:        c++20
* clang-format: AlignConsecutiveBitFields
* clang-format: AlignConsecutiveMacros
* clang-format: RemoveParentheses: ReturnStatement
* clang-format: RemoveSemicolon: true
* Restored RemoveParentheses: Leave, retained general changes for it
* formatting: fixed logging TAGs
* Formatting update for dev

Co-authored-by: あく <alleteam@gmail.com>
2024-07-15 13:38:49 +09:00
MX a57dbe446e update DS1420 for latest ibutton changes 2024-05-01 16:53:49 +03:00
MX 1736a8a7c2 Merge remote-tracking branch 'OFW/dev' into dev 2024-04-30 22:31:39 +03:00
Astra 7414e6d4df [FL-3817] iButton: fix crash when deleting some keys (#3617)
* iButton: fix crash when deleting some keys
* Fix cyfral crashes
* Better data formatting
* Remove void returns
2024-04-29 19:56:15 +09:00
MX e7ef923729 Merge remote-tracking branch 'OFW/astra/3817-ibutton-crash' into dev 2024-04-27 15:09:25 +03:00
Astra 379e8d2a6a Fix cyfral crashes 2024-04-27 15:53:19 +09:00
Astra 42c69b076a iButton: fix crash when deleting some keys 2024-04-26 19:07:51 +09:00
MX 4422a03ae9 Merge remote-tracking branch 'OFW/dev' into dev 2024-04-18 17:22:36 +03:00
AstraandAleksandr Kutuzov 4883383b20 [FL-3679] iButton new UI (#3471)
* iButton new UI
* UI final touches
* Satisfy PVS

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-04-18 08:05:37 +09:00
MX 585b7f963d Api Symbols: replace asserts with checks
merge ofw commit
2024-03-25 13:53:32 +03:00
acc39a4bc0 Api Symbols: replace asserts with checks (#3507)
* Api Symbols: replace asserts with checks
* Api Symbols: replace asserts with checks part 2
* Update no args function signatures with void, to help compiler to track incorrect usage
* More unavoidable void
* Update PVS config and code to make it happy
* Format sources
* nfc: fix checks
* dead code cleanup & include fixes

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: hedger <hedger@nanode.su>
2024-03-19 23:43:52 +09:00
MX bee48f483c Merge branch 'ofw_dev' into nfcrefactoring 2023-11-01 21:07:33 +03:00
あくandhedger 9af81ce8d0 Furi: cleanup crash use (#3175)
* Furi: optional message in furi_crash and furi_halt
* Consistent furi_crash use
* UnitTests: crash instead of assert
* furi: check: fixed macro for default arg
* unit_tests: fixed crashes everywhere
* lib: infrared: fixed PVS warnings
* furi: eliminated __FURI_ASSERT_MESSAGE_FLAG
* Furi: update check.h docs
* Furi: add check.h usage note
* Docs: grammar

---------

Co-authored-by: hedger <hedger@nanode.su>
2023-10-31 14:40:32 +04:00
MX 20593d56c0 Merge branch 'ofw-dev' into dev 2023-08-22 21:53:50 +03:00
Astraandあく e353433cd8 [FL-3488] Assign tickets to all TODO items (#2988)
Co-authored-by: あく <alleteam@gmail.com>
2023-08-23 02:56:27 +09:00
MX 114e8d5b6a Merge branch 'fz-dev' into dev 2023-04-10 18:41:22 +03:00
あく 0d8518d31d [FL-3232] FuriHal: fix gpio naming and add explicit pulls for vibro, speaker and ir_tx (#2565)
* FuriHal: fix gpio naming and add explicit pulls for vibro, speaker and ir_tx
* Github: workflow event debug print
* Github: proper PR head commit SHA extraction in get_env.py
2023-04-06 19:06:19 +10:00
Georgii Surkov fad24efdf0 [FL-3188] Fix crash when emulating a DSGeneric key (#2530) 2023-03-24 09:26:43 +09:00
Georgii Surkov b11161abb0 Fix crash when emulating a DSGeneric key 2023-03-24 01:19:38 +03:00
MX 9daa51eda4 Update DS1420 to latest changes 2023-03-22 18:41:50 +03:00
MX a81b794475 Merge branch 'fz-dev' into dev 2023-03-22 18:36:59 +03:00
Georgii Surkovandあく 8b224ecb15 [FL-3179] 1-Wire Overdrive Mode (#2522)
* Separate ibutton to its own module, add one_wire to f18
* Move onewire cli to a separate app
* Add definitions for normal and overdrive timings
* Update api definitions
* Add rough overdrive timings definition for onewire emulation
* Remove one_wire_host_timing.h
* Add rough overdrive timings for onewire host
* Improve overdrive mode
* Working overdrive mode from flipper to flipper
* Update thermometer example app
* Turn on otg power when running thermometer example app
* Implement reset overdrive switching
* Always exit out of overdrive mode
* Improve overdrive timings
* Fix typos
* Fix reset behaviour
* Use overdrive mode everywhere in DS1996
* Improve comments
* Bump API version

Co-authored-by: あく <alleteam@gmail.com>
2023-03-22 23:54:06 +09:00
MX 5660111b28 Merge branch 'fz-dev' into dev 2023-03-20 20:04:22 +03:00
Georgii SurkovandAleksandr Kutuzov 0917494a80 [FL-3168] Add one_wire lib to f18, separate ibutton (#2509)
* Separate ibutton to its own module, add one_wire to f18
* Move onewire cli to a separate app

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-03-21 01:23:17 +09:00