You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Если имелся ввиду сдвиг на 8, то умножать следует на 256:
(gdb) p/x 0xbe * 255 + 0xef
$17 = 0xbe31
(gdb) p/x 0xbe * 256 + 0xef
$18 = 0xbeef
byte URMSerial::processDistance(int& value)
{
....
// 1x16bit value wrapped over two bytes
// HighByte must be multiplied by 255 to represent the correct byte
// Both are added together to calculate the value in Centimeters (I believe)
value = serialData[HighByte]*255+serialData[LowByte];
return DISTANCE;
}
The text was updated successfully, but these errors were encountered:
Если имелся ввиду сдвиг на 8, то умножать следует на 256:
(gdb) p/x 0xbe * 255 + 0xef
$17 = 0xbe31
(gdb) p/x 0xbe * 256 + 0xef
$18 = 0xbeef
byte URMSerial::processDistance(int& value)
{
....
// 1x16bit value wrapped over two bytes
// HighByte must be multiplied by 255 to represent the correct byte
// Both are added together to calculate the value in Centimeters (I believe)
value = serialData[HighByte]*255+serialData[LowByte];
return DISTANCE;
}
The text was updated successfully, but these errors were encountered: