* Turn off vscode cmake prompt - we don't use cmake on meshtastic * Add rak4631_dap variant for debugging with NanoDAP debug probe device. * The rak device can also run freertos (which is underneath nrf52 arduino) * Add semihosting support for nrf52840 devices Initial platformio.ini file only supports rak4630 Default to non TCP for the semihosting log output for now... Fixes https://github.com/meshtastic/firmware/issues/4135 * powermon WIP (for https://github.com/meshtastic/firmware/issues/4136 ) * oops - mean't to mark the _dbg variant as an 'extra' board. * powermon wip * Make serial port on wio-sdk-wm1110 board work By disabling the (inaccessible) adafruit USB * Instrument (radiolib only for now) lora for powermon per https://github.com/meshtastic/firmware/issues/4136 * powermon gps support https://github.com/meshtastic/firmware/issues/4136 * Add CPU deep and light sleep powermon states https://github.com/meshtastic/firmware/issues/4136 * Change the board/swversion bootstring so it is a new "structured" log msg. * powermon wip * add example script for getting esp S3 debugging working Not yet used but I didn't want these nasty tricks to get lost yet. * Add PowerMon reporting for screen and bluetooth pwr. * make power.powermon_enables config setting work. * update to latest protobufs * fix bogus shellcheck warning * make powermon optional (but default enabled because tiny and no runtime impact) * tell vscode, if formatting, use whatever our trunk formatter wants without this flag if the user has set some other formatter (clang) in their user level settings, it will be looking in the wrong directory for the clang options (we want the options in .trunk/clang) Note: formatOnSave is true in master, which means a bunch of our older files are non compliant and if you edit them it will generate lots of formatting related diffs. I guess I'll start letting that happen with my future commits ;-). * add PowerStress module * nrf52 arduino is built upon freertos, so let platformio debug it * don't accidentally try to Segger ICE if we are using another ICE * clean up RedirectablePrint::log so it doesn't have three very different implementations inline. * remove NoopPrint - it is no longer needed * when talking to API clients via serial, don't turn off log msgs instead encapsuate them * fix the build - would loop forever if there were no files to send * don't use Segger code if not talking to a Segger debugger * when encapsulating logs, make sure the strings always has nul terminators * nrf52 soft device will watchdog if you use ICE while BT on... so have debugger disable bluetooth. * Important to not print debug messages while writing to the toPhone scratch buffer * don't include newlines if encapsulating log records as protobufs * update to latest protobufs (needed for powermon goo) * PowerStress WIP * fix linter warning
206 lines
6.6 KiB
C++
206 lines
6.6 KiB
C++
#include "configuration.h"
|
|
#if !MESHTASTIC_EXCLUDE_INPUTBROKER
|
|
#include "input/InputBroker.h"
|
|
#include "input/RotaryEncoderInterruptImpl1.h"
|
|
#include "input/TrackballInterruptImpl1.h"
|
|
#include "input/UpDownInterruptImpl1.h"
|
|
#include "input/cardKbI2cImpl.h"
|
|
#include "input/kbMatrixImpl.h"
|
|
#endif
|
|
#include "modules/AdminModule.h"
|
|
#if !MESHTASTIC_EXCLUDE_ATAK
|
|
#include "modules/AtakPluginModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
|
#include "modules/CannedMessageModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_DETECTIONSENSOR
|
|
#include "modules/DetectionSensorModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_NEIGHBORINFO
|
|
#include "modules/NeighborInfoModule.h"
|
|
#endif
|
|
#include "modules/NodeInfoModule.h"
|
|
#if !MESHTASTIC_EXCLUDE_GPS
|
|
#include "modules/PositionModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_REMOTEHARDWARE
|
|
#include "modules/RemoteHardwareModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_POWERSTRESS
|
|
#include "modules/PowerStressModule.h"
|
|
#endif
|
|
#include "modules/RoutingModule.h"
|
|
#include "modules/TextMessageModule.h"
|
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
|
#include "modules/TraceRouteModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_WAYPOINT
|
|
#include "modules/WaypointModule.h"
|
|
#endif
|
|
#if ARCH_PORTDUINO
|
|
#include "input/LinuxInputImpl.h"
|
|
#endif
|
|
#if HAS_TELEMETRY
|
|
#include "modules/Telemetry/DeviceTelemetry.h"
|
|
#endif
|
|
#if HAS_SENSOR && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
|
#include "main.h"
|
|
#include "modules/Telemetry/AirQualityTelemetry.h"
|
|
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
|
#endif
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_POWER_TELEMETRY
|
|
#include "modules/Telemetry/PowerTelemetry.h"
|
|
#endif
|
|
#ifdef ARCH_ESP32
|
|
#if defined(USE_SX1280) && !MESHTASTIC_EXCLUDE_AUDIO
|
|
#include "modules/esp32/AudioModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
|
#include "modules/esp32/PaxcounterModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
|
#include "modules/esp32/StoreForwardModule.h"
|
|
#endif
|
|
#endif
|
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
|
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
|
#include "modules/ExternalNotificationModule.h"
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_RANGETEST && !MESHTASTIC_EXCLUDE_GPS
|
|
#include "modules/RangeTestModule.h"
|
|
#endif
|
|
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_SERIAL
|
|
#include "modules/SerialModule.h"
|
|
#endif
|
|
#endif
|
|
|
|
#if !MESHTASTIC_EXCLUDE_DROPZONE
|
|
#include "modules/DropzoneModule.h"
|
|
#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 || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
|
inputBroker = new InputBroker();
|
|
#endif
|
|
adminModule = new AdminModule();
|
|
nodeInfoModule = new NodeInfoModule();
|
|
#if !MESHTASTIC_EXCLUDE_GPS
|
|
positionModule = new PositionModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_WAYPOINT
|
|
waypointModule = new WaypointModule();
|
|
#endif
|
|
textMessageModule = new TextMessageModule();
|
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
|
traceRouteModule = new TraceRouteModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_NEIGHBORINFO
|
|
neighborInfoModule = new NeighborInfoModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_DETECTIONSENSOR
|
|
detectionSensorModule = new DetectionSensorModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_ATAK
|
|
atakPluginModule = new AtakPluginModule();
|
|
#endif
|
|
|
|
#if !MESHTASTIC_EXCLUDE_DROPZONE
|
|
dropzoneModule = new DropzoneModule();
|
|
#endif
|
|
// 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.
|
|
|
|
#if !MESHTASTIC_EXCLUDE_REMOTEHARDWARE
|
|
new RemoteHardwareModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_POWERSTRESS
|
|
new PowerStressModule();
|
|
#endif
|
|
// Example: Put your module here
|
|
// new ReplyModule();
|
|
#if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
|
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 ARCH_PORTDUINO
|
|
aLinuxInputImpl = new LinuxInputImpl();
|
|
aLinuxInputImpl->init();
|
|
#endif
|
|
#if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
|
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
|
trackballInterruptImpl1->init();
|
|
#endif
|
|
#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
|
cannedMessageModule = new CannedMessageModule();
|
|
#endif
|
|
#if HAS_TELEMETRY
|
|
new DeviceTelemetryModule();
|
|
#endif
|
|
#if HAS_SENSOR && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
|
new EnvironmentTelemetryModule();
|
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_PMSA003I].first > 0) {
|
|
new AirQualityTelemetryModule();
|
|
}
|
|
#endif
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_POWER_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
|
new PowerTelemetryModule();
|
|
#endif
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && \
|
|
!defined(CONFIG_IDF_TARGET_ESP32C3)
|
|
#if !MESHTASTIC_EXCLUDE_SERIAL
|
|
new SerialModule();
|
|
#endif
|
|
#endif
|
|
#ifdef ARCH_ESP32
|
|
// Only run on an esp32 based device.
|
|
#if defined(USE_SX1280) && !MESHTASTIC_EXCLUDE_AUDIO
|
|
audioModule = new AudioModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
|
storeForwardModule = new StoreForwardModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
|
paxcounterModule = new PaxcounterModule();
|
|
#endif
|
|
#endif
|
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
|
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
|
externalNotificationModule = new ExternalNotificationModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_RANGETEST && !MESHTASTIC_EXCLUDE_GPS
|
|
new RangeTestModule();
|
|
#endif
|
|
#endif
|
|
} else {
|
|
adminModule = new AdminModule();
|
|
#if HAS_TELEMETRY
|
|
new DeviceTelemetryModule();
|
|
#endif
|
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
|
traceRouteModule = new TraceRouteModule();
|
|
#endif
|
|
}
|
|
// 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();
|
|
} |