Compare commits

...

6 Commits

Author SHA1 Message Date
Ben Meadors
fbc2bf3838 Update src/nimble/NimbleBluetooth.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-23 13:48:19 -06:00
Ben Meadors
dec8ff0339 Attribution 2025-12-23 13:37:20 -06:00
Ben Meadors
9dd9baf278 If incompatible NimBLE bonds exist in the NVS, delete them for fresh pairing 2025-12-23 13:34:02 -06:00
Jonathan Bennett
d609d05698 In statusLEDModule, also detect isCharging (#9050) 2025-12-23 07:48:55 -06:00
Ben Meadors
83c6161ac6 Revert "Automated version bumps (#9025)"
This reverts commit 1021d967da.
2025-12-20 14:10:02 -06:00
Ben Meadors
d93d68d31e Fix -ota.zip in manifest and build output 2025-12-20 14:09:05 -06:00
8 changed files with 92 additions and 13 deletions

View File

@@ -21,13 +21,14 @@ rm -f $BUILDDIR/firmware*
export APP_VERSION=$VERSION export APP_VERSION=$VERSION
basename=firmware-$1-$VERSION basename=firmware-$1-$VERSION
ota_basename=${basename}-ota
pio run --environment $1 -t mtjson # -v pio run --environment $1 -t mtjson # -v
cp $BUILDDIR/$basename.elf $OUTDIR/$basename.elf cp $BUILDDIR/$basename.elf $OUTDIR/$basename.elf
echo "Copying NRF52 dfu (OTA) file" echo "Copying NRF52 dfu (OTA) file"
cp $BUILDDIR/$basename.zip $OUTDIR/$basename.zip cp $BUILDDIR/$basename.zip $OUTDIR/$ota_basename.zip
echo "Copying NRF52 UF2 file" echo "Copying NRF52 UF2 file"
cp $BUILDDIR/$basename.uf2 $OUTDIR/$basename.uf2 cp $BUILDDIR/$basename.uf2 $OUTDIR/$basename.uf2

View File

@@ -87,9 +87,6 @@
</screenshots> </screenshots>
<releases> <releases>
<release version="2.7.18" date="2025-12-20">
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.18</url>
</release>
<release version="2.7.17" date="2025-11-28"> <release version="2.7.17" date="2025-11-28">
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.17</url> <url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.17</url>
</release> </release>

View File

@@ -17,6 +17,8 @@ lfsbin = f"{progname.replace('firmware-', 'littlefs-')}.bin"
def manifest_gather(source, target, env): def manifest_gather(source, target, env):
out = [] out = []
board_platform = env.BoardConfig().get("platform")
needs_ota_suffix = board_platform == "nordicnrf52"
check_paths = [ check_paths = [
progname, progname,
f"{progname}.elf", f"{progname}.elf",
@@ -32,8 +34,11 @@ def manifest_gather(source, target, env):
for p in check_paths: for p in check_paths:
f = env.File(env.subst(f"$BUILD_DIR/{p}")) f = env.File(env.subst(f"$BUILD_DIR/{p}"))
if f.exists(): if f.exists():
manifest_name = p
if needs_ota_suffix and p == f"{progname}.zip":
manifest_name = f"{progname}-ota.zip"
d = { d = {
"name": p, "name": manifest_name,
"md5": f.get_content_hash(), # Returns MD5 hash "md5": f.get_content_hash(), # Returns MD5 hash
"bytes": f.get_size() # Returns file size in bytes "bytes": f.get_size() # Returns file size in bytes
} }

6
debian/changelog vendored
View File

@@ -1,9 +1,3 @@
meshtasticd (2.7.18.0) unstable; urgency=medium
* Version 2.7.18
-- GitHub Actions <github-actions[bot]@users.noreply.github.com> Sat, 20 Dec 2025 15:47:25 +0000
meshtasticd (2.7.17.0) unstable; urgency=medium meshtasticd (2.7.17.0) unstable; urgency=medium
* Version 2.7.17 * Version 2.7.17

View File

@@ -429,7 +429,9 @@ int32_t PositionModule::runOnce()
if (lastGpsSend == 0 || msSinceLastSend >= intervalMs) { if (lastGpsSend == 0 || msSinceLastSend >= intervalMs) {
if (waitingForFreshPosition) { if (waitingForFreshPosition) {
#ifdef GPS_DEBUG
LOG_DEBUG("Skip initial position send; no fresh position since boot"); LOG_DEBUG("Skip initial position send; no fresh position since boot");
#endif
} else if (nodeDB->hasValidPosition(node)) { } else if (nodeDB->hasValidPosition(node)) {
lastGpsSend = now; lastGpsSend = now;

View File

@@ -20,7 +20,7 @@ int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg)
switch (arg->getStatusType()) { switch (arg->getStatusType()) {
case STATUS_TYPE_POWER: { case STATUS_TYPE_POWER: {
meshtastic::PowerStatus *powerStatus = (meshtastic::PowerStatus *)arg; meshtastic::PowerStatus *powerStatus = (meshtastic::PowerStatus *)arg;
if (powerStatus->getHasUSB()) { if (powerStatus->getHasUSB() || powerStatus->getIsCharging()) {
power_state = charging; power_state = charging;
if (powerStatus->getBatteryChargePercent() >= 100) { if (powerStatus->getBatteryChargePercent() >= 100) {
power_state = charged; power_state = charged;

View File

@@ -26,6 +26,16 @@
#include "nimble/nimble/host/include/host/ble_gap.h" #include "nimble/nimble/host/include/host/ble_gap.h"
#endif #endif
#ifdef ARCH_ESP32
#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_store.h"
#else
#include "nimble/nimble/host/include/host/ble_store.h"
#endif
#include <nvs.h>
#include <nvs_flash.h>
#endif
namespace namespace
{ {
constexpr uint16_t kPreferredBleMtu = 517; constexpr uint16_t kPreferredBleMtu = 517;
@@ -33,6 +43,72 @@ constexpr uint16_t kPreferredBleTxOctets = 251;
constexpr uint16_t kPreferredBleTxTimeUs = (kPreferredBleTxOctets + 14) * 8; constexpr uint16_t kPreferredBleTxTimeUs = (kPreferredBleTxOctets + 14) * 8;
} // namespace } // namespace
#ifdef ARCH_ESP32
// Credit: https://github.com/h2zero/NimBLE-Arduino/issues/740#issuecomment-2539923656
// Note: Despite the name, this function is invoked on every device boot (from setup()).
// It performs a routine startup check on the stored NimBLE bond data and deletes bonds
// only if a mismatch or migration condition is detected. It is not a one-time hook that
// runs only when the NimBLE version changes.
static void deleteBondsIfNimBLEVersionChanged()
{
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
err = nvs_flash_erase();
if (err != ESP_OK) {
LOG_ERROR("Failed to erase NVS for NimBLE migration, err=%d", err);
return;
}
err = nvs_flash_init();
if (err != ESP_OK) {
LOG_ERROR("Failed to re-init NVS after erase, err=%d", err);
return;
}
} else if (err != ESP_OK) {
LOG_ERROR("nvs_flash_init failed, err=%d", err);
return;
}
nvs_handle_t nimbleHandle = 0;
err = nvs_open("nimble_bond", NVS_READWRITE, &nimbleHandle);
if (err == ESP_ERR_NVS_NOT_FOUND) {
return;
}
if (err != ESP_OK) {
LOG_ERROR("Failed to open nimble_bond namespace, err=%d", err);
return;
}
size_t requiredSize = 0;
bool bondExists = nvs_get_blob(nimbleHandle, "peer_sec_1", nullptr, &requiredSize) == ESP_OK;
bool rpaExists = nvs_get_blob(nimbleHandle, "rpa_rec_1", nullptr, &requiredSize) == ESP_OK;
bool irkExists = nvs_get_blob(nimbleHandle, "local_irk_1", nullptr, &requiredSize) == ESP_OK;
bool erasePartition = false;
#if defined(BLE_STORE_OBJ_TYPE_LOCAL_IRK)
erasePartition = bondExists && !rpaExists;
#else
erasePartition = rpaExists || irkExists;
#endif
bool restartRequired = false;
if (erasePartition) {
LOG_WARN("Clearing NimBLE bonds due to version migration");
if (nvs_erase_all(nimbleHandle) != ESP_OK || nvs_commit(nimbleHandle) != ESP_OK) {
LOG_ERROR("Failed to erase nimble_bond namespace");
} else {
restartRequired = true;
}
}
nvs_close(nimbleHandle);
if (restartRequired) {
LOG_INFO("Restarting after NimBLE bond cleanup");
ESP.restart();
}
}
#endif
// Debugging options: careful, they slow things down quite a bit! // Debugging options: careful, they slow things down quite a bit!
// #define DEBUG_NIMBLE_ON_READ_TIMING // uncomment to time onRead duration // #define DEBUG_NIMBLE_ON_READ_TIMING // uncomment to time onRead duration
// #define DEBUG_NIMBLE_ON_WRITE_TIMING // uncomment to time onWrite duration // #define DEBUG_NIMBLE_ON_WRITE_TIMING // uncomment to time onWrite duration
@@ -800,6 +876,10 @@ void NimbleBluetooth::setup()
// Uncomment for testing // Uncomment for testing
// NimbleBluetooth::clearBonds(); // NimbleBluetooth::clearBonds();
#ifdef ARCH_ESP32
deleteBondsIfNimBLEVersionChanged();
#endif
LOG_INFO("Init the NimBLE bluetooth module"); LOG_INFO("Init the NimBLE bluetooth module");
NimBLEDevice::init(getDeviceName()); NimBLEDevice::init(getDeviceName());

View File

@@ -1,4 +1,4 @@
[VERSION] [VERSION]
major = 2 major = 2
minor = 7 minor = 7
build = 18 build = 17