Merge remote-tracking branch 'origin/develop' into mueller/pus-15-tm-storage
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-11-11 11:26:57 +01:00
commit 08c225a633
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
165 changed files with 2945 additions and 1393 deletions

View File

@ -10,14 +10,41 @@ list yields a list of all related PRs for each release.
# [unreleased]
# [v1.14.1]
- ACS Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231
- Payload Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231
- Add IRQ mode for PDEC handler. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/310
- Extended TM funnels to allow multiple TM recipients.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/312
- DHB: Transitions to normal mode now possible directly, which simplifies subsystem implementations
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/313
- MAX3185 Low Level Handler and Device Handler: Simplifications and bugfixes to allow switching
off without triggering unrequested replies
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/313
# [v1.15.0] 27.10.2022
- Consistent device file naming
- Remove rad sensor from EM build, lead to weird bugs on EM which
prevented `xsc_boot_copy` from working properly
- CFDP closure handling is now working
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/307
- Safety mechanism for SD card handling on graceful reboots
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/308
- Solar Array Deployment handler update
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/305
- IMTQ updates as preparation for ACS controller expansion
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/306
- P60 Module: Reduce number of set IDs, use same set IDs for core, auxiliary
and config HK set across the three PCDU modules
# [v1.14.1] 11.10.2022
- Various bugfixes and regression fixes
- General file handling at program initialization now works properly again
- Scratch buffer preferred SD card handling works again
- Use scoped locks in TCS controller to avoid deadlocks
# [v1.14.0]
# [v1.14.0] 10.10.2022
- Provide full SW update capability for the OBSW.
This includes very basic CFDP integration, a software update
@ -36,6 +63,7 @@ list yields a list of all related PRs for each release.
- Fix for EM SW: Always create ACS Task
- Added Scex device handler and Scex uart reader
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/303
- ACS Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/228
# [v1.13.0] 24.08.2022

View File

@ -10,8 +10,8 @@
cmake_minimum_required(VERSION 3.13)
set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 1)
set(OBSW_VERSION_MINOR_IF_GIT_FAILS 14)
set(OBSW_VERSION_REVISION_IF_GIT_FAILS 1)
set(OBSW_VERSION_MINOR_IF_GIT_FAILS 15)
set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
# set(CMAKE_VERBOSE TRUE)
@ -98,9 +98,30 @@ set(OBSW_ADD_ACS_BOARD
set(OBSW_ADD_GPS_CTRL
${INIT_VAL}
CACHE STRING "Add GPS controllers")
set(OBSW_ADD_CCSDS_IP_CORES
1
CACHE STRING "Add CCSDS IP cores")
set(OBSW_TM_TO_PTME
1
CACHE STRING "Send telemetry to PTME IP core")
set(OBSW_TC_FROM_PDEC
1
CACHE STRING "Poll telecommand from PDEC IP core")
set(OBSW_ADD_TCS_CTRL
${INIT_VAL}
CACHE STRING "Add TCS controllers")
set(OBSW_ADD_HEATERS
${INIT_VAL}
CACHE STRING "Add TCS heaters")
set(OBSW_ADD_PLOC_SUPERVISOR
${INIT_VAL}
CACHE STRING "Add PLOC supervisor handler")
set(OBSW_ADD_SA_DEPL
${INIT_VAL}
CACHE STRING "Add SA deployment handler")
set(OBSW_ADD_PLOC_MPSOC
${INIT_VAL}
CACHE STRING "Add MPSoC handler")
set(OBSW_ADD_ACS_CTRL
${INIT_VAL}
CACHE STRING "Add ACS controller")
@ -128,6 +149,9 @@ set(OBSW_ADD_RW
set(OBSW_ADD_SCEX_DEVICE
${INIT_VAL}
CACHE STRING "Add Solar Cell Experiment module")
set(OBSW_SYRLINKS_SIMULATED
${OBSW_Q7S_EM}
CACHE STRING "Syrlinks is simulated")
# ##############################################################################
# Pre-Sources preparation

View File

@ -1,8 +1,8 @@
#include "ObjectFactory.h"
#include <devConf.h>
#include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <fsfw_hal/linux/serial/SerialComIF.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include "OBSWConfig.h"
#include "busConf.h"
@ -39,7 +39,7 @@ void ObjectFactory::produce(void* args) {
UartCookie* starTrackerCookie =
new UartCookie(objects::STAR_TRACKER, egse::STAR_TRACKER_UART, UartModes::NON_CANONICAL,
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
new UartComIF(objects::UART_COM_IF);
newSerialComIF(objects::UART_COM_IF);
starTrackerCookie->setNoFixedSizeReply();
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(

View File

@ -4,7 +4,7 @@
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <mission/controller/ThermalController.h>
#include <mission/core/GenericFactory.h>
#include <mission/tmtc/TmFunnel.h>
#include <mission/tmtc/TmFunnelHandler.h>
#include <objects/systemObjectList.h>
#include <tmtc/pusIds.h>
@ -59,12 +59,14 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::produce(void* args) {
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
PusTmFunnel* pusFunnel;
CfdpTmFunnel* cfdpFunnel;
ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel);
dummy::DummyCfg cfg;
dummy::createDummies(cfg);
new TemperatureSensorsDummy();
new SusDummy();
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
new ThermalController(objects::THERMAL_CONTROLLER);
new TestTask(objects::TEST_TASK);
}

View File

@ -16,7 +16,7 @@
debugging. */
#define OBSW_VEBOSE_LEVEL 1
#define OBSW_USE_CCSDS_IP_CORE 0
#define OBSW_ADD_CCSDS_IP_CORES 0
// Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core

View File

@ -103,7 +103,7 @@
/*******************************************************************/
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER
#define OBSW_USE_CCSDS_IP_CORE 0
#define OBSW_ADD_CCSDS_IP_CORES 0
// Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core

View File

@ -34,8 +34,8 @@
#include "fsfw/osal/common/UdpTmTcBridge.h"
#endif
#include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <fsfw_hal/linux/serial/SerialComIF.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
@ -202,7 +202,7 @@ void ObjectFactory::createTestTasks() {
#if OBSW_ADD_UART_TEST_CODE == 1
new UartTestClass(objects::UART_TEST);
#else
new UartComIF(objects::UART_COM_IF);
newSerialComIF(objects::UART_COM_IF);
#endif
#if RPI_LOOPBACK_TEST_GPIO == 1

View File

@ -14,18 +14,12 @@
/** All of the following flags should be enabled for mission code */
/*******************************************************************/
#define OBSW_USE_CCSDS_IP_CORE 1
// Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core
#define OBSW_TC_FROM_PDEC 0
#define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@
#define OBSW_ADD_MGT @OBSW_ADD_MGT@
#define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@
#define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@
#define OBSW_ADD_PLOC_SUPERVISOR 1
#define OBSW_ADD_PLOC_MPSOC 1
#define OBSW_ADD_PLOC_SUPERVISOR @OBSW_ADD_PLOC_SUPERVISOR@
#define OBSW_ADD_PLOC_MPSOC @OBSW_ADD_PLOC_MPSOC@
#define OBSW_ADD_SUN_SENSORS @OBSW_ADD_SUN_SENSORS@
#define OBSW_ADD_SUS_BOARD_ASS @OBSW_ADD_SUS_BOARD_ASS@
#define OBSW_ADD_ACS_BOARD @OBSW_ADD_ACS_BOARD@
@ -34,11 +28,18 @@
#define OBSW_ADD_TCS_CTRL @OBSW_ADD_TCS_CTRL@
#define OBSW_ADD_RW @OBSW_ADD_RW@
#define OBSW_ADD_RTD_DEVICES @OBSW_ADD_RTD_DEVICES@
#define OBSW_ADD_SA_DEPL @OBSW_ADD_SA_DEPL@
#define OBSW_ADD_SCEX_DEVICE @OBSW_ADD_SCEX_DEVICE@
#define OBSW_ADD_HEATERS @OBSW_ADD_HEATERS@
#define OBSW_ADD_TMP_DEVICES @OBSW_ADD_TMP_DEVICES@
#define OBSW_ADD_RAD_SENSORS @OBSW_ADD_RAD_SENSORS@
#define OBSW_ADD_PL_PCDU @OBSW_ADD_PL_PCDU@
#define OBSW_ADD_SYRLINKS @OBSW_ADD_SYRLINKS@
#define OBSW_ADD_CCSDS_IP_CORES @OBSW_ADD_CCSDS_IP_CORES@
// Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME @OBSW_TM_TO_PTME@
// Set to 1 if telecommands are received via the PDEC IP Core
#define OBSW_TC_FROM_PDEC @OBSW_TC_FROM_PDEC@
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
// Configuration parameter which causes the core controller to try to keep at least one SD card
@ -59,12 +60,12 @@
/*******************************************************************/
// Can be used to switch device to NORMAL mode immediately
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 0
#define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_MPSOC_JTAG_BOOT 0
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
#define OBSW_SYRLINKS_SIMULATED 1
#define OBSW_SYRLINKS_SIMULATED @OBSW_SYRLINKS_SIMULATED@
#define OBSW_ADD_TEST_CODE 0
#define OBSW_ADD_TEST_TASK 0
#define OBSW_ADD_TEST_PST 0

View File

@ -3,24 +3,25 @@
namespace q7s {
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi-main";
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi_main";
static constexpr uint32_t SPI_MAIN_BUS_LOCK_TIMEOUT = 50;
static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
static constexpr char SPI_RW_DEV[] = "/dev/spi_rw";
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c_eive";
static constexpr char UART_GNSS_DEV[] = "/dev/gps0";
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc";
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str";
static constexpr char UART_SCEX_DEV[] = "/dev/ttyS-SCEX";
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul_plmpsoc";
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul_plsv";
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul_syrlinks";
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul_str";
static constexpr char UART_SCEX_DEV[] = "/dev/scex";
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
static constexpr char UIO_PTME[] = "/dev/uio1";
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio_pdec_regs";
static constexpr char UIO_PTME[] = "/dev/uio_ptme";
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio_pdec_cfg_mem";
static constexpr char UIO_PDEC_RAM[] = "/dev/uio_pdec_ram";
static constexpr char UIO_PDEC_IRQ[] = "/dev/uio_pdec_irq";
static constexpr int MAP_ID_PTME_CONFIG = 3;
namespace uiomapids {

View File

@ -75,8 +75,10 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
if (doTestProtHandler) {
testProtHandler();
}
if (DO_TEST_FS_HANDLER) {
FsOpCodes opCode = FsOpCodes::CREATE_EMPTY_FILE_IN_TMP;
testFileSystemHandlerDirect(opCode);
}
return TestTask::performOneShotAction();
}

View File

@ -18,6 +18,7 @@ class Q7STestTask : public TestTask {
bool doTestScratchApi = false;
static constexpr bool DO_TEST_GOMSPACE_API = false;
static constexpr bool DO_TEST_GOMSPACE_GET_CONFIG = false;
static constexpr bool DO_TEST_FS_HANDLER = false;
bool doTestGpsShm = false;
bool doTestGpsSocket = false;
bool doTestProtHandler = false;

View File

@ -41,19 +41,19 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
uint8_t writeSize = 0;
gpioId_t gpioId = cookie->getChipSelectPin();
GpioIF* gpioIF = comIf->getGpioInterface();
GpioIF& gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0;
MutexIF* mutex = comIf->getCsMutex();
cookie->getMutexParams(timeoutType, timeoutMs);
if (mutex == nullptr or gpioIF == nullptr) {
if (mutex == nullptr) {
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
return returnvalue::FAILED;
}
int fileDescriptor = 0;
const std::string& dev = comIf->getSpiDev();
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
result = openSpi(dev, O_RDWR, &gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
if (result != returnvalue::OK) {
return result;
}
@ -75,7 +75,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return RwHandler::SPI_WRITE_FAILURE;
}
@ -100,7 +100,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
}
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return RwHandler::SPI_WRITE_FAILURE;
}
idx++;
@ -112,14 +112,14 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return RwHandler::SPI_WRITE_FAILURE;
}
uint8_t* rxBuf = nullptr;
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
if (result != returnvalue::OK) {
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return result;
}
@ -127,9 +127,9 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
// There must be a delay of at least 20 ms after sending the command.
// Delay for 70 ms here and release the SPI bus for that duration.
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
usleep(RwDefinitions::SPI_REPLY_DELAY);
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
result = openSpi(dev, O_RDWR, &gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
if (result != returnvalue::OK) {
return result;
}
@ -142,13 +142,13 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
for (int idx = 0; idx < 10; idx++) {
if (read(fileDescriptor, &byteRead, 1) != 1) {
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return RwHandler::SPI_READ_FAILURE;
}
if (idx == 0) {
if (byteRead != FLAG_BYTE) {
sif::error << "Invalid data, expected start marker" << std::endl;
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return RwHandler::NO_START_MARKER;
}
}
@ -159,7 +159,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
if (idx == 9) {
sif::error << "rwSpiCallback::spiCallback: Empty frame timeout" << std::endl;
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return RwHandler::NO_REPLY;
}
}
@ -199,7 +199,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
continue;
} else {
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
result = RwHandler::INVALID_SUBSTITUTE;
break;
}
@ -233,7 +233,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
cookie->setTransferSize(decodedFrameLen);
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
return result;
}

View File

@ -3,6 +3,7 @@
#include <fsfw/events/EventManager.h>
#include <fsfw/filesystem/HasFileSystemIF.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/tasks/TaskFactory.h>
#include "OBSWVersion.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
@ -30,10 +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)
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5),
opDivider5(5),
opDivider10(10),
hkSet(this) {
: ExtendedControllerBase(objectId, 5), opDivider5(5), opDivider10(10), hkSet(this) {
ReturnValue_t result = returnvalue::OK;
try {
result = initWatchdogFifo();
@ -49,10 +47,7 @@ CoreController::CoreController(object_id_t objectId)
sdcMan->setBlocking(false);
}
result = initBootCopy();
if (result != returnvalue::OK) {
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
}
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
} catch (const std::filesystem::filesystem_error &e) {
sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl;
}
@ -81,6 +76,12 @@ void CoreController::performControlOperation() {
sdStateMachine();
performMountedSdCardOperations();
if (sdCardCheckCd.hasTimedOut()) {
if (shortSdCardCdCounter < 2) {
shortSdCardCdCounter++;
}
if (shortSdCardCdCounter == 2) {
sdCardCheckCd.setTimeout(DEFAULT_SD_CARD_CHECK_TIMEOUT);
}
performSdCardCheck();
sdCardCheckCd.resetTimer();
}
@ -91,9 +92,9 @@ void CoreController::performControlOperation() {
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::TEMPERATURE, &tempPoolEntry);
localDataPoolMap.emplace(core::PS_VOLTAGE, &psVoltageEntry);
localDataPoolMap.emplace(core::PL_VOLTAGE, &plVoltageEntry);
poolManager.subscribeForRegularPeriodicPacket({hkSet.getSid(), false, 10.0});
return returnvalue::OK;
}
@ -171,8 +172,7 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
setenv("PATH", updatedEnvPath.c_str(), true);
updateProtInfo();
initPrint();
ExtendedControllerBase::initializeAfterTaskCreation();
return result;
return ExtendedControllerBase::initializeAfterTaskCreation();
}
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
@ -793,7 +793,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
return returnvalue::OK;
}
ReturnValue_t CoreController::initBootCopy() {
ReturnValue_t CoreController::initBootCopyFile() {
if (not std::filesystem::exists(CURR_COPY_FILE)) {
// This file is created by the systemd service eive-early-config so this should
// not happen normally
@ -803,8 +803,6 @@ ReturnValue_t CoreController::initBootCopy() {
utility::handleSystemError(result, "CoreController::initBootCopy");
}
}
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
return returnvalue::OK;
}
@ -932,6 +930,9 @@ ReturnValue_t CoreController::actionReboot(const uint8_t *data, size_t size) {
ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy,
bool &protOpPerformed) {
sdcMan->setBlocking(true);
sdcMan->markUnusable();
// Wait two seconds to ensure no one uses the SD cards
TaskFactory::delayTask(2000);
// Attempt graceful shutdown by unmounting and switching off SD cards
sdcMan->switchOffSdCard(sd::SdCard::SLOT_0);
sdcMan->switchOffSdCard(sd::SdCard::SLOT_1);
@ -1237,6 +1238,10 @@ void CoreController::performMountedSdCardOperations() {
std::filesystem::create_directory(path.str());
}
initVersionFile();
ReturnValue_t result = initBootCopyFile();
if (result != returnvalue::OK) {
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
}
initClockFromTimeFile();
performRebootFileHandling(false);
}

View File

@ -70,6 +70,9 @@ class CoreController : public ExtendedControllerBase {
static constexpr char CHIP_1_COPY_0_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi1-nom-rootfs";
static constexpr char CHIP_1_COPY_1_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi1-gold-rootfs";
static constexpr dur_millis_t INIT_SD_CARD_CHECK_TIMEOUT = 5000;
static constexpr dur_millis_t DEFAULT_SD_CARD_CHECK_TIMEOUT = 60000;
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
@ -210,6 +213,8 @@ class CoreController : public ExtendedControllerBase {
RebootFile rebootFile = {};
std::string currMntPrefix;
bool performOneShotSdCardOpsSwitch = false;
uint8_t shortSdCardCdCounter = 0;
Countdown sdCardCheckCd = Countdown(INIT_SD_CARD_CHECK_TIMEOUT);
/**
* Index 0: Chip 0 Copy 0
@ -221,6 +226,10 @@ class CoreController : public ExtendedControllerBase {
PeriodicOperationDivider opDivider5;
PeriodicOperationDivider opDivider10;
PoolEntry<float> tempPoolEntry = PoolEntry<float>(0.0);
PoolEntry<float> psVoltageEntry = PoolEntry<float>(0.0);
PoolEntry<float> plVoltageEntry = PoolEntry<float>(0.0);
core::HkSet hkSet;
#if OBSW_SD_CARD_MUST_BE_ON == 1
@ -229,7 +238,7 @@ class CoreController : public ExtendedControllerBase {
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
Countdown sdCardCheckCd = Countdown(120000);
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
void performMountedSdCardOperations();
@ -238,7 +247,7 @@ class CoreController : public ExtendedControllerBase {
ReturnValue_t initClockFromTimeFile();
ReturnValue_t performSdCardCheck();
ReturnValue_t timeFileHandler();
ReturnValue_t initBootCopy();
ReturnValue_t initBootCopyFile();
ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking();
bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode, MessageQueueId_t commander,

View File

@ -67,12 +67,7 @@ void initmission::initTasks() {
void (*missedDeadlineFunc)(void) = nullptr;
#endif
PeriodicTaskIF* sysCtrlTask = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = sysCtrlTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
#if OBSW_ADD_SA_DEPL == 1
// Could add this to the core controller but the core controller does so many thing that I would
// prefer to have the solar array deployment in a seprate task.
PeriodicTaskIF* solarArrayDeplTask = factory->createPeriodicTask(
@ -81,6 +76,18 @@ void initmission::initTasks() {
if (result != returnvalue::OK) {
initmission::printAddObjectError("SOLAR_ARRAY_DEPL", objects::SOLAR_ARRAY_DEPL_HANDLER);
}
#endif
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = sysTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
result = sysTask->addComponent(objects::PL_SUBSYSTEM);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PL_SUBSYSTEM", objects::PL_SUBSYSTEM);
}
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
@ -117,7 +124,7 @@ void initmission::initTasks() {
}
#endif
#if OBSW_USE_CCSDS_IP_CORE == 1
#if OBSW_ADD_CCSDS_IP_CORES == 1
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
@ -125,16 +132,14 @@ void initmission::initTasks() {
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
}
// Minimal distance between two received TCs amounts to 0.6 seconds
// If a command has not been read before the next one arrives, the old command will be
// overwritten by the PDEC.
// Runs in IRQ mode, frequency does not really matter
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
"PDEC_HANDLER", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
}
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#endif /* OBSW_ADD_CCSDS_IP_CORE == 1 */
#if OBSW_ADD_CFDP_COMPONENTS == 1
PeriodicTaskIF* cfdpTask = factory->createPeriodicTask(
@ -182,6 +187,10 @@ void initmission::initTasks() {
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
}
#endif
result = acsSysTask->addComponent(objects::ACS_SUBSYSTEM);
if (result != returnvalue::OK) {
initmission::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM);
}
#if OBSW_ADD_RTD_DEVICES == 1
PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask(
@ -190,6 +199,7 @@ void initmission::initTasks() {
if (result != returnvalue::OK) {
initmission::printAddObjectError("SPI_RTD_POLLING", objects::SPI_RTD_COM_IF);
}
PeriodicTaskIF* tcsTask = factory->createPeriodicTask(
"TCS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
std::array<object_id_t, EiveMax31855::NUM_RTDS> rtdIds = {
@ -234,10 +244,12 @@ void initmission::initTasks() {
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
}
#endif
#if OBSW_ADD_HEATERS == 1
result = tcsSystemTask->addComponent(objects::HEATER_HANDLER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("HEATER_HANDLER", objects::HEATER_HANDLER);
}
#endif
#if OBSW_ADD_STAR_TRACKER == 1
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
@ -266,14 +278,11 @@ void initmission::initTasks() {
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
PeriodicTaskIF* plTask = factory->createPeriodicTask(
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
scheduling::addMpsocSupvHandlers(plTask);
plTask->addComponent(objects::CAM_SWITCHER);
#if OBSW_ADD_SCEX_DEVICE == 1
PeriodicTaskIF* scexDevHandler;
PeriodicTaskIF* scexReaderTask;
@ -286,6 +295,14 @@ void initmission::initTasks() {
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
#if OBSW_ADD_TEST_CODE == 1
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
std::vector<PeriodicTaskIF*> testTasks;
createTestTasks(*factory, missedDeadlineFunc, testTasks);
#endif
@ -307,13 +324,15 @@ void initmission::initTasks() {
tmtcPollingTask->startTask();
#endif
#if OBSW_USE_CCSDS_IP_CORE == 1
#if OBSW_ADD_CCSDS_IP_CORES == 1
ccsdsHandlerTask->startTask();
pdecHandlerTask->startTask();
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
sysCtrlTask->startTask();
sysTask->startTask();
#if OBSW_ADD_SA_DEPL == 1
solarArrayDeplTask->startTask();
#endif
taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector");
@ -340,7 +359,9 @@ void initmission::initTasks() {
tcsPollingTask->startTask();
tcsTask->startTask();
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
if (not tcsSystemTask->isEmpty()) {
tcsSystemTask->startTask();
}
#if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
@ -454,7 +475,7 @@ void initmission::createPusTasks(TaskFactory& factory,
taskVec.push_back(pusEvents);
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
@ -463,6 +484,7 @@ void initmission::createPusTasks(TaskFactory& factory,
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
@ -492,14 +514,15 @@ void initmission::createPusTasks(TaskFactory& factory,
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
}
// Used for connection tests, therefore use higher priority
result = pusMedPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
}
taskVec.push_back(pusMedPrio);
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);

View File

@ -1,6 +1,7 @@
#include "ObjectFactory.h"
#include <linux/devices/ScexUartReader.h>
#include <fsfw/subsystem/Subsystem.h>
#include <mission/system/objects/CamSwitcher.h>
#include "OBSWConfig.h"
#include "bsp_q7s/boardtest/Q7STestTask.h"
@ -23,6 +24,7 @@
#include "linux/callbacks/gpioCallbacks.h"
#include "linux/csp/CspComIF.h"
#include "linux/devices/GPSHyperionLinuxController.h"
#include "linux/devices/ScexUartReader.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h"
@ -31,22 +33,28 @@
#include "linux/devices/ploc/PlocSupervisorHandler.h"
#include "linux/devices/startracker/StarTrackerHandler.h"
#include "linux/devices/startracker/StrHelper.h"
#include "linux/obc/AxiPtmeConfig.h"
#include "linux/obc/PapbVcInterface.h"
#include "linux/obc/PdecHandler.h"
#include "linux/obc/Ptme.h"
#include "linux/obc/PtmeConfig.h"
#include "linux/ipcore/AxiPtmeConfig.h"
#include "linux/ipcore/PapbVcInterface.h"
#include "linux/ipcore/PdecHandler.h"
#include "linux/ipcore/Ptme.h"
#include "linux/ipcore/PtmeConfig.h"
#include "mission/csp/CspCookie.h"
#include "mission/system/RwAssembly.h"
#include "mission/system/fdir/AcsBoardFdir.h"
#include "mission/system/fdir/GomspacePowerFdir.h"
#include "mission/system/fdir/RtdFdir.h"
#include "mission/system/fdir/SusFdir.h"
#include "mission/system/fdir/SyrlinksFdir.h"
#include "mission/system/objects/AcsSubsystem.h"
#include "mission/system/objects/RwAssembly.h"
#include "mission/system/objects/TcsBoardAssembly.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/payloadModeTree.h"
#include "tmtc/pusIds.h"
#if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h"
#endif
#include <mission/devices/ImtqHandler.h>
#include <sstream>
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
@ -61,16 +69,15 @@
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "fsfw_hal/linux/i2c/I2cCookie.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "fsfw_hal/linux/serial/SerialCookie.h"
#include "fsfw_hal/linux/spi/SpiComIF.h"
#include "fsfw_hal/linux/spi/SpiCookie.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
#include "mission/core/GenericFactory.h"
#include "mission/devices/ACUHandler.h"
#include "mission/devices/BpxBatteryHandler.h"
#include "mission/devices/GyroADIS1650XHandler.h"
#include "mission/devices/HeaterHandler.h"
#include "mission/devices/IMTQHandler.h"
#include "mission/devices/Max31865PT1000Handler.h"
#include "mission/devices/P60DockHandler.h"
#include "mission/devices/PCDUHandler.h"
@ -88,9 +95,9 @@
#include "mission/devices/devicedefinitions/RwDefinitions.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/system/AcsBoardAssembly.h"
#include "mission/tmtc/CCSDSHandler.h"
#include "mission/tmtc/TmFunnel.h"
#include "mission/system/objects/AcsBoardAssembly.h"
#include "mission/tmtc/CcsdsIpCoreHandler.h"
#include "mission/tmtc/TmFunnelHandler.h"
#include "mission/tmtc/VirtualChannel.h"
ResetArgs RESET_ARGS_GNSS;
@ -130,9 +137,9 @@ void ObjectFactory::createTmpComponents() {
(void)tmp1075Handler_2;
}
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
SpiComIF** spiMainComIF, I2cComIF** i2cComIF,
SpiComIF** spiRWComIF) {
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF,
SerialComIF** uartComIF, SpiComIF** spiMainComIF,
I2cComIF** i2cComIF, SpiComIF** spiRWComIF) {
if (gpioComIF == nullptr or uartComIF == nullptr or spiMainComIF == nullptr or
spiRWComIF == nullptr) {
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer"
@ -143,11 +150,9 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
/* Communication interfaces */
new CspComIF(objects::CSP_COM_IF);
*i2cComIF = new I2cComIF(objects::I2C_COM_IF);
*uartComIF = new UartComIF(objects::UART_COM_IF);
*spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, *gpioComIF);
*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, *gpioComIF);
/* Adding gpios for chip select decoding to the gpioComIf */
q7s::gpioCallbacks::initSpiCsDecoder(*gpioComIF);
*uartComIF = new SerialComIF(objects::UART_COM_IF);
*spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, **gpioComIF);
*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, **gpioComIF);
}
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
@ -192,8 +197,11 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
#endif
}
void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
using namespace gpio;
if (gpioComIF == nullptr) {
return returnvalue::FAILED;
}
GpioCookie* gpioCookieRadSensor = new GpioCookie;
std::stringstream consumer;
consumer << "0x" << std::hex << objects::RAD_SENSOR;
@ -219,12 +227,14 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
#if OBSW_DEBUG_RAD_SENSOR == 1
radSensor->enablePeriodicDataPrint(true);
#endif
return returnvalue::OK;
}
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF,
PowerSwitchIF* pwrSwitcher) {
using namespace gpio;
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
std::vector<std::reference_wrapper<DeviceHandlerBase>> assemblyChildren;
std::stringstream consumer;
GpiodRegularByLineName* gpio = nullptr;
@ -329,11 +339,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
SpiCookie* spiCookie =
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, MGMLIS3MDL::MAX_BUFFER_SIZE,
spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_MAIN_COM_IF,
spiCookie, spi::LIS3_TRANSITION_DELAY);
auto mgmLis3Handler0 = new MgmLIS3MDLHandler(
objects::MGM_0_LIS3_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::LIS3_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_0_LIS3_HANDLER);
mgmLis3Handler->setCustomFdir(fdir);
static_cast<void>(mgmLis3Handler);
mgmLis3Handler0->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmLis3Handler0);
#if OBSW_TEST_ACS == 1
mgmLis3Handler->setStartUpImmediately();
mgmLis3Handler->setToGoToNormalMode(true);
@ -344,13 +354,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spiCookie =
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, RM3100::MAX_BUFFER_SIZE,
spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
auto mgmRm3100Handler =
auto mgmRm3100Handler1 =
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
spi::RM3100_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_1_RM3100_HANDLER);
mgmRm3100Handler->setCustomFdir(fdir);
mgmRm3100Handler->setParent(objects::ACS_BOARD_ASS);
static_cast<void>(mgmRm3100Handler);
mgmRm3100Handler1->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmRm3100Handler1);
#if OBSW_TEST_ACS == 1
mgmRm3100Handler->setStartUpImmediately();
mgmRm3100Handler->setToGoToNormalMode(true);
@ -361,12 +370,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spiCookie =
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, MGMLIS3MDL::MAX_BUFFER_SIZE,
spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_MAIN_COM_IF,
spiCookie, spi::LIS3_TRANSITION_DELAY);
auto* mgmLis3Handler2 = new MgmLIS3MDLHandler(
objects::MGM_2_LIS3_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::LIS3_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_2_LIS3_HANDLER);
mgmLis3Handler->setCustomFdir(fdir);
mgmLis3Handler->setParent(objects::ACS_BOARD_ASS);
static_cast<void>(mgmLis3Handler);
mgmLis3Handler2->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmLis3Handler2);
#if OBSW_TEST_ACS == 1
mgmLis3Handler->setStartUpImmediately();
mgmLis3Handler->setToGoToNormalMode(true);
@ -377,11 +385,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spiCookie =
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, RM3100::MAX_BUFFER_SIZE,
spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_MAIN_COM_IF,
spiCookie, spi::RM3100_TRANSITION_DELAY);
auto* mgmRm3100Handler3 =
new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
spi::RM3100_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::MGM_3_RM3100_HANDLER);
mgmRm3100Handler->setCustomFdir(fdir);
mgmRm3100Handler->setParent(objects::ACS_BOARD_ASS);
mgmRm3100Handler3->setCustomFdir(fdir);
assemblyChildren.push_back(*mgmRm3100Handler3);
#if OBSW_TEST_ACS == 1
mgmRm3100Handler->setStartUpImmediately();
mgmRm3100Handler->setToGoToNormalMode(true);
@ -399,8 +408,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
ADIS1650X::Type::ADIS16505);
fdir = new AcsBoardFdir(objects::GYRO_0_ADIS_HANDLER);
adisHandler->setCustomFdir(fdir);
adisHandler->setParent(objects::ACS_BOARD_ASS);
static_cast<void>(adisHandler);
assemblyChildren.push_back(*adisHandler);
#if OBSW_TEST_ACS == 1
adisHandler->setStartUpImmediately();
adisHandler->setToGoToNormalModeImmediately();
@ -411,12 +419,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
// Gyro 1 Side A
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, L3GD20H::MAX_BUFFER_SIZE,
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto gyroL3gHandler = new GyroHandlerL3GD20H(
auto gyroL3gHandler1 = new GyroHandlerL3GD20H(
objects::GYRO_1_L3G_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::L3G_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::GYRO_1_L3G_HANDLER);
gyroL3gHandler->setCustomFdir(fdir);
gyroL3gHandler->setParent(objects::ACS_BOARD_ASS);
static_cast<void>(gyroL3gHandler);
gyroL3gHandler1->setCustomFdir(fdir);
assemblyChildren.push_back(*gyroL3gHandler1);
#if OBSW_TEST_ACS == 1
gyroL3gHandler->setStartUpImmediately();
gyroL3gHandler->setToGoToNormalMode(true);
@ -432,7 +439,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
spiCookie, ADIS1650X::Type::ADIS16505);
fdir = new AcsBoardFdir(objects::GYRO_2_ADIS_HANDLER);
adisHandler->setCustomFdir(fdir);
adisHandler->setParent(objects::ACS_BOARD_ASS);
assemblyChildren.push_back(*adisHandler);
#if OBSW_TEST_ACS == 1
adisHandler->setStartUpImmediately();
adisHandler->setToGoToNormalModeImmediately();
@ -440,11 +447,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
// Gyro 3 Side B
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, L3GD20H::MAX_BUFFER_SIZE,
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_MAIN_COM_IF,
spiCookie, spi::L3G_TRANSITION_DELAY);
auto gyroL3gHandler3 = new GyroHandlerL3GD20H(
objects::GYRO_3_L3G_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::L3G_TRANSITION_DELAY);
fdir = new AcsBoardFdir(objects::GYRO_3_L3G_HANDLER);
gyroL3gHandler->setCustomFdir(fdir);
gyroL3gHandler->setParent(objects::ACS_BOARD_ASS);
gyroL3gHandler3->setCustomFdir(fdir);
assemblyChildren.push_back(*gyroL3gHandler3);
#if OBSW_TEST_ACS == 1
gyroL3gHandler->setStartUpImmediately();
gyroL3gHandler->setToGoToNormalMode(true);
@ -466,9 +473,18 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,
objects::MGM_3_RM3100_HANDLER, objects::GYRO_0_ADIS_HANDLER, objects::GYRO_1_L3G_HANDLER,
objects::GYRO_2_ADIS_HANDLER, objects::GYRO_3_L3G_HANDLER, objects::GPS_CONTROLLER);
auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
acsBoardHelper, gpioComIF);
auto acsAss =
new AcsBoardAssembly(objects::ACS_BOARD_ASS, pwrSwitcher, acsBoardHelper, gpioComIF);
static_cast<void>(acsAss);
for (auto& assChild : assemblyChildren) {
ReturnValue_t result = assChild.get().connectModeTreeParent(*acsAss);
if (result != returnvalue::OK) {
sif::error << "Connecting assembly for ACS board component " << assChild.get().getObjectId()
<< " failed" << std::endl;
}
}
gpsCtrl->connectModeTreeParent(*acsAss);
acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
}
@ -571,9 +587,13 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
#endif
}
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitch) {
using namespace gpio;
std::stringstream consumer;
auto* camSwitcher =
new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, pcdu::PDU2_CH8_PAYLOAD_CAMERA);
camSwitcher->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
// camSwitcher->
#if OBSW_ADD_PLOC_MPSOC == 1
consumer << "0x" << std::hex << objects::PLOC_MPSOC_HANDLER;
auto gpioConfigMPSoC = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_MPSOC_UART,
@ -586,9 +606,10 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
mpsocCookie->setNoFixedSizeReply();
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF),
objects::PLOC_SUPERVISOR_HANDLER);
auto* mpsocHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, plocMpsocHelper,
Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER);
mpsocHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER;
@ -602,9 +623,10 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
supervisorCookie->setNoFixedSizeReply();
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
auto* supvHandler = new PlocSupervisorHandler(
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, supervisorCookie,
Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), pcdu::PDU1_CH6_PLOC_12V, supvHelper);
supvHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
static_cast<void>(consumer);
}
@ -681,13 +703,21 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF,
}
RwHelper rwHelper(rwIds);
auto* rwAss = new RwAssembly(objects::RW_ASS, objects::NO_OBJECT, pwrSwitcher,
pcdu::Switches::PDU2_CH2_RW_5V, rwHelper);
static_cast<void>(rwAss);
auto* rwAss =
new RwAssembly(objects::RW_ASS, pwrSwitcher, pcdu::Switches::PDU2_CH2_RW_5V, rwHelper);
for (uint8_t idx = 0; idx < rws.size(); idx++) {
ReturnValue_t result = rws[idx]->connectModeTreeParent(*rwAss);
if (result != returnvalue::OK) {
sif::error << "Connecting RW " << static_cast<int>(idx) << " to RW assembly failed"
<< std::endl;
}
}
rwAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
#endif /* OBSW_ADD_RW == 1 */
}
void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
ReturnValue_t ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF,
CcsdsIpCoreHandler** ipCoreHandler) {
using namespace gpio;
// GPIO definitions of signals connected to the virtual channel interfaces of the PTME IP Core
GpioCookie* gpioCookiePtmeIp = new GpioCookie;
@ -750,18 +780,19 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
#else
static const uint32_t TRANSMITTER_TIMEOUT = 900000; // 15 minutes
#endif
CCSDSHandler* ccsdsHandler = new CCSDSHandler(
*ipCoreHandler = new CcsdsIpCoreHandler(
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig,
gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA, TRANSMITTER_TIMEOUT);
VirtualChannel* vc = nullptr;
vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE, objects::CCSDS_HANDLER);
ccsdsHandler->addVirtualChannel(ccsds::VC0, vc);
(*ipCoreHandler)->addVirtualChannel(ccsds::VC0, vc);
vc = new VirtualChannel(ccsds::VC1, common::VC1_QUEUE_SIZE, objects::CCSDS_HANDLER);
ccsdsHandler->addVirtualChannel(ccsds::VC1, vc);
(*ipCoreHandler)->addVirtualChannel(ccsds::VC1, vc);
vc = new VirtualChannel(ccsds::VC2, common::VC2_QUEUE_SIZE, objects::CCSDS_HANDLER);
ccsdsHandler->addVirtualChannel(ccsds::VC2, vc);
(*ipCoreHandler)->addVirtualChannel(ccsds::VC2, vc);
vc = new VirtualChannel(ccsds::VC3, common::VC3_QUEUE_SIZE, objects::CCSDS_HANDLER);
ccsdsHandler->addVirtualChannel(ccsds::VC3, vc);
(*ipCoreHandler)->addVirtualChannel(ccsds::VC3, vc);
GpioCookie* gpioCookiePdec = new GpioCookie;
consumer.str("");
consumer << "0x" << std::hex << objects::PDEC_HANDLER;
@ -770,8 +801,13 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
Levels::LOW);
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
gpioChecker(gpioComIF->addGpios(gpioCookiePdec), "PDEC");
struct UioNames uioNames {};
uioNames.configMemory = q7s::UIO_PDEC_CONFIG_MEMORY;
uioNames.ramMemory = q7s::UIO_PDEC_RAM;
uioNames.registers = q7s::UIO_PDEC_REGISTERS;
uioNames.irq = q7s::UIO_PDEC_IRQ;
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS);
uioNames);
GpioCookie* gpioRS485Chip = new GpioCookie;
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver",
Direction::OUT, Levels::LOW);
@ -787,6 +823,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
Direction::OUT, Levels::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
gpioChecker(gpioComIF->addGpios(gpioRS485Chip), "RS485 Transceiver");
return returnvalue::OK;
}
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
@ -850,6 +887,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
plPcduHandler->setToGoToNormalModeImmediately(true);
plPcduHandler->enablePeriodicPrintout(true, 10);
#endif
plPcduHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
}
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
@ -876,14 +914,16 @@ void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie,
strHelper, pcdu::PDU1_CH2_STAR_TRACKER_5V);
starTracker->setPowerSwitcher(pwrSwitcher);
starTracker->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher) {
I2cCookie* imtqI2cCookie =
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie,
auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie,
pcdu::Switches::PDU1_CH3_MGT_5V);
imtqHandler->setPowerSwitcher(pwrSwitcher);
imtqHandler->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
static_cast<void>(imtqHandler);
#if OBSW_TEST_IMTQ == 1
imtqHandler->setStartUpImmediately();

