2021-06-27 17:56:28 +00:00
|
|
|
#include "configuration.h"
|
2022-01-13 13:06:10 +00:00
|
|
|
#include "input/InputBroker.h"
|
|
|
|
#include "input/RotaryEncoderInterruptImpl1.h"
|
2022-03-26 16:45:42 +00:00
|
|
|
#include "input/UpDownInterruptImpl1.h"
|
2022-03-28 14:55:58 +00:00
|
|
|
#include "input/cardKbI2cImpl.h"
|
2022-02-27 08:18:35 +00:00
|
|
|
#include "modules/AdminModule.h"
|
|
|
|
#include "modules/CannedMessageModule.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"
|
2022-12-05 19:38:06 +00:00
|
|
|
#include "modules/TraceRouteModule.h"
|
2022-08-22 21:41:23 +00:00
|
|
|
#include "modules/WaypointModule.h"
|
2022-07-31 12:11:47 +00:00
|
|
|
#if HAS_TELEMETRY
|
2022-08-22 21:41:23 +00:00
|
|
|
#include "modules/Telemetry/DeviceTelemetry.h"
|
2022-03-27 14:55:35 +00:00
|
|
|
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
2022-01-23 16:05:39 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifdef ARCH_ESP32
|
2023-01-21 13:34:29 +00:00
|
|
|
#include "modules/esp32/AudioModule.h"
|
2022-02-27 09:27:17 +00:00
|
|
|
#include "modules/esp32/RangeTestModule.h"
|
|
|
|
#include "modules/esp32/StoreForwardModule.h"
|
2022-11-02 17:23:41 +00:00
|
|
|
#endif
|
2022-08-23 18:16:20 +00:00
|
|
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52)
|
|
|
|
#include "modules/ExternalNotificationModule.h"
|
2022-12-22 16:43:55 +00:00
|
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
2022-09-12 08:08:32 +00:00
|
|
|
#include "modules/SerialModule.h"
|
2022-08-23 18:16:20 +00:00
|
|
|
#endif
|
2022-09-12 08:53:11 +00:00
|
|
|
#endif
|
2021-01-08 05:15:49 +00:00
|
|
|
/**
|
2022-02-27 08:29:05 +00:00
|
|
|
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)
|
2021-01-08 05:15:49 +00:00
|
|
|
*/
|
2022-02-27 09:49:24 +00:00
|
|
|
void setupModules()
|
2021-01-17 06:27:33 +00:00
|
|
|
{
|
2023-01-28 15:18:06 +00:00
|
|
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
2022-07-31 12:11:47 +00:00
|
|
|
#if HAS_BUTTON
|
2023-01-28 15:18:06 +00:00
|
|
|
inputBroker = new InputBroker();
|
2022-07-31 12:11:47 +00:00
|
|
|
#endif
|
2023-01-28 15:18:06 +00:00
|
|
|
adminModule = new AdminModule();
|
|
|
|
nodeInfoModule = new NodeInfoModule();
|
|
|
|
positionModule = new PositionModule();
|
|
|
|
waypointModule = new WaypointModule();
|
|
|
|
textMessageModule = new TextMessageModule();
|
|
|
|
traceRouteModule = new TraceRouteModule();
|
2023-01-21 13:34:29 +00:00
|
|
|
|
2023-01-28 15:18:06 +00: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 05:15:49 +00:00
|
|
|
|
2023-01-28 15:18:06 +00:00
|
|
|
new RemoteHardwareModule();
|
|
|
|
new ReplyModule();
|
2022-07-31 12:11:47 +00:00
|
|
|
#if HAS_BUTTON
|
2023-01-28 15:18:06 +00:00
|
|
|
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
|
|
|
rotaryEncoderInterruptImpl1->init();
|
|
|
|
upDownInterruptImpl1 = new UpDownInterruptImpl1();
|
|
|
|
upDownInterruptImpl1->init();
|
|
|
|
cardKbI2cImpl = new CardKbI2cImpl();
|
|
|
|
cardKbI2cImpl->init();
|
2022-07-31 12:11:47 +00:00
|
|
|
#endif
|
|
|
|
#if HAS_SCREEN
|
2023-01-28 15:18:06 +00:00
|
|
|
cannedMessageModule = new CannedMessageModule();
|
2022-05-06 13:41:37 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#if HAS_TELEMETRY
|
2023-01-28 15:18:06 +00:00
|
|
|
new DeviceTelemetryModule();
|
|
|
|
new EnvironmentTelemetryModule();
|
2022-01-23 16:05:39 +00:00
|
|
|
#endif
|
2022-12-22 16:43:55 +00:00
|
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
2023-01-28 15:18:06 +00:00
|
|
|
new SerialModule();
|
2022-10-14 16:38:56 +00:00
|
|
|
#endif
|
2022-07-31 12:11:47 +00:00
|
|
|
#ifdef ARCH_ESP32
|
2023-01-28 15:18:06 +00:00
|
|
|
// Only run on an esp32 based device.
|
|
|
|
audioModule = new AudioModule();
|
|
|
|
externalNotificationModule = new ExternalNotificationModule();
|
2021-02-14 21:31:11 +00:00
|
|
|
|
2023-01-28 15:18:06 +00:00
|
|
|
storeForwardModule = new StoreForwardModule();
|
2021-02-14 21:31:11 +00:00
|
|
|
|
2023-01-28 15:18:06 +00:00
|
|
|
new RangeTestModule();
|
2022-08-22 21:41:23 +00:00
|
|
|
#elif defined(ARCH_NRF52)
|
2023-01-28 15:18:06 +00:00
|
|
|
externalNotificationModule = new ExternalNotificationModule();
|
2021-01-17 06:27:33 +00:00
|
|
|
#endif
|
2023-01-28 15:18:06 +00:00
|
|
|
} else {
|
|
|
|
adminModule = new AdminModule();
|
2023-01-29 15:37:02 +00:00
|
|
|
traceRouteModule = new TraceRouteModule();
|
2023-01-28 15:18:06 +00:00
|
|
|
}
|
2023-01-29 15:37:02 +00: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 15:18:06 +00:00
|
|
|
routingModule = new RoutingModule();
|
2022-03-31 21:27:55 +00:00
|
|
|
}
|