From 147ac462b3eb7dca555ae32b799d31e87357a11b Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Thu, 7 May 2026 21:43:48 +0200 Subject: [PATCH] fix deleting public channel could wipe all other channels on reboot --- zephcore/app/CompanionMesh.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/zephcore/app/CompanionMesh.cpp b/zephcore/app/CompanionMesh.cpp index fee4714..6313a0e 100644 --- a/zephcore/app/CompanionMesh.cpp +++ b/zephcore/app/CompanionMesh.cpp @@ -599,15 +599,9 @@ bool CompanionMesh::onChannelLoaded(uint8_t idx, const ChannelDetails &ch) bool CompanionMesh::getChannelForSave(uint8_t idx, ChannelDetails &ch) { - // Only save channels that have content (non-empty name or non-zero secret) - if (getChannel(idx, ch)) { - // Check if channel has any content - if (ch.name[0] != '\0') return true; - // Check if secret is non-zero - static const uint8_t zeroes[32] = {0}; - if (memcmp(ch.channel.secret, zeroes, 32) != 0) return true; - } - return false; + /* Keep fixed-slot channel serialization compatible with Arduino. + * DataStore::saveChannels() expects contiguous indexes until false. */ + return getChannel(idx, ch); } /* Storage interface */