Skip to content

m17: read and write the LSF CAN where the spec puts it - #11

Merged
jancona merged 1 commit into
jancona:masterfrom
turnrye:up/01-lsf-can-bits
Oct 13, 2026
Merged

jancona merged 1 commit into
jancona:masterfrom
turnrye:up/01-lsf-can-bits

Conversation

@turnrye

@turnrye turnrye commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

A radio set to CAN 3 shows on the hotspot dashboard as CAN 1. With Level = DEBUG, the journal showed:

[DEBUG] Received RF LSF: {
        Dst: @ALL
        Src: K0RET-2
        Type: [2]uint8{0x1, 0x85}
        Meta: [14]uint8{0x11, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x54, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}
        CRC: [2]uint8{0x37, 0x1e}

and dashboard.log showed:

{"time":"2026-10-12T20:06:33.563166564-05:00","type":"RF","subtype":"Voice Start","src":"K0RET-2","dst":"@ALL","can":1,"mer":0.000000}

Change

  • CAN() reads both bytes, and the new SetCAN() writes them, keeping the other TYPE bits and updating the CRC. NewLSF uses SetCAN().
  • The Packet LSF TYPE Layout uses the same bits, and OpenRTX's streamType_t agrees. The 3.0.0 draft moves the CAN; this doesn't handle 3.0.
  • TestLSFCANCaptured decodes the LSF above; master reads it as 1. The other new tests cover every CAN in both modes.

Spec 2.0 splits the 4-bit Channel Access Number across the LSF TYPE
bytes: its top three bits are byte 0 bits 2–0, and its lowest is byte 1
bit 7. CAN() and NewLSF used byte 0 alone, so a radio on CAN 3 was read,
and shown on the dashboard, as CAN 1, and NewLSF could send only even
CANs. CAN 0 comes out the same either way, which kept this hidden.

SetCAN sets the CAN on an existing LSF, keeping the other TYPE bits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jancona
jancona merged commit c631983 into jancona:master Oct 13, 2026
2 checks passed
@jancona

jancona commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Well, that's embarrassing, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants