room_server: add system post helper for local events#2688
Draft
Che177 wants to merge 14 commits into
Draft
Conversation
Removed links to outdated resources and links
Include the 'ver' command for retrieving the firmware version
…le based on lilygo_tlora_v2_1 variant
ini sections moved to variants-specific platformio.ini file duplicate init code removed from main.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft PR for discussion, based on issue #2686.
I am opening this as a draft because this touches the room server structure/API shape. Happy to adjust the approach based on maintainer feedback!
Summary
This PR adds a small helper method that allows
simple_room_serverto create a room post as the room server itself.The main change is:
This provides a clean code path for local/server-side events to create room posts without duplicating the existing post storage and push logic.
The helper is also exposed through a console command:
This makes room-server-originated posts easy to test manually from the serial console.
A disabled-by-default GPIO contact example is included as a practical demo use case.
Motivation
The room server can be useful as a local message source.
I wanted to make that concept available as a small helper method so local room-server events can post into the room cleanly.
As a practical demo, I added a disabled-by-default GPIO contact example for the use case I was working on:
Example deployment-specific message:
Implementation
This PR:
MyMesh::addSystemPost(const char* postData)storePost()pathroom.post <message>console commandexamples/simple_room_server/main.cppThe commented PlatformIO example is currently included in:
Known limitation
This follows the current room server timestamp behavior.
The room server clock needs to be synchronized before local/system posts are created. Otherwise, the post may be timestamped in the past and may not appear as expected in the client room view.
This appears to be a limitation of the current room post timestamp design, not something specific to the GPIO contact example.
Scope
This PR does not add a general sensor framework.
It does not introduce protocol changes, app changes, or new dependencies.
The GPIO contact input is intended only as a small example of a local event source that can call the new system post helper.
Testing
Tested locally with
simple_room_server.Verified:
room.post <message>can create a room post throughaddSystemPost()addSystemPost()when the optional contact input is enabled