Index: tests/peter/test_hd_records.py =================================================================== diff -u -r89f9210ef5bf37a6812c4dc06aaa636dd47b9d72 -r47eb368c929e01fbff7d7749a822ee0efb467ea5 --- tests/peter/test_hd_records.py (.../test_hd_records.py) (revision 89f9210ef5bf37a6812c4dc06aaa636dd47b9d72) +++ tests/peter/test_hd_records.py (.../test_hd_records.py) (revision 47eb368c929e01fbff7d7749a822ee0efb467ea5) @@ -21,7 +21,9 @@ print("Message: {0}".format(message)) self.received = message.get(self.prop, False) + def test_hd_calibration_record(): + hd = HD(log_level="DEBUG") if hd.cmd_log_in_to_hd(resend=False): observer = Observer("hd_calibration_record") @@ -30,18 +32,25 @@ while not observer.received: sleep(0.2) - hd.calibration_record.cmd_set_hd_calibration_record(hd.calibration_record.hd_calibration_record) - # store the old record after reading it from fw record_old_formatted = pprint.pformat(hd.calibration_record.hd_calibration_record, indent=4) - with open("/home/fw/projects/dialin/tests/peter/hd_cal_record_old.log", 'w') as f: + with open("/home/fw/projects/dialin/tests/peter/hd_cal_record.log", 'w') as f: f.write(record_old_formatted) - hd.calibration_record.hd_calibration_record["flow_sensors"]["fmb"]["third_order"][1] = 0.0 - hd.calibration_record.hd_calibration_record["flow_sensors"]["fmb"]["cal_time"][1] = \ + hd.calibration_record.hd_calibration_record["accelerometer_sensor"]["accelerometer"]["y_offset"][1] = 0.0 + hd.calibration_record.hd_calibration_record["accelerometer_sensor"]["accelerometer"]["cal_time"][1] = \ NVOpsUtils.get_current_time_in_epoch() - hd.calibration_record.hd_calibration_record["flow_sensors"]["fmb"]["crc"][1] = \ - NVOpsUtils.get_group_record_crc(hd.calibration_record.hd_calibration_record["flow_sensors"]["fmb"]) + hd.calibration_record.hd_calibration_record["accelerometer_sensor"]["accelerometer"]["crc"][1] = \ + NVOpsUtils.get_group_record_crc(hd.calibration_record.hd_calibration_record["accelerometer_sensor"]["accelerometer"]) + + hd.calibration_record.hd_calibration_record["heparin_force_sensor"]["heparin_force"]["fourth_order"][1] = 0.0 + hd.calibration_record.hd_calibration_record["heparin_force_sensor"]["heparin_force"]["third_order"][1] = 0.0 + hd.calibration_record.hd_calibration_record["heparin_force_sensor"]["heparin_force"]["second_order"][1] = 0.0 + hd.calibration_record.hd_calibration_record["heparin_force_sensor"]["heparin_force"]["cal_time"][1] = \ + NVOpsUtils.get_current_time_in_epoch() + hd.calibration_record.hd_calibration_record["heparin_force_sensor"]["heparin_force"]["crc"][1] = \ + NVOpsUtils.get_group_record_crc(hd.calibration_record.hd_calibration_record["heparin_force_sensor"]["heparin_force"]) + print(hd.calibration_record.hd_calibration_record) hd.calibration_record.cmd_set_hd_calibration_record(hd.calibration_record.hd_calibration_record) @@ -68,16 +77,15 @@ hd.service_record.cmd_set_hd_service_record(hd.service_record.hd_service_record) -def test_hd_reset_system_record(): +def test_hd_reset_record_record(): hd = HD(log_level="DEBUG") if hd.cmd_log_in_to_hd(resend=False): - hd.system_record.prepare_hd_system_record() - hd.system_record.hd_system_record["system_record"]["crc"][1] = \ - NVOpsUtils.get_group_record_crc(hd.system_record.hd_system_record["system_record"]) - print(hd.system_record.hd_system_record) - hd.system_record.cmd_set_hd_system_record(hd.system_record.hd_system_record) + hd.calibration_record.cmd_reset_hd_calibration_record() + hd.system_record.cmd_reset_hd_system_record() + hd.service_record.cmd_reset_hd_service_record() + def test_hd_system_record(): hd = HD(log_level="DEBUG") if hd.cmd_log_in_to_hd(resend=False): @@ -93,7 +101,7 @@ f.write(record_old_formatted) hd.system_record.hd_system_record["system_record"]["top_level_pn"][1] = "ASD-S1234" - hd.system_record.hd_system_record["system_record"]["top_level_sn"][1] = "3" + hd.system_record.hd_system_record["system_record"]["top_level_sn"][1] = "ASD-S1234" hd.system_record.hd_system_record["system_record"]["mfg_location"][1] = 9 hd.system_record.hd_system_record["system_record"]["crc"][1] = \ NVOpsUtils.get_group_record_crc(hd.system_record.hd_system_record["system_record"]) @@ -102,8 +110,8 @@ if __name__ == "__main__": - test_hd_reset_calibration_record() - #test_hd_calibration_record() + #test_hd_reset_record_record() + test_hd_calibration_record() # test_hd_service_record() #test_hd_reset_system_record() #test_hd_system_record()