Waypoint creation/move/deletion#714
Conversation
Add methods to send (create or move), delete waypoint. Add an example script to create, move, delete waypoint.
ianmcorvidae
left a comment
There was a problem hiding this comment.
Thanks for the pull request! I've got a few questions and some things that appear to be missing. Would love to see this added to the API!
| logging.debug(f"w.longitude_i:{w.longitude_i}") | ||
|
|
||
| if wantResponse: | ||
| onResponse = self.onResponseWaypoint |
There was a problem hiding this comment.
This function doesn't appear to exist.
There was a problem hiding this comment.
My bad, I forgot those indeed.
Latest commit add them but I am not sure how they should really behave from a protocol perspective. So please guide me if it is wrong.
There was a problem hiding this comment.
These functions are what'd normally be used by the CLI if it supported this stuff, but of course this PR doesn't include that. For now, I think they can just serve as placeholders, so what you have should be fine, I think.
| channelIndex=channelIndex, | ||
| ) | ||
| if wantResponse: | ||
| self.waitForWaypoint() |
There was a problem hiding this comment.
This doesn't seem to exist either.
| w.expire = expire | ||
| if id is None: | ||
| seed = secrets.randbits(32) | ||
| w.id = math.floor(seed * math.pow(2, -32) * 1e9) |
There was a problem hiding this comment.
What is the source of this ID generation formula? Looking at the other clients, android seems to just use whatever would be the next packet ID and apple seems to generate a random one.
There was a problem hiding this comment.
I have done similar has in javascript API.
Note that it is not a packet ID but a waypoint ID.
There was a problem hiding this comment.
Fair enough. I'm not sure why restricting it to 9 digits is useful, but it's probably fine in any case for this applicaiton.
Add missing methods callbacks regarding waypoints.
|
I'm just running the CI checks on this to see if anything pops up there. As long as that's all fine, this seems good to merge. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #714 +/- ##
==========================================
+ Coverage 60.22% 60.35% +0.12%
==========================================
Files 24 24
Lines 3829 3970 +141
==========================================
+ Hits 2306 2396 +90
- Misses 1523 1574 +51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Add
MeshInterface.sendWaypointto send (create or move) waypoint, andMeshInterface.deleteWaypointto delete one.Add an example script to create, move, delete waypoint.
MeshInterface.sendWaypointExample scripts usage looks like: