File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -108,27 +108,20 @@ class drvAs5600 : public drvBase {
108108 WS_DEBUG_PRINTLN (" Magnet not detected!" );
109109 return false ;
110110 }
111-
112- // Continuously read and display angle values
113- uint16_t rawAngle = _as5600->getRawAngle ();
114- uint16_t angle = _as5600->getAngle ();
115-
116- WS_DEBUG_PRINT (" AS5600 Raw: " );
117- WS_DEBUG_PRINT (rawAngle);
118- WS_DEBUG_PRINT (" | Scaled: " );
119- WS_DEBUG_PRINT (angle);
120-
121- // Check status conditions
122111 if (_as5600->isAGCminGainOverflow ()) {
123- WS_DEBUG_PRINTLN (" | MH: magnet too strong" );
124- return false ;
112+ WS_DEBUG_PRINTLN (" MH: magnet too strong" );
113+ } else if (_as5600->isAGCmaxGainOverflow ()) {
114+ WS_DEBUG_PRINTLN (" ML: magnet too weak" );
115+ } else {
116+ uint16_t angle = _as5600->getAngle ();
117+ _angle = ((float )angle / 4095.0 ) * 360.0 ;
118+ return true ;
125119 }
126- if (_as5600->isAGCmaxGainOverflow ()) {
127- WS_DEBUG_PRINTLN (" | ML: magnet too weak" );
128- return false ;
129- }
130- _angle = ((float )angle / 4095.0 ) * 360.0 ;
131- return true ;
120+ // Show raw changing data if low/high value errors
121+ uint16_t rawAngle = _as5600->getRawAngle ();
122+ WS_DEBUG_PRINT (" AS5600 Raw: " );
123+ WS_DEBUG_PRINTLN (rawAngle);
124+ return false ;
132125 }
133126
134127 /* ******************************************************************************/
You can’t perform that action at this time.
0 commit comments