-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nav subcommand #33
Nav subcommand #33
Conversation
The fifth byte in a waypoint definition is 0xf0 for waypoints created on the device itself, but 0xff for waypoints created in Yaesu's PC software, YCE15. The radio seems to ignore the fifth byte altogether, so I'm not sure whether that difference was intentionally introduced by Yeasu, or if it was a mistake. Either way, both formats should be accepted by unpack_waypoint(). This change accomplishes that by simply ignoring the fifth byte, starting unpacking with the sixth byte, which contains the most significant digits of the latitude value. In order to be in line with Yeasu's own use, pack_waypoint() is changed to use 0xff for the fifth byte. This doesn't seem to matter one way or the other though.
A first step towards dumping/flashing navigation data. The code in nav.py is basically lifted straight from gpslog.py.
The current and previously used navigation targets are implemented as indices to the waypoint/route lists. After replacing these lists with new data, those indices are no longer usable and may put the radio in an inconsistent state. This change works around this issue by clearing the navigation status and history for data read from GPX.
Please correct me if I'm wrong, I am writing this from memory: The device contains two databases, a database of waypoints, and a database of routes which reference lists of waypoints in the waypoint database. We need to distinguish two types of waypoints, those which are referenced in routes, let's call them routepoints, and those which are not, let's keep calling those waypoints. On export, GPX can distinguish these by wrapping waypoints as individual GPX import then could have two modes, maybe:
If Dumb were default, activate Clever mode with a If Clever were default, fall back to Dumb mode with Am I missing something? |
That’s correct: Each route is simply a named and ordered list of references to waypoints.
Fundamentally, the issue is that (in this terminology) routepoints are a subtype of waypoints. In other words: Every routepoint is also a waypoint. It follows that there are two different kinds of routepoints in the HX870:
Making a distinction between these two is only possible if we know the user’s intention, which we don’t. Conceptually, I see three options to deal with this issue:
For starters, I went with option 3, simply because it is easiest. I suppose this technically introduces a bug, because route round-trip doesn’t exactly reproduce the device’s nav database, even though it should. But since handling waypoints is much more important than handling routes, I suggest option 3 will be a good enough improvement over the status quo to allow merging this PR once it’s ready for review. I don’t like option 2, because it makes Option 1 can be achieved in several ways, some of which I’ve already listed in #30 (comment). At this point, I’d tend towards introducing a custom GPX extension to represent the routepoint references (though I don’t yet know if The main problem with option 1 would be that any custom metadata that
Right. Removing all duplicate waypoints is one of the other possible approaches for option 1. While it doesn’t give us an exact reproduction of the device’s memory, it’ll likely come close enough in practice. |
This sounds perfectly reasonable, thanks for taking the time to explain it! What I don't understand, yet, is
Could elaborate where the problem lies? And regarding waypoints and routepoints...
I might be mistaken about the inner workings of popular GPX editors, but I'd expect that on import we may infer the user's intention from whether a Taking a step back, perhaps we agree that our objectives are to have backup capability and to spare the user from the pain of editing waypoints and routes on the device. The main workflows I see so far are:
Am I missing something? Perfect backup/restore can be achieved with a complete config backup, but I think we can make it work via GPX export as well. Looks like all we need is a way to restore the waypoint and route databases in their original order. Ideas here:
As far as I can see, the main decisions we need to make are
Both could be controlled with relatively simple command line options as long as the default doesn't get in the way of workflow 1. |
Perhaps an example helps clarifying that: Create a GPX file with no Repeat this often enough, and the user experience will suffer because of all the duplicates. Eventually
I can’t speak on popularity, but would expect that you are correct. However, in order to support round-trip, we need both export and import. And because the HX870’s data store is less expressive than GPX is, export is the more critical step here. Export is where the conversion from “by reference” to “by value” has to take place. Just to emphasise: Use cases that don’t involve round-trip of routes already work fine.
We do.
Right. Once again, I have already (albeit very briefly) mentioned these ideas over in #30 (comment). But I would like to focus on finishing this PR first. In my view, perfecting route round-trip should come at a later stage, if ever. In fact, I think there is a decent chance “option 3” may even work good enough in practice. I don’t really see routes as a frequently used feature of the radio. Waypoints, sure, there are clear use cases for those with the HX870 and I can see their utility. But entire routes, seriously? I personally think those are a bit of a stretch. (I’m asking the HX870 mailing list about this. May change my mind depending on what that turns up.)
In the general case: Both, or else data may be lost. Which use case, exactly, would a CLI option to control this behaviour support?
Detecting duplicates is but one of the possible approaches to “option 1”. Others avoid duplicates in the first place. BTW, detecting duplicates would in fact not result in a perfect round-trip in all cases, as the user may already have duplicates before we even start. Those would then be silently filtered by |
It seems I’ve forgotten about this branch for a long time. Sorry about that! Since earlier this year, a new tool called HxSync offers a web-based GUI for editing waypoints on the device. It connects to the radio using the Web Serial API. In addition to the GUI, it allows editing waypoints in a text-based YAML format. Visual editing of waypoints plotted on a nautical chart is planned. Given that, and the fact that this PR has been dormant for five years, I’m not very eager to continue working on this PR, the goal of which was to add a similar feature to hxtool. Closing the PR. That said, this branch does add GPX waypoint import/export to hxtool, which is a feature that I still consider to be useful (see also #1). GPX support is not currently available for HxSync. The code in this branch works fine, with the caveats already discussed above:
Should you be interested in merging this PR after all, please let me know. I could easily squash some of the commits, which might make your review a bit easier. |
Replacing all waypoints on the device with
--flash --erase
already works fine. Appending new waypoints without--erase
ing the existing data in the device will be added soon-ish.Routes are also supported, but round-trip HX870→GPX→HX870 doesn’t work so well, as already discussed in #30 (comment).