From ac5d3f5c005a0449059d37d0d8a21886dbb0b7e2 Mon Sep 17 00:00:00 2001 From: Hayden Roche Date: Thu, 5 Oct 2023 08:15:09 -0700 Subject: [PATCH] Use NoteResetRequired instead of NoteReset when binary receive fails. (#108) --- n_helpers.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/n_helpers.c b/n_helpers.c index f923138d..c625c4b7 100644 --- a/n_helpers.c +++ b/n_helpers.c @@ -406,9 +406,9 @@ const char * NoteBinaryStoreReceive(uint8_t *buffer, uint32_t bufLen, // Ensure transaction was successful if (err) { - // Reset when a problem is detected, otherwise `note-c` - // will attempt to allocate memory to receive the response. - _Reset(); + // Queue a reset when a problem is detected, otherwise `note-c` will + // attempt to allocate memory to receive the response. + NoteResetRequired(); return ERRSTR(err, c_err); } @@ -416,9 +416,9 @@ const char * NoteBinaryStoreReceive(uint8_t *buffer, uint32_t bufLen, if (available) { const char *err = ERRSTR("unexpected data available", c_err); NOTE_C_LOG_ERROR(err); - // Reset when a problem is detected, otherwise `note-c` - // will attempt to allocate memory to receive the response. - _Reset(); + // Queue a reset when a problem is detected, otherwise `note-c` will + // attempt to allocate memory to receive the response. + NoteResetRequired(); return err; } @@ -434,9 +434,9 @@ const char * NoteBinaryStoreReceive(uint8_t *buffer, uint32_t bufLen, if (decodedLen != decLen) { const char *err = ERRSTR("length mismatch after decoding", c_err); NOTE_C_LOG_ERROR(err); - // Reset when a problem is detected, otherwise `note-c` - // will attempt to allocate memory to receive the response. - _Reset(); + // Queue a reset when a problem is detected, otherwise `note-c` will + // attempt to allocate memory to receive the response. + NoteResetRequired(); return err; }