Skip to content

Increase MAX_FRAME_SIZE by 4 bytes#2022

Open
weebl2000 wants to merge 1 commit into
meshcore-dev:devfrom
weebl2000:adjust-max-framesize
Open

Increase MAX_FRAME_SIZE by 4 bytes#2022
weebl2000 wants to merge 1 commit into
meshcore-dev:devfrom
weebl2000:adjust-max-framesize

Conversation

@weebl2000
Copy link
Copy Markdown
Contributor

@weebl2000 weebl2000 commented Mar 14, 2026

When a region is set, transport codes add 4 bytes to the wire format. For longer flood messages (~133+ chars for 14 char username), this pushes 1-hop repeat packets past the logRxRaw() limit of MAX_FRAME_SIZE - 3 (169 bytes). The raw packet gets silently dropped, so the companion app never sees repeats and can't show "heard repeats" for those messages.

Shorter messages and messages without a region set are unaffected because they stay under the limit.

Fix: bump MAX_FRAME_SIZE from 172 to 176 (the size of the transport code field). All frame buffers and size checks reference this constant so nothing else needs to change.

Memory cost is ~1 KB worst case across all queue buffers — negligible on all platforms.

This is the easiest fix for now without dropping region scoped messages by 10-16 bytes at worst.

Confirmed this fixes it for companions. First message is 1 byte over the limit with 173 bytes, second message is at the limit with 172 bytes, third message is after flashing with this fix and stays under 176 byte limit.

image

@weebl2000
Copy link
Copy Markdown
Contributor Author

@liamcottle thoughts? We talked about this on Discord 2 weeks ago and this seems to fix the issue without causing any problems.

@liamcottle
Copy link
Copy Markdown
Member

liamcottle commented Mar 27, 2026

@liamcottle thoughts? We talked about this on Discord 2 weeks ago and this seems to fix the issue without causing any problems.

  • Would need to test building it on the more constrained boards we support to make sure the firmware still fits.
  • Would need to test that BLE still works on Android/iOS/Windows/Web/Mac across ESP32 and nRF52 to make sure there's no weird issues with BLE MTU being increased. Since this value is passed to the BLE stack as well.

I doubt there will be any issues, and it is indeed a very minimal change, but I'm hesitant to merge without it actually being tested properly due to the wide effect it will have. We already have a bunch of BLE issues, don't wanna introduce more :)

@weebl2000
Copy link
Copy Markdown
Contributor Author

I've tested on Android 16. Works fine there. Can get my hands on an iPhone later to test if needed.

It's the safest fix for now to fix region scoped messages from being
dropped early
@Magalex2x14
Copy link
Copy Markdown

Hello!
Among the supported devices, are there one or two that cause concern, with the most limited resources?

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.

3 participants