diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 693ab63b7..1f54a9801 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -21,6 +21,7 @@ build_src_filter = lib_deps = ${env.lib_deps} + ${screen_base.lib_deps} ${networking_base.lib_deps} ${radiolib_base.lib_deps} ${environmental_base.lib_deps} diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index 153ca9f3e..2e1382a21 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -39,7 +39,7 @@ build_flags = -DHAL_RNG_MODULE_ENABLED build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - - - - - - board_upload.offset_address = 0x08000000 upload_protocol = stlink diff --git a/platformio.ini b/platformio.ini index 8bf56cf5b..ecfda2811 100644 --- a/platformio.ini +++ b/platformio.ini @@ -59,8 +59,6 @@ build_flags = -Wno-missing-field-initializers monitor_speed = 115200 monitor_filters = direct lib_deps = - # renovate: datasource=git-refs depName=meshtastic-esp8266-oled-ssd1306 packageName=https://github.com/meshtastic/esp8266-oled-ssd1306 gitBranch=master - https://github.com/meshtastic/esp8266-oled-ssd1306/archive/0119501e9983bd894830b02f545c377ee08d66fe.zip # renovate: datasource=custom.pio depName=OneButton packageName=mathertel/library/OneButton mathertel/OneButton@2.6.1 # renovate: datasource=git-refs depName=meshtastic-arduino-fsm packageName=https://github.com/meshtastic/arduino-fsm gitBranch=master @@ -82,11 +80,18 @@ check_flags = --suppressions-list=suppressions.txt --inline-suppr +; Common libs for platforms that support screens (not STM32) +[screen_base] +lib_deps = + # renovate: datasource=git-refs depName=meshtastic-esp8266-oled-ssd1306 packageName=https://github.com/meshtastic/esp8266-oled-ssd1306 gitBranch=master + https://github.com/meshtastic/esp8266-oled-ssd1306/archive/0119501e9983bd894830b02f545c377ee08d66fe.zip + ; Common settings for conventional (non Portduino) Arduino targets [arduino_base] framework = arduino lib_deps = ${env.lib_deps} + ${screen_base.lib_deps} ; arduino_base.lib_deps are not consumed by stm32wl # renovate: datasource=custom.pio depName=NonBlockingRTTTL packageName=end2endzone/library/NonBlockingRTTTL end2endzone/NonBlockingRTTTL@1.3.0 build_flags = ${env.build_flags} -Os diff --git a/src/FakeScreen.h b/src/FakeScreen.h new file mode 100644 index 000000000..26a0715e3 --- /dev/null +++ b/src/FakeScreen.h @@ -0,0 +1,32 @@ +#pragma once + +#include "power.h" +namespace graphics +{ +// Noop class for MESHTASTIC_EXCLUDE_SCREEN +class Screen +{ + public: + enum FrameFocus : uint8_t { + FOCUS_DEFAULT, + FOCUS_PRESERVE, + FOCUS_FAULT, + FOCUS_TEXTMESSAGE, + FOCUS_MODULE, + FOCUS_CLOCK, + FOCUS_SYSTEM, + }; + + explicit Screen(){}; + void setup() {} + void setOn(bool) {} + void doDeepSleep() {} + void showSimpleBanner(const char *message, uint32_t durationMs = 0) {} + void setFrames(FrameFocus focus) {} +}; +} // namespace graphics + +inline bool shouldWakeOnReceivedMessage() +{ + return false; +} diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 322b877ff..c320e994c 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -14,7 +14,11 @@ #include "NodeDB.h" #include "PowerMon.h" #include "configuration.h" +#if !MESHTASTIC_EXCLUDE_SCREEN #include "graphics/Screen.h" +#else +#include "FakeScreen.h" +#endif #include "main.h" #include "sleep.h" #include "target_specific.h" diff --git a/src/main.cpp b/src/main.cpp index 1868d98c7..eddeefa81 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,11 @@ #endif #include "detect/einkScan.h" #include "graphics/RAKled.h" +#if !MESHTASTIC_EXCLUDE_SCREEN #include "graphics/Screen.h" +#else +#include "FakeScreen.h" +#endif #include "main.h" #include "mesh/generated/meshtastic/config.pb.h" #include "meshUtils.h" @@ -352,9 +356,11 @@ void setup() SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0); #endif +#if !MESHTASTIC_EXCLUDE_SCREEN meshtastic_Config_DisplayConfig_OledType screen_model = meshtastic_Config_DisplayConfig_OledType::meshtastic_Config_DisplayConfig_OledType_OLED_AUTO; OLEDDISPLAY_GEOMETRY screen_geometry = GEOMETRY_128_64; +#endif #ifdef USE_SEGGER auto mode = false ? SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL : SEGGER_RTT_MODE_NO_BLOCK_TRIM; @@ -750,6 +756,7 @@ void setup() else playStartMelody(); +#if !MESHTASTIC_EXCLUDE_SCREEN // fixed screen override? if (config.display.oled != meshtastic_Config_DisplayConfig_OledType_OLED_AUTO) screen_model = config.display.oled; @@ -762,6 +769,7 @@ void setup() #if defined(USE_SH1107_128_64) screen_model = meshtastic_Config_DisplayConfig_OledType_OLED_SH1107; // keep dimension of 128x64 #endif +#endif // MESHTASTIC_EXCLUDE_SCREEN #if !MESHTASTIC_EXCLUDE_I2C #if !defined(ARCH_STM32WL) diff --git a/src/main.h b/src/main.h index 7105bd62b..1e657b004 100644 --- a/src/main.h +++ b/src/main.h @@ -5,7 +5,11 @@ #include "NodeStatus.h" #include "PowerStatus.h" #include "detect/ScanI2C.h" +#if !MESHTASTIC_EXCLUDE_SCREEN #include "graphics/Screen.h" +#else +#include "FakeScreen.h" +#endif #include "memGet.h" #include "mesh/generated/meshtastic/config.pb.h" #include "mesh/generated/meshtastic/telemetry.pb.h" diff --git a/src/modules/Telemetry/DeviceTelemetry.cpp b/src/modules/Telemetry/DeviceTelemetry.cpp index 43c2dd84c..3d5c6c2bf 100644 --- a/src/modules/Telemetry/DeviceTelemetry.cpp +++ b/src/modules/Telemetry/DeviceTelemetry.cpp @@ -10,8 +10,10 @@ #include "configuration.h" #include "main.h" #include "memGet.h" +#if !MESHTASTIC_EXCLUDE_SCREEN #include #include +#endif #include #define MAGIC_USB_BATTERY_LEVEL 101 diff --git a/src/modules/Telemetry/DeviceTelemetry.h b/src/modules/Telemetry/DeviceTelemetry.h index a1d55a596..f899e4060 100644 --- a/src/modules/Telemetry/DeviceTelemetry.h +++ b/src/modules/Telemetry/DeviceTelemetry.h @@ -2,8 +2,10 @@ #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "NodeDB.h" #include "ProtobufModule.h" +#if !MESHTASTIC_EXCLUDE_SCREEN #include #include +#endif class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModule { diff --git a/src/modules/TextMessageModule.cpp b/src/modules/TextMessageModule.cpp index 970f4429c..5fbabf77b 100644 --- a/src/modules/TextMessageModule.cpp +++ b/src/modules/TextMessageModule.cpp @@ -4,7 +4,11 @@ #include "PowerFSM.h" #include "buzz.h" #include "configuration.h" +#if !MESHTASTIC_EXCLUDE_SCREEN #include "graphics/Screen.h" +#else +#include "FakeScreen.h" +#endif TextMessageModule *textMessageModule; ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp) diff --git a/src/modules/WaypointModule.cpp b/src/modules/WaypointModule.cpp index aab3ed6bc..6e87de40b 100644 --- a/src/modules/WaypointModule.cpp +++ b/src/modules/WaypointModule.cpp @@ -2,12 +2,12 @@ #include "NodeDB.h" #include "PowerFSM.h" #include "configuration.h" -#include "graphics/draw/CompassRenderer.h" #if HAS_SCREEN #include "gps/RTC.h" #include "graphics/Screen.h" #include "graphics/TimeFormatters.h" +#include "graphics/draw/CompassRenderer.h" #include "graphics/draw/NodeListRenderer.h" #include "main.h" #endif diff --git a/src/motion/MotionSensor.cpp b/src/motion/MotionSensor.cpp index b00460aff..e96baa25e 100755 --- a/src/motion/MotionSensor.cpp +++ b/src/motion/MotionSensor.cpp @@ -1,7 +1,7 @@ #include "MotionSensor.h" -#include "graphics/draw/CompassRenderer.h" #if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C +#include "graphics/draw/CompassRenderer.h" char timeRemainingBuffer[12];