Commit Graph
29 Commits
Author SHA1 Message Date
Pieter ViljoenandClaude Opus 5 bb84f54191 drive every gps control line with logical gpio semantics
gps_power_control() mixed the two GPIO conventions on the same pins. It
configured lines with GPIO_OUTPUT_HIGH / GPIO_OUTPUT_LOW, which Zephyr defines
as physical levels, then drove the same lines with gpio_pin_set_dt(), which is
logical. On a line declared GPIO_ACTIVE_LOW those are opposite, so the first
call asserted the reverse of every call after it.

Two lines are actually broken by this.

gps-enable, on the boards declaring it active-low. Most of them reach the block
named for the T1000-E rather than the "simple boards" path, because
HAS_T1000_GPS_CONTROL is (HAS_GPS_VRTC || HAS_GPS_RESET || HAS_GPS_SLEEP) and a
bare gps-reset alias is enough to route a board there. That block drives the
enable physical HIGH unconditionally on every power-on, and power-off lands on
physical HIGH too, so the line is de-asserted in both states and the module is
never powered at all.

gps-reset, on the six boards declaring it active-low: heltec_t096, heltec_t1,
heltec_t114, thinknode_m1, heltec_wifi_lora32_v4 and _v43. The documented
power-on sequence is "assert reset, hold 10 ms, release", written as
GPIO_OUTPUT_HIGH then gpio_pin_set_dt(0). On an active-low line both of those
are physical HIGH, so the pulse never asserts and the module starts
uncontrolled -- the condition the power-off comment says this code prevents.
heltec_wifi_lora32_v4's overlay documented the no-op rather than fixing it;
that comment is updated here, with _v43's copy.

vrtc, sleep, rtcint and resetb are converted too. Every board declaring them is
active-high, so those change nothing today; they are converted so the root
cause does not survive in four more places.

Converting is safe by construction. gpio_pin_configure() flips the init level
only when both GPIO_OUTPUT_INIT_LOGICAL and GPIO_ACTIVE_LOW are set, then
strips INIT_LOGICAL, so on an active-high pin GPIO_OUTPUT_ACTIVE produces a
flags word byte-identical to GPIO_OUTPUT_HIGH. Behaviour changes only where a
line is declared active-low, which is only where it is currently wrong.

gps_power_off_for_shutdown() had the same inversion and it mattered most there:
on the active-low boards the old physical LOW asserted the enable, powering the
GPS on as the device entered System OFF rather than powering it down. Its
header comment also described a narrower scope than the function has, naming
only the power enable where it configures vrtc, reset, sleep, rtcint and
resetb as well; that is corrected here.

Comments that described a level this change now drives logically are reworded
to asserted/de-asserted. Comments stating genuine electrical facts, such as a
pin floating LOW without its pull-up, are left as they are, since rewording
those would make them wrong.

Verified on hardware on a Heltec V4-R8, whose gps-enable is active-low: with
this change the boot log reports "GPS power GPIO configured, set ACTIVE" and
the L76K streams NMEA (210 sentences in 35 s), where without it the log reports
"set HIGH" and the module never powers on. Also built for heltec_wifi_lora32_v4
and _v43 (active-low enable and reset), thinknode_m1 and heltec_t114
(active-low reset) and t1000_e (active-high throughout).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-19 10:10:30 -07:00
liquidraver 39b9584b20 .editorconfig and .gitattributes 2026-09-18 21:25:19 +02:00
liquidraver 9f66e9749c x1 debug v1 2026-08-10 08:32:43 +02:00
liquidraver c0b388d89f build fix 2026-08-05 14:13:29 +02:00
liquidraver d1093bfc5e gps "fiddling" v2 and some debug log fixes 2026-08-05 11:48:33 +02:00
liquidraver f83ce0bed4 gps fiddling 2026-08-04 16:04:05 +02:00
liquidraver aa14944a93 enable PM on ESP repeaters that support it 2026-07-30 17:14:05 +02:00
liquidraver 06a0b03a20 LR1110 duty cycle finally and zephyr PM vs UART wedge fixes 2026-07-25 11:27:25 +02:00
liquidraver 4001b3f130 GPS power management gates 2026-07-21 13:36:51 +02:00
liquidraver 1b9410df21 retry PM activation 2026-07-18 20:30:43 +02:00
liquidraver 3af781ee87 get rid of flash writes initiated by ZephyrGPSManager 2026-07-02 09:20:10 +02:00
liquidraver 989dd4b93e dont hammer flash with gps fixes 2026-07-01 22:37:11 +02:00
liquidraver 1cbddc64da gps fixes 2026-07-01 22:31:18 +02:00
liquidraver c4a1777956 refactor gps manager 2026-06-17 15:42:50 +02:00
liquidraver 533a2a7e4e first fix 5 min timeout for GPS to prevent battery drain 2026-06-17 14:52:00 +02:00
liquidraver 7b3716bd6a fix M1 GPS power control 2026-06-17 14:15:45 +02:00
liquidraver 4ec6f27202 password compare bug fix 2026-06-16 12:36:54 +02:00
liquidraver a9c797b837 guard GPS month_days[] index against out-of-range GNSS month (gps audit) 2026-06-11 13:30:01 +02:00
liquidraver 2ad185bab4 license "refactor" :) 2026-06-07 22:47:17 +02:00
liquidraver 65f31ced7d no permanent gps disable on repeaters 2026-05-06 10:11:09 +02:00
liquidraver c9b6d6bded disable GPS cycle until reboot if no GNSS messages present 2026-04-28 13:49:08 +02:00
liquidraver 57aab5f522 GPS start fix when requesting telemetry
APC disabled by default, but compiled in
2026-04-24 22:32:05 +02:00
liquidraver a5e5fcbb74 fix 0,0 lat/lon save to prefs as valid position, sorry people on a boat off the coast of Ghana with a very precise GPS hardware 2026-04-23 08:23:01 +02:00
liquidraver de4bcd9a52 clear first_fix_acquired on gps off, increase timeout to 120 sec 2026-04-21 14:41:56 +02:00
liquidraver a716d2478f port seeed solar p1 + gps command fixes 2026-04-13 11:48:34 +02:00
liquidraver a1dddbea75 Repeater GPS: separate advert vs telemetry position, persist last fix
GPS fixes no longer overwrite prefs lat/lon — adverts use only
manually-set coordinates (via gps setloc or companion app)

Precise GPS position served via telemetry requests only
getNodeLat()/getNodeLon() returns live GPS fix

Last good fix persisted to /lfs/gps_pos — survives reboots

| Command | Description |
|---------|-------------|
| `gps` | Show GPS status (`on` or `off`) |
| `gps on` | Enable GPS module |
| `gps off` | Disable GPS module |
| `gps setloc` | Update stored latitude/longitude from current GPS fix |
| `gps advert` | Show current location advertising policy |
| `gps advert none` | Do not include location in advertisements |
| `gps advert share` | Include live GPS location in advertisements |
| `gps advert prefs` | Include stored lat/lon from prefs in advertisements |
2026-04-01 11:06:09 +02:00
liquidraver 3b7434be4c unify conf + clean up prod builds 2026-02-24 16:27:07 +01:00
liquidraver 6c7d52e725 t1000 gps fix 2026-02-24 15:50:11 +01:00
liquidraver 8d1823d0b6 First iteration that seems to work 2026-02-20 12:43:13 +01:00