Files
MeshCore/variants/muzi_base/target.h
T
Níckolas Goline 22ce208e68 muzi_base: fix GPS UART pins and re-enable ATGM336H NMEA output
The refactor no longer calls Serial1.setPins() on nRF52, so Serial1 uses
PIN_SERIAL1_RX/TX directly. Those were swapped (the GPS transmits on
P0.20), so no data was received. Fix them and define PIN_GPS_TX/RX by the
gps module's side, as other variants do.

The ATGM336H keeps its NMEA output config across power cycles, and other
firmware may leave every sentence disabled. Re-enable GGA + RMC after each
power-up.
2026-11-08 08:47:34 -04:00

65 lines
2.0 KiB
C++

#pragma once
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include "MuziBaseBoard.h"
#if defined(USE_LR1121)
#include <helpers/radiolib/CustomLR1121Wrapper.h>
#elif defined(USE_SX1262)
#include <helpers/radiolib/CustomSX1262Wrapper.h>
#else
#error "muzi_base: no radio selected (define USE_LR1121 or USE_SX1262)"
#endif
#include <helpers/ArduinoHelpers.h>
#include <helpers/SensorManager.h>
#include <helpers/sensors/LocationProvider.h>
#include <helpers/AutoDiscoverRTCClock.h>
#include <helpers/sensors/EnvironmentSensorManager.h> // Added: Include for EnvironmentSensorManager
#include <helpers/ui/MomentaryButton.h>
#ifdef MUZI_BASE_SUPERIO
#include <helpers/ui/SH1107Display.h>
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
extern MomentaryButton joystick_left;
extern MomentaryButton joystick_right;
extern MomentaryButton back_btn;
#elif defined(DISPLAY_CLASS)
#include "helpers/ui/NullDisplayDriver.h"
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
#endif
extern MuziBaseBoard board;
extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock;
// muzi sensor manager, polled from main loop via sensors.loop():
// - user button: USER_BTN_POWER_OFF_CLICKS quick presses -> power off (all builds)
// gps mode is now handled by GpsDriver on superIO
class MuziBaseSensorManager : public EnvironmentSensorManager {
unsigned long _pwr_last_click = 0;
uint8_t _pwr_clicks = 0;
#if ENV_INCLUDE_GPS
unsigned long _gps_cfg_at = 0;
bool _gps_was_active = false;
#endif
public:
#if ENV_INCLUDE_GPS
MuziBaseSensorManager(LocationProvider& location) : EnvironmentSensorManager(location) {}
#else
MuziBaseSensorManager() {}
#endif
bool begin() override;
void loop() override;
};
extern MuziBaseSensorManager sensors;
bool radio_init();
uint32_t radio_get_rng_seed();
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
void radio_set_tx_power(int8_t dbm);
mesh::LocalIdentity radio_new_identity();