Skip to content

Commit 89a8358

Browse files
authored
Merge branch 'master' into stm32wl
2 parents b9786d9 + 77cf5c6 commit 89a8358

Some content is hidden

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

63 files changed

+1610
-327
lines changed

.github/workflows/build_raspbian.yml

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ jobs:
1010
build-raspbian:
1111
runs-on: [self-hosted, linux, ARM64]
1212
steps:
13+
- name: Install libbluetooth
14+
shell: bash
15+
run: |
16+
apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev
17+
1318
- name: Checkout code
1419
uses: actions/checkout@v4
1520
with:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build Raspbian Arm
2+
3+
on: workflow_call
4+
5+
permissions:
6+
contents: write
7+
packages: write
8+
9+
jobs:
10+
build-raspbian-armv7l:
11+
runs-on: [self-hosted, linux, ARM]
12+
steps:
13+
- name: Install libbluetooth
14+
shell: bash
15+
run: |
16+
apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev
17+
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
ref: ${{github.event.pull_request.head.ref}}
23+
repository: ${{github.event.pull_request.head.repo.full_name}}
24+
25+
- name: Upgrade python tools
26+
shell: bash
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -U platformio adafruit-nrfutil
30+
pip install -U meshtastic --pre
31+
32+
- name: Upgrade platformio
33+
shell: bash
34+
run: |
35+
pio upgrade
36+
37+
- name: Build Raspbian
38+
run: bin/build-native.sh
39+
40+
- name: Get release version string
41+
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
42+
id: version
43+
44+
- name: Store binaries as an artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: firmware-raspbian-armv7l-${{ steps.version.outputs.version }}.zip
48+
overwrite: true
49+
path: |
50+
release/meshtasticd_linux_armv7l
51+
bin/config-dist.yaml

.github/workflows/main_matrix.yml

+20-12
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,12 @@ jobs:
103103
with:
104104
board: ${{ matrix.board }}
105105

106-
build-raspbian:
107-
strategy:
108-
fail-fast: false
109-
max-parallel: 1
110-
uses: ./.github/workflows/build_raspbian.yml
111-
112106
package-raspbian:
113107
uses: ./.github/workflows/package_raspbian.yml
114108

109+
package-raspbian-armv7l:
110+
uses: ./.github/workflows/package_raspbian_armv7l.yml
111+
115112
build-native:
116113
runs-on: ubuntu-latest
117114
steps:
@@ -195,10 +192,10 @@ jobs:
195192
build-esp32-s3,
196193
build-esp32-c3,
197194
build-nrf52,
198-
build-raspbian,
199195
build-native,
200196
build-rpi2040,
201197
package-raspbian,
198+
package-raspbian-armv7l,
202199
]
203200
steps:
204201
- name: Checkout code
@@ -220,7 +217,7 @@ jobs:
220217
id: version
221218

222219
- name: Move files up
223-
run: mv -b -t ./ ./release/meshtasticd_linux_aarch64 ./bin/config-dist.yaml
220+
run: mv -b -t ./ ./release/meshtasticd_linux_aarch64 ./release/meshtasticd_linux_armv7l ./bin/config-dist.yaml
224221

225222
- name: Repackage in single firmware zip
226223
uses: actions/upload-artifact@v4
@@ -233,7 +230,7 @@ jobs:
233230
./firmware-*-ota.zip
234231
./device-*.sh
235232
./device-*.bat
236-
./meshtasticd_linux_*64
233+
./meshtasticd_linux_*
237234
./config-dist.yaml
238235
./littlefs-*.bin
239236
./bleota*bin
@@ -303,8 +300,9 @@ jobs:
303300

304301
- uses: actions/download-artifact@v4
305302
with:
303+
pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb
306304
merge-multiple: true
307-
name: artifact-deb
305+
path: ./output
308306

309307
- name: Display structure of downloaded files
310308
run: ls -R
@@ -363,16 +361,26 @@ jobs:
363361
asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip
364362
asset_content_type: application/zip
365363

366-
- name: Add raspbian .deb
364+
- name: Add raspbian aarch64 .deb
367365
uses: actions/upload-release-asset@v1
368366
env:
369367
GITHUB_TOKEN: ${{ github.token }}
370368
with:
371369
upload_url: ${{ steps.create_release.outputs.upload_url }}
372-
asset_path: ./meshtasticd_${{ steps.version.outputs.version }}_arm64.deb
370+
asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_arm64.deb
373371
asset_name: meshtasticd_${{ steps.version.outputs.version }}_arm64.deb
374372
asset_content_type: application/vnd.debian.binary-package
375373

