Skip to content

Commit

Permalink
Merge pull request #170 from augustozanellato/fix_factory_reset
Browse files Browse the repository at this point in the history
Fix factory reset hang/wdt reset
  • Loading branch information
doegox authored Oct 13, 2023
2 parents 15bcae7 + b35c1fa commit f9be867
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...

## [unreleased][unreleased]
- Fixed factory reset hanging (@augustozanellato)
- Changed fds_write_sync to take length in bytes instead of next multiple of 4 (@doegox)
- Fixed field LED when LF reading and HF cloning (@doegox)
- Added renaming of slot into "cloned" when having cloned an ID/UID with a button (@doegox)
Expand Down
7 changes: 6 additions & 1 deletion firmware/application/src/utils/fds_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ static struct {
uint16_t key; // file key
bool success; // task is success
bool waiting; // task waiting done.
bool ignore_pm; // ignore peer manager records, defaults to true, set to false by fds_wipe
} fds_operation_info;


Expand Down Expand Up @@ -192,10 +193,12 @@ static bool is_peer_manager_record(uint16_t id_or_key) {
*/
static void fds_evt_handler(fds_evt_t const *p_evt) {
// Skip peermanager event
if (is_peer_manager_record(p_evt->write.record_key)
if (fds_operation_info.ignore_pm && (
is_peer_manager_record(p_evt->write.record_key)
|| is_peer_manager_record(p_evt->write.file_id)
|| is_peer_manager_record(p_evt->del.record_key)
|| is_peer_manager_record(p_evt->del.file_id)
)
) {
return;
}
Expand Down Expand Up @@ -264,6 +267,7 @@ static void fds_evt_handler(fds_evt_t const *p_evt) {
*Initialize the FDS library of NRF52
*/
void fds_util_init() {
fds_operation_info.ignore_pm = true;
// reset waiting flag
fds_operation_info.waiting = false;
//Register the incident first
Expand Down Expand Up @@ -311,6 +315,7 @@ static bool fds_next_record_delete_sync() {

bool fds_wipe(void) {
NRF_LOG_INFO("Full fds wipe requested");
fds_operation_info.ignore_pm = false; // wipe should also delete peer manager files.
while (fds_next_record_delete_sync()) {
bsp_wdt_feed();
}
Expand Down

0 comments on commit f9be867

Please sign in to comment.