Fit direct OTA administration into RAK4631 Full

This commit is contained in:
mikecarper committed 2026-10-26 23:41:20 -07:00
1 parent 9d2f7a3e27
commit 7d413a6806
21 files changed
+1926 -61

No files matched your search

+2 -7
View File
@@ -74,14 +74,9 @@
#ifndef COMPANION_FEATURE_OTA_CLI
#define COMPANION_FEATURE_OTA_CLI 0
#endif
// Keep RAK4631 Full's existing feature set inside its application boundary.
// Other Full boards expose the new USB OTA admin helper by default.
// Full builds expose the USB OTA admin helper with their existing OTA CLI.
#ifndef COMPANION_FEATURE_DIRECT_OTA_ADMIN
#if defined(NRF52_PLATFORM) && defined(RAK_4631)
#define COMPANION_FEATURE_DIRECT_OTA_ADMIN 0
#else
#define COMPANION_FEATURE_DIRECT_OTA_ADMIN COMPANION_FEATURE_OTA_CLI
#endif
#define COMPANION_FEATURE_DIRECT_OTA_ADMIN COMPANION_FEATURE_OTA_CLI
#endif
#ifndef COMPANION_FEATURE_NETWORK_TERMINAL
#define COMPANION_FEATURE_NETWORK_TERMINAL 0
+3 -10
View File
@@ -6312,10 +6312,7 @@ __attribute__((noinline, cold)) bool MyMesh::handleDirectOtaFrame(size_t len) {
memcpy(peer.pub_key, key, PUB_KEY_SIZE);
if (!_ota_direct_admin.matches(peer, _ms->getMillis())) {
closeDirectOtaAdmin();
ContactInfo* contact = lookupContactByPubKey(key, PUB_KEY_SIZE);
if (contact) {
_ota_direct_contact = *contact;
} else {
if (!lookupContactByPubKey(key, PUB_KEY_SIZE)) {
// Empty anonymous slots are RAM-only. Never evict another request,
// add an accepted contact, or schedule a contact-store write.
for (unsigned i = 0; i < MAX_ANON_CONTACTS; ++i) {
@@ -6333,14 +6330,10 @@ __attribute__((noinline, cold)) bool MyMesh::handleDirectOtaFrame(size_t len) {
resetContactValue(*_ota_direct_transient);
_ota_direct_transient->id = peer;
_ota_direct_transient->out_path_len = 0;
_ota_direct_contact.id = peer;
}
if (!_ota_direct_contact.setPath(nullptr, 0)) {
closeDirectOtaAdmin();
writeErrFrame(ERR_CODE_BAD_STATE);
return true;
}
_ota_direct_contact.id = peer;
_ota_direct_contact.type = type;
_ota_direct_contact.out_path_len = 0;
_ota_direct_contact.sync_since = 0;
_ota_direct_contact.tx_radio = mesh::RADIO_TX_PRIMARY;
}