stm32/boards/NUCLEO_WB55/rfcore_firmware.py: Fix bad variable name.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
520bb88d70
commit
dfb63b5613
@ -370,18 +370,18 @@ def resume():
|
|||||||
return _write_failure_state(REASON_RFCORE_NOT_CONFIGURED)
|
return _write_failure_state(REASON_RFCORE_NOT_CONFIGURED)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
_STATE_id = _read_state()
|
state = _read_state()
|
||||||
|
|
||||||
if _STATE_id == _STATE_IDLE:
|
if state == _STATE_IDLE:
|
||||||
log("Firmware update complete")
|
log("Firmware update complete")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
elif _STATE_id == _STATE_FAILED:
|
elif state == _STATE_FAILED:
|
||||||
log("Firmware update failed")
|
log("Firmware update failed")
|
||||||
return _read_failure_reason()
|
return _read_failure_reason()
|
||||||
|
|
||||||
# Keep calling GET_STATE until error or FUS.
|
# Keep calling GET_STATE until error or FUS.
|
||||||
elif _STATE_id == _STATE_WAITING_FOR_FUS:
|
elif state == _STATE_WAITING_FOR_FUS:
|
||||||
log("Querying FUS state")
|
log("Querying FUS state")
|
||||||
status, result = fus_get_state()
|
status, result = fus_get_state()
|
||||||
log("FUS state: {} {}", status, result)
|
log("FUS state: {} {}", status, result)
|
||||||
@ -395,7 +395,7 @@ def resume():
|
|||||||
_write_state(_STATE_CHECK_UPDATES)
|
_write_state(_STATE_CHECK_UPDATES)
|
||||||
|
|
||||||
# Keep trying to start the WS until !fus_active() (or error).
|
# Keep trying to start the WS until !fus_active() (or error).
|
||||||
elif _STATE_id == _STATE_WAITING_FOR_WS:
|
elif state == _STATE_WAITING_FOR_WS:
|
||||||
if stm.rfcore_status() != _MAGIC_FUS_ACTIVE:
|
if stm.rfcore_status() != _MAGIC_FUS_ACTIVE:
|
||||||
log("WS active")
|
log("WS active")
|
||||||
_write_state(_STATE_IDLE)
|
_write_state(_STATE_IDLE)
|
||||||
@ -410,7 +410,7 @@ def resume():
|
|||||||
_write_failure_state(REASON_NO_WS)
|
_write_failure_state(REASON_NO_WS)
|
||||||
|
|
||||||
# Sequence the FUS 1.0.2 -> FUS 1.1.0 -> WS (depending on what's available).
|
# Sequence the FUS 1.0.2 -> FUS 1.1.0 -> WS (depending on what's available).
|
||||||
elif _STATE_id == _STATE_CHECK_UPDATES:
|
elif state == _STATE_CHECK_UPDATES:
|
||||||
log("Checking for updates")
|
log("Checking for updates")
|
||||||
fus_version = stm.rfcore_fw_version(_FW_VERSION_FUS)
|
fus_version = stm.rfcore_fw_version(_FW_VERSION_FUS)
|
||||||
log("FUS version {}", fus_version)
|
log("FUS version {}", fus_version)
|
||||||
@ -448,13 +448,13 @@ def resume():
|
|||||||
# This shouldn't happen - the flash write should always complete and
|
# This shouldn't happen - the flash write should always complete and
|
||||||
# move straight onto the COPIED state. Failure here indicates that
|
# move straight onto the COPIED state. Failure here indicates that
|
||||||
# the rfcore is misconfigured or the WS firmware was not deleted first.
|
# the rfcore is misconfigured or the WS firmware was not deleted first.
|
||||||
elif _STATE_id == _STATE_COPYING_FUS or _STATE_id == _STATE_COPYING_WS:
|
elif state == _STATE_COPYING_FUS or state == _STATE_COPYING_WS:
|
||||||
log("Flash copy failed mid-write")
|
log("Flash copy failed mid-write")
|
||||||
_write_failure_state(REASON_FLASH_COPY_FAILED)
|
_write_failure_state(REASON_FLASH_COPY_FAILED)
|
||||||
|
|
||||||
# Flash write completed, we should immediately see GET_STATE return 0,0
|
# Flash write completed, we should immediately see GET_STATE return 0,0
|
||||||
# so we can start the FUS install.
|
# so we can start the FUS install.
|
||||||
elif _STATE_id == _STATE_COPIED_FUS:
|
elif state == _STATE_COPIED_FUS:
|
||||||
if fus_is_idle():
|
if fus_is_idle():
|
||||||
log("FUS copy complete, installing")
|
log("FUS copy complete, installing")
|
||||||
_write_state(_STATE_INSTALLING_FUS)
|
_write_state(_STATE_INSTALLING_FUS)
|
||||||
@ -466,7 +466,7 @@ def resume():
|
|||||||
# Keep polling the state until we see a 0,0 (success) or non-transient
|
# Keep polling the state until we see a 0,0 (success) or non-transient
|
||||||
# error. In general we should expect to see (16,0) several times,
|
# error. In general we should expect to see (16,0) several times,
|
||||||
# followed by a (255,0), followed by (0, 0).
|
# followed by a (255,0), followed by (0, 0).
|
||||||
elif _STATE_id == _STATE_INSTALLING_FUS:
|
elif state == _STATE_INSTALLING_FUS:
|
||||||
log("Installing FUS...")
|
log("Installing FUS...")
|
||||||
status, result = fus_get_state()
|
status, result = fus_get_state()
|
||||||
log("FUS state: {} {}", status, result)
|
log("FUS state: {} {}", status, result)
|
||||||
@ -492,7 +492,7 @@ def resume():
|
|||||||
# Keep polling the state until we see 0,0 or failure (1,0). Any other
|
# Keep polling the state until we see 0,0 or failure (1,0). Any other
|
||||||
# result means retry (but the docs say that 0 and 1 are the only
|
# result means retry (but the docs say that 0 and 1 are the only
|
||||||
# status values).
|
# status values).
|
||||||
elif _STATE_id == _STATE_DELETING_WS:
|
elif state == _STATE_DELETING_WS:
|
||||||
log("Deleting WS...")
|
log("Deleting WS...")
|
||||||
status, result = fus_get_state()
|
status, result = fus_get_state()
|
||||||
log("FUS state: {} {}", status, result)
|
log("FUS state: {} {}", status, result)
|
||||||
@ -508,7 +508,7 @@ def resume():
|
|||||||
_write_failure_state(REASON_WS_DELETION_FAILED)
|
_write_failure_state(REASON_WS_DELETION_FAILED)
|
||||||
|
|
||||||
# As for _STATE_COPIED_FUS above. We should immediately see 0,0.
|
# As for _STATE_COPIED_FUS above. We should immediately see 0,0.
|
||||||
elif _STATE_id == _STATE_COPIED_WS:
|
elif state == _STATE_COPIED_WS:
|
||||||
if fus_is_idle():
|
if fus_is_idle():
|
||||||
log("WS copy complete, installing")
|
log("WS copy complete, installing")
|
||||||
_write_state(_STATE_INSTALLING_WS)
|
_write_state(_STATE_INSTALLING_WS)
|
||||||
@ -518,7 +518,7 @@ def resume():
|
|||||||
_write_failure_state(REASON_FLASH_WS_BAD_STATE)
|
_write_failure_state(REASON_FLASH_WS_BAD_STATE)
|
||||||
|
|
||||||
# As for _STATE_INSTALLING_FUS above.
|
# As for _STATE_INSTALLING_FUS above.
|
||||||
elif _STATE_id == _STATE_INSTALLING_WS:
|
elif state == _STATE_INSTALLING_WS:
|
||||||
log("Installing WS...")
|
log("Installing WS...")
|
||||||
status, result = fus_get_state()
|
status, result = fus_get_state()
|
||||||
log("FUS state: {} {}", status, result)
|
log("FUS state: {} {}", status, result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user