GPS initialization improvements, DBus refactoring - #3
Open
teal-bauer wants to merge 29 commits into
Open
Conversation
`HGET gps state` can have the following values: - `off` if gps is enabled - `searching` while a fix is being established - `fix-established` when a fix has been established - `error` if location services could not be enabled or GPS messages from gpsd could not be parsed
Update the publishModemState function to use the status field in the internet Redis hash key for the modem connection state, as requested in issue #4.
- Implement actual internet connectivity check using ping via the modem interface. - Update Redis 'internet' hash 'status' field based on ping result. - Refactor modem restart logic to handle GPIO errors and fall back to 'mmcli --reset' (addresses feedback related to #3).
Adds an 'error-state' field to the 'modem' hash in Redis. This field provides a single string indicating the primary error condition (e.g., no-modem, sim-missing, powered-off, ok) in kebab-case for easier consumption by other services like the DBC.
Add delays and retries when enabling the gps-unmanaged location source via mmcli. This aims to address potential timing issues on slower modems where the command might fail intermittently, especially after disabling other sources.
Now triggering modem recovery when internet connectivity check fails despite modem reporting as connected. This helps recover from situations where the modem thinks it's online but actual internet connectivity is down. Status is published as disconnected immediately before recovery attempts.
The modem-service now correctly populates the 'modem-state' key in the 'internet' Redis hash. This value is a direct reflection of the modem.State.Status field, providing values like 'connected', 'disconnected', 'off', 'no-modem', or 'UNKNOWN'.
Key changes: 1. __New GPS Filter (`internal/location/filter.go`):__ - Includes a Kalman filter for position and velocity. - Implements stationary detection based on speed and small position changes. - Smooths the course when the scooter is moving. 2. __Redis Integration (`internal/redis/redis.go`):__ - Added `PublishFilteredLocationState` to publish data to a new `gps:filtered` hash. 3. __Location Service Update (`internal/location/location.go`):__ - The `LocationService` now uses the `GPSFilter`. - It stores the `LastRawReportedLocation` to allow publishing both raw and filtered data. 4. __Main Service Update (`internal/service/service.go`):__ - The `monitorStatus` loop now calls `publishLocationState` with both raw (`s.Location.LastRawReportedLocation`) and filtered (`s.Location.CurrentLoc`) GPS data. - Raw data is published to the `gps` Redis hash. - Filtered data is published to the `gps:filtered` Redis hash. The system will now provide more stable speed and course readings, especially when stationary, and the Kalman filter will help smooth the track during motion. You can compare the `gps` and `gps:filtered` hashes in Redis to observe the filter's effect.
Change PUBLISH message from 'location-update' to 'timestamp' to match field name, triggering immediate refresh in ScootUI's SyncableCubit
- communicate with ModemManager via D-Bus instead of shell commands - add GPIO power control for modem - add USB recovery mechanism - configure GPS via AT commands (antenna voltage, XTRA assistance)
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.
Configures GPS auxiliary antenna voltage like unu-modem does, as well as configuring more detailed GPS parameters.
Changes
Instead of shelling out, use proper channels:
And improve modem configuration / recovery as per further analysis of OEM modem service:
Testing
Deployed and tested on device: