Files
MeshCore/variants/muzi_base/target.h
T
TJ Downes 798ce636df Address review feedback on Muzi Base support
- rename the board class and files to MuziBaseBoard
- uppercase the build flags (MUZI_BASE, MUZI_BASE_SUPERIO)
- name the superIO envs muzi_base_{duo,uno}_superIO_companion_radio_ble so
  build.sh picks them up
- set MAX_CONTACTS to 350 like the other variants
- move the pin setup from initVariant() into MuziBaseBoard::begin()
2026-09-19 21:47:24 -07: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 switch on/off (superIO only, see thinknode_m1)
class MuziBaseSensorManager : public EnvironmentSensorManager {
unsigned long _pwr_last_click = 0;
uint8_t _pwr_clicks = 0;
#if ENV_INCLUDE_GPS
int _last_gps_sw = -1;
unsigned long _next_sw_check = 0;
#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();