View File

@ -2,11 +2,14 @@
#define BSP_Q7S_OBJECTFACTORY_H_
#include <fsfw/returnvalues/returnvalue.h>
#include <mission/tmtc/CcsdsIpCoreHandler.h>
#include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PusTmFunnel.h>
#include <string>
class LinuxLibgpioIF;
class UartComIF;
class SerialComIF;
class SpiComIF;
class I2cComIF;
class PowerSwitchIF;
@ -19,15 +22,15 @@ namespace ObjectFactory {
void setStatics();
void produce(void* args);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, SerialComIF** uartComIF,
SpiComIF** spiMainComIF, I2cComIF** i2cComIF,
SpiComIF** spiRwComIF);
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher);
void createTmpComponents();
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF,
PowerSwitchIF* pwrSwitcher);
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable);
void createImtqComponents(PowerSwitchIF* pwrSwitcher);
@ -35,9 +38,9 @@ void createBpxBatteryComponent();
void createStrComponents(PowerSwitchIF* pwrSwitcher);
void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF);
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
ReturnValue_t createCcsdsComponents(LinuxLibgpioIF* gpioComIF, CcsdsIpCoreHandler** ipCoreHandler);
void createMiscComponents();
void createTestComponents(LinuxLibgpioIF* gpioComIF);

View File

@ -1,3 +1,4 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <fsfw/health/HealthTableIF.h>
#include <fsfw/power/DummyPowerSwitcher.h>
@ -16,25 +17,33 @@
void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics();
HealthTableIF* healthTable = nullptr;
ObjectFactory::produceGenericObjects(&healthTable);
PusTmFunnel* pusFunnel = nullptr;
CfdpTmFunnel* cfdpFunnel = nullptr;
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel);
LinuxLibgpioIF* gpioComIF = nullptr;
UartComIF* uartComIF = nullptr;
SerialComIF* uartComIF = nullptr;
SpiComIF* spiMainComIF = nullptr;
I2cComIF* i2cComIF = nullptr;
SpiComIF* spiRwComIF = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
/* Adding gpios for chip select decoding to the gpioComIf */
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
gpioCallbacks::disableAllDecoder(gpioComIF);
// Hardware is usually not connected to EM, so we need to create dummies which replace lower
// level components.
dummy::DummyCfg dummyCfg;
dummyCfg.addCoreCtrlCfg = false;
#if OBSW_ADD_SYRLINKS == 1
dummyCfg.addSyrlinksDummies = false;
#endif
dummy::createDummies(dummyCfg);
new CoreController(objects::CORE_CONTROLLER);
gpioCallbacks::disableAllDecoder(gpioComIF);
PowerSwitchIF* pwrSwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
static_cast<void>(pwrSwitcher);
// Regular FM code, does not work for EM if the hardware is not connected
// createPcduComponents(gpioComIF, &pwrSwitcher);
@ -44,19 +53,28 @@ void ObjectFactory::produce(void* args) {
// createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
// createTmpComponents();
// createSolarArrayDeploymentComponents();
createRadSensorComponent(gpioComIF);
// createPayloadComponents(gpioComIF);
// createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
// TODO: Careful! Switching this on somehow messes with the communication with the ProASIC
// and will cause xsc_boot_copy commands to always boot to 0 0
// createRadSensorComponent(gpioComIF);
#if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
#endif
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
createPayloadComponents(gpioComIF);
#if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher);
#endif
#if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */
#if OBSW_ADD_RW == 1
createReactionWheelComponents(gpioComIF, pwrSwitcher);
#endif
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent();
@ -65,9 +83,13 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_STAR_TRACKER == 1
createStrComponents(pwrSwitcher);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_USE_CCSDS_IP_CORE == 1
createCcsdsComponents(gpioComIF);
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#if OBSW_ADD_CCSDS_IP_CORES == 1
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
createCcsdsComponents(gpioComIF, &ipCoreHandler);
#if OBSW_TM_TO_PTME == 1
ObjectFactory::addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel);
#endif
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
/* Test Task */
#if OBSW_ADD_TEST_CODE == 1
createTestComponents(gpioComIF);
@ -76,7 +98,5 @@ void ObjectFactory::produce(void* args) {
createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), true,
std::nullopt);
#endif
createMiscComponents();
createAcsController();
createAcsController(true);
}

View File

@ -1,3 +1,4 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include "OBSWConfig.h"
@ -10,23 +11,27 @@
#include "linux/ObjectFactory.h"
#include "linux/callbacks/gpioCallbacks.h"
#include "mission/core/GenericFactory.h"
#include "mission/system/tree/system.h"
void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics();
HealthTableIF* healthTable = nullptr;
ObjectFactory::produceGenericObjects(&healthTable);
PusTmFunnel* pusFunnel = nullptr;
CfdpTmFunnel* cfdpFunnel = nullptr;
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel);
LinuxLibgpioIF* gpioComIF = nullptr;
UartComIF* uartComIF = nullptr;
SerialComIF* uartComIF = nullptr;
SpiComIF* spiMainComIF = nullptr;
I2cComIF* i2cComIF = nullptr;
PowerSwitchIF* pwrSwitcher = nullptr;
SpiComIF* spiRwComIF = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
createTmpComponents();
new CoreController(objects::CORE_CONTROLLER);
/* Adding gpios for chip select decoding to the gpioComIf */
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
gpioCallbacks::disableAllDecoder(gpioComIF);
new CoreController(objects::CORE_CONTROLLER);
createPcduComponents(gpioComIF, &pwrSwitcher);
createRadSensorComponent(gpioComIF);
createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
@ -35,13 +40,16 @@ void ObjectFactory::produce(void* args) {
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
#endif
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
#if OBSW_ADD_TMP_DEVICES == 1
createTmpComponents();
#endif
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
#if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF);
createPayloadComponents(gpioComIF, *pwrSwitcher);
#if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher);
@ -55,9 +63,13 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_STAR_TRACKER == 1
createStrComponents(pwrSwitcher);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_USE_CCSDS_IP_CORE == 1
createCcsdsComponents(gpioComIF);
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#if OBSW_ADD_CCSDS_IP_CORES == 1
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
createCcsdsComponents(gpioComIF, &ipCoreHandler);
#if OBSW_TM_TO_PTME == 1
addTmtcIpCoresToFunnels(*ipCoreHandler, *pusFunnel, *cfdpFunnel);
#endif
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
#if OBSW_ADD_SCEX_DEVICE == 1
createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), false,
@ -70,5 +82,6 @@ void ObjectFactory::produce(void* args) {
createMiscComponents();
createThermalController();
createAcsController();
createAcsController(true);
satsystem::init();
}

View File

