James RichandClaude Fable 5.1 7153c787ab Converge the mesh-peer advertisement on the slot count, and stop speaking for links we never held
Review of the previous commit found two problems with the re-arm-on-every-drop
change, both about the slot gate being a check-then-act across two tasks.

startAdvertising() reads the link count under lock and then makes its ble_gap
calls outside it - it has to, because the host task takes the same lock in
addLink and is also the task that delivers the HCI completion those calls block
on, so holding it across them would deadlock. A CONNECT landing in that window
takes the slot after the count said it was free, and the set goes on the air with
no room for the peer it attracts: a second mesh central then connects, both host
connection slots are mesh peers, and the phone API is locked out until one drops.
Now the slot-full branch stops a set it finds running, and the CONNECT-success
path asks for a re-arm so that branch is reached promptly. Whichever task wins
the race, the state converges on "slot held, set off" instead of staying wrong
until the next disconnect.

onDisconnect() logged "conn N disconnected (via ... advertisement)" and latched
pendingAdvertising for any handle at all, including links this transport never
held. With BLE_GATT_PEER off that meant every ordinary phone drop printed a
mesh-transport line about itself and armed an advertisement for a service that
does not exist. It now returns early for a handle the table does not know. This
costs the deferred-start (rc=ENOMEM) retry nothing: with the feature on,
onConnect registers every server link whichever advertising set it arrived on, so
a drop that could free a connection slot is always a link the table knows.

Built for heltec-v3 (pio run, 93 s). Still not flashed - the bench verification
in the previous commit's message covers this one too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-04 12:55:36 -05:00

Meshtastic Logo

Meshtastic Firmware

GitHub release downloads CI CLA assistant Fiscal Contributors Vercel

meshtastic%2Ffirmware | Trendshift

Overview

This repository contains the official device firmware for Meshtastic, an open-source LoRa mesh networking project designed for long-range, low-power communication without relying on internet or cellular infrastructure. The firmware supports various hardware platforms, including ESP32, nRF52, RP2040/RP2350, and Linux-based devices.

Meshtastic enables text messaging, location sharing, and telemetry over a decentralized mesh network, making it ideal for outdoor adventures, emergency preparedness, and remote operations.

Get Started

Join our community and help improve Meshtastic! 🚀

Stats

Alt

S
Description
No description provided
Readme GPL-3.0
320 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 72.7%
C 23.1%
Python 2.1%
Shell 1.5%
Batchfile 0.2%
Other 0.2%