Conversation
…ension, increase max
There was a problem hiding this comment.
Pull request overview
This PR updates the codeplug format handling around “beta41+ / Beta42” by standardizing on the beta41+ layout (DTCN marker), adding explicit legacy (pre-beta41) parsing support, and introducing per-zone per-channel scan flags end-to-end (parser/serializer, model, GUI, and tests).
Changes:
- Add legacy (pre-beta41) channel parsing and tests; detect layout via
DTCNmagic rather than a settings flag. - Add zone scan-list bitmap parsing/serialization plus GUI editing support, and update round-trip tests accordingly.
- Simplify/remove beta-version feature gating and retire several removed settings fields; add new settings fields (FN key + hotkeys, secondary PTT, etc.).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_messages.py | Updates message contact-id encoding assertions to BCD. |
| tests/test_legacy.py | New test suite for pre-beta41 (legacy) channel parsing. |
| tests/test_codeplug_parser.py | Updates settings/zone snapshots and adds zone scan-list tests. |
| rt4d_editor.py | Removes display of settings fields that no longer exist. |
| rt4d_codeplug/serializer.py | Removes legacy/beta branching, always writes beta41+ channel layout, adds zone scan bitmap serialization. |
| rt4d_codeplug/parser.py | Detects layout by DTCN, delegates legacy channel parsing, parses zone scan bitmap, removes beta version logic. |
| rt4d_codeplug/models.py | Adds Zone.scan_list, adjusts group-list limits, updates/renames several settings fields. |
| rt4d_codeplug/legacy.py | New legacy channel parser + legacy group-list sizing exports. |
| rt4d_codeplug/dropdowns.py | Updates dropdown ranges/labels and adds FN key + secondary PTT enums. |
| rt4d_codeplug/constants.py | Adds zone scan bitmap constants; reworks group-list sizing constants; removes beta version offset. |
| gui/zone_widget.py | Adds a “Scan” column with per-channel scan toggle and keeps scan flags in sync on reorder. |
| gui/settings_dialog.py | Removes beta gating/clock/apo UI; adds hotkeys, FN key, secondary PTT, and new hang-time controls. |
| gui/radio_dialog.py | Removes beta-version gating and beta41 layout checkbox; always handles regions uniformly. |
| gui/dtmf_widget.py | Makes DTMF names editable unconditionally and updates “DTMF List” display names dynamically. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Serialize settings to cfg_data if settings exist | ||
| if codeplug.settings: | ||
| codeplug.cfg_data = CodeplugSerializer.serialize_settings(codeplug.settings, codeplug.cfg_data) | ||
|
|
||
| # Write CFG section | ||
| data[OFFSET_CFG:OFFSET_CFG + SIZE_CFG] = codeplug.cfg_data |
There was a problem hiding this comment.
serialize() always writes channels using the beta41+ layout, but the DTCN magic bytes are only written when codeplug.settings is set. If CodeplugSerializer.serialize() is called with settings=None, the resulting file will have beta41+ channel data but no DTCN magic, so CodeplugParser will treat it as legacy and parse channels/group lists incorrectly. Consider always writing BETA41_MAGIC into cfg_data[4092:4096] (even when settings is None), or require/instantiate a default RadioSettings during serialization so the layout marker is consistent with the serialized channel format.
| for i in range(channel_count): | ||
| # Default missing scan_list entries to True | ||
| scan = zone.scan_list[i] if i < len(zone.scan_list) else True | ||
| if scan: | ||
| data[ZONE_SCAN_LIST_OFFSET + i // 8] |= (1 << (i % 8)) |
There was a problem hiding this comment.
Zone scan bitmap serialization indexes zone.scan_list by i in range(channel_count), but channel_count is derived from valid_channels which filters out missing/unknown channel UUIDs. If any channel UUIDs are skipped, the scan flags will shift and get written for the wrong channels. Build the (channel_uuid, scan_flag) list in parallel and filter them together so the bitmap reflects the correct per-channel scan setting after filtering.
No description provided.