str transition fixes #498

Merged
muellerr merged 9 commits from bugfix_str_mode_transitions into develop 2023-03-20 17:56:11 +01:00
2 changed files with 15 additions and 2 deletions
Showing only changes of commit b516f12a61 - Show all commits

View File

@ -268,7 +268,8 @@ void StarTrackerHandler::doStartUp() {
default: default:
return; return;
} }
setMode(_MODE_TO_ON, SUBMODE_BOOTLOADER); boot = true;
setMode(_MODE_TO_ON);
} }
void StarTrackerHandler::doShutDown() { void StarTrackerHandler::doShutDown() {
@ -707,6 +708,13 @@ void StarTrackerHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
void StarTrackerHandler::doOnTransition(Submode_t subModeFrom) { void StarTrackerHandler::doOnTransition(Submode_t subModeFrom) {
uint8_t dhbSubmode = getSubmode(); 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) { if (dhbSubmode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_FIRMWARE) {
bootBootloader(); bootBootloader();
} else if (dhbSubmode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_FIRMWARE) { } else if (dhbSubmode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_FIRMWARE) {
@ -747,7 +755,11 @@ void StarTrackerHandler::bootFirmware(Mode_t toMode) {
internalState = InternalState::IDLE; internalState = InternalState::IDLE;
break; break;
case InternalState::DONE: case InternalState::DONE:
if (toMode == MODE_NORMAL) {
setMode(toMode, 0);
} else {
setMode(toMode); setMode(toMode);
}
internalState = InternalState::IDLE; internalState = InternalState::IDLE;
break; break;
default: 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 // Pointer to object responsible for uploading and downloading images to/from the star tracker
StrHelper* strHelper = nullptr; StrHelper* strHelper = nullptr;
bool boot = false;
uint8_t commandBuffer[startracker::MAX_FRAME_SIZE]; uint8_t commandBuffer[startracker::MAX_FRAME_SIZE];