Skip to content

Methods for setting/removing fixed position#802

Merged
danditomaso merged 3 commits into
meshtastic:mainfrom
bergie:set_fixed_position
Aug 27, 2025
Merged

Methods for setting/removing fixed position#802
danditomaso merged 3 commits into
meshtastic:mainfrom
bergie:set_fixed_position

Conversation

@bergie

@bergie bergie commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

Description

Provides a method for setting a fixed position on the connected Meshtastic device. Useful for devices without GPS.

Will help with #87

Testing Done

Method was ported from signalk-meshtastic.

@vercel

vercel Bot commented Aug 22, 2025

Copy link
Copy Markdown

@bergie is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

latitude: number,
longitude: number,
): Promise<number> {
const setPositionMessage = create(Protobuf.Admin.AdminMessageSchema, {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this PR is great. Unfortunately, there is some undocumented functionality in the firmware that isn't being accounted for in this PR, its important these be added in the same PR.

The firmware wont accept a new fixed position if one is already set, which should to be handled in another method (single responsibility). You are required to unset the existing fixed position prior to setting a new fixed position, so we'll need a updateFixedPosition method or named something else should be added in order to handle this use case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about that? I appears to me that just updating the position by a periodic setFixedPosition works
Screenshot_20250822_124046_Meshtastic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python client library implementation seems quite similar to ours, except that they support setting an altitude:
https://github.com/meshtastic/python/blob/2b10459db05e8a897e689c84b30ad145a25d2512/meshtastic/node.py#L794
They also have a removeFixedPosition, though. Should we follow suit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not seeing the logic mentioned in firmware itself. But maybe I'm not looking in the right place?
https://github.com/meshtastic/firmware/blob/093a37a2b0888934a1941bc3f9c525e80255b5da/src/modules/AdminModule.cpp#L368

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needing to clear the fixed position first is also mentioned in meshtastic/firmware#5747 (comment)
But as said, I'm so far not seeing the firmware code that would require this to happen.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll request someone confirm this assumption in the #contributor-lounge chat.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding removeFixedPosition makes sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added that, so this should be functionally equivalent to the Python library

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are set and remove fixed position admin message values, you have to remove the old value and disable the Boolean before setting a new value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both methods are implemented here. But as discussed here and on Discord, so far I haven't seen anything requiring removing the old value before setting new in the actual firmware

@danditomaso danditomaso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good PR, left a comment

@bergie bergie changed the title Method for setting fixed position Methods for setting/removing fixed position Aug 22, 2025
@danditomaso

Copy link
Copy Markdown
Collaborator

@bergie this looks like it's ready to go, but can you run pnpm -w run format:fix to format the files in this commit automatically. That will fix the remaining failing check required to get this PR merged

@bergie bergie force-pushed the set_fixed_position branch from 573f4e4 to cb40fd2 Compare August 24, 2025 16:39
@bergie

bergie commented Aug 24, 2025

Copy link
Copy Markdown
Contributor Author

@bergie this looks like it's ready to go, but can you run pnpm -w run format:fix to format the files in this commit automatically. That will fix the remaining failing check required to get this PR merged

Done. Had to rebase to get the correct formatter dependency.

@danditomaso danditomaso merged commit 85aa7a3 into meshtastic:main Aug 27, 2025
2 of 3 checks passed
bergie added a commit to meri-imperiumi/signalk-meshtastic that referenced this pull request Sep 4, 2025
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