Skip to content

Commit 946be13

Browse files
authored
Merge branch 'develop' into mcp-server
2 parents db59d3b + 6208c24 commit 946be13

121 files changed

Lines changed: 6089 additions & 675 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_one_target.yml

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ on:
44
workflow_dispatch:
55
inputs:
66
# trunk-ignore(checkov/CKV_GHA_7)
7+
target:
8+
type: string
9+
required: false
10+
description: Choose the target board, e.g. nrf52_promicro_diy_tcxo. If blank, will find available targets.
711
arch:
812
type: choice
913
options:
14+
- all
1015
- esp32
1116
- esp32s3
1217
- esp32c3
@@ -15,32 +20,18 @@ on:
1520
- rp2040
1621
- rp2350
1722
- stm32
18-
target:
19-
type: string
20-
required: false
21-
description: Choose the target board, e.g. nrf52_promicro_diy_tcxo. If blank, will find available targets.
22-
# find-target:
23-
# type: boolean
24-
# default: true
25-
# description: 'Find the available targets'
23+
description: Choose an arch to limit the search, or 'all' to search all architectures.
24+
default: all
2625

2726
permissions: read-all
2827

2928
jobs:
3029
find-targets:
31-
if: ${{ inputs.target == '' }}
3230
strategy:
3331
fail-fast: false
3432
matrix:
3533
arch:
36-
- esp32
37-
- esp32s3
38-
- esp32c3
39-
- esp32c6
40-
- nrf52840
41-
- rp2040
42-
- rp2350
43-
- stm32
34+
- all
4435
runs-on: ubuntu-24.04
4536
steps:
4637
- uses: actions/checkout@v6
@@ -51,14 +42,37 @@ jobs:
5142
- run: pip install -U platformio
5243
- name: Generate matrix
5344
id: jsonStep
45+
env:
46+
BUILDTARGET: ${{ inputs.target }}
47+
MATRIXARCH: ${{ inputs.arch }}
5448
run: |
5549
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}} --level extra)
56-
echo "Name: $GITHUB_REF_NAME" >> $GITHUB_STEP_SUMMARY
57-
echo "Base: $GITHUB_BASE_REF" >> $GITHUB_STEP_SUMMARY
58-
echo "Arch: ${{matrix.arch}}" >> $GITHUB_STEP_SUMMARY
59-
echo "Ref: $GITHUB_REF" >> $GITHUB_STEP_SUMMARY
60-
echo "Targets:" >> $GITHUB_STEP_SUMMARY
61-
echo $TARGETS | jq -r 'sort_by(.board) |.[] | "- " + .board' >> $GITHUB_STEP_SUMMARY
50+
if [ "$BUILDTARGET" = "" ]; then
51+
echo "Name: $GITHUB_REF_NAME" >> $GITHUB_STEP_SUMMARY
52+
echo "Base: $GITHUB_BASE_REF" >> $GITHUB_STEP_SUMMARY
53+
echo "Arch: $MATRIXARCH" >> $GITHUB_STEP_SUMMARY
54+
echo "Ref: $GITHUB_REF" >> $GITHUB_STEP_SUMMARY
55+
echo "## 🎯 The following target boards are available to build:" >> $GITHUB_STEP_SUMMARY
56+
echo "| Platform | Board |" >> $GITHUB_STEP_SUMMARY
57+
echo "| -------- | ----- |" >> $GITHUB_STEP_SUMMARY
58+
echo $TARGETS | jq -r 'sort_by(.board) | sort_by(.platform) |.[] | "| " + .platform + " | " + .board + " |" ' >> $GITHUB_STEP_SUMMARY
59+
else
60+
echo "We build this one:" >> $GITHUB_STEP_SUMMARY
61+
ARCH=$(echo "$TARGETS" | jq --arg BUILDTARGET "$BUILDTARGET" -r '.[] | select(.board==$BUILDTARGET) | .platform')
62+
echo "| Platform | Board |" >> $GITHUB_STEP_SUMMARY
63+
echo "| -------- | ----- |" >> $GITHUB_STEP_SUMMARY
64+
echo "| $ARCH | "$BUILDTARGET" |" >> $GITHUB_STEP_SUMMARY
65+
echo "" >> $GITHUB_STEP_SUMMARY
66+
if [[ "$ARCH" == "" ]]; then
67+
echo "## ❌ Error: Target "$BUILDTARGET" not found!" >> $GITHUB_STEP_SUMMARY
68+
else
69+
echo "## ✅ Target "$BUILDTARGET" found, proceeding to build." >> $GITHUB_STEP_SUMMARY
70+
fi
71+
echo "You may need to refresh this page to make the built firmware appear below." >> $GITHUB_STEP_SUMMARY
72+
echo "arch=$ARCH" >> $GITHUB_OUTPUT
73+
fi
74+
outputs:
75+
arch: ${{ steps.jsonStep.outputs.arch }}
6276

6377
version:
6478
if: ${{ inputs.target != '' }}
@@ -78,12 +92,12 @@ jobs:
7892

7993
build:
8094
if: ${{ inputs.target != '' && inputs.arch != 'native' }}
81-
needs: [version]
95+
needs: [version, find-targets]
8296
uses: ./.github/workflows/build_firmware.yml
8397
with:
8498
version: ${{ needs.version.outputs.long }}
8599
pio_env: ${{ inputs.target }}
86-
platform: ${{ inputs.arch }}
100+
platform: ${{ needs.find-targets.outputs.arch }}
87101

88102
gather-artifacts:
89103
permissions:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
Lora:
3+
## Ebyte E80-900M22S
4+
## This is a bit experimental
5+
##
6+
##
7+
Module: lr1121
8+
gpiochip: 1 # subtract 32 from the gpio numbers
9+
DIO3_TCXO_VOLTAGE: 1.8
10+
CS: 16 #pin6 / GPIO48 1C0
11+
IRQ: 23 #pin17 / GPIO55 1C7
12+
Busy: 22 #pin16 / GPIO54 1C6
13+
Reset: 25 #pin13 / GPIO57 1D1
14+
15+
16+
spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19)
17+
spiSpeed: 2000000
18+
19+
rfswitch_table:
20+
pins: [DIO5, DIO6, DIO7]
21+
MODE_STBY: [LOW, LOW, LOW]
22+
MODE_RX: [LOW, HIGH, LOW]
23+
MODE_TX: [HIGH, HIGH, LOW]
24+
MODE_TX_HP: [HIGH, LOW, LOW]
25+
MODE_TX_HF: [LOW, LOW, LOW]
26+
MODE_GNSS: [LOW, LOW, HIGH]
27+
MODE_WIFI: [LOW, LOW, LOW]
28+
29+
General:
30+
MACAddressSource: eth0
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
Lora:
3+
## Ebyte E80-900M22S
4+
## This is a bit experimental
5+
##
6+
##
7+
Module: lr1121
8+
gpiochip: 1 # subtract 32 from the gpio numbers
9+
DIO3_TCXO_VOLTAGE: 1.8
10+
CS: 16 #pin6 / GPIO48 1C0
11+
IRQ: 23 #pin17 / GPIO55 1C7
12+
Busy: 22 #pin16 / GPIO54 1C6
13+
Reset: 25 #pin13 / GPIO57 1D1
14+
15+
16+
spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19)
17+
spiSpeed: 2000000
18+
19+
rfswitch_table:
20+
pins:
21+
- DIO5
22+
- DIO6
23+
MODE_STBY:
24+
- LOW
25+
- LOW
26+
MODE_RX:
27+
- HIGH
28+
- LOW
29+
MODE_TX:
30+
- HIGH
31+
- HIGH
32+
MODE_TX_HP:
33+
- LOW
34+
- HIGH
35+
MODE_TX_HF:
36+
- LOW
37+
- LOW
38+
MODE_GNSS:
39+
- LOW
40+
- LOW
41+
MODE_WIFI:
42+
- LOW
43+
- LOW
44+
45+
General:
46+
MACAddressSource: eth0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
Lora:
3+
## Ebyte E80-900M22S
4+
## This is a bit experimental
5+
##
6+
##
7+
Module: lr1121
8+
gpiochip: 1 # subtract 32 from the gpio numbers
9+
DIO3_TCXO_VOLTAGE: 1.8
10+
CS: 16 #pin6 / GPIO48 1C0
11+
IRQ: 23 #pin17 / GPIO55 1C7
12+
Busy: 22 #pin16 / GPIO54 1C6
13+
Reset: 25 #pin13 / GPIO57 1D1
14+
15+
16+
spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19)
17+
spiSpeed: 2000000
18+
19+
rfswitch_table:
20+
pins: [DIO5, DIO6, DIO7]
21+
MODE_STBY: [LOW, LOW, LOW]
22+
MODE_RX: [LOW, LOW, LOW]
23+
MODE_TX: [LOW, HIGH, LOW]
24+
MODE_TX_HP: [HIGH, LOW, LOW]
25+
# MODE_TX_HF: []
26+
# MODE_GNSS: []
27+
MODE_WIFI: [LOW, LOW, LOW]
28+
29+
General:
30+
MACAddressSource: eth0
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# For use with Armbian luckfox-pico-max
2+
# Waveshare LoRa HAT for Raspberry Pi Pico
3+
# https://www.waveshare.com/wiki/Pico-LoRa-SX1262
4+
5+
Meta:
6+
name: luckfox-pico-max-ws-raspberry-pi-pico-hat
7+
support: community
8+
compatible:
9+
- luckfox-pico-max # Armbian
10+
11+
Lora:
12+
Module: sx1262
13+
DIO2_AS_RF_SWITCH: true
14+
DIO3_TCXO_VOLTAGE: true
15+
spidev: spidev0.0
16+
Busy: # GPIO1_C7 / GP2
17+
pin: 55
18+
gpiochip: 1
19+
line: 23
20+
CS: # GPIO1_C6 / GP3
21+
pin: 54
22+
gpiochip: 1
23+
line: 22
24+
Reset: # GPIO1_D1 / GP15
25+
pin: 57
26+
gpiochip: 1
27+
line: 25
28+
IRQ: # GPIO2_A2 / GP20
29+
pin: 66
30+
gpiochip: 2
31+
line: 2

platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ build_flags = -Wno-missing-field-initializers
5656
-DMESHTASTIC_EXCLUDE_POWERSTRESS=1 ; exclude power stress test module from main firmware
5757
-DMESHTASTIC_EXCLUDE_GENERIC_THREAD_MODULE=1
5858
-DMESHTASTIC_EXCLUDE_POWERMON=1
59-
-DMESHTASTIC_EXCLUDE_STATUS=1
6059
-D MAX_THREADS=40 ; As we've split modules, we have more threads to manage
61-
-DLED_BUILTIN=-1
6260
#-DBUILD_EPOCH=$UNIX_TIME ; set in platformio-custom.py now
6361
#-D OLED_PL=1
6462
#-D DEBUG_HEAP=1 ; uncomment to add free heap space / memory leak debugging logs
@@ -227,6 +225,8 @@ lib_deps =
227225
https://github.com/Sensirion/arduino-i2c-sfa3x/archive/refs/tags/1.0.0.zip
228226
# renovate: datasource=github-tags depName=Sensirion I2C SCD30 packageName=sensirion/arduino-i2c-scd30
229227
https://github.com/Sensirion/arduino-i2c-scd30/archive/refs/tags/1.0.0.zip
228+
# renovate: datasource=github-tags depName=arduino-sht packageName=sensirion/arduino-sht
229+
https://github.com/Sensirion/arduino-sht/archive/refs/tags/v1.2.6.zip
230230

231231
; Environmental sensors with BSEC2 (Bosch proprietary IAQ)
232232
[environmental_extra]

src/DisplayFormatters.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const char *DisplayFormatters::getModemPresetDisplayName(meshtastic_Config_LoRaC
44
bool usePreset)
55
{
66

7-
// If use_preset is false, always return "Custom"
7+
// If use_preset is false, always return "Custom" — callers such as RadioInterface and Channels
8+
// rely on this being a stable literal for channel-name hashing and default-channel detection.
89
if (!usePreset) {
910
return "Custom";
1011
}

src/Power.cpp

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@
4040
#include "concurrency/LockGuard.h"
4141
#endif
4242

43+
#if defined(ARCH_STM32WL) && defined(BATTERY_PIN)
44+
#include "stm32yyxx_ll_adc.h"
45+
46+
/* Analog read resolution */
47+
#if defined(LL_ADC_RESOLUTION_12B)
48+
#define LL_ADC_RESOLUTION LL_ADC_RESOLUTION_12B
49+
#define BATTERY_SENSE_RESOLUTION_BITS 12
50+
#elif defined(LL_ADC_DS_DATA_WIDTH_12_BIT)
51+
#define LL_ADC_RESOLUTION LL_ADC_DS_DATA_WIDTH_12_BIT
52+
#define BATTERY_SENSE_RESOLUTION_BITS 12
53+
#else
54+
#error "ADC resolution could not be defined!"
55+
#endif
56+
#define ADC_RANGE (1 << BATTERY_SENSE_RESOLUTION_BITS)
57+
#endif
58+
4359
#if defined(DEBUG_HEAP_MQTT) && !MESHTASTIC_EXCLUDE_MQTT
4460
#include "mqtt/MQTT.h"
4561
#include "target_specific.h"
@@ -328,11 +344,17 @@ class AnalogBatteryLevel : public HasBatteryLevel
328344
float scaled = 0;
329345

330346
battery_adcEnable();
331-
#ifdef ARCH_ESP32 // ADC block for espressif platforms
347+
#ifdef ARCH_STM32WL
348+
// STM32 ADC with VREFINT runtime calibration
349+
Vref = __LL_ADC_CALC_VREFANALOG_VOLTAGE(analogRead(AVREF), LL_ADC_RESOLUTION);
350+
raw = analogRead(BATTERY_PIN);
351+
scaled = __LL_ADC_CALC_DATA_TO_VOLTAGE(Vref, raw, LL_ADC_RESOLUTION);
352+
scaled *= operativeAdcMultiplier;
353+
#elif defined(ARCH_ESP32) // ADC block for espressif platforms
332354
raw = espAdcRead();
333355
scaled = esp_adc_cal_raw_to_voltage(raw, adc_characs);
334356
scaled *= operativeAdcMultiplier;
335-
#else // block for all other platforms
357+
#else // block for all other platforms
336358
#ifdef ARCH_NRF52
337359
concurrency::LockGuard saadcGuard(concurrency::nrf52SaadcLock);
338360
#endif
@@ -530,6 +552,11 @@ class AnalogBatteryLevel : public HasBatteryLevel
530552
bool initial_read_done = false;
531553
float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS);
532554
uint32_t last_read_time_ms = 0;
555+
#ifdef ARCH_STM32WL
556+
// 3300mV placeholder for STM32 errata where VREFINT factory calibration may be missing
557+
// (e.g. STM32U0, see DS14756 Rev 3 §2.4.1 "VREFINT offset")
558+
uint32_t Vref = 3300;
559+
#endif
533560

534561
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT)
535562

@@ -639,7 +666,9 @@ bool Power::analogInit()
639666
#define BATTERY_SENSE_RESOLUTION_BITS 10
640667
#endif
641668

642-
#ifdef ARCH_ESP32 // ESP32 needs special analog stuff
669+
#ifdef ARCH_STM32WL
670+
analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS);
671+
#elif defined(ARCH_ESP32) // ESP32 needs special analog stuff
643672

644673
#ifndef ADC_WIDTH // max resolution by default
645674
static const adc_bits_width_t width = ADC_WIDTH_BIT_12;
@@ -649,7 +678,7 @@ bool Power::analogInit()
649678
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
650679
adc1_config_width(width);
651680
adc1_config_channel_atten(adc_channel, atten);
652-
#else // ADC2
681+
#else // ADC2
653682
adc2_config_channel_atten(adc_channel, atten);
654683
#ifndef CONFIG_IDF_TARGET_ESP32S3
655684
// ADC2 wifi bug workaround
@@ -679,7 +708,7 @@ bool Power::analogInit()
679708

680709
// NRF52 ADC init moved to powerHAL_init in nrf52 platform
681710

682-
#ifndef ARCH_ESP32
711+
#if !defined(ARCH_ESP32) && !defined(ARCH_STM32WL)
683712
analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS);
684713
#endif
685714

src/RedirectablePrint.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format,
137137
if (color) {
138138
::printf("\u001b[0m");
139139
}
140-
::printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
140+
::printf("| %02d:%02d:%02d %u.%03u ", hour, min, sec, millis() / 1000, millis() % 1000);
141141
#else
142142
printf("%s ", logLevel);
143143
if (color) {
@@ -151,7 +151,7 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format,
151151
if (color) {
152152
::printf("\u001b[0m");
153153
}
154-
::printf("| ??:??:?? %u ", millis() / 1000);
154+
::printf("| ??:??:?? %u.%03u ", millis() / 1000, millis() % 1000);
155155
#else
156156
printf("%s ", logLevel);
157157
if (color) {

0 commit comments

Comments
 (0)