Skip to content

Conversation

@swannman
Copy link

@swannman swannman commented Nov 1, 2025

In the PugetMesh community we have channels like #bot and #testing that are mostly used for "can you hear me?" tests. These are the most heavily-used channels in the region, yet the messages are not useful to store offline - they take up space on the device and are time-consuming to sync when reconnecting a phone to the companion.

This PR introduces a per-channel "no store" flag that tells the companion not to store any messages for the channel unless a phone is connected. This reserves more offline storage for channels that actually matter, and makes reconnecting faster.

This PR also introduces the concept of channel flags. These are persisted in the unused 4-byte header of each channel in the data store. Other per-channel settings such as notifications enabled/disabled can be stored here in the future.

Testing performed on a WisMesh Tag:

Upgrade

  • Upgrade from previous dev branch firmware to this firmware: all channels default to noStore=false.

Behavior when noStore = false

  • Verified that the companion continued to receive and store messages for all channels when disconnected from phone.

Behavior when noStore = true

  • Verified that the companion continued to store messages for these channels when connected to phone
  • Verified that the companion did not store messages for these channels when disconnected from phone

Settings persistence

  • Verified that CMD_GET_CHANNEL_FLAG_NOSTORE returns the noStore value
  • Verified that CMD_SET_CHANNEL_FLAG_NOSTORE correctly sets the noStore value

API support

Add a "no store" flag for channels
@swannman swannman marked this pull request as ready for review November 1, 2025 21:32
@swannman
Copy link
Author

swannman commented Nov 1, 2025

@liamcottle would you like me to add CMD_SET and CMD_GET commands for this flag so it's ready for integration with clients? Just need to know how to test them if so. Thanks!

Update: the commands are now implemented and were tested using meshcore_py.

@swannman swannman requested a review from kallanreed November 4, 2025 21:04
@ripplebiz
Copy link
Collaborator

Also, you really need to get buy-in from Liam, to support modifying the CMD_GET_CHANNEL and CMD_SET_CHANNEL companion protocol

@swannman
Copy link
Author

swannman commented Nov 9, 2025

@ripplebiz thank you for the code review! Updated with your feedback.

Also, you really need to get buy-in from Liam, to support modifying the CMD_GET_CHANNEL and CMD_SET_CHANNEL companion protocol

I think it makes sense to add new commands for getting and setting the flags for a given channel at a time. I'll work on that next!

@swannman
Copy link
Author

@ripplebiz I've added new CMD_GET_CHANNEL_FLAG_NOSTORE and CMD_SET_CHANNEL_FLAG_NOSTORE commands here, so there is no impact to the existing companion protocol. I've also published a PR that adds these to the Python API: meshcore-dev/meshcore_py#31

Would you mind taking another look?

@fdlamotte
Copy link
Collaborator

Just a little thought, maybe no_store channels could be handled only by the application ? (as there is no need to store message when connected to the app)

I've been thinking that an alternative way to get the same result as proposed here would be to register no_store channels only in the app and read them from rx_log

Then to send on these channels, there would be a new command to send a msg providing the pubkey of the channel where to send the message to

And channels configured on the device would be dedicated to "store" channels (and we can lower their number, which would be another benefit), there would then be an unlimited number of no_store channels

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.

4 participants