374+
- name: Add raspbian armv7l .deb
375+
uses: actions/upload-release-asset@v1
376+
env:
377+
GITHUB_TOKEN: ${{ github.token }}
378+
with:
379+
upload_url: ${{ steps.create_release.outputs.upload_url }}
380+
asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_armhf.deb
381+
asset_name: meshtasticd_${{ steps.version.outputs.version }}_armhf.deb
382+
asset_content_type: application/vnd.debian.binary-package
383+
376384
- name: Bump version.properties
377385
run: >-
378386
bin/bump_version.py

.github/workflows/package_raspbian.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272

7373
- uses: actions/upload-artifact@v4
7474
with:
75-
name: artifact-deb
75+
name: meshtasticd_${{ steps.version.outputs.version }}_arm64.deb
7676
overwrite: true
7777
path: |
7878
./*.deb
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Package Raspbian
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
build-raspbian_armv7l:
13+
uses: ./.github/workflows/build_raspbian_armv7l.yml
14+
15+
package-raspbian_armv7l:
16+
runs-on: ubuntu-latest
17+
needs: build-raspbian_armv7l
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
ref: ${{github.event.pull_request.head.ref}}
24+
repository: ${{github.event.pull_request.head.repo.full_name}}
25+
26+
- name: Pull web ui
27+
uses: dsaltares/fetch-gh-release-asset@master
28+
with:
29+
repo: meshtastic/web
30+
file: build.tar
31+
target: build.tar
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Get release version string
35+
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
36+
id: version
37+
38+
- name: Download artifacts
39+
uses: actions/download-artifact@v4
40+
with:
41+
name: firmware-raspbian-armv7l-${{ steps.version.outputs.version }}.zip
42+
merge-multiple: true
43+
44+
- name: Display structure of downloaded files
45+
run: ls -R
46+
47+
- name: build .debpkg
48+
run: |
49+
mkdir -p .debpkg/DEBIAN
50+
mkdir -p .debpkg/usr/share/doc/meshtasticd/web
51+
mkdir -p .debpkg/usr/sbin
52+
mkdir -p .debpkg/etc/meshtasticd
53+
mkdir -p .debpkg/usr/lib/systemd/system/
54+
tar -xf build.tar -C .debpkg/usr/share/doc/meshtasticd/web
55+
gunzip .debpkg/usr/share/doc/meshtasticd/web/*.gz
56+
cp release/meshtasticd_linux_armv7l .debpkg/usr/sbin/meshtasticd
57+
cp bin/config-dist.yaml .debpkg/etc/meshtasticd/config.yaml
58+
chmod +x .debpkg/usr/sbin/meshtasticd
59+
cp bin/meshtasticd.service .debpkg/usr/lib/systemd/system/meshtasticd.service
60+
echo "/etc/meshtasticd/config.yaml" > .debpkg/DEBIAN/conffiles
61+
chmod +x .debpkg/DEBIAN/conffiles
62+
63+
- uses: jiro4989/build-deb-action@v3
64+
with:
65+
package: meshtasticd
66+
package_root: .debpkg
67+
maintainer: Jonathan Bennett
68+
version: ${{ steps.version.outputs.version }} # refs/tags/v*.*.*
69+
arch: armhf
70+
depends: libyaml-cpp0.7, openssl, libulfius2.7
71+
desc: Native Linux Meshtastic binary.
72+
73+
- uses: actions/upload-artifact@v4
74+
with:
75+
name: meshtasticd_${{ steps.version.outputs.version }}_armhf.deb
76+
overwrite: true
77+
path: |
78+
./*.deb

arch/esp32/esp32.ini

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; Common settings for ESP targes, mixin with extends = esp32_base
22
[esp32_base]
33
extends = arduino_base
4-
platform = platformio/espressif32@6.3.2 # This is a temporary fix to the S3-based devices bluetooth issues until we can determine what within ESP-IDF changed and can develop a suitable patch.
4+
platform = platformio/espressif32@6.7.0
55

66
build_src_filter =
77
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> -<mesh/raspihttp>
@@ -15,8 +15,10 @@ board_build.filesystem = littlefs
1515
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
1616
# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
1717
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
18+
build_unflags = -fno-lto
1819
build_flags =
1920
${arduino_base.build_flags}
21+
-flto
2022
-Wall
2123
-Wextra
2224
-Isrc/platform/esp32

arch/portduino/portduino.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
22
[portduino_base]
3-
platform = https://github.com/meshtastic/platform-native.git#f5ec3c031b0fcd89c0523de9e43eef3a92d59292
3+
platform = https://github.com/meshtastic/platform-native.git#ad8112adf82ce1f5b917092cf32be07a077801a0
44
framework = arduino
55

66
build_src_filter =

bin/build-native.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
set -e
44

5+
platformioFailed() {
6+
[[ $VIRTUAL_ENV != "" ]] && exit 1 # don't hint at virtualenv if it's already in use
7+
echo -e "\nThere were issues running platformio and you are not using a virtual environment." \
8+
"\nYou may try setting up virtualenv and downloading the latest platformio from pip:" \
9+
"\n\tvirtualenv venv" \
10+
"\n\tsource venv/bin/activate" \
11+
"\n\tpip install platformio" \
12+
"\n\t./bin/build-native.sh # retry building"
13+
exit 1
14+
}
15+
516
VERSION=$(bin/buildinfo.py long)
617
SHORT_VERSION=$(bin/buildinfo.py short)
718

@@ -13,8 +24,8 @@ mkdir -p $OUTDIR/
1324
rm -r $OUTDIR/* || true
1425

1526
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
16-
platformio pkg update --environment native
17-
pio run --environment native
27+
platformio pkg update --environment native || platformioFailed
28+
pio run --environment native || platformioFailed
1829
cp .pio/build/native/program "$OUTDIR/meshtasticd_linux_$(uname -m)"
1930
cp bin/device-install.* $OUTDIR
2031
cp bin/device-update.* $OUTDIR

bin/platformio-custom.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# trunk-ignore-all(ruff/F821)
2+
# trunk-ignore-all(flake8/F821): For SConstruct imports
13
import sys
24
from os.path import join
35

@@ -60,6 +62,7 @@ def esp32_create_combined_bin(source, target, env):
6062
import esptool
6163

6264
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)
65+
env.Append(LINKFLAGS=["--specs=nano.specs", "-u", "_printf_float"])
6366

6467
Import("projenv")
6568

boards/tbeam-s3-core.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"-DBOARD_HAS_PSRAM",
99
"-DLILYGO_TBEAM_S3_CORE",
1010
"-DARDUINO_USB_CDC_ON_BOOT=1",
11-
"-DARDUINO_USB_MODE=1",
11+
"-DARDUINO_USB_MODE=0",
1212
"-DARDUINO_RUNNING_CORE=1",
1313
"-DARDUINO_EVENT_RUNNING_CORE=1"
1414
],

protobufs

src/Power.cpp

+17-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ RTC_NOINIT_ATTR uint64_t RTC_reg_b;
5050

5151
esp_adc_cal_characteristics_t *adc_characs = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));
5252
#ifndef ADC_ATTENUATION
53-
static const adc_atten_t atten = ADC_ATTEN_DB_11;
53+
static const adc_atten_t atten = ADC_ATTEN_DB_12;
5454
#else
5555
static const adc_atten_t atten = ADC_ATTENUATION;
5656
#endif
@@ -556,14 +556,24 @@ void Power::readPowerStatus()
556556
#ifdef NRF_APM // Section of code detects USB power on the RAK4631 and updates the power states. Takes 20 seconds or so to detect
557557
// changes.
558558

559+
static nrfx_power_usb_state_t prev_nrf_usb_state = (nrfx_power_usb_state_t)-1; // -1 so that state detected at boot
559560
nrfx_power_usb_state_t nrf_usb_state = nrfx_power_usbstatus_get();
560561

561-
if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED) {
562-
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
563-
NRF_USB = OptFalse;
564-
} else {
565-
powerFSM.trigger(EVENT_POWER_CONNECTED);
566-
NRF_USB = OptTrue;
562+
// If state changed
563+
if (nrf_usb_state != prev_nrf_usb_state) {
564+
// If changed to DISCONNECTED
565+
if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED) {
566+
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
567+
NRF_USB = OptFalse;
568+
}
569+
// If changed to CONNECTED / READY
570+
else {
571+
powerFSM.trigger(EVENT_POWER_CONNECTED);
572+
NRF_USB = OptTrue;
573+
}
574+
575+
// Cache the current state
576+
prev_nrf_usb_state = nrf_usb_state;
567577
}
568578
#endif
569579
// Notify any status instances that are observing us

src/PowerFSM.cpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,18 @@ void PowerFSM_setup()
348348

349349
powerFSM.add_transition(&stateDARK, &stateDARK, EVENT_CONTACT_FROM_PHONE, NULL, "Contact from phone");
350350

351-
powerFSM.add_timed_transition(&stateON, &stateDARK,
352-
Default::getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL,
353-
"Screen-on timeout");
354-
powerFSM.add_timed_transition(&statePOWER, &stateDARK,
355-
Default::getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL,
356-
"Screen-on timeout");
351+
#ifdef USE_EINK
352+
// Allow E-Ink devices to suppress the screensaver, if screen timeout set to 0
353+
if (config.display.screen_on_secs > 0)
354+
#endif
355+
{
356+
powerFSM.add_timed_transition(&stateON, &stateDARK,
357+
Default::getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs),
358+
NULL, "Screen-on timeout");
359+
powerFSM.add_timed_transition(&statePOWER, &stateDARK,
360+
Default::getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs),
361+
NULL, "Screen-on timeout");
362+
}
357363

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

0 commit comments

Comments
 (0)