lay groundwork for a possible future architecture (#1571)

* lay groundwork for a possible future architecture

* switch from feature opt-out to feature opt-in

* lay groundwork for a possible future architecture

* switch from feature opt-out to feature opt-in

* fix USE_RTC in variant.h for rak4631_epaper and t-echo

* ensure Screen.h is not included without configuration.h

Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
majbthrd
2022-07-31 07:11:47 -05:00
committed by GitHub
parent fd27a814b7
commit ade32b1827
53 changed files with 405 additions and 330 deletions

View File

@@ -6,7 +6,7 @@
#include "configuration.h"
#include "main.h"
#ifdef PORTDUINO
#ifdef ARCH_PORTDUINO
#include "unistd.h"
#endif
@@ -110,7 +110,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
break;
}
#ifdef PORTDUINO
#ifdef ARCH_PORTDUINO
case AdminMessage_exit_simulator_tag:
DEBUG_MSG("Exiting simulator\n");
_exit(0);

View File

@@ -1,5 +1,5 @@
#include "configuration.h"
#ifndef NO_SCREEN
#if HAS_SCREEN
#include "CannedMessageModule.h"
#include "FSCommon.h"
#include "MeshService.h"

View File

@@ -1,6 +1,5 @@
#pragma once
#ifdef NO_SCREEN
#else
#if HAS_SCREEN
#include "ProtobufModule.h"
#include "input/InputBroker.h"

View File

@@ -116,7 +116,7 @@ ExternalNotificationModule::ExternalNotificationModule()
// restrict to the admin channel for rx
boundChannel = Channels::gpioChannel;
#ifndef NO_ESP32
#ifdef ARCH_ESP32
#ifdef EXT_NOTIFY_OUT
/*
@@ -154,7 +154,7 @@ ExternalNotificationModule::ExternalNotificationModule()
ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
#ifdef EXT_NOTIFY_OUT
if (moduleConfig.external_notification.enabled) {

View File

@@ -14,10 +14,10 @@
#include "modules/RoutingModule.h"
#include "modules/TextMessageModule.h"
#include "modules/Telemetry/DeviceTelemetry.h"
#ifndef PORTDUINO
#if HAS_TELEMETRY
#include "modules/Telemetry/EnvironmentTelemetry.h"
#endif
#ifndef NO_ESP32
#ifdef ARCH_ESP32
#include "modules/esp32/RangeTestModule.h"
#include "modules/esp32/SerialModule.h"
#include "modules/esp32/StoreForwardModule.h"
@@ -28,7 +28,9 @@
*/
void setupModules()
{
#if HAS_BUTTON
inputBroker = new InputBroker();
#endif
adminModule = new AdminModule();
nodeInfoModule = new NodeInfoModule();
positionModule = new PositionModule();
@@ -39,6 +41,7 @@ void setupModules()
new RemoteHardwareModule();
new ReplyModule();
#if HAS_BUTTON
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
rotaryEncoderInterruptImpl1->init();
upDownInterruptImpl1 = new UpDownInterruptImpl1();
@@ -47,14 +50,15 @@ void setupModules()
cardKbI2cImpl->init();
facesKbI2cImpl = new FacesKbI2cImpl();
facesKbI2cImpl->init();
#ifndef NO_SCREEN
#endif
#if HAS_SCREEN
cannedMessageModule = new CannedMessageModule();
#endif
#ifndef PORTDUINO
#if HAS_TELEMETRY
new DeviceTelemetryModule();
new EnvironmentTelemetryModule();
#endif
#ifndef NO_ESP32
#ifdef ARCH_ESP32
// Only run on an esp32 based device.
/*

View File

@@ -12,7 +12,7 @@
int32_t DeviceTelemetryModule::runOnce()
{
#ifndef PORTDUINO
#ifndef ARCH_PORTDUINO
if (firstTime) {
// This is the first time the OSThread library has called this function, so do some setup
firstTime = 0;

View File

@@ -26,7 +26,7 @@ INA219Sensor ina219Sensor;
#define FAILED_STATE_SENSOR_READ_MULTIPLIER 10
#define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true
#ifdef HAS_EINK
#ifdef USE_EINK
// The screen is bigger so use bigger fonts
#define FONT_SMALL ArialMT_Plain_16
#define FONT_MEDIUM ArialMT_Plain_24
@@ -44,7 +44,7 @@ INA219Sensor ina219Sensor;
int32_t EnvironmentTelemetryModule::runOnce()
{
#ifndef PORTDUINO
#ifndef ARCH_PORTDUINO
int32_t result = INT32_MAX;
/*
Uncomment the preferences below if you want to use the module

View File

@@ -15,7 +15,7 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu
lastMeasurementPacket = nullptr;
}
virtual bool wantUIFrame() override;
#ifdef NO_SCREEN
#if !HAS_SCREEN
void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
#else
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;

View File

@@ -29,7 +29,7 @@ uint32_t packetSequence = 0;
int32_t RangeTestModule::runOnce()
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
/*
Uncomment the preferences below if you want to use the module
@@ -129,7 +129,7 @@ void RangeTestModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp)
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
if (moduleConfig.range_test.enabled) {

View File

@@ -69,7 +69,7 @@ SerialModuleRadio::SerialModuleRadio() : SinglePortModule("SerialModuleRadio", P
int32_t SerialModule::runOnce()
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
/*
Uncomment the preferences below if you want to use the module
@@ -209,7 +209,7 @@ void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
if (moduleConfig.serial.enabled) {

View File

@@ -17,7 +17,7 @@ StoreForwardModule *storeForwardModule;
int32_t StoreForwardModule::runOnce()
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
if (moduleConfig.store_forward.enabled) {
@@ -241,7 +241,7 @@ void StoreForwardModule::sendMessage(NodeNum dest, char *str)
ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp)
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
if (moduleConfig.store_forward.enabled) {
DEBUG_MSG("--- S&F Received something\n");
@@ -381,7 +381,7 @@ StoreForwardModule::StoreForwardModule()
: SinglePortModule("StoreForwardModule", PortNum_TEXT_MESSAGE_APP), concurrency::OSThread("StoreForwardModule")
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
isPromiscuous = true; // Brown chicken brown cow