@ -459,7 +459,14 @@ void SdCardManager::setBlocking(bool blocking) { this->blocking = blocking; }
void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = print; }
bool SdCardManager::isSdCardUsable(sd::SdCard sdCard) {
bool SdCardManager::isSdCardUsable(std::optional<sd::SdCard> sdCard) {
{
MutexGuard mg(mutex);
if (markedUnusable) {
return false;
}
}
SdCardManager::SdStatePair active;
ReturnValue_t result = this->getSdCardsStatus(active);
@ -467,20 +474,30 @@ bool SdCardManager::isSdCardUsable(sd::SdCard sdCard) {
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
return false;
}
if (not sdCard) {
if (active.first == sd::MOUNTED or active.second == sd::MOUNTED) {
return true;
}
return false;
}
if (sdCard == sd::SLOT_0) {
if (active.first == sd::MOUNTED) {
return true;
} else {
return false;
}
} else if (sdCard == sd::SLOT_1) {
}
if (sdCard == sd::SLOT_1) {
if (active.second == sd::MOUNTED) {
return true;
} else {
return false;
}
} else {
sif::debug << "SdCardManager::isSdCardMounted: Unknown SD card specified" << std::endl;
}
if (sdCard == sd::BOTH) {
if (active.first == sd::MOUNTED && active.second == sd::MOUNTED) {
return true;
}
}
return false;
}
@ -560,5 +577,13 @@ void SdCardManager::setActiveSdCard(sd::SdCard sdCard) {
std::optional<sd::SdCard> SdCardManager::getActiveSdCard() const {
MutexGuard mg(mutex);
if (markedUnusable) {
return std::nullopt;
}
return sdInfo.active;
}
void SdCardManager::markUnusable() {
MutexGuard mg(mutex);
markedUnusable = true;
}

View File

@ -206,7 +206,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
*
* @return true if mounted, otherwise false
*/
bool isSdCardUsable(sd::SdCard sdCard) override;
bool isSdCardUsable(std::optional<sd::SdCard> sdCard) override;
ReturnValue_t isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly);
@ -214,12 +214,15 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
ReturnValue_t performFsck(sd::SdCard sdcard, bool printOutput, int& linuxError);
void markUnusable();
private:
CommandExecutor cmdExecutor;
Operations currentOp = Operations::IDLE;
bool blocking = false;
bool sdCardActive = true;
bool printCmdOutput = true;
bool markedUnusable = false;
MutexIF* mutex = nullptr;
SdCardManager();

View File

@ -107,7 +107,7 @@ void initmission::initTasks() {
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
#if OBSW_USE_CCSDS_IP_CORE == 1
#if OBSW_ADD_CCSDS_IP_CORES == 1
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
@ -124,7 +124,7 @@ void initmission::initTasks() {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
}
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
for (const auto& task : taskVector) {
@ -140,10 +140,10 @@ void initmission::initTasks() {
tmtcDistributor->startTask();
tmtcBridgeTask->startTask();
tmtcPollingTask->startTask();
#if OBSW_USE_CCSDS_IP_CORE == 1
#if OBSW_ADD_CCSDS_IP_CORE == 1
pdecHandlerTask->startTask();
ccsdsHandlerTask->startTask();
#endif /* #if OBSW_USE_CCSDS_IP_CORE == 1 */
#endif /* #if OBSW_ADD_CCSDS_IP_CORE == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */

View File

@ -13,7 +13,7 @@
/** All of the following flags should be enabled for mission code */
/*******************************************************************/
#define OBSW_USE_CCSDS_IP_CORE 0
#define OBSW_ADD_CCSDS_IP_CORE 0
// Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core

View File

@ -12,8 +12,8 @@
#include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "fsfw_hal/linux/i2c/I2cCookie.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "fsfw_hal/linux/serial/SerialCookie.h"
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "linux/ObjectFactory.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h"
@ -59,7 +59,7 @@ void ObjectFactory::produce(void* args) {
ObjectFactory::produceGenericObjects();
LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);;
new UartComIF(objects::UART_COM_IF);
newSerialComIF(objects::UART_COM_IF);
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,

View File

@ -4,8 +4,8 @@
#include <cstdint>
#include "fsfw/timemanager/clockDefinitions.h"
#include "fsfw_hal/linux/serial/SerialCookie.h"
#include "fsfw_hal/linux/spi/spiDefinitions.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
/**
* SPI configuration will be contained here to let the device handlers remain independent
@ -55,7 +55,7 @@ namespace uart {
static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024;
static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400;
static constexpr UartBaudRate SCEX_BAUD = UartBaudRate::RATE_57600;
static constexpr UartBaudRate SCEX_BAUD = UartBaudRate::RATE_38400;
static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600;
static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200;
static constexpr UartBaudRate PLOC_SUPV_BAUD = UartBaudRate::RATE_115200;

View File

@ -127,11 +127,15 @@ enum commonObjects : uint32_t {
SUS_BOARD_ASS = 0x73000002,
TCS_BOARD_ASS = 0x73000003,
RW_ASS = 0x73000004,
CFDP_HANDLER = 0x73000005,
CFDP_DISTRIBUTOR = 0x73000006,
CAM_SWITCHER = 0x73000006,
ACS_SUBSYSTEM = 0x73010001,
PL_SUBSYSTEM = 0x73010002,
EIVE_SYSTEM = 0x73010000,
TM_FUNNEL = 0x73000100,
PUS_TM_FUNNEL = 0x73000101,
CFDP_TM_FUNNEL = 0x73000102,
CFDP_HANDLER = 0x73000205,
CFDP_DISTRIBUTOR = 0x73000206,
};
}

View File

@ -6,8 +6,7 @@
#include <cmath>
#include <cstdlib>
CoreControllerDummy::CoreControllerDummy(object_id_t objectId)
: ExtendedControllerBase(objectId, objects::NO_OBJECT) {}
CoreControllerDummy::CoreControllerDummy(object_id_t objectId) : ExtendedControllerBase(objectId) {}
ReturnValue_t CoreControllerDummy::initialize() {
static bool done = false;

View File

@ -1,6 +1,6 @@
#include "ImtqDummy.h"
#include <mission/devices/devicedefinitions/IMTQHandlerDefinitions.h>
#include <mission/devices/devicedefinitions/imtqHandlerDefinitions.h>
ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}

View File

@ -5,8 +5,7 @@
#include <cmath>
#include <cstdlib>
SusDummy::SusDummy()
: ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::NO_OBJECT), susSet(this) {
SusDummy::SusDummy() : ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet(this) {
ObjectManager::instance()->insert(objects::SUS_6_R_LOC_XFYBZM_PT_XF, this);
ObjectManager::instance()->insert(objects::SUS_1_N_LOC_XBYFZM_PT_XB, this);
ObjectManager::instance()->insert(objects::SUS_7_R_LOC_XBYBZM_PT_XB, this);

View File

@ -6,7 +6,7 @@
#include <cstdlib>
TemperatureSensorsDummy::TemperatureSensorsDummy()
: ExtendedControllerBase(objects::RTD_0_IC3_PLOC_HEATSPREADER, objects::NO_OBJECT),
: ExtendedControllerBase(objects::RTD_0_IC3_PLOC_HEATSPREADER),
max31865Set(this, MAX31865::MAX31865_SET_ID) {
ObjectManager::instance()->insert(objects::RTD_1_IC4_PLOC_MISSIONBOARD, this);
ObjectManager::instance()->insert(objects::RTD_2_IC5_4K_CAMERA, this);

View File

@ -38,7 +38,9 @@ void dummy::createDummies(DummyCfg cfg) {
new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy);
new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER);
new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addSyrlinksDummies) {
new SyrlinksDummy(objects::SYRLINKS_HK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
}
new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addPowerDummies) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);

View File

@ -5,6 +5,7 @@ namespace dummy {
struct DummyCfg {
bool addCoreCtrlCfg = true;
bool addPowerDummies = true;
bool addSyrlinksDummies = true;
bool addAcsBoardDummies = true;
bool addSusDummies = true;
bool addTempSensorDummies = true;

2
fsfw

@ -1 +1 @@
Subproject commit 819a2bfac49babfc6a78452bb83cd581bf902bc8
Subproject commit 39946bff58db7c5ac9016ca3156abb059560d9cb

View File

@ -110,14 +110,14 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/devices/ploc/PlocMPSoCHandler.h
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHandler.h
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/devices/ploc/PlocMPSoCHandler.h
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11704;0x2db8;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11705;0x2db9;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11706;0x2dba;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11707;0x2dbb;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11708;0x2dbc;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;mission/devices/IMTQHandler.h
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
11704;0x2db8;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
11705;0x2db9;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
11706;0x2dba;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
11707;0x2dbb;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/ImtqHandler.h
11708;0x2dbc;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;mission/devices/ImtqHandler.h
11801;0x2e19;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/devices/devicedefinitions/RwDefinitions.h
11802;0x2e1a;RESET_OCCURED;LOW;;mission/devices/devicedefinitions/RwDefinitions.h
11901;0x2e7d;BOOTING_FIRMWARE_FAILED;LOW;Failed to boot firmware;linux/devices/startracker/StarTrackerHandler.h
@ -132,12 +132,13 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12300;0x300c;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;linux/devices/ploc/PlocMemoryDumper.h
12301;0x300d;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;linux/devices/ploc/PlocMemoryDumper.h
12302;0x300e;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;linux/devices/ploc/PlocMemoryDumper.h
12401;0x3071;INVALID_TC_FRAME;HIGH;;linux/obc/PdecHandler.h
12402;0x3072;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/obc/PdecHandler.h
12403;0x3073;CARRIER_LOCK;INFO;Carrier lock detected;linux/obc/PdecHandler.h
12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/obc/PdecHandler.h
12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/obc/PdecHandler.h
12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/obc/PdecHandler.h
12401;0x3071;INVALID_TC_FRAME;HIGH;;linux/ipcore/PdecHandler.h
12402;0x3072;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;linux/ipcore/PdecHandler.h
12403;0x3073;CARRIER_LOCK;INFO;Carrier lock detected;linux/ipcore/PdecHandler.h
12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/ipcore/PdecHandler.h
12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/ipcore/PdecHandler.h
12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/ipcore/PdecHandler.h
12407;0x3077;POLL_ERROR_PDEC;MEDIUM;;linux/ipcore/PdecHandler.h
12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/devices/startracker/StrHelper.h
12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/devices/startracker/StrHelper.h
12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/devices/startracker/StrHelper.h
@ -181,15 +182,15 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12709;0x31a5;I_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12710;0x31a6;U_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12711;0x31a7;I_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/devices/PayloadPcduHandler.h
12800;0x3200;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/AcsBoardAssembly.h
12801;0x3201;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/AcsBoardAssembly.h
12802;0x3202;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/AcsBoardAssembly.h
12803;0x3203;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/AcsBoardAssembly.h
12900;0x3264;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/SusAssembly.h
12901;0x3265;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/SusAssembly.h
12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/SusAssembly.h
12903;0x3267;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/SusAssembly.h
13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;;mission/system/TcsBoardAssembly.h
12800;0x3200;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/objects/AcsBoardAssembly.h
12801;0x3201;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/objects/AcsBoardAssembly.h
12802;0x3202;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/objects/AcsBoardAssembly.h
12803;0x3203;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/objects/AcsBoardAssembly.h
12900;0x3264;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/objects/SusAssembly.h
12901;0x3265;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/objects/SusAssembly.h
12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/objects/SusAssembly.h
12903;0x3267;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/objects/SusAssembly.h
13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;;mission/system/objects/TcsBoardAssembly.h
13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;mission/devices/devicedefinitions/GPSDefinitions.h
13200;0x3390;P60_BOOT_COUNT;INFO;P60 boot count is broadcasted once at SW startup. P1: Boot count;mission/devices/P60DockHandler.h
13201;0x3391;BATT_MODE;INFO;Battery mode is broadcasted at startup. P1: Mode;mission/devices/P60DockHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
110 11604 0x2d54 MPSOC_HANDLER_CRC_FAILURE LOW PLOC reply has invalid crc linux/devices/ploc/PlocMPSoCHandler.h
111 11605 0x2d55 MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH LOW Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count linux/devices/ploc/PlocMPSoCHandler.h
112 11606 0x2d56 MPSOC_SHUTDOWN_FAILED HIGH Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor. linux/devices/ploc/PlocMPSoCHandler.h
113 11701 0x2db5 SELF_TEST_I2C_FAILURE LOW Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
114 11702 0x2db6 SELF_TEST_SPI_FAILURE LOW Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
115 11703 0x2db7 SELF_TEST_ADC_FAILURE LOW Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
116 11704 0x2db8 SELF_TEST_PWM_FAILURE LOW Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
117 11705 0x2db9 SELF_TEST_TC_FAILURE LOW Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
118 11706 0x2dba SELF_TEST_MTM_RANGE_FAILURE LOW Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
119 11707 0x2dbb SELF_TEST_COIL_CURRENT_FAILURE LOW Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
120 11708 0x2dbc INVALID_ERROR_BYTE LOW Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC. mission/devices/IMTQHandler.h mission/devices/ImtqHandler.h
121 11801 0x2e19 ERROR_STATE HIGH Reaction wheel signals an error state mission/devices/devicedefinitions/RwDefinitions.h
122 11802 0x2e1a RESET_OCCURED LOW mission/devices/devicedefinitions/RwDefinitions.h
123 11901 0x2e7d BOOTING_FIRMWARE_FAILED LOW Failed to boot firmware linux/devices/startracker/StarTrackerHandler.h
132 12300 0x300c SEND_MRAM_DUMP_FAILED LOW Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command linux/devices/ploc/PlocMemoryDumper.h
133 12301 0x300d MRAM_DUMP_FAILED LOW Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command linux/devices/ploc/PlocMemoryDumper.h
134 12302 0x300e MRAM_DUMP_FINISHED LOW MRAM dump finished successfully linux/devices/ploc/PlocMemoryDumper.h
135 12401 0x3071 INVALID_TC_FRAME HIGH linux/obc/PdecHandler.h linux/ipcore/PdecHandler.h
136 12402 0x3072 INVALID_FAR HIGH Read invalid FAR from PDEC after startup linux/obc/PdecHandler.h linux/ipcore/PdecHandler.h
137 12403 0x3073 CARRIER_LOCK INFO Carrier lock detected linux/obc/PdecHandler.h linux/ipcore/PdecHandler.h
138 12404 0x3074 BIT_LOCK_PDEC INFO Bit lock detected (data valid) linux/obc/PdecHandler.h linux/ipcore/PdecHandler.h
139 12405 0x3075 LOST_CARRIER_LOCK_PDEC INFO Lost carrier lock linux/obc/PdecHandler.h linux/ipcore/PdecHandler.h
140 12406 0x3076 LOST_BIT_LOCK_PDEC INFO Lost bit lock linux/obc/PdecHandler.h linux/ipcore/PdecHandler.h
141 12407 0x3077 POLL_ERROR_PDEC MEDIUM linux/ipcore/PdecHandler.h
142 12500 0x30d4 IMAGE_UPLOAD_FAILED LOW Image upload failed linux/devices/startracker/StrHelper.h
143 12501 0x30d5 IMAGE_DOWNLOAD_FAILED LOW Image download failed linux/devices/startracker/StrHelper.h
144 12502 0x30d6 IMAGE_UPLOAD_SUCCESSFUL LOW Uploading image to star tracker was successfulop linux/devices/startracker/StrHelper.h
182 12709 0x31a5 I_MPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
183 12710 0x31a6 U_HPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
184 12711 0x31a7 I_HPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/devices/PayloadPcduHandler.h
185 12800 0x3200 TRANSITION_OTHER_SIDE_FAILED HIGH mission/system/AcsBoardAssembly.h mission/system/objects/AcsBoardAssembly.h
186 12801 0x3201 NOT_ENOUGH_DEVICES_DUAL_MODE HIGH mission/system/AcsBoardAssembly.h mission/system/objects/AcsBoardAssembly.h
187 12802 0x3202 POWER_STATE_MACHINE_TIMEOUT MEDIUM mission/system/AcsBoardAssembly.h mission/system/objects/AcsBoardAssembly.h
188 12803 0x3203 SIDE_SWITCH_TRANSITION_NOT_ALLOWED LOW Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination mission/system/AcsBoardAssembly.h mission/system/objects/AcsBoardAssembly.h
189 12900 0x3264 TRANSITION_OTHER_SIDE_FAILED HIGH mission/system/SusAssembly.h mission/system/objects/SusAssembly.h
190 12901 0x3265 NOT_ENOUGH_DEVICES_DUAL_MODE HIGH mission/system/SusAssembly.h mission/system/objects/SusAssembly.h
191 12902 0x3266 POWER_STATE_MACHINE_TIMEOUT MEDIUM mission/system/SusAssembly.h mission/system/objects/SusAssembly.h
192 12903 0x3267 SIDE_SWITCH_TRANSITION_NOT_ALLOWED LOW Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination mission/system/SusAssembly.h mission/system/objects/SusAssembly.h
193 13000 0x32c8 CHILDREN_LOST_MODE MEDIUM mission/system/TcsBoardAssembly.h mission/system/objects/TcsBoardAssembly.h
194 13100 0x332c GPS_FIX_CHANGE INFO Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix mission/devices/devicedefinitions/GPSDefinitions.h
195 13200 0x3390 P60_BOOT_COUNT INFO P60 boot count is broadcasted once at SW startup. P1: Boot count mission/devices/P60DockHandler.h
196 13201 0x3391 BATT_MODE INFO Battery mode is broadcasted at startup. P1: Mode mission/devices/P60DockHandler.h

View File

@ -131,10 +131,14 @@
0x73000002;SUS_BOARD_ASS
0x73000003;TCS_BOARD_ASS
0x73000004;RW_ASS
0x73000005;CFDP_HANDLER
0x73000006;CFDP_DISTRIBUTOR
0x73000006;CAM_SWITCHER
0x73000100;TM_FUNNEL
0x73000101;PUS_TM_FUNNEL
0x73000102;CFDP_TM_FUNNEL
0x73000205;CFDP_HANDLER
0x73000206;CFDP_DISTRIBUTOR
0x73010000;EIVE_SYSTEM
0x73010001;ACS_SUBSYSTEM
0x73010002;PL_SUBSYSTEM
0x73500000;CCSDS_IP_CORE_BRIDGE
0xFFFFFFFF;NO_OBJECT

1 0x00005060 P60DOCK_TEST_TASK
131 0x73000002 SUS_BOARD_ASS
132 0x73000003 TCS_BOARD_ASS
133 0x73000004 RW_ASS
134 0x73000005 0x73000006 CFDP_HANDLER CAM_SWITCHER
0x73000006 CFDP_DISTRIBUTOR
135 0x73000100 TM_FUNNEL
136 0x73000101 PUS_TM_FUNNEL
137 0x73000102 CFDP_TM_FUNNEL
138 0x73000205 CFDP_HANDLER
139 0x73000206 CFDP_DISTRIBUTOR
140 0x73010000 EIVE_SYSTEM
141 0x73010001 ACS_SUBSYSTEM
142 0x73010002 PL_SUBSYSTEM
143 0x73500000 CCSDS_IP_CORE_BRIDGE
144 0xFFFFFFFF NO_OBJECT

View File

@ -9,6 +9,14 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x66a2;SADPL_MainSwitchTimeoutFailure;;162;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h
0x66a3;SADPL_SwitchingDeplSa1Failed;;163;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h
0x66a4;SADPL_SwitchingDeplSa2Failed;;164;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h
0x51a0;IMTQ_InvalidCommandCode;;160;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a1;IMTQ_ParameterMissing;;161;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a2;IMTQ_ParameterInvalid;;162;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a3;IMTQ_CcUnavailable;;163;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a4;IMTQ_InternalProcessingError;;164;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a5;IMTQ_RejectedWithoutReason;;165;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a6;IMTQ_CmdErrUnknown;;166;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x51a7;IMTQ_UnexpectedSelfTestReply;The status reply to a self test command was received but no self test command has been sent. This should normally never happen.;167;IMTQ_HANDLER;mission/devices/ImtqHandler.h
0x52b0;RWHA_SpiWriteFailure;;176;RW_HANDLER;mission/devices/RwHandler.h
0x52b1;RWHA_SpiReadFailure;Used by the spi send function to tell a failing read call;177;RW_HANDLER;mission/devices/RwHandler.h
0x52b2;RWHA_MissingStartSign;Can be used by the HDLC decoding mechanism to inform about a missing start sign 0x7E;178;RW_HANDLER;mission/devices/RwHandler.h
@ -27,14 +35,6 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x5d03;GOMS_InvalidParamSize;;3;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h
0x5d04;GOMS_InvalidPayloadSize;;4;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h
0x5d05;GOMS_UnknownReplyId;;5;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h
0x51a0;IMTQ_InvalidCommandCode;;160;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x51a1;IMTQ_ParameterMissing;;161;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x51a2;IMTQ_ParameterInvalid;;162;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x51a3;IMTQ_CcUnavailable;;163;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x51a4;IMTQ_InternalProcessingError;;164;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x51a5;IMTQ_RejectedWithoutReason;;165;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x51a6;IMTQ_CmdErrUnknown;;166;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x51a7;IMTQ_UnexpectedSelfTestReply;The status reply to a self test command was received but no self test command has been sent. This should normally never happen.;167;IMTQ_HANDLER;mission/devices/IMTQHandler.h
0x50a0;SYRLINKS_CrcFailure;;160;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h
0x50a1;SYRLINKS_UartFraminOrParityErrorAck;;161;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h
0x50a2;SYRLINKS_BadCharacterAck;;162;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h
@ -49,7 +49,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x4fa3;HEATER_InvalidSwitchNr;;163;HEATER_HANDLER;mission/devices/HeaterHandler.h
0x4fa4;HEATER_MainSwitchSetTimeout;;164;HEATER_HANDLER;mission/devices/HeaterHandler.h
0x4fa5;HEATER_CommandAlreadyWaiting;;165;HEATER_HANDLER;mission/devices/HeaterHandler.h
0x60a0;CCSDS_CommandNotImplemented;Received action message with unknown action id;160;CCSDS_HANDLER;mission/tmtc/CCSDSHandler.h
0x60a0;CCSDS_CommandNotImplemented;Received action message with unknown action id;160;CCSDS_HANDLER;mission/tmtc/CcsdsIpCoreHandler.h
0x4500;HSPI_OpeningFileFailed;;0;HAL_SPI;fsfw/src/fsfw_hal/linux/spi/SpiComIF.h
0x4501;HSPI_FullDuplexTransferFailed;;1;HAL_SPI;fsfw/src/fsfw_hal/linux/spi/SpiComIF.h
0x4502;HSPI_HalfDuplexTransferFailed;;2;HAL_SPI;fsfw/src/fsfw_hal/linux/spi/SpiComIF.h
@ -60,9 +60,9 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x4805;HGIO_GpioDuplicateDetected;;5;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h
0x4806;HGIO_GpioInitFailed;;6;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h
0x4807;HGIO_GpioGetValueFailed;;7;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h
0x4601;HURT_UartReadFailure;;1;HAL_UART;fsfw/src/fsfw_hal/linux/uart/UartComIF.h
0x4602;HURT_UartReadSizeMissmatch;;2;HAL_UART;fsfw/src/fsfw_hal/linux/uart/UartComIF.h
0x4603;HURT_UartRxBufferTooSmall;;3;HAL_UART;fsfw/src/fsfw_hal/linux/uart/UartComIF.h
0x4601;HURT_UartReadFailure;;1;HAL_UART;fsfw/src/fsfw_hal/linux/serial/SerialComIF.h
0x4602;HURT_UartReadSizeMissmatch;;2;HAL_UART;fsfw/src/fsfw_hal/linux/serial/SerialComIF.h
0x4603;HURT_UartRxBufferTooSmall;;3;HAL_UART;fsfw/src/fsfw_hal/linux/serial/SerialComIF.h
0x4400;UXOS_ExecutionFinished;Execution of the current command has finished;0;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h
0x4401;UXOS_CommandPending;Command is pending. This will also be returned if the user tries to load another command but a command is still pending;1;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h
0x4402;UXOS_BytesRead;Some bytes have been read from the executing process;2;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h
@ -101,10 +101,6 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x38a6;SGP4_SatelliteHasDecayed;;166;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h
0x38b1;SGP4_TleTooOld;;177;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h
0x38b2;SGP4_TleNotInitialized;;178;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h
0x1101;AL_Full;;1;ARRAY_LIST;fsfw/src/fsfw/container/ArrayList.h
0x1501;FM_KeyAlreadyExists;;1;FIXED_MAP;fsfw/src/fsfw/container/FixedMap.h
0x1502;FM_MapFull;;2;FIXED_MAP;fsfw/src/fsfw/container/FixedMap.h
0x1503;FM_KeyDoesNotExist;;3;FIXED_MAP;fsfw/src/fsfw/container/FixedMap.h
0x1801;FF_Full;;1;FIFO_CLASS;fsfw/src/fsfw/container/FIFOBase.h
0x1802;FF_Empty;;2;FIFO_CLASS;fsfw/src/fsfw/container/FIFOBase.h
0x1601;FMM_MapFull;;1;FIXED_MULTIMAP;fsfw/src/fsfw/container/FixedOrderedMultimap.h
@ -325,6 +321,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x360a;CFDP_InvalidPduFormat;;10;CFDP;fsfw/src/fsfw/cfdp/definitions.h
0x4300;FILS_GenericFileError;;0;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h
0x4301;FILS_GenericDirError;;1;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h
0x4302;FILS_FilesystemInactive;;2;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h
0x4303;FILS_GenericRenameError;;3;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h
0x4304;FILS_IsBusy;;4;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h
0x4305;FILS_InvalidParameters;;5;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
9 0x66a2 SADPL_MainSwitchTimeoutFailure 162 SA_DEPL_HANDLER mission/devices/SolarArrayDeploymentHandler.h
10 0x66a3 SADPL_SwitchingDeplSa1Failed 163 SA_DEPL_HANDLER mission/devices/SolarArrayDeploymentHandler.h
11 0x66a4 SADPL_SwitchingDeplSa2Failed 164 SA_DEPL_HANDLER mission/devices/SolarArrayDeploymentHandler.h
12 0x51a0 IMTQ_InvalidCommandCode 160 IMTQ_HANDLER mission/devices/ImtqHandler.h
13 0x51a1 IMTQ_ParameterMissing 161 IMTQ_HANDLER mission/devices/ImtqHandler.h
14 0x51a2 IMTQ_ParameterInvalid 162 IMTQ_HANDLER mission/devices/ImtqHandler.h
15 0x51a3 IMTQ_CcUnavailable 163 IMTQ_HANDLER mission/devices/ImtqHandler.h
16 0x51a4 IMTQ_InternalProcessingError 164 IMTQ_HANDLER mission/devices/ImtqHandler.h
17 0x51a5 IMTQ_RejectedWithoutReason 165 IMTQ_HANDLER mission/devices/ImtqHandler.h
18 0x51a6 IMTQ_CmdErrUnknown 166 IMTQ_HANDLER mission/devices/ImtqHandler.h
19 0x51a7 IMTQ_UnexpectedSelfTestReply The status reply to a self test command was received but no self test command has been sent. This should normally never happen. 167 IMTQ_HANDLER mission/devices/ImtqHandler.h
20 0x52b0 RWHA_SpiWriteFailure 176 RW_HANDLER mission/devices/RwHandler.h
21 0x52b1 RWHA_SpiReadFailure Used by the spi send function to tell a failing read call 177 RW_HANDLER mission/devices/RwHandler.h
22 0x52b2 RWHA_MissingStartSign Can be used by the HDLC decoding mechanism to inform about a missing start sign 0x7E 178 RW_HANDLER mission/devices/RwHandler.h
35 0x5d03 GOMS_InvalidParamSize 3 GOM_SPACE_HANDLER mission/devices/GomspaceDeviceHandler.h
36 0x5d04 GOMS_InvalidPayloadSize 4 GOM_SPACE_HANDLER mission/devices/GomspaceDeviceHandler.h
37 0x5d05 GOMS_UnknownReplyId 5 GOM_SPACE_HANDLER mission/devices/GomspaceDeviceHandler.h
0x51a0 IMTQ_InvalidCommandCode 160 IMTQ_HANDLER mission/devices/IMTQHandler.h
0x51a1 IMTQ_ParameterMissing 161 IMTQ_HANDLER mission/devices/IMTQHandler.h
0x51a2 IMTQ_ParameterInvalid 162 IMTQ_HANDLER mission/devices/IMTQHandler.h
0x51a3 IMTQ_CcUnavailable 163 IMTQ_HANDLER mission/devices/IMTQHandler.h
0x51a4 IMTQ_InternalProcessingError 164 IMTQ_HANDLER mission/devices/IMTQHandler.h
0x51a5 IMTQ_RejectedWithoutReason 165 IMTQ_HANDLER mission/devices/IMTQHandler.h
0x51a6 IMTQ_CmdErrUnknown 166 IMTQ_HANDLER mission/devices/IMTQHandler.h
0x51a7 IMTQ_UnexpectedSelfTestReply The status reply to a self test command was received but no self test command has been sent. This should normally never happen. 167 IMTQ_HANDLER mission/devices/IMTQHandler.h
38 0x50a0 SYRLINKS_CrcFailure 160 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h
39 0x50a1 SYRLINKS_UartFraminOrParityErrorAck 161 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h
40 0x50a2 SYRLINKS_BadCharacterAck 162 SYRLINKS_HANDLER mission/devices/SyrlinksHkHandler.h
49 0x4fa3 HEATER_InvalidSwitchNr 163 HEATER_HANDLER mission/devices/HeaterHandler.h
50 0x4fa4 HEATER_MainSwitchSetTimeout 164 HEATER_HANDLER mission/devices/HeaterHandler.h
51 0x4fa5 HEATER_CommandAlreadyWaiting 165 HEATER_HANDLER mission/devices/HeaterHandler.h
52 0x60a0 CCSDS_CommandNotImplemented Received action message with unknown action id 160 CCSDS_HANDLER mission/tmtc/CCSDSHandler.h mission/tmtc/CcsdsIpCoreHandler.h
53 0x4500 HSPI_OpeningFileFailed 0 HAL_SPI fsfw/src/fsfw_hal/linux/spi/SpiComIF.h
54 0x4501 HSPI_FullDuplexTransferFailed 1 HAL_SPI fsfw/src/fsfw_hal/linux/spi/SpiComIF.h
55 0x4502 HSPI_HalfDuplexTransferFailed 2 HAL_SPI fsfw/src/fsfw_hal/linux/spi/SpiComIF.h
60 0x4805 HGIO_GpioDuplicateDetected 5 HAL_GPIO fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h
61 0x4806 HGIO_GpioInitFailed 6 HAL_GPIO fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h
62 0x4807 HGIO_GpioGetValueFailed 7 HAL_GPIO fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h
63 0x4601 HURT_UartReadFailure 1 HAL_UART fsfw/src/fsfw_hal/linux/uart/UartComIF.h fsfw/src/fsfw_hal/linux/serial/SerialComIF.h
64 0x4602 HURT_UartReadSizeMissmatch 2 HAL_UART fsfw/src/fsfw_hal/linux/uart/UartComIF.h fsfw/src/fsfw_hal/linux/serial/SerialComIF.h
65 0x4603 HURT_UartRxBufferTooSmall 3 HAL_UART fsfw/src/fsfw_hal/linux/uart/UartComIF.h fsfw/src/fsfw_hal/linux/serial/SerialComIF.h
66 0x4400 UXOS_ExecutionFinished Execution of the current command has finished 0 LINUX_OSAL fsfw/src/fsfw_hal/linux/CommandExecutor.h
67 0x4401 UXOS_CommandPending Command is pending. This will also be returned if the user tries to load another command but a command is still pending 1 LINUX_OSAL fsfw/src/fsfw_hal/linux/CommandExecutor.h
68 0x4402 UXOS_BytesRead Some bytes have been read from the executing process 2 LINUX_OSAL fsfw/src/fsfw_hal/linux/CommandExecutor.h
101 0x38a6 SGP4_SatelliteHasDecayed 166 SGP4PROPAGATOR_CLASS fsfw/src/fsfw/coordinates/Sgp4Propagator.h
102 0x38b1 SGP4_TleTooOld 177 SGP4PROPAGATOR_CLASS fsfw/src/fsfw/coordinates/Sgp4Propagator.h
103 0x38b2 SGP4_TleNotInitialized 178 SGP4PROPAGATOR_CLASS fsfw/src/fsfw/coordinates/Sgp4Propagator.h
0x1101 AL_Full 1 ARRAY_LIST fsfw/src/fsfw/container/ArrayList.h
0x1501 FM_KeyAlreadyExists 1 FIXED_MAP fsfw/src/fsfw/container/FixedMap.h
0x1502 FM_MapFull 2 FIXED_MAP fsfw/src/fsfw/container/FixedMap.h
0x1503 FM_KeyDoesNotExist 3 FIXED_MAP fsfw/src/fsfw/container/FixedMap.h
104 0x1801 FF_Full 1 FIFO_CLASS fsfw/src/fsfw/container/FIFOBase.h
105 0x1802 FF_Empty 2 FIFO_CLASS fsfw/src/fsfw/container/FIFOBase.h
106 0x1601 FMM_MapFull 1 FIXED_MULTIMAP fsfw/src/fsfw/container/FixedOrderedMultimap.h
321 0x360a CFDP_InvalidPduFormat 10 CFDP fsfw/src/fsfw/cfdp/definitions.h
322 0x4300 FILS_GenericFileError 0 FILE_SYSTEM fsfw/src/fsfw/filesystem/HasFileSystemIF.h
323 0x4301 FILS_GenericDirError 1 FILE_SYSTEM fsfw/src/fsfw/filesystem/HasFileSystemIF.h
324 0x4302 FILS_FilesystemInactive 2 FILE_SYSTEM fsfw/src/fsfw/filesystem/HasFileSystemIF.h
325 0x4303 FILS_GenericRenameError 3 FILE_SYSTEM fsfw/src/fsfw/filesystem/HasFileSystemIF.h
326 0x4304 FILS_IsBusy 4 FILE_SYSTEM fsfw/src/fsfw/filesystem/HasFileSystemIF.h
327 0x4305 FILS_InvalidParameters 5 FILE_SYSTEM fsfw/src/fsfw/filesystem/HasFileSystemIF.h

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 233 translations.
* @brief Auto-generated event translation file. Contains 234 translations.
* @details
* Generated on: 2022-10-21 15:41:33
* Generated on: 2022-11-10 18:07:26
*/
#include "translateEvents.h"
@ -144,6 +144,7 @@ const char *CARRIER_LOCK_STRING = "CARRIER_LOCK";
const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC";
const char *LOST_CARRIER_LOCK_PDEC_STRING = "LOST_CARRIER_LOCK_PDEC";
const char *LOST_BIT_LOCK_PDEC_STRING = "LOST_BIT_LOCK_PDEC";
const char *POLL_ERROR_PDEC_STRING = "POLL_ERROR_PDEC";
const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED";
const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED";
const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL";
@ -515,6 +516,8 @@ const char *translateEvents(Event event) {
return LOST_CARRIER_LOCK_PDEC_STRING;
case (12406):
return LOST_BIT_LOCK_PDEC_STRING;
case (12407):
return POLL_ERROR_PDEC_STRING;
case (12500):
return IMAGE_UPLOAD_FAILED_STRING;
case (12501):

View File

@ -1,8 +1,8 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 140 translations.
* Generated on: 2022-10-21 15:41:33
* Contains 144 translations.
* Generated on: 2022-11-10 18:07:26
*/
#include "translateObjects.h"
@ -139,11 +139,15 @@ const char *ACS_BOARD_ASS_STRING = "ACS_BOARD_ASS";
const char *SUS_BOARD_ASS_STRING = "SUS_BOARD_ASS";
const char *TCS_BOARD_ASS_STRING = "TCS_BOARD_ASS";
const char *RW_ASS_STRING = "RW_ASS";
const char *CFDP_HANDLER_STRING = "CFDP_HANDLER";
const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR";
const char *CAM_SWITCHER_STRING = "CAM_SWITCHER";
const char *TM_FUNNEL_STRING = "TM_FUNNEL";
const char *PUS_TM_FUNNEL_STRING = "PUS_TM_FUNNEL";
const char *CFDP_TM_FUNNEL_STRING = "CFDP_TM_FUNNEL";
const char *CFDP_HANDLER_STRING = "CFDP_HANDLER";
const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR";
const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM";
const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM";
const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -415,16 +419,24 @@ const char *translateObject(object_id_t object) {
return TCS_BOARD_ASS_STRING;
case 0x73000004:
return RW_ASS_STRING;
case 0x73000005:
return CFDP_HANDLER_STRING;
case 0x73000006:
return CFDP_DISTRIBUTOR_STRING;
return CAM_SWITCHER_STRING;
case 0x73000100:
return TM_FUNNEL_STRING;
case 0x73000101:
return PUS_TM_FUNNEL_STRING;
case 0x73000102:
return CFDP_TM_FUNNEL_STRING;
case 0x73000205:
return CFDP_HANDLER_STRING;
case 0x73000206:
return CFDP_DISTRIBUTOR_STRING;
case 0x73010000:
return EIVE_SYSTEM_STRING;
case 0x73010001:
return ACS_SUBSYSTEM_STRING;
case 0x73010002:
return PL_SUBSYSTEM_STRING;
case 0x73500000:
return CCSDS_IP_CORE_BRIDGE_STRING;
case 0xFFFFFFFF:

View File

@ -4,6 +4,6 @@ add_subdirectory(callbacks)
add_subdirectory(boardtest)
add_subdirectory(devices)
add_subdirectory(fsfwconfig)
add_subdirectory(obc)
add_subdirectory(ipcore)
target_sources(${OBSW_NAME} PUBLIC ObjectFactory.cpp InitMission.cpp)

View File

@ -45,3 +45,21 @@ void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHa
printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER);
}
}
void scheduling::addMpsocSupvHandlers(PeriodicTaskIF* plTask) {
#if OBSW_ADD_PLOC_SUPERVISOR == 1
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::PERFORM_OPERATION);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_READ);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_READ);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_WRITE);
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_WRITE);
#endif
#if OBSW_ADD_PLOC_MPSOC == 1
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::PERFORM_OPERATION);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_READ);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_READ);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_WRITE);
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_WRITE);
#endif
}

View File

@ -4,4 +4,6 @@
namespace scheduling {
void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler,
PeriodicTaskIF*& scexReaderTask);
}
void addMpsocSupvHandlers(PeriodicTaskIF* task);
} // namespace scheduling

View File

@ -1,12 +1,13 @@
#include "ObjectFactory.h"
#include <fsfw/power/PowerSwitchIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include <fsfw_hal/linux/spi/SpiComIF.h>
#include <fsfw_hal/linux/spi/SpiCookie.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <linux/callbacks/gpioCallbacks.h>
#include <linux/devices/Max31865RtdLowlevelHandler.h>
#include <mission/controller/AcsController.h>
@ -15,8 +16,6 @@
#include <mission/devices/Max31865PT1000Handler.h>
#include <mission/devices/ScexDeviceHandler.h>
#include <mission/devices/SusHandler.h>
#include <mission/system/SusAssembly.h>
#include <mission/system/TcsBoardAssembly.h>
#include <mission/system/fdir/RtdFdir.h>
#include <mission/system/fdir/SusFdir.h>
@ -24,6 +23,11 @@
#include "devConf.h"
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "eive/definitions.h"
#include "mission/system/objects/SusAssembly.h"
#include "mission/system/objects/TcsBoardAssembly.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/payloadModeTree.h"
void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, std::string spiDev) {
@ -78,7 +82,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[0] =
new SusHandler(objects::SUS_0_N_LOC_XFYFZM_PT_XF, 0, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
susHandlers[0]->setParent(objects::SUS_BOARD_ASS);
susHandlers[0]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, SUS::MAX_CMD_SIZE,
@ -86,7 +89,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[1] =
new SusHandler(objects::SUS_1_N_LOC_XBYFZM_PT_XB, 1, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_1_N_LOC_XBYFZM_PT_XB);
susHandlers[1]->setParent(objects::SUS_BOARD_ASS);
susHandlers[1]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, SUS::MAX_CMD_SIZE,
@ -94,7 +96,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[2] =
new SusHandler(objects::SUS_2_N_LOC_XFYBZB_PT_YB, 2, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_2_N_LOC_XFYBZB_PT_YB);
susHandlers[2]->setParent(objects::SUS_BOARD_ASS);
susHandlers[2]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, SUS::MAX_CMD_SIZE,
@ -102,7 +103,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[3] =
new SusHandler(objects::SUS_3_N_LOC_XFYBZF_PT_YF, 3, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_3_N_LOC_XFYBZF_PT_YF);
susHandlers[3]->setParent(objects::SUS_BOARD_ASS);
susHandlers[3]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, SUS::MAX_CMD_SIZE,
@ -110,7 +110,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[4] =
new SusHandler(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, 4, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_4_N_LOC_XMYFZF_PT_ZF);
susHandlers[4]->setParent(objects::SUS_BOARD_ASS);
susHandlers[4]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, SUS::MAX_CMD_SIZE,
@ -118,7 +117,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[5] =
new SusHandler(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, 5, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
susHandlers[5]->setParent(objects::SUS_BOARD_ASS);
susHandlers[5]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE,
@ -126,7 +124,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[6] =
new SusHandler(objects::SUS_6_R_LOC_XFYBZM_PT_XF, 6, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
susHandlers[6]->setParent(objects::SUS_BOARD_ASS);
susHandlers[6]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, SUS::MAX_CMD_SIZE,
@ -134,7 +131,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[7] =
new SusHandler(objects::SUS_7_R_LOC_XBYBZM_PT_XB, 7, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_7_R_LOC_XBYBZM_PT_XB);
susHandlers[7]->setParent(objects::SUS_BOARD_ASS);
susHandlers[7]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, SUS::MAX_CMD_SIZE,
@ -142,7 +138,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[8] =
new SusHandler(objects::SUS_8_R_LOC_XBYBZB_PT_YB, 8, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_8_R_LOC_XBYBZB_PT_YB);
susHandlers[8]->setParent(objects::SUS_BOARD_ASS);
susHandlers[8]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, SUS::MAX_CMD_SIZE,
@ -150,7 +145,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[9] =
new SusHandler(objects::SUS_9_R_LOC_XBYBZB_PT_YF, 9, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_9_R_LOC_XBYBZB_PT_YF);
susHandlers[9]->setParent(objects::SUS_BOARD_ASS);
susHandlers[9]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, SUS::MAX_CMD_SIZE,
@ -158,7 +152,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[10] =
new SusHandler(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, 10, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_10_N_LOC_XMYBZF_PT_ZF);
susHandlers[10]->setParent(objects::SUS_BOARD_ASS);
susHandlers[10]->setCustomFdir(fdir);
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, SUS::MAX_CMD_SIZE,
@ -166,11 +159,24 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
susHandlers[11] =
new SusHandler(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, 11, objects::SPI_MAIN_COM_IF, spiCookie);
fdir = new SusFdir(objects::SUS_11_R_LOC_XBYMZB_PT_ZB);
susHandlers[11]->setParent(objects::SUS_BOARD_ASS);
susHandlers[11]->setCustomFdir(fdir);
std::array<object_id_t, 12> susIds = {
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
SusAssHelper susAssHelper = SusAssHelper(susIds);
auto susAss = new SusAssembly(objects::SUS_BOARD_ASS, pwrSwitcher, susAssHelper);
for (auto& sus : susHandlers) {
if (sus != nullptr) {
ReturnValue_t result = sus->connectModeTreeParent(*susAss);
if (result != returnvalue::OK) {
sif::error << "Connecting SUS " << sus->getObjectId() << " to SUS assembly failed"
<< std::endl;
}
#if OBSW_TEST_SUS == 1
sus->setStartUpImmediately();
sus->setToGoToNormalMode(true);
@ -180,17 +186,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
#endif
}
}
std::array<object_id_t, 12> susIds = {
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
SusAssHelper susAssHelper = SusAssHelper(susIds);
auto susAss =
new SusAssembly(objects::SUS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, susAssHelper);
static_cast<void>(susAss);
susAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
}
@ -292,6 +288,11 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
std::array<SpiCookie*, NUM_RTDS> rtdCookies = {};
std::array<Max31865EiveHandler*, NUM_RTDS> rtds = {};
RtdFdir* rtdFdir = nullptr;
TcsBoardHelper helper(rtdInfos);
TcsBoardAssembly* tcsBoardAss = new TcsBoardAssembly(
objects::TCS_BOARD_ASS, pwrSwitcher, pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
static_cast<void>(tcsBoardAss);
// Create special low level reader communication interface
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF, gpioComIF);
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
@ -303,7 +304,11 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
rtds[idx] =
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
rtds[idx]->setDeviceInfo(idx, rtdInfos[idx].second);
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
ReturnValue_t result = rtds[idx]->connectModeTreeParent(*tcsBoardAss);
if (result != returnvalue::OK) {
sif::error << "Connecting RTD " << static_cast<int>(idx) << " to RTD Assembly failed"
<< std::endl;
}
rtdFdir = new RtdFdir(rtdInfos[idx].first);
rtds[idx]->setCustomFdir(rtdFdir);
#if OBSW_DEBUG_RTD == 1
@ -315,11 +320,6 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
#endif
}
TcsBoardHelper helper(rtdInfos);
TcsBoardAssembly* tcsBoardAss =
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
static_cast<void>(tcsBoardAss);
#endif // OBSW_ADD_RTD_DEVICES == 1
}
@ -337,16 +337,29 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr
if (switchId) {
scexHandler->setPowerSwitcher(*pwrSwitcher, switchId.value());
}
scexHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
}
void ObjectFactory::createThermalController() {
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
new ThermalController(objects::THERMAL_CONTROLLER);
}
void ObjectFactory::createAcsController() { new AcsController(objects::ACS_CONTROLLER); }
AcsController* ObjectFactory::createAcsController(bool connectSubsystem) {
auto acsCtrl = new AcsController(objects::ACS_CONTROLLER);
if (connectSubsystem) {
acsCtrl->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
return acsCtrl;
}
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
if (result != returnvalue::OK) {
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
}
}
void ObjectFactory::addTmtcIpCoresToFunnels(CcsdsIpCoreHandler& ipCoreHandler,
PusTmFunnel& pusFunnel, CfdpTmFunnel& cfdpFunnel) {
cfdpFunnel.addDestination(ipCoreHandler, config::LIVE_TM);
pusFunnel.addDestination(ipCoreHandler, config::LIVE_TM);
}

View File

@ -4,6 +4,9 @@
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include <mission/memory/SdCardMountedIF.h>
#include <mission/tmtc/CcsdsIpCoreHandler.h>
#include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PusTmFunnel.h>
#include <optional>
#include <string>
@ -11,6 +14,7 @@
class GpioIF;
class SpiComIF;
class PowerSwitchIF;
class AcsController;
namespace ObjectFactory {
@ -26,6 +30,9 @@ void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher,
void gpioChecker(ReturnValue_t result, std::string output);
void createThermalController();
void createAcsController();
AcsController* createAcsController(bool connectSubsystem);
void addTmtcIpCoresToFunnels(CcsdsIpCoreHandler& ipCoreHandler, PusTmFunnel& pusFunnel,
CfdpTmFunnel& cfdpFunnel);
} // namespace ObjectFactory

View File

@ -3,7 +3,7 @@
#include <errno.h> // Error integer and strerror() function
#include <fcntl.h> // Contains file controls like O_RDWR
#include <fsfw/tasks/TaskFactory.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include <linux/devices/ScexDleParser.h>
#include <linux/devices/ScexHelper.h>
#include <linux/devices/ScexUartReader.h>

View File

@ -5,7 +5,7 @@
#include <fsfw/globalfunctions/DleEncoder.h>
#include <fsfw/globalfunctions/DleParser.h>
#include <fsfw/timemanager/Countdown.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include <termios.h> // Contains POSIX terminal control definitions
#include <array>

View File

@ -18,9 +18,7 @@
GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
bool debugHyperionGps)
: ExtendedControllerBase(objectId, objects::NO_OBJECT),
gpsSet(this),
debugHyperionGps(debugHyperionGps) {
: ExtendedControllerBase(objectId), gpsSet(this), debugHyperionGps(debugHyperionGps) {
timeUpdateCd.resetTimer();
}

View File

@ -50,7 +50,7 @@ ReturnValue_t Max31865RtdReader::performOperation(uint8_t operationCode) {
}
bool Max31865RtdReader::rtdIsActive(uint8_t idx) {
if (rtds[idx]->on and rtds[idx]->active and rtds[idx]->configured) {
if (rtds[idx]->on and rtds[idx]->db.active and rtds[idx]->db.configured) {
return true;
}
return false;
@ -69,7 +69,7 @@ bool Max31865RtdReader::periodicInitHandling() {
if (rtd == nullptr) {
continue;
}
if ((rtd->on or rtd->active) and not rtd->configured and rtd->cd.hasTimedOut()) {
if ((rtd->on or rtd->db.active) and not rtd->db.configured and rtd->cd.hasTimedOut()) {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != returnvalue::OK or mg.gpioResult != returnvalue::OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
@ -95,13 +95,7 @@ bool Max31865RtdReader::periodicInitHandling() {
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "clearFaultStatus");
}
rtd->configured = true;
rtd->db.configured = true;
if (rtd->active) {
rtd->db.active = true;
}
}
if (rtd->active and rtd->configured and not rtd->db.active) {
rtd->db.active = true;
}
}
@ -241,8 +235,8 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
rtdCookie->cd.setTimeout(MAX31865::WARMUP_MS);
rtdCookie->cd.resetTimer();
rtdCookie->on = true;
rtdCookie->active = false;
rtdCookie->configured = false;
rtdCookie->db.active = false;
rtdCookie->db.configured = false;
if (sendLen == 5) {
thresholdHandler(rtdCookie, sendData);
}
@ -254,10 +248,10 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
rtdCookie->cd.setTimeout(MAX31865::WARMUP_MS);
rtdCookie->cd.resetTimer();
rtdCookie->on = true;
rtdCookie->active = true;
rtdCookie->configured = false;
rtdCookie->db.active = true;
rtdCookie->db.configured = false;
} else {
rtdCookie->active = true;
rtdCookie->db.active = true;
}
if (sendLen == 5) {
thresholdHandler(rtdCookie, sendData);
@ -266,8 +260,8 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
}
case (EiveMax31855::RtdCommands::OFF): {
rtdCookie->on = false;
rtdCookie->active = false;
rtdCookie->configured = false;
rtdCookie->db.active = false;
rtdCookie->db.configured = false;
break;
}
case (EiveMax31855::RtdCommands::HIGH_TRESHOLD): {

View File

@ -23,8 +23,6 @@ struct Max31865ReaderCookie : public CookieIF {
Countdown cd = Countdown(MAX31865::WARMUP_MS);
bool on = false;
bool configured = false;
bool active = false;
bool writeLowThreshold = false;
bool writeHighThreshold = false;
uint16_t lowThreshold = 0;

View File

@ -6,7 +6,7 @@
#include <fsfw/ipc/MutexGuard.h>
#include <fsfw/tasks/SemaphoreFactory.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include <unistd.h> // write(), read(), close()
#include <cerrno> // Error integer and strerror() function
@ -58,7 +58,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
result = tryDleParsing();
}
TaskFactory::delayTask(400);
TaskFactory::delayTask(150);
} else if (bytesRead < 0) {
sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno
<< ", " << strerror(errno) << "]" << std::endl;
@ -118,10 +118,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) {
tty.c_cc[VTIME] = 0;
tty.c_cc[VMIN] = 0;
// The SCEX experiment has a fixed baud rate.
if (cfsetispeed(&tty, B38400) != 0) {
sif::warning << "ScexUartReader::initializeInterface: Setting baud rate failed" << std::endl;
}
uart::setBaudrate(tty, uartCookie->getBaudrate());
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error ["
<< errno << ", " << strerror(errno) << std::endl;
@ -216,6 +213,10 @@ ReturnValue_t ScexUartReader::tryDleParsing() {
void ScexUartReader::reset() {
lock->lockMutex();
state = States::FINISH;
ipcRingBuf.clear();
while (not ipcQueue.empty()) {
ipcQueue.pop();
}
lock->unlockMutex();
}

View File

@ -31,7 +31,7 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
if (result != returnvalue::OK) {
return result;
}
uartComIf = dynamic_cast<UartComIF*>(communicationInterface);
uartComIf = dynamic_cast<SerialComIF*>(communicationInterface);
if (uartComIf == nullptr) {
sif::warning << "PlocMPSoCHandler::initialize: Invalid uart com if" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;

View File

@ -10,7 +10,7 @@
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
@ -123,7 +123,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
*/
DeviceCommandId_t nextReplyId = mpsoc::NONE;
UartComIF* uartComIf = nullptr;
SerialComIF* uartComIf = nullptr;
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
Gpio uartIsolatorSwitch;

View File

@ -57,7 +57,7 @@ ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
}
ReturnValue_t PlocMPSoCHelper::setComIF(DeviceCommunicationIF* communicationInterface_) {
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
uartComIF = dynamic_cast<SerialComIF*>(communicationInterface_);
if (uartComIF == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid uart com if" << std::endl;
return returnvalue::FAILED;

View File

@ -9,7 +9,7 @@
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/SdCardManager.h"
@ -136,7 +136,7 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
* Communication interface of MPSoC responsible for low level access. Must be set by the
* MPSoC Handler.
*/
UartComIF* uartComIF = nullptr;
SerialComIF* uartComIF = nullptr;
// Communication cookie. Must be set by the MPSoC Handler
CookieIF* comCookie = nullptr;
// Sequence count, must be set by Ploc MPSoC Handler

View File

@ -46,7 +46,7 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
if (result != returnvalue::OK) {
return result;
}
uartComIf = dynamic_cast<UartComIF*>(communicationInterface);
uartComIf = dynamic_cast<SerialComIF*>(communicationInterface);
if (uartComIf == nullptr) {
sif::warning << "PlocSupervisorHandler::initialize: Invalid uart com if" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
@ -1917,6 +1917,11 @@ ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
}
ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
#ifdef XIPHOS_Q7S
if (not sdcMan->getActiveSdCard()) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
#endif
ReturnValue_t result = returnvalue::OK;
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);

View File

@ -9,7 +9,7 @@
#include "fsfw/timemanager/Countdown.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
@ -110,7 +110,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
*/
DeviceCommandId_t nextReplyId = supv::NONE;
UartComIF* uartComIf = nullptr;
SerialComIF* uartComIf = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
Gpio uartIsolatorSwitch;

View File

@ -1,6 +1,7 @@
#include "PlocSupvHelper.h"
#include <etl/crc16_ccitt.h>
#include <fsfw/filesystem/HasFileSystemIF.h>
#include <cmath>
#include <filesystem>
@ -94,7 +95,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
}
}
ReturnValue_t PlocSupvHelper::setComIF(UartComIF* uartComIF_) {
ReturnValue_t PlocSupvHelper::setComIF(SerialComIF* uartComIF_) {
if (uartComIF_ == nullptr) {
sif::warning << "PlocSupvHelper::initialize: Provided invalid uart com if" << std::endl;
return returnvalue::FAILED;
@ -748,6 +749,11 @@ uint32_t PlocSupvHelper::getFileSize(std::string filename) {
ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reader) {
ReturnValue_t result = returnvalue::OK;
#ifdef XIPHOS_Q7S
if (not sdcMan->getActiveSdCard()) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
#endif
std::string filename = Filenaming::generateAbsoluteFilename(
eventBufferReq.path, eventBufferReq.filename, timestamping);
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);

View File

@ -9,7 +9,7 @@
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#ifdef XIPHOS_Q7S
@ -104,7 +104,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF {
ReturnValue_t initialize() override;
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t setComIF(UartComIF* uartComfIF_);
ReturnValue_t setComIF(SerialComIF* uartComfIF_);
void setComCookie(CookieIF* comCookie_);
/**
@ -209,7 +209,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF {
/**
* Communication interface responsible for data transactions between OBC and Supervisor.
*/
UartComIF* uartComIF = nullptr;
SerialComIF* uartComIF = nullptr;
// Communication cookie. Must be set by the supervisor Handler
CookieIF* comCookie = nullptr;

View File

@ -240,13 +240,12 @@ void StarTrackerHandler::doStartUp() {
// the device handler's submode to the star tracker's mode
return;
case StartupState::DONE:
submode = SUBMODE_BOOTLOADER;
startupState = StartupState::IDLE;
break;
default:
return;
}
setMode(_MODE_TO_ON);
setMode(_MODE_TO_ON, SUBMODE_BOOTLOADER);
}
void StarTrackerHandler::doShutDown() {
@ -654,7 +653,7 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
}
ReturnValue_t StarTrackerHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
if (this->mode == MODE_NORMAL && mode == MODE_ON) {
if (getMode() == MODE_NORMAL && mode == MODE_ON) {
return TRANS_NOT_ALLOWED;
}
switch (mode) {
@ -678,7 +677,7 @@ ReturnValue_t StarTrackerHandler::isModeCombinationValid(Mode_t mode, Submode_t
}
void StarTrackerHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
switch (mode) {
switch (getMode()) {
case _MODE_TO_ON:
doOnTransition(subModeFrom);
break;
@ -698,17 +697,18 @@ void StarTrackerHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
}
void StarTrackerHandler::doOnTransition(Submode_t subModeFrom) {
if (submode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_FIRMWARE) {
uint8_t dhbSubmode = getSubmode();
if (dhbSubmode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_FIRMWARE) {
bootBootloader();
} else if (submode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_FIRMWARE) {
} else if (dhbSubmode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_FIRMWARE) {
setMode(MODE_ON);
} else if (submode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_BOOTLOADER) {
} else if (dhbSubmode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_BOOTLOADER) {
bootFirmware(MODE_ON);
} else if (submode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_BOOTLOADER) {
} else if (dhbSubmode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_BOOTLOADER) {
setMode(MODE_ON);
} else if (submode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_NONE) {
} else if (dhbSubmode == SUBMODE_BOOTLOADER && subModeFrom == SUBMODE_NONE) {
setMode(MODE_ON);
} else if (submode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_NONE) {
} else if (dhbSubmode == SUBMODE_FIRMWARE && subModeFrom == SUBMODE_NONE) {
setMode(MODE_ON);
}
}
@ -2067,13 +2067,13 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
case startracker::REQ_SUBSCRIPTION:
case startracker::REQ_LOG_SUBSCRIPTION:
case startracker::REQ_DEBUG_CAMERA:
if (not(mode == MODE_ON && submode == startracker::Program::FIRMWARE)) {
if (not(getMode() == MODE_ON && getSubmode() == startracker::Program::FIRMWARE)) {
return STARTRACKER_RUNNING_BOOTLOADER;
}
break;
case startracker::FIRMWARE_UPDATE:
case startracker::FLASH_READ:
if (not(mode == MODE_ON && submode == startracker::Program::BOOTLOADER)) {
if (not(getMode() == MODE_ON && getSubmode() == startracker::Program::BOOTLOADER)) {
return STARTRACKER_RUNNING_FIRMWARE;
}
break;

View File

@ -72,7 +72,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
/**
* @brief Overwritten here to always read all available data from the UartComIF.
* @brief Overwritten here to always read all available data from theSerialComIF.
*/
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
virtual ReturnValue_t doSendReadHook() override;

View File

@ -1,5 +1,7 @@
#include "StrHelper.h"
#include <fsfw/filesystem/HasFileSystemIF.h>
#include <filesystem>
#include <fstream>
@ -83,7 +85,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
}
ReturnValue_t StrHelper::setComIF(DeviceCommunicationIF* communicationInterface_) {
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
uartComIF = dynamic_cast<SerialComIF*>(communicationInterface_);
if (uartComIF == nullptr) {
sif::warning << "StrHelper::initialize: Invalid uart com if" << std::endl;
return returnvalue::FAILED;
@ -176,6 +178,11 @@ void StrHelper::disableTimestamping() { timestamping = false; }
void StrHelper::enableTimestamping() { timestamping = true; }
ReturnValue_t StrHelper::performImageDownload() {
#ifdef XIPHOS_Q7S
if (not sdcMan->getActiveSdCard()) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
#endif
ReturnValue_t result;
#if OBSW_DEBUG_STARTRACKER == 1
ProgressPrinter progressPrinter("Image download", ImageDownload::LAST_POSITION);
@ -244,6 +251,11 @@ ReturnValue_t StrHelper::performImageUpload() {
uint32_t imageSize = 0;
struct UploadActionRequest uploadReq;
uploadReq.position = 0;
#ifdef XIPHOS_Q7S
if (not sdcMan->getActiveSdCard()) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
#endif
std::memset(&uploadReq.data, 0, sizeof(uploadReq.data));
if (not std::filesystem::exists(uploadImage.uploadFile)) {
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
@ -315,6 +327,11 @@ ReturnValue_t StrHelper::performFirmwareUpdate() {
}
ReturnValue_t StrHelper::performFlashWrite() {
#ifdef XIPHOS_Q7S
if (not sdcMan->getActiveSdCard()) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
#endif
ReturnValue_t result = returnvalue::OK;
uint32_t size = 0;
uint32_t bytesWritten = 0;
@ -394,6 +411,11 @@ ReturnValue_t StrHelper::performFlashWrite() {
}
ReturnValue_t StrHelper::performFlashRead() {
#ifdef XIPHOS_Q7S
if (not sdcMan->getActiveSdCard()) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
#endif
ReturnValue_t result;
#if OBSW_DEBUG_STARTRACKER == 1
ProgressPrinter progressPrinter("Flash read", flashRead.size);

View File

@ -15,7 +15,7 @@
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
extern "C" {
#include "thirdparty/arcsec_star_tracker/client/generated/actionreq.h"
@ -255,7 +255,7 @@ class StrHelper : public SystemObject, public ExecutableObjectIF {
* UART communication object responsible for low level access of star tracker
* Must be set by star tracker handler
*/
UartComIF* uartComIF = nullptr;
SerialComIF* uartComIF = nullptr;
// Communication cookie. Must be set by the star tracker handler
CookieIF* comCookie = nullptr;

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 233 translations.
* @brief Auto-generated event translation file. Contains 234 translations.
* @details
* Generated on: 2022-10-21 15:41:33
* Generated on: 2022-11-10 18:07:26
*/
#include "translateEvents.h"
@ -144,6 +144,7 @@ const char *CARRIER_LOCK_STRING = "CARRIER_LOCK";
const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC";
const char *LOST_CARRIER_LOCK_PDEC_STRING = "LOST_CARRIER_LOCK_PDEC";
const char *LOST_BIT_LOCK_PDEC_STRING = "LOST_BIT_LOCK_PDEC";
const char *POLL_ERROR_PDEC_STRING = "POLL_ERROR_PDEC";
const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED";
const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED";
const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL";
@ -515,6 +516,8 @@ const char *translateEvents(Event event) {
return LOST_CARRIER_LOCK_PDEC_STRING;
case (12406):
return LOST_BIT_LOCK_PDEC_STRING;
case (12407):
return POLL_ERROR_PDEC_STRING;
case (12500):
return IMAGE_UPLOAD_FAILED_STRING;
case (12501):

View File

@ -1,8 +1,8 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 140 translations.
* Generated on: 2022-10-21 15:41:33
* Contains 144 translations.
* Generated on: 2022-11-10 18:07:26
*/
#include "translateObjects.h"
@ -139,11 +139,15 @@ const char *ACS_BOARD_ASS_STRING = "ACS_BOARD_ASS";
const char *SUS_BOARD_ASS_STRING = "SUS_BOARD_ASS";
const char *TCS_BOARD_ASS_STRING = "TCS_BOARD_ASS";
const char *RW_ASS_STRING = "RW_ASS";
const char *CFDP_HANDLER_STRING = "CFDP_HANDLER";
const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR";
const char *CAM_SWITCHER_STRING = "CAM_SWITCHER";
const char *TM_FUNNEL_STRING = "TM_FUNNEL";
const char *PUS_TM_FUNNEL_STRING = "PUS_TM_FUNNEL";
const char *CFDP_TM_FUNNEL_STRING = "CFDP_TM_FUNNEL";
const char *CFDP_HANDLER_STRING = "CFDP_HANDLER";
const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR";
const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM";
const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM";
const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -415,16 +419,24 @@ const char *translateObject(object_id_t object) {
return TCS_BOARD_ASS_STRING;
case 0x73000004:
return RW_ASS_STRING;
case 0x73000005:
return CFDP_HANDLER_STRING;
case 0x73000006:
return CFDP_DISTRIBUTOR_STRING;
return CAM_SWITCHER_STRING;
case 0x73000100:
return TM_FUNNEL_STRING;
case 0x73000101:
return PUS_TM_FUNNEL_STRING;
case 0x73000102:
return CFDP_TM_FUNNEL_STRING;
case 0x73000205:
return CFDP_HANDLER_STRING;
case 0x73000206:
return CFDP_DISTRIBUTOR_STRING;
case 0x73010000:
return EIVE_SYSTEM_STRING;
case 0x73010001:
return ACS_SUBSYSTEM_STRING;
case 0x73010002:
return PL_SUBSYSTEM_STRING;
case 0x73500000:
return CCSDS_IP_CORE_BRIDGE_STRING;
case 0xFFFFFFFF:

View File

@ -430,11 +430,21 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
#if OBSW_ADD_MGT == 1
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
@ -450,32 +460,9 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs();
bool uartPstEmpty = true;
#if OBSW_ADD_PLOC_MPSOC == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
thisSequence->addSlot(objects::PLOC_MEMORY_DUMPER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
#if OBSW_ADD_PLOC_SUPERVISOR == 1
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
static_cast<void>(length);
#if OBSW_ADD_SYRLINKS == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
@ -485,22 +472,13 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
#endif
#if OBSW_ADD_STAR_TRACKER == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::STAR_TRACKER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::STAR_TRACKER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::STAR_TRACKER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::STAR_TRACKER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
static_cast<void>(length);
if (uartPstEmpty) {
return returnvalue::OK;
}
if (thisSequence->checkSequence() != returnvalue::OK) {
sif::error << "UART PST initialization failed" << std::endl;
return returnvalue::FAILED;
}
return returnvalue::OK;
return thisSequence->checkSequence();
}
ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {

View File

@ -4,7 +4,7 @@
#include "fsfw_hal/linux/uio/UioMapper.h"
AxiPtmeConfig::AxiPtmeConfig(object_id_t objectId, std::string axiUio, int mapNum)
: SystemObject(objectId), axiUio(axiUio), mapNum(mapNum) {
: SystemObject(objectId), axiUio(std::move(axiUio)), mapNum(mapNum) {
mutex = MutexFactory::instance()->createMutex();
if (mutex == nullptr) {
sif::warning << "Failed to create mutex" << std::endl;

View File

@ -1,5 +1,5 @@
#include <fsfw_hal/linux/uio/UioMapper.h>
#include <linux/obc/PapbVcInterface.h>
#include <linux/ipcore/PapbVcInterface.h>
#include "fsfw/serviceinterface/ServiceInterface.h"
@ -8,7 +8,7 @@ PapbVcInterface::PapbVcInterface(LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId,
: gpioComIF(gpioComIF),
papbBusyId(papbBusyId),
papbEmptyId(papbEmptyId),
uioFile(uioFile),
uioFile(std::move(uioFile)),
mapNum(mapNum) {}
PapbVcInterface::~PapbVcInterface() {}

View File

@ -6,7 +6,7 @@
#include "OBSWConfig.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "linux/obc/VcInterfaceIF.h"
#include "linux/ipcore/VcInterfaceIF.h"
/**
* @brief This class handles the transmission of data to a virtual channel of the PTME IP Core

View File

@ -31,3 +31,8 @@ uint32_t PdecConfig::getConfigWord(uint8_t wordNo) {
}
return configWords[wordNo];
}
uint32_t PdecConfig::getImrReg() {
return static_cast<uint32_t>(enableNewFarIrq << 2) |
static_cast<uint32_t>(enableTcAbortIrq << 1) | static_cast<uint32_t>(enableTcNewIrq);
}

View File

@ -23,6 +23,7 @@ class PdecConfig {
* @brief Returns the configuration word by specifying the position.
*/
uint32_t getConfigWord(uint8_t wordNo);
uint32_t getImrReg();
private:
// TC transfer frame configuration parameters
@ -45,6 +46,9 @@ class PdecConfig {
static const uint8_t CONFIG_WORDS_NUM = 2;
uint32_t configWords[CONFIG_WORDS_NUM];
bool enableTcNewIrq = true;
bool enableTcAbortIrq = true;
bool enableNewFarIrq = true;
void initialize();
};

View File

@ -1,7 +1,9 @@
#include "PdecHandler.h"
#include <fcntl.h>
#include <poll.h>
#include <sys/mman.h>
#include <unistd.h>
#include <cstring>
#include <sstream>
@ -12,18 +14,21 @@
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tmtcservices/TmTcMessage.h"
#include "fsfw_hal/linux/uio/UioMapper.h"
#include "pdec.h"
using namespace pdec;
// If this is ever shared, protect it with a mutex!
uint32_t PdecHandler::CURRENT_FAR = 0;
PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId,
LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioConfigMemory,
std::string uioRamMemory, std::string uioRegisters)
LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, UioNames names)
: SystemObject(objectId),
tcDestinationId(tcDestinationId),
gpioComIF(gpioComIF),
pdecReset(pdecReset),
uioConfigMemory(uioConfigMemory),
uioRamMemory(uioRamMemory),
uioRegisters(uioRegisters),
actionHelper(this, nullptr) {
actionHelper(this, nullptr),
uioNames(names) {
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
commandQueue = QueueFactory::instance()->createMessageQueue(
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
@ -47,29 +52,39 @@ ReturnValue_t PdecHandler::initialize() {
ReturnValue_t result = returnvalue::OK;
UioMapper regMapper(uioRegisters);
UioMapper regMapper(uioNames.registers);
result = regMapper.getMappedAdress(&registerBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
UioMapper configMemMapper(uioConfigMemory);
UioMapper configMemMapper(uioNames.configMemory);
result = configMemMapper.getMappedAdress(&memoryBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
UioMapper ramMapper(uioRamMemory);
UioMapper ramMapper(uioNames.ramMemory);
result = ramMapper.getMappedAdress(&ramBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
writePdecConfig();
if (OP_MODE == Modes::IRQ and uioNames.irq == nullptr) {
sif::error << "Can not use IRQ mode if IRQ UIO name is invalid" << std::endl;
return returnvalue::FAILED;
}
PdecConfig pdecConfig;
writePdecConfigDuringReset(pdecConfig);
result = releasePdec();
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
// This configuration must be done while the PDEC is not held in reset.
if (OP_MODE == Modes::IRQ) {
// Configure interrupt mask register to enable interrupts
*(registerBaseAddress + PDEC_IMR_OFFSET) = pdecConfig.getImrReg();
}
result = actionHelper.initialize(commandQueue);
if (result != returnvalue::OK) {
return result;
@ -78,59 +93,16 @@ ReturnValue_t PdecHandler::initialize() {
return returnvalue::OK;
}
MessageQueueId_t PdecHandler::getCommandQueue() const { return commandQueue->getId(); }
void PdecHandler::writePdecConfig() {
PdecConfig pdecConfig;
*(memoryBaseAddress + FRAME_HEADER_OFFSET) = pdecConfig.getConfigWord(0);
*(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = pdecConfig.getConfigWord(1);
// Configure all MAP IDs as invalid
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx + 1 / 4) =
NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION;
}
// All TCs with MAP ID 7 will be routed to the PM module (can then be read from memory)
uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + 1) =
(NO_DESTINATION << 24) | (NO_DESTINATION << 16) | (NO_DESTINATION << 8) | routeToPm;
// Write map id clock frequencies
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
*(memoryBaseAddress + MAP_CLK_FREQ_OFFSET + idx / 4) =
MAP_CLK_FREQ << 24 | MAP_CLK_FREQ << 16 | MAP_CLK_FREQ << 8 | MAP_CLK_FREQ;
}
}
ReturnValue_t PdecHandler::resetFarStatFlag() {
uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET);
if (pdecFar != FAR_RESET) {
sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value."
<< " Read value: 0x" << std::hex << static_cast<unsigned int>(pdecFar)
<< std::endl;
return returnvalue::FAILED;
}
#if OBSW_DEBUG_PDEC_HANDLER == 1
sif::debug << "PdecHandler::resetFarStatFlag: read FAR with value: 0x" << std::hex << pdecFar
<< std::endl;
#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */
return returnvalue::OK;
}
ReturnValue_t PdecHandler::releasePdec() {
ReturnValue_t result = returnvalue::OK;
result = gpioComIF->pullHigh(pdecReset);
if (result != returnvalue::OK) {
sif::error << "PdecHandler::releasePdec: Failed to release PDEC reset signal" << std::endl;
}
return result;
}
ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
ReturnValue_t result = returnvalue::OK;
if (OP_MODE == Modes::POLLED) {
return polledOperation();
} else if (OP_MODE == Modes::IRQ) {
return irqOperation();
}
}
ReturnValue_t PdecHandler::polledOperation() {
ReturnValue_t result = returnvalue::OK;
readCommandQueue();
switch (state) {
@ -153,13 +125,94 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
case State::WAIT_FOR_RECOVERY:
break;
default:
sif::debug << "PdecHandler::performOperation: Invalid state" << std::endl;
sif::error << "PdecHandler::performOperation: Invalid state" << std::endl;
break;
}
return returnvalue::OK;
}
ReturnValue_t PdecHandler::irqOperation() {
ReturnValue_t result = returnvalue::OK;
int fd = open(uioNames.irq, O_RDWR);
if (fd < 0) {
sif::error << "PdecHandler::irqOperation: Opening UIO IRQ file" << uioNames.irq << " failed"
<< std::endl;
return returnvalue::FAILED;
}
struct pollfd fds = {.fd = fd, .events = POLLIN, .revents = 0};
// Used to unmask IRQ
uint32_t info = 1;
ssize_t nb = 0;
int ret = 0;
// Clear interrupts with dummy read before unmasking the interrupt
ret = *(registerBaseAddress + PDEC_PIR_OFFSET);
while (true) {
readCommandQueue();
switch (state) {
case State::INIT:
resetFarStatFlag();
if (result != returnvalue::OK) {
// Requires reconfiguration and reinitialization of PDEC
triggerEvent(INVALID_FAR);
state = State::WAIT_FOR_RECOVERY;
return result;
}
state = State::RUNNING;
break;
case State::RUNNING: {
nb = write(fd, &info, sizeof(info));
if (nb != static_cast<ssize_t>(sizeof(info))) {
sif::error << "PdecHandler::irqOperation: Unmasking IRQ failed" << std::endl;
close(fd);
}
ret = poll(&fds, 1, IRQ_TIMEOUT_MS);
if (ret == 0) {
// No TCs for timeout period
checkLocks();
lockCheckCd.resetTimer();
} else if (ret >= 1) {
nb = read(fd, &info, sizeof(info));
if (nb == static_cast<ssize_t>(sizeof(info))) {
uint32_t pisr = *(registerBaseAddress + PDEC_PISR_OFFSET);
if ((pisr & TC_NEW_MASK) == TC_NEW_MASK) {
// handle TC
handleNewTc();
}
if ((pisr & TC_ABORT_MASK) == TC_ABORT_MASK) {
tcAbortCounter += 1;
}
if ((pisr & NEW_FAR_MASK) == NEW_FAR_MASK) {
// Read FAR here
CURRENT_FAR = readFar();
}
if (lockCheckCd.hasTimedOut()) {
checkLocks();
lockCheckCd.resetTimer();
}
// Clear interrupts with dummy read
ret = *(registerBaseAddress + PDEC_PIR_OFFSET);
}
} else {
sif::error << "PdecHandler::irqOperation: Poll error with errno " << errno << ": "
<< strerror(errno) << std::endl;
triggerEvent(POLL_ERROR_PDEC, errno);
}
break;
}
case State::WAIT_FOR_RECOVERY:
break;
default:
sif::error << "PdecHandler::performOperation: Invalid state" << std::endl;
break;
}
}
return returnvalue::OK;
}
void PdecHandler::readCommandQueue(void) {
CommandMessage commandMessage;
ReturnValue_t result = returnvalue::FAILED;
@ -177,13 +230,65 @@ void PdecHandler::readCommandQueue(void) {
}
}
MessageQueueId_t PdecHandler::getCommandQueue() const { return commandQueue->getId(); }
void PdecHandler::writePdecConfigDuringReset(PdecConfig& pdecConfig) {
*(memoryBaseAddress + FRAME_HEADER_OFFSET) = pdecConfig.getConfigWord(0);
*(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = pdecConfig.getConfigWord(1);
// Configure all MAP IDs as invalid
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) =
NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION;
}
// All TCs with MAP ID 7 will be routed to the PM module (can then be read from memory)
uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + 1) =
(NO_DESTINATION << 24) | (NO_DESTINATION << 16) | (NO_DESTINATION << 8) | routeToPm;
// Write map id clock frequencies
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
*(memoryBaseAddress + MAP_CLK_FREQ_OFFSET + idx / 4) =
MAP_CLK_FREQ << 24 | MAP_CLK_FREQ << 16 | MAP_CLK_FREQ << 8 | MAP_CLK_FREQ;
}
}
ReturnValue_t PdecHandler::resetFarStatFlag() {
uint32_t pdecFar = readFar();
if ((pdecFar & FAR_STAT_MASK) != 0) {
sif::warning << "PdecHandler::resetFarStatFlag: FAR register stat bit is not 0."
<< " Read value for FAR: 0x" << std::hex << static_cast<unsigned int>(pdecFar)
<< std::endl;
CURRENT_FAR = pdecFar;
return returnvalue::FAILED;
}
#if OBSW_DEBUG_PDEC_HANDLER == 1
sif::debug << "PdecHandler::resetFarStatFlag: read FAR with value: 0x" << std::hex << pdecFar
<< std::endl;
#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */
CURRENT_FAR = pdecFar;
return returnvalue::OK;
}
ReturnValue_t PdecHandler::releasePdec() {
ReturnValue_t result = returnvalue::OK;
result = gpioComIF->pullHigh(pdecReset);
if (result != returnvalue::OK) {
sif::error << "PdecHandler::releasePdec: Failed to release PDEC reset signal" << std::endl;
}
return result;
}
bool PdecHandler::newTcReceived() {
uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET);
uint32_t pdecFar = readFar();
if (pdecFar >> STAT_POSITION != NEW_FAR_RECEIVED) {
CURRENT_FAR = pdecFar;
return false;
}
if (!checkFrameAna(pdecFar)) {
CURRENT_FAR = pdecFar;
return false;
}
return true;
@ -331,7 +436,6 @@ void PdecHandler::handleNewTc() {
printTC(tcLength);
#endif /* OBSW_DEBUG_PDEC_HANDLER */
#if OBSW_TC_FROM_PDEC == 1
store_address_t storeId;
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
if (result != returnvalue::OK) {
@ -349,7 +453,6 @@ void PdecHandler::handleNewTc() {
tcStore->deleteData(storeId);
return;
}
#endif /* OBSW_TC_FROM_PDEC == 1 */
return;
}
@ -500,6 +603,8 @@ void PdecHandler::printPdecMon() {
sif::info << std::setw(30) << std::left << "Start sequence lock: " << lock << std::endl;
}
uint32_t PdecHandler::readFar() { return *(registerBaseAddress + PDEC_FAR_OFFSET); }
std::string PdecHandler::getMonStatusString(uint32_t status) {
switch (status) {
case TC_CHANNEL_INACTIVE:

View File

@ -1,6 +1,8 @@
#ifndef LINUX_OBC_PDECHANDLER_H_
#define LINUX_OBC_PDECHANDLER_H_
#include <fsfw/timemanager/Countdown.h>
#include "OBSWConfig.h"
#include "PdecConfig.h"
#include "fsfw/action/ActionHelper.h"
@ -13,6 +15,13 @@
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
struct UioNames {
const char* configMemory;
const char* ramMemory;
const char* registers;
const char* irq;
};
/**
* @brief This class controls the PDEC IP Core implemented in the programmable logic of the
* Zynq-7020. All registers and memories of the PDEC IP Core are accessed via UIO
@ -33,6 +42,10 @@
*/
class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasActionsIF {
public:
static constexpr dur_millis_t IRQ_TIMEOUT_MS = 500;
enum class Modes { POLLED, IRQ };
/**
* @brief Constructor
* @param objectId Object ID of PDEC handler system object
@ -43,8 +56,7 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc
* @param uioregsiters String of uio device file same mapped to the PDEC register space
*/
PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF,
gpioId_t pdecReset, std::string uioConfigMemory, std::string uioRamMemory,
std::string uioRegisters);
gpioId_t pdecReset, UioNames names);
virtual ~PdecHandler();
@ -74,10 +86,13 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc
static const Event LOST_CARRIER_LOCK_PDEC = MAKE_EVENT(5, severity::INFO);
//! [EXPORT] : [COMMENT] Lost bit lock
static const Event LOST_BIT_LOCK_PDEC = MAKE_EVENT(6, severity::INFO);
static constexpr Event POLL_ERROR_PDEC = event::makeEvent(SUBSYSTEM_ID, 7, severity::MEDIUM);
private:
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
static constexpr Modes OP_MODE = Modes::IRQ;
static const ReturnValue_t ABANDONED_CLTU = MAKE_RETURN_CODE(0xA0);
static const ReturnValue_t FRAME_DIRTY = MAKE_RETURN_CODE(0xA1);
static const ReturnValue_t FRAME_ILLEGAL_ONE_REASON = MAKE_RETURN_CODE(0xA2);
@ -112,48 +127,6 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc
// Print PDEC monitor register
static const ActionId_t PRINT_PDEC_MON = 1;
static const uint8_t STAT_POSITION = 31;
static const uint8_t FRAME_ANA_POSITION = 28;
static const uint8_t IREASON_POSITION = 25;
static const uint8_t NEW_FAR_RECEIVED = 0;
static const uint32_t FRAME_ANA_MASK = 0x70000000;
static const uint32_t IREASON_MASK = 0x0E000000;
static const uint32_t TC_CHANNEL_INACTIVE = 0x0;
static const uint32_t TC_CHANNEL_ACTIVE = 0x1;
static const uint32_t TC_CHANNEL_TIMEDOUT = 0x2;
static const uint32_t TC0_STATUS_MASK = 0x3;
static const uint32_t TC1_STATUS_MASK = 0xC;
static const uint32_t TC2_STATUS_MASK = 0x300;
static const uint32_t TC3_STATUS_MASK = 0xC00;
static const uint32_t TC4_STATUS_MASK = 0x30000;
static const uint32_t TC5_STATUS_MASK = 0xc00000;
// Lock register set to 1 when start sequence has been found (CLTU is beeing processed)
static const uint32_t LOCK_MASK = 0xc00000;
static const uint32_t TC0_STATUS_POS = 0;
static const uint32_t TC1_STATUS_POS = 2;
static const uint32_t TC2_STATUS_POS = 4;
static const uint32_t TC3_STATUS_POS = 6;
static const uint32_t TC4_STATUS_POS = 8;
static const uint32_t TC5_STATUS_POS = 10;
// Lock register set to 1 when start sequence has been found (CLTU is beeing processed)
static const uint32_t LOCK_POS = 12;
/**
* UIO is 4 byte aligned. Thus offset is calculated with "true offset" / 4
* Example: PDEC_FAR = 0x2840 => Offset in virtual address space is 0xA10
*/
static const uint32_t PDEC_FAR_OFFSET = 0xA10;
static const uint32_t PDEC_CLCW_OFFSET = 0xA12;
static const uint32_t PDEC_BFREE_OFFSET = 0xA24;
static const uint32_t PDEC_BPTR_OFFSET = 0xA25;
static const uint32_t PDEC_SLEN_OFFSET = 0xA26;
static const uint32_t PDEC_MON_OFFSET = 0xA27;
#ifdef TE0720_1CFA
static const int CONFIG_MEMORY_MAP_SIZE = 0x400;
static const int RAM_MAP_SIZE = 0x4000;
@ -227,16 +200,69 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc
enum class State : uint8_t { INIT, RUNNING, WAIT_FOR_RECOVERY };
static uint32_t CURRENT_FAR;
Countdown lockCheckCd = Countdown(IRQ_TIMEOUT_MS);
object_id_t tcDestinationId;
AcceptsTelecommandsIF* tcDestination = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
/**
* Reset signal is required to hold PDEC in reset state until the configuration has been
* written to the appropriate memory space.
* Can also be used to reboot PDEC in case of erros.
*/
gpioId_t pdecReset = gpio::NO_GPIO;
uint32_t tcAbortCounter = 0;
ActionHelper actionHelper;
StorageManagerIF* tcStore = nullptr;
MessageQueueIF* commandQueue = nullptr;
State state = State::INIT;
/**
* Pointer pointing to base address of the PDEC memory space.
* This address is equivalent with the base address of the section named configuration area in
* the PDEC datasheet.
*/
uint32_t* memoryBaseAddress = nullptr;
uint32_t* ramBaseAddress = nullptr;
// Pointer pointing to base address of register space
uint32_t* registerBaseAddress = nullptr;
uint8_t tcSegment[TC_SEGMENT_LEN];
// Used to check carrier and bit lock changes (default set to no rf and no bitlock)
uint32_t lastClcw = 0xC000;
bool carrierLock = false;
bool bitLock = false;
UioNames uioNames;
/**
* @brief Reads and handles messages stored in the commandQueue
*/
void readCommandQueue(void);
ReturnValue_t polledOperation();
ReturnValue_t irqOperation();
uint32_t readFar();
/**
* @brief This functions writes the configuration parameters to the configuration
* section of the PDEC.
*/
void writePdecConfig();
void writePdecConfigDuringReset(PdecConfig& config);
/**
* @brief Reading the FAR resets the set stat flag which signals a new TC. Without clearing
@ -343,58 +369,6 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc
void printPdecMon();
std::string getMonStatusString(uint32_t status);
object_id_t tcDestinationId;
AcceptsTelecommandsIF* tcDestination = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
/**
* Reset signal is required to hold PDEC in reset state until the configuration has been
* written to the appropriate memory space.
* Can also be used to reboot PDEC in case of erros.
*/
gpioId_t pdecReset = gpio::NO_GPIO;
// UIO device file giving access to the PDEC configuration memory section
std::string uioConfigMemory;
// UIO device file giving access to the PDEC RAM section
std::string uioRamMemory;
// UIO device file giving access to the PDEC register space
std::string uioRegisters;
ActionHelper actionHelper;
StorageManagerIF* tcStore = nullptr;
MessageQueueIF* commandQueue = nullptr;
State state = State::INIT;
/**
* Pointer pointing to base address of the PDEC memory space.
* This address is equivalent with the base address of the section named configuration area in
* the PDEC datasheet.
*/
uint32_t* memoryBaseAddress = nullptr;
uint32_t* ramBaseAddress = nullptr;
// Pointer pointing to base address of register space
uint32_t* registerBaseAddress = nullptr;
uint32_t pdecFar = 0;
uint8_t tcSegment[TC_SEGMENT_LEN];
// Used to check carrier and bit lock changes (default set to no rf and no bitlock)
uint32_t lastClcw = 0xC000;
bool carrierLock = false;
bool bitLock = false;
};
#endif /* LINUX_OBC_PDECHANDLER_H_ */

View File

@ -1,5 +1,5 @@
#include <fcntl.h>
#include <linux/obc/Ptme.h>
#include <linux/ipcore/Ptme.h>
#include <sys/mman.h>
#include <unistd.h>

View File

@ -9,8 +9,8 @@
#include "OBSWConfig.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "linux/obc/PtmeIF.h"
#include "linux/obc/VcInterfaceIF.h"
#include "linux/ipcore/PtmeIF.h"
#include "linux/ipcore/VcInterfaceIF.h"
/**
* @brief This class handles the interfacing to the telemetry (PTME) IP core responsible for the

View File

@ -4,7 +4,7 @@
#include "AxiPtmeConfig.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "linux/obc/PtmeConfig.h"
#include "linux/ipcore/PtmeConfig.h"
#include "returnvalues/classIds.h"
/**

61
linux/ipcore/pdec.h Normal file
View File

@ -0,0 +1,61 @@
#ifndef LINUX_OBC_PDEC_H_
#define LINUX_OBC_PDEC_H_
#include <cstdint>
namespace pdec {
static const uint8_t STAT_POSITION = 31;
static const uint8_t FRAME_ANA_POSITION = 28;
static const uint8_t IREASON_POSITION = 25;
static const uint8_t NEW_FAR_RECEIVED = 0;
static constexpr uint32_t NEW_FAR_MASK = 1 << 2;
static constexpr uint32_t TC_ABORT_MASK = 1 << 1;
static constexpr uint32_t TC_NEW_MASK = 1 << 0;
static constexpr uint32_t FAR_STAT_MASK = 1 << 31;
static const uint32_t FRAME_ANA_MASK = 0x70000000;
static const uint32_t IREASON_MASK = 0x0E000000;
static const uint32_t TC_CHANNEL_INACTIVE = 0x0;
static const uint32_t TC_CHANNEL_ACTIVE = 0x1;
static const uint32_t TC_CHANNEL_TIMEDOUT = 0x2;
static const uint32_t TC0_STATUS_MASK = 0x3;
static const uint32_t TC1_STATUS_MASK = 0xC;
static const uint32_t TC2_STATUS_MASK = 0x300;
static const uint32_t TC3_STATUS_MASK = 0xC00;
static const uint32_t TC4_STATUS_MASK = 0x30000;
static const uint32_t TC5_STATUS_MASK = 0xc00000;
// Lock register set to 1 when start sequence has been found (CLTU is beeing processed)
static const uint32_t LOCK_MASK = 0xc00000;
static const uint32_t TC0_STATUS_POS = 0;
static const uint32_t TC1_STATUS_POS = 2;
static const uint32_t TC2_STATUS_POS = 4;
static const uint32_t TC3_STATUS_POS = 6;
static const uint32_t TC4_STATUS_POS = 8;
static const uint32_t TC5_STATUS_POS = 10;
// Lock register set to 1 when start sequence has been found (CLTU is beeing processed)
static const uint32_t LOCK_POS = 12;
/**
* UIO is 4 byte aligned. Thus offset is calculated with "true offset" / 4
* Example: PDEC_FAR = 0x2840 => Offset in virtual address space is 0xA10
*/
static constexpr uint32_t PDEC_PISR_OFFSET = 0xA02;
static constexpr uint32_t PDEC_PIR_OFFSET = 0xA03;
static constexpr uint32_t PDEC_IMR_OFFSET = 0xA04;
static const uint32_t PDEC_FAR_OFFSET = 0xA10;
static const uint32_t PDEC_CLCW_OFFSET = 0xA12;
static const uint32_t PDEC_BFREE_OFFSET = 0xA24;
static const uint32_t PDEC_BPTR_OFFSET = 0xA25;
static const uint32_t PDEC_SLEN_OFFSET = 0xA26;
static const uint32_t PDEC_MON_OFFSET = 0xA27;
} // namespace pdec
#endif /* LINUX_OBC_PDEC_H_ */

View File

@ -2,8 +2,10 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include "mission/devices/torquer.h"
AcsController::AcsController(object_id_t objectId)
: ExtendedControllerBase(objectId, objects::NO_OBJECT), mgmData(this) {}
: ExtendedControllerBase(objectId), mgmData(this) {}
ReturnValue_t AcsController::handleCommandMessage(CommandMessage *message) {
return returnvalue::OK;
@ -29,6 +31,15 @@ void AcsController::performControlOperation() {
break;
}
{
// TODO: Calculate actuator output
// PoolReadGuard pg(&dipoleSet);
// MutexGuard mg(torquer::lazyLock());
// torquer::NEW_ACTUATION_FLAG = true;
// TODO: Insert correct values here
// dipoleSet.setDipoles(500, 500, 500, 150);
}
{
PoolReadGuard pg(&mgmData);
if (pg.getReadResult() == returnvalue::OK) {

View File

@ -7,8 +7,8 @@
#include "eive/objects.h"
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
#include "mission/devices/devicedefinitions/IMTQHandlerDefinitions.h"
#include "mission/devices/devicedefinitions/SusDefinitions.h"
#include "mission/devices/devicedefinitions/imtqHandlerDefinitions.h"
class AcsController : public ExtendedControllerBase {
public:
@ -20,7 +20,6 @@ class AcsController : public ExtendedControllerBase {
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
InternalState internalState = InternalState::STARTUP;
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
void performControlOperation() override;
@ -44,6 +43,7 @@ class AcsController : public ExtendedControllerBase {
RM3100::Rm3100PrimaryDataset mgm3Rm3100Set =
RM3100::Rm3100PrimaryDataset(objects::MGM_3_RM3100_HANDLER);
IMTQ::RawMtmMeasurementSet imtqMgmSet = IMTQ::RawMtmMeasurementSet(objects::IMTQ_HANDLER);
IMTQ::DipoleActuationSet dipoleSet = IMTQ::DipoleActuationSet(objects::IMTQ_HANDLER);
PoolEntry<float> mgm0PoolVec = PoolEntry<float>(3);
PoolEntry<float> mgm1PoolVec = PoolEntry<float>(3);

View File

@ -8,14 +8,14 @@
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <mission/devices/devicedefinitions/GyroADIS1650XDefinitions.h>
#include <mission/devices/devicedefinitions/GyroL3GD20Definitions.h>
#include <mission/devices/devicedefinitions/IMTQHandlerDefinitions.h>
#include <mission/devices/devicedefinitions/RwDefinitions.h>
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
#include <mission/devices/devicedefinitions/imtqHandlerDefinitions.h>
#include <mission/devices/devicedefinitions/payloadPcduDefinitions.h>
#include <objects/systemObjectList.h>
ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
: ExtendedControllerBase(objectId, parentId),
ThermalController::ThermalController(object_id_t objectId)
: ExtendedControllerBase(objectId),
sensorTemperatures(this),
susTemperatures(this),
deviceTemperatures(this),
@ -573,23 +573,22 @@ void ThermalController::copySus() {
void ThermalController::copyDevices() {
lp_var_t<float> tempQ7s = lp_var_t<float>(objects::CORE_CONTROLLER, core::PoolIds::TEMPERATURE);
ReturnValue_t result = tempQ7s.read();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read Q7S temperature" << std::endl;
deviceTemperatures.q7s.setValid(false);
deviceTemperatures.q7s = static_cast<float>(INVALID_TEMPERATURE);
} else {
{
PoolReadGuard pg(&tempQ7s, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() == returnvalue::OK) {
deviceTemperatures.q7s = tempQ7s;
deviceTemperatures.q7s.setValid(tempQ7s.isValid());
} else {
deviceTemperatures.q7s.setValid(false);
deviceTemperatures.q7s = static_cast<float>(INVALID_TEMPERATURE);
}
result = tempQ7s.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int16_t> battTemp1 =
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_1);
result = battTemp1.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&battTemp1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read battery temperature 1" << std::endl;
deviceTemperatures.batteryTemp1.setValid(false);
deviceTemperatures.batteryTemp1 = static_cast<float>(INVALID_TEMPERATURE);
@ -597,14 +596,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.batteryTemp1 = battTemp1;
deviceTemperatures.batteryTemp1.setValid(battTemp1.isValid());
}
result = battTemp1.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int16_t> battTemp2 =
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_2);
result = battTemp2.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&battTemp2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read battery temperature 2" << std::endl;
deviceTemperatures.batteryTemp2.setValid(false);
deviceTemperatures.batteryTemp2 = static_cast<float>(INVALID_TEMPERATURE);
@ -612,14 +610,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.batteryTemp2 = battTemp2;
deviceTemperatures.batteryTemp2.setValid(battTemp2.isValid());
}
result = battTemp2.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int16_t> battTemp3 =
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_3);
result = battTemp3.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&battTemp3, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read battery temperature 3" << std::endl;
deviceTemperatures.batteryTemp3.setValid(false);
deviceTemperatures.batteryTemp3 = static_cast<float>(INVALID_TEMPERATURE);
@ -627,14 +624,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.batteryTemp3 = battTemp3;
deviceTemperatures.batteryTemp3.setValid(battTemp3.isValid());
}
result = battTemp3.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int16_t> battTemp4 =
lp_var_t<int16_t>(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_4);
result = battTemp4.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&battTemp4, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read battery temperature 4" << std::endl;
deviceTemperatures.batteryTemp4.setValid(false);
deviceTemperatures.batteryTemp4 = static_cast<float>(INVALID_TEMPERATURE);
@ -642,13 +638,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.batteryTemp4 = battTemp4;
deviceTemperatures.batteryTemp4.setValid(battTemp4.isValid());
}
result = battTemp4.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int32_t> tempRw1 = lp_var_t<int32_t>(objects::RW1, RwDefinitions::TEMPERATURE_C);
result = tempRw1.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempRw1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 1 temperature" << std::endl;
deviceTemperatures.rw1.setValid(false);
deviceTemperatures.rw1 = static_cast<int32_t>(INVALID_TEMPERATURE);
@ -656,13 +651,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.rw1.setValid(tempRw1.isValid());
deviceTemperatures.rw1 = tempRw1;
}
result = tempRw1.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int32_t> tempRw2 = lp_var_t<int32_t>(objects::RW2, RwDefinitions::TEMPERATURE_C);
result = tempRw2.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempRw2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 2 temperature" << std::endl;
deviceTemperatures.rw2.setValid(false);
deviceTemperatures.rw2 = static_cast<int32_t>(INVALID_TEMPERATURE);
@ -670,13 +664,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.rw2.setValid(tempRw2.isValid());
deviceTemperatures.rw2 = tempRw2;
}
result = tempRw2.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int32_t> tempRw3 = lp_var_t<int32_t>(objects::RW3, RwDefinitions::TEMPERATURE_C);
result = tempRw3.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempRw3, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 3 temperature" << std::endl;
deviceTemperatures.rw3.setValid(false);
deviceTemperatures.rw3 = static_cast<int32_t>(INVALID_TEMPERATURE);
@ -684,13 +677,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.rw3.setValid(tempRw3.isValid());
deviceTemperatures.rw3 = tempRw3;
}
result = tempRw3.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int32_t> tempRw4 = lp_var_t<int32_t>(objects::RW4, RwDefinitions::TEMPERATURE_C);
result = tempRw4.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempRw4, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read reaction wheel 4 temperature" << std::endl;
deviceTemperatures.rw4.setValid(false);
deviceTemperatures.rw4 = static_cast<int32_t>(INVALID_TEMPERATURE);
@ -698,14 +690,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.rw4.setValid(tempRw4.isValid());
deviceTemperatures.rw4 = tempRw4;
}
result = tempRw4.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempStartracker =
lp_var_t<float>(objects::STAR_TRACKER, startracker::MCU_TEMPERATURE);
result = tempStartracker.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempStartracker, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read startracker temperature" << std::endl;
deviceTemperatures.startracker.setValid(false);
deviceTemperatures.startracker = static_cast<float>(INVALID_TEMPERATURE);
@ -713,14 +704,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.startracker.setValid(tempStartracker.isValid());
deviceTemperatures.startracker = tempStartracker;
}
result = tempStartracker.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempSyrlinksPowerAmplifier =
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER);
result = tempSyrlinksPowerAmplifier.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempSyrlinksPowerAmplifier, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature"
<< std::endl;
deviceTemperatures.syrlinksPowerAmplifier.setValid(false);
@ -729,14 +719,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.syrlinksPowerAmplifier.setValid(tempSyrlinksPowerAmplifier.isValid());
deviceTemperatures.syrlinksPowerAmplifier = tempSyrlinksPowerAmplifier;
}
result = tempSyrlinksPowerAmplifier.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempSyrlinksBasebandBoard =
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
result = tempSyrlinksBasebandBoard.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempSyrlinksBasebandBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature"
<< std::endl;
deviceTemperatures.syrlinksBasebandBoard.setValid(false);
@ -745,13 +734,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.syrlinksBasebandBoard.setValid(tempSyrlinksBasebandBoard.isValid());
deviceTemperatures.syrlinksBasebandBoard = tempSyrlinksBasebandBoard;
}
result = tempSyrlinksBasebandBoard.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<int16_t> tempMgt = lp_var_t<int16_t>(objects::IMTQ_HANDLER, IMTQ::MCU_TEMPERATURE);
result = tempMgt.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempMgt, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read MGT temperature" << std::endl;
deviceTemperatures.mgt.setValid(false);
deviceTemperatures.mgt = static_cast<int16_t>(INVALID_TEMPERATURE);
@ -759,14 +747,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.mgt.setValid(tempMgt.isValid());
deviceTemperatures.mgt = tempMgt;
}
result = tempMgt.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_vec_t<float, 3> tempAcu =
lp_vec_t<float, 3>(objects::ACU_HANDLER, ACU::pool::ACU_TEMPERATURES);
result = tempAcu.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempAcu, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read ACU temperatures" << std::endl;
deviceTemperatures.acu.setValid(false);
deviceTemperatures.acu[0] = static_cast<float>(INVALID_TEMPERATURE);
@ -776,13 +763,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.acu.setValid(tempAcu.isValid());
deviceTemperatures.acu = tempAcu;
}
result = tempAcu.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempPdu1 = lp_var_t<float>(objects::PDU1_HANDLER, PDU::pool::PDU_TEMPERATURE);
result = tempPdu1.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempPdu1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read PDU1 temperature" << std::endl;
deviceTemperatures.pdu1.setValid(false);
deviceTemperatures.pdu1 = static_cast<float>(INVALID_TEMPERATURE);
@ -790,28 +776,26 @@ void ThermalController::copyDevices() {
deviceTemperatures.pdu1.setValid(tempPdu1.isValid());
deviceTemperatures.pdu1 = tempPdu1;
}
result = tempPdu1.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempPdu2 = lp_var_t<float>(objects::PDU2_HANDLER, PDU::pool::PDU_TEMPERATURE);
result = tempPdu2.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempPdu2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read PDU2 temperature" << std::endl;
deviceTemperatures.pdu2.setValid(false);
deviceTemperatures.pdu2 = static_cast<float>(INVALID_TEMPERATURE);
} else {
deviceTemperatures.pdu2.setValid(tempPdu1.isValid());
deviceTemperatures.pdu2 = tempPdu1;
deviceTemperatures.pdu2.setValid(tempPdu2.isValid());
deviceTemperatures.pdu2 = tempPdu2;
}
result = tempPdu2.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> temp1P60dock =
lp_var_t<float>(objects::P60DOCK_HANDLER, P60Dock::pool::P60DOCK_TEMPERATURE_1);
result = temp1P60dock.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&temp1P60dock, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read P60 dock temperature 1" << std::endl;
deviceTemperatures.temp1P60dock.setValid(false);
deviceTemperatures.temp1P60dock = static_cast<float>(INVALID_TEMPERATURE);
@ -819,14 +803,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.temp1P60dock.setValid(temp1P60dock.isValid());
deviceTemperatures.temp1P60dock = temp1P60dock;
}
result = temp1P60dock.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> temp2P60dock =
lp_var_t<float>(objects::P60DOCK_HANDLER, P60Dock::pool::P60DOCK_TEMPERATURE_2);
result = temp2P60dock.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&temp2P60dock, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read P60 dock temperature 2" << std::endl;
deviceTemperatures.temp2P60dock.setValid(false);
deviceTemperatures.temp2P60dock = static_cast<float>(INVALID_TEMPERATURE);
@ -834,13 +817,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.temp2P60dock.setValid(temp2P60dock.isValid());
deviceTemperatures.temp2P60dock = temp2P60dock;
}
result = temp2P60dock.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<float> tempGyro0 = lp_var_t<float>(objects::GYRO_0_ADIS_HANDLER, ADIS1650X::TEMPERATURE);
result = tempGyro0.read();
if (result != returnvalue::OK) {
{
lp_var_t<float> tempGyro0 =
lp_var_t<float>(objects::GYRO_0_ADIS_HANDLER, ADIS1650X::TEMPERATURE);
PoolReadGuard pg(&tempGyro0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read gyro 0 temperature" << std::endl;
deviceTemperatures.gyro0SideA.setValid(false);
deviceTemperatures.gyro0SideA = static_cast<float>(INVALID_TEMPERATURE);
@ -848,13 +831,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.gyro0SideA.setValid(tempGyro0.isValid());
deviceTemperatures.gyro0SideA = tempGyro0;
}
result = tempGyro0.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempGyro1 = lp_var_t<float>(objects::GYRO_1_L3G_HANDLER, L3GD20H::TEMPERATURE);
result = tempGyro1.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempGyro1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read gyro 1 temperature" << std::endl;
deviceTemperatures.gyro1SideA.setValid(false);
deviceTemperatures.gyro1SideA = static_cast<float>(INVALID_TEMPERATURE);
@ -862,13 +844,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.gyro1SideA.setValid(tempGyro1.isValid());
deviceTemperatures.gyro1SideA = tempGyro1;
}
result = tempGyro1.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
lp_var_t<float> tempGyro2 = lp_var_t<float>(objects::GYRO_2_ADIS_HANDLER, ADIS1650X::TEMPERATURE);
result = tempGyro2.read();
if (result != returnvalue::OK) {
{
lp_var_t<float> tempGyro2 =
lp_var_t<float>(objects::GYRO_2_ADIS_HANDLER, ADIS1650X::TEMPERATURE);
PoolReadGuard pg(&tempGyro2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read gyro 2 temperature" << std::endl;
deviceTemperatures.gyro2SideB.setValid(false);
deviceTemperatures.gyro2SideB = static_cast<float>(INVALID_TEMPERATURE);
@ -876,13 +858,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.gyro2SideB.setValid(tempGyro2.isValid());
deviceTemperatures.gyro2SideB = tempGyro2;
}
result = tempGyro2.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempGyro3 = lp_var_t<float>(objects::GYRO_3_L3G_HANDLER, L3GD20H::TEMPERATURE);
result = tempGyro3.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempGyro3, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read gyro 3 temperature" << std::endl;
deviceTemperatures.gyro3SideB.setValid(false);
deviceTemperatures.gyro3SideB = static_cast<float>(INVALID_TEMPERATURE);
@ -890,14 +871,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.gyro3SideB.setValid(tempGyro3.isValid());
deviceTemperatures.gyro3SideB = tempGyro3;
}
result = tempGyro3.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempMgm0 =
lp_var_t<float>(objects::MGM_0_LIS3_HANDLER, MGMLIS3MDL::TEMPERATURE_CELCIUS);
result = tempMgm0.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempMgm0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read MGM 0 temperature" << std::endl;
deviceTemperatures.mgm0SideA.setValid(false);
deviceTemperatures.mgm0SideA = static_cast<float>(INVALID_TEMPERATURE);
@ -905,14 +885,13 @@ void ThermalController::copyDevices() {
deviceTemperatures.mgm0SideA.setValid(tempMgm0.isValid());
deviceTemperatures.mgm0SideA = tempMgm0;
}
result = tempMgm0.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempMgm2 =
lp_var_t<float>(objects::MGM_2_LIS3_HANDLER, MGMLIS3MDL::TEMPERATURE_CELCIUS);
result = tempMgm2.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempMgm2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read MGM 2 temperature" << std::endl;
deviceTemperatures.mgm2SideB.setValid(false);
deviceTemperatures.mgm2SideB = static_cast<float>(INVALID_TEMPERATURE);
@ -920,13 +899,12 @@ void ThermalController::copyDevices() {
deviceTemperatures.mgm2SideB.setValid(tempMgm2.isValid());
deviceTemperatures.mgm2SideB = tempMgm2;
}
result = tempMgm2.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
{
lp_var_t<float> tempAdcPayloadPcdu = lp_var_t<float>(objects::PLPCDU_HANDLER, plpcdu::TEMP);
result = tempAdcPayloadPcdu.read();
if (result != returnvalue::OK) {
PoolReadGuard pg(&tempAdcPayloadPcdu, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read payload PCDU ADC temperature" << std::endl;
deviceTemperatures.adcPayloadPcdu.setValid(false);
deviceTemperatures.adcPayloadPcdu = static_cast<float>(INVALID_TEMPERATURE);
@ -934,8 +912,5 @@ void ThermalController::copyDevices() {
deviceTemperatures.adcPayloadPcdu.setValid(tempAdcPayloadPcdu.isValid());
deviceTemperatures.adcPayloadPcdu = tempAdcPayloadPcdu;
}
result = tempAdcPayloadPcdu.commit();
if (result != returnvalue::OK) {
sif::warning << "ThermalController: Failed to commit" << std::endl;
}
}

View File

@ -12,7 +12,7 @@ class ThermalController : public ExtendedControllerBase {
public:
static const uint16_t INVALID_TEMPERATURE = 999;
ThermalController(object_id_t objectId, object_id_t parentId);
ThermalController(object_id_t objectId);
ReturnValue_t initialize() override;

View File

@ -0,0 +1,14 @@
#ifndef MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_
#define MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_
#include <fsfw/modes/HasModesIF.h>
namespace acs {
enum CtrlModes { OFF = HasModesIF::MODE_OFF, SAFE = 1, DETUMBLE = 2, IDLE = 3, TARGET_PT = 4 };
static constexpr Submode_t IDLE_CHARGE = 1;
} // namespace acs
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ */

View File

@ -24,7 +24,7 @@
#include <fsfw_hal/host/HostFilesystem.h>
#include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PusTmFunnel.h>
#include <mission/tmtc/TmFunnel.h>
#include <mission/tmtc/TmFunnelHandler.h>
#include "OBSWConfig.h"
#include "eive/definitions.h"
@ -66,7 +66,8 @@ EiveFaultHandler EIVE_FAULT_HANDLER;
} // namespace cfdp
void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFunnel** pusFunnel,
CfdpTmFunnel** cfdpFunnel) {
// Framework objects
new EventManager(objects::EVENT_MANAGER);
auto healthTable = new HealthTable(objects::HEALTH_TABLE);
@ -79,14 +80,14 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
StorageManagerIF* tcStore;
StorageManagerIF* tmStore;
{
PoolManager::LocalPoolConfig poolCfg = {{200, 16}, {200, 32}, {150, 64},
{100, 128}, {100, 1024}, {100, 2048}};
PoolManager::LocalPoolConfig poolCfg = {{250, 16}, {250, 32}, {250, 64},
{150, 128}, {120, 1024}, {120, 2048}};
tcStore = new PoolManager(objects::TC_STORE, poolCfg);
}
{
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {100, 64},
{100, 128}, {100, 1024}, {100, 2048}};
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {350, 32}, {350, 64},
{200, 128}, {150, 1024}, {150, 2048}};
tmStore = new PoolManager(objects::TM_STORE, poolCfg);
}
@ -98,12 +99,12 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
#if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
auto tcpIpTmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port "
<< udpBridge->getUdpPort() << std::endl;
#else
auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
auto tcpIpTmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
// TCP is stream based. Use packet ID as start marker when parsing for space packets
tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID, common::CFDP_PACKET_ID});
@ -113,23 +114,21 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
tcpServer->enableWiretapping(true);
#endif /* OBSW_TCP_SERVER_WIRETAPPING == 1 */
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
tmtcBridge->setMaxNumberOfPacketsStored(300);
tcpIpTmtcBridge->setMaxNumberOfPacketsStored(150);
#endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */
auto* ccsdsDistrib =
new CcsdsDistributor(config::EIVE_PUS_APID, objects::CCSDS_PACKET_DISTRIBUTOR);
new PusDistributor(config::EIVE_PUS_APID, objects::PUS_PACKET_DISTRIBUTOR, ccsdsDistrib);
uint8_t vc = 0;
#if OBSW_TM_TO_PTME == 1
vc = config::LIVE_TM;
*cfdpFunnel = new CfdpTmFunnel(objects::CFDP_TM_FUNNEL, config::EIVE_CFDP_APID, *tmStore, 50);
*pusFunnel = new PusTmFunnel(objects::PUS_TM_FUNNEL, *timeStamper, *tmStore, 80);
#if OBSW_ADD_TCPIP_BRIDGE == 1
(*cfdpFunnel)->addDestination(*tcpIpTmtcBridge, 0);
(*pusFunnel)->addDestination(*tcpIpTmtcBridge, 0);
#endif
auto* cfdpFunnel =
new CfdpTmFunnel(objects::CFDP_TM_FUNNEL, config::EIVE_CFDP_APID, *tmtcBridge, *tmStore, vc);
auto* pusFunnel =
new PusTmFunnel(objects::PUS_TM_FUNNEL, *tmtcBridge, *timeStamper, *tmStore, vc);
// Every TM packet goes through this funnel
new TmFunnel(objects::TM_FUNNEL, *pusFunnel, *cfdpFunnel);
new TmFunnelHandler(objects::TM_FUNNEL, **pusFunnel, **cfdpFunnel);
// PUS service stack
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, config::EIVE_PUS_APID,
@ -165,7 +164,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
new CfdpDistributor(distribCfg);
auto* msgQueue = QueueFactory::instance()->createMessageQueue(32);
FsfwHandlerParams params(objects::CFDP_HANDLER, HOST_FS, *cfdpFunnel, *tcStore, *tmStore,
FsfwHandlerParams params(objects::CFDP_HANDLER, HOST_FS, **cfdpFunnel, *tcStore, *tmStore,
*msgQueue);
cfdp::IndicationCfg indicationCfg;
UnsignedByteField<uint16_t> apid(config::EIVE_LOCAL_CFDP_ENTITY_ID);

View File

@ -2,10 +2,13 @@
#define MISSION_CORE_GENERICFACTORY_H_
class HealthTableIF;
class PusTmFunnel;
class CfdpTmFunnel;
namespace ObjectFactory {
void produceGenericObjects(HealthTableIF** healthTable = nullptr);
void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel,
CfdpTmFunnel** cfdpFunnel);
}

View File

@ -216,7 +216,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons
if (packet[2] != sentPingByte) {
return DeviceHandlerIF::INVALID_DATA;
}
if (mode == _MODE_START_UP) {
if (getMode() == _MODE_START_UP) {
commandExecuted = true;
}
break;

View File

@ -11,7 +11,7 @@ target_sources(
SyrlinksHkHandler.cpp
Max31865PT1000Handler.cpp
Max31865EiveHandler.cpp
IMTQHandler.cpp
ImtqHandler.cpp
HeaterHandler.cpp
RadiationSensorHandler.cpp
GyroADIS1650XHandler.cpp
@ -20,6 +20,7 @@ target_sources(
SusHandler.cpp
PayloadPcduHandler.cpp
SolarArrayDeploymentHandler.cpp
ScexDeviceHandler.cpp)
ScexDeviceHandler.cpp
torquer.cpp)
add_subdirectory(devicedefinitions)

View File

@ -570,7 +570,7 @@ ReturnValue_t GomspaceDeviceHandler::generateRequestFullCfgTableCmd(DeviceType d
uint32_t GomspaceDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 0; }
void GomspaceDeviceHandler::setModeNormal() { mode = MODE_NORMAL; }
void GomspaceDeviceHandler::setModeNormal() { setMode(_MODE_TO_NORMAL); }
ReturnValue_t GomspaceDeviceHandler::printStatus(DeviceCommandId_t cmd) {
sif::info << "No printHkTable implementation given.." << std::endl;

View File

@ -422,12 +422,12 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
cookie->setTransferSize(2);
gpioId_t gpioId = cookie->getChipSelectPin();
GpioIF *gpioIF = comIf->getGpioInterface();
GpioIF &gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0;
MutexIF *mutex = comIf->getCsMutex();
cookie->getMutexParams(timeoutType, timeoutMs);
if (mutex == nullptr or gpioIF == nullptr) {
if (mutex == nullptr) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "GyroADIS16507Handler::spiSendCallback: "
"Mutex or GPIO interface invalid"
@ -453,7 +453,7 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
while (idx < sendLen) {
// Pull SPI CS low. For now, no support for active high given
if (gpioId != gpio::NO_GPIO) {
gpioIF->pullLow(gpioId);
gpioIF.pullLow(gpioId);
}
// Execute transfer
@ -468,7 +468,7 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
if (gpioId != gpio::NO_GPIO) {
gpioIF->pullHigh(gpioId);
gpioIF.pullHigh(gpioId);
}
idx += 2;

View File

@ -1,18 +1,41 @@
#include "IMTQHandler.h"
#include <bits/stdint-intn.h>
#include <commonConfig.h>
#include <fsfw/datapool/PoolEntry.h>
#include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/globalfunctions/CRC.h>
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/datapoollocal/LocalPoolVariable.h>
#include <fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h>
#include <fsfw/datapoollocal/localPoolDefinitions.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/ipc/MutexFactory.h>
#include <fsfw/ipc/MutexGuard.h>
#include <fsfw/ipc/messageQueueDefinitions.h>
#include <fsfw/modes/ModeMessage.h>
#include <fsfw/objectmanager/SystemObjectIF.h>
#include <fsfw/power/definitions.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/serialize/SerializeIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfw/timemanager/Countdown.h>
#include <fsfw/timemanager/clockDefinitions.h>
#include <mission/devices/ImtqHandler.h>
#include <cmath>
#include <fsfw/datapoollocal/LocalPoolVariable.tpp>
#include "OBSWConfig.h"
#include "mission/devices/torquer.h"
IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
static constexpr bool ACTUATION_WIRETAPPING = false;
ImtqHandler::ImtqHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t pwrSwitcher)
: DeviceHandlerBase(objectId, comIF, comCookie),
engHkDataset(this),
calMtmMeasurementSet(this),
rawMtmMeasurementSet(this),
dipoleSet(*this),
posXselfTestDataset(this),
negXselfTestDataset(this),
posYselfTestDataset(this),
@ -25,9 +48,9 @@ IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comC
}
}
IMTQHandler::~IMTQHandler() {}
ImtqHandler::~ImtqHandler() = default;
void IMTQHandler::doStartUp() {
void ImtqHandler::doStartUp() {
if (goToNormalMode) {
setMode(MODE_NORMAL);
} else {
@ -35,9 +58,11 @@ void IMTQHandler::doStartUp() {
}
}
void IMTQHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
void ImtqHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
ReturnValue_t IMTQHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
bool buildCommand = true;
// Depending on the normal polling mode configuration, 3-4 communication steps are recommended
switch (communicationStep) {
case CommunicationStep::GET_ENG_HK_DATA:
*id = IMTQ::GET_ENG_HK_DATA;
@ -45,29 +70,61 @@ ReturnValue_t IMTQHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
break;
case CommunicationStep::START_MTM_MEASUREMENT:
*id = IMTQ::START_MTM_MEASUREMENT;
communicationStep = CommunicationStep::GET_CAL_MTM_MEASUREMENT;
break;
case CommunicationStep::GET_CAL_MTM_MEASUREMENT:
*id = IMTQ::GET_CAL_MTM_MEASUREMENT;
if (pollingMode == NormalPollingMode::BOTH or
pollingMode == NormalPollingMode::UNCALIBRATED) {
communicationStep = CommunicationStep::GET_RAW_MTM_MEASUREMENT;
} else {
communicationStep = CommunicationStep::GET_CAL_MTM_MEASUREMENT;
}
break;
case CommunicationStep::GET_RAW_MTM_MEASUREMENT:
if (integrationTimeCd.getRemainingMillis() > 0) {
TaskFactory::delayTask(integrationTimeCd.getRemainingMillis());
}
*id = IMTQ::GET_RAW_MTM_MEASUREMENT;
if (pollingMode == NormalPollingMode::BOTH) {
communicationStep = CommunicationStep::GET_CAL_MTM_MEASUREMENT;
} else {
communicationStep = CommunicationStep::DIPOLE_ACTUATION;
}
break;
case CommunicationStep::GET_CAL_MTM_MEASUREMENT:
if (integrationTimeCd.getRemainingMillis() > 0) {
TaskFactory::delayTask(integrationTimeCd.getRemainingMillis());
}
*id = IMTQ::GET_CAL_MTM_MEASUREMENT;
communicationStep = CommunicationStep::DIPOLE_ACTUATION;
break;
case CommunicationStep::DIPOLE_ACTUATION: {
// If the dipole is not commanded but set by the ACS control algorithm,
// the dipoles will be set by the ACS controller directly using the dipole local pool set.
// This set has a flag to determine whether the ACS controller actually set any new input.
MutexGuard mg(torquer::lazyLock());
if (torquer::NEW_ACTUATION_FLAG) {
*id = IMTQ::START_ACTUATION_DIPOLE;
torquer::NEW_ACTUATION_FLAG = false;
} else {
buildCommand = false;
}
communicationStep = CommunicationStep::GET_ENG_HK_DATA;
break;
}
default:
sif::debug << "IMTQHandler::buildNormalDeviceCommand: Invalid communication step"
<< std::endl;
break;
}
return buildCommandFromCommand(*id, NULL, 0);
}
ReturnValue_t IMTQHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
if (buildCommand) {
return buildCommandFromCommand(*id, nullptr, 0);
}
return NOTHING_TO_SEND;
}
ReturnValue_t IMTQHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
ReturnValue_t ImtqHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
return NOTHING_TO_SEND;
}
ReturnValue_t ImtqHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t* commandData,
size_t commandDataLen) {
switch (deviceCommand) {
@ -122,20 +179,36 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma
case (IMTQ::START_ACTUATION_DIPOLE): {
/* IMTQ expects low byte first */
commandBuffer[0] = IMTQ::CC::START_ACTUATION_DIPOLE;
if (commandData == nullptr) {
if (commandData != nullptr && commandDataLen < 8) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
commandBuffer[1] = commandData[1];
commandBuffer[2] = commandData[0];
commandBuffer[3] = commandData[3];
commandBuffer[4] = commandData[2];
commandBuffer[5] = commandData[5];
commandBuffer[6] = commandData[4];
commandBuffer[7] = commandData[7];
commandBuffer[8] = commandData[6];
rawPacket = commandBuffer;
rawPacketLen = 9;
return returnvalue::OK;
ReturnValue_t result;
// Commands override anything which was set in the software
if (commandData != nullptr) {
dipoleSet.setValidityBufferGeneration(false);
result =
dipoleSet.deSerialize(&commandData, &commandDataLen, SerializeIF::Endianness::NETWORK);
dipoleSet.setValidityBufferGeneration(true);
if (result != returnvalue::OK) {
return result;
}
} else {
// Read set dipole values from local pool
PoolReadGuard pg(&dipoleSet);
}
if (ACTUATION_WIRETAPPING) {
sif::debug << "Actuating IMTQ with parameters x = " << dipoleSet.xDipole.value
<< ", y = " << dipoleSet.yDipole.value << ", z = " << dipoleSet.zDipole.value
<< ", duration = " << dipoleSet.currentTorqueDurationMs.value << std::endl;
}
result = buildDipoleActuationCommand();
if (result != returnvalue::OK) {
return result;
}
MutexGuard mg(torquer::lazyLock());
torquer::TORQUEING = true;
torquer::TORQUE_COUNTDOWN.setTimeout(dipoleSet.currentTorqueDurationMs.value);
return result;
}
case (IMTQ::GET_ENG_HK_DATA): {
commandBuffer[0] = IMTQ::CC::GET_ENG_HK_DATA;
@ -151,6 +224,7 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma
}
case (IMTQ::START_MTM_MEASUREMENT): {
commandBuffer[0] = IMTQ::CC::START_MTM_MEASUREMENT;
integrationTimeCd.resetTimer();
rawPacket = commandBuffer;
rawPacketLen = 1;
return returnvalue::OK;
@ -173,30 +247,42 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma
return returnvalue::FAILED;
}
void IMTQHandler::fillCommandAndReplyMap() {
this->insertInCommandAndReplyMap(IMTQ::POS_X_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::NEG_X_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::POS_Y_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::NEG_Y_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::POS_Z_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::NEG_Z_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_SELF_TEST_RESULT, 1, nullptr,
IMTQ::SIZE_SELF_TEST_RESULTS);
this->insertInCommandAndReplyMap(IMTQ::START_ACTUATION_DIPOLE, 1, nullptr,
IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_ENG_HK_DATA, 1, &engHkDataset,
IMTQ::SIZE_ENG_HK_DATA_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_COMMANDED_DIPOLE, 1, nullptr,
ReturnValue_t ImtqHandler::buildDipoleActuationCommand() {
commandBuffer[0] = IMTQ::CC::START_ACTUATION_DIPOLE;
uint8_t* serPtr = commandBuffer + 1;
size_t serSize = 1;
dipoleSet.setValidityBufferGeneration(false);
ReturnValue_t result = dipoleSet.serialize(&serPtr, &serSize, sizeof(commandBuffer),
SerializeIF::Endianness::LITTLE);
dipoleSet.setValidityBufferGeneration(true);
if (result != returnvalue::OK) {
return result;
}
rawPacket = commandBuffer;
rawPacketLen = 9;
return result;
}
void ImtqHandler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(IMTQ::POS_X_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::NEG_X_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::POS_Y_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::NEG_Y_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::POS_Z_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::NEG_Z_SELF_TEST, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::GET_SELF_TEST_RESULT, 1, nullptr, IMTQ::SIZE_SELF_TEST_RESULTS);
insertInCommandAndReplyMap(IMTQ::START_ACTUATION_DIPOLE, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::GET_ENG_HK_DATA, 1, &engHkDataset, IMTQ::SIZE_ENG_HK_DATA_REPLY);
insertInCommandAndReplyMap(IMTQ::GET_COMMANDED_DIPOLE, 1, nullptr,
IMTQ::SIZE_GET_COMMANDED_DIPOLE_REPLY);
this->insertInCommandAndReplyMap(IMTQ::START_MTM_MEASUREMENT, 1, nullptr,
IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_CAL_MTM_MEASUREMENT, 1, &calMtmMeasurementSet,
insertInCommandAndReplyMap(IMTQ::START_MTM_MEASUREMENT, 1, nullptr, IMTQ::SIZE_STATUS_REPLY);
insertInCommandAndReplyMap(IMTQ::GET_CAL_MTM_MEASUREMENT, 1, &calMtmMeasurementSet,
IMTQ::SIZE_GET_CAL_MTM_MEASUREMENT);
this->insertInCommandAndReplyMap(IMTQ::GET_RAW_MTM_MEASUREMENT, 1, &rawMtmMeasurementSet,
insertInCommandAndReplyMap(IMTQ::GET_RAW_MTM_MEASUREMENT, 1, &rawMtmMeasurementSet,
IMTQ::SIZE_GET_RAW_MTM_MEASUREMENT);
}
ReturnValue_t IMTQHandler::scanForReply(const uint8_t* start, size_t remainingSize,
ReturnValue_t ImtqHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = returnvalue::OK;
@ -233,8 +319,16 @@ ReturnValue_t IMTQHandler::scanForReply(const uint8_t* start, size_t remainingSi
*foundLen = IMTQ::SIZE_SELF_TEST_RESULTS;
*foundId = IMTQ::GET_SELF_TEST_RESULT;
break;
case (IMTQ::CC::PAST_AVAILABLE_RESPONSE_BYTES): {
sif::warning << "IMTQHandler::scanForReply: Read 0xFF command byte, reading past available "
"bytes. Keep 1 ms delay between I2C send and read"
<< std::endl;
result = IGNORE_REPLY_DATA;
break;
}
default:
sif::debug << "IMTQHandler::scanForReply: Reply contains invalid command code" << std::endl;
sif::debug << "IMTQHandler::scanForReply: Reply with length " << remainingSize
<< "contains invalid command code " << static_cast<int>(*start) << std::endl;
result = IGNORE_REPLY_DATA;
break;
}
@ -242,7 +336,7 @@ ReturnValue_t IMTQHandler::scanForReply(const uint8_t* start, size_t remainingSi
return result;
}
ReturnValue_t IMTQHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
ReturnValue_t ImtqHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
ReturnValue_t result = returnvalue::OK;
result = parseStatusByte(packet);
@ -286,9 +380,9 @@ ReturnValue_t IMTQHandler::interpretDeviceReply(DeviceCommandId_t id, const uint
return returnvalue::OK;
}
void IMTQHandler::setNormalDatapoolEntriesInvalid() {}
void ImtqHandler::setNormalDatapoolEntriesInvalid() {}
LocalPoolDataSetBase* IMTQHandler::getDataSetHandle(sid_t sid) {
LocalPoolDataSetBase* ImtqHandler::getDataSetHandle(sid_t sid) {
if (sid == engHkDataset.getSid()) {
return &engHkDataset;
} else if (sid == calMtmMeasurementSet.getSid()) {
@ -313,9 +407,9 @@ LocalPoolDataSetBase* IMTQHandler::getDataSetHandle(sid_t sid) {
}
}
uint32_t IMTQHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
uint32_t ImtqHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
ReturnValue_t ImtqHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
/** Entries of engineering housekeeping dataset */
localDataPoolMap.emplace(IMTQ::DIGITAL_VOLTAGE_MV, new PoolEntry<uint16_t>({0}));
@ -330,6 +424,11 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat
localDataPoolMap.emplace(IMTQ::COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<int16_t>({0}));
localDataPoolMap.emplace(IMTQ::DIPOLES_X, &dipoleXEntry);
localDataPoolMap.emplace(IMTQ::DIPOLES_Y, &dipoleYEntry);
localDataPoolMap.emplace(IMTQ::DIPOLES_Z, &dipoleZEntry);
localDataPoolMap.emplace(IMTQ::CURRENT_TORQUE_DURATION, &torqueDurationEntry);
/** Entries of calibrated MTM measurement dataset */
localDataPoolMap.emplace(IMTQ::MGM_CAL_NT, &mgmCalEntry);
localDataPoolMap.emplace(IMTQ::ACTUATION_CAL_STATUS, new PoolEntry<uint8_t>({0}));
@ -611,7 +710,7 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat
return returnvalue::OK;
}
ReturnValue_t IMTQHandler::getSelfTestCommandId(DeviceCommandId_t* id) {
ReturnValue_t ImtqHandler::getSelfTestCommandId(DeviceCommandId_t* id) {
DeviceCommandId_t commandId = getPendingCommand();
switch (commandId) {
case IMTQ::POS_X_SELF_TEST:
@ -630,7 +729,7 @@ ReturnValue_t IMTQHandler::getSelfTestCommandId(DeviceCommandId_t* id) {
return returnvalue::OK;
}
ReturnValue_t IMTQHandler::parseStatusByte(const uint8_t* packet) {
ReturnValue_t ImtqHandler::parseStatusByte(const uint8_t* packet) {
uint8_t cmdErrorField = *(packet + 1) & 0xF;
switch (cmdErrorField) {
case 0:
@ -661,7 +760,7 @@ ReturnValue_t IMTQHandler::parseStatusByte(const uint8_t* packet) {
}
}
void IMTQHandler::fillEngHkDataset(const uint8_t* packet) {
void ImtqHandler::fillEngHkDataset(const uint8_t* packet) {
PoolReadGuard rg(&engHkDataset);
uint8_t offset = 2;
engHkDataset.digitalVoltageMv = *(packet + offset + 1) << 8 | *(packet + offset);
@ -687,7 +786,9 @@ void IMTQHandler::fillEngHkDataset(const uint8_t* packet) {
offset += 2;
engHkDataset.coilZTemperature = (*(packet + offset + 1) << 8 | *(packet + offset));
offset += 2;
engHkDataset.mcuTemperature = (*(packet + offset + 1) << 8 | *(packet + offset));
size_t dummy = 2;
SerializeAdapter::deSerialize(&engHkDataset.mcuTemperature.value, packet + offset, &dummy,
SerializeIF::Endianness::LITTLE);
engHkDataset.setValidity(true, true);
@ -708,9 +809,9 @@ void IMTQHandler::fillEngHkDataset(const uint8_t* packet) {
}
}
void IMTQHandler::setToGoToNormal(bool enable) { this->goToNormalMode = enable; }
void ImtqHandler::setToGoToNormal(bool enable) { this->goToNormalMode = enable; }
void IMTQHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) {
void ImtqHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) {
if (wiretappingMode == RAW) {
/* Data already sent in doGetRead() */
return;
@ -734,7 +835,7 @@ void IMTQHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCom
}
}
void IMTQHandler::handleGetCommandedDipoleReply(const uint8_t* packet) {
void ImtqHandler::handleGetCommandedDipoleReply(const uint8_t* packet) {
uint8_t tmData[6];
/* Switching endianess of received dipole values */
tmData[0] = *(packet + 3);
@ -746,7 +847,7 @@ void IMTQHandler::handleGetCommandedDipoleReply(const uint8_t* packet) {
handleDeviceTM(tmData, sizeof(tmData), IMTQ::GET_COMMANDED_DIPOLE);
}
void IMTQHandler::fillCalibratedMtmDataset(const uint8_t* packet) {
void ImtqHandler::fillCalibratedMtmDataset(const uint8_t* packet) {
PoolReadGuard rg(&calMtmMeasurementSet);
calMtmMeasurementSet.setValidity(true, true);
int8_t offset = 2;
@ -776,7 +877,7 @@ void IMTQHandler::fillCalibratedMtmDataset(const uint8_t* packet) {
}
}
void IMTQHandler::fillRawMtmDataset(const uint8_t* packet) {
void ImtqHandler::fillRawMtmDataset(const uint8_t* packet) {
PoolReadGuard rg(&rawMtmMeasurementSet);
unsigned int offset = 2;
size_t deSerLen = 16;
@ -824,7 +925,7 @@ void IMTQHandler::fillRawMtmDataset(const uint8_t* packet) {
}
}
void IMTQHandler::handleSelfTestReply(const uint8_t* packet) {
void ImtqHandler::handleSelfTestReply(const uint8_t* packet) {
uint16_t offset = 2;
checkErrorByte(*(packet + offset), *(packet + offset + 1));
@ -858,7 +959,7 @@ void IMTQHandler::handleSelfTestReply(const uint8_t* packet) {
}
}
void IMTQHandler::handlePositiveXSelfTestReply(const uint8_t* packet) {
void ImtqHandler::handlePositiveXSelfTestReply(const uint8_t* packet) {
PoolReadGuard rg(&posXselfTestDataset);
uint16_t offset = 2;
@ -1070,7 +1171,7 @@ void IMTQHandler::handlePositiveXSelfTestReply(const uint8_t* packet) {
}
}
void IMTQHandler::handleNegativeXSelfTestReply(const uint8_t* packet) {
void ImtqHandler::handleNegativeXSelfTestReply(const uint8_t* packet) {
PoolReadGuard rg(&posXselfTestDataset);
uint16_t offset = 2;
@ -1282,7 +1383,7 @@ void IMTQHandler::handleNegativeXSelfTestReply(const uint8_t* packet) {
}
}
void IMTQHandler::handlePositiveYSelfTestReply(const uint8_t* packet) {
void ImtqHandler::handlePositiveYSelfTestReply(const uint8_t* packet) {
PoolReadGuard rg(&posXselfTestDataset);
uint16_t offset = 2;
@ -1494,7 +1595,7 @@ void IMTQHandler::handlePositiveYSelfTestReply(const uint8_t* packet) {
}
}
void IMTQHandler::handleNegativeYSelfTestReply(const uint8_t* packet) {
void ImtqHandler::handleNegativeYSelfTestReply(const uint8_t* packet) {
PoolReadGuard rg(&posXselfTestDataset);
uint16_t offset = 2;
@ -1706,7 +1807,7 @@ void IMTQHandler::handleNegativeYSelfTestReply(const uint8_t* packet) {
}
}
void IMTQHandler::handlePositiveZSelfTestReply(const uint8_t* packet) {
void ImtqHandler::handlePositiveZSelfTestReply(const uint8_t* packet) {
PoolReadGuard rg(&posXselfTestDataset);
uint16_t offset = 2;
@ -1918,7 +2019,7 @@ void IMTQHandler::handlePositiveZSelfTestReply(const uint8_t* packet) {
}
}
void IMTQHandler::handleNegativeZSelfTestReply(const uint8_t* packet) {
void ImtqHandler::handleNegativeZSelfTestReply(const uint8_t* packet) {
PoolReadGuard rg(&posXselfTestDataset);
uint16_t offset = 2;
@ -2130,9 +2231,9 @@ void IMTQHandler::handleNegativeZSelfTestReply(const uint8_t* packet) {
}
}
void IMTQHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void ImtqHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void IMTQHandler::checkErrorByte(const uint8_t errorByte, const uint8_t step) {
void ImtqHandler::checkErrorByte(const uint8_t errorByte, const uint8_t step) {
std::string stepString("");
if (step < 8) {
stepString = makeStepString(step);
@ -2190,7 +2291,12 @@ void IMTQHandler::checkErrorByte(const uint8_t errorByte, const uint8_t step) {
}
}
std::string IMTQHandler::makeStepString(const uint8_t step) {
void ImtqHandler::doSendRead() {
TaskFactory::delayTask(1);
DeviceHandlerBase::doSendRead();
}
std::string ImtqHandler::makeStepString(const uint8_t step) {
std::string stepString("");
switch (step) {
case IMTQ::SELF_TEST_STEPS::INIT:
@ -2225,7 +2331,7 @@ std::string IMTQHandler::makeStepString(const uint8_t step) {
return stepString;
}
ReturnValue_t IMTQHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
ReturnValue_t ImtqHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
if (switcher != power::NO_SWITCH) {
*numberOfSwitches = 1;
*switches = &switcher;

View File

@ -2,7 +2,7 @@
#define MISSION_DEVICES_IMTQHANDLER_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/devices/devicedefinitions/IMTQHandlerDefinitions.h>
#include <mission/devices/devicedefinitions/imtqHandlerDefinitions.h>
#include <string.h>
#include "events/subsystemIdRanges.h"
@ -13,12 +13,17 @@
*
* @author J. Meier
*/
class IMTQHandler : public DeviceHandlerBase {
class ImtqHandler : public DeviceHandlerBase {
public:
IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t pwrSwitcher);
virtual ~IMTQHandler();
enum NormalPollingMode { UNCALIBRATED = 0, CALIBRATED = 1, BOTH = 2 };
ImtqHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t pwrSwitcher);
virtual ~ImtqHandler();
void setPollingMode(NormalPollingMode pollMode);
void doSendRead() override;
/**
* @brief Sets mode to MODE_NORMAL. Can be used for debugging.
*/
@ -95,6 +100,7 @@ class IMTQHandler : public DeviceHandlerBase {
IMTQ::EngHkDataset engHkDataset;
IMTQ::CalibratedMtmMeasurementSet calMtmMeasurementSet;
IMTQ::RawMtmMeasurementSet rawMtmMeasurementSet;
IMTQ::DipoleActuationSet dipoleSet;
IMTQ::PosXSelfTestSet posXselfTestDataset;
IMTQ::NegXSelfTestSet negXselfTestDataset;
IMTQ::PosYSelfTestSet posYselfTestDataset;
@ -102,7 +108,16 @@ class IMTQHandler : public DeviceHandlerBase {
IMTQ::PosZSelfTestSet posZselfTestDataset;
IMTQ::NegZSelfTestSet negZselfTestDataset;
NormalPollingMode pollingMode = NormalPollingMode::UNCALIBRATED;
PoolEntry<int32_t> mgmCalEntry = PoolEntry<int32_t>(3);
PoolEntry<int16_t> dipoleXEntry = PoolEntry<int16_t>(0, false);
PoolEntry<int16_t> dipoleYEntry = PoolEntry<int16_t>(0, false);
PoolEntry<int16_t> dipoleZEntry = PoolEntry<int16_t>(0, false);
PoolEntry<uint16_t> torqueDurationEntry = PoolEntry<uint16_t>(0, false);
// Hardcoded to default integration time of 10 ms.
// SHOULDDO: Support for other integration times
Countdown integrationTimeCd = Countdown(10);
power::Switch_t switcher = power::NO_SWITCH;
@ -114,7 +129,8 @@ class IMTQHandler : public DeviceHandlerBase {
GET_ENG_HK_DATA,
START_MTM_MEASUREMENT,
GET_CAL_MTM_MEASUREMENT,
GET_RAW_MTM_MEASUREMENT
GET_RAW_MTM_MEASUREMENT,
DIPOLE_ACTUATION
};
CommunicationStep communicationStep = CommunicationStep::GET_ENG_HK_DATA;
@ -196,6 +212,7 @@ class IMTQHandler : public DeviceHandlerBase {
void handlePositiveZSelfTestReply(const uint8_t* packet);
void handleNegativeZSelfTestReply(const uint8_t* packet);
ReturnValue_t buildDipoleActuationCommand();
/**
* @brief This function checks the error byte of a self test measurement.
*

View File

@ -30,16 +30,13 @@ void Max31865EiveHandler::doStartUp() {
}
void Max31865EiveHandler::doShutDown() {
updatePeriodicReply(false, EiveMax31855::RtdCommands::EXCHANGE_SET_ID);
if (state == InternalState::NONE or state == InternalState::ACTIVE or
state == InternalState::ON) {
state = InternalState::INACTIVE;
transitionOk = false;
} else {
transitionOk = true;
}
if (state == InternalState::INACTIVE and transitionOk) {
setMode(_MODE_POWER_DOWN);
setMode(MODE_OFF);
}
}
@ -104,7 +101,7 @@ void Max31865EiveHandler::simpleCommand(EiveMax31855::RtdCommands cmd) {
rawPacketLen = 1;
}
void Max31865EiveHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
if (mode == _MODE_TO_NORMAL) {
if (getMode() == _MODE_TO_NORMAL) {
if (state != InternalState::ACTIVE) {
state = InternalState::ACTIVE;
transitionOk = false;
@ -125,7 +122,7 @@ void Max31865EiveHandler::fillCommandAndReplyMap() {
ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
if (mode == _MODE_POWER_ON or mode == _MODE_WAIT_ON) {
if (getMode() == _MODE_POWER_ON or getMode() == _MODE_WAIT_ON) {
return IGNORE_FULL_PACKET;
}
if (remainingSize != structLen) {
@ -145,12 +142,17 @@ ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id,
if (result != returnvalue::OK) {
return result;
}
if (mode == _MODE_TO_NORMAL and exchangeStruct.active and state == InternalState::ACTIVE) {
if (getMode() == _MODE_TO_NORMAL and exchangeStruct.active and state == InternalState::ACTIVE) {
transitionOk = true;
}
if (mode == _MODE_START_UP and exchangeStruct.configured and state == InternalState::ON) {
if (getMode() == _MODE_START_UP and exchangeStruct.configured and state == InternalState::ON) {
transitionOk = true;
}
if (getMode() == _MODE_SHUT_DOWN and not exchangeStruct.active) {
transitionOk = true;
return returnvalue::OK;
}
// Calculate resistance
float rtdValue = exchangeStruct.adcCode * EiveMax31855::RTD_RREF_PT1000 / INT16_MAX;
// calculate approximation

View File

@ -302,7 +302,7 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, size_t r
} else if (internalState == InternalState::CLEAR_FAULT_BYTE) {
*foundId = MAX31865::CLEAR_FAULT_BYTE;
*foundLen = 2;
if (mode == _MODE_START_UP) {
if (getMode() == _MODE_START_UP) {
commandExecuted = true;
} else {
internalState = InternalState::RUNNING;
@ -524,7 +524,7 @@ void Max31865PT1000Handler::setInstantNormal(bool instantNormal) {
}
void Max31865PT1000Handler::modeChanged() {
if (mode == MODE_OFF) {
if (getMode() == MODE_OFF) {
lastFaultStatus = 0;
currentFaultStatus = 0;
sameFaultStatusCounter = 0;

View File

@ -66,7 +66,7 @@ void PayloadPcduHandler::doShutDown() {
}
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
if (mode == _MODE_TO_NORMAL) {
if (getMode() == _MODE_TO_NORMAL) {
stateMachineToNormal(modeFrom, subModeFrom);
return;
}
@ -76,7 +76,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subModeFrom) {
using namespace plpcdu;
bool doFinish = true;
if (((submode >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == 1) {
if (((getSubmode() >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == 1) {
if (state == States::PL_PCDU_OFF) {
sif::error << "PayloadPcduHandler::stateMachineToNormal: Unexpected state PL_PCDU_OFF"
<< "detected" << std::endl;
@ -129,7 +129,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
auto switchHandler = [&](NormalSubmodeBits bit, gpioId_t id, std::string info) {
if (((diffMask >> bit) & 1) == 1) {
if (((submode >> bit) & 1) == 1) {
if (((getSubmode() >> bit) & 1) == 1) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::info << "Enabling PL PCDU " << info << " module" << std::endl;
#endif
@ -150,7 +150,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
switchHandler(MPA_ON, gpioIds::PLPCDU_ENB_MPA, "MPA");
switchHandler(HPA_ON, gpioIds::PLPCDU_ENB_HPA, "HPA");
if (doFinish) {
setMode(MODE_NORMAL, submode);
setMode(MODE_NORMAL);
}
return returnvalue::OK;
}
@ -177,7 +177,7 @@ ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t
*id = plpcdu::SETUP_CMD;
return buildCommandFromCommand(*id, nullptr, 0);
}
if (mode == _MODE_TO_NORMAL) {
if (getMode() == _MODE_TO_NORMAL) {
return buildNormalDeviceCommand(id);
}
return NOTHING_TO_SEND;
@ -248,7 +248,7 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
using namespace plpcdu;
switch (id) {
case (SETUP_CMD): {
if (mode == _MODE_TO_NORMAL) {
if (getMode() == _MODE_TO_NORMAL) {
adcCmdExecuted = true;
}
break;
@ -540,33 +540,34 @@ bool PayloadPcduHandler::checkCurrent(float val, float upperBound, Event event)
ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
using namespace plpcdu;
if (mode == MODE_NORMAL) {
diffMask = submode ^ this->submode;
uint8_t dhbSubmode = getSubmode();
diffMask = submode ^ dhbSubmode;
// Also deals with the case where the mode is MODE_ON, submode should be 0 here
if ((((submode >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == SOLID_STATE_RELAYS_ADC_ON) and
(this->mode == MODE_NORMAL and this->submode != ALL_OFF_SUBMODE)) {
(getMode() == MODE_NORMAL and dhbSubmode != ALL_OFF_SUBMODE)) {
return TRANS_NOT_ALLOWED;
}
if (((((submode >> DRO_ON) & 1) == 1) and
((this->submode & 0b1) != (1 << SOLID_STATE_RELAYS_ADC_ON)))) {
((dhbSubmode & 0b1) != (1 << SOLID_STATE_RELAYS_ADC_ON)))) {
return TRANS_NOT_ALLOWED;
}
if ((((submode >> X8_ON) & 1) == 1) and
((this->submode & 0b11) != ((1 << SOLID_STATE_RELAYS_ADC_ON) | (1 << DRO_ON)))) {
((dhbSubmode & 0b11) != ((1 << SOLID_STATE_RELAYS_ADC_ON) | (1 << DRO_ON)))) {
return TRANS_NOT_ALLOWED;
}
if (((((submode >> TX_ON) & 1) == 1) and
((this->submode & 0b111) !=
((dhbSubmode & 0b111) !=
((1 << X8_ON) | (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) {
return TRANS_NOT_ALLOWED;
}
if ((((submode >> MPA_ON) & 1) == 1 and
((this->submode & 0b1111) !=
((dhbSubmode & 0b1111) !=
((1 << TX_ON) | (1 << X8_ON) | (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) {
return TRANS_NOT_ALLOWED;
}
if ((((submode >> HPA_ON) & 1) == 1 and
((this->submode & 0b11111) != ((1 << MPA_ON) | (1 << TX_ON) | (1 << X8_ON) |
(1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) {
((dhbSubmode & 0b11111) != ((1 << MPA_ON) | (1 << TX_ON) | (1 << X8_ON) | (1 << DRO_ON) |
(1 << SOLID_STATE_RELAYS_ADC_ON))))) {
return TRANS_NOT_ALLOWED;
}
return returnvalue::OK;
@ -719,11 +720,11 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
cookie->setTransferSize(transferLen);
gpioId_t gpioId = cookie->getChipSelectPin();
GpioIF* gpioIF = comIf->getGpioInterface();
GpioIF& gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0;
MutexIF* mutex = comIf->getCsMutex();
if (mutex == nullptr or gpioIF == nullptr) {
if (mutex == nullptr) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "GyroADIS16507Handler::spiSendCallback: "
"Mutex or GPIO interface invalid"
@ -753,7 +754,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
transferStruct->len = transferLen;
// Pull SPI CS low. For now, no support for active high given
if (gpioId != gpio::NO_GPIO) {
gpioIF->pullLow(gpioId);
gpioIF.pullLow(gpioId);
}
// Execute transfer
@ -768,14 +769,14 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
if (gpioId != gpio::NO_GPIO) {
gpioIF->pullHigh(gpioId);
gpioIF.pullHigh(gpioId);
}
transferStruct->tx_buf += transferLen;
transferStruct->rx_buf += transferLen;
transferStruct->len = plpcdu::TEMP_REPLY_SIZE - 1;
if (gpioId != gpio::NO_GPIO) {
gpioIF->pullLow(gpioId);
gpioIF.pullLow(gpioId);
}
// Execute transfer
@ -790,7 +791,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
if (gpioId != gpio::NO_GPIO) {
gpioIF->pullHigh(gpioId);
gpioIF.pullHigh(gpioId);
}
transferStruct->tx_buf = origTx;

View File

@ -10,8 +10,8 @@
#include "fsfw_hal/common/gpio/GpioIF.h"
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/memory/SdCardMountedIF.h"
#include "mission/system/DualLanePowerStateMachine.h"
#include "mission/system/definitions.h"
#include "mission/system/objects/DualLanePowerStateMachine.h"
#include "mission/system/objects/definitions.h"
#ifdef FSFW_OSAL_LINUX
class SpiComIF;

View File

@ -1,5 +1,6 @@
#include "ScexDeviceHandler.h"
#include <fsfw/filesystem/HasFileSystemIF.h>
#include <linux/devices/ScexHelper.h>
#include <mission/memory/SdCardMountedIF.h>
@ -27,6 +28,7 @@ void ScexDeviceHandler::doStartUp() { setMode(MODE_ON); }
void ScexDeviceHandler::doShutDown() {
reader.reset();
commandActive = false;
multiFileFinishOutstanding = false;
setMode(_MODE_POWER_DOWN);
}
@ -95,6 +97,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
<< remainingMillis << std::endl;
}
multiFileFinishOutstanding = true;
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
@ -104,6 +107,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
finishCountdown.setTimeout(LONG_CD);
// countdown starts
finishCountdown.resetTimer();
multiFileFinishOutstanding = true;
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
@ -113,6 +117,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
finishCountdown.setTimeout(LONG_CD);
// countdown starts
finishCountdown.resetTimer();
multiFileFinishOutstanding = true;
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
@ -172,17 +177,14 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI
sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis
<< std::endl;
}
finishAction(true, helper.getCmd(), OK);
result = APERIODIC_REPLY;
break;
}
case (ONE_CELL): {
finishAction(true, helper.getCmd(), OK);
result = APERIODIC_REPLY;
break;
}
case (ALL_CELLS_CMD): {
finishAction(true, helper.getCmd(), OK);
result = APERIODIC_REPLY;
break;
}
@ -190,6 +192,11 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI
break;
}
}
if (result == APERIODIC_REPLY and multiFileFinishOutstanding) {
finishAction(true, helper.getCmd(), OK);
multiFileFinishOutstanding = false;
}
*foundId = helper.getCmd();
*foundLen = remSize;
return result;
@ -200,6 +207,10 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
ReturnValue_t status = OK;
auto oneFileHandler = [&](std::string cmdName) {
auto activeSd = sdcMan.getActiveSdCard();
if (not activeSd) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
fileId = date_time_string();
std::ostringstream oss;
auto prefix = sdcMan.getCurrentMountPrefix();
@ -216,6 +227,10 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
};
auto multiFileHandler = [&](std::string cmdName) {
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
auto activeSd = sdcMan.getActiveSdCard();
if (not activeSd) {
return HasFileSystemIF::FILESYSTEM_INACTIVE;
}
fileId = date_time_string();
std::ostringstream oss;
auto prefix = sdcMan.getCurrentMountPrefix();
@ -241,6 +256,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
}
return OK;
};
id = helper.getCmd();
switch (id) {
case (PING): {
status = oneFileHandler("ping_");

View File

@ -28,6 +28,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
std::string fileName = "";
bool fileNameSet = false;
bool commandActive = false;
bool multiFileFinishOutstanding = false;
bool debugMode = false;
scex::Cmds currCmd = scex::Cmds::PING;

View File

@ -1,5 +1,6 @@
#include "SolarArrayDeploymentHandler.h"
#include <fsfw/filesystem/HasFileSystemIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <filesystem>
@ -150,7 +151,7 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(sd::SdCard sdCard, const
string line;
string word;
unsigned int lineNum = 0;
AutonomousDeplState deplState;
AutonomousDeplState deplState = AutonomousDeplState::INIT;
bool stateSwitch = false;
uint32_t secsSinceBoot = 0;
while (std::getline(file, line)) {

Some files were not shown because too many files have changed in this diff Show More