decode the left_right_balance
Welcome to the forum, it is no secret: (I hope so)
mask 0x7F % contribution
right 0x80 data corresponds to right if set, otherwise unknown
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
decode = 'L/R '+ str(left) + '%-' + str(right)+'%'
decode = '?/? ' + str(left) + '%-' + str(right)+'%'
Thank you for your answer. Finally I've found some code in C and along with your instructions I've written my code:
right = record->left_right_balance&FIT;_LEFT_RIGHT_BALANCE_MASK;
printf("Right = %d\n",right);
printf("Left = %d\n",100.0-right);
where FIT_LEFT_RIGHT_BALANCE_INVALID is the value for no data, FIT_LEFT_RIGHT_BALANCE_RIGHT is the checking value for "data corresponds to right if set, otherwise unknown" and FIT_LEFT_RIGHT_BALANCE_MASK is the value to decode the contribution.
I'm a bit confused about the "data corresponds to right if set, otherwise unknown" statement. What is the meaning of "unknown"? Means that there is no data as it can be checked via FIT_LEFT_RIGHT_BALANCE_INVALID?, means that there is a value but it is meaningless?, or maybe means that the value is for the left leg?