Merge pull request 'Bugfixes STR' (#508) from bugfix_str into develop
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

Reviewed-on: #508
This commit is contained in:
Robin Müller 2023-03-22 00:00:40 +01:00
commit c611bc824b
19 changed files with 51 additions and 40 deletions

View File

@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release:
# [unreleased]
## Fixed
- Bugfix for STR: Some action commands wrongfully declined.
- STR: No normal command handling while a special request like an image upload is active.
# [v1.39.0] 2023-03-21
Requires firmware update for new FPGA design where reset line is routed into the software.

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @details
* Generated on: 2023-03-21 23:34:22
* Generated on: 2023-03-21 23:59:36
*/
#include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 169 translations.
* Generated on: 2023-03-21 23:34:22
* Generated on: 2023-03-21 23:59:36
*/
#include "translateObjects.h"

View File

@ -31,7 +31,7 @@
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
CoreController::CoreController(object_id_t objectId, const std::atomic_uint16_t& i2cErrors)
CoreController::CoreController(object_id_t objectId, const std::atomic_uint16_t &i2cErrors)
: ExtendedControllerBase(objectId, 5),
cmdExecutor(4096),
cmdReplyBuf(4096, true),
@ -108,7 +108,7 @@ void CoreController::performControlOperation() {
sdStateMachine();
performMountedSdCardOperations();
readHkData();
if(i2cErrors >= 5) {
if (i2cErrors >= 5) {
bool protOpPerformed = false;
triggerEvent(I2C_UNAVAILABLE_REBOOT);
gracefulShutdownTasks(CURRENT_CHIP, CURRENT_COPY, protOpPerformed);

View File

@ -6,6 +6,7 @@
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#include <libxiphos.h>
#include <atomic>
#include <cstddef>
#include "CoreDefinitions.h"
@ -15,7 +16,6 @@
#include "fsfw/controller/ExtendedControllerBase.h"
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
#include "mission/trace.h"
#include <atomic>
class Timer;
class SdCardManager;
@ -132,7 +132,8 @@ class CoreController : public ExtendedControllerBase {
//! P1: First 16 bits boot count of image 0 0, last 16 bits boot count of image 0 1.
//! P2: First 16 bits boot count of image 1 0, last 16 bits boot count of image 1 1.
static constexpr Event INDIVIDUAL_BOOT_COUNTS = event::makeEvent(SUBSYSTEM_ID, 8, severity::INFO);
static constexpr Event I2C_UNAVAILABLE_REBOOT = event::makeEvent(SUBSYSTEM_ID, 10, severity::MEDIUM);
static constexpr Event I2C_UNAVAILABLE_REBOOT =
event::makeEvent(SUBSYSTEM_ID, 10, severity::MEDIUM);
CoreController(object_id_t objectId, const std::atomic_uint16_t& i2cErrors);
virtual ~CoreController();

View File

@ -11,8 +11,8 @@
#include <mission/tmtc/PersistentLogTmStoreTask.h>
#include <mission/tmtc/PusTmFunnel.h>
#include <string>
#include <atomic>
#include <string>
class LinuxLibgpioIF;
class SerialComIF;

View File

@ -471,8 +471,8 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x53b4;STRH_CrcFailure;Received reply with invalid CRC;180;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x53b5;STRH_StrHelperExecuting;Star tracker handler currently executing a command and using the communication interface;181;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x53b6;STRH_StartrackerAlreadyBooted;Star tracker is already in firmware mode;182;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x53b7;STRH_StartrackerRunningFirmware;Star tracker is in firmware mode but must be in bootloader mode to execute this command;183;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x53b8;STRH_StartrackerRunningBootloader;Star tracker is in bootloader mode but must be in firmware mode to execute this command;184;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x53b7;STRH_StartrackerNotRunningFirmware;Star tracker must be in firmware mode to run this command;183;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x53b8;STRH_StartrackerNotRunningBootloader;Star tracker must be in bootloader mode to run this command;184;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x5400;DWLPWRON_NoReplyAvailable;No description;0;DWLPWRON_CMD;linux/devices/ImtqPollingTask.h
0x5402;DWLPWRON_InvalidCrc;No description;2;DWLPWRON_CMD;linux/devices/ScexHelper.h
0x54e0;DWLPWRON_InvalidMode;Received command has invalid JESD mode (valid modes are 0 - 5);224;DWLPWRON_CMD;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
471 0x53b4 STRH_CrcFailure Received reply with invalid CRC 180 STR_HANDLER linux/devices/startracker/StarTrackerHandler.h
472 0x53b5 STRH_StrHelperExecuting Star tracker handler currently executing a command and using the communication interface 181 STR_HANDLER linux/devices/startracker/StarTrackerHandler.h
473 0x53b6 STRH_StartrackerAlreadyBooted Star tracker is already in firmware mode 182 STR_HANDLER linux/devices/startracker/StarTrackerHandler.h
474 0x53b7 STRH_StartrackerRunningFirmware STRH_StartrackerNotRunningFirmware Star tracker is in firmware mode but must be in bootloader mode to execute this command Star tracker must be in firmware mode to run this command 183 STR_HANDLER linux/devices/startracker/StarTrackerHandler.h
475 0x53b8 STRH_StartrackerRunningBootloader STRH_StartrackerNotRunningBootloader Star tracker is in bootloader mode but must be in firmware mode to execute this command Star tracker must be in bootloader mode to run this command 184 STR_HANDLER linux/devices/startracker/StarTrackerHandler.h
476 0x5400 DWLPWRON_NoReplyAvailable No description 0 DWLPWRON_CMD linux/devices/ImtqPollingTask.h
477 0x5402 DWLPWRON_InvalidCrc No description 2 DWLPWRON_CMD linux/devices/ScexHelper.h
478 0x54e0 DWLPWRON_InvalidMode Received command has invalid JESD mode (valid modes are 0 - 5) 224 DWLPWRON_CMD linux/devices/devicedefinitions/PlocMPSoCDefinitions.h

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @details
* Generated on: 2023-03-21 23:34:22
* Generated on: 2023-03-21 23:59:36
*/
#include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 173 translations.
* Generated on: 2023-03-21 23:34:22
* Generated on: 2023-03-21 23:59:36
*/
#include "translateObjects.h"

View File

@ -303,7 +303,7 @@ ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
bool timeValid = false;
if (TIME_SET == (TIME_SET & gps.set)) {
// To prevent totally incorrect times from being declared valid.
if(gpsSet.satInView.isValid() and gpsSet.satInView.value >= 1) {
if (gpsSet.satInView.isValid() and gpsSet.satInView.value >= 1) {
timeValid = true;
}
timeval time = {};

View File

@ -10,9 +10,8 @@
#include "fsfw/FSFW.h"
ImtqPollingTask::ImtqPollingTask(object_id_t imtqPollingTask,
std::atomic_uint16_t& i2cFatalErrors): SystemObject(imtqPollingTask),
i2cFatalErrors(i2cFatalErrors) {
ImtqPollingTask::ImtqPollingTask(object_id_t imtqPollingTask, std::atomic_uint16_t& i2cFatalErrors)
: SystemObject(imtqPollingTask), i2cFatalErrors(i2cFatalErrors) {
semaphore = SemaphoreFactory::instance()->createBinarySemaphore();
semaphore->acquire();
ipcLock = MutexFactory::instance()->createMutex();
@ -429,7 +428,7 @@ ReturnValue_t ImtqPollingTask::performI2cFullRequest(uint8_t* reply, size_t repl
if (ioctl(fd, I2C_SLAVE, i2cAddr) < 0) {
sif::warning << "Opening IMTQ slave device failed with code " << errno << ": "
<< strerror(errno) << std::endl;
if(errno == EBUSY) {
if (errno == EBUSY) {
i2cFatalErrors++;
}
}
@ -440,7 +439,7 @@ ReturnValue_t ImtqPollingTask::performI2cFullRequest(uint8_t* reply, size_t repl
<< ". Error description: " << strerror(errno) << std::endl;
// This is a weird issue which sometimes occurs on debug builds. All I2C buses are busy
// for all writes,
if(errno == EBUSY) {
if (errno == EBUSY) {
i2cFatalErrors++;
}
return returnvalue::FAILED;

View File

@ -4,11 +4,12 @@
#include <fsfw/tasks/SemaphoreIF.h>
#include <fsfw_hal/linux/i2c/I2cCookie.h>
#include <atomic>
#include "fsfw/devicehandlers/DeviceCommunicationIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "mission/devices/devicedefinitions/imtqHelpers.h"
#include <atomic>
class ImtqPollingTask : public SystemObject,
public ExecutableObjectIF,

View File

@ -49,7 +49,7 @@ uint8_t ArcsecDatalinkLayer::getReplyFrameType() { return decodedFrame[0]; }
const uint8_t* ArcsecDatalinkLayer::getReply() { return &decodedFrame[1]; }
void ArcsecDatalinkLayer::encodeFrame(const uint8_t* data, uint32_t length) {
void ArcsecDatalinkLayer::encodeFrame(const uinah uint32_t length) {
arc_transport_encode_body(data, length, encBuffer, &encFrameSize);
}

View File

@ -129,7 +129,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
break;
}
if (strHelperExecuting == true) {
if (strHelperHandlingSpecialRequest == true) {
return STR_HELPER_EXECUTING;
}
@ -157,7 +157,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
strHelperHandlingSpecialRequest = true;
return EXECUTION_FINISHED;
}
case (startracker::DOWNLOAD_IMAGE): {
@ -173,7 +173,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
strHelperHandlingSpecialRequest = true;
return EXECUTION_FINISHED;
}
case (startracker::FLASH_READ): {
@ -185,7 +185,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
strHelperHandlingSpecialRequest = true;
return EXECUTION_FINISHED;
}
case (startracker::CHANGE_IMAGE_DOWNLOAD_FILE): {
@ -215,7 +215,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
strHelperHandlingSpecialRequest = true;
return EXECUTION_FINISHED;
}
default:
@ -283,6 +283,9 @@ void StarTrackerHandler::doShutDown() {
}
ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (strHelperHandlingSpecialRequest) {
return NOTHING_TO_SEND;
}
switch (normalState) {
case NormalState::TEMPERATURE_REQUEST:
*id = startracker::REQ_TEMPERATURE;
@ -1296,7 +1299,7 @@ size_t StarTrackerHandler::getNextReplyLength(DeviceCommandId_t commandId) {
ReturnValue_t StarTrackerHandler::doSendReadHook() {
// Prevent DHB from polling UART during commands executed by the image loader task
if (strHelperExecuting) {
if (strHelperHandlingSpecialRequest) {
return returnvalue::FAILED;
}
return returnvalue::OK;
@ -1538,7 +1541,7 @@ void StarTrackerHandler::handleEvent(EventMessage* eventMessage) {
case objects::STR_HELPER: {
// All events from image loader signal either that the operation was successful or that it
// failed
strHelperExecuting = false;
strHelperHandlingSpecialRequest = false;
break;
}
default:
@ -2147,14 +2150,14 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
case startracker::REQ_SUBSCRIPTION:
case startracker::REQ_LOG_SUBSCRIPTION:
case startracker::REQ_DEBUG_CAMERA:
if (not(getMode() == MODE_ON && getSubmode() == startracker::Program::FIRMWARE)) {
return STARTRACKER_RUNNING_BOOTLOADER;
if (getMode() == MODE_ON and getSubmode() != startracker::Program::FIRMWARE) {
return STARTRACKER_NOT_RUNNING_FIRMWARE;
}
break;
case startracker::FIRMWARE_UPDATE:
case startracker::FLASH_READ:
if (not(getMode() == MODE_ON && getSubmode() == startracker::Program::BOOTLOADER)) {
return STARTRACKER_RUNNING_FIRMWARE;
if (getMode() != MODE_ON or getSubmode() != startracker::Program::BOOTLOADER) {
return STARTRACKER_NOT_RUNNING_BOOTLOADER;
}
break;
default:

View File

@ -132,12 +132,10 @@ class StarTrackerHandler : public DeviceHandlerBase {
static const ReturnValue_t STR_HELPER_EXECUTING = MAKE_RETURN_CODE(0xB5);
//! [EXPORT] : [COMMENT] Star tracker is already in firmware mode
static const ReturnValue_t STARTRACKER_ALREADY_BOOTED = MAKE_RETURN_CODE(0xB6);
//! [EXPORT] : [COMMENT] Star tracker is in firmware mode but must be in bootloader mode to
//! execute this command
static const ReturnValue_t STARTRACKER_RUNNING_FIRMWARE = MAKE_RETURN_CODE(0xB7);
//! [EXPORT] : [COMMENT] Star tracker is in bootloader mode but must be in firmware mode to
//! execute this command
static const ReturnValue_t STARTRACKER_RUNNING_BOOTLOADER = MAKE_RETURN_CODE(0xB8);
//! [EXPORT] : [COMMENT] Star tracker must be in firmware mode to run this command
static const ReturnValue_t STARTRACKER_NOT_RUNNING_FIRMWARE = MAKE_RETURN_CODE(0xB7);
//! [EXPORT] : [COMMENT] Star tracker must be in bootloader mode to run this command
static const ReturnValue_t STARTRACKER_NOT_RUNNING_BOOTLOADER = MAKE_RETURN_CODE(0xB8);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HANDLER;
@ -291,7 +289,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
InternalState internalState = InternalState::IDLE;
bool strHelperExecuting = false;
bool strHelperHandlingSpecialRequest = false;
const power::Switch_t powerSwitch = power::NO_SWITCH;

View File

@ -263,6 +263,10 @@ ReturnValue_t StrHelper::performImageUpload() {
return returnvalue::FAILED;
}
std::ifstream file(uploadImage.uploadFile, std::ifstream::binary);
if (file.bad()) {
return HasFileSystemIF::GENERIC_FILE_ERROR;
}
// Set position of next character to end of file input stream
file.seekg(0, file.end);
// tellg returns position of character in input stream

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @details
* Generated on: 2023-03-21 23:34:22
* Generated on: 2023-03-21 23:59:36
*/
#include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 173 translations.
* Generated on: 2023-03-21 23:34:22
* Generated on: 2023-03-21 23:59:36
*/
#include "translateObjects.h"

2
tmtc

@ -1 +1 @@
Subproject commit c5b8831b439cb8b89040d1aca6de78112d8850a0
Subproject commit c171654d2b18547249ee03ace3a4016e8837cf4a