9 years, 7 months ago.

Problem in function calibrated_sensors()

The function :

void m3pi::calibrated_sensors(unsigned short ltab[5]) { unsigned i; _ser.putc(SEND_CALIB_SENSOR_VALUES); for(i=0;i<5;i++){ ltab[i] = (unsigned short) _ser.getc(); ltab[i] += _ser.getc() << 8; } }

shouldn't be written like this to have the values returned between 0 and 1000 ? :

void m3pi::calibrated_sensors(unsigned short ltab[5]) { unsigned i; _ser.putc(SEND_CALIB_SENSOR_VALUES); for(i=0;i<5;i++){ ltab[i] = _ser.getc() << 8; ltab[i] += _ser.getc(); } }

MSB and LSB have been swapped i think.

Question relating to:

Be the first to answer this question.