str transition fixes
Some checks are pending
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-20 15:16:20 +01:00
parent a196ab136e
commit b516f12a61
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 15 additions and 2 deletions

View File

@ -268,7 +268,8 @@ void StarTrackerHandler::doStartUp() {
default:
return;
}
setMode(_MODE_TO_ON, SUBMODE_BOOTLOADER);
boot = true;
setMode(_MODE_TO_ON);
}
void StarTrackerHandler::doShutDown() {
@ -707,6 +708,13 @@ void StarTrackerHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
void StarTrackerHandler::doOnTransition(Submode_t subModeFrom) {
uint8_t dhbSubmode = getSubmode();
// We hide that the transition to submode firmware actually goes through the submode bootloader.
// This is because the startracker always starts in bootloader mode but we want to allow direct
// transitions to firmware mode.
if (boot) {
subModeFrom = SUBMODE_BOOTLOADER;
boot = false;
}
if (dhbSubmode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_FIRMWARE) {
bootBootloader();
} else if (dhbSubmode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_FIRMWARE) {
@ -747,7 +755,11 @@ void StarTrackerHandler::bootFirmware(Mode_t toMode) {
internalState = InternalState::IDLE;
break;
case InternalState::DONE:
setMode(toMode);
if (toMode == MODE_NORMAL) {
setMode(toMode, 0);
} else {
setMode(toMode);
}
internalState = InternalState::IDLE;
break;
default:

View File

@ -212,6 +212,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
// Pointer to object responsible for uploading and downloading images to/from the star tracker
StrHelper* strHelper = nullptr;
bool boot = false;
uint8_t commandBuffer[startracker::MAX_FRAME_SIZE];