Skip to content

Commit f1429f4

Browse files
committed
fixed bug in upscaledPos calculation in C++ lib
1 parent 8645697 commit f1429f4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

C++/Library/src/ServoProject.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,11 @@ void DCServoCommunicator::run()
664664
}
665665
else
666666
{
667-
long int upscaledPos = static_cast<unsigned long int>(intReadBuffer[3]);
667+
long int upscaledPos = static_cast<unsigned short int>(intReadBuffer[3]);
668668
upscaledPos += (static_cast<long int>(charReadBuffer[9]) << 16);
669-
if (upscaledPos >= (2 << 23))
669+
if (upscaledPos >= (1 << 23))
670670
{
671-
upscaledPos -= (2 << 24);
671+
upscaledPos -= (1 << 24);
672672
}
673673

674674
long int encPosWithBacklashComp = intReadBuffer[10] + static_cast<long int>(intReadBuffer[11]);

0 commit comments

Comments
 (0)