introduced current program check
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Jakob Meier 2022-02-14 16:42:04 +01:00
parent 7adff2c9a8
commit 88a9f8f8de
3 changed files with 41 additions and 35 deletions

View File

@ -1145,6 +1145,8 @@ Password: raspberry
To run the obsw perform the following steps: To run the obsw perform the following steps:
1. Build the cmake EGSE Configuration 1. Build the cmake EGSE Configuration
* the sysroots for the EGSE can be found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/egse&fileid=1190471) * the sysroots for the EGSE can be found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/egse&fileid=1190471)
* toolchain for linux host can be downloaded from [here](https://github.com/Pro/raspi-toolchain)
* toolchain for windows host from [here](https://gnutoolchains.com/raspberry/) (the raspios-buster-armhf toolchain is the right one for the EGSE)
2. Disable the ser2net systemd service on the EGSE 2. Disable the ser2net systemd service on the EGSE
````sh ````sh
$ sudo systemctl stop ser2net.service $ sudo systemctl stop ser2net.service

View File

@ -130,7 +130,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
result = checkCommand(actionId); result = checkCommand(actionId);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
// Intercept image loader commands which do not follow the common DHB communication flow // Intercept image loader commands which do not follow the common DHB communication flow
@ -241,11 +241,11 @@ void StarTrackerHandler::doStartUp() {
} }
return; return;
case StartupState::FAILED_FIRMWARE_BOOT: case StartupState::FAILED_FIRMWARE_BOOT:
startupState = StartupState::IDLE; startupState = StartupState::IDLE;
// Though the star tracker failed to boot the firmware the device handler will go to // Though the star tracker failed to boot the firmware the device handler will go to
// mode on. In bootloader mode the star tracker is still on and can e.g. perform firmware // mode on. In bootloader mode the star tracker is still on and can e.g. perform firmware
// updates. // updates.
break; break;
case StartupState::DONE: case StartupState::DONE:
startupState = StartupState::IDLE; startupState = StartupState::IDLE;
break; break;
@ -267,7 +267,7 @@ void StarTrackerHandler::doOffActivity() { startupState = StartupState::IDLE; }
ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (!bootCountdown.hasTimedOut()) { if (!bootCountdown.hasTimedOut()) {
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
} }
switch (internalState) { switch (internalState) {
case InternalState::CHECK_PROGRAM: case InternalState::CHECK_PROGRAM:
@ -1761,13 +1761,15 @@ ReturnValue_t StarTrackerHandler::prepareUploadCentroidCommand(const uint8_t* co
result = j.getValue(startracker::UploadCentroidKeys::x_uncorrected, &req.x_uncorrected); result = j.getValue(startracker::UploadCentroidKeys::x_uncorrected, &req.x_uncorrected);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< startracker::UploadCentroidKeys::x_uncorrected << " does not exist" << std::endl; << startracker::UploadCentroidKeys::x_uncorrected << " does not exist"
<< std::endl;
return result; return result;
} }
result = j.getValue(startracker::UploadCentroidKeys::y_uncorrected, &req.y_uncorrected); result = j.getValue(startracker::UploadCentroidKeys::y_uncorrected, &req.y_uncorrected);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< startracker::UploadCentroidKeys::y_uncorrected << " does not exist" << std::endl; << startracker::UploadCentroidKeys::y_uncorrected << " does not exist"
<< std::endl;
return result; return result;
} }
result = j.getValue(startracker::UploadCentroidKeys::x_corrected, &req.x_corrected); result = j.getValue(startracker::UploadCentroidKeys::x_corrected, &req.x_corrected);
@ -2271,17 +2273,16 @@ ReturnValue_t StarTrackerHandler::checkProgram() {
// firmware program // firmware program
currentProgram = startracker::Program::BOOTLOADER; currentProgram = startracker::Program::BOOTLOADER;
if (startupState == StartupState::STARTUP_CHECK) { if (startupState == StartupState::STARTUP_CHECK) {
startupState = StartupState::BOOT; startupState = StartupState::BOOT;
} else if (startupState == StartupState::FIRMWARE_CHECK) {
startupState = StartupState::FAILED_FIRMWARE_BOOT;
} }
else if (startupState == StartupState::FIRMWARE_CHECK) { if (internalState == InternalState::CHECK_PROGRAM) {
startupState = StartupState::FAILED_FIRMWARE_BOOT; // Firmware boot failed when trying to switch to normal mode
} internalState = InternalState::IDLE;
if (internalState == InternalState::CHECK_PROGRAM){ sif::warning << "StarTrackerHandler::checkProgram: Failed to boot firmware when "
// Firmware boot failed when trying to switch to normal mode << "trying to switch to normal mode" << std::endl;
internalState = InternalState::IDLE; setMode(_MODE_TO_ON);
sif::warning << "StarTrackerHandler::checkProgram: Failed to boot firmware when "
<< "trying to switch to normal mode" << std::endl;
setMode(_MODE_TO_ON);
} }
break; break;
case startracker::Program::FIRMWARE: case startracker::Program::FIRMWARE:
@ -2425,12 +2426,12 @@ void StarTrackerHandler::handleStartup(const uint8_t* parameterId) {
} }
ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) { ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
switch(actionId) { switch (actionId) {
case startracker::BOOT: case startracker::BOOT:
if (currentProgram != startracker::Program::BOOTLOADER) { if (currentProgram != startracker::Program::BOOTLOADER) {
return STARTRACKER_ALREADY_BOOTED; return STARTRACKER_ALREADY_BOOTED;
} }
break; break;
case startracker::REQ_INTERFACE: case startracker::REQ_INTERFACE:
case startracker::REQ_TIME: case startracker::REQ_TIME:
case startracker::SWITCH_TO_BOOTLOADER_PROGRAM: case startracker::SWITCH_TO_BOOTLOADER_PROGRAM:
@ -2447,17 +2448,17 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
case startracker::DOWNLOAD_MATCHED_STAR: case startracker::DOWNLOAD_MATCHED_STAR:
case startracker::DOWNLOAD_DBIMAGE: case startracker::DOWNLOAD_DBIMAGE:
case startracker::DOWNLOAD_BLOBPIXEL: case startracker::DOWNLOAD_BLOBPIXEL:
if (currentProgram != startracker::Program::FIRMWARE) { if (currentProgram != startracker::Program::FIRMWARE) {
return STARTRACKER_RUNNING_BOOTLOADER; return STARTRACKER_RUNNING_BOOTLOADER;
} }
break; break;
case startracker::FIRMWARE_UPDATE: case startracker::FIRMWARE_UPDATE:
if (currentProgram != startracker::Program::BOOTLOADER) { if (currentProgram != startracker::Program::BOOTLOADER) {
return STARTRACKER_RUNNING_FIRMWARE; return STARTRACKER_RUNNING_FIRMWARE;
} }
break; break;
default: default:
break; break;
} }
return RETURN_OK; return RETURN_OK;
} }

View File

@ -48,6 +48,9 @@ class StarTrackerHandler : public DeviceHandlerBase {
void performOperationHook() override; void performOperationHook() override;
static const Submode_t SUBMODE_BOOTLOADER = 0;
static const Submode_t SUBMODE_FIRMWARE = 1;
protected: protected:
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;