diff --git a/README.md b/README.md index 7acc6342..8a588aab 100644 --- a/README.md +++ b/README.md @@ -1145,6 +1145,8 @@ Password: raspberry To run the obsw perform the following steps: 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) + * 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 ````sh $ sudo systemctl stop ser2net.service diff --git a/linux/devices/startracker/StarTrackerHandler.cpp b/linux/devices/startracker/StarTrackerHandler.cpp index 5dde524b..7cf857d7 100644 --- a/linux/devices/startracker/StarTrackerHandler.cpp +++ b/linux/devices/startracker/StarTrackerHandler.cpp @@ -130,7 +130,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu result = checkCommand(actionId); if (result != RETURN_OK) { - return result; + return result; } // Intercept image loader commands which do not follow the common DHB communication flow @@ -241,11 +241,11 @@ void StarTrackerHandler::doStartUp() { } return; case StartupState::FAILED_FIRMWARE_BOOT: - startupState = StartupState::IDLE; - // 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 - // updates. - break; + startupState = StartupState::IDLE; + // 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 + // updates. + break; case StartupState::DONE: startupState = StartupState::IDLE; break; @@ -267,7 +267,7 @@ void StarTrackerHandler::doOffActivity() { startupState = StartupState::IDLE; } ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { if (!bootCountdown.hasTimedOut()) { - return NOTHING_TO_SEND; + return NOTHING_TO_SEND; } switch (internalState) { 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); if (result != RETURN_OK) { 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; } result = j.getValue(startracker::UploadCentroidKeys::y_uncorrected, &req.y_uncorrected); if (result != RETURN_OK) { 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; } result = j.getValue(startracker::UploadCentroidKeys::x_corrected, &req.x_corrected); @@ -2271,17 +2273,16 @@ ReturnValue_t StarTrackerHandler::checkProgram() { // firmware program currentProgram = startracker::Program::BOOTLOADER; 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) { - startupState = StartupState::FAILED_FIRMWARE_BOOT; - } - if (internalState == InternalState::CHECK_PROGRAM){ - // Firmware boot failed when trying to switch to normal mode - internalState = InternalState::IDLE; - sif::warning << "StarTrackerHandler::checkProgram: Failed to boot firmware when " - << "trying to switch to normal mode" << std::endl; - setMode(_MODE_TO_ON); + if (internalState == InternalState::CHECK_PROGRAM) { + // Firmware boot failed when trying to switch to normal mode + internalState = InternalState::IDLE; + sif::warning << "StarTrackerHandler::checkProgram: Failed to boot firmware when " + << "trying to switch to normal mode" << std::endl; + setMode(_MODE_TO_ON); } break; case startracker::Program::FIRMWARE: @@ -2425,12 +2426,12 @@ void StarTrackerHandler::handleStartup(const uint8_t* parameterId) { } ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) { - switch(actionId) { + switch (actionId) { case startracker::BOOT: - if (currentProgram != startracker::Program::BOOTLOADER) { - return STARTRACKER_ALREADY_BOOTED; - } - break; + if (currentProgram != startracker::Program::BOOTLOADER) { + return STARTRACKER_ALREADY_BOOTED; + } + break; case startracker::REQ_INTERFACE: case startracker::REQ_TIME: 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_DBIMAGE: case startracker::DOWNLOAD_BLOBPIXEL: - if (currentProgram != startracker::Program::FIRMWARE) { - return STARTRACKER_RUNNING_BOOTLOADER; - } - break; + if (currentProgram != startracker::Program::FIRMWARE) { + return STARTRACKER_RUNNING_BOOTLOADER; + } + break; case startracker::FIRMWARE_UPDATE: - if (currentProgram != startracker::Program::BOOTLOADER) { - return STARTRACKER_RUNNING_FIRMWARE; - } - break; + if (currentProgram != startracker::Program::BOOTLOADER) { + return STARTRACKER_RUNNING_FIRMWARE; + } + break; default: - break; - } - return RETURN_OK; + break; + } + return RETURN_OK; } diff --git a/linux/devices/startracker/StarTrackerHandler.h b/linux/devices/startracker/StarTrackerHandler.h index dc140015..3a078b51 100644 --- a/linux/devices/startracker/StarTrackerHandler.h +++ b/linux/devices/startracker/StarTrackerHandler.h @@ -48,6 +48,9 @@ class StarTrackerHandler : public DeviceHandlerBase { void performOperationHook() override; + static const Submode_t SUBMODE_BOOTLOADER = 0; + static const Submode_t SUBMODE_FIRMWARE = 1; + protected: void doStartUp() override; void doShutDown() override;