2021-06-27 10:56:28 -07:00
|
|
|
#include "configuration.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_INPUTBROKER
|
2022-01-13 14:06:10 +01:00
|
|
|
#include "input/InputBroker.h"
|
|
|
|
|
#include "input/RotaryEncoderInterruptImpl1.h"
|
2023-07-30 14:51:26 +02:00
|
|
|
#include "input/TrackballInterruptImpl1.h"
|
2022-03-26 17:45:42 +01:00
|
|
|
#include "input/UpDownInterruptImpl1.h"
|
2022-03-28 16:55:58 +02:00
|
|
|
#include "input/cardKbI2cImpl.h"
|
2023-08-07 19:34:42 +02:00
|
|
|
#include "input/kbMatrixImpl.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2022-02-27 00:18:35 -08:00
|
|
|
#include "modules/AdminModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_ATAK
|
2024-02-09 20:31:10 -06:00
|
|
|
#include "modules/AtakPluginModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
2022-02-27 00:18:35 -08:00
|
|
|
#include "modules/CannedMessageModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_DETECTIONSENSOR
|
2023-08-14 19:00:51 -05:00
|
|
|
#include "modules/DetectionSensorModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_NEIGHBORINFO
|
2023-05-31 13:18:09 +02:00
|
|
|
#include "modules/NeighborInfoModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2022-02-27 00:18:35 -08:00
|
|
|
#include "modules/NodeInfoModule.h"
|
|
|
|
|
#include "modules/PositionModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_REMOTEHARDWARE
|
2022-02-27 00:18:35 -08:00
|
|
|
#include "modules/RemoteHardwareModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2022-02-27 00:18:35 -08:00
|
|
|
#include "modules/RoutingModule.h"
|
|
|
|
|
#include "modules/TextMessageModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
2022-12-05 20:38:06 +01:00
|
|
|
#include "modules/TraceRouteModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_WAYPOINT
|
2022-08-22 16:41:23 -05:00
|
|
|
#include "modules/WaypointModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2024-01-12 02:00:31 -06:00
|
|
|
#if ARCH_PORTDUINO
|
2023-12-12 20:27:31 -06:00
|
|
|
#include "input/LinuxInputImpl.h"
|
|
|
|
|
#endif
|
2022-07-31 07:11:47 -05:00
|
|
|
#if HAS_TELEMETRY
|
2022-08-22 16:41:23 -05:00
|
|
|
#include "modules/Telemetry/DeviceTelemetry.h"
|
2023-02-11 10:08:25 +01:00
|
|
|
#endif
|
2024-03-11 13:52:46 +01:00
|
|
|
#if HAS_SENSOR && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
2023-02-11 10:08:25 +01:00
|
|
|
#include "modules/Telemetry/AirQualityTelemetry.h"
|
2023-02-11 11:46:54 +01:00
|
|
|
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
2022-01-23 10:05:39 -06:00
|
|
|
#endif
|
2024-03-11 13:52:46 +01:00
|
|
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_POWER_TELEMETRY
|
2023-11-04 19:07:00 -06:00
|
|
|
#include "modules/Telemetry/PowerTelemetry.h"
|
|
|
|
|
#endif
|
2022-07-31 07:11:47 -05:00
|
|
|
#ifdef ARCH_ESP32
|
2024-03-05 14:50:52 +01:00
|
|
|
#if defined(USE_SX1280) && !MESHTASTIC_EXCLUDE_AUDIO
|
2023-01-21 14:34:29 +01:00
|
|
|
#include "modules/esp32/AudioModule.h"
|
2023-12-17 16:00:57 +01:00
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
2023-12-17 16:00:57 +01:00
|
|
|
#include "modules/esp32/PaxcounterModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
2022-02-27 01:27:17 -08:00
|
|
|
#include "modules/esp32/StoreForwardModule.h"
|
2022-11-02 18:23:41 +01:00
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2023-07-29 14:19:58 +02:00
|
|
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
2022-08-23 13:16:20 -05:00
|
|
|
#include "modules/ExternalNotificationModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
2023-05-31 20:08:32 -05:00
|
|
|
#include "modules/RangeTestModule.h"
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2023-09-26 12:45:34 +02:00
|
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_SERIAL
|
2022-09-12 10:08:32 +02:00
|
|
|
#include "modules/SerialModule.h"
|
2022-08-23 13:16:20 -05:00
|
|
|
#endif
|
2022-09-12 10:53:11 +02:00
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2021-01-08 13:15:49 +08:00
|
|
|
/**
|
2022-02-27 00:29:05 -08:00
|
|
|
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)
|
2021-01-08 13:15:49 +08:00
|
|
|
*/
|
2022-02-27 01:49:24 -08:00
|
|
|
void setupModules()
|
2021-01-16 22:27:33 -08:00
|
|
|
{
|
2023-01-28 09:18:06 -06:00
|
|
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
2024-03-05 14:50:52 +01:00
|
|
|
#if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
2023-01-28 09:18:06 -06:00
|
|
|
inputBroker = new InputBroker();
|
2022-07-31 07:11:47 -05:00
|
|
|
#endif
|
2023-01-28 09:18:06 -06:00
|
|
|
adminModule = new AdminModule();
|
|
|
|
|
nodeInfoModule = new NodeInfoModule();
|
|
|
|
|
positionModule = new PositionModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_WAYPOINT
|
2023-01-28 09:18:06 -06:00
|
|
|
waypointModule = new WaypointModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2023-01-28 09:18:06 -06:00
|
|
|
textMessageModule = new TextMessageModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
2023-01-28 09:18:06 -06:00
|
|
|
traceRouteModule = new TraceRouteModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_NEIGHBORINFO
|
2023-06-06 21:07:12 +02:00
|
|
|
neighborInfoModule = new NeighborInfoModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_DETECTIONSENSOR
|
2023-08-14 19:00:51 -05:00
|
|
|
detectionSensorModule = new DetectionSensorModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_ATAK
|
2024-02-09 20:31:10 -06:00
|
|
|
atakPluginModule = new AtakPluginModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2023-01-28 09:18:06 -06:00
|
|
|
// 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.
|
2021-01-08 13:15:49 +08:00
|
|
|
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_REMOTEHARDWARE
|
2023-01-28 09:18:06 -06:00
|
|
|
new RemoteHardwareModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2024-03-02 07:21:53 -06:00
|
|
|
// Example: Put your module here
|
|
|
|
|
// new ReplyModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
2023-01-28 09:18:06 -06:00
|
|
|
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
2023-09-23 23:45:35 -05:00
|
|
|
if (!rotaryEncoderInterruptImpl1->init()) {
|
|
|
|
|
delete rotaryEncoderInterruptImpl1;
|
|
|
|
|
rotaryEncoderInterruptImpl1 = nullptr;
|
|
|
|
|
}
|
2023-01-28 09:18:06 -06:00
|
|
|
upDownInterruptImpl1 = new UpDownInterruptImpl1();
|
2023-09-23 23:45:35 -05:00
|
|
|
if (!upDownInterruptImpl1->init()) {
|
|
|
|
|
delete upDownInterruptImpl1;
|
|
|
|
|
upDownInterruptImpl1 = nullptr;
|
|
|
|
|
}
|
2023-01-28 09:18:06 -06:00
|
|
|
cardKbI2cImpl = new CardKbI2cImpl();
|
|
|
|
|
cardKbI2cImpl->init();
|
2023-08-07 19:57:47 +02:00
|
|
|
#ifdef INPUTBROKER_MATRIX_TYPE
|
2023-08-07 19:34:42 +02:00
|
|
|
kbMatrixImpl = new KbMatrixImpl();
|
|
|
|
|
kbMatrixImpl->init();
|
2023-08-07 19:57:47 +02:00
|
|
|
#endif // INPUTBROKER_MATRIX_TYPE
|
|
|
|
|
#endif // HAS_BUTTON
|
2024-01-12 02:00:31 -06:00
|
|
|
#if ARCH_PORTDUINO
|
2023-12-12 20:27:31 -06:00
|
|
|
aLinuxInputImpl = new LinuxInputImpl();
|
|
|
|
|
aLinuxInputImpl->init();
|
|
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
2023-07-30 14:51:26 +02:00
|
|
|
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
|
|
|
|
trackballInterruptImpl1->init();
|
|
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
2023-01-28 09:18:06 -06:00
|
|
|
cannedMessageModule = new CannedMessageModule();
|
2022-05-06 15:41:37 +02:00
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
2023-01-28 09:18:06 -06:00
|
|
|
new DeviceTelemetryModule();
|
2023-02-11 10:08:25 +01:00
|
|
|
#endif
|
2024-03-11 13:52:46 +01:00
|
|
|
#if HAS_SENSOR && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
2023-01-28 09:18:06 -06:00
|
|
|
new EnvironmentTelemetryModule();
|
2023-10-15 02:33:45 +02:00
|
|
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_PMSA003I].first > 0) {
|
2023-02-04 13:07:14 -06:00
|
|
|
new AirQualityTelemetryModule();
|
|
|
|
|
}
|
2022-01-23 10:05:39 -06:00
|
|
|
#endif
|
2024-03-11 13:52:46 +01:00
|
|
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_POWER_TELEMETRY
|
2023-11-04 19:07:00 -06:00
|
|
|
new PowerTelemetryModule();
|
|
|
|
|
#endif
|
2023-09-26 12:45:34 +02:00
|
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && \
|
|
|
|
|
!defined(CONFIG_IDF_TARGET_ESP32C3)
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_SERIAL
|
2023-01-28 09:18:06 -06:00
|
|
|
new SerialModule();
|
2022-10-14 11:38:56 -05:00
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2022-07-31 07:11:47 -05:00
|
|
|
#ifdef ARCH_ESP32
|
2023-01-28 09:18:06 -06:00
|
|
|
// Only run on an esp32 based device.
|
2024-03-05 14:50:52 +01:00
|
|
|
#if defined(USE_SX1280) && !MESHTASTIC_EXCLUDE_AUDIO
|
2023-01-28 09:18:06 -06:00
|
|
|
audioModule = new AudioModule();
|
2023-12-17 16:00:57 +01:00
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
2023-01-28 09:18:06 -06:00
|
|
|
storeForwardModule = new StoreForwardModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
2023-12-17 16:00:57 +01:00
|
|
|
paxcounterModule = new PaxcounterModule();
|
2023-05-31 20:08:32 -05:00
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2023-07-29 14:19:58 +02:00
|
|
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
2023-01-28 09:18:06 -06:00
|
|
|
externalNotificationModule = new ExternalNotificationModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
2023-05-31 20:08:32 -05:00
|
|
|
new RangeTestModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2021-01-16 22:27:33 -08:00
|
|
|
#endif
|
2023-01-28 09:18:06 -06:00
|
|
|
} else {
|
|
|
|
|
adminModule = new AdminModule();
|
2023-08-01 16:18:10 -05:00
|
|
|
#if HAS_TELEMETRY
|
|
|
|
|
new DeviceTelemetryModule();
|
|
|
|
|
#endif
|
2024-03-05 14:50:52 +01:00
|
|
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
2023-01-29 16:37:02 +01:00
|
|
|
traceRouteModule = new TraceRouteModule();
|
2024-03-05 14:50:52 +01:00
|
|
|
#endif
|
2023-01-28 09:18:06 -06:00
|
|
|
}
|
2023-01-29 16:37:02 +01:00
|
|
|
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra
|
|
|
|
|
// acks
|
2023-01-28 09:18:06 -06:00
|
|
|
routingModule = new RoutingModule();
|
2023-07-29 14:19:58 +02:00
|
|
|
}
|