Closed IhorNehrutsa closed 3 years ago
Was the overflow incorrectly handled? What do you think is the issue here?
Overflow is not happen.I check it. Thre is uint32 to int32 convertation bug.
CNT is defined as uint32_t, but has count diapasone 0...65535 as uint16_t We should treat it as int16_t -32768... 32767. Like in the encoder. I will test this tomorrow.
https://github.com/CAP1Sup/Intellistep/blob/f292d5d595b82d5efa1879fca8f6c93d19482ed4/src/hardware/motor.cpp#L145-L148 If direction of input pulses is negative the return is positive instead of -1 return 65535 instead of -2 return 65534 instead of -3 return 65533 ...