code review
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2024-02-27 10:54:26 +01:00
parent 386430b9f2
commit c434882e37
2 changed files with 6 additions and 6 deletions

View File

@ -7,6 +7,7 @@
#include <string> #include <string>
#include "fsfw/filesystem/HasFileSystemIF.h"
#include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "mission/memory/SdCardMountedIF.h" #include "mission/memory/SdCardMountedIF.h"
@ -177,7 +178,7 @@ void StarTrackerHandler::loadTargetFirmwareFromPersistentCfg() {
const char* prefix = sdCardIF.getCurrentMountPrefix(); const char* prefix = sdCardIF.getCurrentMountPrefix();
std::filesystem::path path = std::filesystem::path(prefix) / startracker::FW_TARGET_CFG_PATH; std::filesystem::path path = std::filesystem::path(prefix) / startracker::FW_TARGET_CFG_PATH;
std::ifstream ifile(path); std::ifstream ifile(path);
if (ifile.is_open()) { if (ifile.is_open() and !ifile.bad()) {
std::string targetStr; std::string targetStr;
std::getline(ifile, targetStr); std::getline(ifile, targetStr);
if (targetStr == "backup") { if (targetStr == "backup") {
@ -2896,7 +2897,7 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
case startracker::REQ_CENTROID: case startracker::REQ_CENTROID:
case startracker::REQ_CENTROIDS: case startracker::REQ_CENTROIDS:
case startracker::REQ_CONTRAST: { case startracker::REQ_CONTRAST: {
if (getMode() == MODE_ON and getSubmode() != startracker::Program::FIRMWARE_MAIN) { if (getMode() == MODE_ON and getSubmode() != startracker::SUBMODE_FIRMWARE) {
return STARTRACKER_NOT_RUNNING_FIRMWARE; return STARTRACKER_NOT_RUNNING_FIRMWARE;
} }
break; break;
@ -2904,7 +2905,7 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
case startracker::FIRMWARE_UPDATE_MAIN: case startracker::FIRMWARE_UPDATE_MAIN:
case startracker::FIRMWARE_UPDATE_BACKUP: case startracker::FIRMWARE_UPDATE_BACKUP:
case startracker::FLASH_READ: case startracker::FLASH_READ:
if (getMode() != MODE_ON or getSubmode() != startracker::Program::BOOTLOADER) { if (getMode() != MODE_ON or getSubmode() != startracker::SUBMODE_BOOTLOADER) {
return STARTRACKER_NOT_RUNNING_BOOTLOADER; return STARTRACKER_NOT_RUNNING_BOOTLOADER;
} }
break; break;
@ -2940,8 +2941,7 @@ ReturnValue_t StarTrackerHandler::getParameter(uint8_t domainId, uint8_t uniqueI
of << "backup\n"; of << "backup\n";
} }
} else { } else {
sif::warning << "SD card not usable" << std::endl; return HasFileSystemIF::FILESYSTEM_INACTIVE;
return returnvalue::FAILED;
} }
}; };
return returnvalue::OK; return returnvalue::OK;