Skip to content

Conversation

@oltaco
Copy link
Contributor

@oltaco oltaco commented Oct 31, 2025

refactored loadPrefsInt(), loadContacts(), loadChannels(), getBlobByKey() and putBlobByKey() to use openRead() and openWrite()

This gets rid of a few of the architecture ifdefs since that's already handled for us in openRead and openWrite.

Tested on nRF52 and ESP32, but should be fine for STM32 and RP2040 since it was already done this way elsewhere in DataStore (saveContacts for example already used openWrite with no arch ifdefs).

refactored loadPrefsInt(), loadContacts(), loadChannels(), getBlobByKey() and putBlobByKey() to use openRead() and openWrite()
@liamcottle
Copy link
Member

One thing to note here, is on nrf52, openWrite will delete the file before opening it. So I'm wondering if this will nuke all previous adv blobs each time you save a new one, since we don't write all of them back.

@oltaco oltaco marked this pull request as draft October 31, 2025 04:00
@oltaco
Copy link
Contributor Author

oltaco commented Oct 31, 2025

Good catch! 🤦‍♂️
I've reverted the change to putBlobByKey() since it's the only place we are still using seek() instead of remove then rewrite.

@oltaco oltaco marked this pull request as ready for review October 31, 2025 04:08
@liamcottle
Copy link
Member

Sweet! Looks good. Will leave for @ripplebiz to review in case I missed anything else

@liamcottle liamcottle requested a review from ripplebiz October 31, 2025 04:21
@ripplebiz ripplebiz merged commit ef75292 into meshcore-dev:dev Oct 31, 2025
@ripplebiz
Copy link
Collaborator

Nice. Like seeing the line count reduced! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants