Skip to content
Snippets Groups Projects
Commit 2b2460f5 authored by Thomas Juerges's avatar Thomas Juerges
Browse files

L2SS-170 Use of enumerations simplifies the RCU mask set-up

parent 4959ba23
No related branches found
No related tags found
1 merge request!22L2SS-170: First stab at an LTS cold start script
......@@ -189,26 +189,20 @@ def lts_cold_start():
#
#
# Steps 3.1 & 3.2
# 2021-04-30, Thomas
# This should be refactored into a function.
rcu_i2c_status = numpy.array(pcc.RCU_I2C_STATUS_R)
i2c_ok_rcus = numpy.where(rcu_i2c_status == 0, True, False)
i2c_not_ok_rcus = ~i2c_ok_rcus
adc_locked = pcc.RCU_ADC_lock_R
rcu = -1
for status in i2c_ok_rcus:
rcu = rcu + 1
if status is True:
logging.debug("RCU #{} is available.".format(rcu))
adc = -1
for lock in adc_locked[rcu]:
adc = adc + 1
if lock[adc] is False:
logging.warning("RCU #{} ADC #{} is unlocked. Please investigate! Will continue with normal operation.".format(rcu, adc))
rcu_mask = pcc.RCU_mask_RW
adc_locked = numpy.array(pcc.RCU_ADC_lock_R)
for rcu, i2c_status in enumerate(pcc.RCU_I2C_STATUS_R):
if i2c_status == 0:
pcc.RCU_mask_RW[rcu] = True
logging.info("RCU #{} is available.".format(rcu))
for adc, adc_is_locked in enumerate(adc_locked[rcu]):
if adc_is_locked < 1:
logging.warning("RCU#{}, ADC#{} is unlocked. Please investigate! Will continue with normal operation.".format(rcu, adc))
else:
# The RCU's I2C bus is not working.
pcc.RCU_mask_RW[rcu] = False
logging.warning("RCU #{}'s I2C is not working. Please investigate! Disabling RCU #{} to avoid damage.".format(rcu, rcu))
rcu_mask[rcu] = False
logging.error("RCU #{}'s I2C is not working. Please investigate! Disabling RCU #{} to avoid damage.".format(rcu, rcu))
pcc.RCU_mask_RW = rcu_mask
# Step 3.3
# Done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment