Make UsbCommand_JumpToModuleBootloader() more robust by not making it dependent on the state of the module driver.
This commit is contained in:
Submodule lib/agent updated: 04b43896c5...2702a74035
@@ -69,6 +69,13 @@ status_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleDriverId)
|
|||||||
|
|
||||||
switch (*uhkModulePhase) {
|
switch (*uhkModulePhase) {
|
||||||
|
|
||||||
|
// Jump to bootloader
|
||||||
|
case UhkModulePhase_JumpToBootloader:
|
||||||
|
txMessage.data[0] = SlaveCommand_JumpToBootloader;
|
||||||
|
txMessage.length = 1;
|
||||||
|
status = tx(i2cAddress);
|
||||||
|
break;
|
||||||
|
|
||||||
// Sync communication
|
// Sync communication
|
||||||
case UhkModulePhase_RequestSync:
|
case UhkModulePhase_RequestSync:
|
||||||
txMessage.data[0] = SlaveCommand_RequestProperty;
|
txMessage.data[0] = SlaveCommand_RequestProperty;
|
||||||
@@ -177,19 +184,6 @@ status_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleDriverId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
status = kStatus_Uhk_NoTransfer;
|
status = kStatus_Uhk_NoTransfer;
|
||||||
*uhkModulePhase = UhkModulePhase_JumpToBootloader;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Jump to bootloader
|
|
||||||
case UhkModulePhase_JumpToBootloader:
|
|
||||||
if (uhkModuleState->jumpToBootloader) {
|
|
||||||
txMessage.data[0] = SlaveCommand_JumpToBootloader;
|
|
||||||
txMessage.length = 1;
|
|
||||||
status = tx(i2cAddress);
|
|
||||||
uhkModuleState->jumpToBootloader = false;
|
|
||||||
} else {
|
|
||||||
status = kStatus_Uhk_NoTransfer;
|
|
||||||
}
|
|
||||||
*uhkModulePhase = UhkModulePhase_SetTestLed;
|
*uhkModulePhase = UhkModulePhase_SetTestLed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,9 @@
|
|||||||
UhkModulePhase_ProcessKeystates,
|
UhkModulePhase_ProcessKeystates,
|
||||||
|
|
||||||
// Misc phases
|
// Misc phases
|
||||||
UhkModulePhase_JumpToBootloader,
|
|
||||||
UhkModulePhase_SetTestLed,
|
UhkModulePhase_SetTestLed,
|
||||||
UhkModulePhase_SetLedPwmBrightness,
|
UhkModulePhase_SetLedPwmBrightness,
|
||||||
|
UhkModulePhase_JumpToBootloader,
|
||||||
|
|
||||||
} uhk_module_phase_t;
|
} uhk_module_phase_t;
|
||||||
|
|
||||||
@@ -70,7 +70,6 @@
|
|||||||
uint8_t firmwareI2cAddress;
|
uint8_t firmwareI2cAddress;
|
||||||
uint8_t bootloaderI2cAddress;
|
uint8_t bootloaderI2cAddress;
|
||||||
uhk_module_features_t features;
|
uhk_module_features_t features;
|
||||||
bool jumpToBootloader;
|
|
||||||
} uhk_module_state_t;
|
} uhk_module_state_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ void UsbCommand_JumpToModuleBootloader(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t uhkModuleDriverId = SLOT_ID_TO_UHK_MODULE_DRIVER_ID(slotId);
|
uint8_t uhkModuleDriverId = SLOT_ID_TO_UHK_MODULE_DRIVER_ID(slotId);
|
||||||
UhkModuleStates[uhkModuleDriverId].jumpToBootloader = true;
|
UhkModuleStates[uhkModuleDriverId].phase = UhkModulePhase_JumpToBootloader;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user