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(): ...@@ -189,26 +189,20 @@ def lts_cold_start():
# #
# #
# Steps 3.1 & 3.2 # Steps 3.1 & 3.2
# 2021-04-30, Thomas rcu_mask = pcc.RCU_mask_RW
# This should be refactored into a function. adc_locked = numpy.array(pcc.RCU_ADC_lock_R)
rcu_i2c_status = numpy.array(pcc.RCU_I2C_STATUS_R) for rcu, i2c_status in enumerate(pcc.RCU_I2C_STATUS_R):
i2c_ok_rcus = numpy.where(rcu_i2c_status == 0, True, False) if i2c_status == 0:
i2c_not_ok_rcus = ~i2c_ok_rcus pcc.RCU_mask_RW[rcu] = True
adc_locked = pcc.RCU_ADC_lock_R logging.info("RCU #{} is available.".format(rcu))
rcu = -1 for adc, adc_is_locked in enumerate(adc_locked[rcu]):
for status in i2c_ok_rcus: if adc_is_locked < 1:
rcu = rcu + 1 logging.warning("RCU#{}, ADC#{} is unlocked. Please investigate! Will continue with normal operation.".format(rcu, adc))
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))
else: else:
# The RCU's I2C bus is not working. # The RCU's I2C bus is not working.
pcc.RCU_mask_RW[rcu] = False rcu_mask[rcu] = False
logging.warning("RCU #{}'s I2C is not working. Please investigate! Disabling RCU #{} to avoid damage.".format(rcu, rcu)) 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 # Step 3.3
# Done # Done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment