mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-19 17:22:59 +00:00
* Refactor GPS to not probe if pins not defined * Use Named Constructor to clean up code * Move doGPSPowerSave to GPS class * Make sure to set GPS awake on triple-click * Cleanup and remove dead code * Rename GPS_PIN_WAKE to GPS_PIN_STANDBY * Actually put GPS to sleep between fixes * add GPS_POWER_TOGGLE for heltec-tracker and t-deck * Change GPS_THREAD_INTERVAL to 200 ms * More dead code, compiler warnings, and add returns * Add Number of sats to log output * Add pgs enable and triple-click config * Track average GPS fix time to judge low-power time * Feed PositionModule on GPS fix * Don't turn off the 3v3_s line on RAK4631 when the rotary is present. * Add GPS power standbyOnly option * Delay setting time currentQuality to avoid strange log message. * Typos, comments, and remove unused variable * Short-circuit the setAwake logic on GPS disable * heltec-tracker 0.3 GPS power saving * set en_gpio to defined state * Fix fixed_position logic with GPS disabled * Don't process GPS serial when not isAwake * Add quirk for Heltec Tracker GPS powersave --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: mverch67 <manuel.verch@gmx.de> Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com>
118 lines
4.1 KiB
C++
118 lines
4.1 KiB
C++
#include "configuration.h"
|
|
#include "input/InputBroker.h"
|
|
#include "input/RotaryEncoderInterruptImpl1.h"
|
|
#include "input/TrackballInterruptImpl1.h"
|
|
#include "input/UpDownInterruptImpl1.h"
|
|
#include "input/cardKbI2cImpl.h"
|
|
#include "input/kbMatrixImpl.h"
|
|
#include "modules/AdminModule.h"
|
|
#include "modules/CannedMessageModule.h"
|
|
#include "modules/DetectionSensorModule.h"
|
|
#include "modules/NeighborInfoModule.h"
|
|
#include "modules/NodeInfoModule.h"
|
|
#include "modules/PositionModule.h"
|
|
#include "modules/RemoteHardwareModule.h"
|
|
#include "modules/ReplyModule.h"
|
|
#include "modules/RoutingModule.h"
|
|
#include "modules/TextMessageModule.h"
|
|
#include "modules/TraceRouteModule.h"
|
|
#include "modules/WaypointModule.h"
|
|
#if HAS_TELEMETRY
|
|
#include "modules/Telemetry/DeviceTelemetry.h"
|
|
#endif
|
|
#if HAS_SENSOR
|
|
#include "modules/Telemetry/AirQualityTelemetry.h"
|
|
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
|
#endif
|
|
#ifdef ARCH_ESP32
|
|
#include "modules/esp32/AudioModule.h"
|
|
#include "modules/esp32/StoreForwardModule.h"
|
|
#endif
|
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
|
#include "modules/ExternalNotificationModule.h"
|
|
#include "modules/RangeTestModule.h"
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
|
#include "modules/SerialModule.h"
|
|
#endif
|
|
#endif
|
|
/**
|
|
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)
|
|
*/
|
|
void setupModules()
|
|
{
|
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
|
#if HAS_BUTTON
|
|
inputBroker = new InputBroker();
|
|
#endif
|
|
adminModule = new AdminModule();
|
|
nodeInfoModule = new NodeInfoModule();
|
|
positionModule = new PositionModule();
|
|
waypointModule = new WaypointModule();
|
|
textMessageModule = new TextMessageModule();
|
|
traceRouteModule = new TraceRouteModule();
|
|
neighborInfoModule = new NeighborInfoModule();
|
|
detectionSensorModule = new DetectionSensorModule();
|
|
|
|
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance
|
|
// to a global variable.
|
|
|
|
new RemoteHardwareModule();
|
|
new ReplyModule();
|
|
#if HAS_BUTTON
|
|
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
|
if (!rotaryEncoderInterruptImpl1->init()) {
|
|
delete rotaryEncoderInterruptImpl1;
|
|
rotaryEncoderInterruptImpl1 = nullptr;
|
|
}
|
|
upDownInterruptImpl1 = new UpDownInterruptImpl1();
|
|
if (!upDownInterruptImpl1->init()) {
|
|
delete upDownInterruptImpl1;
|
|
upDownInterruptImpl1 = nullptr;
|
|
}
|
|
cardKbI2cImpl = new CardKbI2cImpl();
|
|
cardKbI2cImpl->init();
|
|
#ifdef INPUTBROKER_MATRIX_TYPE
|
|
kbMatrixImpl = new KbMatrixImpl();
|
|
kbMatrixImpl->init();
|
|
#endif // INPUTBROKER_MATRIX_TYPE
|
|
#endif // HAS_BUTTON
|
|
#if HAS_TRACKBALL
|
|
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
|
trackballInterruptImpl1->init();
|
|
#endif
|
|
#if HAS_SCREEN
|
|
cannedMessageModule = new CannedMessageModule();
|
|
#endif
|
|
#if HAS_TELEMETRY
|
|
new DeviceTelemetryModule();
|
|
#endif
|
|
#if HAS_SENSOR
|
|
new EnvironmentTelemetryModule();
|
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_PMSA003I] > 0) {
|
|
new AirQualityTelemetryModule();
|
|
}
|
|
#endif
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
|
new SerialModule();
|
|
#endif
|
|
#ifdef ARCH_ESP32
|
|
// Only run on an esp32 based device.
|
|
audioModule = new AudioModule();
|
|
|
|
storeForwardModule = new StoreForwardModule();
|
|
#endif
|
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
|
externalNotificationModule = new ExternalNotificationModule();
|
|
new RangeTestModule();
|
|
#endif
|
|
} else {
|
|
adminModule = new AdminModule();
|
|
#if HAS_TELEMETRY
|
|
new DeviceTelemetryModule();
|
|
#endif
|
|
traceRouteModule = new TraceRouteModule();
|
|
}
|
|
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra
|
|
// acks
|
|
routingModule = new RoutingModule();
|
|
} |