mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 01:16:55 +00:00
Turn off certain modules not wanted in custom builds (#3337)
This commit is contained in:
parent
72050530f1
commit
f5ff77c2b9
@ -221,4 +221,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#ifndef HW_VENDOR
|
#ifndef HW_VENDOR
|
||||||
#error HW_VENDOR must be defined
|
#error HW_VENDOR must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// global switch to turn off all optional modules for a minimzed build
|
||||||
|
#ifdef MESHTASTIC_EXCLUDE_MODULES
|
||||||
|
#define MESHTASTIC_EXCLUDE_AUDIO 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_DETECTIONSENSOR 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_PAXCOUNTER 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_POWER_TELEMETRY 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_RANGETEST 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_REMOTEHARDWARE 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_STOREFORWARD 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_ATAK 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_CANNEDMESSAGES 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_NEIGHBORINFO 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_TRACEROUTE 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_WAYPOINT 1
|
||||||
|
#endif
|
||||||
|
@ -1,74 +1,112 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#if !MESHTASTIC_EXCLUDE_INPUTBROKER
|
||||||
#include "input/InputBroker.h"
|
#include "input/InputBroker.h"
|
||||||
#include "input/RotaryEncoderInterruptImpl1.h"
|
#include "input/RotaryEncoderInterruptImpl1.h"
|
||||||
#include "input/TrackballInterruptImpl1.h"
|
#include "input/TrackballInterruptImpl1.h"
|
||||||
#include "input/UpDownInterruptImpl1.h"
|
#include "input/UpDownInterruptImpl1.h"
|
||||||
#include "input/cardKbI2cImpl.h"
|
#include "input/cardKbI2cImpl.h"
|
||||||
#include "input/kbMatrixImpl.h"
|
#include "input/kbMatrixImpl.h"
|
||||||
|
#endif
|
||||||
#include "modules/AdminModule.h"
|
#include "modules/AdminModule.h"
|
||||||
|
#if !MESHTASTIC_EXCLUDE_ATAK
|
||||||
#include "modules/AtakPluginModule.h"
|
#include "modules/AtakPluginModule.h"
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
||||||
#include "modules/CannedMessageModule.h"
|
#include "modules/CannedMessageModule.h"
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_DETECTIONSENSOR
|
||||||
#include "modules/DetectionSensorModule.h"
|
#include "modules/DetectionSensorModule.h"
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_NEIGHBORINFO
|
||||||
#include "modules/NeighborInfoModule.h"
|
#include "modules/NeighborInfoModule.h"
|
||||||
|
#endif
|
||||||
#include "modules/NodeInfoModule.h"
|
#include "modules/NodeInfoModule.h"
|
||||||
#include "modules/PositionModule.h"
|
#include "modules/PositionModule.h"
|
||||||
|
#if !MESHTASTIC_EXCLUDE_REMOTEHARDWARE
|
||||||
#include "modules/RemoteHardwareModule.h"
|
#include "modules/RemoteHardwareModule.h"
|
||||||
|
#endif
|
||||||
#include "modules/RoutingModule.h"
|
#include "modules/RoutingModule.h"
|
||||||
#include "modules/TextMessageModule.h"
|
#include "modules/TextMessageModule.h"
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
||||||
#include "modules/TraceRouteModule.h"
|
#include "modules/TraceRouteModule.h"
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_WAYPOINT
|
||||||
#include "modules/WaypointModule.h"
|
#include "modules/WaypointModule.h"
|
||||||
|
#endif
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
#include "input/LinuxInputImpl.h"
|
#include "input/LinuxInputImpl.h"
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TELEMETRY
|
#if HAS_TELEMETRY
|
||||||
#include "modules/Telemetry/DeviceTelemetry.h"
|
#include "modules/Telemetry/DeviceTelemetry.h"
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SENSOR
|
#if HAS_SENSOR && !EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||||
#include "modules/Telemetry/AirQualityTelemetry.h"
|
#include "modules/Telemetry/AirQualityTelemetry.h"
|
||||||
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !EXCLUDE_POWER_TELEMETRY
|
||||||
#include "modules/Telemetry/PowerTelemetry.h"
|
#include "modules/Telemetry/PowerTelemetry.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#ifdef USE_SX1280
|
#if defined(USE_SX1280) && !MESHTASTIC_EXCLUDE_AUDIO
|
||||||
#include "modules/esp32/AudioModule.h"
|
#include "modules/esp32/AudioModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||||
#include "modules/esp32/PaxcounterModule.h"
|
#include "modules/esp32/PaxcounterModule.h"
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||||
#include "modules/esp32/StoreForwardModule.h"
|
#include "modules/esp32/StoreForwardModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
||||||
|
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
||||||
#include "modules/ExternalNotificationModule.h"
|
#include "modules/ExternalNotificationModule.h"
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
||||||
#include "modules/RangeTestModule.h"
|
#include "modules/RangeTestModule.h"
|
||||||
|
#endif
|
||||||
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||||
|
#if !MESHTASTIC_EXCLUDE_SERIAL
|
||||||
#include "modules/SerialModule.h"
|
#include "modules/SerialModule.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)
|
* Create module instances here. If you are adding a new module, you must 'new' it here (or somewhere else)
|
||||||
*/
|
*/
|
||||||
void setupModules()
|
void setupModules()
|
||||||
{
|
{
|
||||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||||
#if HAS_BUTTON || ARCH_PORTDUINO
|
#if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
||||||
inputBroker = new InputBroker();
|
inputBroker = new InputBroker();
|
||||||
#endif
|
#endif
|
||||||
adminModule = new AdminModule();
|
adminModule = new AdminModule();
|
||||||
nodeInfoModule = new NodeInfoModule();
|
nodeInfoModule = new NodeInfoModule();
|
||||||
positionModule = new PositionModule();
|
positionModule = new PositionModule();
|
||||||
|
#if !MESHTASTIC_EXCLUDE_WAYPOINT
|
||||||
waypointModule = new WaypointModule();
|
waypointModule = new WaypointModule();
|
||||||
|
#endif
|
||||||
textMessageModule = new TextMessageModule();
|
textMessageModule = new TextMessageModule();
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
||||||
traceRouteModule = new TraceRouteModule();
|
traceRouteModule = new TraceRouteModule();
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_NEIGHBORINFO
|
||||||
neighborInfoModule = new NeighborInfoModule();
|
neighborInfoModule = new NeighborInfoModule();
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_DETECTIONSENSOR
|
||||||
detectionSensorModule = new DetectionSensorModule();
|
detectionSensorModule = new DetectionSensorModule();
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_ATAK
|
||||||
atakPluginModule = new AtakPluginModule();
|
atakPluginModule = new AtakPluginModule();
|
||||||
|
#endif
|
||||||
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance
|
// 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.
|
// to a global variable.
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_REMOTEHARDWARE
|
||||||
new RemoteHardwareModule();
|
new RemoteHardwareModule();
|
||||||
|
#endif
|
||||||
// Example: Put your module here
|
// Example: Put your module here
|
||||||
// new ReplyModule();
|
// new ReplyModule();
|
||||||
#if HAS_BUTTON || ARCH_PORTDUINO
|
#if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
||||||
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
||||||
if (!rotaryEncoderInterruptImpl1->init()) {
|
if (!rotaryEncoderInterruptImpl1->init()) {
|
||||||
delete rotaryEncoderInterruptImpl1;
|
delete rotaryEncoderInterruptImpl1;
|
||||||
@ -90,47 +128,59 @@ void setupModules()
|
|||||||
aLinuxInputImpl = new LinuxInputImpl();
|
aLinuxInputImpl = new LinuxInputImpl();
|
||||||
aLinuxInputImpl->init();
|
aLinuxInputImpl->init();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TRACKBALL
|
#if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER
|
||||||
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
||||||
trackballInterruptImpl1->init();
|
trackballInterruptImpl1->init();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SCREEN
|
#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
||||||
cannedMessageModule = new CannedMessageModule();
|
cannedMessageModule = new CannedMessageModule();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TELEMETRY
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
||||||
new DeviceTelemetryModule();
|
new DeviceTelemetryModule();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SENSOR
|
#if HAS_SENSOR && !EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||||
new EnvironmentTelemetryModule();
|
new EnvironmentTelemetryModule();
|
||||||
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_PMSA003I].first > 0) {
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_PMSA003I].first > 0) {
|
||||||
new AirQualityTelemetryModule();
|
new AirQualityTelemetryModule();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !EXCLUDE_POWER_TELEMETRY
|
||||||
new PowerTelemetryModule();
|
new PowerTelemetryModule();
|
||||||
#endif
|
#endif
|
||||||
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && \
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && \
|
||||||
!defined(CONFIG_IDF_TARGET_ESP32C3)
|
!defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
#if !MESHTASTIC_EXCLUDE_SERIAL
|
||||||
new SerialModule();
|
new SerialModule();
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// Only run on an esp32 based device.
|
// Only run on an esp32 based device.
|
||||||
#ifdef USE_SX1280
|
#if defined(USE_SX1280) && !MESHTASTIC_EXCLUDE_AUDIO
|
||||||
audioModule = new AudioModule();
|
audioModule = new AudioModule();
|
||||||
#endif
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||||
storeForwardModule = new StoreForwardModule();
|
storeForwardModule = new StoreForwardModule();
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||||
paxcounterModule = new PaxcounterModule();
|
paxcounterModule = new PaxcounterModule();
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
||||||
|
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
||||||
externalNotificationModule = new ExternalNotificationModule();
|
externalNotificationModule = new ExternalNotificationModule();
|
||||||
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
||||||
new RangeTestModule();
|
new RangeTestModule();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
adminModule = new AdminModule();
|
adminModule = new AdminModule();
|
||||||
#if HAS_TELEMETRY
|
#if HAS_TELEMETRY
|
||||||
new DeviceTelemetryModule();
|
new DeviceTelemetryModule();
|
||||||
#endif
|
#endif
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
||||||
traceRouteModule = new TraceRouteModule();
|
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
|
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra
|
||||||
// acks
|
// acks
|
||||||
|
Loading…
Reference in New Issue
Block a user