Add GPS support for SenseCap Solar variant - #1314
Conversation
|
My SenseCap P1 Pro is now running a build of this PR. GPS works, giving me location and time. I do not have a BME280 I think (at least, I did not add one myself - I get a temperature reading but not humidity). Thank you! |
Thank you for testing! Much appreciated. To the repo maintainers, if any changes are needed, let me know. |
|
I've also installed it, and I'm getting a proper lock on satellites, time, and position. Turning it off with GPS on/off also works. Now I just need to find someone who can fix the PWR on/off button :) |
|
I wonder (and I can't compare to before - this GPS patched build is the first thing I installed after unpacking my sensecap) if getting location + time at some frequency (don't know how often this happens) is drawing too much power for the panel+battery to keep up in this winter weather. |
|
Based on the discussion in #1353 I will likely remove the GPS from my SenseCap. Of course this PR is still useful - some people may have a different power setup, or want the GPS because their SenseCap is on a boat or something. In a build with this PR, if GPS is not turned on, does the GPS still draw power? |
I guess
answers that! |
|
I also haven't really looked at how much more this requires from the battery. And with the changeable weather here, it is also difficult to measure. But with GPS switched on, I can easily get more than a week of uptime without sun. And charging when the sun shines on it is actually quite fast. |
|
GPS enabled is working well for me here at 50 degrees north, panel is still keeping up with charging the batteries despite some days of cloud and trees shading the unit parts of the day. Happy to have the clock set automatically now. |
|
Are you sure it's actually setting the clock automatically outside of an explicit |
|
Yup. It pulls the time from the gps. |
|
why hasn't this been merged yet? It works great! |
|
Rebased this locally on top of 1.12.0 and it works great. |
5ff7072 to
dd1e296
Compare
PR #1314 – Comment (follow-up)Follow-up (branch updated):
No change to GPS behavior; only version bump, alias removal, and fix for LED naming/defines. Users who want working buttons to activate/deactivate GPS, send advert, or power down the solar node can use the branch: feature/sensecap-headless-btn-led. We are not opening a PR for that branch yet, as it introduces more extensive changes to source libraries and shared files. |
|
the only problem I have with this PR is that GPS does not power off itself after getting the correct time. repeater should never move, so it doesn't make much sense to keep it on all the time. |
|
Who cares? You can turn it off manually or leave it on. Not like it uses a lot of energy. There are mobile repeaters too.. which would need it on. |
I care. |
|
I get that, but that behaviour you want isn't implemented in any of the devices currently. |
I appreciate and understand your feedback. We can implement a new Another question we should also ask ourself is; do we want it to autostart GPS on reboot or not. Is this the right direction? |
My idea was to keep the gps flag unchanged after fix/sync/shutdown, promising to always sync clock after reboot. only not doing anything with gps if gps is set to off. |
|
@recrof So the plan is more to have a power-save option: when GPS is on (per the setting), we get a fix, sync the clock, then power down the GPS to save current. We keep the We can do it without big changes (e.g. an extra flag for the build), but then we have “user wants GPS on” vs “hardware is actually on or off” — they can diverge. And as you've seen with @dowjames ' reply, it doesn't fit for everyone. Needs a bit of thinking in settings, and we might add something like Give me a couple of days to let this sync in and find a good approach. In the meantime I’ve pushed what I have (a bit more heavy-handed than I’d like). In b7d71cb and 99454dc: with |
|
thanks @Confituurke, makes sense. |
|
Something interesting could also be to work on a way to sync the clock by turning the GPS on once a day or something like that to correct time drift due to the powersaving modes.
|
the main problem with this is: you can't set time backwards as it breaks timers and statistics. we would need complete overhaul of how time is stored/used in MC for this to be viable. right now, if you set the time that is in past, board needs to be rebooted. |
2ff6a85 to
c53c5b0
Compare
- Enable GPS support (L76KB module) via ENV_INCLUDE_GPS - Add GPS pin definitions (TX, RX, EN, STANDBY) to platformio.ini - Use EnvironmentSensorManager to support both GPS and BME280 sensors - Add MicroNMEA library dependency for GPS parsing - Configure GPS baudrate to 9600 - Initialize GPS enable pin in variant.cpp - GPS can be enabled/disabled via device settings
086dd5f to
f358a3b
Compare
|
Closing this PR since the same approach was merged in #1589. We will open a new PR for the GPS power-saving feature (boot-only mode for repeaters). |
This PR adds GPS support for the SenseCap Solar variant using the L76KB GPS module.
Changes
ENV_INCLUDE_GPSflag in platformio.iniGPS_BAUD_RATEin variant.h for EnvironmentSensorManager (Serial1 baud rate)PIN_GPS_ENinstead ofGPS_ENin variant.h for consistency with other GPS pins and variantsgps offpowers down the module to save currentHardware
Testing