Muzi Base SuperIO: GPS mode switch ignored at boot
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- embedded-iot
Research direction
Start in MuziBaseSensorManager::begin() and loop() in variants/muzi_base/target.cpp, then the companion's startup order around applyGpsPrefs() in examples/companion_radio/main.cpp. The proposed change leaves _last_gps_sw at -1 so the first loop() applies the switch position after prefs are set. Done means the GPS page reads gps on after a power cycle with the switch in the middle position, and you have checked whether variants/thinknode_m1/target.cpp has the same ordering problem. Hardware is needed to confirm the fix.
Written by the indexing model from the issue text.
Description
Description
On the Muzi Base (Uno/Duo) with the SuperIO, the companion firmware ignores the 3-position mode switch when the device boots. If the switch is already in the GPS position (Mode 2, middle) at power-on, GPS stays off. It only turns on after the switch is moved away and back.
Meshtastic uses the same switch for GPS on/off: SWITCH_MODE2 (P0.12, middle position) is defined as PIN_GPS_SWITCH[^1]. The SuperIO docs list the GPS module as part of the board[^2].
Cause
MuziBaseSensorManager::begin() reads the switch and calls start_gps()/stop_gps()[^3]. But in the companion, sensors.begin() is followed right away by the_mesh.applyGpsPrefs()[^4], which sets GPS from the saved gps_enabled pref (off by default). That overrides the switch state.
After that, loop() only reacts when the switch changes[^5], so the initial position is never applied again.
Steps to reproduce
- Flash
muzi_base_uno_superIO_companion_radio_ble(or the Duo equivalent). - Set the mode switch to the middle position (GPS on).
- Power cycle the device.
- Open the GPS page on the display: it shows
gps off(sw)instead ofgps on. - Move the switch away and back: GPS turns on.
Proposed fix
Let the first loop() apply the switch position, so it runs after applyGpsPrefs():
--- a/variants/muzi_base/target.cpp
+++ b/variants/muzi_base/target.cpp
@@ bool MuziBaseSensorManager::begin() {
pinMode(PIN_GPS_SWITCH, INPUT);
- _last_gps_sw = digitalRead(PIN_GPS_SWITCH); // initial gps state from the switch
- if (_last_gps_sw == HIGH) start_gps(); else stop_gps();
+ // leave _last_gps_sw at -1 so the first loop() applies the switch position.
+ // applying it here would be overridden by applyGpsPrefs(), which the
+ // companion runs right after sensors.begin().
+ _last_gps_sw = -1;
The ThinkNode M1 uses the same pattern (variants/thinknode_m1/target.cpp) and may have the same problem.
Environment
- Board: Muzi Base Uno + SuperIO
- Firmware:
main@ 81dbae5 (v1.18.0), envmuzi_base_uno_superIO_companion_radio_ble
[^1]: Meshtastic muzi_base variant, mode switch pins: https://github.com/meshtastic/firmwa6fdd4cd659498d28d8bd153/variants/nrf52840/muzi_base/variant.h#L64-L66
[^2]: Meshtastic docs, muzi ᴡᴏʀᴋꜱ Super IO: https://meshtastic.org/docs/hardware/devices/muziworks/muzi-base/super-io/
[^3]: https://github.com/meshcore-dev/MeshCore/blob/81dbae592ffad40b4212bc0b37e82b38da08f4bct.cpp#L44-L45
[^4]: https://github.com/meshcore-dev/MeshCore/blob/81dbae592ffad40b4212bc0b37e82b38da08f4bc/examples/companion_radio/main.cpp#L278-L281
[^5]: https://github.com/meshcore-dev/MeshCore/blob/81dbae592ffad40b4212bc0b37e82b38da08f4bc/variants/muzi_base/target.cpp#L63-L65
- Dominant language
- C
- Stars
- 3.9k
- Forks
- 1.5k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 36
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from meshcore-dev/MeshCore
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
meshcore-dev/MeshCore#3698 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
meshcore-dev/MeshCore#3622 ·
Maintainers usually reply within 1 day
-
[Feature Request] Set Australia (Mid) Preset to automatically enable 2 byte default path hash sizeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
meshcore-dev/MeshCore#3571 · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
meshcore-dev/MeshCore#3567 · 1 comment ·
Maintainers usually reply within 1 day
-
RTC_RX8130CE writes and reads the one-hot WEEK register as a numberPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
meshcore-dev/MeshCore#3549 ·
Maintainers usually reply within 1 day
All issues in meshcore-dev/MeshCore
Similar issues
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ly05010419/MacNativeGames#1697 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
colbymchenry/codegraph#3228 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
FujiNetWIFI/fujinet-config#372 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
aminya/project_options#303 ·