Muzi Base SuperIO: GPS mode switch ignored at boot

Đang mở Phù hợp với người mới
#3,760 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
embedded-iot

Hướng nghiên cứu

Bắt đầu từ MuziBaseSensorManager::begin() và loop() trong variants/muzi_base/target.cpp, sau đó xem thứ tự khởi động của companion quanh applyGpsPrefs() trong examples/companion_radio/main.cpp. Thay đổi được đề xuất giữ _last_gps_sw ở -1, để loop() đầu tiên áp dụng vị trí công tắc sau khi các tùy chọn đã được đặt. Hoàn thành khi trang GPS hiển thị gps on sau khi khởi động lại với công tắc ở vị trí giữa, và bạn đã kiểm tra xem variants/thinknode_m1/target.cpp có cùng vấn đề thứ tự hay không. Cần có phần cứng để xác nhận bản sửa lỗi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
  1. Flash muzi_base_uno_superIO_companion_radio_ble (or the Duo equivalent).
  2. Set the mode switch to the middle position (GPS on).
  3. Power cycle the device.
  4. Open the GPS page on the display: it shows gps off(sw) instead of gps on.
  5. 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), env muzi_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

Ngôn ngữ chính
C
Star
3.9k
Fork
1.5k
Merge trung bình
2 ngày 20 giờ
Pull request đã merge (30 ngày)
36

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của meshcore-dev/MeshCore

Tất cả issue của meshcore-dev/MeshCore

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.