From 8cc1e5379e7078a4fe436ee250b4ee0b75491201 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 7 Feb 2019 16:23:00 +0100 Subject: [PATCH] tmc2130_read_gstat() read also reset flag. This reverts "Replace boolean operator with bitwise." --- MM-control-01/tmc2130.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MM-control-01/tmc2130.c b/MM-control-01/tmc2130.c index ee645866..7a136905 100644 --- a/MM-control-01/tmc2130.c +++ b/MM-control-01/tmc2130.c @@ -340,9 +340,12 @@ uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval) return stat; } -//! @brief Read global error flags for all axes +//! @brief Read global error flags for all axis //! //! Error is detected if any of following flags is set. +//! * reset +//! * IC has been reset since the last read access to GSTAT. +//! All registers have been cleared to reset values. //! * drv_err //! * Overtemperature or short circuit. Driver has been shut down. //! * uv_cp @@ -357,7 +360,7 @@ uint8_t tmc2130_read_gstat() { uint32_t result; tmc2130_rd(axis, TMC2130_REG_GSTAT, &result); - if (result & 0x6) retval += (1 << axis); + if (result & 0x7) retval += (1 << axis); } return retval; }