diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml
index 7f8659523b..61466655d1 100644
--- a/.github/actions/setup-base/action.yml
+++ b/.github/actions/setup-base/action.yml
@@ -11,7 +11,7 @@ runs:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- - name: Install dependencies
+ - name: Install dependencies
shell: bash
run: |
sudo apt-get -y update --fix-missing
@@ -22,19 +22,20 @@ runs:
with:
python-version: 3.x
- - name: Cache python libs
- uses: actions/cache@v4
- id: cache-pip # needed in if test
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip
+ # - name: Cache python libs
+ # uses: actions/cache@v4
+ # id: cache-pip # needed in if test
+ # with:
+ # path: ~/.cache/pip
+ # key: ${{ runner.os }}-pip
- name: Upgrade python tools
shell: bash
run: |
python -m pip install --upgrade pip
- pip install -U platformio adafruit-nrfutil
- pip install -U meshtastic --pre
+ pip install -U --no-build-isolation --no-cache-dir "setuptools<72"
+ pip install -U platformio adafruit-nrfutil --no-build-isolation
+ pip install -U meshtastic --pre --no-build-isolation
- name: Upgrade platformio
shell: bash
diff --git a/.github/workflows/build_stm32.yml b/.github/workflows/build_stm32.yml
new file mode 100644
index 0000000000..d13c52c8a1
--- /dev/null
+++ b/.github/workflows/build_stm32.yml
@@ -0,0 +1,33 @@
+name: Build STM32
+
+on:
+ workflow_call:
+ inputs:
+ board:
+ required: true
+ type: string
+
+jobs:
+ build-stm32:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Build base
+ id: base
+ uses: ./.github/actions/setup-base
+
+ - name: Build STM32
+ run: bin/build-stm32.sh ${{ inputs.board }}
+
+ - name: Get release version string
+ run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
+ id: version
+
+ - name: Store binaries as an artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
+ overwrite: true
+ path: |
+ release/*.hex
+ release/*.bin
diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml
index 14c8a9d10c..36125f72f1 100644
--- a/.github/workflows/main_matrix.yml
+++ b/.github/workflows/main_matrix.yml
@@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- arch: [esp32, esp32s3, esp32c3, nrf52840, rp2040, check]
+ arch: [esp32, esp32s3, esp32c3, nrf52840, rp2040, stm32, check]
runs-on: ubuntu-latest
steps:
- id: checkout
@@ -41,6 +41,7 @@ jobs:
esp32c3: ${{ steps.jsonStep.outputs.esp32c3 }}
nrf52840: ${{ steps.jsonStep.outputs.nrf52840 }}
rp2040: ${{ steps.jsonStep.outputs.rp2040 }}
+ stm32: ${{ steps.jsonStep.outputs.stm32 }}
check: ${{ steps.jsonStep.outputs.check }}
check:
@@ -103,6 +104,15 @@ jobs:
with:
board: ${{ matrix.board }}
+ build-stm32:
+ needs: setup
+ strategy:
+ fail-fast: false
+ matrix: ${{ fromJson(needs.setup.outputs.stm32) }}
+ uses: ./.github/workflows/build_stm32.yml
+ with:
+ board: ${{ matrix.board }}
+
package-raspbian:
uses: ./.github/workflows/package_raspbian.yml
@@ -134,6 +144,7 @@ jobs:
build-esp32-c3,
build-nrf52,
build-rpi2040,
+ build-stm32,
package-raspbian,
package-raspbian-armv7l,
package-native,
diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini
new file mode 100644
index 0000000000..2cea4bbc58
--- /dev/null
+++ b/arch/stm32/stm32.ini
@@ -0,0 +1,36 @@
+[stm32_base]
+extends = arduino_base
+platform = ststm32
+platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#361a7fdb67e2a7104e99b4f42a802469eef8b129
+
+build_type = release
+
+;board_build.flash_offset = 0x08000000
+
+build_flags =
+ ${arduino_base.build_flags}
+ -flto
+ -Isrc/platform/stm32wl -g
+ -DMESHTASTIC_MINIMIZE_BUILD
+ -DDEBUG_MUTE
+; -DVECT_TAB_OFFSET=0x08000000
+ -DconfigUSE_CMSIS_RTOS_V2=1
+; -DSPI_MODE_0=SPI_MODE0
+ -fmerge-all-constants
+ -ffunction-sections
+ -fdata-sections
+
+build_src_filter =
+ ${arduino_base.build_src_filter} - - - - - - - - - - - - - -
+
+board_upload.offset_address = 0x08000000
+upload_protocol = stlink
+
+lib_deps =
+ ${env.lib_deps}
+ charlesbaynham/OSFS@^1.2.3
+ https://github.com/caveman99/Crypto.git#f61ae26a53f7a2d0ba5511625b8bf8eff3a35d5e
+
+lib_ignore =
+ mathertel/OneButton
+ Wire
\ No newline at end of file
diff --git a/arch/stm32/stm32wl5e.ini b/arch/stm32/stm32wl5e.ini
deleted file mode 100644
index 4d74ade8fb..0000000000
--- a/arch/stm32/stm32wl5e.ini
+++ /dev/null
@@ -1,28 +0,0 @@
-[stm32wl5e_base]
-platform_packages = platformio/framework-arduinoststm32 @ https://github.com/stm32duino/Arduino_Core_STM32.git#6e3f9910d0122e82a6c3438507dfac3d2fd80a39
-platform = ststm32
-board = generic_wl5e
-framework = arduino
-
-build_type = debug
-
-build_flags =
- ${arduino_base.build_flags}
- -Isrc/platform/stm32wl -g
- -DconfigUSE_CMSIS_RTOS_V2=1
- -DVECT_TAB_OFFSET=0x08000000
-
-build_src_filter =
- ${arduino_base.build_src_filter} - - - - - - - - - - - - - -
-
-board_upload.offset_address = 0x08000000
-upload_protocol = stlink
-
-lib_deps =
- ${env.lib_deps}
- https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b
- https://github.com/littlefs-project/littlefs.git#v2.5.1
- https://github.com/stm32duino/STM32FreeRTOS.git#10.3.1
-
-lib_ignore =
- mathertel/OneButton
\ No newline at end of file
diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh
index f60331ed52..adb6ab12ad 100755
--- a/bin/build-esp32.sh
+++ b/bin/build-esp32.sh
@@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware*
rm -r $OUTDIR/* || true
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
-platformio pkg update
+platformio pkg update -e $1
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
rm -f .pio/build/$1/firmware.*
diff --git a/bin/build-nrf52.sh b/bin/build-nrf52.sh
index c0658dad95..060d06cfda 100755
--- a/bin/build-nrf52.sh
+++ b/bin/build-nrf52.sh
@@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware*
rm -r $OUTDIR/* || true
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
-platformio pkg update
+platformio pkg update -e $1
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
rm -f .pio/build/$1/firmware.*
diff --git a/bin/build-rpi2040.sh b/bin/build-rpi2040.sh
index fe0725085a..dad6a7e67e 100755
--- a/bin/build-rpi2040.sh
+++ b/bin/build-rpi2040.sh
@@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware*
rm -r $OUTDIR/* || true
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
-platformio pkg update
+platformio pkg update -e $1
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
rm -f .pio/build/$1/firmware.*
diff --git a/bin/build-stm32.sh b/bin/build-stm32.sh
new file mode 100755
index 0000000000..76c5a75fb2
--- /dev/null
+++ b/bin/build-stm32.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+set -e
+
+VERSION=$(bin/buildinfo.py long)
+SHORT_VERSION=$(bin/buildinfo.py short)
+
+OUTDIR=release/
+
+rm -f $OUTDIR/firmware*
+rm -r $OUTDIR/* || true
+
+# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
+platformio pkg update -e $1
+
+echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
+rm -f .pio/build/$1/firmware.*
+
+# The shell vars the build tool expects to find
+export APP_VERSION=$VERSION
+
+basename=firmware-$1-$VERSION
+
+pio run --environment $1 # -v
+SRCELF=.pio/build/$1/firmware.elf
+cp $SRCELF $OUTDIR/$basename.elf
+
+SRCBIN=.pio/build/$1/firmware.bin
+cp $SRCBIN $OUTDIR/$basename.bin
diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml
index e1320198a8..0517b1e6b0 100644
--- a/bin/config-dist.yaml
+++ b/bin/config-dist.yaml
@@ -54,6 +54,8 @@ Lora:
# ch341_quirk: true # Uncomment this to use the chunked SPI transfer that seems to fix the ch341
+# spiSpeed: 2000000
+
### Set gpio chip to use in /dev/. Defaults to 0.
### Notably the Raspberry Pi 5 puts the GPIO header on gpiochip4
# gpiochip: 4
@@ -134,6 +136,9 @@ Display:
# OffsetRotate: 1
# Invert: true
+### You can also specify the spi device for the display to use
+# spidev: spidev0.0
+
Touchscreen:
### Note, at least for now, the touchscreen must have a CS pin defined, even if you let Linux manage the CS switching.
@@ -149,15 +154,20 @@ Touchscreen:
# CS: 7
# IRQ: 17
-### Configure device for direct keyboard input
+### You can also specify the spi device for the touchscreen to use
+# spidev: spidev0.0
+
Input:
+### Configure device for direct keyboard input
+
# KeyboardDevice: /dev/input/by-id/usb-_Raspberry_Pi_Internal_Keyboard-event-kbd
###
Logging:
LogLevel: info # debug, info, warn, error
+# TraceFile: /var/log/meshtasticd.json
Webserver:
# Port: 443 # Port for Webserver & Webservices
@@ -165,3 +175,4 @@ Webserver:
General:
MaxNodes: 200
+ MaxMessageQueue: 100
\ No newline at end of file
diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py
index 3202a1e7a9..065f1267b4 100644
--- a/bin/platformio-custom.py
+++ b/bin/platformio-custom.py
@@ -91,3 +91,12 @@ def esp32_create_combined_bin(source, target, env):
"-DAPP_VERSION_SHORT=" + verObj["short"],
]
)
+
+# Add a custom p.io project task to run the UF2 conversion script.
+env.AddCustomTarget(
+ name="Convert Hex to UF2",
+ dependencies=None,
+ actions=["PYTHON .\\bin\\uf2conv.py $BUILD_DIR\$env\\firmware.hex -c -f 0xADA52840 -o $BUILD_DIR\$env\\firmware.uf2"],
+ title="Convert hex to uf2",
+ description="Runs the python script to convert an already-built .hex file into .uf2 for copying to a device"
+)
diff --git a/boards/heltec_vision_master_e290.json b/boards/heltec_vision_master_e290.json
new file mode 100644
index 0000000000..70f7d5f02f
--- /dev/null
+++ b/boards/heltec_vision_master_e290.json
@@ -0,0 +1,42 @@
+{
+ "build": {
+ "arduino": {
+ "ldscript": "esp32s3_out.ld",
+ "partitions": "default_8MB.csv"
+ },
+ "core": "esp32",
+ "extra_flags": [
+ "-DBOARD_HAS_PSRAM",
+ "-DARDUINO_USB_CDC_ON_BOOT=1",
+ "-DARDUINO_USB_MODE=0",
+ "-DARDUINO_RUNNING_CORE=1",
+ "-DARDUINO_EVENT_RUNNING_CORE=1"
+ ],
+ "f_cpu": "240000000L",
+ "f_flash": "80000000L",
+ "flash_mode": "qio",
+ "hwids": [
+ ["0x303A", "0x1001"],
+ ["0x303A", "0x0002"]
+ ],
+ "mcu": "esp32s3",
+ "variant": "heltec_vision_master_e290"
+ },
+ "connectivity": ["wifi", "bluetooth", "lora"],
+ "debug": {
+ "openocd_target": "esp32s3.cfg"
+ },
+ "frameworks": ["arduino", "espidf"],
+ "name": "Heltec Vision Master E290",
+ "upload": {
+ "flash_size": "8MB",
+ "maximum_ram_size": 327680,
+ "maximum_size": 8388608,
+ "use_1200bps_touch": true,
+ "wait_for_upload_port": true,
+ "require_upload_port": true,
+ "speed": 921600
+ },
+ "url": "https://heltec.org/project/vision-master-e290/",
+ "vendor": "Heltec"
+}
diff --git a/boards/generic_wl5e.json b/boards/wiscore_rak3172.json
similarity index 91%
rename from boards/generic_wl5e.json
rename to boards/wiscore_rak3172.json
index 5c4bc24a75..714e09115e 100644
--- a/boards/generic_wl5e.json
+++ b/boards/wiscore_rak3172.json
@@ -1,5 +1,8 @@
{
"build": {
+ "arduino": {
+ "variant_h": "variant_RAK3172_MODULE.h"
+ },
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32WLxx -DSTM32WLE5xx -DARDUINO_GENERIC_WLE5CCUX",
diff --git a/protobufs b/protobufs
index 7f90178f18..976748839f 160000
--- a/protobufs
+++ b/protobufs
@@ -1 +1 @@
-Subproject commit 7f90178f183820e288aec41133144f30723228fe
+Subproject commit 976748839fafcf0049bb364fe2c7226a194d18a9
diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp
index 914ff8e06a..1b101044fd 100644
--- a/src/ButtonThread.cpp
+++ b/src/ButtonThread.cpp
@@ -144,8 +144,8 @@ int32_t ButtonThread::runOnce()
case BUTTON_EVENT_DOUBLE_PRESSED: {
LOG_BUTTON("Double press!\n");
- service.refreshLocalMeshNode();
- auto sentPosition = service.trySendPosition(NODENUM_BROADCAST, true);
+ service->refreshLocalMeshNode();
+ auto sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
if (screen) {
if (sentPosition)
screen->print("Sent ad-hoc position\n");
diff --git a/src/ButtonThread.h b/src/ButtonThread.h
index d7a9201a34..9cd7b3dac3 100644
--- a/src/ButtonThread.h
+++ b/src/ButtonThread.h
@@ -13,7 +13,7 @@
#endif
#ifndef BUTTON_TOUCH_MS
-#define BUTTON_TOCH_MS 400
+#define BUTTON_TOUCH_MS 400
#endif
class ButtonThread : public concurrency::OSThread
diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp
index 7d3788c4d9..3017ec085c 100644
--- a/src/FSCommon.cpp
+++ b/src/FSCommon.cpp
@@ -24,6 +24,30 @@ SPIClass SPI1(HSPI);
#endif // HAS_SDCARD
+#if defined(ARCH_STM32WL)
+
+uint16_t OSFS::startOfEEPROM = 1;
+uint16_t OSFS::endOfEEPROM = 2048;
+
+// 3) How do I read from the medium?
+void OSFS::readNBytes(uint16_t address, unsigned int num, byte *output)
+{
+ for (uint16_t i = address; i < address + num; i++) {
+ *output = EEPROM.read(i);
+ output++;
+ }
+}
+
+// 4) How to I write to the medium?
+void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte *input)
+{
+ for (uint16_t i = address; i < address + num; i++) {
+ EEPROM.update(i, *input);
+ input++;
+ }
+}
+#endif
+
/**
* @brief Copies a file from one location to another.
*
@@ -33,7 +57,33 @@ SPIClass SPI1(HSPI);
*/
bool copyFile(const char *from, const char *to)
{
-#ifdef FSCom
+#ifdef ARCH_STM32WL
+ unsigned char cbuffer[2048];
+
+ // Var to hold the result of actions
+ OSFS::result r;
+
+ r = OSFS::getFile(from, cbuffer);
+
+ if (r == notfound) {
+ LOG_ERROR("Failed to open source file %s\n", from);
+ return false;
+ } else if (r == noerr) {
+ r = OSFS::newFile(to, cbuffer, true);
+ if (r == noerr) {
+ return true;
+ } else {
+ LOG_ERROR("OSFS Error %d\n", r);
+ return false;
+ }
+
+ } else {
+ LOG_ERROR("OSFS Error %d\n", r);
+ return false;
+ }
+ return true;
+
+#elif defined(FSCom)
unsigned char cbuffer[16];
File f1 = FSCom.open(from, FILE_O_READ);
@@ -70,7 +120,13 @@ bool copyFile(const char *from, const char *to)
*/
bool renameFile(const char *pathFrom, const char *pathTo)
{
-#ifdef FSCom
+#ifdef ARCH_STM32WL
+ if (copyFile(pathFrom, pathTo) && (OSFS::deleteFile(pathFrom) == OSFS::result::NO_ERROR)) {
+ return true;
+ } else {
+ return false;
+ }
+#elif defined(FSCom)
#ifdef ARCH_ESP32
// rename was fixed for ESP32 IDF LittleFS in April
return FSCom.rename(pathFrom, pathTo);
diff --git a/src/FSCommon.h b/src/FSCommon.h
index 8fbabd9526..3d485d1b1d 100644
--- a/src/FSCommon.h
+++ b/src/FSCommon.h
@@ -15,10 +15,13 @@
#endif
#if defined(ARCH_STM32WL)
-#include "platform/stm32wl/InternalFileSystem.h" // STM32WL version
-#define FSCom InternalFS
-#define FSBegin() FSCom.begin()
-using namespace LittleFS_Namespace;
+// STM32WL series 2 Kbytes (8 rows of 256 bytes)
+#include
+#include
+
+// Useful consts
+const OSFS::result noerr = OSFS::result::NO_ERROR;
+const OSFS::result notfound = OSFS::result::FILE_NOT_FOUND;
#endif
#if defined(ARCH_RP2040)
diff --git a/src/OSTimer.cpp b/src/OSTimer.cpp
deleted file mode 100644
index f6739d75e0..0000000000
--- a/src/OSTimer.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "OSTimer.h"
-#include "configuration.h"
-
-/**
- * Schedule a callback to run. The callback must _not_ block, though it is called from regular thread level (not ISR)
- *
- * NOTE! xTimerPend... seems to ignore the time passed in on ESP32 and on NRF52
- * The reason this didn't work is because xTimerPednFunctCall really isn't a timer function at all - it just means run the
-callback
- * from the timer thread the next time you have spare cycles.
- *
- * @return true if successful, false if the timer fifo is too full.
-
-bool scheduleOSCallback(PendableFunction callback, void *param1, uint32_t param2, uint32_t delayMsec)
-{
- return xTimerPendFunctionCall(callback, param1, param2, pdMS_TO_TICKS(delayMsec));
-} */
-
-#ifdef ARCH_ESP32
-
-// Super skanky quick hack to use hardware timers of the ESP32
-static hw_timer_t *timer;
-static PendableFunction tCallback;
-static void *tParam1;
-static uint32_t tParam2;
-
-static void IRAM_ATTR onTimer()
-{
- (*tCallback)(tParam1, tParam2);
-}
-
-/**
- * Schedules a hardware callback function to be executed after a specified delay.
- *
- * @param callback The function to be executed.
- * @param param1 The first parameter to be passed to the function.
- * @param param2 The second parameter to be passed to the function.
- * @param delayMsec The delay time in milliseconds before the function is executed.
- *
- * @return True if the function was successfully scheduled, false otherwise.
- */
-bool scheduleHWCallback(PendableFunction callback, void *param1, uint32_t param2, uint32_t delayMsec)
-{
- if (!timer) {
- timer = timerBegin(0, 80, true); // one usec per tick (main clock is 80MhZ on ESP32)
- assert(timer);
- timerAttachInterrupt(timer, &onTimer, true);
- }
-
- tCallback = callback;
- tParam1 = param1;
- tParam2 = param2;
-
- timerAlarmWrite(timer, delayMsec * 1000UL, false); // Do not reload, we want it to be a single shot timer
- timerRestart(timer);
- timerAlarmEnable(timer);
- return true;
-}
-
-#endif
\ No newline at end of file
diff --git a/src/OSTimer.h b/src/OSTimer.h
deleted file mode 100644
index 37415f3a6e..0000000000
--- a/src/OSTimer.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-#include
-
-typedef void (*PendableFunction)(void *pvParameter1, uint32_t ulParameter2);
-
-/// Uses a hardware timer, but calls the handler in _interrupt_ context
-bool scheduleHWCallback(PendableFunction callback, void *param1, uint32_t param2, uint32_t delayMsec);
\ No newline at end of file
diff --git a/src/Power.cpp b/src/Power.cpp
index 19c5c99375..138b06e719 100644
--- a/src/Power.cpp
+++ b/src/Power.cpp
@@ -200,7 +200,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
}
#endif
-#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
+#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(HAS_PMU) && \
+ !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
if (hasINA()) {
LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage\n", config.power.device_battery_ina_address);
return getINAVoltage();
@@ -420,7 +421,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
}
#endif
-#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO)
+#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
uint16_t getINAVoltage()
{
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
diff --git a/src/RedirectablePrint.cpp b/src/RedirectablePrint.cpp
index 9c3dcdc987..05d349de92 100644
--- a/src/RedirectablePrint.cpp
+++ b/src/RedirectablePrint.cpp
@@ -49,7 +49,11 @@ size_t RedirectablePrint::write(uint8_t c)
size_t RedirectablePrint::vprintf(const char *logLevel, const char *format, va_list arg)
{
va_list copy;
+#if ENABLE_JSON_LOGGING || ARCH_PORTDUINO
+ static char printBuf[512];
+#else
static char printBuf[160];
+#endif
va_copy(copy, arg);
size_t len = vsnprintf(printBuf, sizeof(printBuf), format, copy);
@@ -98,6 +102,8 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format,
Print::write("\u001b[33m", 6);
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0)
Print::write("\u001b[31m", 6);
+ if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
+ Print::write("\u001b[35m", 6);
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile
if (rtc_sec > 0) {
long hms = rtc_sec % SEC_PER_DAY;
@@ -244,7 +250,21 @@ meshtastic_LogRecord_Level RedirectablePrint::getLogLevel(const char *logLevel)
void RedirectablePrint::log(const char *logLevel, const char *format, ...)
{
-#ifdef ARCH_PORTDUINO
+#if ARCH_PORTDUINO
+ // level trace is special, two possible ways to handle it.
+ if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0) {
+ if (settingsStrings[traceFilename] != "") {
+ va_list arg;
+ va_start(arg, format);
+ try {
+ traceFile << va_arg(arg, char *) << std::endl;
+ } catch (const std::ios_base::failure &e) {
+ }
+ va_end(arg);
+ }
+ if (settingsMap[logoutputlevel] < level_trace && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
+ return;
+ }
if (settingsMap[logoutputlevel] < level_debug && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
return;
else if (settingsMap[logoutputlevel] < level_info && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
diff --git a/src/SerialConsole.cpp b/src/SerialConsole.cpp
index 9a9331e473..d25b81da7b 100644
--- a/src/SerialConsole.cpp
+++ b/src/SerialConsole.cpp
@@ -96,7 +96,7 @@ bool SerialConsole::handleToRadio(const uint8_t *buf, size_t len)
void SerialConsole::log_to_serial(const char *logLevel, const char *format, va_list arg)
{
- if (usingProtobufs) {
+ if (usingProtobufs && config.device.debug_log_enabled) {
meshtastic_LogRecord_Level ll = meshtastic_LogRecord_Level_UNSET; // default to unset
switch (logLevel[0]) {
case 'D':
@@ -120,4 +120,4 @@ void SerialConsole::log_to_serial(const char *logLevel, const char *format, va_l
emitLogRecord(ll, thread ? thread->ThreadName.c_str() : "", format, arg);
} else
RedirectablePrint::log_to_serial(logLevel, format, arg);
-}
\ No newline at end of file
+}
diff --git a/src/StatusHandler.h b/src/StatusHandler.h
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/src/configuration.h b/src/configuration.h
index f069669536..4c5b3bc601 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -52,10 +52,6 @@ along with this program. If not, see .
// Configuration
// -----------------------------------------------------------------------------
-// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
-// we don't support jtag on the ttgo - access to gpio 12 is a PITA
-#define REQUIRE_RADIO true // If true, we will fail to start if the radio is not found
-
/// Convert a preprocessor name into a quoted string
#define xstr(s) ystr(s)
#define ystr(s) #s
@@ -262,6 +258,7 @@ along with this program. If not, see .
#define MESHTASTIC_EXCLUDE_SCREEN 1
#define MESHTASTIC_EXCLUDE_MQTT 1
#define MESHTASTIC_EXCLUDE_POWERMON 1
+#define MESHTASTIC_EXCLUDE_I2C 1
#endif
// Turn off all optional modules
diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp
index 6b6d485b0a..d2892b7d42 100644
--- a/src/detect/ScanI2CTwoWire.cpp
+++ b/src/detect/ScanI2CTwoWire.cpp
@@ -1,7 +1,8 @@
#include "ScanI2CTwoWire.h"
+#if !MESHTASTIC_EXCLUDE_I2C
+
#include "concurrency/LockGuard.h"
-#include "configuration.h"
#if defined(ARCH_PORTDUINO)
#include "linux/LinuxHardwareI2C.h"
#endif
@@ -403,3 +404,4 @@ size_t ScanI2CTwoWire::countDevices() const
{
return foundDevices.size();
}
+#endif
\ No newline at end of file
diff --git a/src/detect/ScanI2CTwoWire.h b/src/detect/ScanI2CTwoWire.h
index 82b48f6b47..c8dd96469a 100644
--- a/src/detect/ScanI2CTwoWire.h
+++ b/src/detect/ScanI2CTwoWire.h
@@ -1,5 +1,8 @@
#pragma once
+#include "configuration.h"
+#if !MESHTASTIC_EXCLUDE_I2C
+
#include