You are here: Forum Home → ANT Developers Forums → ANT+ FIT Forum Has Moved → Thread
decode the left_right_balance
right = (value & 0b01111111)
left = 100 - right
set_right = (value & 0b10000000) >> 7
if set_right:
decode = 'L/R '+ str(left) + '%-' + str(right)+'%'
else:
decode = '?/? ' + str(left) + '%-' + str(right)+'%'
decode the left_right_balance
Welcome to the forum, it is no secret: (I hope so)
left_right_balance (uint8)
mask 0x7F % contribution
right 0x80 data corresponds to right if set, otherwise unknown
left_right_balance_100 (uint16)
mask 0x3FFF % contribution scaled by 100
right 0x8000 data corresponds to right if set, otherwise unknown
left_right_balance e.g. in Python:
right = (value & 0b01111111)
left = 100 - right
set_right = (value & 0b10000000) >> 7
if set_right:
decode = 'L/R '+ str(left) + '%-' + str(right)+'%'
else:
decode = '?/? ' + str(left) + '%-' + str(right)+'%'
int right=0;
if((record->left_right_balance!=FIT_LEFT_RIGHT_BALANCE_INVALID)&&
(record->left_right_balance&FIT;_LEFT_RIGHT_BALANCE_RIGHT))
{
right = record->left_right_balance&FIT;_LEFT_RIGHT_BALANCE_MASK;
printf("Right = %d\n",right);
printf("Left = %d\n",100.0-right);
}
I'm a bit confused about the "data corresponds to right if set, otherwise unknown" statement. What is the meaning of "unknown"?
if set (1): balance value is for right
if not set (0): balance value is for right or for left, it is unknown
it means:
if set (1): balance value is for right
if not set (0): balance value is for right or for left, it is unknown
(and please: reduce the quote )