completely working!
This commit is contained in:
@ -173,6 +173,7 @@ def get_DATA(prt):
|
||||
print("Received "+str(prt.inWaiting())+" bytes.\n")
|
||||
if prt.inWaiting()!=GET_DATA_TOTAL_LENGTH:
|
||||
print("Error. Couldn't get DATA data.")
|
||||
print("receiven data len:", prt.inWaiting())
|
||||
return None
|
||||
|
||||
out_bytes = prt.read(GET_DATA_TOTAL_LENGTH)
|
||||
@ -324,18 +325,18 @@ def decode_DATA(dh):
|
||||
data = {}
|
||||
data['datetime'] = datetime.now()
|
||||
data['Header'] = get_word(dh, 0)
|
||||
data['I1'] = cnv.conv_I_N_to_mA(get_int_word(dh, 1))
|
||||
data['I2'] = cnv.conv_I_N_to_mA(get_int_word(dh, 2))
|
||||
data['TO_LSB'] = get_int_word(dh, 3)
|
||||
data['TO_MSB'] = get_int_word(dh, 4)
|
||||
data['Temp_1'] = cnv.conv_T_N_to_C(get_int_word(dh, 5))
|
||||
data['Temp_2'] = cnv.conv_T_N_to_C(get_int_word(dh, 6))
|
||||
data['Temp_Ext_1'] = cnv.conv_TExt_N_to_C(get_int_word(dh, 7))
|
||||
data['Temp_Ext_2'] = cnv.conv_TExt_N_to_C(get_int_word(dh, 8))
|
||||
data['MON_3V3'] = cnv.conv_U3V3_N_to_V(get_int_word(dh, 9))
|
||||
data['MON_5V1'] = cnv.conv_U5V_N_to_V(get_int_word(dh, 10))
|
||||
data['MON_5V2'] = cnv.conv_U5V_N_to_V(get_int_word(dh, 11))
|
||||
data['MON_7V0'] = cnv.conv_U7V_N_to_V(get_int_word(dh, 12))
|
||||
data['I1'] = cnv.conv_I_N_to_mA(get_int_word(dh, 1)) #LD1_param.POWER
|
||||
data['I2'] = cnv.conv_I_N_to_mA(get_int_word(dh, 2)) #LD2_param.POWER
|
||||
data['TO_LSB'] = get_int_word(dh, 3) #TO6_counter_LSB
|
||||
data['TO_MSB'] = get_int_word(dh, 4) #TO6_counter_MSB
|
||||
data['Temp_1'] = cnv.conv_T_N_to_C(get_int_word(dh, 5)) #LD1_param.LD_CURR_TEMP
|
||||
data['Temp_2'] = cnv.conv_T_N_to_C(get_int_word(dh, 6)) #LD2_param.LD_CURR_TEMP
|
||||
data['Temp_Ext_1'] = cnv.conv_TExt_N_to_C(get_int_word(dh, 7)) #U_Rt1_ext_Gain
|
||||
data['Temp_Ext_2'] = cnv.conv_TExt_N_to_C(get_int_word(dh, 8)) #U_Rt2_ext_Gain
|
||||
data['MON_3V3'] = cnv.conv_U3V3_N_to_V(get_int_word(dh, 9)) #3V_monitor
|
||||
data['MON_5V1'] = cnv.conv_U5V_N_to_V(get_int_word(dh, 10)) #5V1_monitor
|
||||
data['MON_5V2'] = cnv.conv_U5V_N_to_V(get_int_word(dh, 11)) #5V2_monitor
|
||||
data['MON_7V0'] = cnv.conv_U7V_N_to_V(get_int_word(dh, 12)) #7V_monitor
|
||||
data['Message_ID'] = get_word(dh, 13) # Last received command
|
||||
data['CRC'] = get_word(dh, 14)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user