Skip to content
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ lib_deps =
extends = arduino_base
platform = espressif32@3.5.0
build_src_filter =
${arduino_base.build_src_filter} -<nrf52/>
${arduino_base.build_src_filter} -<nrf52/> -<stm32wl>
upload_speed = 115200
debug_init_break = tbreak setup

Expand Down Expand Up @@ -143,7 +143,7 @@ build_flags =
${arduino_base.build_flags} -Wno-unused-variable
-Isrc/nrf52
build_src_filter =
${arduino_base.build_src_filter} -<esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mqtt/>
${arduino_base.build_src_filter} -<esp32/> -<stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mqtt/>
lib_ignore =
BluetoothOTA

Expand Down
14 changes: 7 additions & 7 deletions src/ButtonThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "power.h"
#include <OneButton.h>

#ifndef NO_ESP32
#ifdef ARCH_ESP32
#include "nimble/BluetoothUtil.h"
#endif

Expand Down Expand Up @@ -127,7 +127,7 @@ class ButtonThread : public concurrency::OSThread
static void userButtonPressedLong()
{
// DEBUG_MSG("Long press!\n");
#ifndef NRF52_SERIES
#ifdef ARCH_ESP32
screen->adjustBrightness();
#endif
// If user button is held down for 5 seconds, shutdown the device.
Expand All @@ -137,7 +137,7 @@ class ButtonThread : public concurrency::OSThread
setLed(false);
power->shutdown();
}
#elif NRF52_SERIES
#elif defined(ARCH_NRF52)
// Do actual shutdown when button released, otherwise the button release
// may wake the board immediatedly.
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
Expand All @@ -156,19 +156,19 @@ class ButtonThread : public concurrency::OSThread

static void userButtonDoublePressed()
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
disablePin();
#elif defined(HAS_EINK)
#elif defined(USE_EINK)
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
#endif
}

static void userButtonMultiPressed()
{
#ifndef NO_ESP32
#ifdef ARCH_ESP32
clearNVS();
#endif
#ifdef NRF52_SERIES
#ifdef ARCH_NRF52
clearBonds();
#endif
}
Expand Down
23 changes: 0 additions & 23 deletions src/DebugConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,6 @@

#define DEBUG_PORT (*console) // Serial debug port

// What platforms should use SEGGER?
#ifdef NRF52_SERIES

// Always include the SEGGER code on NRF52 - because useful for debugging
#include "SEGGER_RTT.h"

// The channel we send stdout data to
#define SEGGER_STDOUT_CH 0

// Debug printing to segger console
#define SEGGER_MSG(...) SEGGER_RTT_printf(SEGGER_STDOUT_CH, __VA_ARGS__)

// If we are not on a NRF52840 (which has built in USB-ACM serial support) and we don't have serial pins hooked up, then we MUST
// use SEGGER for debug output
#if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA)
// No serial ports on this board - ONLY use segger in memory console
#define USE_SEGGER
#endif

#else
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32
#endif

#ifdef USE_SEGGER
#define DEBUG_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
#else
Expand Down
10 changes: 7 additions & 3 deletions src/FSCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@

// Cross platform filesystem API

#ifdef PORTDUINO
#if defined(ARCH_PORTDUINO)
// Portduino version
#include "PortduinoFS.h"
#define FSCom PortduinoFS
#define FSBegin() true
#define FILE_O_WRITE "w"
#define FILE_O_READ "r"
#elif !defined(NO_ESP32)
#endif

#if defined(ARCH_ESP32)
// ESP32 version
#include "LITTLEFS.h"
#define FSCom LITTLEFS
#define FSBegin() FSCom.begin(true)
#define FILE_O_WRITE "w"
#define FILE_O_READ "r"
#else
#endif

#if defined(ARCH_NRF52)
// NRF52 version
#include "InternalFileSystem.h"
#define FSCom InternalFS
Expand Down
2 changes: 1 addition & 1 deletion src/OSTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bool scheduleOSCallback(PendableFunction callback, void *param1, uint32_t param2
return xTimerPendFunctionCall(callback, param1, param2, pdMS_TO_TICKS(delayMsec));
} */

#ifndef NO_ESP32
#ifdef ARCH_ESP32

// Super skanky quick hack to use hardware timers of the ESP32
static hw_timer_t *timer;
Expand Down
12 changes: 6 additions & 6 deletions src/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Power *power;
using namespace meshtastic;

#ifndef AREF_VOLTAGE
#if defined(NRF52_SERIES)
#if defined(ARCH_NRF52)
/*
* Internal Reference is +/-0.6V, with an adjustable gain of 1/6, 1/5, 1/4,
* 1/3, 1/2 or 1, meaning 3.6, 3.0, 2.4, 1.8, 1.2 or 0.6V for the ADC levels.
Expand Down Expand Up @@ -84,7 +84,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
if (v < noBatVolt)
return -1; // If voltage is super low assume no battery installed

#ifndef NRF52_SERIES
#ifdef ARCH_ESP32
// This does not work on a RAK4631 with battery connected
if (v > chargingVolt)
return 0; // While charging we can't report % full on the battery
Expand Down Expand Up @@ -180,11 +180,11 @@ bool Power::analogInit()
// disable any internal pullups
pinMode(BATTERY_PIN, INPUT);

#ifndef NO_ESP32
#ifdef ARCH_ESP32
// ESP32 needs special analog stuff
adcAttachPin(BATTERY_PIN);
#endif
#ifdef NRF52_SERIES
#ifdef ARCH_NRF52
#ifdef VBAT_AR_INTERNAL
analogReference(VBAT_AR_INTERNAL);
#else
Expand Down Expand Up @@ -225,7 +225,7 @@ void Power::shutdown()
DEBUG_MSG("Shutting down\n");
axp.setChgLEDMode(AXP20X_LED_OFF);
axp.shutdown();
#elif NRF52_SERIES
#elif defined(ARCH_NRF52)
playBeep();
ledOff(PIN_LED1);
ledOff(PIN_LED2);
Expand Down Expand Up @@ -267,7 +267,7 @@ void Power::readPowerStatus()

// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 3 low readings in a row
// Supect fluctuating voltage on the RAK4631 to force it to deep sleep even if battery is at 85% after only a few days
#ifdef NRF52_SERIES
#ifdef ARCH_NRF52
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
low_voltage_counter++;
Expand Down
4 changes: 2 additions & 2 deletions src/PowerFSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void lsIdle()
{
// DEBUG_MSG("lsIdle begin ls_secs=%u\n", getPref_ls_secs());

#ifndef NO_ESP32
#ifdef ARCH_ESP32

// Do we have more sleeping to do?
if (secsSlept < config.power.ls_secs ? config.power.ls_secs : default_ls_secs * 1000) {
Expand Down Expand Up @@ -343,7 +343,7 @@ void PowerFSM_setup()

uint32_t meshSds = 0;

#ifndef NRF52_SERIES
#ifdef ARCH_ESP32
// We never enter light-sleep or NB states on NRF52 (because the CPU uses so little power normally)

// See: https://github.com/meshtastic/Meshtastic-device/issues/1071
Expand Down
2 changes: 1 addition & 1 deletion src/SerialConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port)
// setDestination(&noopPrint); for testing, try turning off 'all' debug output and see what leaks

Port.begin(SERIAL_BAUD);
#ifdef NRF52_SERIES
#ifdef ARCH_NRF52
time_t timeout = millis();
while (!Port) {
if ((millis() - timeout) < 5000) {
Expand Down
Loading