Index: dialin/dg/accelerometer.py =================================================================== diff -u -r6f6b6c076ce638b404534b2bf04cb3f986ee6b26 -ra0370d7df824c38cc35a1ab57b6efe1e2f8b1ca8 --- dialin/dg/accelerometer.py (.../accelerometer.py) (revision 6f6b6c076ce638b404534b2bf04cb3f986ee6b26) +++ dialin/dg/accelerometer.py (.../accelerometer.py) (revision a0370d7df824c38cc35a1ab57b6efe1e2f8b1ca8) @@ -271,11 +271,15 @@ """ Constructs and sends the DG accelerometer axis calibration offsets message to the DG. + @param x_offset: float - calibration offset for X axis + @param y_offset: float - calibration offset for Y axis + @param z_offset: float - calibration offset for Z axis + @return: 1 if successful, zero otherwise """ - x = integer_to_bytearray(x_offset) - y = integer_to_bytearray(y_offset) - z = integer_to_bytearray(z_offset) + x = float_to_bytearray(x_offset) + y = float_to_bytearray(y_offset) + z = float_to_bytearray(z_offset) payload = x + y + z message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, Index: dialin/hd/accelerometer.py =================================================================== diff -u -r6f6b6c076ce638b404534b2bf04cb3f986ee6b26 -ra0370d7df824c38cc35a1ab57b6efe1e2f8b1ca8 --- dialin/hd/accelerometer.py (.../accelerometer.py) (revision 6f6b6c076ce638b404534b2bf04cb3f986ee6b26) +++ dialin/hd/accelerometer.py (.../accelerometer.py) (revision a0370d7df824c38cc35a1ab57b6efe1e2f8b1ca8) @@ -271,11 +271,15 @@ """ Constructs and sends the HD accelerometer axis calibration offsets message to the HD. + @param x_offset: float - calibration offset for X axis + @param y_offset: float - calibration offset for Y axis + @param z_offset: float - calibration offset for Z axis + @return: 1 if successful, zero otherwise """ - x = integer_to_bytearray(x_offset) - y = integer_to_bytearray(y_offset) - z = integer_to_bytearray(z_offset) + x = float_to_bytearray(x_offset) + y = float_to_bytearray(y_offset) + z = float_to_bytearray(z_offset) payload = x + y + z message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, Index: tests/set_accels_cal.py =================================================================== diff -u -rd134777c4f35ca58a14720a668c155bed3b0c124 -ra0370d7df824c38cc35a1ab57b6efe1e2f8b1ca8 --- tests/set_accels_cal.py (.../set_accels_cal.py) (revision d134777c4f35ca58a14720a668c155bed3b0c124) +++ tests/set_accels_cal.py (.../set_accels_cal.py) (revision a0370d7df824c38cc35a1ab57b6efe1e2f8b1ca8) @@ -31,29 +31,31 @@ # log in to HD and DG as tester if hd.cmd_log_in_to_hd() == 0: exit(1) - if dg.cmd_log_in_to_dg() == 0: - exit(1) + #if dg.cmd_log_in_to_dg() == 0: + # exit(1) sleep(1) #reset calibrations hd.accel.cmd_set_accel_calibration(0, 0, 0) - dg.accel.cmd_set_accel_calibration(0, 0, 0) + #dg.accel.cmd_set_accel_calibration(0, 0, 0) #wait for new readings after calibration reset sleep(5) #calculate offsets (assuming HD and DG systems are level) hd_offsets = hd.accel.get_accel_vector() - dg_offsets = dg.accel.get_accel_vector() - hd_offsets.x *= -1 - hd_offsets.y *= -1 - hd_offsets.z -= 1 + #dg_offsets = dg.accel.get_accel_vector() + hd_offsets.x *= -1.0 + hd_offsets.y *= -1.0 + hd_offsets.z -= 1.0 hd_offsets.z *= -1 - dg_offsets.x *= -1 - dg_offsets.y *= -1 - dg_offsets.z -= 1 - dg_offsets.z *= -1 + #dg_offsets.x *= -1.0 + #dg_offsets.y *= -1.0 + #dg_offsets.z -= 1.0 + #dg_offsets.z *= -1.0 #set new offsets hd.accel.cmd_set_accel_calibration(hd_offsets.x, hd_offsets.y, hd_offsets.z) - dg.accel.cmd_set_accel_calibration(dg_offsets.x, dg_offsets.y, dg_offsets.z) + #dg.accel.cmd_set_accel_calibration(dg_offsets.x, dg_offsets.y, dg_offsets.z) + + exit(0)