From aa153054b7353a49051fb164711f24ddf78064d9 Mon Sep 17 00:00:00 2001 From: nwdepatie Date: Tue, 4 Jun 2024 17:03:34 -0400 Subject: [PATCH] Account for bad reading --- CM7/Core/Src/encoder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CM7/Core/Src/encoder.c b/CM7/Core/Src/encoder.c index b6967b0..474eccc 100644 --- a/CM7/Core/Src/encoder.c +++ b/CM7/Core/Src/encoder.c @@ -85,7 +85,8 @@ void vEncoderObserver(void *pv_params) for (;;) { /* Retrieve SSI position */ - encoder_get_angle_ssi(encoder, &ssi_position); + if (encoder_get_angle_ssi(encoder, &ssi_position)); + continue; /* Fuse SSI position with incremental position */ msg.payload.rotor_position = (ssi_position + encoder_get_angle_incr(encoder)) / 2;