Skip to content
Snippets Groups Projects

Modified the scripts to run on Raspberry Pi.

1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
+ 6
2
@@ -75,7 +75,9 @@ def read_pol(node_nr, i2c_addr):
@@ -75,7 +75,9 @@ def read_pol(node_nr, i2c_addr):
if ret_ack < 1:
if ret_ack < 1:
print("no device found")
print("no device found")
else:
else:
 
sleep(0.1)
ret_ack, vout_mod = LOC_PWR.read_bytes(LP_VOUT_MODE, 1)
ret_ack, vout_mod = LOC_PWR.read_bytes(LP_VOUT_MODE, 1)
 
sleep(0.1)
ret_ack, raw_value = LOC_PWR.read_bytes(LP_VOUT, 2)
ret_ack, raw_value = LOC_PWR.read_bytes(LP_VOUT, 2)
vout_mod = int(vout_mod,16)
vout_mod = int(vout_mod,16)
ret_value = []
ret_value = []
@@ -83,12 +85,14 @@ def read_pol(node_nr, i2c_addr):
@@ -83,12 +85,14 @@ def read_pol(node_nr, i2c_addr):
ret_value.append(int(raw_value[2:], 16))
ret_value.append(int(raw_value[2:], 16))
vout = calc_lin_3bytes(ret_value, [vout_mod])
vout = calc_lin_3bytes(ret_value, [vout_mod])
stri = "Output voltage :{0: <5.2f} V ".format(vout)
stri = "Output voltage :{0: <5.2f} V ".format(vout)
 
sleep(0.1)
ret_ack, raw_value = LOC_PWR.read_bytes(LP_IOUT, 2)
ret_ack, raw_value = LOC_PWR.read_bytes(LP_IOUT, 2)
ret_value=[]
ret_value=[]
ret_value.append(int(raw_value[:2],16))
ret_value.append(int(raw_value[:2],16))
ret_value.append(int(raw_value[2:],16))
ret_value.append(int(raw_value[2:],16))
iout = calc_lin_2bytes(ret_value)
iout = calc_lin_2bytes(ret_value)
stri += "Output Current :{0: <5.2f} A ".format(iout)
stri += "Output Current :{0: <5.2f} A ".format(iout)
 
sleep(0.1)
ret_ack,raw_value = LOC_PWR.read_bytes(LP_temp, 2)
ret_ack,raw_value = LOC_PWR.read_bytes(LP_temp, 2)
ret_value=[]
ret_value=[]
ret_value.append(int(raw_value[:2],16))
ret_value.append(int(raw_value[:2],16))
@@ -160,7 +164,7 @@ def read_qsfp(node_nr = 0, module=0):
@@ -160,7 +164,7 @@ def read_qsfp(node_nr = 0, module=0):
stri = "Voltage QSFP in slot {0} node {1} is {2:3.2f} V".format(module, node_nr, Power_in_mod)
stri = "Voltage QSFP in slot {0} node {1} is {2:3.2f} V".format(module, node_nr, Power_in_mod)
print(stri)
print(stri)
if 1:
if 0:
rw_eeprom(0xCD)
rw_eeprom(0xCD)
for color in list(LED_COLORS.keys()):
for color in list(LED_COLORS.keys()):
print(color)
print(color)
@@ -171,7 +175,7 @@ if 1:
@@ -171,7 +175,7 @@ if 1:
for node_cnt in range(4):
for node_cnt in range(4):
for qsfp_cnt in range(6):
for qsfp_cnt in range(6):
read_qsfp(node_nr = node_cnt, module=qsfp_cnt)
read_qsfp(node_nr = node_cnt, module=qsfp_cnt)
#else:
else:
for node_cnt in range(4):
for node_cnt in range(4):
read_pol(node_cnt, LOC_POWER_CORE)
read_pol(node_cnt, LOC_POWER_CORE)
read_pol(-1,0x01)
read_pol(-1,0x01)
Loading