From df712c71000fa129a95bd2a6311a78a8109713e3 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 25 Mar 2022 17:48:38 +0100 Subject: [PATCH 001/361] scex reader task started --- bsp_linux_board/InitMission.cpp | 8 ++++++++ bsp_linux_board/ObjectFactory.cpp | 2 ++ linux/boardtest/UartTestClass.cpp | 1 + linux/devices/CMakeLists.txt | 3 +++ linux/devices/ScexUartReader.cpp | 18 ++++++++++++++++++ linux/devices/ScexUartReader.h | 18 ++++++++++++++++++ linux/fsfwconfig/objects/systemObjectList.h | 2 ++ 7 files changed, 52 insertions(+) create mode 100644 linux/devices/ScexUartReader.cpp create mode 100644 linux/devices/ScexUartReader.h diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 6dfe3af1..0a242209 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -228,7 +228,15 @@ void initmission::createTestTasks(TaskFactory& factory, if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } + PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask( + "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = scexReaderTask->addComponent(objects::SCEX_UART_READER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); + } + #endif /* RPI_ADD_GPIO_TEST == 1 */ + taskVec.push_back(scexReaderTask); taskVec.push_back(testTask); bool startTestPst = true; diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 18da8896..7df6b116 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -1,3 +1,4 @@ +#include #include "ObjectFactory.h" #include "OBSWConfig.h" @@ -182,6 +183,7 @@ void ObjectFactory::createTestTasks() { #endif #if OBSW_ADD_UART_TEST_CODE == 1 + new ScexUartReader(objects::SCEX_UART_READER); new UartTestClass(objects::UART_TEST); #else new UartComIF(objects::UART_COM_IF); diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 9c51ed8a..bfa735e9 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -197,6 +197,7 @@ void UartTestClass::scexPeriodic() { sif::info << "Received " << bytesRead << " bytes from the Solar Cell Experiment:" << std::endl; arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); + break; } } while (bytesRead > 0); } diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index 7d39837d..1130e7cd 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -4,4 +4,7 @@ if(EIVE_BUILD_GPSD_GPS_HANDLER) ) endif() +target_sources(${OBSW_NAME} PRIVATE + ScexUartReader.cpp +) add_subdirectory(startracker) diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp new file mode 100644 index 00000000..4aa78357 --- /dev/null +++ b/linux/devices/ScexUartReader.cpp @@ -0,0 +1,18 @@ +#include "ScexUartReader.h" +#include + + +ScexUartReader::ScexUartReader(object_id_t objectId):SystemObject(objectId) { +} + +void ScexUartRead::start() { + semaphore->give(); +} +ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { + std::cout<<"hallo welt"<take(); + while(true) { + semaphore->take(); + } + return RETURN_OK; +} diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h new file mode 100644 index 00000000..70eafcf7 --- /dev/null +++ b/linux/devices/ScexUartReader.h @@ -0,0 +1,18 @@ +#ifndef LINUX_DEVICES_SCEXUARTREADER_H_ +#define LINUX_DEVICES_SCEXUARTREADER_H_ +#include +#include + + +class ScexUartReader: public SystemObject, //strg+shift+n +public ExecutableObjectIF, +public HasReturnvaluesIF { +public: + ScexUartReader(object_id_t objectId); +private: + ReturnValue_t performOperation(uint8_t operationCode = 0) override; + +}; + + +#endif /* LINUX_DEVICES_SCEXUARTREADER_H_ */ diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index a03e4d38..5fbc99d5 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -49,6 +49,7 @@ enum sourceObjects : uint32_t { UART_COM_IF = 0x49030003, SPI_COM_IF = 0x49020004, GPIO_IF = 0x49010005, + SCEX_UART_READER = 0x49010006, /* Custom device handler */ PCDU_HANDLER = 0x442000A1, @@ -57,6 +58,7 @@ enum sourceObjects : uint32_t { HEATER_HANDLER = 0x444100A4, RAD_SENSOR = 0x443200A5, + /* 0x54 ('T') for test handlers */ TEST_TASK = 0x54694269, LIBGPIOD_TEST = 0x54123456, From 35f2d2cb9cb5c6df84ca782c5d86c44c4c1fd004 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 8 Apr 2022 15:25:07 +0200 Subject: [PATCH 002/361] solve merge comflioct --- linux/devices/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index b88d59fc..b8568560 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -4,11 +4,8 @@ if(EIVE_BUILD_GPSD_GPS_HANDLER) ) endif() -<<<<<<< HEAD target_sources(${OBSW_NAME} PRIVATE ScexUartReader.cpp ) -======= add_subdirectory(ploc) ->>>>>>> origin/develop add_subdirectory(startracker) From 01d86a0c7b9e0e3dc8f1d63642d3860d45332662 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 8 Apr 2022 19:12:21 +0200 Subject: [PATCH 003/361] huge progress --- bsp_linux_board/InitMission.cpp | 13 +- bsp_linux_board/ObjectFactory.cpp | 7 +- linux/boardtest/UartTestClass.cpp | 183 ++++++++++++-------- linux/boardtest/UartTestClass.h | 11 +- linux/devices/ScexUartReader.cpp | 176 +++++++++++++++++-- linux/devices/ScexUartReader.h | 53 +++++- linux/fsfwconfig/objects/systemObjectList.h | 1 - 7 files changed, 339 insertions(+), 105 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 7814b61d..f634e8d6 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -229,14 +229,13 @@ void initmission::createTestTasks(TaskFactory& factory, initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask( - "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); - result = scexReaderTask->addComponent(objects::SCEX_UART_READER); - if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); - } - -#endif /* RPI_ADD_GPIO_TEST == 1 */ + "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = scexReaderTask->addComponent(objects::SCEX_UART_READER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); + } taskVec.push_back(scexReaderTask); +#endif /* RPI_ADD_GPIO_TEST == 1 */ taskVec.push_back(testTask); bool startTestPst = true; diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 76d35c6b..6bfa487f 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -1,6 +1,7 @@ -#include #include "ObjectFactory.h" +#include + #include "OBSWConfig.h" #include "devConf.h" #include "devices/addresses.h" @@ -198,8 +199,8 @@ void ObjectFactory::createTestTasks() { #endif #if OBSW_ADD_UART_TEST_CODE == 1 - new ScexUartReader(objects::SCEX_UART_READER); - new UartTestClass(objects::UART_TEST); + auto scexReader = new ScexUartReader(objects::SCEX_UART_READER); + new UartTestClass(objects::UART_TEST, scexReader); #else new UartComIF(objects::UART_COM_IF); #endif diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index bfa735e9..0941e423 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -3,6 +3,8 @@ #include // Error integer and strerror() function #include // Contains file controls like O_RDWR #include +#include +#include #include // write(), read(), close() #include "OBSWConfig.h" @@ -18,7 +20,11 @@ #define RPI_TEST_GPS_HANDLER 0 #endif -UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) { mode = TestModes::SCEX; } +UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) + : TestTask(objectId), reader(reader) { + mode = TestModes::SCEX; + scexMode = ScexModes::READER_TASK; +} ReturnValue_t UartTestClass::initialize() { if (mode == TestModes::GPS) { @@ -127,100 +133,129 @@ void UartTestClass::gpsPeriodic() { } void UartTestClass::scexInit() { -#if defined(RASPBERRY_PI) - std::string devname = "/dev/serial0"; -#else - std::string devname = "/dev/ul-scex"; -#endif - /* Get file descriptor */ - serialPort = open(devname.c_str(), O_RDWR); - if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) - << std::endl; + if (reader == nullptr) { + sif::warning << "UartTestClass::scexInit: Reader invalid" << std::endl; return; } - // Setting up UART parameters - tty.c_cflag &= ~PARENB; // Clear parity bit - tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication - tty.c_cflag &= ~CSIZE; // Clear all the size bits - tty.c_cflag |= CS8; // 8 bits per byte - tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control - tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) + if (scexMode == ScexModes::SIMPLE) { +#if defined(RASPBERRY_PI) + std::string devname = "/dev/serial0"; +#else + std::string devname = "/dev/ul-scex"; +#endif + /* Get file descriptor */ + serialPort = open(devname.c_str(), O_RDWR); + if (serialPort < 0) { + sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + return; + } + // Setting up UART parameters + tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSIZE; // Clear all the size bits + tty.c_cflag |= CS8; // 8 bits per byte + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) - // Use non-canonical mode and clear echo flag - tty.c_lflag &= ~(ICANON | ECHO); + // Use non-canonical mode and clear echo flag + tty.c_lflag &= ~(ICANON | ECHO); - // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are - // received in one go - tty.c_cc[VTIME] = 1; // In units of 0.1 seconds - tty.c_cc[VMIN] = 255; // Read up to 255 bytes + // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are + // received in one go + tty.c_cc[VTIME] = 1; // In units of 0.1 seconds + tty.c_cc[VMIN] = 255; // Read up to 255 bytes - // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. + // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) - if (cfsetispeed(&tty, B57600) != 0) { - sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; - } + if (cfsetispeed(&tty, B57600) != 0) { + sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; + } #endif - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) - << std::endl; + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + } + // Flush received and unread data + tcflush(serialPort, TCIFLUSH); + } else { +#if defined(RASPBERRY_PI) + std::string devname = "/dev/serial0"; +#else + std::string devname = "/dev/ul-scex"; +#endif + uartCookie = + new UartCookie(this->getObjectId(), devname, UartModes::NON_CANONICAL, 57600, 4096); + reader->setDebugMode(true); + ReturnValue_t result = reader->initializeInterface(uartCookie); } - // Flush received and unread data - tcflush(serialPort, TCIFLUSH); } void UartTestClass::scexPeriodic() { - sif::info << "UartTestClass::scexInit: Sending ping command to SCEX" << std::endl; - int result = prepareScexPing(); - if (result != 0) { + if (reader == nullptr) { return; - }; - size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); - if (bytesWritten != encodedLen) { - sif::warning << "Sending ping command to solar experiment failed" << std::endl; } - // Read back reply immediately - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno - << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - sif::info << "Received " << bytesRead - << " bytes from the Solar Cell Experiment:" << std::endl; - arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); - break; + if (scexMode == ScexModes::SIMPLE) { + sif::info << "UartTestClass::scexInit: Sending ping command to SCEX" << std::endl; + // reader->sendMessage(nullptr, nullptr, 0); + uint8_t tmpCmdBuf[32] = {}; + size_t len = 0; + prepareScexPing(tmpCmdBuf, &len); + ReturnValue_t result = + dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + return; } - } while (bytesRead > 0); + if (result != 0) { + return; + }; + size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); + if (bytesWritten != encodedLen) { + sif::warning << "Sending ping command to solar experiment failed" << std::endl; + } + + // Read back reply immediately + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" + << errno << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + sif::info << "Received " << bytesRead + << " bytes from the Solar Cell Experiment:" << std::endl; + arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); + break; + } + } while (bytesRead > 0); + } else { + size_t len = 0; + prepareScexPing(cmdBuf.data(), &len); + reader->sendMessage(uartCookie, cmdBuf.data(), len); + } } -int UartTestClass::prepareScexPing() { - std::array tmpCmdBuf = {}; +int UartTestClass::prepareScexPing(uint8_t* cmdBuf, size_t* len) { // Send ping command - tmpCmdBuf[0] = scex::CMD_PING; + cmdBuf[0] = scex::CMD_PING; // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each // telecommand so far - tmpCmdBuf[1] = 1; - tmpCmdBuf[2] = 1; + cmdBuf[1] = 1; + cmdBuf[2] = 1; uint16_t userDataLen = 0; - tmpCmdBuf[3] = (userDataLen >> 8) & 0xff; - tmpCmdBuf[4] = userDataLen & 0xff; - uint16_t crc = CRC::crc16ccitt(tmpCmdBuf.data(), 5); - tmpCmdBuf[5] = (crc >> 8) & 0xff; - tmpCmdBuf[6] = crc & 0xff; - ReturnValue_t result = - dleEncoder.encode(tmpCmdBuf.data(), 7, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; - return -1; - } + cmdBuf[3] = (userDataLen >> 8) & 0xff; + cmdBuf[4] = userDataLen & 0xff; + uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); + cmdBuf[5] = (crc >> 8) & 0xff; + cmdBuf[6] = crc & 0xff; + *len = 7; return 0; } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 786d01ce..17fdca59 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -2,6 +2,7 @@ #define LINUX_BOARDTEST_UARTTESTCLASS_H_ #include +#include #include // Contains POSIX terminal control definitions #include @@ -9,9 +10,11 @@ #include "lwgps/lwgps.h" #include "test/testtasks/TestTask.h" +class ScexUartReader; + class UartTestClass : public TestTask { public: - UartTestClass(object_id_t objectId); + UartTestClass(object_id_t objectId, ScexUartReader* reader); ReturnValue_t initialize() override; ReturnValue_t performOneShotAction() override; @@ -24,14 +27,17 @@ class UartTestClass : public TestTask { SCEX }; + enum ScexModes { SIMPLE, READER_TASK } scexMode; + void gpsInit(); void gpsPeriodic(); void scexInit(); void scexPeriodic(); - int prepareScexPing(); + int prepareScexPing(uint8_t* cmdBuf, size_t* len); TestModes mode = TestModes::GPS; DleEncoder dleEncoder = DleEncoder(); + UartCookie* uartCookie = nullptr; size_t encodedLen = 0; lwgps_t gpsData = {}; struct termios tty = {}; @@ -39,6 +45,7 @@ class UartTestClass : public TestTask { std::array cmdBuf = {}; std::array recBuf = {}; uint8_t recvCnt = 0; + ScexUartReader* reader = nullptr; }; #endif /* LINUX_BOARDTEST_UARTTESTCLASS_H_ */ diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 4aa78357..a35f153f 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -1,18 +1,174 @@ #include "ScexUartReader.h" + +#include // Contains file controls like O_RDWR +#include +#include +#include +#include +#include +#include // write(), read(), close() + +#include // Error integer and strerror() function #include +#include "OBSWConfig.h" -ScexUartReader::ScexUartReader(object_id_t objectId):SystemObject(objectId) { +ScexUartReader::ScexUartReader(object_id_t objectId) + : SystemObject(objectId), ringBuffer(200 * 2048, true), sizesQueue(200) { + semaphore = SemaphoreFactory::instance()->createBinarySemaphore(); + semaphore->acquire(); + lock = MutexFactory::instance()->createMutex(); } -void ScexUartRead::start() { - semaphore->give(); -} +// void ScexUartRead::start() { /* semaphore->give(); */ } ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { - std::cout<<"hallo welt"<take(); - while(true) { - semaphore->take(); - } - return RETURN_OK; + lock->lockMutex(); + state = States::IDLE; + lock->unlockMutex(); + while (true) { + semaphore->acquire(); + std::cout << "task was started" << std::endl; + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead == 0) { + MutexGuard mg(lock); + States currentState = state; + if (currentState == States::FINISH) { + state = States::IDLE; + break; + } + } else if (bytesRead < 0) { + sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno + << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::error << "ScexUartReader::performOperation: Receive buffer too small" << std::endl; + } else if (bytesRead > 0) { + MutexGuard mg(lock); + sizesQueue.insert(bytesRead); + ReturnValue_t result = ringBuffer.writeData(recBuf.data(), bytesRead); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "ScexUartReader::performOperation: Writing into ring buffer failed" + << std::endl; + } + if (debugMode) { + sif::info << "Received " << bytesRead + << " bytes from the Solar Cell Experiment:" << std::endl; + arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); + } + break; + } + } while (bytesRead > 0); + // task block comes here + std::cout << "done" << std::endl; + } + return RETURN_OK; +} + +ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { + UartCookie *uartCookie = dynamic_cast(cookie); + if (uartCookie) { + return RETURN_FAILED; + } + std::string devname = uartCookie->getDeviceFile(); + /* Get file descriptor */ + serialPort = open(devname.c_str(), O_RDWR); + if (serialPort < 0) { + sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + // Setting up UART parameters + tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSIZE; // Clear all the size bits + tty.c_cflag |= CS8; // 8 bits per byte + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) + + // Use non-canonical mode and clear echo flag + tty.c_lflag &= ~(ICANON | ECHO); + + // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are + // received in one go + tty.c_cc[VTIME] = 20; // Read for up to 2 seconds + tty.c_cc[VMIN] = 0; // Read as much as there is available + + // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. +#if !defined(XIPHOS_Q7S) + if (cfsetispeed(&tty, B57600) != 0) { + sif::warning << "ScexUartReader::initializeInterface: Setting baud rate failed" << std::endl; + } +#endif + + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + } + // Flush received and unread data + tcflush(serialPort, TCIFLUSH); + return RETURN_OK; +} + +ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendData, + size_t sendLen) { + lock->lockMutex(); + if (state == States::NOT_READY or state == States::RUNNING) { + lock->unlockMutex(); + return HasReturnvaluesIF::RETURN_FAILED; + } + state = States::RUNNING; + lock->unlockMutex(); + size_t encodedLen = 0; + ReturnValue_t result = + dleEncoder.encode(sendData, sendLen, cmdbuf.data(), cmdbuf.size(), &encodedLen, true); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + return RETURN_FAILED; + } + size_t bytesWritten = write(serialPort, cmdbuf.data(), encodedLen); + if (bytesWritten != encodedLen) { + sif::warning << "Sending ping command to solar experiment failed" << std::endl; + return RETURN_FAILED; + } + result = semaphore->release(); + if (result != HasReturnvaluesIF::RETURN_OK) { + std::cout << "ScexUartReader::sendMessag: Releasing semaphore failed" << std::endl; + } + return RETURN_OK; +} + +ReturnValue_t ScexUartReader::getSendSuccess(CookieIF *cookie) { return RETURN_OK; } + +ReturnValue_t ScexUartReader::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + return RETURN_OK; +} + +void ScexUartReader::setDebugMode(bool enable) { this->debugMode = enable; } + +ReturnValue_t ScexUartReader::finish() { + MutexGuard mg(lock); + if (state == States::IDLE) { + return HasReturnvaluesIF::RETURN_FAILED; + } + state = States::FINISH; + return RETURN_OK; +} + +ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) { + MutexGuard mg(lock); + if (sizesQueue.empty()) { + *size = 0; + return RETURN_OK; + } + *size = sizesQueue.pop(); + *buffer = ipcBuffer.data(); + ReturnValue_t result = ringBuffer.readData(ipcBuffer.data(), *size, true); + if (result != RETURN_OK) { + sif::warning << "ScexUartReader::readReceivedMessage: Reading RingBuffer failed" << std::endl; + } + return RETURN_OK; } diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h index 70eafcf7..13ff7d73 100644 --- a/linux/devices/ScexUartReader.h +++ b/linux/devices/ScexUartReader.h @@ -1,18 +1,55 @@ #ifndef LINUX_DEVICES_SCEXUARTREADER_H_ #define LINUX_DEVICES_SCEXUARTREADER_H_ + +#include +#include +#include +#include #include #include +#include +#include // Contains POSIX terminal control definitions +class SemaphoreIF; +class MutexIF; -class ScexUartReader: public SystemObject, //strg+shift+n -public ExecutableObjectIF, -public HasReturnvaluesIF { -public: - ScexUartReader(object_id_t objectId); -private: - ReturnValue_t performOperation(uint8_t operationCode = 0) override; +class ScexUartReader : public SystemObject, // strg+shift+n + public ExecutableObjectIF, + public DeviceCommunicationIF { + friend class UartTestClass; + public: + enum class States { NOT_READY, IDLE, RUNNING, FINISH }; + ScexUartReader(object_id_t objectId); + + ReturnValue_t finish(); + void setDebugMode(bool enable); + + private: + SemaphoreIF *semaphore; + bool debugMode = false; + MutexIF *lock; + int serialPort = 0; + States state = States::IDLE; + struct termios tty = {}; + bool doFinish = false; + DleEncoder dleEncoder = DleEncoder(); + SimpleRingBuffer ringBuffer; + DynamicFIFO sizesQueue; + Countdown finishCoutdown = Countdown(180 * 1000); + std::array cmdbuf = {}; + std::array recBuf = {}; + + std::array ipcBuffer = {}; + + ReturnValue_t performOperation(uint8_t operationCode = 0) override; + + // DeviceCommunicationIF implementation + ReturnValue_t initializeInterface(CookieIF *cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override; }; - #endif /* LINUX_DEVICES_SCEXUARTREADER_H_ */ diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index 5fbc99d5..3d8edba2 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -58,7 +58,6 @@ enum sourceObjects : uint32_t { HEATER_HANDLER = 0x444100A4, RAD_SENSOR = 0x443200A5, - /* 0x54 ('T') for test handlers */ TEST_TASK = 0x54694269, LIBGPIOD_TEST = 0x54123456, From 6071e34771af2d62e48b2c7a1f47eafb1b07dd6c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Apr 2022 21:16:02 +0200 Subject: [PATCH 004/361] some refactoring --- linux/boardtest/UartTestClass.cpp | 174 ++++++++++--------- linux/boardtest/UartTestClass.h | 4 + linux/devices/GPSHyperionLinuxController.cpp | 1 - mission/devices/P60DockHandler.cpp | 2 +- tmtc | 2 +- 5 files changed, 100 insertions(+), 83 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 0941e423..6ca8ef9a 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -23,7 +23,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) : TestTask(objectId), reader(reader) { mode = TestModes::SCEX; - scexMode = ScexModes::READER_TASK; + scexMode = ScexModes::SIMPLE; } ReturnValue_t UartTestClass::initialize() { @@ -138,47 +138,7 @@ void UartTestClass::scexInit() { return; } if (scexMode == ScexModes::SIMPLE) { -#if defined(RASPBERRY_PI) - std::string devname = "/dev/serial0"; -#else - std::string devname = "/dev/ul-scex"; -#endif - /* Get file descriptor */ - serialPort = open(devname.c_str(), O_RDWR); - if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - return; - } - // Setting up UART parameters - tty.c_cflag &= ~PARENB; // Clear parity bit - tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication - tty.c_cflag &= ~CSIZE; // Clear all the size bits - tty.c_cflag |= CS8; // 8 bits per byte - tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control - tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) - - // Use non-canonical mode and clear echo flag - tty.c_lflag &= ~(ICANON | ECHO); - - // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are - // received in one go - tty.c_cc[VTIME] = 1; // In units of 0.1 seconds - tty.c_cc[VMIN] = 255; // Read up to 255 bytes - - // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. -#if !defined(XIPHOS_Q7S) - if (cfsetispeed(&tty, B57600) != 0) { - sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; - } -#endif - - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - } - // Flush received and unread data - tcflush(serialPort, TCIFLUSH); + scexSimpleInit(); } else { #if defined(RASPBERRY_PI) std::string devname = "/dev/serial0"; @@ -189,6 +149,11 @@ void UartTestClass::scexInit() { new UartCookie(this->getObjectId(), devname, UartModes::NON_CANONICAL, 57600, 4096); reader->setDebugMode(true); ReturnValue_t result = reader->initializeInterface(uartCookie); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::gpsPeriodic: Initializing SCEX reader " + "UART IF failed" + << std::endl; + } } } @@ -198,44 +163,7 @@ void UartTestClass::scexPeriodic() { } if (scexMode == ScexModes::SIMPLE) { - sif::info << "UartTestClass::scexInit: Sending ping command to SCEX" << std::endl; - // reader->sendMessage(nullptr, nullptr, 0); - uint8_t tmpCmdBuf[32] = {}; - size_t len = 0; - prepareScexPing(tmpCmdBuf, &len); - ReturnValue_t result = - dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; - return; - } - if (result != 0) { - return; - }; - size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); - if (bytesWritten != encodedLen) { - sif::warning << "Sending ping command to solar experiment failed" << std::endl; - } - - // Read back reply immediately - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" - << errno << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - sif::info << "Received " << bytesRead - << " bytes from the Solar Cell Experiment:" << std::endl; - arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); - break; - } - } while (bytesRead > 0); + scexSimplePeriodic(); } else { size_t len = 0; prepareScexPing(cmdBuf.data(), &len); @@ -259,3 +187,89 @@ int UartTestClass::prepareScexPing(uint8_t* cmdBuf, size_t* len) { *len = 7; return 0; } + +void UartTestClass::scexSimplePeriodic() { + sif::info << "UartTestClass::scexInit: Sending ping command to SCEX" << std::endl; + uint8_t tmpCmdBuf[32] = {}; + size_t len = 0; + prepareScexPing(tmpCmdBuf, &len); + ReturnValue_t result = + dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + return; + } + if (result != 0) { + return; + }; + size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); + if (bytesWritten != encodedLen) { + sif::warning << "Sending ping command to solar experiment failed" << std::endl; + } + + // Read back reply immediately + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead == 0) { + sif::warning << "Reading SCEX: Timeout occured after 0.5 seconds" << std::endl; + } else if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno + << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + sif::info << "Received " << bytesRead + << " bytes from the Solar Cell Experiment:" << std::endl; + arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); + break; + } + } while (bytesRead > 0); +} + +void UartTestClass::scexSimpleInit() { +#if defined(RASPBERRY_PI) + std::string devname = "/dev/serial0"; +#else + std::string devname = "/dev/ul-scex"; +#endif + /* Get file descriptor */ + serialPort = open(devname.c_str(), O_RDWR); + if (serialPort < 0) { + sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + return; + } + // Setting up UART parameters + tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSIZE; // Clear all the size bits + tty.c_cflag |= CS8; // 8 bits per byte + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) + + // Use non-canonical mode and clear echo flag + tty.c_lflag &= ~(ICANON | ECHO); + + // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are + // received in one go + tty.c_cc[VTIME] = 5; // In units of 0.1 seconds + tty.c_cc[VMIN] = 1; // Read up to 255 bytes + + // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. +#if !defined(XIPHOS_Q7S) + if (cfsetispeed(&tty, B57600) != 0) { + sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; + } +#endif + + // Flush received and unread data + tcflush(serialPort, TCIOFLUSH); + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + } +} diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 17fdca59..7c046931 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -35,6 +35,10 @@ class UartTestClass : public TestTask { void scexInit(); void scexPeriodic(); int prepareScexPing(uint8_t* cmdBuf, size_t* len); + + void scexSimplePeriodic(); + void scexSimpleInit(); + TestModes mode = TestModes::GPS; DleEncoder dleEncoder = DleEncoder(); UartCookie* uartCookie = nullptr; diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index d1ef7d1b..20860211 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -3,7 +3,6 @@ #include "OBSWConfig.h" #include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/timemanager/Clock.h" - #include "linux/utility/utility.h" #include "mission/utility/compileTime.h" diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index d37673fc..508471d2 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -111,7 +111,7 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) { dataOffset += 6; coreHk.bootCount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3); - if(firstHk) { + if (firstHk) { triggerEvent(P60_BOOT_COUNT, coreHk.bootCount.value); } dataOffset += 6; diff --git a/tmtc b/tmtc index 3a1c7c62..091cf2dd 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 3a1c7c62887eb377c498bd9cdac47b93f40c85ba +Subproject commit 091cf2dd632c71a0fa8000312bb11e84f1a755db From 44c8f5f7307549b2c7399fcdcf2f5014d25b2ee4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 9 Apr 2022 01:00:42 +0200 Subject: [PATCH 005/361] bugfix for SCEX --- bsp_linux_board/ObjectFactory.cpp | 2 +- linux/boardtest/UartTestClass.cpp | 99 ++++++++++--------- linux/boardtest/UartTestClass.h | 4 +- .../devicedefinitions/SCEXDefinitions.h | 12 ++- 4 files changed, 66 insertions(+), 51 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 6bfa487f..fe6a0fa3 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -78,7 +78,7 @@ void ObjectFactory::produce(void* args) { createRpiAcsBoard(gpioIF, spiDev); #endif -#if OBSW_ADD_SUN_SENSORS == 1 || defined(OBSW_ADD_RTD_DEVICES) +#if OBSW_ADD_SUN_SENSORS == 1 || OBSW_ADD_RTD_DEVICES == 1 #ifdef RASPBERRY_PI rpi::gpio::initSpiCsDecoder(gpioIF); #endif diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 6ca8ef9a..a59dc4ea 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -12,7 +12,6 @@ #include "fsfw/globalfunctions/DleEncoder.h" #include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/serviceinterface.h" -#include "mission/devices/devicedefinitions/SCEXDefinitions.h" #define GPS_REPLY_WIRETAPPING 0 @@ -24,6 +23,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) : TestTask(objectId), reader(reader) { mode = TestModes::SCEX; scexMode = ScexModes::SIMPLE; + currCmd = scex::ScexCmds::ONE_CELL; } ReturnValue_t UartTestClass::initialize() { @@ -166,14 +166,16 @@ void UartTestClass::scexPeriodic() { scexSimplePeriodic(); } else { size_t len = 0; - prepareScexPing(cmdBuf.data(), &len); + prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len); reader->sendMessage(uartCookie, cmdBuf.data(), len); } } -int UartTestClass::prepareScexPing(uint8_t* cmdBuf, size_t* len) { +int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, + uint8_t* cmdBuf, size_t* len) { + using namespace scex; // Send ping command - cmdBuf[0] = scex::CMD_PING; + cmdBuf[0] = scex::createCmdByte(cmd, false); // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each // telecommand so far cmdBuf[1] = 1; @@ -188,48 +190,6 @@ int UartTestClass::prepareScexPing(uint8_t* cmdBuf, size_t* len) { return 0; } -void UartTestClass::scexSimplePeriodic() { - sif::info << "UartTestClass::scexInit: Sending ping command to SCEX" << std::endl; - uint8_t tmpCmdBuf[32] = {}; - size_t len = 0; - prepareScexPing(tmpCmdBuf, &len); - ReturnValue_t result = - dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; - return; - } - if (result != 0) { - return; - }; - size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); - if (bytesWritten != encodedLen) { - sif::warning << "Sending ping command to solar experiment failed" << std::endl; - } - - // Read back reply immediately - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead == 0) { - sif::warning << "Reading SCEX: Timeout occured after 0.5 seconds" << std::endl; - } else if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno - << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - sif::info << "Received " << bytesRead - << " bytes from the Solar Cell Experiment:" << std::endl; - arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); - break; - } - } while (bytesRead > 0); -} - void UartTestClass::scexSimpleInit() { #if defined(RASPBERRY_PI) std::string devname = "/dev/serial0"; @@ -256,8 +216,8 @@ void UartTestClass::scexSimpleInit() { // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are // received in one go - tty.c_cc[VTIME] = 5; // In units of 0.1 seconds - tty.c_cc[VMIN] = 1; // Read up to 255 bytes + tty.c_cc[VTIME] = 0; // In units of 0.1 seconds + tty.c_cc[VMIN] = 0; // Read up to 255 bytes // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) @@ -273,3 +233,46 @@ void UartTestClass::scexSimpleInit() { << std::endl; } } + +void UartTestClass::scexSimplePeriodic() { + using namespace scex; + sif::info << "UartTestClass::scexInit: Sending ping command to SCEX" << std::endl; + uint8_t tmpCmdBuf[32] = {}; + size_t len = 0; + prepareScexCmd(currCmd, false, tmpCmdBuf, &len); + ReturnValue_t result = + dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + return; + } + if (result != 0) { + return; + }; + size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); + if (bytesWritten != encodedLen) { + sif::warning << "Sending ping command to solar experiment failed" << std::endl; + } + + // Read back reply immediately + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead == 0) { + sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; + } else if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno + << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + sif::info << "Received " << bytesRead + << " bytes from the Solar Cell Experiment:" << std::endl; + arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); + break; + } + } while (bytesRead > 0); +} diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 7c046931..3836506c 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -8,6 +8,7 @@ #include #include "lwgps/lwgps.h" +#include "mission/devices/devicedefinitions/SCEXDefinitions.h" #include "test/testtasks/TestTask.h" class ScexUartReader; @@ -34,11 +35,12 @@ class UartTestClass : public TestTask { void scexInit(); void scexPeriodic(); - int prepareScexPing(uint8_t* cmdBuf, size_t* len); + int prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len); void scexSimplePeriodic(); void scexSimpleInit(); + scex::ScexCmds currCmd = scex::ScexCmds::PING; TestModes mode = TestModes::GPS; DleEncoder dleEncoder = DleEncoder(); UartCookie* uartCookie = nullptr; diff --git a/mission/devices/devicedefinitions/SCEXDefinitions.h b/mission/devices/devicedefinitions/SCEXDefinitions.h index 8becabc8..f9c532ff 100644 --- a/mission/devices/devicedefinitions/SCEXDefinitions.h +++ b/mission/devices/devicedefinitions/SCEXDefinitions.h @@ -6,7 +6,17 @@ // Definitions for the Solar Cell Experiment namespace scex { -static constexpr uint8_t CMD_PING = 0x4e; +enum ScexCmds: uint8_t { + PING = 0b00111, + ONE_CELL = 0b00110 +}; + +static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0; +static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1; + +uint8_t createCmdByte(ScexCmds cmd, bool tempCheck) { + return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck; +} } From 808e01dfd360e7894d0aba11f985ea42cc7318ac Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 9 Apr 2022 14:43:06 +0200 Subject: [PATCH 006/361] DLE FRAM packets can be read now --- fsfw | 2 +- linux/boardtest/UartTestClass.cpp | 152 ++++++++++-------- linux/boardtest/UartTestClass.h | 20 ++- linux/devices/CMakeLists.txt | 1 + linux/devices/ScexDleParser.cpp | 6 + linux/devices/ScexDleParser.h | 12 ++ linux/devices/ScexUartReader.cpp | 37 +++-- linux/devices/ScexUartReader.h | 16 +- linux/fsfwconfig/OBSWConfig.h.in | 2 + mission/devices/CMakeLists.txt | 2 + .../devices/devicedefinitions/CMakeLists.txt | 3 + .../devicedefinitions/ScexDefinitions.cpp | 5 + .../{SCEXDefinitions.h => ScexDefinitions.h} | 11 +- 13 files changed, 176 insertions(+), 93 deletions(-) create mode 100644 linux/devices/ScexDleParser.cpp create mode 100644 linux/devices/ScexDleParser.h create mode 100644 mission/devices/devicedefinitions/CMakeLists.txt create mode 100644 mission/devices/devicedefinitions/ScexDefinitions.cpp rename mission/devices/devicedefinitions/{SCEXDefinitions.h => ScexDefinitions.h} (63%) diff --git a/fsfw b/fsfw index 85a6e4b1..bdddee4f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 85a6e4b12977f24247ed3ca3011c6f8b611a144e +Subproject commit bdddee4f81fbdff7f207fd03b3c592522e04c5aa diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index a59dc4ea..0a164c8b 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -4,6 +4,7 @@ #include // Contains file controls like O_RDWR #include #include +#include #include #include // write(), read(), close() @@ -20,10 +21,15 @@ #endif UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) - : TestTask(objectId), reader(reader) { + : TestTask(objectId), reader(reader), decodeRingBuf(4096, true) { mode = TestModes::SCEX; scexMode = ScexModes::SIMPLE; - currCmd = scex::ScexCmds::ONE_CELL; + currCmd = scex::ScexCmds::FRAM; + if (mode == TestModes::SCEX) { + dleParser = + new ScexDleParser(decodeRingBuf, dleEncoder, {encodedBuf.data(), encodedBuf.size()}, + {decodedBuf.data(), decodedBuf.size()}, &foundDlePacketHandler, this); + } } ReturnValue_t UartTestClass::initialize() { @@ -145,8 +151,7 @@ void UartTestClass::scexInit() { #else std::string devname = "/dev/ul-scex"; #endif - uartCookie = - new UartCookie(this->getObjectId(), devname, UartModes::NON_CANONICAL, 57600, 4096); + uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); reader->setDebugMode(true); ReturnValue_t result = reader->initializeInterface(uartCookie); if (result != HasReturnvaluesIF::RETURN_OK) { @@ -171,25 +176,6 @@ void UartTestClass::scexPeriodic() { } } -int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, - uint8_t* cmdBuf, size_t* len) { - using namespace scex; - // Send ping command - cmdBuf[0] = scex::createCmdByte(cmd, false); - // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each - // telecommand so far - cmdBuf[1] = 1; - cmdBuf[2] = 1; - uint16_t userDataLen = 0; - cmdBuf[3] = (userDataLen >> 8) & 0xff; - cmdBuf[4] = userDataLen & 0xff; - uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); - cmdBuf[5] = (crc >> 8) & 0xff; - cmdBuf[6] = crc & 0xff; - *len = 7; - return 0; -} - void UartTestClass::scexSimpleInit() { #if defined(RASPBERRY_PI) std::string devname = "/dev/serial0"; @@ -216,8 +202,8 @@ void UartTestClass::scexSimpleInit() { // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are // received in one go - tty.c_cc[VTIME] = 0; // In units of 0.1 seconds - tty.c_cc[VMIN] = 0; // Read up to 255 bytes + tty.c_cc[VTIME] = 10; // In units of 0.1 seconds + tty.c_cc[VMIN] = 255; // Read up to 255 bytes // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) @@ -226,53 +212,89 @@ void UartTestClass::scexSimpleInit() { } #endif - // Flush received and unread data - tcflush(serialPort, TCIOFLUSH); if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) << std::endl; } + // Flush received and unread data + tcflush(serialPort, TCIOFLUSH); } void UartTestClass::scexSimplePeriodic() { using namespace scex; - sif::info << "UartTestClass::scexInit: Sending ping command to SCEX" << std::endl; - uint8_t tmpCmdBuf[32] = {}; - size_t len = 0; - prepareScexCmd(currCmd, false, tmpCmdBuf, &len); - ReturnValue_t result = - dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; - return; - } - if (result != 0) { - return; - }; - size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); - if (bytesWritten != encodedLen) { - sif::warning << "Sending ping command to solar experiment failed" << std::endl; - } - - // Read back reply immediately - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead == 0) { - sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; - } else if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno - << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - sif::info << "Received " << bytesRead - << " bytes from the Solar Cell Experiment:" << std::endl; - arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); - break; + ReturnValue_t result = RETURN_OK; + if (not cmdSent) { + // Flush received and unread data + tcflush(serialPort, TCIFLUSH); + uint8_t tmpCmdBuf[32] = {}; + size_t len = 0; + sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl; + prepareScexCmd(currCmd, false, tmpCmdBuf, &len); + result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + return; } - } while (bytesRead > 0); + if (result != 0) { + return; + }; + size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); + if (bytesWritten != encodedLen) { + sif::warning << "Sending command to solar experiment failed" << std::endl; + } + cmdSent = true; + cmdDone = false; + } + if (not cmdDone) { + // Read back reply immediately + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead == 0) { + sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; + } else if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" + << errno << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + dleParser->passData(recBuf.data(), bytesRead); + if (currCmd == ScexCmds::PING) { + cmdDone = true; + cmdSent = false; + } + } + } while (bytesRead > 0); + } +} + +int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, + size_t* len) { + using namespace scex; + // Send ping command + cmdBuf[0] = scex::createCmdByte(cmd, false); + // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each + // telecommand so far + cmdBuf[1] = 1; + cmdBuf[2] = 1; + uint16_t userDataLen = 0; + cmdBuf[3] = (userDataLen >> 8) & 0xff; + cmdBuf[4] = userDataLen & 0xff; + uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); + cmdBuf[5] = (crc >> 8) & 0xff; + cmdBuf[6] = crc & 0xff; + *len = 7; + return 0; +} + +void UartTestClass::foundDlePacketHandler(uint8_t* packet, size_t len, void* args) { + UartTestClass* obj = reinterpret_cast(args); + obj->handleFoundDlePacket(packet, len); +} + +void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { + sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 3836506c..b080f8a3 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -1,6 +1,7 @@ #ifndef LINUX_BOARDTEST_UARTTESTCLASS_H_ #define LINUX_BOARDTEST_UARTTESTCLASS_H_ +#include #include #include #include // Contains POSIX terminal control definitions @@ -8,10 +9,11 @@ #include #include "lwgps/lwgps.h" -#include "mission/devices/devicedefinitions/SCEXDefinitions.h" +#include "mission/devices/devicedefinitions/ScexDefinitions.h" #include "test/testtasks/TestTask.h" class ScexUartReader; +class ScexDleParser; class UartTestClass : public TestTask { public: @@ -40,6 +42,11 @@ class UartTestClass : public TestTask { void scexSimplePeriodic(); void scexSimpleInit(); + static void foundDlePacketHandler(uint8_t* packet, size_t len, void* args); + void handleFoundDlePacket(uint8_t* packet, size_t len); + + bool cmdSent = false; + bool cmdDone = false; scex::ScexCmds currCmd = scex::ScexCmds::PING; TestModes mode = TestModes::GPS; DleEncoder dleEncoder = DleEncoder(); @@ -48,10 +55,15 @@ class UartTestClass : public TestTask { lwgps_t gpsData = {}; struct termios tty = {}; int serialPort = 0; - std::array cmdBuf = {}; - std::array recBuf = {}; - uint8_t recvCnt = 0; + bool startFound = false; ScexUartReader* reader = nullptr; + SimpleRingBuffer decodeRingBuf; + std::array cmdBuf = {}; + std::array recBuf = {}; + std::array encodedBuf = {}; + std::array decodedBuf = {}; + ScexDleParser* dleParser; + uint8_t recvCnt = 0; }; #endif /* LINUX_BOARDTEST_UARTTESTCLASS_H_ */ diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index b8568560..6be5da2f 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -6,6 +6,7 @@ endif() target_sources(${OBSW_NAME} PRIVATE ScexUartReader.cpp + ScexDleParser.cpp ) add_subdirectory(ploc) add_subdirectory(startracker) diff --git a/linux/devices/ScexDleParser.cpp b/linux/devices/ScexDleParser.cpp new file mode 100644 index 00000000..f2620b8e --- /dev/null +++ b/linux/devices/ScexDleParser.cpp @@ -0,0 +1,6 @@ +#include "ScexDleParser.h" + +ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, + BufPair encodedBuf, BufPair decodedBuf, FoundPacketHandler handler, + void *args) + : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {} diff --git a/linux/devices/ScexDleParser.h b/linux/devices/ScexDleParser.h new file mode 100644 index 00000000..d914cdaf --- /dev/null +++ b/linux/devices/ScexDleParser.h @@ -0,0 +1,12 @@ +#ifndef LINUX_DEVICES_SCEXDLEPARSER_H_ +#define LINUX_DEVICES_SCEXDLEPARSER_H_ + +#include + +class ScexDleParser : public DleParser { + public: + ScexDleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf, + BufPair decodedBuf, FoundPacketHandler handler, void* args); +}; + +#endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */ diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index a35f153f..8017e8c6 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include // write(), read(), close() #include // Error integer and strerror() function @@ -14,7 +15,12 @@ #include "OBSWConfig.h" ScexUartReader::ScexUartReader(object_id_t objectId) - : SystemObject(objectId), ringBuffer(200 * 2048, true), sizesQueue(200) { + : SystemObject(objectId), + decodeRingBuf(4096, true), + ipcRingBuf(200 * 2048, true), + ipcQueue(200), + dleParser(decodeRingBuf, dleEncoder, {encodedBuf.data(), encodedBuf.size()}, + {decodedBuf.data(), decodedBuf.size()}, &foundDlePacketHandler, this) { semaphore = SemaphoreFactory::instance()->createBinarySemaphore(); semaphore->acquire(); lock = MutexFactory::instance()->createMutex(); @@ -47,10 +53,10 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { sif::error << "ScexUartReader::performOperation: Receive buffer too small" << std::endl; } else if (bytesRead > 0) { MutexGuard mg(lock); - sizesQueue.insert(bytesRead); - ReturnValue_t result = ringBuffer.writeData(recBuf.data(), bytesRead); + ipcQueue.insert(bytesRead); + ReturnValue_t result = dleParser.passData(recBuf.data(), bytesRead); if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "ScexUartReader::performOperation: Writing into ring buffer failed" + sif::warning << "ScexUartReader::performOperation: Passing data to DLE parser failed" << std::endl; } if (debugMode) { @@ -91,10 +97,9 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { // Use non-canonical mode and clear echo flag tty.c_lflag &= ~(ICANON | ECHO); - // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are - // received in one go - tty.c_cc[VTIME] = 20; // Read for up to 2 seconds - tty.c_cc[VMIN] = 0; // Read as much as there is available + // Non-blocking mode, use polling + tty.c_cc[VTIME] = 0; // Read for up to 2 seconds + tty.c_cc[VMIN] = 0; // Read as much as there is available // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) @@ -157,16 +162,26 @@ ReturnValue_t ScexUartReader::finish() { return RETURN_OK; } +void ScexUartReader::foundDlePacketHandler(uint8_t *packet, size_t len, void *args) { + ScexUartReader *obj = reinterpret_cast(args); + obj->handleFoundDlePacket(packet, len); +} + +void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { + // TODO: insert data into IPC ring buffer here + sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; +} + ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { MutexGuard mg(lock); - if (sizesQueue.empty()) { + if (ipcQueue.empty()) { *size = 0; return RETURN_OK; } - *size = sizesQueue.pop(); + *size = ipcQueue.pop(); *buffer = ipcBuffer.data(); - ReturnValue_t result = ringBuffer.readData(ipcBuffer.data(), *size, true); + ReturnValue_t result = ipcRingBuf.readData(ipcBuffer.data(), *size, true); if (result != RETURN_OK) { sif::warning << "ScexUartReader::readReceivedMessage: Reading RingBuffer failed" << std::endl; } diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h index 13ff7d73..246dd8f9 100644 --- a/linux/devices/ScexUartReader.h +++ b/linux/devices/ScexUartReader.h @@ -8,6 +8,7 @@ #include #include #include +#include #include // Contains POSIX terminal control definitions class SemaphoreIF; @@ -34,13 +35,20 @@ class ScexUartReader : public SystemObject, // strg+shift+n struct termios tty = {}; bool doFinish = false; DleEncoder dleEncoder = DleEncoder(); - SimpleRingBuffer ringBuffer; - DynamicFIFO sizesQueue; + SimpleRingBuffer decodeRingBuf; + Countdown finishCoutdown = Countdown(180 * 1000); std::array cmdbuf = {}; - std::array recBuf = {}; - + std::array recBuf = {}; + std::array encodedBuf = {}; + std::array decodedBuf = {}; std::array ipcBuffer = {}; + SimpleRingBuffer ipcRingBuf; + DynamicFIFO ipcQueue; + ScexDleParser dleParser; + + static void foundDlePacketHandler(uint8_t *packet, size_t len, void *args); + void handleFoundDlePacket(uint8_t *packet, size_t len); ReturnValue_t performOperation(uint8_t operationCode = 0) override; diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index bbf8da64..d288a0aa 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -163,6 +163,8 @@ debugging. */ #ifdef RASPBERRY_PI +#define OBSW_TC_FROM_PDEC 0 + #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index 2919ff1f..fc013271 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -19,3 +19,5 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE PayloadPcduHandler.cpp SolarArrayDeploymentHandler.cpp ) + +add_subdirectory(devicedefinitions) diff --git a/mission/devices/devicedefinitions/CMakeLists.txt b/mission/devices/devicedefinitions/CMakeLists.txt new file mode 100644 index 00000000..3ac1d9bc --- /dev/null +++ b/mission/devices/devicedefinitions/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_EIVE_MISSION} PRIVATE + ScexDefinitions.cpp +) diff --git a/mission/devices/devicedefinitions/ScexDefinitions.cpp b/mission/devices/devicedefinitions/ScexDefinitions.cpp new file mode 100644 index 00000000..1e39f414 --- /dev/null +++ b/mission/devices/devicedefinitions/ScexDefinitions.cpp @@ -0,0 +1,5 @@ +#include "ScexDefinitions.h" + +uint8_t scex::createCmdByte(ScexCmds cmd, bool tempCheck) { + return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck; +} diff --git a/mission/devices/devicedefinitions/SCEXDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h similarity index 63% rename from mission/devices/devicedefinitions/SCEXDefinitions.h rename to mission/devices/devicedefinitions/ScexDefinitions.h index f9c532ff..704500f4 100644 --- a/mission/devices/devicedefinitions/SCEXDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -6,18 +6,13 @@ // Definitions for the Solar Cell Experiment namespace scex { -enum ScexCmds: uint8_t { - PING = 0b00111, - ONE_CELL = 0b00110 -}; +enum ScexCmds : uint8_t { PING = 0b00111, ONE_CELL = 0b00110, FRAM = 0b00001 }; static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0; static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1; -uint8_t createCmdByte(ScexCmds cmd, bool tempCheck) { - return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck; -} +uint8_t createCmdByte(ScexCmds cmd, bool tempCheck); -} +} // namespace scex #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_ */ From d00cb6d4a540d74cfa906187e2f21f7c5a1ce657 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 9 Apr 2022 15:38:09 +0200 Subject: [PATCH 007/361] updates for new dle parser API --- fsfw | 2 +- linux/boardtest/UartTestClass.cpp | 10 +++++++--- linux/boardtest/UartTestClass.h | 3 ++- linux/devices/ScexDleParser.cpp | 2 +- linux/devices/ScexDleParser.h | 2 +- linux/devices/ScexUartReader.cpp | 10 +++++++--- linux/devices/ScexUartReader.h | 2 +- 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/fsfw b/fsfw index bdddee4f..4e242aa9 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit bdddee4f81fbdff7f207fd03b3c592522e04c5aa +Subproject commit 4e242aa9547dfc6d7abc0cdd405440547239016b diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 0a164c8b..672a34c8 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -290,9 +290,13 @@ int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* c return 0; } -void UartTestClass::foundDlePacketHandler(uint8_t* packet, size_t len, void* args) { - UartTestClass* obj = reinterpret_cast(args); - obj->handleFoundDlePacket(packet, len); +void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) { + UartTestClass* obj = reinterpret_cast(ctx.userArgs); + if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { + obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); + } else { + DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); + } } void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index b080f8a3..c6242281 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -3,6 +3,7 @@ #include #include +#include #include #include // Contains POSIX terminal control definitions @@ -42,7 +43,7 @@ class UartTestClass : public TestTask { void scexSimplePeriodic(); void scexSimpleInit(); - static void foundDlePacketHandler(uint8_t* packet, size_t len, void* args); + static void foundDlePacketHandler(const DleParser::Context& ctx); void handleFoundDlePacket(uint8_t* packet, size_t len); bool cmdSent = false; diff --git a/linux/devices/ScexDleParser.cpp b/linux/devices/ScexDleParser.cpp index f2620b8e..3a95e497 100644 --- a/linux/devices/ScexDleParser.cpp +++ b/linux/devices/ScexDleParser.cpp @@ -1,6 +1,6 @@ #include "ScexDleParser.h" ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, - BufPair encodedBuf, BufPair decodedBuf, FoundPacketHandler handler, + BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {} diff --git a/linux/devices/ScexDleParser.h b/linux/devices/ScexDleParser.h index d914cdaf..eab7e9c1 100644 --- a/linux/devices/ScexDleParser.h +++ b/linux/devices/ScexDleParser.h @@ -6,7 +6,7 @@ class ScexDleParser : public DleParser { public: ScexDleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf, - BufPair decodedBuf, FoundPacketHandler handler, void* args); + BufPair decodedBuf, UserHandler handler, void* args); }; #endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */ diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 8017e8c6..5a325668 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -162,9 +162,13 @@ ReturnValue_t ScexUartReader::finish() { return RETURN_OK; } -void ScexUartReader::foundDlePacketHandler(uint8_t *packet, size_t len, void *args) { - ScexUartReader *obj = reinterpret_cast(args); - obj->handleFoundDlePacket(packet, len); +void ScexUartReader::foundDlePacketHandler(const DleParser::Context &ctx) { + ScexUartReader *obj = reinterpret_cast(ctx.userArgs); + if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { + obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); + } else { + DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); + } } void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h index 246dd8f9..ad760b39 100644 --- a/linux/devices/ScexUartReader.h +++ b/linux/devices/ScexUartReader.h @@ -47,7 +47,7 @@ class ScexUartReader : public SystemObject, // strg+shift+n DynamicFIFO ipcQueue; ScexDleParser dleParser; - static void foundDlePacketHandler(uint8_t *packet, size_t len, void *args); + static void foundDlePacketHandler(const DleParser::Context &ctx); void handleFoundDlePacket(uint8_t *packet, size_t len); ReturnValue_t performOperation(uint8_t operationCode = 0) override; From 9f3f264eac0a986d7c0f025124f1595b9d21763f Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Wed, 13 Apr 2022 17:43:16 +0200 Subject: [PATCH 008/361] continued scex uart reader, some bugs --- fsfw | 2 +- linux/boardtest/UartTestClass.cpp | 493 ++++++++++++++++-------------- linux/boardtest/UartTestClass.h | 3 - linux/devices/ScexUartReader.cpp | 38 ++- 4 files changed, 293 insertions(+), 243 deletions(-) diff --git a/fsfw b/fsfw index 5ff88129..e0c9bf58 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5ff88129b8158a3a66366968231a68d01564f8fe +Subproject commit e0c9bf587151094a54568117aa7159607b8bac2e diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 672a34c8..c2619699 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -21,284 +21,331 @@ #endif UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) - : TestTask(objectId), reader(reader), decodeRingBuf(4096, true) { - mode = TestModes::SCEX; - scexMode = ScexModes::SIMPLE; - currCmd = scex::ScexCmds::FRAM; - if (mode == TestModes::SCEX) { - dleParser = - new ScexDleParser(decodeRingBuf, dleEncoder, {encodedBuf.data(), encodedBuf.size()}, - {decodedBuf.data(), decodedBuf.size()}, &foundDlePacketHandler, this); - } +: TestTask(objectId), reader(reader) { + mode = TestModes::SCEX; + scexMode = ScexModes::READER_TASK; + currCmd = scex::ScexCmds::FRAM; + if (scexMode == ScexModes::SIMPLE) { + auto encodingBuf = new std::array; + DleParser::BufPair encodingBufPair {encodingBuf->data(), encodingBuf->size()}; + auto decodedBuf = new std::array; + DleParser::BufPair decodingBufPair {decodedBuf->data(), decodedBuf->size()}; + dleParser = + new ScexDleParser(*(new SimpleRingBuffer(4096, true)), dleEncoder, encodingBufPair, decodingBufPair, &foundDlePacketHandler, this); + } } ReturnValue_t UartTestClass::initialize() { - if (mode == TestModes::GPS) { - gpsInit(); - } else if (mode == TestModes::SCEX) { - scexInit(); - } - return HasReturnvaluesIF::RETURN_OK; + if (mode == TestModes::GPS) { + gpsInit(); + } else if (mode == TestModes::SCEX) { + scexInit(); + } + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t UartTestClass::performOneShotAction() { return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t UartTestClass::performPeriodicAction() { - if (mode == TestModes::GPS) { - gpsPeriodic(); - } else if (mode == TestModes::SCEX) { - scexPeriodic(); - } - return HasReturnvaluesIF::RETURN_OK; + if (mode == TestModes::GPS) { + gpsPeriodic(); + } else if (mode == TestModes::SCEX) { + scexPeriodic(); + } + return HasReturnvaluesIF::RETURN_OK; } void UartTestClass::gpsInit() { #if RPI_TEST_GPS_HANDLER == 1 - int result = lwgps_init(&gpsData); - if (result == 0) { - sif::warning << "lwgps_init error: " << result << std::endl; - } + int result = lwgps_init(&gpsData); + if (result == 0) { + sif::warning << "lwgps_init error: " << result << std::endl; + } - /* Get file descriptor */ - serialPort = open("/dev/serial0", O_RDWR); - if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - } - /* Setting up UART parameters */ - tty.c_cflag &= ~PARENB; // Clear parity bit - tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication - tty.c_cflag &= ~CSIZE; // Clear all the size bits - tty.c_cflag |= CS8; // 8 bits per byte - tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control - tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) - // Use canonical mode for GPS device - tty.c_lflag |= ICANON; - tty.c_lflag &= ~ECHO; // Disable echo - tty.c_lflag &= ~ECHOE; // Disable erasure - tty.c_lflag &= ~ECHONL; // Disable new-line echo - tty.c_lflag &= ~ISIG; // Disable interpretation of INTR, QUIT and SUSP - tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Turn off s/w flow ctrl - tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | - ICRNL); // Disable any special handling of received bytes - tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars) - tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed + /* Get file descriptor */ + serialPort = open("/dev/serial0", O_RDWR); + if (serialPort < 0) { + sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + } + /* Setting up UART parameters */ + tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSIZE; // Clear all the size bits + tty.c_cflag |= CS8; // 8 bits per byte + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) + // Use canonical mode for GPS device + tty.c_lflag |= ICANON; + tty.c_lflag &= ~ECHO; // Disable echo + tty.c_lflag &= ~ECHOE; // Disable erasure + tty.c_lflag &= ~ECHONL; // Disable new-line echo + tty.c_lflag &= ~ISIG; // Disable interpretation of INTR, QUIT and SUSP + tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Turn off s/w flow ctrl + tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | + ICRNL); // Disable any special handling of received bytes + tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars) + tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed - // Non-blocking mode - tty.c_cc[VTIME] = 0; - tty.c_cc[VMIN] = 0; + // Non-blocking mode + tty.c_cc[VTIME] = 0; + tty.c_cc[VMIN] = 0; - cfsetispeed(&tty, B9600); - cfsetospeed(&tty, B9600); - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - ; - } - // Flush received and unread data. Those are old NMEA strings which are not relevant anymore - tcflush(serialPort, TCIFLUSH); + cfsetispeed(&tty, B9600); + cfsetospeed(&tty, B9600); + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + ; + } + // Flush received and unread data. Those are old NMEA strings which are not relevant anymore + tcflush(serialPort, TCIFLUSH); #endif } void UartTestClass::gpsPeriodic() { #if RPI_TEST_GPS_HANDLER == 1 - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno - << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: " - "recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - // pass data to lwgps for processing + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno + << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: " + "recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + // pass data to lwgps for processing #if GPS_REPLY_WIRETAPPING == 1 - sif::info << recBuf.data() << std::endl; + sif::info << recBuf.data() << std::endl; #endif - int result = lwgps_process(&gpsData, recBuf.data(), bytesRead); - if (result == 0) { - sif::warning << "UartTestClass::performPeriodicAction: lwgps_process error" << std::endl; - } - recvCnt++; - if (recvCnt == 6) { - recvCnt = 0; - sif::info << "GPS Data" << std::endl; - // Print messages - printf("Valid status: %d\n", gpsData.is_valid); - printf("Latitude: %f degrees\n", gpsData.latitude); - printf("Longitude: %f degrees\n", gpsData.longitude); - printf("Altitude: %f meters\n", gpsData.altitude); - } - } - } while (bytesRead > 0); + int result = lwgps_process(&gpsData, recBuf.data(), bytesRead); + if (result == 0) { + sif::warning << "UartTestClass::performPeriodicAction: lwgps_process error" << std::endl; + } + recvCnt++; + if (recvCnt == 6) { + recvCnt = 0; + sif::info << "GPS Data" << std::endl; + // Print messages + printf("Valid status: %d\n", gpsData.is_valid); + printf("Latitude: %f degrees\n", gpsData.latitude); + printf("Longitude: %f degrees\n", gpsData.longitude); + printf("Altitude: %f meters\n", gpsData.altitude); + } + } + } while (bytesRead > 0); #endif } void UartTestClass::scexInit() { - if (reader == nullptr) { - sif::warning << "UartTestClass::scexInit: Reader invalid" << std::endl; - return; - } - if (scexMode == ScexModes::SIMPLE) { - scexSimpleInit(); - } else { + if (reader == nullptr) { + sif::warning << "UartTestClass::scexInit: Reader invalid" << std::endl; + return; + } + if (scexMode == ScexModes::SIMPLE) { + scexSimpleInit(); + } else { #if defined(RASPBERRY_PI) - std::string devname = "/dev/serial0"; + std::string devname = "/dev/serial0"; #else - std::string devname = "/dev/ul-scex"; + std::string devname = "/dev/ul-scex"; #endif - uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); - reader->setDebugMode(true); - ReturnValue_t result = reader->initializeInterface(uartCookie); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::gpsPeriodic: Initializing SCEX reader " - "UART IF failed" - << std::endl; - } - } + uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); + reader->setDebugMode(true); + ReturnValue_t result = reader->initializeInterface(uartCookie); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::gpsPeriodic: Initializing SCEX reader " + "UART IF failed" + << std::endl; + } + } } void UartTestClass::scexPeriodic() { - if (reader == nullptr) { - return; - } + using namespace std; + if (reader == nullptr) { + return; + } + + if (scexMode == ScexModes::SIMPLE) { + scexSimplePeriodic(); + } else { + if (not cmdSent){ + size_t len = 0; + prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len); + reader->sendMessage(uartCookie, cmdBuf.data(), len); + cmdSent = true; + cmdDone = false; + } + if (cmdSent and not cmdDone){ + uint8_t* decodedPacket = nullptr; + size_t len = 0; + ReturnValue_t result = reader->readReceivedMessage(uartCookie, &decodedPacket, &len); + + if(len > 0){ + sif::info<<"CmdByte: "<<(int)decodedPacket[0]<((decodedPacket[0] >> 1) & 0b11111); + size_t packetCounter = decodedPacket[1]; + sif::info<<"PacketCounter: "<finish(); + sif::info<<"Reader is finished" << endl; + cmdDone = true; + if(cmd == scex::ScexCmds::PING){ + cmdSent = false; + } + } + + } + } + + } - if (scexMode == ScexModes::SIMPLE) { - scexSimplePeriodic(); - } else { - size_t len = 0; - prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len); - reader->sendMessage(uartCookie, cmdBuf.data(), len); - } } void UartTestClass::scexSimpleInit() { #if defined(RASPBERRY_PI) - std::string devname = "/dev/serial0"; + std::string devname = "/dev/serial0"; #else - std::string devname = "/dev/ul-scex"; + std::string devname = "/dev/ul-scex"; #endif - /* Get file descriptor */ - serialPort = open(devname.c_str(), O_RDWR); - if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - return; - } - // Setting up UART parameters - tty.c_cflag &= ~PARENB; // Clear parity bit - tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication - tty.c_cflag &= ~CSIZE; // Clear all the size bits - tty.c_cflag |= CS8; // 8 bits per byte - tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control - tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) + /* Get file descriptor */ + serialPort = open(devname.c_str(), O_RDWR); + if (serialPort < 0) { + sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + return; + } + // Setting up UART parameters + tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSIZE; // Clear all the size bits + tty.c_cflag |= CS8; // 8 bits per byte + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) - // Use non-canonical mode and clear echo flag - tty.c_lflag &= ~(ICANON | ECHO); + // Use non-canonical mode and clear echo flag + tty.c_lflag &= ~(ICANON | ECHO); - // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are - // received in one go - tty.c_cc[VTIME] = 10; // In units of 0.1 seconds - tty.c_cc[VMIN] = 255; // Read up to 255 bytes + // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are + // received in one go + tty.c_cc[VTIME] = 10; // In units of 0.1 seconds + tty.c_cc[VMIN] = 255; // Read up to 255 bytes - // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. + // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) - if (cfsetispeed(&tty, B57600) != 0) { - sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; - } + if (cfsetispeed(&tty, B57600) != 0) { + sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; + } #endif - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - } - // Flush received and unread data - tcflush(serialPort, TCIOFLUSH); + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + } + // Flush received and unread data + tcflush(serialPort, TCIOFLUSH); } void UartTestClass::scexSimplePeriodic() { - using namespace scex; - ReturnValue_t result = RETURN_OK; - if (not cmdSent) { - // Flush received and unread data - tcflush(serialPort, TCIFLUSH); - uint8_t tmpCmdBuf[32] = {}; - size_t len = 0; - sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl; - prepareScexCmd(currCmd, false, tmpCmdBuf, &len); - result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; - return; - } - if (result != 0) { - return; - }; - size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); - if (bytesWritten != encodedLen) { - sif::warning << "Sending command to solar experiment failed" << std::endl; - } - cmdSent = true; - cmdDone = false; - } - if (not cmdDone) { - // Read back reply immediately - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead == 0) { - sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; - } else if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" - << errno << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - dleParser->passData(recBuf.data(), bytesRead); - if (currCmd == ScexCmds::PING) { - cmdDone = true; - cmdSent = false; - } - } - } while (bytesRead > 0); - } + using namespace scex; + ReturnValue_t result = RETURN_OK; + if (not cmdSent) { + // Flush received and unread data + tcflush(serialPort, TCIFLUSH); + uint8_t tmpCmdBuf[32] = {}; + size_t len = 0; + sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl; + prepareScexCmd(currCmd, false, tmpCmdBuf, &len); + result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + return; + } + if (result != 0) { + return; + }; + size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); + if (bytesWritten != encodedLen) { + sif::warning << "Sending command to solar experiment failed" << std::endl; + } + cmdSent = true; + cmdDone = false; + } + if (not cmdDone) { + // Read back reply immediately + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead == 0) { + sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; + } else if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" + << errno << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + dleParser->passData(recBuf.data(), bytesRead); + if (currCmd == ScexCmds::PING) { + cmdDone = true; + cmdSent = false; + } + } + } while (bytesRead > 0); + } } int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, - size_t* len) { - using namespace scex; - // Send ping command - cmdBuf[0] = scex::createCmdByte(cmd, false); - // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each - // telecommand so far - cmdBuf[1] = 1; - cmdBuf[2] = 1; - uint16_t userDataLen = 0; - cmdBuf[3] = (userDataLen >> 8) & 0xff; - cmdBuf[4] = userDataLen & 0xff; - uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); - cmdBuf[5] = (crc >> 8) & 0xff; - cmdBuf[6] = crc & 0xff; - *len = 7; - return 0; + size_t* len) { + using namespace scex; + // Send ping command + cmdBuf[0] = scex::createCmdByte(cmd, false); + // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each + // telecommand so far + cmdBuf[1] = 1; + cmdBuf[2] = 1; + uint16_t userDataLen = 0; + cmdBuf[3] = (userDataLen >> 8) & 0xff; + cmdBuf[4] = userDataLen & 0xff; + uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); + cmdBuf[5] = (crc >> 8) & 0xff; + cmdBuf[6] = crc & 0xff; + *len = 7; + return 0; } void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) { - UartTestClass* obj = reinterpret_cast(ctx.userArgs); - if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { - obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); - } else { - DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); - } + UartTestClass* obj = reinterpret_cast(ctx.userArgs); + if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { + obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); + } else { + DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); + } } void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { - sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; + sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index c6242281..03c6805d 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -58,11 +58,8 @@ class UartTestClass : public TestTask { int serialPort = 0; bool startFound = false; ScexUartReader* reader = nullptr; - SimpleRingBuffer decodeRingBuf; std::array cmdBuf = {}; std::array recBuf = {}; - std::array encodedBuf = {}; - std::array decodedBuf = {}; ScexDleParser* dleParser; uint8_t recvCnt = 0; }; diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 5a325668..15201dd1 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -26,16 +26,15 @@ ScexUartReader::ScexUartReader(object_id_t objectId) lock = MutexFactory::instance()->createMutex(); } -// void ScexUartRead::start() { /* semaphore->give(); */ } ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { lock->lockMutex(); state = States::IDLE; lock->unlockMutex(); while (true) { semaphore->acquire(); - std::cout << "task was started" << std::endl; + sif::info << "task was started" << std::endl; int bytesRead = 0; - do { + while(true) { bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), static_cast(recBuf.size())); if (bytesRead == 0) { @@ -52,21 +51,17 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { } else if (bytesRead >= static_cast(recBuf.size())) { sif::error << "ScexUartReader::performOperation: Receive buffer too small" << std::endl; } else if (bytesRead > 0) { - MutexGuard mg(lock); - ipcQueue.insert(bytesRead); ReturnValue_t result = dleParser.passData(recBuf.data(), bytesRead); + if (debugMode) { + sif::info << "Received " << bytesRead + << " bytes from the Solar Cell Experiment:" << std::endl; + } if (result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "ScexUartReader::performOperation: Passing data to DLE parser failed" << std::endl; } - if (debugMode) { - sif::info << "Received " << bytesRead - << " bytes from the Solar Cell Experiment:" << std::endl; - arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); - } - break; } - } while (bytesRead > 0); + }; // task block comes here std::cout << "done" << std::endl; } @@ -75,10 +70,11 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { UartCookie *uartCookie = dynamic_cast(cookie); - if (uartCookie) { + if (uartCookie == nullptr) { return RETURN_FAILED; } std::string devname = uartCookie->getDeviceFile(); + sif::info << devname << std::endl; /* Get file descriptor */ serialPort = open(devname.c_str(), O_RDWR); if (serialPort < 0) { @@ -98,8 +94,8 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { tty.c_lflag &= ~(ICANON | ECHO); // Non-blocking mode, use polling - tty.c_cc[VTIME] = 0; // Read for up to 2 seconds - tty.c_cc[VMIN] = 0; // Read as much as there is available + tty.c_cc[VTIME] = 10; // Read for up to 1 seconds + tty.c_cc[VMIN] = 255; // Read as much as there is available // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) @@ -174,11 +170,21 @@ void ScexUartReader::foundDlePacketHandler(const DleParser::Context &ctx) { void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { // TODO: insert data into IPC ring buffer here sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; + //MutexGuard mg(lock); + ReturnValue_t result = ipcQueue.insert(len); + if(result != RETURN_OK){ + sif::warning<< "IPCQueue error" << std::endl; + } + result = ipcRingBuf.writeData(packet, len); + if(result != RETURN_OK){ + sif::warning<< "IPCRingBuf error" << std::endl; + } + sif::info << "DLE handler done" << std::endl; } ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { - MutexGuard mg(lock); + //MutexGuard mg(lock); if (ipcQueue.empty()) { *size = 0; return RETURN_OK; From bbdd3c052e31f9270fa037b472bf91ba4eb4288e Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Wed, 13 Apr 2022 17:47:24 +0200 Subject: [PATCH 009/361] mutex --- linux/boardtest/UartTestClass.cpp | 2 +- linux/devices/ScexUartReader.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index c2619699..28d92c40 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -23,7 +23,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) : TestTask(objectId), reader(reader) { mode = TestModes::SCEX; - scexMode = ScexModes::READER_TASK; + scexMode = ScexModes::SIMPLE; currCmd = scex::ScexCmds::FRAM; if (scexMode == ScexModes::SIMPLE) { auto encodingBuf = new std::array; diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 15201dd1..657fb829 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -170,7 +170,7 @@ void ScexUartReader::foundDlePacketHandler(const DleParser::Context &ctx) { void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { // TODO: insert data into IPC ring buffer here sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; - //MutexGuard mg(lock); + MutexGuard mg(lock); ReturnValue_t result = ipcQueue.insert(len); if(result != RETURN_OK){ sif::warning<< "IPCQueue error" << std::endl; @@ -184,7 +184,7 @@ void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { - //MutexGuard mg(lock); + MutexGuard mg(lock); if (ipcQueue.empty()) { *size = 0; return RETURN_OK; From 57cc77e19750b508823b8578cd47c34de61670c2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 15 Apr 2022 01:39:47 +0200 Subject: [PATCH 010/361] fixed some tiny bugs --- linux/boardtest/UartTestClass.cpp | 538 +++++++++++++++--------------- linux/devices/ScexUartReader.cpp | 31 +- mission/devices/IMTQHandler.cpp | 2 +- tmtc | 2 +- 4 files changed, 289 insertions(+), 284 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 28d92c40..7723dc86 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -21,331 +21,333 @@ #endif UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) -: TestTask(objectId), reader(reader) { - mode = TestModes::SCEX; - scexMode = ScexModes::SIMPLE; - currCmd = scex::ScexCmds::FRAM; - if (scexMode == ScexModes::SIMPLE) { - auto encodingBuf = new std::array; - DleParser::BufPair encodingBufPair {encodingBuf->data(), encodingBuf->size()}; - auto decodedBuf = new std::array; - DleParser::BufPair decodingBufPair {decodedBuf->data(), decodedBuf->size()}; - dleParser = - new ScexDleParser(*(new SimpleRingBuffer(4096, true)), dleEncoder, encodingBufPair, decodingBufPair, &foundDlePacketHandler, this); - } + : TestTask(objectId), reader(reader) { + mode = TestModes::SCEX; + scexMode = ScexModes::READER_TASK; + currCmd = scex::ScexCmds::PING; + if (scexMode == ScexModes::SIMPLE) { + auto encodingBuf = new std::array; + DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()}; + auto decodedBuf = new std::array; + DleParser::BufPair decodingBufPair{decodedBuf->data(), decodedBuf->size()}; + dleParser = new ScexDleParser(*(new SimpleRingBuffer(4096, true)), dleEncoder, encodingBufPair, + decodingBufPair, &foundDlePacketHandler, this); + } } ReturnValue_t UartTestClass::initialize() { - if (mode == TestModes::GPS) { - gpsInit(); - } else if (mode == TestModes::SCEX) { - scexInit(); - } - return HasReturnvaluesIF::RETURN_OK; + if (mode == TestModes::GPS) { + gpsInit(); + } else if (mode == TestModes::SCEX) { + scexInit(); + } + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t UartTestClass::performOneShotAction() { return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t UartTestClass::performPeriodicAction() { - if (mode == TestModes::GPS) { - gpsPeriodic(); - } else if (mode == TestModes::SCEX) { - scexPeriodic(); - } - return HasReturnvaluesIF::RETURN_OK; + if (mode == TestModes::GPS) { + gpsPeriodic(); + } else if (mode == TestModes::SCEX) { + scexPeriodic(); + } + return HasReturnvaluesIF::RETURN_OK; } void UartTestClass::gpsInit() { #if RPI_TEST_GPS_HANDLER == 1 - int result = lwgps_init(&gpsData); - if (result == 0) { - sif::warning << "lwgps_init error: " << result << std::endl; - } + int result = lwgps_init(&gpsData); + if (result == 0) { + sif::warning << "lwgps_init error: " << result << std::endl; + } - /* Get file descriptor */ - serialPort = open("/dev/serial0", O_RDWR); - if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - } - /* Setting up UART parameters */ - tty.c_cflag &= ~PARENB; // Clear parity bit - tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication - tty.c_cflag &= ~CSIZE; // Clear all the size bits - tty.c_cflag |= CS8; // 8 bits per byte - tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control - tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) - // Use canonical mode for GPS device - tty.c_lflag |= ICANON; - tty.c_lflag &= ~ECHO; // Disable echo - tty.c_lflag &= ~ECHOE; // Disable erasure - tty.c_lflag &= ~ECHONL; // Disable new-line echo - tty.c_lflag &= ~ISIG; // Disable interpretation of INTR, QUIT and SUSP - tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Turn off s/w flow ctrl - tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | - ICRNL); // Disable any special handling of received bytes - tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars) - tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed + /* Get file descriptor */ + serialPort = open("/dev/serial0", O_RDWR); + if (serialPort < 0) { + sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + } + /* Setting up UART parameters */ + tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSIZE; // Clear all the size bits + tty.c_cflag |= CS8; // 8 bits per byte + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) + // Use canonical mode for GPS device + tty.c_lflag |= ICANON; + tty.c_lflag &= ~ECHO; // Disable echo + tty.c_lflag &= ~ECHOE; // Disable erasure + tty.c_lflag &= ~ECHONL; // Disable new-line echo + tty.c_lflag &= ~ISIG; // Disable interpretation of INTR, QUIT and SUSP + tty.c_iflag &= ~(IXON | IXOFF | IXANY); // Turn off s/w flow ctrl + tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | + ICRNL); // Disable any special handling of received bytes + tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars) + tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed - // Non-blocking mode - tty.c_cc[VTIME] = 0; - tty.c_cc[VMIN] = 0; + // Non-blocking mode + tty.c_cc[VTIME] = 0; + tty.c_cc[VMIN] = 0; - cfsetispeed(&tty, B9600); - cfsetospeed(&tty, B9600); - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - ; - } - // Flush received and unread data. Those are old NMEA strings which are not relevant anymore - tcflush(serialPort, TCIFLUSH); + cfsetispeed(&tty, B9600); + cfsetospeed(&tty, B9600); + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + ; + } + // Flush received and unread data. Those are old NMEA strings which are not relevant anymore + tcflush(serialPort, TCIFLUSH); #endif } void UartTestClass::gpsPeriodic() { #if RPI_TEST_GPS_HANDLER == 1 - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno - << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: " - "recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - // pass data to lwgps for processing + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno + << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: " + "recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + // pass data to lwgps for processing #if GPS_REPLY_WIRETAPPING == 1 - sif::info << recBuf.data() << std::endl; + sif::info << recBuf.data() << std::endl; #endif - int result = lwgps_process(&gpsData, recBuf.data(), bytesRead); - if (result == 0) { - sif::warning << "UartTestClass::performPeriodicAction: lwgps_process error" << std::endl; - } - recvCnt++; - if (recvCnt == 6) { - recvCnt = 0; - sif::info << "GPS Data" << std::endl; - // Print messages - printf("Valid status: %d\n", gpsData.is_valid); - printf("Latitude: %f degrees\n", gpsData.latitude); - printf("Longitude: %f degrees\n", gpsData.longitude); - printf("Altitude: %f meters\n", gpsData.altitude); - } - } - } while (bytesRead > 0); + int result = lwgps_process(&gpsData, recBuf.data(), bytesRead); + if (result == 0) { + sif::warning << "UartTestClass::performPeriodicAction: lwgps_process error" << std::endl; + } + recvCnt++; + if (recvCnt == 6) { + recvCnt = 0; + sif::info << "GPS Data" << std::endl; + // Print messages + printf("Valid status: %d\n", gpsData.is_valid); + printf("Latitude: %f degrees\n", gpsData.latitude); + printf("Longitude: %f degrees\n", gpsData.longitude); + printf("Altitude: %f meters\n", gpsData.altitude); + } + } + } while (bytesRead > 0); #endif } void UartTestClass::scexInit() { - if (reader == nullptr) { - sif::warning << "UartTestClass::scexInit: Reader invalid" << std::endl; - return; - } - if (scexMode == ScexModes::SIMPLE) { - scexSimpleInit(); - } else { + if (reader == nullptr) { + sif::warning << "UartTestClass::scexInit: Reader invalid" << std::endl; + return; + } + if (scexMode == ScexModes::SIMPLE) { + scexSimpleInit(); + } else { #if defined(RASPBERRY_PI) - std::string devname = "/dev/serial0"; + std::string devname = "/dev/serial0"; #else - std::string devname = "/dev/ul-scex"; + std::string devname = "/dev/ul-scex"; #endif - uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); - reader->setDebugMode(true); - ReturnValue_t result = reader->initializeInterface(uartCookie); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::gpsPeriodic: Initializing SCEX reader " - "UART IF failed" - << std::endl; - } - } + uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); + reader->setDebugMode(true); + ReturnValue_t result = reader->initializeInterface(uartCookie); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::gpsPeriodic: Initializing SCEX reader " + "UART IF failed" + << std::endl; + } + } } void UartTestClass::scexPeriodic() { - using namespace std; - if (reader == nullptr) { - return; - } + using namespace std; + if (reader == nullptr) { + return; + } - if (scexMode == ScexModes::SIMPLE) { - scexSimplePeriodic(); - } else { - if (not cmdSent){ - size_t len = 0; - prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len); - reader->sendMessage(uartCookie, cmdBuf.data(), len); - cmdSent = true; - cmdDone = false; - } - if (cmdSent and not cmdDone){ - uint8_t* decodedPacket = nullptr; - size_t len = 0; - ReturnValue_t result = reader->readReceivedMessage(uartCookie, &decodedPacket, &len); + if (scexMode == ScexModes::SIMPLE) { + scexSimplePeriodic(); + } else { + if (not cmdSent) { + size_t len = 0; + prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len); + reader->sendMessage(uartCookie, cmdBuf.data(), len); + cmdSent = true; + cmdDone = false; + } + if (cmdSent and not cmdDone) { + uint8_t* decodedPacket = nullptr; + size_t len = 0; + ReturnValue_t result = reader->readReceivedMessage(uartCookie, &decodedPacket, &len); - if(len > 0){ - sif::info<<"CmdByte: "<<(int)decodedPacket[0]<((decodedPacket[0] >> 1) & 0b11111); - size_t packetCounter = decodedPacket[1]; - sif::info<<"PacketCounter: "<finish(); - sif::info<<"Reader is finished" << endl; - cmdDone = true; - if(cmd == scex::ScexCmds::PING){ - cmdSent = false; - } - } - - } - } - - } + if (len > 0) { + sif::info << "CmdByte: " << std::setw(2) << std::setfill('0') << std::hex + << (int)decodedPacket[0] << std::dec << endl; + scex::ScexCmds cmd = static_cast((decodedPacket[0] >> 1) & 0b11111); + sif::info << "Command: 0x" << std::setw(2) << std::setfill('0') << std::hex + << static_cast(cmd) << std::dec << std::endl; + size_t packetCounter = decodedPacket[1]; + sif::info << "PacketCounter: " << packetCounter << endl; + size_t totalPacketCounter = decodedPacket[2]; + sif::info << "TotalPacketCount: " << totalPacketCounter << endl; + uint16_t packetLen = (decodedPacket[3] << 8) | (decodedPacket[4]); + sif::info << "PacketLength: " << packetLen << endl; + uint16_t expectedPacketLen = packetLen + 7; + sif::info << "ExpectedPacketLength: " << packetLen + 7 << endl; + if (expectedPacketLen != len) { + sif::warning << "ExpectedPacketLength " << expectedPacketLen << " is not Length" << len + << endl; + } + if (CRC::crc16ccitt(decodedPacket, expectedPacketLen) != 0) { + sif::warning << "CRC invalid" << endl; + } else { + sif::info << "CRC valid" << endl; + } + if (packetCounter == totalPacketCounter) { + reader->finish(); + sif::info << "Reader is finished" << endl; + cmdDone = true; + // TODO: Bug in firmware, other command will be returned + cmdSent = false; + // if (cmd == scex::ScexCmds::PING) { + // cmdSent = false; + // } + } + } + } + } } void UartTestClass::scexSimpleInit() { #if defined(RASPBERRY_PI) - std::string devname = "/dev/serial0"; + std::string devname = "/dev/serial0"; #else - std::string devname = "/dev/ul-scex"; + std::string devname = "/dev/ul-scex"; #endif - /* Get file descriptor */ - serialPort = open(devname.c_str(), O_RDWR); - if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - return; - } - // Setting up UART parameters - tty.c_cflag &= ~PARENB; // Clear parity bit - tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication - tty.c_cflag &= ~CSIZE; // Clear all the size bits - tty.c_cflag |= CS8; // 8 bits per byte - tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control - tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) + /* Get file descriptor */ + serialPort = open(devname.c_str(), O_RDWR); + if (serialPort < 0) { + sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + return; + } + // Setting up UART parameters + tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSIZE; // Clear all the size bits + tty.c_cflag |= CS8; // 8 bits per byte + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + tty.c_cflag |= CREAD | CLOCAL; // Turn on READ & ignore ctrl lines (CLOCAL = 1) - // Use non-canonical mode and clear echo flag - tty.c_lflag &= ~(ICANON | ECHO); + // Use non-canonical mode and clear echo flag + tty.c_lflag &= ~(ICANON | ECHO); - // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are - // received in one go - tty.c_cc[VTIME] = 10; // In units of 0.1 seconds - tty.c_cc[VMIN] = 255; // Read up to 255 bytes + // Non-blocking mode, read until either line is 0.1 second idle or maximum of 255 bytes are + // received in one go + tty.c_cc[VTIME] = 0; // In units of 0.1 seconds + tty.c_cc[VMIN] = 0; // Read up to 255 bytes - // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. + // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) - if (cfsetispeed(&tty, B57600) != 0) { - sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; - } + if (cfsetispeed(&tty, B57600) != 0) { + sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; + } #endif - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) - << std::endl; - } - // Flush received and unread data - tcflush(serialPort, TCIOFLUSH); + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + << std::endl; + } + // Flush received and unread data + tcflush(serialPort, TCIOFLUSH); } void UartTestClass::scexSimplePeriodic() { - using namespace scex; - ReturnValue_t result = RETURN_OK; - if (not cmdSent) { - // Flush received and unread data - tcflush(serialPort, TCIFLUSH); - uint8_t tmpCmdBuf[32] = {}; - size_t len = 0; - sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl; - prepareScexCmd(currCmd, false, tmpCmdBuf, &len); - result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; - return; - } - if (result != 0) { - return; - }; - size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); - if (bytesWritten != encodedLen) { - sif::warning << "Sending command to solar experiment failed" << std::endl; - } - cmdSent = true; - cmdDone = false; - } - if (not cmdDone) { - // Read back reply immediately - int bytesRead = 0; - do { - bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), - static_cast(recBuf.size())); - if (bytesRead == 0) { - sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; - } else if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" - << errno << ", " << strerror(errno) << "]" << std::endl; - break; - } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" - << std::endl; - } else if (bytesRead > 0) { - dleParser->passData(recBuf.data(), bytesRead); - if (currCmd == ScexCmds::PING) { - cmdDone = true; - cmdSent = false; - } - } - } while (bytesRead > 0); - } + using namespace scex; + ReturnValue_t result = RETURN_OK; + if (not cmdSent) { + // Flush received and unread data + tcflush(serialPort, TCIFLUSH); + uint8_t tmpCmdBuf[32] = {}; + size_t len = 0; + sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl; + prepareScexCmd(currCmd, false, tmpCmdBuf, &len); + result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + return; + } + if (result != 0) { + return; + }; + size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); + if (bytesWritten != encodedLen) { + sif::warning << "Sending command to solar experiment failed" << std::endl; + } + cmdSent = true; + cmdDone = false; + } + if (not cmdDone) { + // Read back reply immediately + int bytesRead = 0; + do { + bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead == 0) { + sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; + } else if (bytesRead < 0) { + sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" + << errno << ", " << strerror(errno) << "]" << std::endl; + break; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" + << std::endl; + } else if (bytesRead > 0) { + dleParser->passData(recBuf.data(), bytesRead); + if (currCmd == ScexCmds::PING) { + cmdDone = true; + cmdSent = false; + } + } + } while (bytesRead > 0); + } } int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, - size_t* len) { - using namespace scex; - // Send ping command - cmdBuf[0] = scex::createCmdByte(cmd, false); - // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each - // telecommand so far - cmdBuf[1] = 1; - cmdBuf[2] = 1; - uint16_t userDataLen = 0; - cmdBuf[3] = (userDataLen >> 8) & 0xff; - cmdBuf[4] = userDataLen & 0xff; - uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); - cmdBuf[5] = (crc >> 8) & 0xff; - cmdBuf[6] = crc & 0xff; - *len = 7; - return 0; + size_t* len) { + using namespace scex; + // Send ping command + cmdBuf[0] = scex::createCmdByte(cmd, false); + // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each + // telecommand so far + cmdBuf[1] = 1; + cmdBuf[2] = 1; + uint16_t userDataLen = 0; + cmdBuf[3] = (userDataLen >> 8) & 0xff; + cmdBuf[4] = userDataLen & 0xff; + uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); + cmdBuf[5] = (crc >> 8) & 0xff; + cmdBuf[6] = crc & 0xff; + *len = 7; + return 0; } void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) { - UartTestClass* obj = reinterpret_cast(ctx.userArgs); - if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { - obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); - } else { - DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); - } + UartTestClass* obj = reinterpret_cast(ctx.userArgs); + if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { + obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); + } else { + DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); + } } void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { - sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; + sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; } diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 657fb829..e0868b48 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include // write(), read(), close() @@ -34,16 +35,17 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { semaphore->acquire(); sif::info << "task was started" << std::endl; int bytesRead = 0; - while(true) { + while (true) { bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), static_cast(recBuf.size())); if (bytesRead == 0) { MutexGuard mg(lock); - States currentState = state; - if (currentState == States::FINISH) { + if (state == States::FINISH) { + sif::debug << "finish detected" << std::endl; state = States::IDLE; break; } + TaskFactory::delayTask(1000); } else if (bytesRead < 0) { sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno << ", " << strerror(errno) << "]" << std::endl; @@ -63,7 +65,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { } }; // task block comes here - std::cout << "done" << std::endl; + sif::info << "task was stopped" << std::endl; } return RETURN_OK; } @@ -74,7 +76,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { return RETURN_FAILED; } std::string devname = uartCookie->getDeviceFile(); - sif::info << devname << std::endl; + sif::info << devname << std::endl; /* Get file descriptor */ serialPort = open(devname.c_str(), O_RDWR); if (serialPort < 0) { @@ -94,8 +96,8 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { tty.c_lflag &= ~(ICANON | ECHO); // Non-blocking mode, use polling - tty.c_cc[VTIME] = 10; // Read for up to 1 seconds - tty.c_cc[VMIN] = 255; // Read as much as there is available + tty.c_cc[VTIME] = 0; + tty.c_cc[VMIN] = 0; // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) @@ -109,7 +111,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { << std::endl; } // Flush received and unread data - tcflush(serialPort, TCIFLUSH); + tcflush(serialPort, TCIOFLUSH); return RETURN_OK; } @@ -172,13 +174,13 @@ void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; MutexGuard mg(lock); ReturnValue_t result = ipcQueue.insert(len); - if(result != RETURN_OK){ - sif::warning<< "IPCQueue error" << std::endl; + if (result != RETURN_OK) { + sif::warning << "IPCQueue error" << std::endl; } result = ipcRingBuf.writeData(packet, len); - if(result != RETURN_OK){ - sif::warning<< "IPCRingBuf error" << std::endl; - } + if (result != RETURN_OK) { + sif::warning << "IPCRingBuf error" << std::endl; + } sif::info << "DLE handler done" << std::endl; } @@ -189,7 +191,8 @@ ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **bu *size = 0; return RETURN_OK; } - *size = ipcQueue.pop(); + sif::info << "returning data" << std::endl; + ipcQueue.retrieve(size); *buffer = ipcBuffer.data(); ReturnValue_t result = ipcRingBuf.readData(ipcBuffer.data(), *size, true); if (result != RETURN_OK) { diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index 645a8aa7..e9483d35 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -118,7 +118,7 @@ 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) { return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; } commandBuffer[1] = commandData[1]; diff --git a/tmtc b/tmtc index ecb973c3..8a30f669 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit ecb973c37fe43954d0be1f19b0735b3546d2ef1b +Subproject commit 8a30f669f075c284494d7c1c6618e42e2aec8f15 From f52c2a32b7064b2a11d1a2f6e1fddd4c56efbc33 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 15 Apr 2022 01:40:14 +0200 Subject: [PATCH 011/361] repoint fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index e0c9bf58..186b3565 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e0c9bf587151094a54568117aa7159607b8bac2e +Subproject commit 186b3565e0eb6ca10ec2203febdbc7eb7e7f7fe0 From ad12fa606020b6f261d8a944f12e1a82a6c116fb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 15 Apr 2022 01:40:53 +0200 Subject: [PATCH 012/361] repoint fsfw again --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 186b3565..e949368b 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 186b3565e0eb6ca10ec2203febdbc7eb7e7f7fe0 +Subproject commit e949368b062e8703c35d2043ece8d7258cd2608b From 01f812b932dff83601fd780a1548eeb06fba947f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 15 Apr 2022 01:42:00 +0200 Subject: [PATCH 013/361] reorder fix --- mission/devices/IMTQHandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index 2b3ba240..07f610b7 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -10,7 +10,6 @@ IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, power::Switch_t pwrSwitcher) : DeviceHandlerBase(objectId, comIF, comCookie), - switcher(pwrSwitcher), engHkDataset(this), calMtmMeasurementSet(this), rawMtmMeasurementSet(this), @@ -19,8 +18,9 @@ IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comC posYselfTestDataset(this), negYselfTestDataset(this), posZselfTestDataset(this), - negZselfTestDataset(this) { - if (comCookie == NULL) { + negZselfTestDataset(this), + switcher(pwrSwitcher) { + if (comCookie == nullptr) { sif::error << "IMTQHandler: Invalid com cookie" << std::endl; } } From a99b0007db8694441e32e457ba12fe7425f742e7 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 21 Apr 2022 16:58:43 +0200 Subject: [PATCH 014/361] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index e0c9bf58..befaca78 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e0c9bf587151094a54568117aa7159607b8bac2e +Subproject commit befaca78c660f232c312667202f2bbd5da95c235 From 578899b5a584c8e7952d303103fd71982172a5d3 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 21 Apr 2022 19:47:09 +0200 Subject: [PATCH 015/361] scexhelper --- linux/boardtest/UartTestClass.cpp | 55 ++++++------ linux/boardtest/UartTestClass.h | 1 + linux/devices/CMakeLists.txt | 1 + linux/devices/ScexHelper.cpp | 83 +++++++++++++++++++ linux/devices/ScexHelper.h | 48 +++++++++++ .../devicedefinitions/ScexDefinitions.h | 2 +- 6 files changed, 163 insertions(+), 27 deletions(-) create mode 100644 linux/devices/ScexHelper.cpp create mode 100644 linux/devices/ScexHelper.h diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 7723dc86..b4a23c6c 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include // write(), read(), close() @@ -167,6 +168,7 @@ void UartTestClass::scexInit() { void UartTestClass::scexPeriodic() { using namespace std; + using namespace scex; if (reader == nullptr) { return; } @@ -187,38 +189,39 @@ void UartTestClass::scexPeriodic() { ReturnValue_t result = reader->readReceivedMessage(uartCookie, &decodedPacket, &len); if (len > 0) { - sif::info << "CmdByte: " << std::setw(2) << std::setfill('0') << std::hex - << (int)decodedPacket[0] << std::dec << endl; - scex::ScexCmds cmd = static_cast((decodedPacket[0] >> 1) & 0b11111); - sif::info << "Command: 0x" << std::setw(2) << std::setfill('0') << std::hex - << static_cast(cmd) << std::dec << std::endl; - size_t packetCounter = decodedPacket[1]; - sif::info << "PacketCounter: " << packetCounter << endl; - size_t totalPacketCounter = decodedPacket[2]; - sif::info << "TotalPacketCount: " << totalPacketCounter << endl; - uint16_t packetLen = (decodedPacket[3] << 8) | (decodedPacket[4]); - sif::info << "PacketLength: " << packetLen << endl; - uint16_t expectedPacketLen = packetLen + 7; + ScexHelper helper; + const uint8_t* helperPtr = decodedPacket; + result = helper.deSerialize(&helperPtr, &len); + if (result == ScexHelper::INVALID_CRC) { + sif::warning << "CRC invalid" << std::endl; + } + sif::info << helper << endl; - sif::info << "ExpectedPacketLength: " << packetLen + 7 << endl; - if (expectedPacketLen != len) { - sif::warning << "ExpectedPacketLength " << expectedPacketLen << " is not Length" << len - << endl; + //ping + //if ping cmd + ofstream out("/tmp/scex-ping.bin", ofstream::binary ); + if (out.bad()) { + sif::warning << "bad" < + //countdown (max 2min), wenn nicht if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { nach 2min reader->finish(); + if(helper.getCmd() == FRAM) { + if(helper.getPacketCounter() == 0) { + // neues file anlegen wie oben ping + } else { + // an bestehendes file hinzufügen + } } - if (packetCounter == totalPacketCounter) { + out << helper; + + if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { reader->finish(); sif::info << "Reader is finished" << endl; cmdDone = true; - // TODO: Bug in firmware, other command will be returned - cmdSent = false; - // if (cmd == scex::ScexCmds::PING) { - // cmdSent = false; - // } + if (helper.getCmd() == scex::ScexCmds::PING) { + cmdSent = false; + } } } } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 03c6805d..0a228782 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -61,6 +61,7 @@ class UartTestClass : public TestTask { std::array cmdBuf = {}; std::array recBuf = {}; ScexDleParser* dleParser; + scex::ScexCmds cmdHelper; uint8_t recvCnt = 0; }; diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index 6be5da2f..9a4695ca 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -7,6 +7,7 @@ endif() target_sources(${OBSW_NAME} PRIVATE ScexUartReader.cpp ScexDleParser.cpp + ScexHelper.cpp ) add_subdirectory(ploc) add_subdirectory(startracker) diff --git a/linux/devices/ScexHelper.cpp b/linux/devices/ScexHelper.cpp new file mode 100644 index 00000000..bc7ee04f --- /dev/null +++ b/linux/devices/ScexHelper.cpp @@ -0,0 +1,83 @@ +#include "ScexHelper.h" + +#include + +#include "fsfw/serviceinterface.h" + +ScexHelper::ScexHelper() {} + +ReturnValue_t ScexHelper::serialize(uint8_t** buffer, size_t* size, size_t maxSize, + Endianness streamEndianness) const { + return RETURN_FAILED; +} + +size_t ScexHelper::getSerializedSize() const { return totalPacketLen; } + +ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size, + Endianness streamEndianness) { + if (buffer == nullptr or size == nullptr) { + return RETURN_FAILED; + } + if (*size < 7) { + return STREAM_TOO_SHORT; + } + start = *buffer; + cmdByteRaw = **buffer; + cmd = static_cast((cmdByteRaw >> 1) & 0b11111); + + *buffer += 1; + packetCounter = **buffer; + + *buffer += 1; + totalPacketCounter = **buffer; + + *buffer += 1; + payloadLen = (**buffer << 8) | *(*buffer + 1); + + *buffer += 2; + totalPacketLen = payloadLen + HEADER_LEN + CRC_LEN; + if (totalPacketLen >= *size) { + return STREAM_TOO_SHORT; + } + *buffer += payloadLen; + crc = (**buffer << 8) | *(*buffer + 1); + if (CRC::crc16ccitt(start, totalPacketLen) != 0) { + return INVALID_CRC; + } + return RETURN_OK; +} + +scex::ScexCmds ScexHelper::getCmd() const { return cmd; } + +uint8_t ScexHelper::getCmdByteRaw() const { return cmdByteRaw; } + +uint16_t ScexHelper::getCrc() const { return crc; } + +size_t ScexHelper::getExpectedPacketLen() const { return totalPacketLen; } + +uint8_t ScexHelper::getPacketCounter() const { return packetCounter; } + +uint16_t ScexHelper::getPayloadLen() const { return payloadLen; } + +const uint8_t* ScexHelper::getStart() const { return start; } + +uint8_t ScexHelper::getTotalPacketCounter() const { return totalPacketCounter; } + +std::ostream& operator<<(std::ostream& os, const ScexHelper& h) { + using namespace std; + sif::info << "Command Byte Raw: 0x" << std::setw(2) << std::setfill('0') << std::hex + << (int)h.cmdByteRaw << " | Command: 0x" << std::setw(2) << std::setfill('0') + << std::hex << static_cast(h.cmd) << std::dec << std::endl; + sif::info << "PacketCounter: " << h.packetCounter << endl; + sif::info << "TotalPacketCount: " << h.totalPacketCounter << endl; + sif::info << "PayloadLength: " << h.payloadLen << endl; + sif::info << "TotalPacketLength: " << h.totalPacketLen << endl; + + return os; +} + +std::ofstream& operator<<(std::ofstream& of, const ScexHelper& h) { + of.write(reinterpret_cast(h.start), h.getSerializedSize()); + + return of; +} diff --git a/linux/devices/ScexHelper.h b/linux/devices/ScexHelper.h new file mode 100644 index 00000000..a835bd0a --- /dev/null +++ b/linux/devices/ScexHelper.h @@ -0,0 +1,48 @@ +#ifndef LINUX_DEVICES_SCEXHELPER_H_ +#define LINUX_DEVICES_SCEXHELPER_H_ +#include +#include + +#include +#include +#include +#include +// ScexHelper helper; +// helper.deSerialize(data, ...); +// sif::info << helper << std::endl; +class ScexHelper : public HasReturnvaluesIF, public SerializeIF { + public: + static const ReturnValue_t INVALID_CRC = HasReturnvaluesIF::makeReturnCode(0, 2); + static constexpr uint8_t HEADER_LEN = 5; + static constexpr uint8_t CRC_LEN = 2; + ScexHelper(); + ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, + Endianness streamEndianness) const override; + + size_t getSerializedSize() const override; + ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, + Endianness streamEndianness = Endianness::BIG) override; + friend std::ostream &operator<<(std::ostream &os, const ScexHelper &h); + friend std::ofstream &operator<<(std::ofstream &os, const ScexHelper &h); + + scex::ScexCmds getCmd() const; + uint8_t getCmdByteRaw() const; + uint16_t getCrc() const; + size_t getExpectedPacketLen() const; + uint8_t getPacketCounter() const; + uint16_t getPayloadLen() const; + const uint8_t *getStart() const; + uint8_t getTotalPacketCounter() const; + + private: + const uint8_t *start = nullptr; + uint16_t crc = 0; + uint8_t cmdByteRaw = 0; + scex::ScexCmds cmd = scex::ScexCmds::INVALID; + int packetCounter = 0; + int totalPacketCounter = 0; + uint16_t payloadLen = 0; + size_t totalPacketLen = 0; +}; + +#endif /* LINUX_DEVICES_SCEXHELPER_H_ */ diff --git a/mission/devices/devicedefinitions/ScexDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h index 704500f4..f479981e 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -6,7 +6,7 @@ // Definitions for the Solar Cell Experiment namespace scex { -enum ScexCmds : uint8_t { PING = 0b00111, ONE_CELL = 0b00110, FRAM = 0b00001 }; +enum ScexCmds : uint8_t { PING = 0b00111, ONE_CELL = 0b00110, FRAM = 0b00001, INVALID = 255 }; static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0; static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1; From a0db5dcc7cb3f39106ecf0dc2ec36b025936a529 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 22 Apr 2022 17:00:23 +0200 Subject: [PATCH 016/361] add first mode sequence for acs ss --- bsp_q7s/core/CMakeLists.txt | 1 + bsp_q7s/core/acsModeTree.cpp | 72 +++++++++++++++++++++++++++++++++++ bsp_q7s/core/acsModeTree.h | 10 +++++ common/config/commonObjects.h | 5 ++- generators/fsfwgen | 2 +- 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 bsp_q7s/core/acsModeTree.cpp create mode 100644 bsp_q7s/core/acsModeTree.h diff --git a/bsp_q7s/core/CMakeLists.txt b/bsp_q7s/core/CMakeLists.txt index 8731b7a3..30538565 100644 --- a/bsp_q7s/core/CMakeLists.txt +++ b/bsp_q7s/core/CMakeLists.txt @@ -1,4 +1,5 @@ target_sources(${OBSW_NAME} PRIVATE + acsModeTree.cpp CoreController.cpp obsw.cpp InitMission.cpp diff --git a/bsp_q7s/core/acsModeTree.cpp b/bsp_q7s/core/acsModeTree.cpp new file mode 100644 index 00000000..c097d971 --- /dev/null +++ b/bsp_q7s/core/acsModeTree.cpp @@ -0,0 +1,72 @@ +#include + +#include "acsModeTree.h" +#include +#include +#include + +FixedArrayList ACS_SEQUENCE_OFF = FixedArrayList(); +FixedArrayList ACS_TABLE_OFF_TGT = FixedArrayList(); +FixedArrayList ACS_TABLE_OFF_TRANS = FixedArrayList(); + +static constexpr Mode_t ACS_SEQUENCE_OFF_ID = HasModesIF::MODE_OFF; +static constexpr Mode_t ACS_TABLE_OFF_TGT_ID = 0x61000000; +static constexpr Mode_t ACS_TABLE_OFF_TRANS_ID = 0x61000001; + +void satsystem::acsSubsystemInit() { + ModeListEntry entry; + Subsystem *acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); + buildOffSequence(acsSubsystem, entry); +} + +void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { + // Build OFF target + ss->addTable(&ACS_TABLE_OFF_TGT, ACS_TABLE_OFF_TGT_ID, false, true); + + // Build OFF transition + eh.setObject(objects::ACS_CONTROLLER); + eh.setMode(HasModesIF::MODE_OFF); + eh.setSubmode(0); + ACS_TABLE_OFF_TRANS.insert(eh); + + eh.setObject(objects::IMTQ_HANDLER); + eh.setMode(HasModesIF::MODE_OFF); + eh.setSubmode(0); + ACS_TABLE_OFF_TRANS.insert(eh); + + eh.setObject(objects::STAR_TRACKER); + eh.setMode(HasModesIF::MODE_OFF); + eh.setSubmode(0); + ACS_TABLE_OFF_TRANS.insert(eh); + + eh.setObject(objects::ACS_BOARD_ASS); + eh.setMode(HasModesIF::MODE_OFF); + eh.setSubmode(0); + ACS_TABLE_OFF_TRANS.insert(eh); + + eh.setObject(objects::SUS_BOARD_ASS); + eh.setMode(HasModesIF::MODE_OFF); + eh.setSubmode(0); + ACS_TABLE_OFF_TRANS.insert(eh); + + eh.setObject(objects::RW_ASS); + eh.setMode(HasModesIF::MODE_OFF); + eh.setSubmode(0); + ACS_TABLE_OFF_TRANS.insert(eh); + + ss->addTable(&ACS_TABLE_OFF_TRANS, ACS_TABLE_OFF_TRANS_ID, false, true); + + // Build OFF sequence + eh.setTableId(ACS_TABLE_OFF_TGT_ID); + eh.setWaitSeconds(0); + eh.setCheckSuccess(false); + ACS_SEQUENCE_OFF.insert(eh); + + eh.setTableId(ACS_TABLE_OFF_TRANS_ID); + eh.setWaitSeconds(0); + eh.setCheckSuccess(false); + ACS_SEQUENCE_OFF.insert(eh); + + ss->addSequence(&ACS_SEQUENCE_OFF, ACS_SEQUENCE_OFF_ID, ACS_SEQUENCE_OFF_ID, false, true); + ss->setInitialMode(HasModesIF::MODE_OFF); +} diff --git a/bsp_q7s/core/acsModeTree.h b/bsp_q7s/core/acsModeTree.h new file mode 100644 index 00000000..34811349 --- /dev/null +++ b/bsp_q7s/core/acsModeTree.h @@ -0,0 +1,10 @@ +#include + +class Subsystem; + +namespace satsystem { + +void acsSubsystemInit(); +void buildOffSequence(Subsystem* ss, ModeListEntry& entryHelper); + +} diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index a4f3319e..0b27a023 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -97,7 +97,10 @@ enum commonObjects: uint32_t { // 0x73 ('s') for assemblies and system/subsystem components ACS_BOARD_ASS = 0x73000001, SUS_BOARD_ASS = 0x73000002, - TCS_BOARD_ASS = 0x73000003 + TCS_BOARD_ASS = 0x73000003, + RW_ASS = 0x73000004, + ACS_SUBSYSTEM = 0x73010001, + EIVE_SYSTEM = 0x73010000, }; } diff --git a/generators/fsfwgen b/generators/fsfwgen index 5ad9fb94..19e8ee90 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5 +Subproject commit 19e8ee90be12f72ceb8c2aefdfd665b5babad417 From 874e06baa1b8e97061c35779dc06157c872e9395 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 22 Apr 2022 17:49:28 +0200 Subject: [PATCH 017/361] continued acs subsystem --- bsp_q7s/core/acsModeTree.cpp | 135 +++++++++++++++--- bsp_q7s/core/acsModeTree.h | 5 + generators/fsfwgen | 2 +- .../AcsControllerDefinitions.h | 21 +++ 4 files changed, 144 insertions(+), 19 deletions(-) create mode 100644 mission/controller/controllerdefinitions/AcsControllerDefinitions.h diff --git a/bsp_q7s/core/acsModeTree.cpp b/bsp_q7s/core/acsModeTree.cpp index c097d971..58c1159a 100644 --- a/bsp_q7s/core/acsModeTree.cpp +++ b/bsp_q7s/core/acsModeTree.cpp @@ -1,6 +1,8 @@ #include +#include #include "acsModeTree.h" +#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" #include #include #include @@ -9,50 +11,69 @@ FixedArrayList ACS_SEQUENCE_OFF = FixedArrayList ACS_TABLE_OFF_TGT = FixedArrayList(); FixedArrayList ACS_TABLE_OFF_TRANS = FixedArrayList(); -static constexpr Mode_t ACS_SEQUENCE_OFF_ID = HasModesIF::MODE_OFF; -static constexpr Mode_t ACS_TABLE_OFF_TGT_ID = 0x61000000; -static constexpr Mode_t ACS_TABLE_OFF_TRANS_ID = 0x61000001; +static constexpr Mode_t ACS_SEQUENCE_OFF_ID = acs::CtrlModes::OFF; +static constexpr Mode_t ACS_TABLE_OFF_TGT_ID = (acs::CtrlModes::OFF << 8) | 1; +static constexpr Mode_t ACS_TABLE_OFF_TRANS_ID = (acs::CtrlModes::OFF << 8) | 2; + +FixedArrayList ACS_SEQUENCE_DETUMBLE = FixedArrayList(); +FixedArrayList ACS_TABLE_DETUMBLE_TGT = FixedArrayList(); +FixedArrayList ACS_TABLE_DETUMBLE_TRANS_0 = FixedArrayList(); +FixedArrayList ACS_TABLE_DETUMBLE_TRANS_1 = FixedArrayList(); + +static constexpr Mode_t ACS_SEQUENCE_DETUMBLE_ID = acs::CtrlModes::DETUMBLE; +static constexpr Mode_t ACS_TABLE_DETUMBLE_TGT_ID = (acs::CtrlModes::DETUMBLE << 8) | 1; +static constexpr Mode_t ACS_TABLE_DETUMBLE_TRANS_0_ID = (acs::CtrlModes::DETUMBLE << 8) | 2; +static constexpr Mode_t ACS_TABLE_DETUMBLE_TRANS_1_ID = (acs::CtrlModes::DETUMBLE << 8) | 3; + +// Alias for checker function +const auto CHK = satsystem::checkInsert; +static const auto OFF = HasModesIF::MODE_OFF; +static const auto NML = DeviceHandlerIF::MODE_NORMAL; void satsystem::acsSubsystemInit() { ModeListEntry entry; Subsystem *acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); buildOffSequence(acsSubsystem, entry); + buildDetumbleSequence(acsSubsystem, entry); + acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); } void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::buildOffSequence"; + auto ctxc = context.c_str(); // Build OFF target ss->addTable(&ACS_TABLE_OFF_TGT, ACS_TABLE_OFF_TGT_ID, false, true); // Build OFF transition eh.setObject(objects::ACS_CONTROLLER); - eh.setMode(HasModesIF::MODE_OFF); + eh.setMode(OFF); eh.setSubmode(0); - ACS_TABLE_OFF_TRANS.insert(eh); + CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::IMTQ_HANDLER); - eh.setMode(HasModesIF::MODE_OFF); + eh.setMode(OFF); eh.setSubmode(0); - ACS_TABLE_OFF_TRANS.insert(eh); + CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::STAR_TRACKER); - eh.setMode(HasModesIF::MODE_OFF); + eh.setMode(OFF); eh.setSubmode(0); - ACS_TABLE_OFF_TRANS.insert(eh); + CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::ACS_BOARD_ASS); - eh.setMode(HasModesIF::MODE_OFF); + eh.setMode(OFF); eh.setSubmode(0); - ACS_TABLE_OFF_TRANS.insert(eh); + CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::SUS_BOARD_ASS); - eh.setMode(HasModesIF::MODE_OFF); + eh.setMode(OFF); eh.setSubmode(0); - ACS_TABLE_OFF_TRANS.insert(eh); + CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); eh.setObject(objects::RW_ASS); - eh.setMode(HasModesIF::MODE_OFF); + eh.setMode(OFF); eh.setSubmode(0); - ACS_TABLE_OFF_TRANS.insert(eh); + CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); ss->addTable(&ACS_TABLE_OFF_TRANS, ACS_TABLE_OFF_TRANS_ID, false, true); @@ -60,13 +81,91 @@ void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(ACS_TABLE_OFF_TGT_ID); eh.setWaitSeconds(0); eh.setCheckSuccess(false); - ACS_SEQUENCE_OFF.insert(eh); + CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); eh.setTableId(ACS_TABLE_OFF_TRANS_ID); eh.setWaitSeconds(0); eh.setCheckSuccess(false); - ACS_SEQUENCE_OFF.insert(eh); + CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); ss->addSequence(&ACS_SEQUENCE_OFF, ACS_SEQUENCE_OFF_ID, ACS_SEQUENCE_OFF_ID, false, true); - ss->setInitialMode(HasModesIF::MODE_OFF); +} + +void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { + + std::string context = "satsystem::buildDetumbleSequence"; + auto ctxc = context.c_str(); + // Build DETUMBLE target + eh.setObject(objects::ACS_CONTROLLER); + eh.setMode(acs::CtrlModes::DETUMBLE); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); + + eh.setObject(objects::IMTQ_HANDLER); + eh.setMode(NML); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); + + eh.setObject(objects::SUS_BOARD_ASS); + eh.setMode(NML); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); + + eh.setObject(objects::ACS_BOARD_ASS); + eh.setMode(NML); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); + + ss->addTable(&ACS_TABLE_DETUMBLE_TGT, ACS_TABLE_DETUMBLE_TGT_ID, false, true); + + // Build DETUMBLE transition 0 + + eh.setObject(objects::IMTQ_HANDLER); + eh.setMode(NML); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); + + eh.setObject(objects::STAR_TRACKER); + eh.setMode(OFF); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); + + eh.setObject(objects::ACS_BOARD_ASS); + eh.setMode(NML); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); + + eh.setObject(objects::SUS_BOARD_ASS); + eh.setMode(NML); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); + + eh.setObject(objects::RW_ASS); + eh.setMode(OFF); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); + + ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0, ACS_TABLE_DETUMBLE_TRANS_0_ID, false, true); + + // Build DETUMBLE transition 1 + + eh.setObject(objects::ACS_CONTROLLER); + eh.setMode(acs::CtrlModes::DETUMBLE); + eh.setSubmode(0); + CHK(ACS_TABLE_DETUMBLE_TRANS_1.insert(eh), ctxc); + ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1, ACS_TABLE_DETUMBLE_TRANS_1_ID, false, true); + + ss->addSequence(&ACS_SEQUENCE_DETUMBLE, ACS_SEQUENCE_DETUMBLE_ID, 0 /*Ãœ TODO*/, false, true); +} + +void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {} + +void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {} + +void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {} + +void satsystem::checkInsert(ReturnValue_t result, const char* ctx) { + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Insertion failed at " << ctx << std::endl; + } } diff --git a/bsp_q7s/core/acsModeTree.h b/bsp_q7s/core/acsModeTree.h index 34811349..8f0c593d 100644 --- a/bsp_q7s/core/acsModeTree.h +++ b/bsp_q7s/core/acsModeTree.h @@ -6,5 +6,10 @@ namespace satsystem { void acsSubsystemInit(); void buildOffSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); +void checkInsert(ReturnValue_t result, const char* ctx); } diff --git a/generators/fsfwgen b/generators/fsfwgen index 19e8ee90..9d7963f3 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit 19e8ee90be12f72ceb8c2aefdfd665b5babad417 +Subproject commit 9d7963f3292c669814810adf50d6820b2e5c29b7 diff --git a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h new file mode 100644 index 00000000..43cce539 --- /dev/null +++ b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h @@ -0,0 +1,21 @@ +#ifndef MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ +#define MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ + +#include + +namespace acs { + +enum CtrlModes { + OFF = HasModesIF::MODE_OFF, + IDLE = 1, + DETUMBLE = 2, + SAFE = 3, + IDLE = 4, + TARGET_PT = 5 +}; + +} + + + +#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ */ From e3783d09416e46c2cb995752f8b6ee0c2af1e7bf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Apr 2022 12:37:12 +0200 Subject: [PATCH 018/361] small fix --- fsfw | 2 +- .../controller/controllerdefinitions/AcsControllerDefinitions.h | 1 - tmtc | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fsfw b/fsfw index 24ef96d1..280b641c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 24ef96d1b802e768d395f94b69f9f81a3c6d1e66 +Subproject commit 280b641cbc621d0c00c89851aaffbb64d5e5f40b diff --git a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h index 43cce539..c05f1b27 100644 --- a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h @@ -7,7 +7,6 @@ namespace acs { enum CtrlModes { OFF = HasModesIF::MODE_OFF, - IDLE = 1, DETUMBLE = 2, SAFE = 3, IDLE = 4, diff --git a/tmtc b/tmtc index 28983d38..b1aaef90 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 28983d387b82578a73fbfe052cb53dec1910d021 +Subproject commit b1aaef90c72874f501c6524ec967827f17e8cedf From baa6f05f8eeaa79c6f7ac7855db4587646c0db2b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 08:48:22 +0200 Subject: [PATCH 019/361] neat --- bsp_q7s/core/acsModeTree.cpp | 185 +++++++----------- bsp_q7s/core/acsModeTree.h | 2 +- .../AcsControllerDefinitions.h | 10 +- 3 files changed, 70 insertions(+), 127 deletions(-) diff --git a/bsp_q7s/core/acsModeTree.cpp b/bsp_q7s/core/acsModeTree.cpp index 58c1159a..207a98bf 100644 --- a/bsp_q7s/core/acsModeTree.cpp +++ b/bsp_q7s/core/acsModeTree.cpp @@ -1,38 +1,36 @@ +#include "acsModeTree.h" + #include #include - -#include "acsModeTree.h" -#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" -#include -#include #include +#include +#include -FixedArrayList ACS_SEQUENCE_OFF = FixedArrayList(); -FixedArrayList ACS_TABLE_OFF_TGT = FixedArrayList(); -FixedArrayList ACS_TABLE_OFF_TRANS = FixedArrayList(); - -static constexpr Mode_t ACS_SEQUENCE_OFF_ID = acs::CtrlModes::OFF; -static constexpr Mode_t ACS_TABLE_OFF_TGT_ID = (acs::CtrlModes::OFF << 8) | 1; -static constexpr Mode_t ACS_TABLE_OFF_TRANS_ID = (acs::CtrlModes::OFF << 8) | 2; - -FixedArrayList ACS_SEQUENCE_DETUMBLE = FixedArrayList(); -FixedArrayList ACS_TABLE_DETUMBLE_TGT = FixedArrayList(); -FixedArrayList ACS_TABLE_DETUMBLE_TRANS_0 = FixedArrayList(); -FixedArrayList ACS_TABLE_DETUMBLE_TRANS_1 = FixedArrayList(); - -static constexpr Mode_t ACS_SEQUENCE_DETUMBLE_ID = acs::CtrlModes::DETUMBLE; -static constexpr Mode_t ACS_TABLE_DETUMBLE_TGT_ID = (acs::CtrlModes::DETUMBLE << 8) | 1; -static constexpr Mode_t ACS_TABLE_DETUMBLE_TRANS_0_ID = (acs::CtrlModes::DETUMBLE << 8) | 2; -static constexpr Mode_t ACS_TABLE_DETUMBLE_TRANS_1_ID = (acs::CtrlModes::DETUMBLE << 8) | 3; +#include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" // Alias for checker function const auto CHK = satsystem::checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; +auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlModes::OFF, FixedArrayList()); +auto ACS_TABLE_OFF_TGT = + std::make_pair((acs::CtrlModes::OFF << 8) | 1, FixedArrayList()); +auto ACS_TABLE_OFF_TRANS = + std::make_pair((acs::CtrlModes::OFF << 8) | 2, FixedArrayList()); + +auto ACS_SEQUENCE_DETUMBLE = + std::make_pair(acs::CtrlModes::DETUMBLE, FixedArrayList()); +auto ACS_TABLE_DETUMBLE_TGT = + std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 1, FixedArrayList()); +auto ACS_TABLE_DETUMBLE_TRANS_0 = + std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 2, FixedArrayList()); +auto ACS_TABLE_DETUMBLE_TRANS_1 = + std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 3, FixedArrayList()); + void satsystem::acsSubsystemInit() { ModeListEntry entry; - Subsystem *acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); + Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); buildOffSequence(acsSubsystem, entry); buildDetumbleSequence(acsSubsystem, entry); acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); @@ -41,121 +39,74 @@ void satsystem::acsSubsystemInit() { void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildOffSequence"; auto ctxc = context.c_str(); - // Build OFF target - ss->addTable(&ACS_TABLE_OFF_TGT, ACS_TABLE_OFF_TGT_ID, false, true); + + auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; // Build OFF transition - eh.setObject(objects::ACS_CONTROLLER); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); - - eh.setObject(objects::IMTQ_HANDLER); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); - - eh.setObject(objects::STAR_TRACKER); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); - - eh.setObject(objects::ACS_BOARD_ASS); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); - - eh.setObject(objects::SUS_BOARD_ASS); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); - - eh.setObject(objects::RW_ASS); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_OFF_TRANS.insert(eh), ctxc); - - ss->addTable(&ACS_TABLE_OFF_TRANS, ACS_TABLE_OFF_TRANS_ID, false, true); + ih(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); + ih(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); + ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second); + ih(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); + ih(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); + ih(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); // Build OFF sequence - eh.setTableId(ACS_TABLE_OFF_TGT_ID); + eh.setTableId(ACS_TABLE_OFF_TGT.first); eh.setWaitSeconds(0); eh.setCheckSuccess(false); - CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); + CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc); - eh.setTableId(ACS_TABLE_OFF_TRANS_ID); + eh.setTableId(ACS_TABLE_OFF_TRANS.first); eh.setWaitSeconds(0); eh.setCheckSuccess(false); - CHK(ACS_SEQUENCE_OFF.insert(eh), ctxc); + CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc); - ss->addSequence(&ACS_SEQUENCE_OFF, ACS_SEQUENCE_OFF_ID, ACS_SEQUENCE_OFF_ID, false, true); + // Build OFF target + ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true); + ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true); + ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false, + true); } void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { - std::string context = "satsystem::buildDetumbleSequence"; auto ctxc = context.c_str(); + auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; // Build DETUMBLE target - eh.setObject(objects::ACS_CONTROLLER); - eh.setMode(acs::CtrlModes::DETUMBLE); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); + ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); + ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); + ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); + ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); - eh.setObject(objects::IMTQ_HANDLER); - eh.setMode(NML); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); - - eh.setObject(objects::SUS_BOARD_ASS); - eh.setMode(NML); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); - - eh.setObject(objects::ACS_BOARD_ASS); - eh.setMode(NML); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TGT.insert(eh), ctxc); - - ss->addTable(&ACS_TABLE_DETUMBLE_TGT, ACS_TABLE_DETUMBLE_TGT_ID, false, true); + ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true); // Build DETUMBLE transition 0 - - eh.setObject(objects::IMTQ_HANDLER); - eh.setMode(NML); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); - - eh.setObject(objects::STAR_TRACKER); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); - - eh.setObject(objects::ACS_BOARD_ASS); - eh.setMode(NML); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); - - eh.setObject(objects::SUS_BOARD_ASS); - eh.setMode(NML); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); - - eh.setObject(objects::RW_ASS); - eh.setMode(OFF); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TRANS_0.insert(eh), ctxc); - - ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0, ACS_TABLE_DETUMBLE_TRANS_0_ID, false, true); + ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + ih(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); // Build DETUMBLE transition 1 + ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); - eh.setObject(objects::ACS_CONTROLLER); - eh.setMode(acs::CtrlModes::DETUMBLE); - eh.setSubmode(0); - CHK(ACS_TABLE_DETUMBLE_TRANS_1.insert(eh), ctxc); - ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1, ACS_TABLE_DETUMBLE_TRANS_1_ID, false, true); - - ss->addSequence(&ACS_SEQUENCE_DETUMBLE, ACS_SEQUENCE_DETUMBLE_ID, 0 /*Ãœ TODO*/, false, true); + // Build full sequence + ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true); + ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true); + ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, + ACS_SEQUENCE_DETUMBLE.first, false, true); } void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {} @@ -165,7 +116,7 @@ void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {} void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {} void satsystem::checkInsert(ReturnValue_t result, const char* ctx) { - if(result != HasReturnvaluesIF::RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { sif::error << "Insertion failed at " << ctx << std::endl; } } diff --git a/bsp_q7s/core/acsModeTree.h b/bsp_q7s/core/acsModeTree.h index 8f0c593d..f37d0f75 100644 --- a/bsp_q7s/core/acsModeTree.h +++ b/bsp_q7s/core/acsModeTree.h @@ -12,4 +12,4 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); void checkInsert(ReturnValue_t result, const char* ctx); -} +} // namespace satsystem diff --git a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h index c05f1b27..d0733046 100644 --- a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h @@ -5,16 +5,8 @@ namespace acs { -enum CtrlModes { - OFF = HasModesIF::MODE_OFF, - DETUMBLE = 2, - SAFE = 3, - IDLE = 4, - TARGET_PT = 5 -}; +enum CtrlModes { OFF = HasModesIF::MODE_OFF, DETUMBLE = 2, SAFE = 3, IDLE = 4, TARGET_PT = 5 }; } - - #endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCONTROLLERDEFINITIONS_H_ */ From bbb4ba2191582bb70d4289329504a84bfd85b3e3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 10:08:29 +0200 Subject: [PATCH 020/361] baseline acs mode tree done --- bsp_q7s/core/acsModeTree.cpp | 268 +++++++++++++++++++++++++++++------ 1 file changed, 226 insertions(+), 42 deletions(-) diff --git a/bsp_q7s/core/acsModeTree.cpp b/bsp_q7s/core/acsModeTree.cpp index 207a98bf..f99b79fc 100644 --- a/bsp_q7s/core/acsModeTree.cpp +++ b/bsp_q7s/core/acsModeTree.cpp @@ -20,100 +20,284 @@ auto ACS_TABLE_OFF_TRANS = std::make_pair((acs::CtrlModes::OFF << 8) | 2, FixedArrayList()); auto ACS_SEQUENCE_DETUMBLE = - std::make_pair(acs::CtrlModes::DETUMBLE, FixedArrayList()); + std::make_pair(acs::CtrlModes::DETUMBLE, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TGT = - std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 1, FixedArrayList()); + std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 1, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_0 = std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 2, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_1 = std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 3, FixedArrayList()); +auto ACS_SEQUENCE_SAFE = + std::make_pair(acs::CtrlModes::SAFE, FixedArrayList()); +auto ACS_TABLE_SAFE_TGT = + std::make_pair((acs::CtrlModes::SAFE << 8) | 1, FixedArrayList()); +auto ACS_TABLE_SAFE_TRANS_0 = + std::make_pair((acs::CtrlModes::SAFE << 8) | 2, FixedArrayList()); +auto ACS_TABLE_SAFE_TRANS_1 = + std::make_pair((acs::CtrlModes::SAFE << 8) | 3, FixedArrayList()); + +auto ACS_SEQUENCE_IDLE = + std::make_pair(acs::CtrlModes::IDLE, FixedArrayList()); +auto ACS_TABLE_IDLE_TGT = + std::make_pair((acs::CtrlModes::IDLE << 8) | 1, FixedArrayList()); +auto ACS_TABLE_IDLE_TRANS_0 = + std::make_pair((acs::CtrlModes::IDLE << 8) | 2, FixedArrayList()); +auto ACS_TABLE_IDLE_TRANS_1 = + std::make_pair((acs::CtrlModes::IDLE << 8) | 3, FixedArrayList()); + +auto ACS_SEQUENCE_TARGET_PT = + std::make_pair(acs::CtrlModes::TARGET_PT, FixedArrayList()); +auto ACS_TABLE_TARGET_PT_TGT = + std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 1, FixedArrayList()); +auto ACS_TABLE_TARGET_PT_TRANS_0 = + std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 2, FixedArrayList()); +auto ACS_TABLE_TARGET_PT_TRANS_1 = + std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 3, FixedArrayList()); + +enum InsertType { + TABLE, + SEQ +}; + void satsystem::acsSubsystemInit() { ModeListEntry entry; Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); buildOffSequence(acsSubsystem, entry); + buildSafeSequence(acsSubsystem, entry); buildDetumbleSequence(acsSubsystem, entry); + buildIdleSequence(acsSubsystem, entry); + buildTargetPtSequence(acsSubsystem, entry); acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); } void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildOffSequence"; auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& table) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; - auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode, + // OFF Target table is empty + ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true); + + // Build OFF transition + iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); + iht(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); + iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second); + iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); + iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); + iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); + ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true); + + // Build OFF sequence + ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false); + ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false); + ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false, + true); +} + +void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::buildSafeSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); CHK(sequence.insert(eh), ctxc); }; + // Insert Helper Sequence + auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; + // Build SAFE target + iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); + ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true); - // Build OFF transition - ih(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); - ih(objects::IMTQ_HANDLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); - ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_OFF_TRANS.second); - ih(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - ih(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - ih(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); + // Build SAFE transition 0 + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); + iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); + iht(objects::RW_ASS, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); + ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true); - // Build OFF sequence - eh.setTableId(ACS_TABLE_OFF_TGT.first); - eh.setWaitSeconds(0); - eh.setCheckSuccess(false); - CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc); + // Build SAFE transition 1 + iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); + ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true); - eh.setTableId(ACS_TABLE_OFF_TRANS.first); - eh.setWaitSeconds(0); - eh.setCheckSuccess(false); - CHK(ACS_SEQUENCE_OFF.second.insert(eh), ctxc); - - // Build OFF target - ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true); - ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true); - ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false, + // Build SAFE sequence + ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, false); + ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_0.first, 0, false); + ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_1.first, 0, false); + ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, false, true); } void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildDetumbleSequence"; auto ctxc = context.c_str(); - auto ih = [&](object_id_t obj, Mode_t mode, Submode_t submode, + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& sequence) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); CHK(sequence.insert(eh), ctxc); }; + // Insert Helper Sequence + auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; // Build DETUMBLE target - ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); - ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); - ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); - ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); - + iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true); // Build DETUMBLE transition 0 - ih(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - ih(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - ih(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - ih(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - ih(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true); // Build DETUMBLE transition 1 - ih(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); - - // Build full sequence - ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true); + iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true); + + // Build DETUMBLE sequence + ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, false); + ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_0.first, 0, false); + ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_1.first, 0, false); ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, ACS_SEQUENCE_DETUMBLE.first, false, true); } -void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) {} -void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) {} +void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::buildIdleSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; + // Build IDLE target + iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TGT.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TGT.second); + ss->addTable(&ACS_TABLE_IDLE_TGT.second, ACS_TABLE_IDLE_TGT.first, false, true); -void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) {} + // Build IDLE transition 0 + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + ss->addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true); + + // Build IDLE transition 1 + iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); + ss->addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true); + + // Build IDLE sequence + ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TGT.first, 0, false); + ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, false); + ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, false); + ss->addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, + ACS_SEQUENCE_IDLE.first, false, true); +} + +void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::buildTargetPtSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; + + // Build TARGET PT table + iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); + ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true); + + // Build TARGET PT transition 0 + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); + iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); + ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, true); + + // Build TARGET PT transition 1 + iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second); + ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, true); + + // Build IDLE sequence + ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, false); + ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, false); + ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false); + ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, + ACS_SEQUENCE_TARGET_PT.first, false, true); +} void satsystem::checkInsert(ReturnValue_t result, const char* ctx) { if (result != HasReturnvaluesIF::RETURN_OK) { From 298148eebfd6f542a07741cafc41dd2b44390c16 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 10:08:54 +0200 Subject: [PATCH 021/361] bump fsfwgen --- generators/fsfwgen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/fsfwgen b/generators/fsfwgen index 9d7963f3..d2bdabbf 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit 9d7963f3292c669814810adf50d6820b2e5c29b7 +Subproject commit d2bdabbf0f213747efc18cb45fcf2a2294b14bc8 From 9ba65b04fd703d55518f8506e6aa6ce143205ebe Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 10:30:47 +0200 Subject: [PATCH 022/361] add IDLE charge mode --- bsp_q7s/core/acsModeTree.cpp | 224 ++++++++++++------ bsp_q7s/core/acsModeTree.h | 1 + .../AcsControllerDefinitions.h | 6 +- 3 files changed, 154 insertions(+), 77 deletions(-) diff --git a/bsp_q7s/core/acsModeTree.cpp b/bsp_q7s/core/acsModeTree.cpp index f99b79fc..b944caa9 100644 --- a/bsp_q7s/core/acsModeTree.cpp +++ b/bsp_q7s/core/acsModeTree.cpp @@ -13,60 +13,66 @@ const auto CHK = satsystem::checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; -auto ACS_SEQUENCE_OFF = std::make_pair(acs::CtrlModes::OFF, FixedArrayList()); +auto ACS_SEQUENCE_OFF = + std::make_pair(acs::CtrlModes::OFF << 24, FixedArrayList()); auto ACS_TABLE_OFF_TGT = - std::make_pair((acs::CtrlModes::OFF << 8) | 1, FixedArrayList()); + std::make_pair((acs::CtrlModes::OFF << 24) | 1, FixedArrayList()); auto ACS_TABLE_OFF_TRANS = - std::make_pair((acs::CtrlModes::OFF << 8) | 2, FixedArrayList()); + std::make_pair((acs::CtrlModes::OFF << 24) | 2, FixedArrayList()); auto ACS_SEQUENCE_DETUMBLE = - std::make_pair(acs::CtrlModes::DETUMBLE, FixedArrayList()); + std::make_pair(acs::CtrlModes::DETUMBLE << 24, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TGT = - std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 1, FixedArrayList()); + std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 1, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_0 = - std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 2, FixedArrayList()); + std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 2, FixedArrayList()); auto ACS_TABLE_DETUMBLE_TRANS_1 = - std::make_pair((acs::CtrlModes::DETUMBLE << 8) | 3, FixedArrayList()); + std::make_pair((acs::CtrlModes::DETUMBLE << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_SAFE = - std::make_pair(acs::CtrlModes::SAFE, FixedArrayList()); + std::make_pair(acs::CtrlModes::SAFE << 24, FixedArrayList()); auto ACS_TABLE_SAFE_TGT = - std::make_pair((acs::CtrlModes::SAFE << 8) | 1, FixedArrayList()); + std::make_pair((acs::CtrlModes::SAFE << 24) | 1, FixedArrayList()); auto ACS_TABLE_SAFE_TRANS_0 = - std::make_pair((acs::CtrlModes::SAFE << 8) | 2, FixedArrayList()); + std::make_pair((acs::CtrlModes::SAFE << 24) | 2, FixedArrayList()); auto ACS_TABLE_SAFE_TRANS_1 = - std::make_pair((acs::CtrlModes::SAFE << 8) | 3, FixedArrayList()); + std::make_pair((acs::CtrlModes::SAFE << 24) | 3, FixedArrayList()); auto ACS_SEQUENCE_IDLE = - std::make_pair(acs::CtrlModes::IDLE, FixedArrayList()); + std::make_pair(acs::CtrlModes::IDLE << 24, FixedArrayList()); auto ACS_TABLE_IDLE_TGT = - std::make_pair((acs::CtrlModes::IDLE << 8) | 1, FixedArrayList()); + std::make_pair((acs::CtrlModes::IDLE << 24) | 1, FixedArrayList()); auto ACS_TABLE_IDLE_TRANS_0 = - std::make_pair((acs::CtrlModes::IDLE << 8) | 2, FixedArrayList()); + std::make_pair((acs::CtrlModes::IDLE << 24) | 2, FixedArrayList()); auto ACS_TABLE_IDLE_TRANS_1 = - std::make_pair((acs::CtrlModes::IDLE << 8) | 3, FixedArrayList()); + std::make_pair((acs::CtrlModes::IDLE << 24) | 3, FixedArrayList()); + +auto ACS_SEQUENCE_IDLE_CHRG = std::make_pair(acs::CtrlModes::IDLE << 24 | (acs::IDLE_CHARGE << 8), + FixedArrayList()); +auto ACS_TABLE_IDLE_CHRG_TGT = std::make_pair( + (acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 1, FixedArrayList()); +auto ACS_TABLE_IDLE_CHRG_TRANS_0 = std::make_pair( + (acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 2, FixedArrayList()); +auto ACS_TABLE_IDLE_CHRG_TRANS_1 = std::make_pair( + (acs::CtrlModes::IDLE << 24) | (acs::IDLE_CHARGE << 8) | 3, FixedArrayList()); auto ACS_SEQUENCE_TARGET_PT = std::make_pair(acs::CtrlModes::TARGET_PT, FixedArrayList()); auto ACS_TABLE_TARGET_PT_TGT = - std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 1, FixedArrayList()); + std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 1, FixedArrayList()); auto ACS_TABLE_TARGET_PT_TRANS_0 = - std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 2, FixedArrayList()); + std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 2, FixedArrayList()); auto ACS_TABLE_TARGET_PT_TRANS_1 = - std::make_pair((acs::CtrlModes::TARGET_PT << 8) | 3, FixedArrayList()); - -enum InsertType { - TABLE, - SEQ -}; + std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList()); void satsystem::acsSubsystemInit() { ModeListEntry entry; - Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 20, 20); + Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24); buildOffSequence(acsSubsystem, entry); buildSafeSequence(acsSubsystem, entry); buildDetumbleSequence(acsSubsystem, entry); buildIdleSequence(acsSubsystem, entry); + buildIdleChargeSequence(acsSubsystem, entry); buildTargetPtSequence(acsSubsystem, entry); acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); } @@ -75,16 +81,15 @@ void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildOffSequence"; auto ctxc = context.c_str(); // Insert Helper Table - auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, - ArrayList& table) { + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); CHK(table.insert(eh), ctxc); }; // Insert Helper Sequence - auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, - bool checkSuccess) { + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); @@ -92,7 +97,7 @@ void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { }; // OFF Target table is empty - ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true); + CHK(ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); // Build OFF transition iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); @@ -101,13 +106,14 @@ void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true); + CHK(ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc); // Build OFF sequence ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false); ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false); - ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false, - true); + CHK(ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, + false, true), + ctxc); } void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { @@ -115,15 +121,15 @@ void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, - ArrayList& sequence) { + ArrayList& sequence) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); CHK(sequence.insert(eh), ctxc); }; // Insert Helper Sequence - auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, - bool checkSuccess) { + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); @@ -134,7 +140,7 @@ void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); - ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true); + CHK(ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); // Build SAFE transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); @@ -142,18 +148,21 @@ void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); - ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true); + CHK(ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true), + ctxc); // Build SAFE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); - ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true); + CHK(ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), + ctxc); // Build SAFE sequence - ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, false); + ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, true); ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_0.first, 0, false); ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_1.first, 0, false); - ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, false, - true); + CHK(ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, + false, true), + ctxc); } void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { @@ -161,15 +170,15 @@ void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, - ArrayList& sequence) { + ArrayList& sequence) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); CHK(sequence.insert(eh), ctxc); }; // Insert Helper Sequence - auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, - bool checkSuccess) { + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); @@ -180,7 +189,8 @@ void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); - ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true); + CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true), + ctxc); // Build DETUMBLE transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); @@ -188,35 +198,39 @@ void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true); + CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, + true), + ctxc); // Build DETUMBLE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); - ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true); + CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, + true), + ctxc); // Build DETUMBLE sequence - ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, false); + ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, true); ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_0.first, 0, false); ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_1.first, 0, false); - ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, - ACS_SEQUENCE_DETUMBLE.first, false, true); + CHK(ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, + ACS_SEQUENCE_SAFE.first, false, true), + ctxc); } - void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildIdleSequence"; auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, - ArrayList& sequence) { + ArrayList& sequence) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); CHK(sequence.insert(eh), ctxc); }; // Insert Helper Sequence - auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, - bool checkSuccess) { + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); @@ -231,23 +245,77 @@ void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { ss->addTable(&ACS_TABLE_IDLE_TGT.second, ACS_TABLE_IDLE_TGT.first, false, true); // Build IDLE transition 0 - iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - iht(objects::RW_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); + iht(objects::RW_ASS, NML, 0, ACS_TABLE_IDLE_TRANS_0.second); + iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_TRANS_0.second); ss->addTable(&ACS_TABLE_IDLE_TRANS_0.second, ACS_TABLE_IDLE_TRANS_0.first, false, true); // Build IDLE transition 1 - iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); + iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TRANS_1.second); ss->addTable(&ACS_TABLE_IDLE_TRANS_1.second, ACS_TABLE_IDLE_TRANS_1.first, false, true); // Build IDLE sequence - ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TGT.first, 0, false); - ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, false); + ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TGT.first, 0, true); + ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_IDLE.second, ACS_TABLE_IDLE_TRANS_1.first, 0, false); - ss->addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, - ACS_SEQUENCE_IDLE.first, false, true); + ss->addSequence(&ACS_SEQUENCE_IDLE.second, ACS_SEQUENCE_IDLE.first, ACS_SEQUENCE_SAFE.first, + false, true); +} + +void satsystem::buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { + std::string context = "satsystem::buildIdleChargeSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, + ArrayList& sequence) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + CHK(sequence.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + CHK(sequence.insert(eh), ctxc); + }; + // Build IDLE target + iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, + ACS_TABLE_IDLE_CHRG_TGT.second); + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); + CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true), + ctxc); + + // Build IDLE transition 0 + iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); + iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); + iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); + iht(objects::RW_ASS, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); + iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); + CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false, + true), + ctxc); + + // Build IDLE transition 1 + iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, + ACS_TABLE_IDLE_CHRG_TRANS_1.second); + CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false, + true), + ctxc); + + // Build IDLE sequence + ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TGT.first, 0, true); + ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, 0, true); + ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, 0, false); + CHK(ss->addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first, + ACS_SEQUENCE_SAFE.first, false, true), + ctxc); } void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { @@ -255,15 +323,15 @@ void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { auto ctxc = context.c_str(); // Insert Helper Table auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, - ArrayList& sequence) { + ArrayList& sequence) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); CHK(sequence.insert(eh), ctxc); }; // Insert Helper Sequence - auto ihs = [&]( ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, - bool checkSuccess) { + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); @@ -277,7 +345,8 @@ void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true); + CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true), + ctxc); // Build TARGET PT transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); @@ -285,22 +354,27 @@ void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, true); + CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, + true), + ctxc); // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second); - ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, true); + CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, + true), + ctxc); // Build IDLE sequence - ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, false); - ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, false); + ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, true); + ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false); - ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, - ACS_SEQUENCE_TARGET_PT.first, false, true); + CHK(ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, + ACS_SEQUENCE_IDLE.first, false, true), + ctxc); } void satsystem::checkInsert(ReturnValue_t result, const char* ctx) { if (result != HasReturnvaluesIF::RETURN_OK) { - sif::error << "Insertion failed at " << ctx << std::endl; + sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; } } diff --git a/bsp_q7s/core/acsModeTree.h b/bsp_q7s/core/acsModeTree.h index f37d0f75..b6c96e39 100644 --- a/bsp_q7s/core/acsModeTree.h +++ b/bsp_q7s/core/acsModeTree.h @@ -9,6 +9,7 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); void checkInsert(ReturnValue_t result, const char* ctx); diff --git a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h index d0733046..8122178d 100644 --- a/mission/controller/controllerdefinitions/AcsControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/AcsControllerDefinitions.h @@ -5,8 +5,10 @@ namespace acs { -enum CtrlModes { OFF = HasModesIF::MODE_OFF, DETUMBLE = 2, SAFE = 3, IDLE = 4, TARGET_PT = 5 }; +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_ */ From f014e2d5c794897f17fa0a5a70e7ca3ae716a299 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 10:36:03 +0200 Subject: [PATCH 023/361] system folder restructuring --- bsp_q7s/core/CMakeLists.txt | 1 - bsp_q7s/core/ObjectFactory.cpp | 30 +++++++++---------- linux/ObjectFactory.cpp | 8 ++--- mission/devices/PayloadPcduHandler.h | 4 +-- mission/system/CMakeLists.txt | 19 ++---------- .../system/{ => objects}/AcsBoardAssembly.cpp | 0 .../system/{ => objects}/AcsBoardAssembly.h | 0 mission/system/{ => objects}/AcsBoardFdir.cpp | 0 mission/system/{ => objects}/AcsBoardFdir.h | 0 mission/system/{ => objects}/AcsSubsystem.cpp | 0 mission/system/{ => objects}/AcsSubsystem.h | 0 mission/system/objects/CMakeLists.txt | 17 +++++++++++ mission/system/{ => objects}/ComSubsystem.cpp | 0 mission/system/{ => objects}/ComSubsystem.h | 0 .../{ => objects}/DualLaneAssemblyBase.cpp | 0 .../{ => objects}/DualLaneAssemblyBase.h | 2 +- .../DualLanePowerStateMachine.cpp | 0 .../{ => objects}/DualLanePowerStateMachine.h | 2 +- mission/system/{ => objects}/EiveSystem.cpp | 0 mission/system/{ => objects}/EiveSystem.h | 0 .../system/{ => objects}/PayloadSubsystem.cpp | 0 .../system/{ => objects}/PayloadSubsystem.h | 0 .../{ => objects}/PowerStateMachineBase.cpp | 0 .../{ => objects}/PowerStateMachineBase.h | 0 mission/system/{ => objects}/RtdFdir.cpp | 0 mission/system/{ => objects}/RtdFdir.h | 0 mission/system/{ => objects}/SusAssembly.cpp | 0 mission/system/{ => objects}/SusAssembly.h | 0 mission/system/{ => objects}/SusFdir.cpp | 0 mission/system/{ => objects}/SusFdir.h | 0 .../system/{ => objects}/TcsBoardAssembly.cpp | 0 .../system/{ => objects}/TcsBoardAssembly.h | 0 mission/system/{ => objects}/definitions.h | 0 mission/system/tree/CMakeLists.txt | 3 ++ .../system/tree}/acsModeTree.cpp | 0 .../system/tree}/acsModeTree.h | 0 36 files changed, 45 insertions(+), 41 deletions(-) rename mission/system/{ => objects}/AcsBoardAssembly.cpp (100%) rename mission/system/{ => objects}/AcsBoardAssembly.h (100%) rename mission/system/{ => objects}/AcsBoardFdir.cpp (100%) rename mission/system/{ => objects}/AcsBoardFdir.h (100%) rename mission/system/{ => objects}/AcsSubsystem.cpp (100%) rename mission/system/{ => objects}/AcsSubsystem.h (100%) create mode 100644 mission/system/objects/CMakeLists.txt rename mission/system/{ => objects}/ComSubsystem.cpp (100%) rename mission/system/{ => objects}/ComSubsystem.h (100%) rename mission/system/{ => objects}/DualLaneAssemblyBase.cpp (100%) rename mission/system/{ => objects}/DualLaneAssemblyBase.h (98%) rename mission/system/{ => objects}/DualLanePowerStateMachine.cpp (100%) rename mission/system/{ => objects}/DualLanePowerStateMachine.h (91%) rename mission/system/{ => objects}/EiveSystem.cpp (100%) rename mission/system/{ => objects}/EiveSystem.h (100%) rename mission/system/{ => objects}/PayloadSubsystem.cpp (100%) rename mission/system/{ => objects}/PayloadSubsystem.h (100%) rename mission/system/{ => objects}/PowerStateMachineBase.cpp (100%) rename mission/system/{ => objects}/PowerStateMachineBase.h (100%) rename mission/system/{ => objects}/RtdFdir.cpp (100%) rename mission/system/{ => objects}/RtdFdir.h (100%) rename mission/system/{ => objects}/SusAssembly.cpp (100%) rename mission/system/{ => objects}/SusAssembly.h (100%) rename mission/system/{ => objects}/SusFdir.cpp (100%) rename mission/system/{ => objects}/SusFdir.h (100%) rename mission/system/{ => objects}/TcsBoardAssembly.cpp (100%) rename mission/system/{ => objects}/TcsBoardAssembly.h (100%) rename mission/system/{ => objects}/definitions.h (100%) create mode 100644 mission/system/tree/CMakeLists.txt rename {bsp_q7s/core => mission/system/tree}/acsModeTree.cpp (100%) rename {bsp_q7s/core => mission/system/tree}/acsModeTree.h (100%) diff --git a/bsp_q7s/core/CMakeLists.txt b/bsp_q7s/core/CMakeLists.txt index 30538565..8731b7a3 100644 --- a/bsp_q7s/core/CMakeLists.txt +++ b/bsp_q7s/core/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(${OBSW_NAME} PRIVATE - acsModeTree.cpp CoreController.cpp obsw.cpp InitMission.cpp diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index ecc88ede..a675ffc5 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -37,11 +37,11 @@ #include "linux/obc/PdecHandler.h" #include "linux/obc/Ptme.h" #include "linux/obc/PtmeConfig.h" -#include "mission/system/AcsBoardFdir.h" -#include "mission/system/RtdFdir.h" -#include "mission/system/SusAssembly.h" -#include "mission/system/SusFdir.h" -#include "mission/system/TcsBoardAssembly.h" +#include "mission/system/objects/AcsBoardFdir.h" +#include "mission/system/objects/RtdFdir.h" +#include "mission/system/objects/SusAssembly.h" +#include "mission/system/objects/SusFdir.h" +#include "mission/system/objects/TcsBoardAssembly.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" @@ -92,13 +92,13 @@ #include "mission/devices/devicedefinitions/SusDefinitions.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" #include "mission/devices/devicedefinitions/payloadPcduDefinitions.h" -#include "mission/system/AcsBoardAssembly.h" +#include "mission/system/objects/AcsBoardAssembly.h" #include "mission/tmtc/CCSDSHandler.h" #include "mission/tmtc/VirtualChannel.h" #include "mission/utility/TmFunnel.h" -ResetArgs resetArgsGnss0; -ResetArgs resetArgsGnss1; +ResetArgs RESET_ARGS_GNSS_0; +ResetArgs RESET_ARGS_GNSS_1; void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } @@ -537,15 +537,15 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_GPS == 1 debugGps = true; #endif - resetArgsGnss1.gnss1 = true; - resetArgsGnss1.gpioComIF = gpioComIF; - resetArgsGnss1.waitPeriodMs = 100; - resetArgsGnss0.gnss1 = false; - resetArgsGnss0.gpioComIF = gpioComIF; - resetArgsGnss0.waitPeriodMs = 100; + RESET_ARGS_GNSS_1.gnss1 = true; + RESET_ARGS_GNSS_1.gpioComIF = gpioComIF; + RESET_ARGS_GNSS_1.waitPeriodMs = 100; + RESET_ARGS_GNSS_0.gnss1 = false; + RESET_ARGS_GNSS_0.gpioComIF = gpioComIF; + RESET_ARGS_GNSS_0.waitPeriodMs = 100; auto gpsHandler0 = new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); - gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); + gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS_0); AcsBoardHelper acsBoardHelper = AcsBoardHelper( objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER, diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 7811fdbe..6b86b128 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -9,10 +9,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "OBSWConfig.h" #include "devConf.h" diff --git a/mission/devices/PayloadPcduHandler.h b/mission/devices/PayloadPcduHandler.h index dba5b4ef..d5d0f5b1 100644 --- a/mission/devices/PayloadPcduHandler.h +++ b/mission/devices/PayloadPcduHandler.h @@ -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; diff --git a/mission/system/CMakeLists.txt b/mission/system/CMakeLists.txt index 59418a07..0e9ce773 100644 --- a/mission/system/CMakeLists.txt +++ b/mission/system/CMakeLists.txt @@ -1,17 +1,2 @@ -target_sources(${LIB_EIVE_MISSION} PRIVATE - EiveSystem.cpp - AcsSubsystem.cpp - ComSubsystem.cpp - PayloadSubsystem.cpp - - AcsBoardAssembly.cpp - SusAssembly.cpp - DualLanePowerStateMachine.cpp - PowerStateMachineBase.cpp - DualLaneAssemblyBase.cpp - TcsBoardAssembly.cpp - - AcsBoardFdir.cpp - SusFdir.cpp - RtdFdir.cpp -) \ No newline at end of file +add_subdirectory(objects) +add_subdirectory(tree) diff --git a/mission/system/AcsBoardAssembly.cpp b/mission/system/objects/AcsBoardAssembly.cpp similarity index 100% rename from mission/system/AcsBoardAssembly.cpp rename to mission/system/objects/AcsBoardAssembly.cpp diff --git a/mission/system/AcsBoardAssembly.h b/mission/system/objects/AcsBoardAssembly.h similarity index 100% rename from mission/system/AcsBoardAssembly.h rename to mission/system/objects/AcsBoardAssembly.h diff --git a/mission/system/AcsBoardFdir.cpp b/mission/system/objects/AcsBoardFdir.cpp similarity index 100% rename from mission/system/AcsBoardFdir.cpp rename to mission/system/objects/AcsBoardFdir.cpp diff --git a/mission/system/AcsBoardFdir.h b/mission/system/objects/AcsBoardFdir.h similarity index 100% rename from mission/system/AcsBoardFdir.h rename to mission/system/objects/AcsBoardFdir.h diff --git a/mission/system/AcsSubsystem.cpp b/mission/system/objects/AcsSubsystem.cpp similarity index 100% rename from mission/system/AcsSubsystem.cpp rename to mission/system/objects/AcsSubsystem.cpp diff --git a/mission/system/AcsSubsystem.h b/mission/system/objects/AcsSubsystem.h similarity index 100% rename from mission/system/AcsSubsystem.h rename to mission/system/objects/AcsSubsystem.h diff --git a/mission/system/objects/CMakeLists.txt b/mission/system/objects/CMakeLists.txt new file mode 100644 index 00000000..22fd63b7 --- /dev/null +++ b/mission/system/objects/CMakeLists.txt @@ -0,0 +1,17 @@ +target_sources(${LIB_EIVE_MISSION} PRIVATE + EiveSystem.cpp + AcsSubsystem.cpp + ComSubsystem.cpp + PayloadSubsystem.cpp + + AcsBoardAssembly.cpp + SusAssembly.cpp + DualLanePowerStateMachine.cpp + PowerStateMachineBase.cpp + DualLaneAssemblyBase.cpp + TcsBoardAssembly.cpp + + AcsBoardFdir.cpp + SusFdir.cpp + RtdFdir.cpp +) diff --git a/mission/system/ComSubsystem.cpp b/mission/system/objects/ComSubsystem.cpp similarity index 100% rename from mission/system/ComSubsystem.cpp rename to mission/system/objects/ComSubsystem.cpp diff --git a/mission/system/ComSubsystem.h b/mission/system/objects/ComSubsystem.h similarity index 100% rename from mission/system/ComSubsystem.h rename to mission/system/objects/ComSubsystem.h diff --git a/mission/system/DualLaneAssemblyBase.cpp b/mission/system/objects/DualLaneAssemblyBase.cpp similarity index 100% rename from mission/system/DualLaneAssemblyBase.cpp rename to mission/system/objects/DualLaneAssemblyBase.cpp diff --git a/mission/system/DualLaneAssemblyBase.h b/mission/system/objects/DualLaneAssemblyBase.h similarity index 98% rename from mission/system/DualLaneAssemblyBase.h rename to mission/system/objects/DualLaneAssemblyBase.h index 4233d860..7a8c7ac9 100644 --- a/mission/system/DualLaneAssemblyBase.h +++ b/mission/system/objects/DualLaneAssemblyBase.h @@ -2,7 +2,7 @@ #define MISSION_SYSTEM_DUALLANEASSEMBLYBASE_H_ #include -#include +#include /** * @brief Encapsulates assemblies which are also responsible for dual lane power switching diff --git a/mission/system/DualLanePowerStateMachine.cpp b/mission/system/objects/DualLanePowerStateMachine.cpp similarity index 100% rename from mission/system/DualLanePowerStateMachine.cpp rename to mission/system/objects/DualLanePowerStateMachine.cpp diff --git a/mission/system/DualLanePowerStateMachine.h b/mission/system/objects/DualLanePowerStateMachine.h similarity index 91% rename from mission/system/DualLanePowerStateMachine.h rename to mission/system/objects/DualLanePowerStateMachine.h index d2160c64..7a6f29b6 100644 --- a/mission/system/DualLanePowerStateMachine.h +++ b/mission/system/objects/DualLanePowerStateMachine.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include "definitions.h" diff --git a/mission/system/EiveSystem.cpp b/mission/system/objects/EiveSystem.cpp similarity index 100% rename from mission/system/EiveSystem.cpp rename to mission/system/objects/EiveSystem.cpp diff --git a/mission/system/EiveSystem.h b/mission/system/objects/EiveSystem.h similarity index 100% rename from mission/system/EiveSystem.h rename to mission/system/objects/EiveSystem.h diff --git a/mission/system/PayloadSubsystem.cpp b/mission/system/objects/PayloadSubsystem.cpp similarity index 100% rename from mission/system/PayloadSubsystem.cpp rename to mission/system/objects/PayloadSubsystem.cpp diff --git a/mission/system/PayloadSubsystem.h b/mission/system/objects/PayloadSubsystem.h similarity index 100% rename from mission/system/PayloadSubsystem.h rename to mission/system/objects/PayloadSubsystem.h diff --git a/mission/system/PowerStateMachineBase.cpp b/mission/system/objects/PowerStateMachineBase.cpp similarity index 100% rename from mission/system/PowerStateMachineBase.cpp rename to mission/system/objects/PowerStateMachineBase.cpp diff --git a/mission/system/PowerStateMachineBase.h b/mission/system/objects/PowerStateMachineBase.h similarity index 100% rename from mission/system/PowerStateMachineBase.h rename to mission/system/objects/PowerStateMachineBase.h diff --git a/mission/system/RtdFdir.cpp b/mission/system/objects/RtdFdir.cpp similarity index 100% rename from mission/system/RtdFdir.cpp rename to mission/system/objects/RtdFdir.cpp diff --git a/mission/system/RtdFdir.h b/mission/system/objects/RtdFdir.h similarity index 100% rename from mission/system/RtdFdir.h rename to mission/system/objects/RtdFdir.h diff --git a/mission/system/SusAssembly.cpp b/mission/system/objects/SusAssembly.cpp similarity index 100% rename from mission/system/SusAssembly.cpp rename to mission/system/objects/SusAssembly.cpp diff --git a/mission/system/SusAssembly.h b/mission/system/objects/SusAssembly.h similarity index 100% rename from mission/system/SusAssembly.h rename to mission/system/objects/SusAssembly.h diff --git a/mission/system/SusFdir.cpp b/mission/system/objects/SusFdir.cpp similarity index 100% rename from mission/system/SusFdir.cpp rename to mission/system/objects/SusFdir.cpp diff --git a/mission/system/SusFdir.h b/mission/system/objects/SusFdir.h similarity index 100% rename from mission/system/SusFdir.h rename to mission/system/objects/SusFdir.h diff --git a/mission/system/TcsBoardAssembly.cpp b/mission/system/objects/TcsBoardAssembly.cpp similarity index 100% rename from mission/system/TcsBoardAssembly.cpp rename to mission/system/objects/TcsBoardAssembly.cpp diff --git a/mission/system/TcsBoardAssembly.h b/mission/system/objects/TcsBoardAssembly.h similarity index 100% rename from mission/system/TcsBoardAssembly.h rename to mission/system/objects/TcsBoardAssembly.h diff --git a/mission/system/definitions.h b/mission/system/objects/definitions.h similarity index 100% rename from mission/system/definitions.h rename to mission/system/objects/definitions.h diff --git a/mission/system/tree/CMakeLists.txt b/mission/system/tree/CMakeLists.txt new file mode 100644 index 00000000..f88891d4 --- /dev/null +++ b/mission/system/tree/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_EIVE_MISSION} PRIVATE + acsModeTree.cpp +) diff --git a/bsp_q7s/core/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp similarity index 100% rename from bsp_q7s/core/acsModeTree.cpp rename to mission/system/tree/acsModeTree.cpp diff --git a/bsp_q7s/core/acsModeTree.h b/mission/system/tree/acsModeTree.h similarity index 100% rename from bsp_q7s/core/acsModeTree.h rename to mission/system/tree/acsModeTree.h From f9dd77b8ec2ea608a2ee3960ab158b305de54904 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Apr 2022 10:50:59 +0200 Subject: [PATCH 024/361] create and schedule ACS SS --- bsp_q7s/core/InitMission.cpp | 14 +++++++++----- bsp_q7s/core/ObjectFactory.cpp | 4 ++++ mission/system/tree/acsModeTree.cpp | 26 +++++++++++++++++--------- mission/system/tree/acsModeTree.h | 9 +-------- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index ced1d12a..b2fbb41f 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -114,9 +114,9 @@ void initmission::initTasks() { #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ #if OBSW_ADD_ACS_HANDLERS == 1 - PeriodicTaskIF* acsTask = factory->createPeriodicTask( - "ACS_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); - result = acsTask->addComponent(objects::GPS_CONTROLLER); + PeriodicTaskIF* gpsTask = factory->createPeriodicTask( + "ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); + result = gpsTask->addComponent(objects::GPS_CONTROLLER); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER); } @@ -124,7 +124,7 @@ void initmission::initTasks() { #endif /* OBSW_ADD_ACS_HANDLERS */ PeriodicTaskIF* sysTask = factory->createPeriodicTask( - "SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); + "SYS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); result = sysTask->addComponent(objects::ACS_BOARD_ASS); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS); @@ -139,6 +139,10 @@ void initmission::initTasks() { if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS); } + result = sysTask->addComponent(objects::ACS_SUBSYSTEM); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM); + } // FS task, task interval does not matter because it runs in permanent loop, priority low // because it is a non-essential background task @@ -227,7 +231,7 @@ void initmission::initTasks() { #endif /* OBSW_ADD_STAR_TRACKER == 1 */ #if OBSW_ADD_ACS_HANDLERS == 1 - acsTask->startTask(); + gpsTask->startTask(); #endif sysTask->startTask(); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index a675ffc5..19457188 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -42,6 +42,7 @@ #include "mission/system/objects/SusAssembly.h" #include "mission/system/objects/SusFdir.h" #include "mission/system/objects/TcsBoardAssembly.h" +#include "mission/system/tree/acsModeTree.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" @@ -135,6 +136,7 @@ void ObjectFactory::produce(void* args) { SpiComIF* spiComIF = nullptr; I2cComIF* i2cComIF = nullptr; PowerSwitchIF* pwrSwitcher = nullptr; + createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF, &i2cComIF); createTmpComponents(); new CoreController(objects::CORE_CONTROLLER); @@ -205,6 +207,8 @@ void ObjectFactory::produce(void* args) { new PlocUpdater(objects::PLOC_UPDATER); new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); + + satsystem::initAcsSubsystem(); } void ObjectFactory::createTmpComponents() { diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index b944caa9..e5748f08 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -8,8 +8,16 @@ #include "mission/controller/controllerdefinitions/AcsControllerDefinitions.h" +void checkInsert(ReturnValue_t result, const char* ctx); +void buildOffSequence(Subsystem* ss, ModeListEntry& eh); +void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); +void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); + // Alias for checker function -const auto CHK = satsystem::checkInsert; +const auto CHK = checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; @@ -65,7 +73,7 @@ auto ACS_TABLE_TARGET_PT_TRANS_0 = auto ACS_TABLE_TARGET_PT_TRANS_1 = std::make_pair((acs::CtrlModes::TARGET_PT << 24) | 3, FixedArrayList()); -void satsystem::acsSubsystemInit() { +void satsystem::initAcsSubsystem() { ModeListEntry entry; Subsystem* acsSubsystem = new Subsystem(objects::ACS_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24); buildOffSequence(acsSubsystem, entry); @@ -77,7 +85,7 @@ void satsystem::acsSubsystemInit() { acsSubsystem->setInitialMode(HasModesIF::MODE_OFF); } -void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { +void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildOffSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -116,7 +124,7 @@ void satsystem::buildOffSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); } -void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { +void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildSafeSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -165,7 +173,7 @@ void satsystem::buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); } -void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { +void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildDetumbleSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -217,7 +225,7 @@ void satsystem::buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); } -void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { +void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildIdleSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -264,7 +272,7 @@ void satsystem::buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { false, true); } -void satsystem::buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { +void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildIdleChargeSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -318,7 +326,7 @@ void satsystem::buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); } -void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { +void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { std::string context = "satsystem::buildTargetPtSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -373,7 +381,7 @@ void satsystem::buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { ctxc); } -void satsystem::checkInsert(ReturnValue_t result, const char* ctx) { +void checkInsert(ReturnValue_t result, const char* ctx) { if (result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; } diff --git a/mission/system/tree/acsModeTree.h b/mission/system/tree/acsModeTree.h index b6c96e39..5ad5d7c9 100644 --- a/mission/system/tree/acsModeTree.h +++ b/mission/system/tree/acsModeTree.h @@ -4,13 +4,6 @@ class Subsystem; namespace satsystem { -void acsSubsystemInit(); -void buildOffSequence(Subsystem* ss, ModeListEntry& entryHelper); -void buildDetumbleSequence(Subsystem* ss, ModeListEntry& entryHelper); -void buildSafeSequence(Subsystem* ss, ModeListEntry& entryHelper); -void buildIdleSequence(Subsystem* ss, ModeListEntry& entryHelper); -void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); -void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); +void initAcsSubsystem(); -void checkInsert(ReturnValue_t result, const char* ctx); } // namespace satsystem From e2f0c0f1be3885abec108d34f0333fd786109db0 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 26 Apr 2022 13:22:56 +0200 Subject: [PATCH 025/361] fram rec --- linux/boardtest/UartTestClass.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index b4a23c6c..12404269 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -25,7 +25,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) : TestTask(objectId), reader(reader) { mode = TestModes::SCEX; scexMode = ScexModes::READER_TASK; - currCmd = scex::ScexCmds::PING; + currCmd = scex::ScexCmds::FRAM; if (scexMode == ScexModes::SIMPLE) { auto encodingBuf = new std::array; DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()}; @@ -178,7 +178,7 @@ void UartTestClass::scexPeriodic() { } else { if (not cmdSent) { size_t len = 0; - prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len); + prepareScexCmd(currCmd, false, cmdBuf.data(), &len); reader->sendMessage(uartCookie, cmdBuf.data(), len); cmdSent = true; cmdDone = false; @@ -199,21 +199,24 @@ void UartTestClass::scexPeriodic() { //ping //if ping cmd + if(helper.getCmd() == PING) { ofstream out("/tmp/scex-ping.bin", ofstream::binary ); if (out.bad()) { sif::warning << "bad" < //countdown (max 2min), wenn nicht if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { nach 2min reader->finish(); if(helper.getCmd() == FRAM) { if(helper.getPacketCounter() == 0) { - // neues file anlegen wie oben ping + ofstream out("/tmp/scex-fram.bin", ofstream::binary ); // neues file anlegen wie oben ping } else { - // an bestehendes file hinzufügen + ofstream out("/tmp/scex-fram.bin", ofstream::binary | ofstream::app );// an bestehendes file hinzufügen + out << helper; } } - out << helper; if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { reader->finish(); @@ -326,7 +329,7 @@ void UartTestClass::scexSimplePeriodic() { int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len) { using namespace scex; - // Send ping command + // Send command cmdBuf[0] = scex::createCmdByte(cmd, false); // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each // telecommand so far From c5683afe9f892a838bc4654ddc64130ca9177736 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Wed, 27 Apr 2022 16:46:11 +0200 Subject: [PATCH 026/361] fram --- linux/devices/ScexUartReader.cpp | 2 +- linux/devices/ScexUartReader.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index e0868b48..cfac79e4 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -51,7 +51,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { << ", " << strerror(errno) << "]" << std::endl; break; } else if (bytesRead >= static_cast(recBuf.size())) { - sif::error << "ScexUartReader::performOperation: Receive buffer too small" << std::endl; + sif::error << "ScexUartReader::performOperation: Receive buffer too small for " << bytesRead << " bytes" << std::endl; } else if (bytesRead > 0) { ReturnValue_t result = dleParser.passData(recBuf.data(), bytesRead); if (debugMode) { diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h index ad760b39..4cebb31e 100644 --- a/linux/devices/ScexUartReader.h +++ b/linux/devices/ScexUartReader.h @@ -37,9 +37,9 @@ class ScexUartReader : public SystemObject, // strg+shift+n DleEncoder dleEncoder = DleEncoder(); SimpleRingBuffer decodeRingBuf; - Countdown finishCoutdown = Countdown(180 * 1000); + Countdown finishCountdown = Countdown(180 * 1000); std::array cmdbuf = {}; - std::array recBuf = {}; + std::array recBuf = {}; std::array encodedBuf = {}; std::array decodedBuf = {}; std::array ipcBuffer = {}; From e11c84a5ed09f20a8ba75cd2663f515f48c414bb Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Wed, 27 Apr 2022 18:21:32 +0200 Subject: [PATCH 027/361] update --- linux/boardtest/UartTestClass.cpp | 63 +++++++++++++++++++------------ linux/boardtest/UartTestClass.h | 4 +- linux/devices/ScexHelper.cpp | 2 +- linux/devices/ScexUartReader.cpp | 11 +++--- linux/devices/ScexUartReader.h | 1 - 5 files changed, 47 insertions(+), 34 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 12404269..27e8d02e 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -156,7 +156,7 @@ void UartTestClass::scexInit() { std::string devname = "/dev/ul-scex"; #endif uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); - reader->setDebugMode(true); + reader->setDebugMode(false); ReturnValue_t result = reader->initializeInterface(uartCookie); if (result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "UartTestClass::gpsPeriodic: Initializing SCEX reader " @@ -186,9 +186,11 @@ void UartTestClass::scexPeriodic() { if (cmdSent and not cmdDone) { uint8_t* decodedPacket = nullptr; size_t len = 0; - ReturnValue_t result = reader->readReceivedMessage(uartCookie, &decodedPacket, &len); - - if (len > 0) { + do { + ReturnValue_t result = reader->readReceivedMessage(uartCookie, &decodedPacket, &len); + if(len == 0){ + break; + } ScexHelper helper; const uint8_t* helperPtr = decodedPacket; result = helper.deSerialize(&helperPtr, &len); @@ -197,25 +199,35 @@ void UartTestClass::scexPeriodic() { } sif::info << helper << endl; - //ping - //if ping cmd - if(helper.getCmd() == PING) { - ofstream out("/tmp/scex-ping.bin", ofstream::binary ); - if (out.bad()) { - sif::warning << "bad" < - //countdown (max 2min), wenn nicht if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { nach 2min reader->finish(); - if(helper.getCmd() == FRAM) { - if(helper.getPacketCounter() == 0) { - ofstream out("/tmp/scex-fram.bin", ofstream::binary ); // neues file anlegen wie oben ping - } else { - ofstream out("/tmp/scex-fram.bin", ofstream::binary | ofstream::app );// an bestehendes file hinzufügen - out << helper; - } + // fram + // packetcounter eins höher, wenn mehr packet verloren -> merkt sich welches packet fehlt + //was wenn erstes packet fehlt; mit boolean var (firstpacketarrived=false) die immer mit finish false wird? + // countdown (max 2min), wenn nicht if (helper.getPacketCounter() == + // helper.getTotalPacketCounter()) { nach 2min reader->finish(); + if (helper.getCmd() == FRAM) { + if (helper.getPacketCounter() == 1) { + //countdown starten + finishCountdown.resetTimer(); + ofstream out("/tmp/scex-fram.bin", + ofstream::binary); // neues file anlegen wie oben ping + } else { + ofstream out("/tmp/scex-fram.bin", + ofstream::binary | ofstream::app); // an bestehendes file hinzufügen + out << helper; + } + + if(finishCountdown.hasTimedOut()){ + reader->finish(); + } } if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { @@ -226,7 +238,7 @@ void UartTestClass::scexPeriodic() { cmdSent = false; } } - } + } while (len > 0); } } } @@ -313,8 +325,9 @@ void UartTestClass::scexSimplePeriodic() { << errno << ", " << strerror(errno) << "]" << std::endl; break; } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" - << std::endl; + sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large " + "enough, bytes read:" + << bytesRead << std::endl; } else if (bytesRead > 0) { dleParser->passData(recBuf.data(), bytesRead); if (currCmd == ScexCmds::PING) { diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 0a228782..28a8b8a7 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include // Contains POSIX terminal control definitions @@ -46,6 +47,7 @@ class UartTestClass : public TestTask { static void foundDlePacketHandler(const DleParser::Context& ctx); void handleFoundDlePacket(uint8_t* packet, size_t len); + Countdown finishCountdown = Countdown(180 * 1000); bool cmdSent = false; bool cmdDone = false; scex::ScexCmds currCmd = scex::ScexCmds::PING; @@ -59,7 +61,7 @@ class UartTestClass : public TestTask { bool startFound = false; ScexUartReader* reader = nullptr; std::array cmdBuf = {}; - std::array recBuf = {}; + std::array recBuf = {}; ScexDleParser* dleParser; scex::ScexCmds cmdHelper; uint8_t recvCnt = 0; diff --git a/linux/devices/ScexHelper.cpp b/linux/devices/ScexHelper.cpp index bc7ee04f..ca29ff65 100644 --- a/linux/devices/ScexHelper.cpp +++ b/linux/devices/ScexHelper.cpp @@ -71,7 +71,7 @@ std::ostream& operator<<(std::ostream& os, const ScexHelper& h) { sif::info << "PacketCounter: " << h.packetCounter << endl; sif::info << "TotalPacketCount: " << h.totalPacketCounter << endl; sif::info << "PayloadLength: " << h.payloadLen << endl; - sif::info << "TotalPacketLength: " << h.totalPacketLen << endl; + sif::info << "TotalPacketLength: " << h.totalPacketLen; return os; } diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index cfac79e4..517ee4a1 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -45,13 +45,14 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { state = States::IDLE; break; } - TaskFactory::delayTask(1000); + TaskFactory::delayTask(400); } else if (bytesRead < 0) { sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno << ", " << strerror(errno) << "]" << std::endl; break; } else if (bytesRead >= static_cast(recBuf.size())) { - sif::error << "ScexUartReader::performOperation: Receive buffer too small for " << bytesRead << " bytes" << std::endl; + sif::error << "ScexUartReader::performOperation: Receive buffer too small for " << bytesRead + << " bytes" << std::endl; } else if (bytesRead > 0) { ReturnValue_t result = dleParser.passData(recBuf.data(), bytesRead); if (debugMode) { @@ -76,7 +77,6 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { return RETURN_FAILED; } std::string devname = uartCookie->getDeviceFile(); - sif::info << devname << std::endl; /* Get file descriptor */ serialPort = open(devname.c_str(), O_RDWR); if (serialPort < 0) { @@ -171,7 +171,7 @@ void ScexUartReader::foundDlePacketHandler(const DleParser::Context &ctx) { void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { // TODO: insert data into IPC ring buffer here - sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; + // sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; MutexGuard mg(lock); ReturnValue_t result = ipcQueue.insert(len); if (result != RETURN_OK) { @@ -181,7 +181,7 @@ void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { if (result != RETURN_OK) { sif::warning << "IPCRingBuf error" << std::endl; } - sif::info << "DLE handler done" << std::endl; + // sif::info << "DLE handler done" << std::endl; } ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, @@ -191,7 +191,6 @@ ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **bu *size = 0; return RETURN_OK; } - sif::info << "returning data" << std::endl; ipcQueue.retrieve(size); *buffer = ipcBuffer.data(); ReturnValue_t result = ipcRingBuf.readData(ipcBuffer.data(), *size, true); diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h index 4cebb31e..4abbfd86 100644 --- a/linux/devices/ScexUartReader.h +++ b/linux/devices/ScexUartReader.h @@ -37,7 +37,6 @@ class ScexUartReader : public SystemObject, // strg+shift+n DleEncoder dleEncoder = DleEncoder(); SimpleRingBuffer decodeRingBuf; - Countdown finishCountdown = Countdown(180 * 1000); std::array cmdbuf = {}; std::array recBuf = {}; std::array encodedBuf = {}; From b4a54804dfbbefbeea06028f50a391bcaf78a164 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 13:07:28 +0200 Subject: [PATCH 028/361] submodule update --- generators/fsfwgen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/fsfwgen b/generators/fsfwgen index d2bdabbf..2a408e8c 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit d2bdabbf0f213747efc18cb45fcf2a2294b14bc8 +Subproject commit 2a408e8c7dd2ebe974b9699fb5aee0889aa86392 From 40b84b0576cd3fac16a2788ac17a70254fd20392 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 13:08:19 +0200 Subject: [PATCH 029/361] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ef8a06..e1b7d3cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ list yields a list of all related PRs for each release. # [v1.11.0] +## Added + +- ACS Subsystem + ## Changed - Update rootfs base of Linux, all related OBSW changes From 5de45a7ae7d70a40387636813dc0c01f4bd6f641 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Apr 2022 16:05:01 +0200 Subject: [PATCH 030/361] more readable --- mission/system/tree/acsModeTree.cpp | 64 ++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index e5748f08..b78a5ff2 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -17,7 +17,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& entryHelper); void buildTargetPtSequence(Subsystem* ss, ModeListEntry& entryHelper); // Alias for checker function -const auto CHK = checkInsert; +const auto check = checkInsert; static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; @@ -93,7 +93,7 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(table.insert(eh), ctxc); + check(table.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -101,11 +101,11 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // OFF Target table is empty - CHK(ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); + check(ss->addTable(&ACS_TABLE_OFF_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); // Build OFF transition iht(objects::ACS_CONTROLLER, OFF, 0, ACS_TABLE_OFF_TRANS.second); @@ -114,12 +114,12 @@ void buildOffSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); iht(objects::SUS_BOARD_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_OFF_TRANS.second); - CHK(ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc); + check(ss->addTable(&ACS_TABLE_OFF_TRANS.second, ACS_TABLE_OFF_TRANS.first, false, true), ctxc); // Build OFF sequence ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TGT.first, 0, false); ihs(ACS_SEQUENCE_OFF.second, ACS_TABLE_OFF_TRANS.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, + check(ss->addSequence(&ACS_SEQUENCE_OFF.second, ACS_SEQUENCE_OFF.first, ACS_SEQUENCE_OFF.first, false, true), ctxc); } @@ -133,7 +133,7 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -141,14 +141,14 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build SAFE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TGT.second); - CHK(ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); + check(ss->addTable(&ACS_TABLE_SAFE_TGT.second, ACS_TABLE_OFF_TGT.first, false, true), ctxc); // Build SAFE transition 0 iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); @@ -156,19 +156,19 @@ void buildSafeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_SAFE_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true), + check(ss->addTable(&ACS_TABLE_SAFE_TRANS_0.second, ACS_TABLE_SAFE_TRANS_0.first, false, true), ctxc); // Build SAFE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::SAFE, 0, ACS_TABLE_SAFE_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), + check(ss->addTable(&ACS_TABLE_SAFE_TRANS_1.second, ACS_TABLE_SAFE_TRANS_1.first, false, true), ctxc); // Build SAFE sequence ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TGT.first, 0, true); ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_0.first, 0, false); ihs(ACS_SEQUENCE_SAFE.second, ACS_TABLE_SAFE_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, + check(ss->addSequence(&ACS_SEQUENCE_SAFE.second, ACS_SEQUENCE_SAFE.first, ACS_SEQUENCE_OFF.first, false, true), ctxc); } @@ -182,7 +182,7 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -190,14 +190,14 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build DETUMBLE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TGT.second); - CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true), + check(ss->addTable(&ACS_TABLE_DETUMBLE_TGT.second, ACS_TABLE_DETUMBLE_TGT.first, false, true), ctxc); // Build DETUMBLE transition 0 @@ -206,13 +206,13 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_DETUMBLE_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, + check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_0.second, ACS_TABLE_DETUMBLE_TRANS_0.first, false, true), ctxc); // Build DETUMBLE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::DETUMBLE, 0, ACS_TABLE_DETUMBLE_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, + check(ss->addTable(&ACS_TABLE_DETUMBLE_TRANS_1.second, ACS_TABLE_DETUMBLE_TRANS_1.first, false, true), ctxc); @@ -220,7 +220,7 @@ void buildDetumbleSequence(Subsystem* ss, ModeListEntry& eh) { ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TGT.first, 0, true); ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_0.first, 0, false); ihs(ACS_SEQUENCE_DETUMBLE.second, ACS_TABLE_DETUMBLE_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, + check(ss->addSequence(&ACS_SEQUENCE_DETUMBLE.second, ACS_SEQUENCE_DETUMBLE.first, ACS_SEQUENCE_SAFE.first, false, true), ctxc); } @@ -234,7 +234,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -242,7 +242,7 @@ void buildIdleSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build IDLE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, 0, ACS_TABLE_IDLE_TGT.second); @@ -281,7 +281,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -289,7 +289,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build IDLE target iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, @@ -297,7 +297,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::IMTQ_HANDLER, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TGT.second); - CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true), + check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TGT.second, ACS_TABLE_IDLE_CHRG_TGT.first, false, true), ctxc); // Build IDLE transition 0 @@ -306,14 +306,14 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::SUS_BOARD_ASS, NML, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); iht(objects::RW_ASS, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); iht(objects::STAR_TRACKER, OFF, 0, ACS_TABLE_IDLE_CHRG_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false, + check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_0.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, false, true), ctxc); // Build IDLE transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::IDLE, acs::IDLE_CHARGE, ACS_TABLE_IDLE_CHRG_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false, + check(ss->addTable(&ACS_TABLE_IDLE_CHRG_TRANS_1.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, false, true), ctxc); @@ -321,7 +321,7 @@ void buildIdleChargeSequence(Subsystem* ss, ModeListEntry& eh) { ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TGT.first, 0, true); ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_IDLE_CHRG.second, ACS_TABLE_IDLE_CHRG_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first, + check(ss->addSequence(&ACS_SEQUENCE_IDLE_CHRG.second, ACS_SEQUENCE_IDLE_CHRG.first, ACS_SEQUENCE_SAFE.first, false, true), ctxc); } @@ -335,7 +335,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Insert Helper Sequence auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, @@ -343,7 +343,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { eh.setTableId(tableId); eh.setWaitSeconds(waitSeconds); eh.setCheckSuccess(checkSuccess); - CHK(sequence.insert(eh), ctxc); + check(sequence.insert(eh), ctxc); }; // Build TARGET PT table @@ -353,7 +353,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TGT.second); - CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true), + check(ss->addTable(&ACS_TABLE_TARGET_PT_TGT.second, ACS_TABLE_TARGET_PT_TGT.first, false, true), ctxc); // Build TARGET PT transition 0 @@ -362,13 +362,13 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { iht(objects::ACS_BOARD_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); iht(objects::RW_ASS, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); iht(objects::STAR_TRACKER, NML, 0, ACS_TABLE_TARGET_PT_TRANS_0.second); - CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, + check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_0.second, ACS_TABLE_TARGET_PT_TRANS_0.first, false, true), ctxc); // Build TARGET PT transition 1 iht(objects::ACS_CONTROLLER, acs::CtrlModes::TARGET_PT, 0, ACS_TABLE_TARGET_PT_TRANS_1.second); - CHK(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, + check(ss->addTable(&ACS_TABLE_TARGET_PT_TRANS_1.second, ACS_TABLE_TARGET_PT_TRANS_1.first, false, true), ctxc); @@ -376,7 +376,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TGT.first, 0, true); ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_0.first, 0, true); ihs(ACS_SEQUENCE_TARGET_PT.second, ACS_TABLE_TARGET_PT_TRANS_1.first, 0, false); - CHK(ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, + check(ss->addSequence(&ACS_SEQUENCE_TARGET_PT.second, ACS_SEQUENCE_TARGET_PT.first, ACS_SEQUENCE_IDLE.first, false, true), ctxc); } From e16e6c2d17ab41df0aea08cd1e2cc76c5541643c Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 29 Apr 2022 12:26:18 +0200 Subject: [PATCH 031/361] fileId --- linux/boardtest/UartTestClass.cpp | 26 ++++++++++++++++++++++---- linux/boardtest/UartTestClass.h | 3 +++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 27e8d02e..88a0895c 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -217,11 +217,13 @@ void UartTestClass::scexPeriodic() { if (helper.getPacketCounter() == 1) { //countdown starten finishCountdown.resetTimer(); - ofstream out("/tmp/scex-fram.bin", - ofstream::binary); // neues file anlegen wie oben ping + fileId = gen_random(12); + fileName = "/tmp/scex-fram_"+fileId+".bin"; + ofstream out(fileName, + ofstream::binary); // neues file anlegen } else { - ofstream out("/tmp/scex-fram.bin", - ofstream::binary | ofstream::app); // an bestehendes file hinzufügen + ofstream out(fileName, + ofstream::binary | ofstream::app); // an bestehendes file appenden out << helper; } @@ -370,3 +372,19 @@ void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) { void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; } + +std::string gen_random(const int len) { + static const char alphanum[] = + "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + + std::string tmp_s; + tmp_s.reserve(len); + + for (int i = 0; i < len; ++i) { + tmp_s += alphanum[rand() % (sizeof(alphanum) - 1)]; + } + + return tmp_s; +} diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 28a8b8a7..dad9152e 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -46,7 +46,10 @@ class UartTestClass : public TestTask { static void foundDlePacketHandler(const DleParser::Context& ctx); void handleFoundDlePacket(uint8_t* packet, size_t len); + std::string gen_random(const int len); + std::string fileId = ""; + std::string fileName = ""; Countdown finishCountdown = Countdown(180 * 1000); bool cmdSent = false; bool cmdDone = false; From be7b1411268ff97850de370bccdbbd48c5846e90 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 29 Apr 2022 12:30:52 +0200 Subject: [PATCH 032/361] update --- linux/boardtest/UartTestClass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 88a0895c..2e1a195c 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -373,7 +373,7 @@ void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; } -std::string gen_random(const int len) { +std::string UartTestClass::gen_random(const int len) { static const char alphanum[] = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" From 7c15eb57bbde24efd1e84abc926803f148fc4d74 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 29 Apr 2022 12:48:13 +0200 Subject: [PATCH 033/361] update --- linux/boardtest/UartTestClass.cpp | 47 ++++++++++++++++++------------- linux/boardtest/UartTestClass.h | 1 + 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 2e1a195c..1fa6a10c 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -188,8 +188,8 @@ void UartTestClass::scexPeriodic() { size_t len = 0; do { ReturnValue_t result = reader->readReceivedMessage(uartCookie, &decodedPacket, &len); - if(len == 0){ - break; + if (len == 0) { + break; } ScexHelper helper; const uint8_t* helperPtr = decodedPacket; @@ -210,15 +210,19 @@ void UartTestClass::scexPeriodic() { } // fram // packetcounter eins höher, wenn mehr packet verloren -> merkt sich welches packet fehlt - //was wenn erstes packet fehlt; mit boolean var (firstpacketarrived=false) die immer mit finish false wird? + // was wenn erstes packet fehlt; mit boolean var (firstpacketarrived=false) die immer mit + // finish false wird? // countdown (max 2min), wenn nicht if (helper.getPacketCounter() == // helper.getTotalPacketCounter()) { nach 2min reader->finish(); if (helper.getCmd() == FRAM) { + if (not fileNameSet) { + fileId = gen_random(12); + fileName = "/tmp/scex-fram_" + fileId + ".bin"; + fileNameSet = true; + } if (helper.getPacketCounter() == 1) { - //countdown starten - finishCountdown.resetTimer(); - fileId = gen_random(12); - fileName = "/tmp/scex-fram_"+fileId+".bin"; + // countdown starten + finishCountdown.resetTimer(); ofstream out(fileName, ofstream::binary); // neues file anlegen } else { @@ -227,8 +231,11 @@ void UartTestClass::scexPeriodic() { out << helper; } - if(finishCountdown.hasTimedOut()){ - reader->finish(); + if (finishCountdown.hasTimedOut()) { + reader->finish(); + sif::warning << "Reader countdown expired" << endl; + cmdDone = true; + fileNameSet = false; } } @@ -236,8 +243,10 @@ void UartTestClass::scexPeriodic() { reader->finish(); sif::info << "Reader is finished" << endl; cmdDone = true; + fileNameSet = false; if (helper.getCmd() == scex::ScexCmds::PING) { cmdSent = false; + fileNameSet = true; // to not generate everytime new file } } } while (len > 0); @@ -374,17 +383,17 @@ void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { } std::string UartTestClass::gen_random(const int len) { - static const char alphanum[] = - "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz"; + static const char alphanum[] = + "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; - std::string tmp_s; - tmp_s.reserve(len); + std::string tmp_s; + tmp_s.reserve(len); - for (int i = 0; i < len; ++i) { - tmp_s += alphanum[rand() % (sizeof(alphanum) - 1)]; - } + for (int i = 0; i < len; ++i) { + tmp_s += alphanum[rand() % (sizeof(alphanum) - 1)]; + } - return tmp_s; + return tmp_s; } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index dad9152e..8c6bc22f 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -50,6 +50,7 @@ class UartTestClass : public TestTask { std::string fileId = ""; std::string fileName = ""; + bool fileNameSet = false; Countdown finishCountdown = Countdown(180 * 1000); bool cmdSent = false; bool cmdDone = false; From 57f3103e52d19c26fca380a44832cf40564aa9cd Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 29 Apr 2022 13:31:14 +0200 Subject: [PATCH 034/361] update --- linux/boardtest/UartTestClass.cpp | 28 +++++++++++++++++----------- linux/boardtest/UartTestClass.h | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 1fa6a10c..b958579a 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -9,6 +9,9 @@ #include #include // write(), read(), close() +#include +#include + #include "OBSWConfig.h" #include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/DleEncoder.h" @@ -216,7 +219,7 @@ void UartTestClass::scexPeriodic() { // helper.getTotalPacketCounter()) { nach 2min reader->finish(); if (helper.getCmd() == FRAM) { if (not fileNameSet) { - fileId = gen_random(12); + fileId = random_string(12); fileName = "/tmp/scex-fram_" + fileId + ".bin"; fileNameSet = true; } @@ -382,18 +385,21 @@ void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; } -std::string UartTestClass::gen_random(const int len) { - static const char alphanum[] = +std::string UartTestClass::random_string(std::string::size_type length) { + static auto& chrs = "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz"; + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - std::string tmp_s; - tmp_s.reserve(len); + thread_local static std::mt19937 rg{std::random_device{}()}; + thread_local static std::uniform_int_distribution pick(0, + sizeof(chrs) - 2); - for (int i = 0; i < len; ++i) { - tmp_s += alphanum[rand() % (sizeof(alphanum) - 1)]; - } + std::string s; - return tmp_s; + s.reserve(length); + + while (length--) s += chrs[pick(rg)]; + + return s; } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 8c6bc22f..ca42a688 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -46,7 +46,7 @@ class UartTestClass : public TestTask { static void foundDlePacketHandler(const DleParser::Context& ctx); void handleFoundDlePacket(uint8_t* packet, size_t len); - std::string gen_random(const int len); + std::string random_string(std::string::size_type length); std::string fileId = ""; std::string fileName = ""; From f2cb43a52fb91f13c20e8b30887eb33af4f207d5 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Fri, 29 Apr 2022 15:46:16 +0200 Subject: [PATCH 035/361] scexDataHandler --- common/config/commonSubsystemIds.h | 1 + linux/boardtest/UartTestClass.cpp | 15 +- linux/boardtest/UartTestClass.h | 6 +- linux/devices/ScexHelper.cpp | 6 +- linux/devices/ScexHelper.h | 7 +- mission/devices/CMakeLists.txt | 1 + mission/devices/ScexDeviceHandler.cpp | 128 ++++++++++++++++++ mission/devices/ScexDeviceHandler.h | 36 +++++ .../devicedefinitions/ScexDefinitions.cpp | 33 ++++- .../devicedefinitions/ScexDefinitions.h | 33 ++++- 10 files changed, 246 insertions(+), 20 deletions(-) create mode 100644 mission/devices/ScexDeviceHandler.cpp create mode 100644 mission/devices/ScexDeviceHandler.h diff --git a/common/config/commonSubsystemIds.h b/common/config/commonSubsystemIds.h index cd692231..c19a4d0c 100644 --- a/common/config/commonSubsystemIds.h +++ b/common/config/commonSubsystemIds.h @@ -30,6 +30,7 @@ enum: uint8_t { PDU1_HANDLER = 133, PDU2_HANDLER = 134, ACU_HANDLER = 135, + SCEX_HANDLER = 136, COMMON_SUBSYSTEM_ID_END }; } diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index b958579a..469081cd 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -17,6 +17,7 @@ #include "fsfw/globalfunctions/DleEncoder.h" #include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/serviceinterface.h" +#include "mission/devices/devicedefinitions/ScexDefinitions.h" #define GPS_REPLY_WIRETAPPING 0 @@ -28,7 +29,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) : TestTask(objectId), reader(reader) { mode = TestModes::SCEX; scexMode = ScexModes::READER_TASK; - currCmd = scex::ScexCmds::FRAM; + currCmd = scex::Cmds::FRAM; if (scexMode == ScexModes::SIMPLE) { auto encodingBuf = new std::array; DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()}; @@ -219,7 +220,7 @@ void UartTestClass::scexPeriodic() { // helper.getTotalPacketCounter()) { nach 2min reader->finish(); if (helper.getCmd() == FRAM) { if (not fileNameSet) { - fileId = random_string(12); + fileId = random_string(6); fileName = "/tmp/scex-fram_" + fileId + ".bin"; fileNameSet = true; } @@ -235,8 +236,9 @@ void UartTestClass::scexPeriodic() { } if (finishCountdown.hasTimedOut()) { + triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); reader->finish(); - sif::warning << "Reader countdown expired" << endl; + sif::warning << "Reader timeout" << endl; cmdDone = true; fileNameSet = false; } @@ -247,7 +249,7 @@ void UartTestClass::scexPeriodic() { sif::info << "Reader is finished" << endl; cmdDone = true; fileNameSet = false; - if (helper.getCmd() == scex::ScexCmds::PING) { + if (helper.getCmd() == scex::Cmds::PING) { cmdSent = false; fileNameSet = true; // to not generate everytime new file } @@ -344,7 +346,7 @@ void UartTestClass::scexSimplePeriodic() { << bytesRead << std::endl; } else if (bytesRead > 0) { dleParser->passData(recBuf.data(), bytesRead); - if (currCmd == ScexCmds::PING) { + if (currCmd == Cmds::PING) { cmdDone = true; cmdSent = false; } @@ -353,8 +355,7 @@ void UartTestClass::scexSimplePeriodic() { } } -int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, - size_t* len) { +int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len) { using namespace scex; // Send command cmdBuf[0] = scex::createCmdByte(cmd, false); diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index ca42a688..efe15dc1 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -39,7 +39,7 @@ class UartTestClass : public TestTask { void scexInit(); void scexPeriodic(); - int prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len); + int prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBuf, size_t* len); void scexSimplePeriodic(); void scexSimpleInit(); @@ -54,7 +54,7 @@ class UartTestClass : public TestTask { Countdown finishCountdown = Countdown(180 * 1000); bool cmdSent = false; bool cmdDone = false; - scex::ScexCmds currCmd = scex::ScexCmds::PING; + scex::Cmds currCmd = scex::Cmds::PING; TestModes mode = TestModes::GPS; DleEncoder dleEncoder = DleEncoder(); UartCookie* uartCookie = nullptr; @@ -67,7 +67,7 @@ class UartTestClass : public TestTask { std::array cmdBuf = {}; std::array recBuf = {}; ScexDleParser* dleParser; - scex::ScexCmds cmdHelper; + scex::Cmds cmdHelper; uint8_t recvCnt = 0; }; diff --git a/linux/devices/ScexHelper.cpp b/linux/devices/ScexHelper.cpp index ca29ff65..92a9e24a 100644 --- a/linux/devices/ScexHelper.cpp +++ b/linux/devices/ScexHelper.cpp @@ -23,7 +23,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size, } start = *buffer; cmdByteRaw = **buffer; - cmd = static_cast((cmdByteRaw >> 1) & 0b11111); + cmd = static_cast((cmdByteRaw >> 1) & 0b11111); *buffer += 1; packetCounter = **buffer; @@ -35,7 +35,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size, payloadLen = (**buffer << 8) | *(*buffer + 1); *buffer += 2; - totalPacketLen = payloadLen + HEADER_LEN + CRC_LEN; + totalPacketLen = payloadLen + scex::HEADER_LEN + scex::CRC_LEN; if (totalPacketLen >= *size) { return STREAM_TOO_SHORT; } @@ -47,7 +47,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size, return RETURN_OK; } -scex::ScexCmds ScexHelper::getCmd() const { return cmd; } +scex::Cmds ScexHelper::getCmd() const { return cmd; } uint8_t ScexHelper::getCmdByteRaw() const { return cmdByteRaw; } diff --git a/linux/devices/ScexHelper.h b/linux/devices/ScexHelper.h index a835bd0a..02908514 100644 --- a/linux/devices/ScexHelper.h +++ b/linux/devices/ScexHelper.h @@ -13,8 +13,7 @@ class ScexHelper : public HasReturnvaluesIF, public SerializeIF { public: static const ReturnValue_t INVALID_CRC = HasReturnvaluesIF::makeReturnCode(0, 2); - static constexpr uint8_t HEADER_LEN = 5; - static constexpr uint8_t CRC_LEN = 2; + ScexHelper(); ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const override; @@ -25,7 +24,7 @@ class ScexHelper : public HasReturnvaluesIF, public SerializeIF { friend std::ostream &operator<<(std::ostream &os, const ScexHelper &h); friend std::ofstream &operator<<(std::ofstream &os, const ScexHelper &h); - scex::ScexCmds getCmd() const; + scex::Cmds getCmd() const; uint8_t getCmdByteRaw() const; uint16_t getCrc() const; size_t getExpectedPacketLen() const; @@ -38,7 +37,7 @@ class ScexHelper : public HasReturnvaluesIF, public SerializeIF { const uint8_t *start = nullptr; uint16_t crc = 0; uint8_t cmdByteRaw = 0; - scex::ScexCmds cmd = scex::ScexCmds::INVALID; + scex::Cmds cmd = scex::Cmds::INVALID; int packetCounter = 0; int totalPacketCounter = 0; uint16_t payloadLen = 0; diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index fc013271..9ad299e8 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -18,6 +18,7 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE SusHandler.cpp PayloadPcduHandler.cpp SolarArrayDeploymentHandler.cpp + ScexDeviceHandler.cpp ) add_subdirectory(devicedefinitions) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp new file mode 100644 index 00000000..fe948a7e --- /dev/null +++ b/mission/devices/ScexDeviceHandler.cpp @@ -0,0 +1,128 @@ +#include "ScexDeviceHandler.h" + +#include + +#include "mission/devices/devicedefinitions/ScexDefinitions.h" +#include "fsfw/globalfunctions/CRC.h" +#include + +ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie) + : DeviceHandlerBase(objectId, reader.getObjectId(),cookie), reader(reader) +{ + +} + +void ScexDeviceHandler::doStartUp() { + // mode on + setMode(MODE_ON); +} + +void ScexDeviceHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } + +ReturnValue_t ScexDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { + return RETURN_OK; +} + +ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { + return RETURN_OK; +} + +ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t* commandData, + size_t commandDataLen) { + using namespace scex; + + if (not std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) != VALID_CMDS.end()) { + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + if (commandDataLen < 1) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + switch (deviceCommand) { + case (PING): { + rawPacket = cmdBuf.size(); + + prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {nullptr, 0}); + return RETURN_OK; + } + case (FRAM): { + prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {nullptr, 0}); + return RETURN_OK; + } + case (ION_CMD): { + prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {nullptr, 0}); + return RETURN_OK; + } + case (TEMP_CMD): { + prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {nullptr, 0}); + return RETURN_OK; + } + case (ONE_CELL): { + prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandData - 1}); + return RETURN_OK; + } + case (ALL_CELLS_CMD): { + prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandData - 1}); + return RETURN_OK; + } + case (EXP_STATUS_CMD): { + prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {nullptr, 0}); + return RETURN_OK; + } + } + return RETURN_OK; +} + +void ScexDeviceHandler::fillCommandAndReplyMap() { + insertInCommandAndReplyMap(scex::Cmds::PING, 3); + insertInCommandAndReplyMap(scex::Cmds::ION_CMD, 3); + insertInCommandAndReplyMap(scex::Cmds::TEMP_CMD, 3); + insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3); + + insertInCommandMap(scex::Cmds::ALL_CELLS_CMD); + insertInCommandMap(scex::Cmds::ONE_CELL); + insertInCommandMap(scex::Cmds::FRAM); + + insertInReplyMap(scex::Cmds::ERROR_REPLY, 3); +} + +ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, + DeviceCommandId_t* foundId, size_t* foundLen) { + //helper.deSerialize(blabla); + //crc check + + *foundId = helper.getCmd(); + *foundLen = remainingSize; + + return RETURN_OK; +} + +ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { + //cmd auswertung (in file reinschreiben) + return RETURN_OK; +} + +uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { + return RETURN_OK; +} + +ReturnValue_t ScexDeviceHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { + return RETURN_OK; +} + +ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) { + return RETURN_OK; +} + + + +void ScexDeviceHandler::modeChanged() {} diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h new file mode 100644 index 00000000..5058ed3b --- /dev/null +++ b/mission/devices/ScexDeviceHandler.h @@ -0,0 +1,36 @@ +#ifndef MISSION_DEVICES_SCEXDEVICEHANDLER_H_ +#define MISSION_DEVICES_SCEXDEVICEHANDLER_H_ + +#include +#include +#include + +class ScexDeviceHandler : public DeviceHandlerBase { + public: + // ctor vervollständigen + ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie); + private: + std::array cmdBuf = {}; + + // DeviceHandlerBase private function implementation + void doStartUp() override; + void doShutDown() override; + ScexHelper helper; + ScexUartReader& reader; + ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; + ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; + ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) override; + void fillCommandAndReplyMap() override; + ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, + size_t *foundLen) override; + ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; + uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; + ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override; + + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) override; + void modeChanged() override; +}; + +#endif /* MISSION_DEVICES_SCEXDEVICEHANDLER_H_ */ diff --git a/mission/devices/devicedefinitions/ScexDefinitions.cpp b/mission/devices/devicedefinitions/ScexDefinitions.cpp index 1e39f414..c202dd5c 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.cpp +++ b/mission/devices/devicedefinitions/ScexDefinitions.cpp @@ -1,5 +1,36 @@ #include "ScexDefinitions.h" -uint8_t scex::createCmdByte(ScexCmds cmd, bool tempCheck) { +#include + +#include + +uint8_t scex::createCmdByte(Cmds cmd, bool tempCheck) { return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck; } + +ReturnValue_t scex::prepareScexCmd(scex::Cmds cmd, bool tempCheck, + std::pair cmdBufPair, size_t& cmdLen, + std::pair usrDataPair) { + using namespace scex; + uint8_t* cmdBuf = cmdBufPair.first; + const uint8_t* userData = usrDataPair.first; + // Send command + if (cmdBuf == nullptr or (cmdBufPair.second < usrDataPair.second + HEADER_LEN + CRC_LEN) or + (usrDataPair.second > 0 and userData == nullptr)) { + cmdLen = 0; + return HasReturnvaluesIF::RETURN_FAILED; + } + cmdBuf[0] = scex::createCmdByte(cmd, tempCheck); + // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each + // telecommand so far + cmdBuf[1] = 1; + cmdBuf[2] = 1; + cmdBuf[3] = (usrDataPair.second >> 8) & 0xff; + cmdBuf[4] = usrDataPair.second & 0xff; + std::memcpy(cmdBuf + HEADER_LEN, userData, usrDataPair.second); + uint16_t crc = CRC::crc16ccitt(cmdBuf, usrDataPair.second + HEADER_LEN); + cmdBuf[usrDataPair.second + HEADER_LEN] = (crc >> 8) & 0xff; + cmdBuf[usrDataPair.second + HEADER_LEN + 1] = crc & 0xff; + cmdLen = usrDataPair.second + HEADER_LEN + CRC_LEN; + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/mission/devices/devicedefinitions/ScexDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h index f479981e..70426085 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -1,17 +1,46 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_ +#include +#include +#include + #include +#include // Definitions for the Solar Cell Experiment namespace scex { -enum ScexCmds : uint8_t { PING = 0b00111, ONE_CELL = 0b00110, FRAM = 0b00001, INVALID = 255 }; +static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SCEX_HANDLER; + +static constexpr Event MISSING_PACKET = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); + +static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); + +enum Cmds : DeviceCommandId_t { + PING = 0b00111, + ALL_CELLS_CMD = 0b00101, + ONE_CELL = 0b00110, + FRAM = 0b00001, + EXP_STATUS_CMD = 0b00010, + TEMP_CMD = 0b00011, + ION_CMD = 0b00100, + ERROR_REPLY = 0b01000, + INVALID = 255 +}; + +static const std::vector VALID_CMDS = { + PING, ALL_CELLS_CMD, ONE_CELL, FRAM, EXP_STATUS_CMD, TEMP_CMD, ION_CMD}; + +static constexpr uint8_t HEADER_LEN = 5; +static constexpr uint8_t CRC_LEN = 2; static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0; static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1; -uint8_t createCmdByte(ScexCmds cmd, bool tempCheck); +uint8_t createCmdByte(Cmds cmd, bool tempCheck); +ReturnValue_t prepareScexCmd(scex::Cmds cmd, bool tempCheck, std::pair cmdBufPair, + size_t& cmdLen, std::pair usrDataPair); } // namespace scex From aa9acef76a9e0593ad37ec92389a96da46f3627c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 May 2022 12:53:12 +0200 Subject: [PATCH 036/361] bump tmtc submodule --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 8d0a8312..0a47c17f 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8d0a83122932deb49a9e536bea1a0b5723b1cb2a +Subproject commit 0a47c17fa699dc571d2d3e63ec08c9f4cf513f65 From c413d90b88f48425c32294f48acf654b6a29ec88 Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Tue, 3 May 2022 08:10:07 +0200 Subject: [PATCH 037/361] Minor adaption ti filesystem include and removed arcsect submodule to make it work on my local machine --- .gitmodules | 3 --- mission/devices/devicedefinitions/payloadPcduDefinitions.h | 2 +- mission/memory/NVMParameterBase.cpp | 4 ++-- mission/memory/NVMParameterBase.h | 2 +- thirdparty/arcsec_star_tracker | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) delete mode 160000 thirdparty/arcsec_star_tracker diff --git a/.gitmodules b/.gitmodules index d309e0f5..d9a11687 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "generators/fsfwgen"] path = generators/fsfwgen url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git -[submodule "thirdparty/arcsec_star_tracker"] - path = thirdparty/arcsec_star_tracker - url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git [submodule "thirdparty/json"] path = thirdparty/json url = https://github.com/nlohmann/json.git diff --git a/mission/devices/devicedefinitions/payloadPcduDefinitions.h b/mission/devices/devicedefinitions/payloadPcduDefinitions.h index ab387fc7..c4dc2aa1 100644 --- a/mission/devices/devicedefinitions/payloadPcduDefinitions.h +++ b/mission/devices/devicedefinitions/payloadPcduDefinitions.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "OBSWConfig.h" diff --git a/mission/memory/NVMParameterBase.cpp b/mission/memory/NVMParameterBase.cpp index 78f40525..865c561b 100644 --- a/mission/memory/NVMParameterBase.cpp +++ b/mission/memory/NVMParameterBase.cpp @@ -8,7 +8,7 @@ NVMParameterBase::NVMParameterBase(std::string fullName) : fullName(fullName) {} ReturnValue_t NVMParameterBase::readJsonFile() { - if (std::filesystem::exists(fullName)) { + if (std::experimental::filesystem::exists(fullName)) { // Read JSON file content into object std::ifstream i(fullName); try { @@ -37,7 +37,7 @@ void NVMParameterBase::setFullName(std::string fullName) { this->fullName = full std::string NVMParameterBase::getFullName() const { return fullName; } -bool NVMParameterBase::getJsonFileExists() { return std::filesystem::exists(fullName); } +bool NVMParameterBase::getJsonFileExists() { return std::experimental::filesystem::exists(fullName); } void NVMParameterBase::printKeys() const { sif::info << "Printing keys for JSON file " << fullName << std::endl; diff --git a/mission/memory/NVMParameterBase.h b/mission/memory/NVMParameterBase.h index eb839905..16d9824c 100644 --- a/mission/memory/NVMParameterBase.h +++ b/mission/memory/NVMParameterBase.h @@ -1,7 +1,7 @@ #ifndef BSP_Q7S_CORE_NVMPARAMS_NVMPARAMIF_H_ #define BSP_Q7S_CORE_NVMPARAMS_NVMPARAMIF_H_ -#include +#include #include #include diff --git a/thirdparty/arcsec_star_tracker b/thirdparty/arcsec_star_tracker deleted file mode 160000 index 93e93965..00000000 --- a/thirdparty/arcsec_star_tracker +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 93e93965e2c6405170b62c523dea1990db02d2ad From 7179d9dec314f35ccfa48bb1042754fb5bf8ec50 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 19 May 2022 09:59:33 +0200 Subject: [PATCH 038/361] deSerialize --- mission/devices/ScexDeviceHandler.cpp | 36 ++++++++++++++++----------- mission/devices/ScexDeviceHandler.h | 10 +++++--- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index fe948a7e..8b80bc0e 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -1,16 +1,16 @@ #include "ScexDeviceHandler.h" +#include + #include -#include "mission/devices/devicedefinitions/ScexDefinitions.h" #include "fsfw/globalfunctions/CRC.h" -#include +#include "mission/devices/devicedefinitions/ScexDefinitions.h" ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie) - : DeviceHandlerBase(objectId, reader.getObjectId(),cookie), reader(reader) -{ + : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader) {} -} +ScexDeviceHandler::~ScexDeviceHandler() {} void ScexDeviceHandler::doStartUp() { // mode on @@ -27,9 +27,9 @@ ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* return RETURN_OK; } -ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, - const uint8_t* commandData, - size_t commandDataLen) { +ReturnValue_t ScexDeviceHandler::buildCommandFromCommand( + scex::Cmds deviceCommand, // DeviceCommandId_t + const uint8_t* commandData, size_t commandDataLen) { using namespace scex; if (not std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) != VALID_CMDS.end()) { @@ -96,17 +96,25 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) { - //helper.deSerialize(blabla); - //crc check + uint8_t* decodedPacket = nullptr; + size_t len = 0; - *foundId = helper.getCmd(); - *foundLen = remainingSize; + const uint8_t* helperPtr = decodedPacket; + ReturnValue_t result = helper.deSerialize(&helperPtr, &len); + if (result == ScexHelper::INVALID_CRC) { + sif::warning << "CRC invalid" << std::endl; + } + sif::info << helper << std::endl; + // crc check + + *foundId = helper.getCmd(); + *foundLen = remainingSize; return RETURN_OK; } ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { - //cmd auswertung (in file reinschreiben) + // cmd auswertung (in file reinschreiben) return RETURN_OK; } @@ -123,6 +131,4 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo return RETURN_OK; } - - void ScexDeviceHandler::modeChanged() {} diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index 5058ed3b..f5a46971 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -7,8 +7,10 @@ class ScexDeviceHandler : public DeviceHandlerBase { public: - // ctor vervollständigen - ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie); + // ctor vervollständigen + ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie); + virtual ~ScexDeviceHandler(); + private: std::array cmdBuf = {}; @@ -16,10 +18,10 @@ class ScexDeviceHandler : public DeviceHandlerBase { void doStartUp() override; void doShutDown() override; ScexHelper helper; - ScexUartReader& reader; + ScexUartReader &reader; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; - ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, + ReturnValue_t buildCommandFromCommand(scex::Cmds deviceCommand, const uint8_t *commandData, size_t commandDataLen) override; void fillCommandAndReplyMap() override; ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, From b4e1451501ab51dc9654799e5ff0f2cb80cb7d69 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 19 May 2022 10:16:46 +0200 Subject: [PATCH 039/361] ScexDeviceHandler DeviceReply --- mission/devices/ScexDeviceHandler.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 8b80bc0e..407c470e 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -3,10 +3,13 @@ #include #include +#include #include "fsfw/globalfunctions/CRC.h" #include "mission/devices/devicedefinitions/ScexDefinitions.h" +using std::ofstream; + ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie) : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader) {} @@ -104,8 +107,12 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai if (result == ScexHelper::INVALID_CRC) { sif::warning << "CRC invalid" << std::endl; } - sif::info << helper << std::endl; + // crc check + if (result == ScexHelper::INVALID_CRC) { + sif::warning << "CRC invalid" << std::endl; + } + sif::info << helper << std::endl; *foundId = helper.getCmd(); *foundLen = remainingSize; @@ -115,6 +122,15 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { // cmd auswertung (in file reinschreiben) + using namespace scex; + if (helper.getCmd() == PING) { + ofstream out("/tmp/scex-ping.bin", ofstream::binary); + if (out.bad()) { + sif::warning << "bad" << std::endl; + } + out << helper; + } + // was alles hier rein? return RETURN_OK; } From e8882b11cf65cecda633af290dc2baa57cbbea77 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 19 May 2022 11:56:59 +0200 Subject: [PATCH 040/361] ScexDeviceHandler --- linux/devices/ScexHelper.cpp | 1 + linux/devices/ScexHelper.h | 1 + mission/devices/ScexDeviceHandler.cpp | 117 +++++++++++++++++++++----- mission/devices/ScexDeviceHandler.h | 18 +++- 4 files changed, 113 insertions(+), 24 deletions(-) diff --git a/linux/devices/ScexHelper.cpp b/linux/devices/ScexHelper.cpp index 92a9e24a..3e61d346 100644 --- a/linux/devices/ScexHelper.cpp +++ b/linux/devices/ScexHelper.cpp @@ -35,6 +35,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size, payloadLen = (**buffer << 8) | *(*buffer + 1); *buffer += 2; + payloadStart = *buffer; totalPacketLen = payloadLen + scex::HEADER_LEN + scex::CRC_LEN; if (totalPacketLen >= *size) { return STREAM_TOO_SHORT; diff --git a/linux/devices/ScexHelper.h b/linux/devices/ScexHelper.h index 02908514..eb258568 100644 --- a/linux/devices/ScexHelper.h +++ b/linux/devices/ScexHelper.h @@ -41,6 +41,7 @@ class ScexHelper : public HasReturnvaluesIF, public SerializeIF { int packetCounter = 0; int totalPacketCounter = 0; uint16_t payloadLen = 0; + const uint8_t *payloadStart = 0; size_t totalPacketLen = 0; }; diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 407c470e..b45e603c 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -1,6 +1,7 @@ #include "ScexDeviceHandler.h" #include +#include #include #include @@ -10,8 +11,9 @@ using std::ofstream; -ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie) - : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader) {} +ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie, + SdCardMountedIF* sdcMan) + : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader), sdcMan(sdcMan) {} ScexDeviceHandler::~ScexDeviceHandler() {} @@ -31,11 +33,12 @@ ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* } ReturnValue_t ScexDeviceHandler::buildCommandFromCommand( - scex::Cmds deviceCommand, // DeviceCommandId_t + DeviceCommandId_t deviceCommand, // DeviceCommandId_t const uint8_t* commandData, size_t commandDataLen) { using namespace scex; - if (not std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) != VALID_CMDS.end()) { + auto cmdTyped = static_cast(deviceCommand); + if (std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) == VALID_CMDS.end()) { return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } if (commandDataLen < 1) { @@ -44,39 +47,38 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand( switch (deviceCommand) { case (PING): { - rawPacket = cmdBuf.size(); - - prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + rawPacket = cmdBuf.data(); + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; } case (FRAM): { - prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; } case (ION_CMD): { - prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; } case (TEMP_CMD): { - prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; } case (ONE_CELL): { - prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {commandData + 1, commandData - 1}); + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandDataLen - 1}); return RETURN_OK; } case (ALL_CELLS_CMD): { - prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {commandData + 1, commandData - 1}); + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandDataLen - 1}); return RETURN_OK; } case (EXP_STATUS_CMD): { - prepareScexCmd(deviceCommand, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; } @@ -111,9 +113,8 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai // crc check if (result == ScexHelper::INVALID_CRC) { sif::warning << "CRC invalid" << std::endl; + return result; } - sif::info << helper << std::endl; - *foundId = helper.getCmd(); *foundLen = remainingSize; @@ -123,14 +124,86 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { // cmd auswertung (in file reinschreiben) using namespace scex; - if (helper.getCmd() == PING) { - ofstream out("/tmp/scex-ping.bin", ofstream::binary); + + auto oneFileHandler = [&](std::string cmdName) { + fileId = random_string(6); + std::ostringstream oss("/tmp/scex-"); + oss << cmdName << fileId << ".bin"; + fileName = oss.str(); + ofstream out(fileName, ofstream::binary); if (out.bad()) { - sif::warning << "bad" << std::endl; + sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName + << std::endl; + return RETURN_FAILED; + } + if (debugMode) { + out << helper; + } + return RETURN_OK; + }; + auto multiFileHandler = [&](std::string cmdName) { + if (helper.getPacketCounter() == 1) { + // countdown starten + finishCountdown.resetTimer(); + fileId = random_string(6); + std::ostringstream oss("/tmp/scex-"); + oss << cmdName << fileId << ".bin"; + fileName = oss.str(); + ofstream out(fileName, + ofstream::binary); // neues file anlegen + } else { + ofstream out(fileName, + ofstream::binary | ofstream::app); // an bestehendes file appenden + if (debugMode) { + out << helper; + } + } + if (finishCountdown.hasTimedOut()) { + triggerEvent(scex::EXPERIMENT_TIMEDOUT, id, 0); + reader.finish(); + sif::warning << "ScexDeviceHandler: Reader timeout" << std::endl; + // cmdDone = true; + fileNameSet = false; + } + return RETURN_OK; + }; + switch (id) { + case (PING): { + return oneFileHandler("ping_"); + } + case (ION_CMD): { + return oneFileHandler("ion_"); + } + case (TEMP_CMD): { + return oneFileHandler("temp_"); + } + case (EXP_STATUS_CMD): { + return oneFileHandler("exp_status_"); + } + case (FRAM): { + return multiFileHandler("fram_"); + } + case (ONE_CELL): { + return multiFileHandler("one_cell_"); + } + case (ALL_CELLS_CMD): { + return multiFileHandler("all_cell_"); + } + default: + // Unknown DeviceCommand + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + + if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { + reader.finish(); + sif::info << "Reader is finished" << std::endl; + // cmdDone = true; + fileNameSet = false; + if (helper.getCmd() == scex::Cmds::PING) { + // cmdSent = false; + fileNameSet = true; // to not generate everytime new file } - out << helper; } - // was alles hier rein? return RETURN_OK; } diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index f5a46971..a719fc49 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -5,15 +5,29 @@ #include #include +class SdCardMountedIF; + class ScexDeviceHandler : public DeviceHandlerBase { public: // ctor vervollständigen - ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie); + ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie, + SdCardMountedIF *sdcMan); virtual ~ScexDeviceHandler(); private: std::array cmdBuf = {}; + std::string fileId = ""; + std::string fileName = ""; + bool fileNameSet = false; + bool debugMode = true; + + scex::Cmds currCmd = scex::Cmds::PING; + SdCardMountedIF *sdcMan = nullptr; + Countdown finishCountdown = Countdown(180 * 1000); + + std::string random_string(std::string::size_type length); + // DeviceHandlerBase private function implementation void doStartUp() override; void doShutDown() override; @@ -21,7 +35,7 @@ class ScexDeviceHandler : public DeviceHandlerBase { ScexUartReader &reader; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; - ReturnValue_t buildCommandFromCommand(scex::Cmds deviceCommand, const uint8_t *commandData, + ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, size_t commandDataLen) override; void fillCommandAndReplyMap() override; ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, From 2f4d44433d97721414ce6cfa8a54fd3d638a24c2 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 24 May 2022 18:38:34 +0200 Subject: [PATCH 041/361] scexDeviceHandler::interpretDeviceReply --- mission/devices/ScexDeviceHandler.cpp | 64 +++++++++++++-------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index b45e603c..6c3aa17b 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -32,9 +32,9 @@ ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* return RETURN_OK; } -ReturnValue_t ScexDeviceHandler::buildCommandFromCommand( - DeviceCommandId_t deviceCommand, // DeviceCommandId_t - const uint8_t* commandData, size_t commandDataLen) { +ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t* commandData, + size_t commandDataLen) { using namespace scex; auto cmdTyped = static_cast(deviceCommand); @@ -52,7 +52,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand( {nullptr, 0}); return RETURN_OK; } - case (FRAM): { + case (EXP_STATUS_CMD): { prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; @@ -67,6 +67,11 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand( {nullptr, 0}); return RETURN_OK; } + case (FRAM): { + prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandDataLen - 1}); + return RETURN_OK; + } case (ONE_CELL): { prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}); @@ -77,11 +82,6 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand( {commandData + 1, commandDataLen - 1}); return RETURN_OK; } - case (EXP_STATUS_CMD): { - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {nullptr, 0}); - return RETURN_OK; - } } return RETURN_OK; } @@ -106,13 +106,9 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai const uint8_t* helperPtr = decodedPacket; ReturnValue_t result = helper.deSerialize(&helperPtr, &len); - if (result == ScexHelper::INVALID_CRC) { - sif::warning << "CRC invalid" << std::endl; - } - // crc check if (result == ScexHelper::INVALID_CRC) { - sif::warning << "CRC invalid" << std::endl; + sif::warning << "ScexDeviceHandler::scanForReply: CRC invalid" << std::endl; return result; } *foundId = helper.getCmd(); @@ -142,29 +138,36 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons return RETURN_OK; }; auto multiFileHandler = [&](std::string cmdName) { - if (helper.getPacketCounter() == 1) { + if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { // countdown starten finishCountdown.resetTimer(); + fileId = random_string(6); std::ostringstream oss("/tmp/scex-"); oss << cmdName << fileId << ".bin"; fileName = oss.str(); - ofstream out(fileName, - ofstream::binary); // neues file anlegen + fileNameSet = true; + ofstream out(fileName, ofstream::binary); + if (out.bad()) { + sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName + << std::endl; + return RETURN_FAILED; + } } else { ofstream out(fileName, - ofstream::binary | ofstream::app); // an bestehendes file appenden + ofstream::binary | ofstream::app); // append if (debugMode) { out << helper; } + + if (finishCountdown.hasTimedOut()) { + triggerEvent(scex::EXPERIMENT_TIMEDOUT, id, 0); + reader.finish(); + sif::warning << "ScexDeviceHandler::interpretDiviceReply: Reader timeout" << std::endl; + fileNameSet = false; + } } - if (finishCountdown.hasTimedOut()) { - triggerEvent(scex::EXPERIMENT_TIMEDOUT, id, 0); - reader.finish(); - sif::warning << "ScexDeviceHandler: Reader timeout" << std::endl; - // cmdDone = true; - fileNameSet = false; - } + return RETURN_OK; }; switch (id) { @@ -193,17 +196,14 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons // Unknown DeviceCommand return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { reader.finish(); - sif::info << "Reader is finished" << std::endl; - // cmdDone = true; - fileNameSet = false; - if (helper.getCmd() == scex::Cmds::PING) { - // cmdSent = false; - fileNameSet = true; // to not generate everytime new file + if (id != PING) { + sif::info << "Reader is finished" << std::endl; + fileNameSet = false; } } + return RETURN_OK; } From 83c7ec8067490665b2c14ecb5ddb80a1bd0acb20 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 May 2022 10:12:37 +0200 Subject: [PATCH 042/361] solve merge conflicts --- bsp_q7s/core/InitMission.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 008bc68f..b6a4fa37 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -154,6 +154,10 @@ void initmission::initTasks() { initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS); } #endif + result = sysTask->addComponent(objects::ACS_SUBSYSTEM); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM); + } PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask( "TCS_POLLING_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc); @@ -161,13 +165,7 @@ void initmission::initTasks() { if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("SPI_RTD_POLLING", objects::SPI_RTD_COM_IF); } -<<<<<<< HEAD - result = sysTask->addComponent(objects::ACS_SUBSYSTEM); - if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM); - } -#endif /* OBSW_ADD_RTD_DEVICES == 1 */ -======= + PeriodicTaskIF* tcsTask = factory->createPeriodicTask( "TCS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); std::array rtdIds = { @@ -198,7 +196,6 @@ void initmission::initTasks() { tcsTask->addComponent(rtd, DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_RTD_DEVICES */ ->>>>>>> origin/develop // FS task, task interval does not matter because it runs in permanent loop, priority low // because it is a non-essential background task @@ -295,14 +292,7 @@ void initmission::initTasks() { strHelperTask->startTask(); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ -<<<<<<< HEAD -#if OBSW_ADD_ACS_HANDLERS == 1 - gpsTask->startTask(); -#endif -#if OBSW_ADD_RTD_DEVICES == 1 -======= acsTask->startTask(); ->>>>>>> origin/develop sysTask->startTask(); tcsPollingTask->startTask(); tcsTask->startTask(); From 44d36587aa2d1435fc85f8adfaa9bd20f7317083 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Wed, 25 May 2022 10:51:22 +0200 Subject: [PATCH 043/361] precised printouts --- linux/boardtest/UartTestClass.cpp | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 469081cd..8361ba86 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -64,13 +64,13 @@ void UartTestClass::gpsInit() { #if RPI_TEST_GPS_HANDLER == 1 int result = lwgps_init(&gpsData); if (result == 0) { - sif::warning << "lwgps_init error: " << result << std::endl; + sif::warning << "UartTestClass::gpsInit: lwgps_init error: " << result << std::endl; } /* Get file descriptor */ serialPort = open("/dev/serial0", O_RDWR); if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + sif::warning << "UartTestClass::gpsInit: open call failed with error [" << errno << ", " << strerror(errno) << std::endl; } /* Setting up UART parameters */ @@ -99,7 +99,7 @@ void UartTestClass::gpsInit() { cfsetispeed(&tty, B9600); cfsetospeed(&tty, B9600); if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + sif::warning << "UartTestClass::gpsInit: tcsetattr call failed with error [" << errno << ", " << strerror(errno) << std::endl; ; } @@ -115,11 +115,11 @@ void UartTestClass::gpsPeriodic() { bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), static_cast(recBuf.size())); if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" << errno + sif::warning << "UartTestClass::gpsPeriodic: read call failed with error [" << errno << ", " << strerror(errno) << "]" << std::endl; break; } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: " + sif::debug << "UartTestClass::gpsPeriodic: " "recv buffer might not be large enough" << std::endl; } else if (bytesRead > 0) { @@ -129,7 +129,7 @@ void UartTestClass::gpsPeriodic() { #endif int result = lwgps_process(&gpsData, recBuf.data(), bytesRead); if (result == 0) { - sif::warning << "UartTestClass::performPeriodicAction: lwgps_process error" << std::endl; + sif::warning << "UartTestClass::gpsPeriodic: lwgps_process error" << std::endl; } recvCnt++; if (recvCnt == 6) { @@ -163,7 +163,7 @@ void UartTestClass::scexInit() { reader->setDebugMode(false); ReturnValue_t result = reader->initializeInterface(uartCookie); if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::gpsPeriodic: Initializing SCEX reader " + sif::warning << "UartTestClass::scexInit: Initializing SCEX reader " "UART IF failed" << std::endl; } @@ -199,7 +199,7 @@ void UartTestClass::scexPeriodic() { const uint8_t* helperPtr = decodedPacket; result = helper.deSerialize(&helperPtr, &len); if (result == ScexHelper::INVALID_CRC) { - sif::warning << "CRC invalid" << std::endl; + sif::warning << "UartTestClass::scexPeriodic: CRC invalid" << std::endl; } sif::info << helper << endl; @@ -238,7 +238,7 @@ void UartTestClass::scexPeriodic() { if (finishCountdown.hasTimedOut()) { triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); reader->finish(); - sif::warning << "Reader timeout" << endl; + sif::warning << "UartTestClass::scexPeriodic: Reader timeout" << endl; cmdDone = true; fileNameSet = false; } @@ -246,7 +246,7 @@ void UartTestClass::scexPeriodic() { if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { reader->finish(); - sif::info << "Reader is finished" << endl; + sif::info << "UartTestClass::scexPeriodic: Reader is finished" << endl; cmdDone = true; fileNameSet = false; if (helper.getCmd() == scex::Cmds::PING) { @@ -268,7 +268,7 @@ void UartTestClass::scexSimpleInit() { /* Get file descriptor */ serialPort = open(devname.c_str(), O_RDWR); if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) + sif::warning << "UartTestClass::scexSimpleInit: Open call failed with error [" << errno << ", " << strerror(errno) << std::endl; return; } @@ -291,12 +291,12 @@ void UartTestClass::scexSimpleInit() { // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. #if !defined(XIPHOS_Q7S) if (cfsetispeed(&tty, B57600) != 0) { - sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; + sif::warning << "UartTestClass::scexSimpleInit: Setting baud rate failed" << std::endl; } #endif if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) + sif::warning << "UartTestClass::scexSimpleInit: tcsetattr call failed with error [" << errno << ", " << strerror(errno) << std::endl; } // Flush received and unread data @@ -315,7 +315,7 @@ void UartTestClass::scexSimplePeriodic() { prepareScexCmd(currCmd, false, tmpCmdBuf, &len); result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + sif::warning << "UartTestClass::scexSimplePeriodic: Encoding failed" << std::endl; return; } if (result != 0) { @@ -323,7 +323,7 @@ void UartTestClass::scexSimplePeriodic() { }; size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen); if (bytesWritten != encodedLen) { - sif::warning << "Sending command to solar experiment failed" << std::endl; + sif::warning << "UartTestClass::scexSimplePeriodic: Sending command to solar experiment failed" << std::endl; } cmdSent = true; cmdDone = false; @@ -335,13 +335,13 @@ void UartTestClass::scexSimplePeriodic() { bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), static_cast(recBuf.size())); if (bytesRead == 0) { - sif::warning << "Reading SCEX: Timeout or no bytes read" << std::endl; + sif::warning << "UartTestClass::scexSimplePeriodic: Reading SCEX: Timeout or no bytes read" << std::endl; } else if (bytesRead < 0) { - sif::warning << "UartTestClass::performPeriodicAction: read call failed with error [" + sif::warning << "UartTestClass::scexSimplePeriodic: read call failed with error [" << errno << ", " << strerror(errno) << "]" << std::endl; break; } else if (bytesRead >= static_cast(recBuf.size())) { - sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large " + sif::debug << "UartTestClass::scexSimplePeriodic: recv buffer might not be large " "enough, bytes read:" << bytesRead << std::endl; } else if (bytesRead > 0) { @@ -383,7 +383,7 @@ void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) { } void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) { - sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; + sif::info << "UartTestClass::handleFoundDlePacket: Detected DLE encoded packet with decoded size " << len << std::endl; } std::string UartTestClass::random_string(std::string::size_type length) { From 1276cc2dc6b81582827c1e021b83c69e4e3fdee9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 May 2022 12:04:27 +0200 Subject: [PATCH 044/361] scex additions --- bsp_linux_board/InitMission.cpp | 26 ++++++++++++++++++++++++++ bsp_linux_board/OBSWConfig.h.in | 7 +++++++ bsp_linux_board/ObjectFactory.cpp | 4 ++++ bsp_linux_board/definitions.h | 6 ++++++ common/config/commonObjects.h | 1 + linux/ObjectFactory.cpp | 5 +++++ linux/ObjectFactory.h | 2 ++ linux/obc/PdecHandler.cpp | 1 + 8 files changed, 52 insertions(+) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 0fa7a4f6..27a435b4 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -1,3 +1,4 @@ +#include #include "InitMission.h" #include @@ -77,6 +78,28 @@ void initmission::initTasks() { sif::error << "Add component TMTC Polling failed" << std::endl; } +#if OBSW_ADD_SCEX == 1 + PeriodicTaskIF* scexDevHandler = factory->createPeriodicTask( + "SCEX_DEV", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc); + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ); +#endif + /* PUS Services */ std::vector pusTasks; createPusTasks(*factory, missedDeadlineFunc, pusTasks); @@ -109,6 +132,9 @@ void initmission::initTasks() { #endif /* OBSW_ADD_TEST_CODE == 1 */ taskStarter(pstTasks, "PST Tasks"); +#if OBSW_ADD_SCEX == 1 + scexDevHandler->startTask(); +#endif #if OBSW_ADD_TEST_PST == 1 if (startTestPst) { pstTestTask->startTask(); diff --git a/bsp_linux_board/OBSWConfig.h.in b/bsp_linux_board/OBSWConfig.h.in index d8a981bd..398cf19e 100644 --- a/bsp_linux_board/OBSWConfig.h.in +++ b/bsp_linux_board/OBSWConfig.h.in @@ -28,6 +28,7 @@ #define OBSW_ADD_RTD_DEVICES 0 #define OBSW_ADD_PL_PCDU 0 #define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_SCEX 1 #define OBSW_ADD_RAD_SENSORS 0 #define OBSW_ADD_SYRLINKS 0 #define OBSW_STAR_TRACKER_GROUND_CONFIG 1 @@ -102,6 +103,12 @@ /*******************************************************************/ #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER +#define OBSW_USE_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 +#define OBSW_TC_FROM_PDEC 0 + #cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@ #cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@ diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 47f80936..6ff4947b 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -82,6 +82,10 @@ void ObjectFactory::produce(void* args) { #endif #endif +#if OBSW_ADD_SCEX == 1 + createScexComponents(uart::DEV, pwrSwitcher); +#endif + #if OBSW_ADD_SUN_SENSORS == 1 createSunSensorComponents(gpioIF, spiComIF, pwrSwitcher, spi::DEV); #endif diff --git a/bsp_linux_board/definitions.h b/bsp_linux_board/definitions.h index 1b6814f4..83aeb847 100644 --- a/bsp_linux_board/definitions.h +++ b/bsp_linux_board/definitions.h @@ -13,6 +13,12 @@ static constexpr char DEV[] = "/dev/spidev0.1"; } +namespace uart { + +static constexpr char DEV[] = "/dev/serial0"; + +} + /* Adapt these values accordingly */ namespace gpio { static constexpr uint8_t MGM_0_BCM_PIN = 17; diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index 4a4594f4..1fcd6aaa 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -57,6 +57,7 @@ enum commonObjects : uint32_t { PLOC_MPSOC_HANDLER = 0x44330015, PLOC_SUPERVISOR_HANDLER = 0x44330016, PLOC_SUPERVISOR_HELPER = 0x44330017, + SCEX = 0x44330032, SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2, HEATER_HANDLER = 0x444100A4, diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index f84cf52f..8192d215 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -319,8 +319,13 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, #endif // OBSW_ADD_RTD_DEVICES == 1 } +void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF *pwrSwitcher) { +} + +du findest void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) { if (result != HasReturnvaluesIF::RETURN_OK) { sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl; } } + diff --git a/linux/ObjectFactory.h b/linux/ObjectFactory.h index a5642729..41040fe7 100644 --- a/linux/ObjectFactory.h +++ b/linux/ObjectFactory.h @@ -15,6 +15,8 @@ void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitc void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher, SpiComIF* comIF); +void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher); + void gpioChecker(ReturnValue_t result, std::string output); } // namespace ObjectFactory diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 4c8beeed..9bc95fb8 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -1,4 +1,5 @@ #include "PdecHandler.h" +#include "OBSWConfig.h" #include #include From 5c91697cf19092bee579bf043e5d205a63db6724 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 May 2022 12:09:01 +0200 Subject: [PATCH 045/361] removed accidental typed stuff --- linux/ObjectFactory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 8192d215..cc5e7079 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -322,7 +322,6 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF *pwrSwitcher) { } -du findest void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) { if (result != HasReturnvaluesIF::RETURN_OK) { sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl; From b306116eaca2a7684b538fc0bb7a922038335d17 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 May 2022 12:09:36 +0200 Subject: [PATCH 046/361] remove duplicate declarations --- linux/fsfwconfig/objects/systemObjectList.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index 3e9653d6..165df2d4 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -52,11 +52,6 @@ enum sourceObjects : uint32_t { SCEX_UART_READER = 0x49010006, /* Custom device handler */ - PCDU_HANDLER = 0x442000A1, - SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2, - SYRLINKS_HK_HANDLER = 0x445300A3, - HEATER_HANDLER = 0x444100A4, - RAD_SENSOR = 0x443200A5, SPI_RW_COM_IF = 0x49020005, SPI_RTD_COM_IF = 0x49020006, From 1f616a101de88c0c8abd709e607debaf9f27bdcc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 May 2022 12:10:56 +0200 Subject: [PATCH 047/361] add scex preproc define to OBSWConfig.h.in --- CMakeLists.txt | 3 +++ bsp_q7s/OBSWConfig.h.in | 1 + 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef87352e..77379956 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,9 @@ set(OBSW_ADD_GOMSPACE_PCDU set(OBSW_ADD_RW ${INIT_VAL} CACHE STRING "Add RW modules") +set(OBSW_ADD_SCEX_DEVICE + ${INIT_VAL} + CACHE STRING "Add Solar Cell Experiment module") # ############################################################################## # Pre-Sources preparation diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index ed321f8c..fc9cefca 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -33,6 +33,7 @@ #define OBSW_ADD_ACS_HANDLERS @OBSW_ADD_ACS_HANDLERS@ #define OBSW_ADD_RW @OBSW_ADD_RW@ #define OBSW_ADD_RTD_DEVICES @OBSW_ADD_RTD_DEVICES@ +#define OBSW_ADD_SCEX_DEVICE @OBSW_ADD_SCEX_DEVICE@ #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@ From 24cb5558494ddf3123fd4a3a8e4ff1d9389a5b94 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Sun, 29 May 2022 17:52:13 +0200 Subject: [PATCH 048/361] update --- bsp_linux_board/InitMission.cpp | 2 +- linux/ObjectFactory.cpp | 10 +++++++-- linux/devices/ScexDleParser.cpp | 7 +++--- linux/devices/ScexDleParser.h | 12 ++++++++-- linux/obc/PdecHandler.cpp | 2 +- mission/devices/ScexDeviceHandler.cpp | 22 ++++++++++++++++++- .../devicedefinitions/ScexDefinitions.cpp | 4 ++-- .../devicedefinitions/ScexDefinitions.h | 3 ++- 8 files changed, 48 insertions(+), 14 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index ea44c399..db8dd80f 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -1,6 +1,6 @@ -#include #include "InitMission.h" +#include #include #include #include diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index cc5e7079..bb8b183f 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -319,7 +320,13 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, #endif // OBSW_ADD_RTD_DEVICES == 1 } -void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF *pwrSwitcher) { +void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher) { + // objekte anlegen + SdCardMountedIF* sdcMan = nullptr; + CookieIF* cookie = new CookieIF; + + auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER); + new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, sdcMan); } void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) { @@ -327,4 +334,3 @@ void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) { sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl; } } - diff --git a/linux/devices/ScexDleParser.cpp b/linux/devices/ScexDleParser.cpp index 3a95e497..43405fc5 100644 --- a/linux/devices/ScexDleParser.cpp +++ b/linux/devices/ScexDleParser.cpp @@ -1,6 +1,5 @@ #include "ScexDleParser.h" -ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, - BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, - void *args) - : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {} +ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, + void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {}; +ScexDleParser::~ScexDleParser() {}; diff --git a/linux/devices/ScexDleParser.h b/linux/devices/ScexDleParser.h index eab7e9c1..7fbd73db 100644 --- a/linux/devices/ScexDleParser.h +++ b/linux/devices/ScexDleParser.h @@ -3,10 +3,18 @@ #include + class ScexDleParser : public DleParser { public: - ScexDleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf, - BufPair decodedBuf, UserHandler handler, void* args); + ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, + BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, + void *args); +// ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, +// BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, +// void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args){} + + virtual ~ScexDleParser(); + private: }; #endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */ diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 9bc95fb8..48816512 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -1,5 +1,4 @@ #include "PdecHandler.h" -#include "OBSWConfig.h" #include #include @@ -7,6 +6,7 @@ #include #include +#include "OBSWConfig.h" #include "fsfw/ipc/QueueFactory.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 6c3aa17b..de4b63d0 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -8,6 +8,7 @@ #include "fsfw/globalfunctions/CRC.h" #include "mission/devices/devicedefinitions/ScexDefinitions.h" +#include using std::ofstream; @@ -47,7 +48,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic switch (deviceCommand) { case (PING): { - rawPacket = cmdBuf.data(); + //rawPacket = cmdBuf.data(); prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; @@ -220,4 +221,23 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo return RETURN_OK; } +std::string ScexDeviceHandler::random_string(std::string::size_type length) { + static auto& chrs = + "0123456789" + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + thread_local static std::mt19937 rg{std::random_device{}()}; + thread_local static std::uniform_int_distribution pick(0, + sizeof(chrs) - 2); + + std::string s; + + s.reserve(length); + + while (length--) s += chrs[pick(rg)]; + + return s; +} + void ScexDeviceHandler::modeChanged() {} diff --git a/mission/devices/devicedefinitions/ScexDefinitions.cpp b/mission/devices/devicedefinitions/ScexDefinitions.cpp index c202dd5c..7b8f49dd 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.cpp +++ b/mission/devices/devicedefinitions/ScexDefinitions.cpp @@ -8,7 +8,7 @@ uint8_t scex::createCmdByte(Cmds cmd, bool tempCheck) { return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck; } -ReturnValue_t scex::prepareScexCmd(scex::Cmds cmd, bool tempCheck, +ReturnValue_t scex::prepareScexCmd(Cmds cmd, bool tempCheck, std::pair cmdBufPair, size_t& cmdLen, std::pair usrDataPair) { using namespace scex; @@ -20,7 +20,7 @@ ReturnValue_t scex::prepareScexCmd(scex::Cmds cmd, bool tempCheck, cmdLen = 0; return HasReturnvaluesIF::RETURN_FAILED; } - cmdBuf[0] = scex::createCmdByte(cmd, tempCheck); + cmdBuf[0] = createCmdByte(cmd, tempCheck); // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each // telecommand so far cmdBuf[1] = 1; diff --git a/mission/devices/devicedefinitions/ScexDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h index 70426085..55264f3e 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -39,7 +39,8 @@ static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0; static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1; uint8_t createCmdByte(Cmds cmd, bool tempCheck); -ReturnValue_t prepareScexCmd(scex::Cmds cmd, bool tempCheck, std::pair cmdBufPair, + +ReturnValue_t prepareScexCmd(Cmds cmd, bool tempCheck, std::pair cmdBufPair, size_t& cmdLen, std::pair usrDataPair); } // namespace scex From f5ee21334cd8a428da35aaf795532afb65ea8509 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Sun, 29 May 2022 17:54:17 +0200 Subject: [PATCH 049/361] formatted --- linux/devices/ScexDleParser.cpp | 8 +++++--- linux/devices/ScexDleParser.h | 14 +++++++------- mission/devices/ScexDeviceHandler.cpp | 4 ++-- .../devices/devicedefinitions/ScexDefinitions.cpp | 5 ++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/linux/devices/ScexDleParser.cpp b/linux/devices/ScexDleParser.cpp index 43405fc5..ac1828dc 100644 --- a/linux/devices/ScexDleParser.cpp +++ b/linux/devices/ScexDleParser.cpp @@ -1,5 +1,7 @@ #include "ScexDleParser.h" -ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, - void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args) {}; -ScexDleParser::~ScexDleParser() {}; +ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, + BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, + void *args) + : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args){}; +ScexDleParser::~ScexDleParser(){}; diff --git a/linux/devices/ScexDleParser.h b/linux/devices/ScexDleParser.h index 7fbd73db..ef87abb7 100644 --- a/linux/devices/ScexDleParser.h +++ b/linux/devices/ScexDleParser.h @@ -3,17 +3,17 @@ #include - class ScexDleParser : public DleParser { public: - ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, - BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, - void *args); -// ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, -// BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, -// void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args){} + ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, BufPair encodedBuf, + BufPair decodedBuf, UserHandler handler, void *args); + // ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, + // BufPair encodedBuf, BufPair decodedBuf, UserHandler handler, + // void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, + // args){} virtual ~ScexDleParser(); + private: }; diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index de4b63d0..f732447f 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -5,10 +5,10 @@ #include #include +#include #include "fsfw/globalfunctions/CRC.h" #include "mission/devices/devicedefinitions/ScexDefinitions.h" -#include using std::ofstream; @@ -48,7 +48,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic switch (deviceCommand) { case (PING): { - //rawPacket = cmdBuf.data(); + // rawPacket = cmdBuf.data(); prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}); return RETURN_OK; diff --git a/mission/devices/devicedefinitions/ScexDefinitions.cpp b/mission/devices/devicedefinitions/ScexDefinitions.cpp index 7b8f49dd..68bf0d76 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.cpp +++ b/mission/devices/devicedefinitions/ScexDefinitions.cpp @@ -8,9 +8,8 @@ uint8_t scex::createCmdByte(Cmds cmd, bool tempCheck) { return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck; } -ReturnValue_t scex::prepareScexCmd(Cmds cmd, bool tempCheck, - std::pair cmdBufPair, size_t& cmdLen, - std::pair usrDataPair) { +ReturnValue_t scex::prepareScexCmd(Cmds cmd, bool tempCheck, std::pair cmdBufPair, + size_t& cmdLen, std::pair usrDataPair) { using namespace scex; uint8_t* cmdBuf = cmdBufPair.first; const uint8_t* userData = usrDataPair.first; From 521b17a8f8453021878956e13b5a50746121f01c Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Mon, 30 May 2022 20:52:45 +0200 Subject: [PATCH 050/361] initmission --- bsp_linux_board/InitMission.cpp | 14 ++++++++++++++ linux/devices/ScexUartReader.cpp | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index db8dd80f..3611524c 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -100,6 +100,20 @@ void initmission::initTasks() { result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ); #endif +#if OBSW_ADD_SCEX_READER == 1 + result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* scexReaderTask = factory->createPeriodicTask( + "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = scexReaderTask->addComponent(objects::SCEX_UART_READER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); + } + sif::info << "Starting tasks.." << std::endl; + tmTcDistributor->startTask(); + tmtcBridgeTask->startTask(); + tmtcPollingTask->startTask(); +#endif + /* PUS Services */ std::vector pusTasks; createPusTasks(*factory, missedDeadlineFunc, pusTasks); diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 517ee4a1..a33040a8 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -165,7 +165,7 @@ void ScexUartReader::foundDlePacketHandler(const DleParser::Context &ctx) { if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); } else { - DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); + DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); } } From 74b38a6d06e6bf7186f95c880e0a75cc2455100b Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Tue, 7 Jun 2022 09:54:52 +0200 Subject: [PATCH 051/361] Worked on config file handler, added all functions --- bsp_hosted/CMakeLists.txt | 1 + bsp_hosted/GlobalConfigHandler.cpp | 156 ++++++++++++++++++ bsp_hosted/GlobalConfigHandler.h | 63 +++++++ bsp_hosted/InitMission.cpp | 10 ++ bsp_hosted/ObjectFactory.cpp | 3 + .../fsfwconfig/objects/systemObjectList.h | 1 + bsp_hosted/main.cpp | 1 + linux/fsfwconfig/objects/systemObjectList.h | 1 + 8 files changed, 236 insertions(+) create mode 100644 bsp_hosted/GlobalConfigHandler.cpp create mode 100644 bsp_hosted/GlobalConfigHandler.h diff --git a/bsp_hosted/CMakeLists.txt b/bsp_hosted/CMakeLists.txt index 7787cf7e..88710bd1 100644 --- a/bsp_hosted/CMakeLists.txt +++ b/bsp_hosted/CMakeLists.txt @@ -2,6 +2,7 @@ target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp + GlobalConfigHandler.cpp ) add_subdirectory(fsfwconfig) diff --git a/bsp_hosted/GlobalConfigHandler.cpp b/bsp_hosted/GlobalConfigHandler.cpp new file mode 100644 index 00000000..b450bfa9 --- /dev/null +++ b/bsp_hosted/GlobalConfigHandler.cpp @@ -0,0 +1,156 @@ +/* + * GlobalConfigHandler.cpp + * + * Created on: May 3, 2022 + * Author: metobs + */ + +#include "GlobalConfigHandler.h" +#include +#include "fsfw/serviceinterface/ServiceInterface.h" + +MutexIF* GlobalConfigHandler::configLock = nullptr; +GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string configFilePath): SystemObject(objectId), NVMParameterBase(configFilePath){ + if (configLock == nullptr) { + configLock = MutexFactory::instance()->createMutex(); + } + +} +ReturnValue_t GlobalConfigHandler::initialize(){ + + ReturnValue_t result = SystemObject::initialize(); + if (result != RETURN_OK) { + return result; + } + result = ReadConfigFile(); + if(result!=RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::initialize: Creating JSON file at " << getFullName() << std::endl; +#endif + result=ResetConfigFile(); + if (result != RETURN_OK) { + return result; + } + } +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::initialize success " << std::endl; +#endif + return result; +} +GlobalConfigHandler::~GlobalConfigHandler() { + +} + +ReturnValue_t GlobalConfigHandler::performOperation(uint8_t operationCode) { + ReturnValue_t result = RETURN_OK; + sif::debug<<"GlobalConfigHandler::performOperation"<lockMutex(MutexIF::TimeoutType::WAITING, 0); + return result; +} +ReturnValue_t GlobalConfigHandler::unlockConfigFile(){ + ReturnValue_t result = RETURN_OK; + result=configLock->unlockMutex(); + return result; +} + +//TBD for set/get/insert: Mutx lock, set/get/insert, Mutex unlock +//Use template functions for different data types +ReturnValue_t GlobalConfigHandler::setConfigFileValue(){ + ReturnValue_t result = RETURN_OK; + return result; +} +ReturnValue_t GlobalConfigHandler::getConfigFileValue(){ + ReturnValue_t result = RETURN_OK; + return result; +} +ReturnValue_t GlobalConfigHandler::insertConfigFileValue(){ + ReturnValue_t result = RETURN_OK; + return result; +} +ReturnValue_t GlobalConfigHandler::resetConfigFileValues(){ + ReturnValue_t result = RETURN_OK; + result=lockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::resetConfigFileValues lock mutex failed with " << result << std::endl; +#endif + return result; + } + insertValue(PARAM_KEY_MAP[PARAM0], PARAM0_DEFAULT); + insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT); + result=unlockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::resetConfigFileValues unlock mutex failed with " << result << std::endl; +#endif + return result; + } + return result; +} +ReturnValue_t GlobalConfigHandler::WriteConfigFile(){ + ReturnValue_t result = RETURN_OK; + ReturnValue_t resultWrite = RETURN_OK; + result=lockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::WriteConfigFile lock mutex failed with " << result << std::endl; +#endif + return result; + } + + resultWrite =writeJsonFile(); + if(resultWrite!=RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << result << std::endl; +#endif + } + + + result=unlockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::WriteConfigFile unlock mutex failed with " << result << std::endl; +#endif + return result; + } + return resultWrite; +} +ReturnValue_t GlobalConfigHandler::ReadConfigFile(){ + ReturnValue_t result = RETURN_OK; + ReturnValue_t resultRead = RETURN_OK; + result=lockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::ReadConfigFile lock mutex failed with " << result << std::endl; +#endif + return result; + } + + resultRead=readJsonFile(); + if(resultRead!=RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << result << std::endl; +#endif + } + + result=unlockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::ReadConfigFile unlock mutex failed with " << result << std::endl; +#endif + return result; + } + + return resultRead; +} +ReturnValue_t GlobalConfigHandler::ResetConfigFile(){ + ReturnValue_t result = RETURN_OK; + resetConfigFileValues(); + result =writeJsonFile(); + return result; +} diff --git a/bsp_hosted/GlobalConfigHandler.h b/bsp_hosted/GlobalConfigHandler.h new file mode 100644 index 00000000..9db594a3 --- /dev/null +++ b/bsp_hosted/GlobalConfigHandler.h @@ -0,0 +1,63 @@ +/* + * GlobalConfigHandler.h + * + * Created on: May 3, 2022 + * Author: metobs + */ + +#ifndef BSP_LINUX_GLOBALCONFIGHANDLER_H_ +#define BSP_LINUX_GLOBALCONFIGHANDLER_H_ + +#include +#include +#include +#include +#include +#include +#include "mission/memory/NVMParameterBase.h" +#include "OBSWConfig.h" + +static constexpr double PARAM0_DEFAULT = 5.0; +static constexpr double PARAM1_DEFAULT = 905.0; + +enum ParamIds : uint8_t { + PARAM0 = 0, + PARAM1 = 1, + +}; + +static std::map PARAM_KEY_MAP = { + {PARAM0, "Parameter0"}, + {PARAM1, "Parameter1"}, +}; +/* + * Idea: This class is intended to be used as a subclass for the Core Controller. + * Its tasks is managing a configuration JSON file containing config values important for various object. + * If some function to read or write a config value is called, a mutex should be used so only one call is done at a time. + */ +class GlobalConfigHandler: public SystemObject, public ExecutableObjectIF, public NVMParameterBase{ +public: + GlobalConfigHandler(object_id_t objectId, std::string configFilePath); + virtual ~GlobalConfigHandler(); + ReturnValue_t performOperation(uint8_t operationCode); + ReturnValue_t initialize(); + + ReturnValue_t lockConfigFile(); + ReturnValue_t unlockConfigFile(); + ReturnValue_t setConfigFileValue(); + ReturnValue_t getConfigFileValue(); + ReturnValue_t insertConfigFileValue(); + ReturnValue_t resetConfigFileValues(); + ReturnValue_t WriteConfigFile(); + ReturnValue_t ReadConfigFile(); + ReturnValue_t ResetConfigFile(); + +private: + std::string configFilePath; + static MutexIF* configLock ; + + + +}; + +#endif /* BSP_LINUX_GLOBALCONFIGHANDLER_H_ */ diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index 0ca59db5..b1463967 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -138,6 +138,15 @@ void initmission::initTasks() { } #endif /* OBSW_ADD_TEST_CODE == 1 */ + PeriodicTaskIF* configTask = factory->createPeriodicTask( + "CONFIG_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + + result = configTask->addComponent(objects::CONFIG_TEST); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("CONFIG_TASK", objects::CONFIG_TEST); + } + + sif::info << "Starting tasks.." << std::endl; tmTcDistributor->startTask(); tmtcBridgeTask->startTask(); @@ -148,6 +157,7 @@ void initmission::initTasks() { pusHighPrio->startTask(); pusMedPrio->startTask(); pusLowPrio->startTask(); + configTask->startTask(); #if OBSW_ADD_TEST_CODE == 1 testTask->startTask(); diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index e1be7588..91fbb509 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -24,6 +24,8 @@ #include #endif +#include "GlobalConfigHandler.h" + void Factory::setStaticFrameworkObjectIds() { PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetDestination = objects::TM_FUNNEL; @@ -44,4 +46,5 @@ void ObjectFactory::produce(void* args) { ObjectFactory::produceGenericObjects(); new TestTask(objects::TEST_TASK); + new GlobalConfigHandler(objects::CONFIG_TEST,"/path/to/JSON.config"); } diff --git a/bsp_hosted/fsfwconfig/objects/systemObjectList.h b/bsp_hosted/fsfwconfig/objects/systemObjectList.h index 91bd2bed..8eddfc4f 100644 --- a/bsp_hosted/fsfwconfig/objects/systemObjectList.h +++ b/bsp_hosted/fsfwconfig/objects/systemObjectList.h @@ -21,6 +21,7 @@ enum sourceObjects : uint32_t { /* Test Task */ TEST_TASK = 0x42694269, + CONFIG_TEST = 0x42694270, DUMMY_INTERFACE = 0xCAFECAFE, DUMMY_HANDLER = 0x4400AFFE, diff --git a/bsp_hosted/main.cpp b/bsp_hosted/main.cpp index 938adb76..cdf1bdb4 100644 --- a/bsp_hosted/main.cpp +++ b/bsp_hosted/main.cpp @@ -23,6 +23,7 @@ int main(void) { << " v" << common::OBSW_VERSION << " | FSFW v" << fsfw::FSFW_VERSION << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; + std::cout << "-- " <<" BSP HOSTED"<< " --" << std::endl; initmission::initMission(); diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index a03e4d38..ec711711 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -59,6 +59,7 @@ enum sourceObjects : uint32_t { /* 0x54 ('T') for test handlers */ TEST_TASK = 0x54694269, + CONFIG_TEST = 0x54694270, LIBGPIOD_TEST = 0x54123456, SPI_TEST = 0x54000010, UART_TEST = 0x54000020, From 0fb620b2903940e571ac204e6720a1088392b418 Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Wed, 8 Jun 2022 08:27:45 +0200 Subject: [PATCH 052/361] Implemented set/get/insert functions for config file handler --- bsp_hosted/GlobalConfigHandler.cpp | 90 +++++++++++++++++++++++++++--- bsp_hosted/GlobalConfigHandler.h | 6 +- 2 files changed, 86 insertions(+), 10 deletions(-) diff --git a/bsp_hosted/GlobalConfigHandler.cpp b/bsp_hosted/GlobalConfigHandler.cpp index b450bfa9..470eba4c 100644 --- a/bsp_hosted/GlobalConfigHandler.cpp +++ b/bsp_hosted/GlobalConfigHandler.cpp @@ -60,17 +60,93 @@ ReturnValue_t GlobalConfigHandler::unlockConfigFile(){ //TBD for set/get/insert: Mutx lock, set/get/insert, Mutex unlock //Use template functions for different data types -ReturnValue_t GlobalConfigHandler::setConfigFileValue(){ +//Trigger Event, if set/get/insert/write/Read fails +template ReturnValue_t GlobalConfigHandler::setConfigFileValue(std::string key, T data){ ReturnValue_t result = RETURN_OK; + ReturnValue_t resultSet = RETURN_OK; + + result=lockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::setConfigFileValue lock mutex failed with " << result << std::endl; +#endif + return result; + } + + resultSet=setValue(key, data); + if(resultSet!=RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << result << std::endl; +#endif + } + + + result=unlockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::setConfigFileValue unlock mutex failed with " << result << std::endl; +#endif + return result; + } + + return resultSet; +} +template ReturnValue_t GlobalConfigHandler::getConfigFileValue(std::string key, T& data){ + ReturnValue_t result = RETURN_OK; + ReturnValue_t resultGet = RETURN_OK; + + result=lockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result << std::endl; +#endif + return result; + } + + resultGet=getValue(key, data); + if (resultGet!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result << std::endl; +#endif + } + result=unlockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::getConfigFileValue unlock mutex failed with " << result << std::endl; +#endif + return result; + } + return result; } -ReturnValue_t GlobalConfigHandler::getConfigFileValue(){ +template ReturnValue_t GlobalConfigHandler::insertConfigFileValue(std::string key, T data){ ReturnValue_t result = RETURN_OK; - return result; -} -ReturnValue_t GlobalConfigHandler::insertConfigFileValue(){ - ReturnValue_t result = RETURN_OK; - return result; + ReturnValue_t resultInsert = RETURN_OK; + + result=lockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::insertConfigFileValue lock mutex failed with " << result << std::endl; +#endif + return result; + } + + resultInsert=insertValue(key, data);//Should never fail + if(resultInsert!=RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::insertConfigFileValue insert failed with " << result << std::endl; +#endif + } + + result=unlockConfigFile(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::insertConfigFileValue unlock mutex failed with " << result << std::endl; +#endif + return result; + } + + return resultInsert; } ReturnValue_t GlobalConfigHandler::resetConfigFileValues(){ ReturnValue_t result = RETURN_OK; diff --git a/bsp_hosted/GlobalConfigHandler.h b/bsp_hosted/GlobalConfigHandler.h index 9db594a3..5a9d0c30 100644 --- a/bsp_hosted/GlobalConfigHandler.h +++ b/bsp_hosted/GlobalConfigHandler.h @@ -44,9 +44,9 @@ public: ReturnValue_t lockConfigFile(); ReturnValue_t unlockConfigFile(); - ReturnValue_t setConfigFileValue(); - ReturnValue_t getConfigFileValue(); - ReturnValue_t insertConfigFileValue(); + template ReturnValue_t setConfigFileValue(std::string key, T data); + template ReturnValue_t getConfigFileValue(std::string key, T& data); + template ReturnValue_t insertConfigFileValue(std::string key, T data); ReturnValue_t resetConfigFileValues(); ReturnValue_t WriteConfigFile(); ReturnValue_t ReadConfigFile(); From 7cd048b03ff95af2451dd43dba488eaa3e478310 Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Wed, 8 Jun 2022 09:18:17 +0200 Subject: [PATCH 053/361] Added events for failure of config file handler functions --- bsp_hosted/GlobalConfigHandler.cpp | 20 +++++++++++++++++--- bsp_hosted/GlobalConfigHandler.h | 13 ++++++++++++- common/config/commonSubsystemIds.h | 1 + 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/bsp_hosted/GlobalConfigHandler.cpp b/bsp_hosted/GlobalConfigHandler.cpp index 470eba4c..93fcad10 100644 --- a/bsp_hosted/GlobalConfigHandler.cpp +++ b/bsp_hosted/GlobalConfigHandler.cpp @@ -58,9 +58,6 @@ ReturnValue_t GlobalConfigHandler::unlockConfigFile(){ return result; } -//TBD for set/get/insert: Mutx lock, set/get/insert, Mutex unlock -//Use template functions for different data types -//Trigger Event, if set/get/insert/write/Read fails template ReturnValue_t GlobalConfigHandler::setConfigFileValue(std::string key, T data){ ReturnValue_t result = RETURN_OK; ReturnValue_t resultSet = RETURN_OK; @@ -75,6 +72,7 @@ template ReturnValue_t GlobalConfigHandler::setConfigFileValue(std: resultSet=setValue(key, data); if(resultSet!=RETURN_OK){ + triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << result << std::endl; #endif @@ -105,6 +103,7 @@ template ReturnValue_t GlobalConfigHandler::getConfigFileValue(std: resultGet=getValue(key, data); if (resultGet!= RETURN_OK){ + triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result << std::endl; #endif @@ -133,6 +132,7 @@ template ReturnValue_t GlobalConfigHandler::insertConfigFileValue(s resultInsert=insertValue(key, data);//Should never fail if(resultInsert!=RETURN_OK){ + triggerEvent(INSERT_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::insertConfigFileValue insert failed with " << result << std::endl; #endif @@ -181,6 +181,7 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile(){ resultWrite =writeJsonFile(); if(resultWrite!=RETURN_OK){ + triggerEvent(WRITE_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << result << std::endl; #endif @@ -209,6 +210,7 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile(){ resultRead=readJsonFile(); if(resultRead!=RETURN_OK){ + triggerEvent(READ_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << result << std::endl; #endif @@ -230,3 +232,15 @@ ReturnValue_t GlobalConfigHandler::ResetConfigFile(){ result =writeJsonFile(); return result; } + + +ReturnValue_t GlobalConfigHandler::setConfigFileName(std::string configFileName){ + ReturnValue_t result = RETURN_OK; + setFullName(configFileName); + result=ResetConfigFile(); + return result; +} +std::string GlobalConfigHandler::getConfigFileName(){ + + return getFullName(); +} diff --git a/bsp_hosted/GlobalConfigHandler.h b/bsp_hosted/GlobalConfigHandler.h index 5a9d0c30..31652f4b 100644 --- a/bsp_hosted/GlobalConfigHandler.h +++ b/bsp_hosted/GlobalConfigHandler.h @@ -39,6 +39,15 @@ class GlobalConfigHandler: public SystemObject, public ExecutableObjectIF, publi public: GlobalConfigHandler(object_id_t objectId, std::string configFilePath); virtual ~GlobalConfigHandler(); + + static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CONFIGHANDLER; + + static constexpr Event SET_CONFIGFILEVALUE_FAILED = MAKE_EVENT(1, severity::MEDIUM); + static constexpr Event GET_CONFIGFILEVALUE_FAILED = MAKE_EVENT(2, severity::MEDIUM); + static constexpr Event INSERT_CONFIGFILEVALUE_FAILED = MAKE_EVENT(3, severity::MEDIUM); + static constexpr Event WRITE_CONFIGFILE_FAILED = MAKE_EVENT(4, severity::MEDIUM); + static constexpr Event READ_CONFIGFILE_FAILED = MAKE_EVENT(5, severity::MEDIUM); + ReturnValue_t performOperation(uint8_t operationCode); ReturnValue_t initialize(); @@ -52,8 +61,10 @@ public: ReturnValue_t ReadConfigFile(); ReturnValue_t ResetConfigFile(); + ReturnValue_t setConfigFileName(std::string configFileName); + std::string getConfigFileName(); + private: - std::string configFilePath; static MutexIF* configLock ; diff --git a/common/config/commonSubsystemIds.h b/common/config/commonSubsystemIds.h index c3e6c5a2..ef0ce7c2 100644 --- a/common/config/commonSubsystemIds.h +++ b/common/config/commonSubsystemIds.h @@ -31,6 +31,7 @@ enum: uint8_t { PDU2_HANDLER = 134, ACU_HANDLER = 135, SYRLINKS = 136, + CONFIGHANDLER=137, COMMON_SUBSYSTEM_ID_END }; } From 8b6992df6d7c1d3783b873d3af8a517330437357 Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Wed, 8 Jun 2022 11:08:19 +0200 Subject: [PATCH 054/361] Added parameter interface to config file handler --- bsp_hosted/GlobalConfigHandler.cpp | 113 ++++++++++++++++++++++++++++- bsp_hosted/GlobalConfigHandler.h | 34 ++++++++- 2 files changed, 143 insertions(+), 4 deletions(-) diff --git a/bsp_hosted/GlobalConfigHandler.cpp b/bsp_hosted/GlobalConfigHandler.cpp index 93fcad10..a2c8ff56 100644 --- a/bsp_hosted/GlobalConfigHandler.cpp +++ b/bsp_hosted/GlobalConfigHandler.cpp @@ -8,9 +8,16 @@ #include "GlobalConfigHandler.h" #include #include "fsfw/serviceinterface/ServiceInterface.h" +#include +#include MutexIF* GlobalConfigHandler::configLock = nullptr; -GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string configFilePath): SystemObject(objectId), NVMParameterBase(configFilePath){ +GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string configFilePath): + SystemObject(objectId), + NVMParameterBase(configFilePath), + parameterHelper(this), + commandQueue(QueueFactory::instance()->createMessageQueue(20)), + actionHelper(this, commandQueue){ if (configLock == nullptr) { configLock = MutexFactory::instance()->createMutex(); } @@ -22,6 +29,12 @@ ReturnValue_t GlobalConfigHandler::initialize(){ if (result != RETURN_OK) { return result; } + + result = actionHelper.initialize(commandQueue); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + result = ReadConfigFile(); if(result!=RETURN_OK){ #if OBSW_VERBOSE_LEVEL >= 1 @@ -32,6 +45,15 @@ ReturnValue_t GlobalConfigHandler::initialize(){ return result; } } + + result = parameterHelper.initialize(); + if (result != HasReturnvaluesIF::RETURN_OK) { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::initialize: parameterHelper init failed with " << result << std::endl; +#endif + return result; + } + #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::initialize success " << std::endl; #endif @@ -44,9 +66,23 @@ GlobalConfigHandler::~GlobalConfigHandler() { ReturnValue_t GlobalConfigHandler::performOperation(uint8_t operationCode) { ReturnValue_t result = RETURN_OK; sif::debug<<"GlobalConfigHandler::performOperation"<receiveMessage(&command); + if (result != RETURN_OK) { + return; + } + + result = parameterHelper.handleParameterMessage(&command); + if (result == RETURN_OK) { + return; + } +} + ReturnValue_t GlobalConfigHandler::lockConfigFile(){ ReturnValue_t result = RETURN_OK; result = configLock->lockMutex(MutexIF::TimeoutType::WAITING, 0); @@ -244,3 +280,78 @@ std::string GlobalConfigHandler::getConfigFileName(){ return getFullName(); } + +ReturnValue_t GlobalConfigHandler::getParameter(uint8_t domainId, uint8_t uniqueId, + ParameterWrapper* parameterWrapper, + const ParameterWrapper* newValues, + uint16_t startAtIndex) { + + ReturnValue_t result = RETURN_OK; + switch(uniqueId){ + + case(ParamIds::PARAM0):{ + result=handleDoubleParamUpdate(PARAM_KEY_MAP[static_cast(uniqueId)], + parameterWrapper, newValues); + break; + } + case(ParamIds::PARAM1):{ + result=handleIntParamUpdate(PARAM_KEY_MAP[static_cast(uniqueId)], + parameterWrapper, newValues); + break; + } + default:{ + result=RETURN_FAILED; + break; + } + } + return result; + +} + +//Taken from payloadPCDU Handler Definition +ReturnValue_t GlobalConfigHandler::handleDoubleParamUpdate(std::string key, + ParameterWrapper* parameterWrapper, + const ParameterWrapper* newValues) { + double newValue = 0.0; + ReturnValue_t result = newValues->getElement(&newValue, 0, 0); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + result=setConfigFileValue(key, newValue); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + // Do this so the dumping and loading with the framework works as well + doubleDummy = newValue; + parameterWrapper->set(doubleDummy); + return WriteConfigFile(); +} + +ReturnValue_t GlobalConfigHandler::handleIntParamUpdate(std::string key, + ParameterWrapper* parameterWrapper, + const ParameterWrapper* newValues) { + int newValue = 0; + ReturnValue_t result = newValues->getElement(&newValue, 0, 0); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + result=setConfigFileValue(key, newValue); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + // Do this so the dumping and loading with the framework works as well + intDummy = newValue; + parameterWrapper->set(intDummy); + return WriteConfigFile(); +} + +MessageQueueId_t GlobalConfigHandler::getCommandQueue() const{ + return commandQueue->getId(); +} + +ReturnValue_t GlobalConfigHandler::executeAction(ActionId_t actionId, + MessageQueueId_t commandedBy, const uint8_t* data, + size_t size) { + + return RETURN_FAILED; +} diff --git a/bsp_hosted/GlobalConfigHandler.h b/bsp_hosted/GlobalConfigHandler.h index 31652f4b..2beffa67 100644 --- a/bsp_hosted/GlobalConfigHandler.h +++ b/bsp_hosted/GlobalConfigHandler.h @@ -16,9 +16,13 @@ #include #include "mission/memory/NVMParameterBase.h" #include "OBSWConfig.h" +#include "fsfw/parameters/HasParametersIF.h" +#include "fsfw/parameters/ParameterHelper.h" +#include +#include static constexpr double PARAM0_DEFAULT = 5.0; -static constexpr double PARAM1_DEFAULT = 905.0; +static constexpr int PARAM1_DEFAULT = 905; enum ParamIds : uint8_t { PARAM0 = 0, @@ -35,7 +39,11 @@ static std::map PARAM_KEY_MAP = { * Its tasks is managing a configuration JSON file containing config values important for various object. * If some function to read or write a config value is called, a mutex should be used so only one call is done at a time. */ -class GlobalConfigHandler: public SystemObject, public ExecutableObjectIF, public NVMParameterBase{ +class GlobalConfigHandler: public SystemObject, + public ExecutableObjectIF, + public NVMParameterBase, + public ReceivesParameterMessagesIF, + public HasActionsIF{ public: GlobalConfigHandler(object_id_t objectId, std::string configFilePath); virtual ~GlobalConfigHandler(); @@ -49,6 +57,7 @@ public: static constexpr Event READ_CONFIGFILE_FAILED = MAKE_EVENT(5, severity::MEDIUM); ReturnValue_t performOperation(uint8_t operationCode); + void readCommandQueue(); ReturnValue_t initialize(); ReturnValue_t lockConfigFile(); @@ -64,11 +73,30 @@ public: ReturnValue_t setConfigFileName(std::string configFileName); std::string getConfigFileName(); + ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, + ParameterWrapper* parameterWrapper, + const ParameterWrapper* newValues, + uint16_t startAtIndex); + + ReturnValue_t handleDoubleParamUpdate(std::string key, + ParameterWrapper* parameterWrapper, + const ParameterWrapper* newValues); + ReturnValue_t handleIntParamUpdate(std::string key, + ParameterWrapper* parameterWrapper, + const ParameterWrapper* newValues) ; + MessageQueueId_t getCommandQueue() const override; + ReturnValue_t executeAction(ActionId_t actionId, + MessageQueueId_t commandedBy, const uint8_t* data, + size_t size) override; private: static MutexIF* configLock ; + ParameterHelper parameterHelper; + MessageQueueIF* commandQueue; + ActionHelper actionHelper; - + double doubleDummy = 0.0; + int intDummy = 0; }; #endif /* BSP_LINUX_GLOBALCONFIGHANDLER_H_ */ From 61257dfdd2988f51016899d52216791f8597046f Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Wed, 8 Jun 2022 12:53:41 +0200 Subject: [PATCH 055/361] Minor refactoring config file handler --- bsp_hosted/GlobalConfigHandler.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bsp_hosted/GlobalConfigHandler.cpp b/bsp_hosted/GlobalConfigHandler.cpp index a2c8ff56..7a995aa3 100644 --- a/bsp_hosted/GlobalConfigHandler.cpp +++ b/bsp_hosted/GlobalConfigHandler.cpp @@ -81,11 +81,18 @@ void GlobalConfigHandler::readCommandQueue(){ if (result == RETURN_OK) { return; } + + result = actionHelper.handleActionMessage(&command); + if (result == HasReturnvaluesIF::RETURN_OK) { + sif::debug<<"GlobalConfigHandler::readCommandQueue handleActionMessage success"<lockMutex(MutexIF::TimeoutType::WAITING, 0); + result = configLock->lockMutex(MutexIF::TimeoutType::WAITING, 10); return result; } ReturnValue_t GlobalConfigHandler::unlockConfigFile(){ @@ -353,5 +360,6 @@ ReturnValue_t GlobalConfigHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { + //Currently, no commands are used return RETURN_FAILED; } From 005e548059053b67add4e1c43d495176c67b7592 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 21 Jun 2022 16:44:14 +0200 Subject: [PATCH 056/361] comntinued scex handler --- bsp_linux_board/InitMission.cpp | 36 ++++++------- common/config/devConf.h | 1 + fsfw | 2 +- linux/ObjectFactory.cpp | 6 ++- linux/devices/ScexDleParser.h | 5 +- linux/devices/ScexUartReader.cpp | 31 ++++++----- linux/devices/ScexUartReader.h | 5 +- mission/devices/CMakeLists.txt | 2 + mission/devices/ScexDeviceHandler.cpp | 54 ++++++++++--------- mission/devices/ScexDeviceHandler.h | 1 - .../devicedefinitions/ScexDefinitions.cpp | 4 +- .../devicedefinitions/ScexDefinitions.h | 6 +-- scripts/rpi-port.sh | 4 +- tmtc | 2 +- 14 files changed, 82 insertions(+), 77 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 3611524c..16fac3f6 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -81,37 +81,31 @@ void initmission::initTasks() { #if OBSW_ADD_SCEX == 1 PeriodicTaskIF* scexDevHandler = factory->createPeriodicTask( "SCEX_DEV", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc); - result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION); + result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } - result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE); + result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } - result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE); + result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } - result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ); + result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } - result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ); -#endif + result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ); -#if OBSW_ADD_SCEX_READER == 1 result = HasReturnvaluesIF::RETURN_OK; - PeriodicTaskIF* scexReaderTask = factory->createPeriodicTask( - "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); - result = scexReaderTask->addComponent(objects::SCEX_UART_READER); - if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); - } - sif::info << "Starting tasks.." << std::endl; - tmTcDistributor->startTask(); - tmtcBridgeTask->startTask(); - tmtcPollingTask->startTask(); + PeriodicTaskIF* scexReaderTask = factory->createPeriodicTask( + "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = scexReaderTask->addComponent(objects::SCEX_UART_READER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); + } #endif /* PUS Services */ @@ -148,6 +142,7 @@ void initmission::initTasks() { #if OBSW_ADD_SCEX == 1 scexDevHandler->startTask(); + scexReaderTask->startTask(); #endif #if OBSW_ADD_TEST_PST == 1 if (startTestPst) { @@ -235,9 +230,12 @@ void initmission::createPstTasks(TaskFactory& factory, "SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc); result = pst::pstSpi(spiPst); if (result != HasReturnvaluesIF::RETURN_OK) { - sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; + if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { + sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; + } + } else { + taskVec.push_back(spiPst); } - taskVec.push_back(spiPst); #endif } diff --git a/common/config/devConf.h b/common/config/devConf.h index 51da9011..68a3e199 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -55,6 +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 GNSS_BAUD = UartBaudRate::RATE_9600; static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200; static constexpr UartBaudRate PLOC_SUPV_BAUD = UartBaudRate::RATE_115200; diff --git a/fsfw b/fsfw index ebbe0863..1910a783 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit ebbe08639caae43667829d2cc2bcbdf91260e175 +Subproject commit 1910a7838c712f1cf34031d2a8b53e2f7cd24f66 diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index bb8b183f..6424dd00 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -323,10 +324,11 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher) { // objekte anlegen SdCardMountedIF* sdcMan = nullptr; - CookieIF* cookie = new CookieIF; + auto* cookie = new UartCookie(objects::SCEX, uartDev, uart::SCEX_BAUD, 4096); auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER); - new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, sdcMan); + auto scexHandler = new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, sdcMan); + scexHandler->setStartUpImmediately(); } void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) { diff --git a/linux/devices/ScexDleParser.h b/linux/devices/ScexDleParser.h index ef87abb7..a8b04ca7 100644 --- a/linux/devices/ScexDleParser.h +++ b/linux/devices/ScexDleParser.h @@ -1,5 +1,4 @@ -#ifndef LINUX_DEVICES_SCEXDLEPARSER_H_ -#define LINUX_DEVICES_SCEXDLEPARSER_H_ +#pragma once #include @@ -16,5 +15,3 @@ class ScexDleParser : public DleParser { private: }; - -#endif /* LINUX_DEVICES_SCEXDLEPARSER_H_ */ diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index a33040a8..f7a65f12 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include // write(), read(), close() #include // Error integer and strerror() function @@ -21,7 +20,7 @@ ScexUartReader::ScexUartReader(object_id_t objectId) ipcRingBuf(200 * 2048, true), ipcQueue(200), dleParser(decodeRingBuf, dleEncoder, {encodedBuf.data(), encodedBuf.size()}, - {decodedBuf.data(), decodedBuf.size()}, &foundDlePacketHandler, this) { + {decodedBuf.data(), decodedBuf.size()}, &foundDlePacketHandler, (void *)this) { semaphore = SemaphoreFactory::instance()->createBinarySemaphore(); semaphore->acquire(); lock = MutexFactory::instance()->createMutex(); @@ -80,8 +79,8 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { /* Get file descriptor */ serialPort = open(devname.c_str(), O_RDWR); if (serialPort < 0) { - sif::warning << "open call failed with error [" << errno << ", " << strerror(errno) - << std::endl; + sif::warning << "ScexUartReader::initializeInterface: open call failed with error [" << errno + << ", " << strerror(errno) << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } // Setting up UART parameters @@ -107,8 +106,8 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { #endif if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { - sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) - << std::endl; + sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error [" + << errno << ", " << strerror(errno) << std::endl; } // Flush received and unread data tcflush(serialPort, TCIOFLUSH); @@ -117,6 +116,9 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + if (sendData == nullptr or sendLen == 0) { + return HasReturnvaluesIF::RETURN_FAILED; + } lock->lockMutex(); if (state == States::NOT_READY or state == States::RUNNING) { lock->unlockMutex(); @@ -128,17 +130,18 @@ ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendD ReturnValue_t result = dleEncoder.encode(sendData, sendLen, cmdbuf.data(), cmdbuf.size(), &encodedLen, true); if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; + sif::warning << "ScexUartReader::sendMessage: Encoding failed" << std::endl; return RETURN_FAILED; } size_t bytesWritten = write(serialPort, cmdbuf.data(), encodedLen); if (bytesWritten != encodedLen) { - sif::warning << "Sending ping command to solar experiment failed" << std::endl; + sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed" + << std::endl; return RETURN_FAILED; } result = semaphore->release(); if (result != HasReturnvaluesIF::RETURN_OK) { - std::cout << "ScexUartReader::sendMessag: Releasing semaphore failed" << std::endl; + std::cout << "ScexUartReader::sendMessage: Releasing semaphore failed" << std::endl; } return RETURN_OK; } @@ -160,12 +163,12 @@ ReturnValue_t ScexUartReader::finish() { return RETURN_OK; } -void ScexUartReader::foundDlePacketHandler(const DleParser::Context &ctx) { +void ScexUartReader::foundDlePacketHandler(const ScexDleParser::Context &ctx) { ScexUartReader *obj = reinterpret_cast(ctx.userArgs); - if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) { + if (ctx.getType() == ScexDleParser::ContextType::PACKET_FOUND) { obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second); } else { - DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); + ScexDleParser::defaultErrorHandler(ctx.error.first, ctx.error.second); } } @@ -175,11 +178,11 @@ void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { MutexGuard mg(lock); ReturnValue_t result = ipcQueue.insert(len); if (result != RETURN_OK) { - sif::warning << "IPCQueue error" << std::endl; + sif::warning << "ScexUartReader::handleFoundDlePacket: IPCQueue error" << std::endl; } result = ipcRingBuf.writeData(packet, len); if (result != RETURN_OK) { - sif::warning << "IPCRingBuf error" << std::endl; + sif::warning << "ScexUartReader::handleFoundDlePacket: IPCRingBuf error" << std::endl; } // sif::info << "DLE handler done" << std::endl; } diff --git a/linux/devices/ScexUartReader.h b/linux/devices/ScexUartReader.h index 4abbfd86..bdce5b65 100644 --- a/linux/devices/ScexUartReader.h +++ b/linux/devices/ScexUartReader.h @@ -1,5 +1,4 @@ -#ifndef LINUX_DEVICES_SCEXUARTREADER_H_ -#define LINUX_DEVICES_SCEXUARTREADER_H_ +#pragma once #include #include @@ -58,5 +57,3 @@ class ScexUartReader : public SystemObject, // strg+shift+n ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override; }; - -#endif /* LINUX_DEVICES_SCEXUARTREADER_H_ */ diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index 3efb68ab..56184ea4 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -21,3 +21,5 @@ target_sources( PayloadPcduHandler.cpp SolarArrayDeploymentHandler.cpp ScexDeviceHandler.cpp) + +add_subdirectory(devicedefinitions) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index f732447f..be280365 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -14,7 +14,7 @@ using std::ofstream; ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie, SdCardMountedIF* sdcMan) - : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader), sdcMan(sdcMan) {} + : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), sdcMan(sdcMan), reader(reader) {} ScexDeviceHandler::~ScexDeviceHandler() {} @@ -42,48 +42,52 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic if (std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) == VALID_CMDS.end()) { return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - if (commandDataLen < 1) { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + bool tempCheck = false; + if (commandDataLen == 1) { + tempCheck = commandData[0]; } switch (deviceCommand) { case (PING): { - // rawPacket = cmdBuf.data(); - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {nullptr, 0}); - return RETURN_OK; + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, + tempCheck); + break; } case (EXP_STATUS_CMD): { - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {nullptr, 0}); - return RETURN_OK; + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, + tempCheck); + break; } case (ION_CMD): { - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {nullptr, 0}); - return RETURN_OK; + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, + tempCheck); + break; } case (TEMP_CMD): { - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {nullptr, 0}); - return RETURN_OK; + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, + tempCheck); + break; } case (FRAM): { - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {commandData + 1, commandDataLen - 1}); - return RETURN_OK; + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandDataLen - 1}, tempCheck); + break; } case (ONE_CELL): { - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {commandData + 1, commandDataLen - 1}); - return RETURN_OK; + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandDataLen - 1}, tempCheck); + break; } case (ALL_CELLS_CMD): { - prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, - {commandData + 1, commandDataLen - 1}); - return RETURN_OK; + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, + {commandData + 1, commandDataLen - 1}, tempCheck); + break; + } + default: { + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } } + rawPacket = cmdBuf.data(); return RETURN_OK; } diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index a719fc49..ad549e68 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -9,7 +9,6 @@ class SdCardMountedIF; class ScexDeviceHandler : public DeviceHandlerBase { public: - // ctor vervollständigen ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie, SdCardMountedIF *sdcMan); virtual ~ScexDeviceHandler(); diff --git a/mission/devices/devicedefinitions/ScexDefinitions.cpp b/mission/devices/devicedefinitions/ScexDefinitions.cpp index 68bf0d76..8685862e 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.cpp +++ b/mission/devices/devicedefinitions/ScexDefinitions.cpp @@ -8,8 +8,8 @@ uint8_t scex::createCmdByte(Cmds cmd, bool tempCheck) { return (IDLE_BIT_0_DEF_STATE << 7) | (IDLE_BIT_1_DEF_STATE << 6) | (cmd << 1) | tempCheck; } -ReturnValue_t scex::prepareScexCmd(Cmds cmd, bool tempCheck, std::pair cmdBufPair, - size_t& cmdLen, std::pair usrDataPair) { +ReturnValue_t scex::prepareScexCmd(Cmds cmd, std::pair cmdBufPair, size_t& cmdLen, + std::pair usrDataPair, bool tempCheck) { using namespace scex; uint8_t* cmdBuf = cmdBufPair.first; const uint8_t* userData = usrDataPair.first; diff --git a/mission/devices/devicedefinitions/ScexDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h index 55264f3e..685f0cc0 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -38,10 +38,10 @@ static constexpr uint8_t CRC_LEN = 2; static constexpr uint8_t IDLE_BIT_0_DEF_STATE = 0; static constexpr uint8_t IDLE_BIT_1_DEF_STATE = 1; -uint8_t createCmdByte(Cmds cmd, bool tempCheck); +uint8_t createCmdByte(Cmds cmd, bool tempCheck = false); -ReturnValue_t prepareScexCmd(Cmds cmd, bool tempCheck, std::pair cmdBufPair, - size_t& cmdLen, std::pair usrDataPair); +ReturnValue_t prepareScexCmd(Cmds cmd, std::pair cmdBufPair, size_t& cmdLen, + std::pair usrDataPair, bool tempCheck = false); } // namespace scex diff --git a/scripts/rpi-port.sh b/scripts/rpi-port.sh index 5801fb50..e8832c89 100755 --- a/scripts/rpi-port.sh +++ b/scripts/rpi-port.sh @@ -1,8 +1,10 @@ #!/bin/bash echo "-L 1538:raspberrypi.local:1538 for Raspberry Pi connect with TCF agent" echo "-L 1539:raspberrypi.local:22 for Raspberry Pi file transfers" +echo "-L 7301:raspberrypi.local:7301 for Raspberry Pi TMTC Commands" ssh -L 1538:raspberrypi.local:1534 \ -L 1539:raspberrypi.local:22 \ - eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 \ + -L 7301:raspberrypi.local:7301 \ + eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 \ -t 'CONSOLE_PREFIX="[RPi Tunnel]" /bin/bash' diff --git a/tmtc b/tmtc index ef349856..7012a6c4 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit ef349856d614be7a408ffadf0c27c677d8be3157 +Subproject commit 7012a6c41f6e211c060f583c21061fe7ca3f4c45 From 2584e51bb420e23bab54e60aa2fcdcaa92c566b2 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 21 Jun 2022 16:49:26 +0200 Subject: [PATCH 057/361] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 7012a6c4..67500e88 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 7012a6c41f6e211c060f583c21061fe7ca3f4c45 +Subproject commit 67500e88edbf684e79775333c69735ac88b31fd0 From 20328f89ae4344f5440ab437abce54586f601baa Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 21 Jun 2022 17:46:59 +0200 Subject: [PATCH 058/361] ping cmd working --- mission/devices/ScexDeviceHandler.cpp | 59 +++++++++++++++++---------- mission/devices/ScexDeviceHandler.h | 7 +++- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index be280365..e18292c0 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -46,6 +46,9 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic if (commandDataLen == 1) { tempCheck = commandData[0]; } + if (commandActive) { + return DeviceHandlerIF::BUSY; + } switch (deviceCommand) { case (PING): { @@ -87,12 +90,13 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } } + commandActive = true; rawPacket = cmdBuf.data(); return RETURN_OK; } void ScexDeviceHandler::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(scex::Cmds::PING, 3); + insertInCommandAndReplyMap(scex::Cmds::PING, 5); insertInCommandAndReplyMap(scex::Cmds::ION_CMD, 3); insertInCommandAndReplyMap(scex::Cmds::TEMP_CMD, 3); insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3); @@ -106,11 +110,8 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) { - uint8_t* decodedPacket = nullptr; - size_t len = 0; - - const uint8_t* helperPtr = decodedPacket; - ReturnValue_t result = helper.deSerialize(&helperPtr, &len); + size_t len = remainingSize; + ReturnValue_t result = helper.deSerialize(&start, &len); if (result == ScexHelper::INVALID_CRC) { sif::warning << "ScexDeviceHandler::scanForReply: CRC invalid" << std::endl; @@ -126,8 +127,12 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons // cmd auswertung (in file reinschreiben) using namespace scex; + ReturnValue_t status = RETURN_OK; auto oneFileHandler = [&](std::string cmdName) { fileId = random_string(6); + finishCountdown.setTimeout(SHORT_CD); + // countdown starten + finishCountdown.resetTimer(); std::ostringstream oss("/tmp/scex-"); oss << cmdName << fileId << ".bin"; fileName = oss.str(); @@ -144,6 +149,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons }; auto multiFileHandler = [&](std::string cmdName) { if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { + finishCountdown.setTimeout(LONG_CD); // countdown starten finishCountdown.resetTimer(); @@ -164,38 +170,38 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons if (debugMode) { out << helper; } - - if (finishCountdown.hasTimedOut()) { - triggerEvent(scex::EXPERIMENT_TIMEDOUT, id, 0); - reader.finish(); - sif::warning << "ScexDeviceHandler::interpretDiviceReply: Reader timeout" << std::endl; - fileNameSet = false; - } } return RETURN_OK; }; switch (id) { case (PING): { - return oneFileHandler("ping_"); + status = oneFileHandler("ping_"); + break; } case (ION_CMD): { - return oneFileHandler("ion_"); + status = oneFileHandler("ion_"); + break; } case (TEMP_CMD): { - return oneFileHandler("temp_"); + status = oneFileHandler("temp_"); + break; } case (EXP_STATUS_CMD): { - return oneFileHandler("exp_status_"); + status = oneFileHandler("exp_status_"); + break; } case (FRAM): { - return multiFileHandler("fram_"); + status = multiFileHandler("fram_"); + break; } case (ONE_CELL): { - return multiFileHandler("one_cell_"); + status = multiFileHandler("one_cell_"); + break; } case (ALL_CELLS_CMD): { - return multiFileHandler("all_cell_"); + status = multiFileHandler("all_cell_"); + break; } default: // Unknown DeviceCommand @@ -203,13 +209,24 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons } if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { reader.finish(); + commandActive = false; if (id != PING) { sif::info << "Reader is finished" << std::endl; fileNameSet = false; } } - return RETURN_OK; + return status; +} + +void ScexDeviceHandler::performOperationHook() { + if (commandActive and finishCountdown.hasTimedOut()) { + triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); + reader.finish(); + sif::warning << "ScexDeviceHandler::interpretDiviceReply: Reader timeout" << std::endl; + fileNameSet = false; + commandActive = false; + } } uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index ad549e68..eeaac755 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -14,16 +14,19 @@ class ScexDeviceHandler : public DeviceHandlerBase { virtual ~ScexDeviceHandler(); private: + static constexpr uint32_t LONG_CD = 180 * 1000; + static constexpr uint32_t SHORT_CD = 7000; std::array cmdBuf = {}; std::string fileId = ""; std::string fileName = ""; bool fileNameSet = false; + bool commandActive = false; bool debugMode = true; scex::Cmds currCmd = scex::Cmds::PING; SdCardMountedIF *sdcMan = nullptr; - Countdown finishCountdown = Countdown(180 * 1000); + Countdown finishCountdown = Countdown(LONG_CD); std::string random_string(std::string::size_type length); @@ -32,6 +35,8 @@ class ScexDeviceHandler : public DeviceHandlerBase { void doShutDown() override; ScexHelper helper; ScexUartReader &reader; + + void performOperationHook() override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, From 5a92b9e6160c2c4852e31a5ce4d198d4f97aff6f Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 30 Jun 2022 21:53:02 +0200 Subject: [PATCH 059/361] tmtc --- linux/devices/ScexUartReader.cpp | 1 - mission/devices/ScexDeviceHandler.cpp | 4 ++-- tmtc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index f7a65f12..b4e48612 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -184,7 +184,6 @@ void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { if (result != RETURN_OK) { sif::warning << "ScexUartReader::handleFoundDlePacket: IPCRingBuf error" << std::endl; } - // sif::info << "DLE handler done" << std::endl; } ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index e18292c0..7417ca0d 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -150,7 +150,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons auto multiFileHandler = [&](std::string cmdName) { if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { finishCountdown.setTimeout(LONG_CD); - // countdown starten + // countdown starts finishCountdown.resetTimer(); fileId = random_string(6); @@ -223,7 +223,7 @@ void ScexDeviceHandler::performOperationHook() { if (commandActive and finishCountdown.hasTimedOut()) { triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); reader.finish(); - sif::warning << "ScexDeviceHandler::interpretDiviceReply: Reader timeout" << std::endl; + sif::warning << "ScexDeviceHandler::performOperationHook: Reader timeout" << std::endl; fileNameSet = false; commandActive = false; } diff --git a/tmtc b/tmtc index 67500e88..dbae41cb 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 67500e88edbf684e79775333c69735ac88b31fd0 +Subproject commit dbae41cb5810c45ee783080dd0c0f5580e258876 From d9060734b05dd29cf2f0849040bdb2506789f968 Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Tue, 5 Jul 2022 12:57:50 +0200 Subject: [PATCH 060/361] Removed insert function in config handler, not needed. Added more tests for config handler --- mission/utility/GlobalConfigFileDefinitions.h | 23 ++++ mission/utility/GlobalConfigHandler.cpp | 103 ++---------------- mission/utility/GlobalConfigHandler.h | 53 ++++----- unittest/controller/testConfigFileHandler.cpp | 44 +++++++- 4 files changed, 95 insertions(+), 128 deletions(-) create mode 100644 mission/utility/GlobalConfigFileDefinitions.h diff --git a/mission/utility/GlobalConfigFileDefinitions.h b/mission/utility/GlobalConfigFileDefinitions.h new file mode 100644 index 00000000..7a48c095 --- /dev/null +++ b/mission/utility/GlobalConfigFileDefinitions.h @@ -0,0 +1,23 @@ +/* + * GlobalConfigFileDefinitions.h + * + * Created on: July 05, 2022 + * Author: Jona Petri (IRS) + */ + +#ifndef MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ +#define MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ + + +static constexpr double PARAM0_DEFAULT = 5.0; +static constexpr int PARAM1_DEFAULT = 905; + +enum ParamIds : uint8_t { + PARAM0 = 0, + PARAM1 = 1, + +}; + + + +#endif /* MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ */ diff --git a/mission/utility/GlobalConfigHandler.cpp b/mission/utility/GlobalConfigHandler.cpp index 109fbfa6..c76af5d1 100644 --- a/mission/utility/GlobalConfigHandler.cpp +++ b/mission/utility/GlobalConfigHandler.cpp @@ -2,7 +2,7 @@ * GlobalConfigHandler.cpp * * Created on: May 3, 2022 - * Author: metobs + * Author: Jona Petri (IRS) */ #include "GlobalConfigHandler.h" @@ -11,6 +11,7 @@ #include #include + MutexIF* GlobalConfigHandler::configLock = nullptr; GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string configFilePath): SystemObject(objectId), @@ -73,7 +74,7 @@ ReturnValue_t GlobalConfigHandler::unlockConfigFile(){ return result; } -template ReturnValue_t GlobalConfigHandler::setConfigFileValue(std::string key, T data){ +template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data){ ReturnValue_t result = RETURN_OK; ReturnValue_t resultSet = RETURN_OK; @@ -85,7 +86,7 @@ template ReturnValue_t GlobalConfigHandler::setConfigFileValue(std: return result; } - resultSet=setValue(key, data); + resultSet=setValue(PARAM_KEY_MAP[paramID], data); if(resultSet!=RETURN_OK){ triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 @@ -104,7 +105,7 @@ template ReturnValue_t GlobalConfigHandler::setConfigFileValue(std: return resultSet; } -template ReturnValue_t GlobalConfigHandler::getConfigFileValue(std::string key, T& data){ +template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data){ ReturnValue_t result = RETURN_OK; ReturnValue_t resultGet = RETURN_OK; @@ -116,7 +117,7 @@ template ReturnValue_t GlobalConfigHandler::getConfigFileValue(std: return result; } - resultGet=getValue(key, data); + resultGet=getValue(PARAM_KEY_MAP[paramID], data); if (resultGet!= RETURN_OK){ triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 @@ -133,36 +134,7 @@ template ReturnValue_t GlobalConfigHandler::getConfigFileValue(std: return result; } -template ReturnValue_t GlobalConfigHandler::insertConfigFileValue(std::string key, T data){ - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultInsert = RETURN_OK; - result=lockConfigFile(); - if (result!= RETURN_OK){ -#if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::insertConfigFileValue lock mutex failed with " << result << std::endl; -#endif - return result; - } - - resultInsert=insertValue(key, data);//Should never fail - if(resultInsert!=RETURN_OK){ - triggerEvent(INSERT_CONFIGFILEVALUE_FAILED, 0, 0); -#if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::insertConfigFileValue insert failed with " << result << std::endl; -#endif - } - - result=unlockConfigFile(); - if (result!= RETURN_OK){ -#if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::insertConfigFileValue unlock mutex failed with " << result << std::endl; -#endif - return result; - } - - return resultInsert; -} ReturnValue_t GlobalConfigHandler::resetConfigFileValues(){ ReturnValue_t result = RETURN_OK; result=lockConfigFile(); @@ -260,65 +232,10 @@ std::string GlobalConfigHandler::getConfigFileName(){ return getFullName(); } -ReturnValue_t GlobalConfigHandler::getParameter(uint8_t domainId, uint8_t uniqueId, - ParameterWrapper* parameterWrapper, - const ParameterWrapper* newValues, - uint16_t startAtIndex) { - ReturnValue_t result = RETURN_OK; - switch(uniqueId){ - - case(ParamIds::PARAM0):{ - result=handleDoubleParamUpdate(PARAM_KEY_MAP[static_cast(uniqueId)], - parameterWrapper, newValues); - break; - } - case(ParamIds::PARAM1):{ - result=handleIntParamUpdate(PARAM_KEY_MAP[static_cast(uniqueId)], - parameterWrapper, newValues); - break; - } - default:{ - result=RETURN_FAILED; - break; - } - } - return result; - -} - -//Taken from payloadPCDU Handler Definition -ReturnValue_t GlobalConfigHandler::handleDoubleParamUpdate(std::string key, - ParameterWrapper* parameterWrapper, - const ParameterWrapper* newValues) { - double newValue = 0.0; - ReturnValue_t result = newValues->getElement(&newValue, 0, 0); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - result=setConfigFileValue(key, newValue); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - // Do this so the dumping and loading with the framework works as well - - return WriteConfigFile(); -} - -ReturnValue_t GlobalConfigHandler::handleIntParamUpdate(std::string key, - ParameterWrapper* parameterWrapper, - const ParameterWrapper* newValues) { - int newValue = 0; - ReturnValue_t result = newValues->getElement(&newValue, 0, 0); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - result=setConfigFileValue(key, newValue); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - return WriteConfigFile(); -} +template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, double& data); +template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, int32_t& data); +template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, double data); +template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, int32_t data); diff --git a/mission/utility/GlobalConfigHandler.h b/mission/utility/GlobalConfigHandler.h index 14e20b28..7869aaf0 100644 --- a/mission/utility/GlobalConfigHandler.h +++ b/mission/utility/GlobalConfigHandler.h @@ -2,11 +2,11 @@ * GlobalConfigHandler.h * * Created on: May 3, 2022 - * Author: metobs + * Author: Jona Petri (IRS) */ -#ifndef BSP_LINUX_GLOBALCONFIGHANDLER_H_ -#define BSP_LINUX_GLOBALCONFIGHANDLER_H_ +#ifndef MISSION_UTILITY_GLOBALCONFIGHANDLER_H_ +#define MISSION_UTILITY_GLOBALCONFIGHANDLER_H_ #include #include @@ -21,14 +21,7 @@ #include #include -static constexpr double PARAM0_DEFAULT = 5.0; -static constexpr int PARAM1_DEFAULT = 905; - -enum ParamIds : uint8_t { - PARAM0 = 0, - PARAM1 = 1, - -}; +#include "GlobalConfigFileDefinitions.h" static std::map PARAM_KEY_MAP = { {PARAM0, "Parameter0"}, @@ -58,34 +51,26 @@ public: ReturnValue_t initialize(); - ReturnValue_t lockConfigFile(); - ReturnValue_t unlockConfigFile(); - template ReturnValue_t setConfigFileValue(std::string key, T data); - template ReturnValue_t getConfigFileValue(std::string key, T& data); - template ReturnValue_t insertConfigFileValue(std::string key, T data); + + template ReturnValue_t setConfigFileValue(ParamIds paramID, T data); + template ReturnValue_t getConfigFileValue(ParamIds paramID, T& data); + ReturnValue_t resetConfigFileValues(); ReturnValue_t WriteConfigFile(); + std::string getConfigFileName(); + +private: + static MutexIF* configLock ; + + ReturnValue_t lockConfigFile(); + ReturnValue_t unlockConfigFile(); + + + ReturnValue_t ReadConfigFile(); ReturnValue_t ResetConfigFile(); ReturnValue_t setConfigFileName(std::string configFileName); - std::string getConfigFileName(); - - ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, - ParameterWrapper* parameterWrapper, - const ParameterWrapper* newValues, - uint16_t startAtIndex); - - ReturnValue_t handleDoubleParamUpdate(std::string key, - ParameterWrapper* parameterWrapper, - const ParameterWrapper* newValues); - ReturnValue_t handleIntParamUpdate(std::string key, - ParameterWrapper* parameterWrapper, - const ParameterWrapper* newValues) ; - - -private: - static MutexIF* configLock ; MessageQueueIF* commandQueue; @@ -94,4 +79,4 @@ private: }; -#endif /* BSP_LINUX_GLOBALCONFIGHANDLER_H_ */ +#endif /* MISSION_UTILITY_GLOBALCONFIGHANDLER_H_ */ diff --git a/unittest/controller/testConfigFileHandler.cpp b/unittest/controller/testConfigFileHandler.cpp index a76a9efe..30365863 100644 --- a/unittest/controller/testConfigFileHandler.cpp +++ b/unittest/controller/testConfigFileHandler.cpp @@ -11,9 +11,51 @@ TEST_CASE("Configfile Handler", "[ConfigHandler]") { - GlobalConfigHandler confighandler= GlobalConfigHandler(objects::CONFIG_TEST,"JSON.config"); sif::debug<<"Testcase config file handler"< Date: Tue, 5 Jul 2022 14:56:31 +0200 Subject: [PATCH 061/361] Code refactoring and bug fixes for config file handler. Added new test cases for config file handler --- mission/utility/GlobalConfigFileDefinitions.h | 2 +- mission/utility/GlobalConfigHandler.cpp | 32 +++++++++++++++---- mission/utility/GlobalConfigHandler.h | 10 +++--- unittest/controller/testConfigFileHandler.cpp | 10 ++++-- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/mission/utility/GlobalConfigFileDefinitions.h b/mission/utility/GlobalConfigFileDefinitions.h index 7a48c095..b4f5f394 100644 --- a/mission/utility/GlobalConfigFileDefinitions.h +++ b/mission/utility/GlobalConfigFileDefinitions.h @@ -15,7 +15,7 @@ static constexpr int PARAM1_DEFAULT = 905; enum ParamIds : uint8_t { PARAM0 = 0, PARAM1 = 1, - + PARAM2 = 2, }; diff --git a/mission/utility/GlobalConfigHandler.cpp b/mission/utility/GlobalConfigHandler.cpp index c76af5d1..df0b4566 100644 --- a/mission/utility/GlobalConfigHandler.cpp +++ b/mission/utility/GlobalConfigHandler.cpp @@ -86,11 +86,23 @@ template ReturnValue_t GlobalConfigHandler::setConfigFileValue(Para return result; } + std:: string paramString; + paramString=PARAM_KEY_MAP[paramID]; + + //Check if key exists in map before setting value. No check is done in setValue! Somehow PARAM_KEY_MAP.count(paramID) == 0 does not work + if (paramString.empty() == true) { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::setConfigFileValue ParamId " << PARAM_KEY_MAP[paramID]<<" not found!" << std::endl; +#endif + triggerEvent(SET_CONFIGFILEVALUE_FAILED, 1, 0); + return RETURN_FAILED; + } + resultSet=setValue(PARAM_KEY_MAP[paramID], data); if(resultSet!=RETURN_OK){ triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << resultSet << std::endl; #endif } @@ -121,7 +133,7 @@ template ReturnValue_t GlobalConfigHandler::getConfigFileValue(Para if (resultGet!= RETURN_OK){ triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::getConfigFileValue getValue failed with " << resultGet << std::endl; #endif } result=unlockConfigFile(); @@ -132,7 +144,7 @@ template ReturnValue_t GlobalConfigHandler::getConfigFileValue(Para return result; } - return result; + return resultGet; } ReturnValue_t GlobalConfigHandler::resetConfigFileValues(){ @@ -146,6 +158,8 @@ ReturnValue_t GlobalConfigHandler::resetConfigFileValues(){ } insertValue(PARAM_KEY_MAP[PARAM0], PARAM0_DEFAULT); insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT); + + result=unlockConfigFile(); if (result!= RETURN_OK){ #if OBSW_VERBOSE_LEVEL >= 1 @@ -170,7 +184,7 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile(){ if(resultWrite!=RETURN_OK){ triggerEvent(WRITE_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << resultWrite << std::endl; #endif } @@ -199,7 +213,7 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile(){ if(resultRead!=RETURN_OK){ triggerEvent(READ_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << resultRead << std::endl; #endif } @@ -215,7 +229,13 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile(){ } ReturnValue_t GlobalConfigHandler::ResetConfigFile(){ ReturnValue_t result = RETURN_OK; - resetConfigFileValues(); + result=resetConfigFileValues(); + if (result!= RETURN_OK){ +#if OBSW_VERBOSE_LEVEL >= 1 + sif::info << "GlobalConfigHandler::ResetConfigFile failed with " << result << std::endl; +#endif + return result; + } result =writeJsonFile(); return result; } diff --git a/mission/utility/GlobalConfigHandler.h b/mission/utility/GlobalConfigHandler.h index 7869aaf0..cbb65d20 100644 --- a/mission/utility/GlobalConfigHandler.h +++ b/mission/utility/GlobalConfigHandler.h @@ -55,7 +55,8 @@ public: template ReturnValue_t setConfigFileValue(ParamIds paramID, T data); template ReturnValue_t getConfigFileValue(ParamIds paramID, T& data); - ReturnValue_t resetConfigFileValues(); + + ReturnValue_t ResetConfigFile(); ReturnValue_t WriteConfigFile(); std::string getConfigFileName(); @@ -64,14 +65,11 @@ private: ReturnValue_t lockConfigFile(); ReturnValue_t unlockConfigFile(); - - - - ReturnValue_t ReadConfigFile(); - ReturnValue_t ResetConfigFile(); + ReturnValue_t resetConfigFileValues(); ReturnValue_t setConfigFileName(std::string configFileName); + ReturnValue_t ReadConfigFile(); MessageQueueIF* commandQueue; diff --git a/unittest/controller/testConfigFileHandler.cpp b/unittest/controller/testConfigFileHandler.cpp index 30365863..cbfd24b6 100644 --- a/unittest/controller/testConfigFileHandler.cpp +++ b/unittest/controller/testConfigFileHandler.cpp @@ -12,13 +12,13 @@ TEST_CASE("Configfile Handler", "[ConfigHandler]") { sif::debug<<"Testcase config file handler"< Date: Fri, 8 Jul 2022 16:39:07 +0200 Subject: [PATCH 062/361] smaller fixes, always download ETL --- CMakeLists.txt | 26 +++++++++++++------------- bsp_linux_board/ObjectFactory.cpp | 2 +- fsfw | 2 +- tmtc | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e18fa588..7317b5a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -374,20 +374,20 @@ add_subdirectory(${UNITTEST_PATH}) # This should have already been downloaded by the FSFW Still include it to be # safe -find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) +# find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) # Not installed, so use FetchContent to download and provide etl -if(NOT etl_FOUND) - message( - STATUS - "No ETL installation was found with find_package. Installing and providing " - "etl with FindPackage") - include(FetchContent) - FetchContent_Declare( - etl - GIT_REPOSITORY https://github.com/ETLCPP/etl - GIT_TAG ${FSFW_ETL_LIB_VERSION}) - list(APPEND FSFW_FETCH_CONTENT_TARGETS etl) -endif() +# if(NOT etl_FOUND) +message( + STATUS + "No ETL installation was found with find_package. Installing and providing " + "etl with FindPackage") +include(FetchContent) +FetchContent_Declare( + etl + GIT_REPOSITORY https://github.com/ETLCPP/etl + GIT_TAG ${FSFW_ETL_LIB_VERSION}) +list(APPEND FSFW_FETCH_CONTENT_TARGETS etl) +# endif() # Use same Catch2 version as framework if(NOT (TGT_BSP MATCHES "arm/te0720-1cfa") diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 5ac79123..19a00647 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -20,7 +20,7 @@ #include "mission/core/GenericFactory.h" #include "mission/devices/GPSHyperionHandler.h" #include "mission/devices/GyroADIS1650XHandler.h" -#include "mission/utility/TmFunnel.h" +#include "mission/tmtc/TmFunnel.h" #include "objects/systemObjectList.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" diff --git a/fsfw b/fsfw index 6a62cf7f..904ae2cc 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 6a62cf7f1e47d627346916f3605829118ffd8357 +Subproject commit 904ae2cc0ef61706a385d498942154da4f923a18 diff --git a/tmtc b/tmtc index 87d539d4..370d6c2f 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 87d539d46eba64569e550f5873e176f31fce1542 +Subproject commit 370d6c2fa4e9c84d96d23cbae6711cdf68cdd465 From 57f97de58e530882324cbbdf1632ddf8fc069548 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Jul 2022 16:46:27 +0200 Subject: [PATCH 063/361] rerun generator scripts --- generators/bsp_q7s_events.csv | 1 + generators/bsp_q7s_objects.csv | 2 + generators/bsp_q7s_returnvalues.csv | 518 +++++++++--------- generators/events/translateEvents.cpp | 7 +- generators/objects/translateObjects.cpp | 10 +- linux/fsfwconfig/events/translateEvents.cpp | 7 +- linux/fsfwconfig/objects/translateObjects.cpp | 10 +- tmtc | 2 +- 8 files changed, 289 insertions(+), 268 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 7adf38da..cd0116df 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -208,3 +208,4 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h 13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h 13703;0x3587;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h +13800;0x35e8;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h diff --git a/generators/bsp_q7s_objects.csv b/generators/bsp_q7s_objects.csv index 09a96584..098b0b08 100644 --- a/generators/bsp_q7s_objects.csv +++ b/generators/bsp_q7s_objects.csv @@ -46,6 +46,7 @@ 0x44330015;PLOC_MPSOC_HANDLER 0x44330016;PLOC_SUPERVISOR_HANDLER 0x44330017;PLOC_SUPERVISOR_HELPER +0x44330032;SCEX 0x444100A2;SOLAR_ARRAY_DEPL_HANDLER 0x444100A4;HEATER_HANDLER 0x44420004;TMP1075_HANDLER_1 @@ -69,6 +70,7 @@ 0x445300A3;SYRLINKS_HK_HANDLER 0x49000000;ARDUINO_COM_IF 0x49010005;GPIO_IF +0x49010006;SCEX_UART_READER 0x49020004;SPI_MAIN_COM_IF 0x49020005;SPI_RW_COM_IF 0x49020006;SPI_RTD_COM_IF diff --git a/generators/bsp_q7s_returnvalues.csv b/generators/bsp_q7s_returnvalues.csv index a74cfaa2..147a9ea4 100644 --- a/generators/bsp_q7s_returnvalues.csv +++ b/generators/bsp_q7s_returnvalues.csv @@ -1,25 +1,13 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h 0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h +0x64a0;CCSDS_CommandNotImplemented;Received action message with unknown action id;160;CCSDS_HANDLER;mission/tmtc/CCSDSHandler.h 0x6100;GOMS_PacketTooLong;;0;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h 0x6101;GOMS_InvalidTableId;;1;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h 0x6102;GOMS_InvalidAddress;;2;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h 0x6103;GOMS_InvalidParamSize;;3;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h 0x6104;GOMS_InvalidPayloadSize;;4;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h 0x6105;GOMS_UnknownReplyId;;5;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h -0x53a1;HEATER_CommandNotSupported;;161;HEATER_HANDLER;mission/devices/HeaterHandler.h -0x53a2;HEATER_InitFailed;;162;HEATER_HANDLER;mission/devices/HeaterHandler.h -0x53a3;HEATER_InvalidSwitchNr;;163;HEATER_HANDLER;mission/devices/HeaterHandler.h -0x53a4;HEATER_MainSwitchSetTimeout;;164;HEATER_HANDLER;mission/devices/HeaterHandler.h -0x53a5;HEATER_CommandAlreadyWaiting;;165;HEATER_HANDLER;mission/devices/HeaterHandler.h -0x55a0;IMTQ_InvalidCommandCode;;160;IMTQ_HANDLER;mission/devices/IMTQHandler.h -0x55a1;IMTQ_ParameterMissing;;161;IMTQ_HANDLER;mission/devices/IMTQHandler.h -0x55a2;IMTQ_ParameterInvalid;;162;IMTQ_HANDLER;mission/devices/IMTQHandler.h -0x55a3;IMTQ_CcUnavailable;;163;IMTQ_HANDLER;mission/devices/IMTQHandler.h -0x55a4;IMTQ_InternalProcessingError;;164;IMTQ_HANDLER;mission/devices/IMTQHandler.h -0x55a5;IMTQ_RejectedWithoutReason;;165;IMTQ_HANDLER;mission/devices/IMTQHandler.h -0x55a6;IMTQ_CmdErrUnknown;;166;IMTQ_HANDLER;mission/devices/IMTQHandler.h -0x55a7;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 0x56b0;RWHA_SpiWriteFailure;;176;RW_HANDLER;mission/devices/RwHandler.h 0x56b1;RWHA_SpiReadFailure;Used by the spi send function to tell a failing read call;177;RW_HANDLER;mission/devices/RwHandler.h 0x56b2;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 @@ -32,13 +20,21 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x56a2;RWHA_SetSpeedCommandInvalidLength;Received set speed command has invalid length. Should be 6.;162;RW_HANDLER;mission/devices/RwHandler.h 0x56a3;RWHA_ExecutionFailed;Command execution failed;163;RW_HANDLER;mission/devices/RwHandler.h 0x56a4;RWHA_CrcError;Reaction wheel reply has invalid crc;164;RW_HANDLER;mission/devices/RwHandler.h -0x6aa0;SADPL_CommandNotSupported;;160;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h -0x6aa1;SADPL_DeploymentAlreadyExecuting;;161;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h -0x6aa2;SADPL_MainSwitchTimeoutFailure;;162;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h -0x6aa3;SADPL_SwitchingDeplSa1Failed;;163;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h -0x6aa4;SADPL_SwitchingDeplSa2Failed;;164;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h +0x53a1;HEATER_CommandNotSupported;;161;HEATER_HANDLER;mission/devices/HeaterHandler.h +0x53a2;HEATER_InitFailed;;162;HEATER_HANDLER;mission/devices/HeaterHandler.h +0x53a3;HEATER_InvalidSwitchNr;;163;HEATER_HANDLER;mission/devices/HeaterHandler.h +0x53a4;HEATER_MainSwitchSetTimeout;;164;HEATER_HANDLER;mission/devices/HeaterHandler.h +0x53a5;HEATER_CommandAlreadyWaiting;;165;HEATER_HANDLER;mission/devices/HeaterHandler.h 0x5ca0;SUSS_ErrorUnlockMutex;;160;SUS_HANDLER;mission/devices/SusHandler.h 0x5ca1;SUSS_ErrorLockMutex;;161;SUS_HANDLER;mission/devices/SusHandler.h +0x55a0;IMTQ_InvalidCommandCode;;160;IMTQ_HANDLER;mission/devices/IMTQHandler.h +0x55a1;IMTQ_ParameterMissing;;161;IMTQ_HANDLER;mission/devices/IMTQHandler.h +0x55a2;IMTQ_ParameterInvalid;;162;IMTQ_HANDLER;mission/devices/IMTQHandler.h +0x55a3;IMTQ_CcUnavailable;;163;IMTQ_HANDLER;mission/devices/IMTQHandler.h +0x55a4;IMTQ_InternalProcessingError;;164;IMTQ_HANDLER;mission/devices/IMTQHandler.h +0x55a5;IMTQ_RejectedWithoutReason;;165;IMTQ_HANDLER;mission/devices/IMTQHandler.h +0x55a6;IMTQ_CmdErrUnknown;;166;IMTQ_HANDLER;mission/devices/IMTQHandler.h +0x55a7;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 0x54a0;SYRLINKS_CrcFailure;;160;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x54a1;SYRLINKS_UartFraminOrParityErrorAck;;161;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x54a2;SYRLINKS_BadCharacterAck;;162;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h @@ -48,8 +44,18 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x54a6;SYRLINKS_BadCrcAck;;166;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x54a7;SYRLINKS_ReplyWrongSize;;167;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x54a8;SYRLINKS_MissingStartFrameCharacter;;168;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h +0x6aa0;SADPL_CommandNotSupported;;160;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h +0x6aa1;SADPL_DeploymentAlreadyExecuting;;161;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h +0x6aa2;SADPL_MainSwitchTimeoutFailure;;162;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h +0x6aa3;SADPL_SwitchingDeplSa1Failed;;163;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h +0x6aa4;SADPL_SwitchingDeplSa2Failed;;164;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h 0x67a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NVMParameterBase.h -0x64a0;CCSDS_CommandNotImplemented;Received action message with unknown action id;160;CCSDS_HANDLER;mission/tmtc/CCSDSHandler.h +0x4400;HSPI_HalTimeoutRetval;;0;HAL_SPI;fsfw/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h +0x4401;HSPI_HalBusyRetval;;1;HAL_SPI;fsfw/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h +0x4402;HSPI_HalErrorRetval;;2;HAL_SPI;fsfw/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h +0x4501;HURT_UartReadFailure;;1;HAL_UART;fsfw/hal/src/fsfw_hal/linux/uart/UartComIF.h +0x4502;HURT_UartReadSizeMissmatch;;2;HAL_UART;fsfw/hal/src/fsfw_hal/linux/uart/UartComIF.h +0x4503;HURT_UartRxBufferTooSmall;;3;HAL_UART;fsfw/hal/src/fsfw_hal/linux/uart/UartComIF.h 0x4701;HGIO_UnknownGpioId;;1;HAL_GPIO;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h 0x4702;HGIO_DriveGpioFailure;;2;HAL_GPIO;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h 0x4703;HGIO_GpioTypeFailure;;3;HAL_GPIO;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h @@ -57,48 +63,12 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x4705;HGIO_GpioDuplicateDetected;;5;HAL_GPIO;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h 0x4706;HGIO_GpioInitFailed;;6;HAL_GPIO;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h 0x4707;HGIO_GpioGetValueFailed;;7;HAL_GPIO;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h -0x4400;HSPI_HalTimeoutRetval;;0;HAL_SPI;fsfw/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h -0x4401;HSPI_HalBusyRetval;;1;HAL_SPI;fsfw/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h -0x4402;HSPI_HalErrorRetval;;2;HAL_SPI;fsfw/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h -0x4501;HURT_UartReadFailure;;1;HAL_UART;fsfw/hal/src/fsfw_hal/linux/uart/UartComIF.h -0x4502;HURT_UartReadSizeMissmatch;;2;HAL_UART;fsfw/hal/src/fsfw_hal/linux/uart/UartComIF.h -0x4503;HURT_UartRxBufferTooSmall;;3;HAL_UART;fsfw/hal/src/fsfw_hal/linux/uart/UartComIF.h 0x4300;UXOS_ExecutionFinished;Execution of the current command has finished;0;LINUX_OSAL;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h 0x4301;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/hal/src/fsfw_hal/linux/CommandExecutor.h 0x4302;UXOS_BytesRead;Some bytes have been read from the executing process;2;LINUX_OSAL;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h 0x4303;UXOS_CommandError;Command execution failed;3;LINUX_OSAL;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h 0x4304;UXOS_NoCommandLoadedOrPending;;4;LINUX_OSAL;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h 0x4306;UXOS_PcloseCallError;;6;LINUX_OSAL;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h -0x3101;CF_ObjectHasNoFunctions;;1;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h -0x3102;CF_AlreadyCommanding;;2;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h -0x3201;HF_IsBusy;;1;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x3202;HF_InvalidParameters;;2;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x3203;HF_ExecutionFinished;;3;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x3204;HF_InvalidActionId;;4;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x3501;CFDP_InvalidTlvType;;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3502;CFDP_InvalidDirectiveFields;;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3503;CFDP_InvalidPduDatafieldLen;;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3504;CFDP_InvalidAckDirectiveFields;;4;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3505;CFDP_MetadataCantParseOptions;;5;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3506;CFDP_FinishedCantParseFsResponses;;6;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3508;CFDP_FilestoreRequiresSecondFile;;8;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3509;CFDP_FilestoreResponseCantParseFsMessage;;9;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x1101;AL_Full;;1;ARRAY_LIST;fsfw/src/fsfw/container/ArrayList.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 -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 -0x1601;FMM_MapFull;;1;FIXED_MULTIMAP;fsfw/src/fsfw/container/FixedOrderedMultimap.h -0x1602;FMM_KeyDoesNotExist;;2;FIXED_MULTIMAP;fsfw/src/fsfw/container/FixedOrderedMultimap.h -0x37a1;SGP4_InvalidEccentricity;;161;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x37a2;SGP4_InvalidMeanMotion;;162;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x37a3;SGP4_InvalidPerturbationElements;;163;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x37a4;SGP4_InvalidSemiLatusRectum;;164;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x37a5;SGP4_InvalidEpochElements;;165;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x37a6;SGP4_SatelliteHasDecayed;;166;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x37b1;SGP4_TleTooOld;;177;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x37b2;SGP4_TleNotInitialized;;178;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h 0x2b01;CCS_BcIsSetVrCommand;;1;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h 0x2b02;CCS_BcIsUnlockCommand;;2;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h 0x2bb0;CCS_BcIllegalCommand;;176;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h @@ -128,154 +98,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x2bd1;CCS_ShorterThanHeader;;209;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h 0x2bd2;CCS_TooShortBlockedPacket;;210;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h 0x2bd3;CCS_TooShortMapExtraction;;211;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x0801;DPS_InvalidParameterDefinition;;1;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h -0x0802;DPS_SetWasAlreadyRead;;2;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h -0x0803;DPS_CommitingWithoutReading;;3;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h -0x0804;DPS_DataSetUninitialised;;4;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h -0x0805;DPS_DataSetFull;;5;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h -0x0806;DPS_PoolVarNull;;6;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h -0x3ca0;PVA_InvalidReadWriteMode;;160;POOL_VARIABLE_IF;fsfw/src/fsfw/datapool/PoolVariableIF.h -0x3ca1;PVA_InvalidPoolEntry;;161;POOL_VARIABLE_IF;fsfw/src/fsfw/datapool/PoolVariableIF.h -0x3d00;HKM_QueueOrDestinationInvalid;;0;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3d01;HKM_WrongHkPacketType;;1;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3d02;HKM_ReportingStatusUnchanged;;2;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3d03;HKM_PeriodicHelperInvalid;;3;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3d04;HKM_PoolobjectNotFound;;4;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3d05;HKM_DatasetNotFound;;5;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3b00;LPIF_PoolEntryNotFound;;0;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h -0x3b01;LPIF_PoolEntryTypeConflict;;1;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h -0x1201;AB_NeedSecondStep;;1;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1202;AB_NeedToReconfigure;;2;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1203;AB_ModeFallback;;3;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1204;AB_ChildNotCommandable;;4;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1205;AB_NeedToChangeHealth;;5;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x12a1;AB_NotEnoughChildrenInCorrectState;;161;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x3301;DC_NoReplyReceived;;1;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3302;DC_ProtocolError;;2;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3303;DC_Nullpointer;;3;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3304;DC_InvalidCookieType;;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3305;DC_NotActive;;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3306;DC_TooMuchData;;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x03a0;DHB_InvalidChannel;;160;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03b0;DHB_AperiodicReply;;176;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03b1;DHB_IgnoreReplyData;;177;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03b2;DHB_IgnoreFullPacket;;178;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03c0;DHB_NothingToSend;;192;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03c2;DHB_CommandMapError;;194;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03d0;DHB_NoSwitch;;208;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03e0;DHB_ChildTimeout;;224;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x03e1;DHB_SwitchFailed;;225;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x26a0;DHI_NoCommandData;;160;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a1;DHI_CommandNotSupported;;161;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a2;DHI_CommandAlreadySent;;162;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a3;DHI_CommandWasNotSent;;163;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a4;DHI_CantSwitchAddress;;164;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a5;DHI_WrongModeForCommand;;165;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a6;DHI_Timeout;;166;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a7;DHI_Busy;;167;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a8;DHI_NoReplyExpected;;168;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26a9;DHI_NonOpTemperature;;169;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26aa;DHI_CommandNotImplemented;;170;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26b0;DHI_ChecksumError;;176;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26b1;DHI_LengthMissmatch;;177;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26b2;DHI_InvalidData;;178;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26b3;DHI_ProtocolError;;179;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26c0;DHI_DeviceDidNotExecute;;192;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26c1;DHI_DeviceReportedError;;193;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26c2;DHI_UnknownDeviceReply;;194;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26c3;DHI_DeviceReplyInvalid;;195;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26d0;DHI_InvalidCommandParameter;;208;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x26d1;DHI_InvalidNumberOrLengthOfParameters;;209;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x2401;EV_ListenerNotFound;;1;EVENT_MANAGER_IF;fsfw/src/fsfw/events/EventManagerIF.h -0x2500;FDI_YourFault;;0;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h -0x2501;FDI_MyFault;;1;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h -0x2502;FDI_ConfirmLater;;2;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h -0x2301;MT_TooDetailedRequest;;1;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2302;MT_TooGeneralRequest;;2;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2303;MT_NoMatch;;3;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2304;MT_Full;;4;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2305;MT_NewNodeCreated;;5;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2e01;ASC_TooLongForTargetType;;1;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h -0x2e02;ASC_InvalidCharacters;;2;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h -0x2e03;ASC_BufferTooSmall;;3;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h -0x3e01;DLEE_StreamTooShort;;1;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h -0x3e02;DLEE_DecodingError;;2;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h -0x1701;HHI_ObjectNotHealthy;;1;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h -0x1702;HHI_InvalidHealthState;;2;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h -0x1703;HHI_IsExternallyControlled;;3;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h -0x0f01;CM_UnknownCommand;;1;COMMAND_MESSAGE;fsfw/src/fsfw/ipc/CommandMessageIF.h -0x3901;MQI_Empty;;1;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x3902;MQI_Full;No space left for more messages;2;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x3903;MQI_NoReplyPartner;Returned if a reply method was called without partner;3;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x3904;MQI_DestinationInvalid;Returned if the target destination is invalid.;4;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x3801;MUX_NotEnoughResources;;1;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3802;MUX_InsufficientMemory;;2;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3803;MUX_NoPrivilege;;3;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3804;MUX_WrongAttributeSetting;;4;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3805;MUX_MutexAlreadyLocked;;5;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3806;MUX_MutexNotFound;;6;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3807;MUX_MutexMaxLocks;;7;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3808;MUX_CurrThreadAlreadyOwnsMutex;;8;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3809;MUX_CurrThreadDoesNotOwnMutex;;9;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x380a;MUX_MutexTimeout;;10;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x380b;MUX_MutexInvalidId;;11;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x380c;MUX_MutexDestroyedWhileWaiting;;12;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x4200;FILS_GenericFileError;;0;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4201;FILS_IsBusy;;1;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4202;FILS_InvalidParameters;;2;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4205;FILS_FileDoesNotExist;;5;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4206;FILS_FileAlreadyExists;;6;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4207;FILS_FileLocked;;7;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x420a;FILS_DirectoryDoesNotExist;;10;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x420b;FILS_DirectoryAlreadyExists;;11;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x420c;FILS_DirectoryNotEmpty;;12;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x420f;FILS_SequencePacketMissingWrite;;15;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4210;FILS_SequencePacketMissingRead;;16;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x0601;PP_DoItMyself;;1;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0602;PP_PointsToVariable;;2;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0603;PP_PointsToMemory;;3;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0604;PP_ActivityCompleted;;4;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0605;PP_PointsToVectorUint8;;5;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0606;PP_PointsToVectorUint16;;6;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0607;PP_PointsToVectorUint32;;7;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0608;PP_PointsToVectorFloat;;8;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06a0;PP_DumpNotSupported;;160;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e0;PP_InvalidSize;;224;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e1;PP_InvalidAddress;;225;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e2;PP_InvalidContent;;226;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e3;PP_UnalignedAccess;;227;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e4;PP_WriteProtected;;228;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x13e0;MH_UnknownCmd;;224;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x13e1;MH_InvalidAddress;;225;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x13e2;MH_InvalidSize;;226;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x13e3;MH_StateMismatch;;227;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x0e01;HM_InvalidMode;;1;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h -0x0e02;HM_TransNotAllowed;;2;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h -0x0e03;HM_InTransition;;3;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h -0x0e04;HM_InvalidSubmode;;4;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h -0x3001;LIM_Unchecked;;1;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x3002;LIM_Invalid;;2;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x3003;LIM_Unselected;;3;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x3004;LIM_BelowLowLimit;;4;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x3005;LIM_AboveHighLimit;;5;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x3006;LIM_UnexpectedValue;;6;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x3007;LIM_OutOfRange;;7;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x30a0;LIM_FirstSample;;160;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x30e0;LIM_InvalidSize;;224;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x30e1;LIM_WrongType;;225;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x30e2;LIM_WrongPid;;226;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x30e3;LIM_WrongLimitId;;227;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x30ee;LIM_MonitorNotFound;;238;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x1a01;TRC_NotEnoughSensors;;1;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h -0x1a02;TRC_LowestValueOol;;2;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h -0x1a03;TRC_HighestValueOol;;3;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h -0x1a04;TRC_BothValuesOol;;4;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h -0x1a05;TRC_DuplexOol;;5;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h -0x0201;OM_InsertionFailed;;1;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x0202;OM_NotFound;;2;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x0203;OM_ChildInitFailed;;3;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x0204;OM_InternalErrReporterUninit;;4;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x0200;OM_ConnBroken;;0;OBJECT_MANAGER_IF;fsfw/src/fsfw/osal/common/TcpTmTcServer.h +0x3a00;SPH_ConnBroken;;0;SEMAPHORE_IF;fsfw/src/fsfw/osal/common/TcpTmTcServer.h 0x2901;IEC_NoConfigurationTable;;1;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h 0x2902;IEC_NoCpuTable;;2;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h 0x2903;IEC_InvalidWorkspaceAddress;;3;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h @@ -297,6 +120,10 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x2913;IEC_ImplementationBlockingOperationCancel;;19;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h 0x2914;IEC_MutexObtainFromBadState;;20;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h 0x2915;IEC_UnlimitedAndMaximumIs0;;21;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x0e01;HM_InvalidMode;;1;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h +0x0e02;HM_TransNotAllowed;;2;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h +0x0e03;HM_InTransition;;3;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h +0x0e04;HM_InvalidSubmode;;4;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h 0x2d01;HPA_InvalidIdentifierId;;1;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h 0x2d02;HPA_InvalidDomainId;;2;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h 0x2d03;HPA_InvalidValue;;3;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h @@ -309,16 +136,53 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x2c06;PAW_OutOfBounds;;6;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h 0x2c07;PAW_NotSet;;7;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h 0x2c08;PAW_ColumnOrRowsZero;;8;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2f01;POS_InPowerTransition;;1;POWER_SWITCHER;fsfw/src/fsfw/power/PowerSwitcher.h -0x2f02;POS_SwitchStateMismatch;;2;POWER_SWITCHER;fsfw/src/fsfw/power/PowerSwitcher.h -0x0501;PS_SwitchOn;;1;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h -0x0500;PS_SwitchOff;;0;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h -0x0502;PS_SwitchTimeout;;2;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h -0x0503;PS_FuseOn;;3;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h -0x0504;PS_FuseOff;;4;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h -0x4101;PUS11_InvalidTypeTimeWindow;;1;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h -0x4102;PUS11_TimeshiftingNotPossible;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h -0x4103;PUS11_InvalidRelativeTime;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x3101;CF_ObjectHasNoFunctions;;1;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h +0x3102;CF_AlreadyCommanding;;2;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h +0x3201;HF_IsBusy;;1;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x3202;HF_InvalidParameters;;2;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x3203;HF_ExecutionFinished;;3;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x3204;HF_InvalidActionId;;4;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x0201;OM_InsertionFailed;;1;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x0202;OM_NotFound;;2;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x0203;OM_ChildInitFailed;;3;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x0204;OM_InternalErrReporterUninit;;4;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x2500;FDI_YourFault;;0;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h +0x2501;FDI_MyFault;;1;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h +0x2502;FDI_ConfirmLater;;2;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h +0x2101;TMF_Busy;;1;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2102;TMF_LastPacketFound;;2;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2103;TMF_StopFetch;;3;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2104;TMF_Timeout;;4;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2105;TMF_TmChannelFull;;5;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2106;TMF_NotStored;;6;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2107;TMF_AllDeleted;;7;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2108;TMF_InvalidData;;8;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2109;TMF_NotReady;;9;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2001;TMB_Busy;;1;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2002;TMB_Full;;2;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2003;TMB_Empty;;3;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2004;TMB_NullRequested;;4;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2005;TMB_TooLarge;;5;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2006;TMB_NotReady;;6;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2007;TMB_DumpError;;7;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2008;TMB_CrcError;;8;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2009;TMB_Timeout;;9;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x200a;TMB_IdlePacketFound;;10;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x200b;TMB_TelecommandFound;;11;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x200c;TMB_NoPusATm;;12;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x200d;TMB_TooSmall;;13;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x200e;TMB_BlockNotFound;;14;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x200f;TMB_InvalidRequest;;15;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x1c01;TCD_PacketLost;;1;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h +0x1c02;TCD_DestinationNotFound;;2;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h +0x1c03;TCD_ServiceIdAlreadyExists;;3;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h +0x1b00;TCC_IllegalApid;;0;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h +0x1b01;TCC_IncompletePacket;;1;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h +0x1b02;TCC_IncorrectChecksum;;2;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h +0x1b03;TCC_IllegalPacketType;;3;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h +0x1b04;TCC_IllegalPacketSubtype;;4;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h +0x1b05;TCC_IncorrectPrimaryHeader;;5;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h +0x1b06;TCC_IncorrectSecondaryHeader;;6;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h 0x04e1;RMP_CommandNoDescriptorsAvailable;;225;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x04e2;RMP_CommandBufferFull;;226;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x04e3;RMP_CommandChannelOutOfRange;;227;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h @@ -359,15 +223,61 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x040a;RMP_ReplyCommandNotImplementedOrNotAuthorised;;10;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x040b;RMP_ReplyRmwDataLengthError;;11;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x040c;RMP_ReplyInvalidTargetLogicalAddress;;12;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h -0x1401;SE_BufferTooShort;;1;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h -0x1402;SE_StreamTooShort;;2;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h -0x1403;SE_TooManyElements;;3;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h 0x2701;SM_DataTooLarge;;1;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h 0x2702;SM_DataStorageFull;;2;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h 0x2703;SM_IllegalStorageId;;3;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h 0x2704;SM_DataDoesNotExist;;4;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h 0x2705;SM_IllegalAddress;;5;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h 0x2706;SM_PoolTooLarge;;6;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h +0x37a1;SGP4_InvalidEccentricity;;161;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x37a2;SGP4_InvalidMeanMotion;;162;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x37a3;SGP4_InvalidPerturbationElements;;163;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x37a4;SGP4_InvalidSemiLatusRectum;;164;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x37a5;SGP4_InvalidEpochElements;;165;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x37a6;SGP4_SatelliteHasDecayed;;166;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x37b1;SGP4_TleTooOld;;177;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x37b2;SGP4_TleNotInitialized;;178;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x2301;MT_TooDetailedRequest;;1;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2302;MT_TooGeneralRequest;;2;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2303;MT_NoMatch;;3;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2304;MT_Full;;4;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2305;MT_NewNodeCreated;;5;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x3e01;DLEE_StreamTooShort;;1;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h +0x3e02;DLEE_DecodingError;;2;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h +0x2e01;ASC_TooLongForTargetType;;1;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h +0x2e02;ASC_InvalidCharacters;;2;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h +0x2e03;ASC_BufferTooSmall;;3;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h +0x0f01;CM_UnknownCommand;;1;COMMAND_MESSAGE;fsfw/src/fsfw/ipc/CommandMessageIF.h +0x3901;MQI_Empty;;1;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3902;MQI_Full;No space left for more messages;2;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3903;MQI_NoReplyPartner;Returned if a reply method was called without partner;3;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3904;MQI_DestinationInvalid;Returned if the target destination is invalid.;4;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3801;MUX_NotEnoughResources;;1;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3802;MUX_InsufficientMemory;;2;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3803;MUX_NoPrivilege;;3;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3804;MUX_WrongAttributeSetting;;4;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3805;MUX_MutexAlreadyLocked;;5;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3806;MUX_MutexNotFound;;6;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3807;MUX_MutexMaxLocks;;7;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3808;MUX_CurrThreadAlreadyOwnsMutex;;8;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3809;MUX_CurrThreadDoesNotOwnMutex;;9;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x380a;MUX_MutexTimeout;;10;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x380b;MUX_MutexInvalidId;;11;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x380c;MUX_MutexDestroyedWhileWaiting;;12;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3a01;SPH_SemaphoreTimeout;;1;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h +0x3a02;SPH_SemaphoreNotOwned;;2;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h +0x3a03;SPH_SemaphoreInvalid;;3;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h +0x3501;CFDP_InvalidTlvType;;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3502;CFDP_InvalidDirectiveFields;;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3503;CFDP_InvalidPduDatafieldLen;;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3504;CFDP_InvalidAckDirectiveFields;;4;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3505;CFDP_MetadataCantParseOptions;;5;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3506;CFDP_FinishedCantParseFsResponses;;6;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3508;CFDP_FilestoreRequiresSecondFile;;8;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3509;CFDP_FilestoreResponseCantParseFsMessage;;9;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x2801;TC_InvalidTargetState;;1;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h +0x28f1;TC_AboveOperationalLimit;;241;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h +0x28f2;TC_BelowOperationalLimit;;242;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h 0x0c02;MS_InvalidEntry;;2;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h 0x0c03;MS_TooManyElements;;3;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h 0x0c04;MS_CantStoreEmpty;;4;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h @@ -390,22 +300,22 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x0b03;SB_ChildDoesntHaveModes;;3;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h 0x0b04;SB_CouldNotInsertChild;;4;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h 0x0b05;SB_TableContainsInvalidObjectId;;5;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h -0x3a01;SPH_SemaphoreTimeout;;1;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h -0x3a02;SPH_SemaphoreNotOwned;;2;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h -0x3a03;SPH_SemaphoreInvalid;;3;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h -0x1c01;TCD_PacketLost;;1;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h -0x1c02;TCD_DestinationNotFound;;2;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h -0x1c03;TCD_ServiceIdAlreadyExists;;3;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h -0x1b00;TCC_IllegalApid;;0;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h -0x1b01;TCC_IncompletePacket;;1;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h -0x1b02;TCC_IncorrectChecksum;;2;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h -0x1b03;TCC_IllegalPacketType;;3;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h -0x1b04;TCC_IllegalPacketSubtype;;4;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h -0x1b05;TCC_IncorrectPrimaryHeader;;5;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h -0x1b06;TCC_IncorrectSecondaryHeader;;6;TC_PACKET_CHECK;fsfw/src/fsfw/tcdistribution/TcPacketCheckPUS.h -0x2801;TC_InvalidTargetState;;1;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h -0x28f1;TC_AboveOperationalLimit;;241;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h -0x28f2;TC_BelowOperationalLimit;;242;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h +0x3d00;HKM_QueueOrDestinationInvalid;;0;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3d01;HKM_WrongHkPacketType;;1;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3d02;HKM_ReportingStatusUnchanged;;2;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3d03;HKM_PeriodicHelperInvalid;;3;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3d04;HKM_PoolobjectNotFound;;4;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3d05;HKM_DatasetNotFound;;5;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3b00;LPIF_PoolEntryNotFound;;0;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h +0x3b01;LPIF_PoolEntryTypeConflict;;1;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h +0x3ca0;PVA_InvalidReadWriteMode;;160;POOL_VARIABLE_IF;fsfw/src/fsfw/datapool/PoolVariableIF.h +0x3ca1;PVA_InvalidPoolEntry;;161;POOL_VARIABLE_IF;fsfw/src/fsfw/datapool/PoolVariableIF.h +0x0801;DPS_InvalidParameterDefinition;;1;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h +0x0802;DPS_SetWasAlreadyRead;;2;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h +0x0803;DPS_CommitingWithoutReading;;3;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h +0x0804;DPS_DataSetUninitialised;;4;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h +0x0805;DPS_DataSetFull;;5;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h +0x0806;DPS_PoolVarNull;;6;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h 0x1000;TIM_UnsupportedTimeFormat;;0;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h 0x1001;TIM_NotEnoughInformationForTargetFormat;;1;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h 0x1002;TIM_LengthMismatch;;2;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h @@ -413,35 +323,13 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x1004;TIM_InvalidDayOfYear;;4;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h 0x1005;TIM_TimeDoesNotFitFormat;;5;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h 0x3601;TSI_BadTimestamp;;1;TIME_STAMPER_IF;fsfw/src/fsfw/timemanager/TimeStamperIF.h -0x2001;TMB_Busy;;1;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2002;TMB_Full;;2;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2003;TMB_Empty;;3;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2004;TMB_NullRequested;;4;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2005;TMB_TooLarge;;5;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2006;TMB_NotReady;;6;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2007;TMB_DumpError;;7;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2008;TMB_CrcError;;8;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2009;TMB_Timeout;;9;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x200a;TMB_IdlePacketFound;;10;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x200b;TMB_TelecommandFound;;11;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x200c;TMB_NoPusATm;;12;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x200d;TMB_TooSmall;;13;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x200e;TMB_BlockNotFound;;14;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x200f;TMB_InvalidRequest;;15;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2101;TMF_Busy;;1;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2102;TMF_LastPacketFound;;2;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2103;TMF_StopFetch;;3;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2104;TMF_Timeout;;4;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2105;TMF_TmChannelFull;;5;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2106;TMF_NotStored;;6;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2107;TMF_AllDeleted;;7;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2108;TMF_InvalidData;;8;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2109;TMF_NotReady;;9;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h 0x1d01;PUS_ActivityStarted;;1;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h 0x1d02;PUS_InvalidSubservice;;2;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h 0x1d03;PUS_IllegalApplicationData;;3;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h 0x1d04;PUS_SendTmFailed;;4;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h 0x1d05;PUS_Timeout;;5;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +0x4b00;SPPA_NoPacketFound;;0;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h +0x4b01;SPPA_SplitPacket;;1;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h 0x1f01;CSB_ExecutionComplete;;1;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h 0x1f02;CSB_NoStepMessage;;2;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h 0x1f03;CSB_ObjectBusy;;3;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h @@ -449,11 +337,122 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x1f05;CSB_InvalidTc;;5;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h 0x1f06;CSB_InvalidObject;;6;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h 0x1f07;CSB_InvalidReply;;7;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x4b00;SPPA_NoPacketFound;;0;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h -0x4b01;SPPA_SplitPacket;;1;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h +0x1101;AL_Full;;1;ARRAY_LIST;fsfw/src/fsfw/container/ArrayList.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 +0x1602;FMM_KeyDoesNotExist;;2;FIXED_MULTIMAP;fsfw/src/fsfw/container/FixedOrderedMultimap.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 +0x2401;EV_ListenerNotFound;;1;EVENT_MANAGER_IF;fsfw/src/fsfw/events/EventManagerIF.h +0x1701;HHI_ObjectNotHealthy;;1;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h +0x1702;HHI_InvalidHealthState;;2;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h +0x1703;HHI_IsExternallyControlled;;3;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h +0x2f01;POS_InPowerTransition;;1;POWER_SWITCHER;fsfw/src/fsfw/power/PowerSwitcher.h +0x2f02;POS_SwitchStateMismatch;;2;POWER_SWITCHER;fsfw/src/fsfw/power/PowerSwitcher.h +0x0501;PS_SwitchOn;;1;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h +0x0500;PS_SwitchOff;;0;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h +0x0502;PS_SwitchTimeout;;2;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h +0x0503;PS_FuseOn;;3;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h +0x0504;PS_FuseOff;;4;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h +0x1a01;TRC_NotEnoughSensors;;1;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h +0x1a02;TRC_LowestValueOol;;2;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h +0x1a03;TRC_HighestValueOol;;3;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h +0x1a04;TRC_BothValuesOol;;4;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h +0x1a05;TRC_DuplexOol;;5;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h +0x3001;LIM_Unchecked;;1;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x3002;LIM_Invalid;;2;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x3003;LIM_Unselected;;3;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x3004;LIM_BelowLowLimit;;4;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x3005;LIM_AboveHighLimit;;5;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x3006;LIM_UnexpectedValue;;6;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x3007;LIM_OutOfRange;;7;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x30a0;LIM_FirstSample;;160;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x30e0;LIM_InvalidSize;;224;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x30e1;LIM_WrongType;;225;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x30e2;LIM_WrongPid;;226;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x30e3;LIM_WrongLimitId;;227;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x30ee;LIM_MonitorNotFound;;238;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h +0x4101;PUS11_InvalidTypeTimeWindow;;1;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4102;PUS11_TimeshiftingNotPossible;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4103;PUS11_InvalidRelativeTime;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4200;FILS_GenericFileError;;0;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x4201;FILS_IsBusy;;1;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x4202;FILS_InvalidParameters;;2;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x4205;FILS_FileDoesNotExist;;5;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x4206;FILS_FileAlreadyExists;;6;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x4207;FILS_FileLocked;;7;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x420a;FILS_DirectoryDoesNotExist;;10;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x420b;FILS_DirectoryAlreadyExists;;11;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x420c;FILS_DirectoryNotEmpty;;12;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x420f;FILS_SequencePacketMissingWrite;;15;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x4210;FILS_SequencePacketMissingRead;;16;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h +0x0601;PP_DoItMyself;;1;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0602;PP_PointsToVariable;;2;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0603;PP_PointsToMemory;;3;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0604;PP_ActivityCompleted;;4;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0605;PP_PointsToVectorUint8;;5;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0606;PP_PointsToVectorUint16;;6;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0607;PP_PointsToVectorUint32;;7;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0608;PP_PointsToVectorFloat;;8;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06a0;PP_DumpNotSupported;;160;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e0;PP_InvalidSize;;224;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e1;PP_InvalidAddress;;225;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e2;PP_InvalidContent;;226;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e3;PP_UnalignedAccess;;227;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e4;PP_WriteProtected;;228;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x13e0;MH_UnknownCmd;;224;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x13e1;MH_InvalidAddress;;225;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x13e2;MH_InvalidSize;;226;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x13e3;MH_StateMismatch;;227;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x1201;AB_NeedSecondStep;;1;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1202;AB_NeedToReconfigure;;2;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1203;AB_ModeFallback;;3;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1204;AB_ChildNotCommandable;;4;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1205;AB_NeedToChangeHealth;;5;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x12a1;AB_NotEnoughChildrenInCorrectState;;161;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x03a0;DHB_InvalidChannel;;160;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03b0;DHB_AperiodicReply;;176;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03b1;DHB_IgnoreReplyData;;177;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03b2;DHB_IgnoreFullPacket;;178;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03c0;DHB_NothingToSend;;192;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03c2;DHB_CommandMapError;;194;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03d0;DHB_NoSwitch;;208;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03e0;DHB_ChildTimeout;;224;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x03e1;DHB_SwitchFailed;;225;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h +0x3301;DC_NoReplyReceived;;1;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3302;DC_ProtocolError;;2;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3303;DC_Nullpointer;;3;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3304;DC_InvalidCookieType;;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3305;DC_NotActive;;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3306;DC_TooMuchData;;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x26a0;DHI_NoCommandData;;160;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a1;DHI_CommandNotSupported;;161;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a2;DHI_CommandAlreadySent;;162;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a3;DHI_CommandWasNotSent;;163;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a4;DHI_CantSwitchAddress;;164;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a5;DHI_WrongModeForCommand;;165;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a6;DHI_Timeout;;166;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a7;DHI_Busy;;167;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a8;DHI_NoReplyExpected;;168;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26a9;DHI_NonOpTemperature;;169;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26aa;DHI_CommandNotImplemented;;170;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26b0;DHI_ChecksumError;;176;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26b1;DHI_LengthMissmatch;;177;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26b2;DHI_InvalidData;;178;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26b3;DHI_ProtocolError;;179;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26c0;DHI_DeviceDidNotExecute;;192;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26c1;DHI_DeviceReportedError;;193;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26c2;DHI_UnknownDeviceReply;;194;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26c3;DHI_DeviceReplyInvalid;;195;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26d0;DHI_InvalidCommandParameter;;208;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x26d1;DHI_InvalidNumberOrLengthOfParameters;;209;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +0x1401;SE_BufferTooShort;;1;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h +0x1402;SE_StreamTooShort;;2;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h +0x1403;SE_TooManyElements;;3;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h 0x68a0;FSHLP_SdNotMounted;SD card specified with path string not mounted;160;FILE_SYSTEM_HELPER;bsp_q7s/memory/FilesystemHelper.h 0x68a1;FSHLP_FileNotExists;Specified file does not exist on filesystem;161;FILE_SYSTEM_HELPER;bsp_q7s/memory/FilesystemHelper.h -0x7400;SCBU_KeyNotFound;;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h 0x7300;SDMA_OpOngoing;;0;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h 0x7301;SDMA_AlreadyOn;;1;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h 0x7302;SDMA_AlreadyMounted;;2;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h @@ -464,3 +463,4 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x730d;SDMA_UnmountError;;13;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h 0x730e;SDMA_SystemCallError;;14;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h 0x730f;SDMA_PopenCallError;;15;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h +0x7400;SCBU_KeyNotFound;;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 7f9cfc78..bf0954cd 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 209 translations. + * @brief Auto-generated event translation file. Contains 210 translations. * @details - * Generated on: 2022-06-27 09:14:37 + * Generated on: 2022-07-08 16:45:10 */ #include "translateEvents.h" @@ -210,6 +210,7 @@ const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED"; const char *REBOOT_HW_STRING = "REBOOT_HW"; +const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; const char *translateEvents(Event event) { switch ((event & 0xFFFF)) { @@ -623,6 +624,8 @@ const char *translateEvents(Event event) { return REBOOT_MECHANISM_TRIGGERED_STRING; case (13703): return REBOOT_HW_STRING; + case (13800): + return EXPERIMENT_TIMEDOUT_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 2b6dc330..0868cdb0 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 132 translations. - * Generated on: 2022-06-27 09:14:34 + * Contains 134 translations. + * Generated on: 2022-07-08 16:45:09 */ #include "translateObjects.h" @@ -54,6 +54,7 @@ const char *PTME_CONFIG_STRING = "PTME_CONFIG"; const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER"; const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER"; const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER"; +const char *SCEX_STRING = "SCEX"; const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER"; const char *HEATER_HANDLER_STRING = "HEATER_HANDLER"; const char *TMP1075_HANDLER_1_STRING = "TMP1075_HANDLER_1"; @@ -77,6 +78,7 @@ const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ"; const char *SYRLINKS_HK_HANDLER_STRING = "SYRLINKS_HK_HANDLER"; const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF"; const char *GPIO_IF_STRING = "GPIO_IF"; +const char *SCEX_UART_READER_STRING = "SCEX_UART_READER"; const char *SPI_MAIN_COM_IF_STRING = "SPI_MAIN_COM_IF"; const char *SPI_RW_COM_IF_STRING = "SPI_RW_COM_IF"; const char *SPI_RTD_COM_IF_STRING = "SPI_RTD_COM_IF"; @@ -237,6 +239,8 @@ const char *translateObject(object_id_t object) { return PLOC_SUPERVISOR_HANDLER_STRING; case 0x44330017: return PLOC_SUPERVISOR_HELPER_STRING; + case 0x44330032: + return SCEX_STRING; case 0x444100A2: return SOLAR_ARRAY_DEPL_HANDLER_STRING; case 0x444100A4: @@ -283,6 +287,8 @@ const char *translateObject(object_id_t object) { return ARDUINO_COM_IF_STRING; case 0x49010005: return GPIO_IF_STRING; + case 0x49010006: + return SCEX_UART_READER_STRING; case 0x49020004: return SPI_MAIN_COM_IF_STRING; case 0x49020005: diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 7f9cfc78..bf0954cd 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 209 translations. + * @brief Auto-generated event translation file. Contains 210 translations. * @details - * Generated on: 2022-06-27 09:14:37 + * Generated on: 2022-07-08 16:45:10 */ #include "translateEvents.h" @@ -210,6 +210,7 @@ const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED"; const char *REBOOT_HW_STRING = "REBOOT_HW"; +const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; const char *translateEvents(Event event) { switch ((event & 0xFFFF)) { @@ -623,6 +624,8 @@ const char *translateEvents(Event event) { return REBOOT_MECHANISM_TRIGGERED_STRING; case (13703): return REBOOT_HW_STRING; + case (13800): + return EXPERIMENT_TIMEDOUT_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 2b6dc330..0868cdb0 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 132 translations. - * Generated on: 2022-06-27 09:14:34 + * Contains 134 translations. + * Generated on: 2022-07-08 16:45:09 */ #include "translateObjects.h" @@ -54,6 +54,7 @@ const char *PTME_CONFIG_STRING = "PTME_CONFIG"; const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER"; const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER"; const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER"; +const char *SCEX_STRING = "SCEX"; const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER"; const char *HEATER_HANDLER_STRING = "HEATER_HANDLER"; const char *TMP1075_HANDLER_1_STRING = "TMP1075_HANDLER_1"; @@ -77,6 +78,7 @@ const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ"; const char *SYRLINKS_HK_HANDLER_STRING = "SYRLINKS_HK_HANDLER"; const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF"; const char *GPIO_IF_STRING = "GPIO_IF"; +const char *SCEX_UART_READER_STRING = "SCEX_UART_READER"; const char *SPI_MAIN_COM_IF_STRING = "SPI_MAIN_COM_IF"; const char *SPI_RW_COM_IF_STRING = "SPI_RW_COM_IF"; const char *SPI_RTD_COM_IF_STRING = "SPI_RTD_COM_IF"; @@ -237,6 +239,8 @@ const char *translateObject(object_id_t object) { return PLOC_SUPERVISOR_HANDLER_STRING; case 0x44330017: return PLOC_SUPERVISOR_HELPER_STRING; + case 0x44330032: + return SCEX_STRING; case 0x444100A2: return SOLAR_ARRAY_DEPL_HANDLER_STRING; case 0x444100A4: @@ -283,6 +287,8 @@ const char *translateObject(object_id_t object) { return ARDUINO_COM_IF_STRING; case 0x49010005: return GPIO_IF_STRING; + case 0x49010006: + return SCEX_UART_READER_STRING; case 0x49020004: return SPI_MAIN_COM_IF_STRING; case 0x49020005: diff --git a/tmtc b/tmtc index 370d6c2f..1a73fa1f 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 370d6c2fa4e9c84d96d23cbae6711cdf68cdd465 +Subproject commit 1a73fa1ff126466c9444664f1825e7c34a27453f From fc639a3e3fc7becc1714c8552b82020ab5682172 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Jul 2022 16:57:40 +0200 Subject: [PATCH 064/361] move countdown reset --- mission/devices/ScexDeviceHandler.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 7417ca0d..85fbdc3a 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -52,36 +52,57 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic switch (deviceCommand) { case (PING): { + finishCountdown.setTimeout(SHORT_CD); + // countdown starten + finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, tempCheck); break; } case (EXP_STATUS_CMD): { + finishCountdown.setTimeout(SHORT_CD); + // countdown starten + finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, tempCheck); break; } case (ION_CMD): { + finishCountdown.setTimeout(SHORT_CD); + // countdown starten + finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, tempCheck); break; } case (TEMP_CMD): { + finishCountdown.setTimeout(SHORT_CD); + // countdown starten + finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0}, tempCheck); break; } case (FRAM): { + finishCountdown.setTimeout(SHORT_CD); + // countdown starten + finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); break; } case (ONE_CELL): { + finishCountdown.setTimeout(LONG_CD); + // countdown starts + finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); break; } case (ALL_CELLS_CMD): { + finishCountdown.setTimeout(LONG_CD); + // countdown starts + finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); break; @@ -130,9 +151,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons ReturnValue_t status = RETURN_OK; auto oneFileHandler = [&](std::string cmdName) { fileId = random_string(6); - finishCountdown.setTimeout(SHORT_CD); - // countdown starten - finishCountdown.resetTimer(); std::ostringstream oss("/tmp/scex-"); oss << cmdName << fileId << ".bin"; fileName = oss.str(); @@ -149,9 +167,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons }; auto multiFileHandler = [&](std::string cmdName) { if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { - finishCountdown.setTimeout(LONG_CD); - // countdown starts - finishCountdown.resetTimer(); fileId = random_string(6); std::ostringstream oss("/tmp/scex-"); From 303f5380761ee8a04721d4692c70757ec9369acd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Jul 2022 17:11:21 +0200 Subject: [PATCH 065/361] countdown based reply handling --- mission/devices/ScexDeviceHandler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 85fbdc3a..4c84b40d 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -122,9 +122,12 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(scex::Cmds::TEMP_CMD, 3); insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3); - insertInCommandMap(scex::Cmds::ALL_CELLS_CMD); - insertInCommandMap(scex::Cmds::ONE_CELL); - insertInCommandMap(scex::Cmds::FRAM); + insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, false, false, + DeviceHandlerIF::UNKNOWN_DEVICE_REPLY, &finishCountdown); + insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, false, false, + DeviceHandlerIF::UNKNOWN_DEVICE_REPLY, &finishCountdown); + insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, false, false, + DeviceHandlerIF::UNKNOWN_DEVICE_REPLY, &finishCountdown); insertInReplyMap(scex::Cmds::ERROR_REPLY, 3); } From 84c4f47ed1cb36df13906b698610bce3602530c4 Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Wed, 13 Jul 2022 09:26:22 +0200 Subject: [PATCH 066/361] Removed obsolete stuff --- bsp_hosted/InitMission.cpp | 8 -------- bsp_hosted/ObjectFactory.cpp | 3 +-- bsp_hosted/fsfwconfig/objects/systemObjectList.h | 1 - common/config/commonSubsystemIds.h | 1 - linux/fsfwconfig/objects/systemObjectList.h | 1 - 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index 0d40cbd7..3a89098b 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -139,13 +139,6 @@ void initmission::initTasks() { } #endif /* OBSW_ADD_TEST_CODE == 1 */ - PeriodicTaskIF* configTask = factory->createPeriodicTask( - "CONFIG_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); - - result = configTask->addComponent(objects::CONFIG_TEST); - if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("CONFIG_TASK", objects::CONFIG_TEST); - } sif::info << "Starting tasks.." << std::endl; @@ -158,7 +151,6 @@ void initmission::initTasks() { pusHighPrio->startTask(); pusMedPrio->startTask(); pusLowPrio->startTask(); - configTask->startTask(); #if OBSW_ADD_TEST_CODE == 1 testTask->startTask(); diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index ec668cd6..12b30c04 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -47,5 +47,4 @@ void ObjectFactory::produce(void* args) { ObjectFactory::produceGenericObjects(); new TestTask(objects::TEST_TASK); - new GlobalConfigHandler(objects::CONFIG_TEST,"/path/to/JSON.config"); -} + } diff --git a/bsp_hosted/fsfwconfig/objects/systemObjectList.h b/bsp_hosted/fsfwconfig/objects/systemObjectList.h index 8eddfc4f..91bd2bed 100644 --- a/bsp_hosted/fsfwconfig/objects/systemObjectList.h +++ b/bsp_hosted/fsfwconfig/objects/systemObjectList.h @@ -21,7 +21,6 @@ enum sourceObjects : uint32_t { /* Test Task */ TEST_TASK = 0x42694269, - CONFIG_TEST = 0x42694270, DUMMY_INTERFACE = 0xCAFECAFE, DUMMY_HANDLER = 0x4400AFFE, diff --git a/common/config/commonSubsystemIds.h b/common/config/commonSubsystemIds.h index a56db7db..222325ac 100644 --- a/common/config/commonSubsystemIds.h +++ b/common/config/commonSubsystemIds.h @@ -33,7 +33,6 @@ enum : uint8_t { ACU_HANDLER = 135, PLOC_SUPV_HELPER = 136, SYRLINKS = 137, - CONFIGHANDLER=138, COMMON_SUBSYSTEM_ID_END }; diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index 2463837d..28c87d3c 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -54,7 +54,6 @@ enum sourceObjects : uint32_t { /* 0x54 ('T') for test handlers */ TEST_TASK = 0x54694269, - CONFIG_TEST = 0x54694270, LIBGPIOD_TEST = 0x54123456, SPI_TEST = 0x54000010, UART_TEST = 0x54000020, From 3bad503694c6dbf29f5493e9310af756179adefb Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Wed, 13 Jul 2022 09:34:27 +0200 Subject: [PATCH 067/361] Fixed submodules file --- .gitmodules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 13fed4d1..ac6824b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,8 +11,11 @@ path = thirdparty/lwgps url = https://github.com/rmspacefish/lwgps.git [submodule "generators/fsfwgen"] - path = generators/fsfwgen + path = generators/deps/fsfwgen url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git +[submodule "thirdparty/arcsec_star_tracker"] + path = thirdparty/arcsec_star_tracker + url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git [submodule "thirdparty/json"] path = thirdparty/json url = https://github.com/nlohmann/json.git From b4bb46726cf35511249638cb2e04c2131bf14ac9 Mon Sep 17 00:00:00 2001 From: petriVM18 Date: Wed, 13 Jul 2022 09:38:42 +0200 Subject: [PATCH 068/361] Changed filesystem include to new version --- mission/devices/devicedefinitions/payloadPcduDefinitions.h | 2 +- mission/memory/NVMParameterBase.cpp | 4 ++-- mission/memory/NVMParameterBase.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mission/devices/devicedefinitions/payloadPcduDefinitions.h b/mission/devices/devicedefinitions/payloadPcduDefinitions.h index c4dc2aa1..ab387fc7 100644 --- a/mission/devices/devicedefinitions/payloadPcduDefinitions.h +++ b/mission/devices/devicedefinitions/payloadPcduDefinitions.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "OBSWConfig.h" diff --git a/mission/memory/NVMParameterBase.cpp b/mission/memory/NVMParameterBase.cpp index 865c561b..78f40525 100644 --- a/mission/memory/NVMParameterBase.cpp +++ b/mission/memory/NVMParameterBase.cpp @@ -8,7 +8,7 @@ NVMParameterBase::NVMParameterBase(std::string fullName) : fullName(fullName) {} ReturnValue_t NVMParameterBase::readJsonFile() { - if (std::experimental::filesystem::exists(fullName)) { + if (std::filesystem::exists(fullName)) { // Read JSON file content into object std::ifstream i(fullName); try { @@ -37,7 +37,7 @@ void NVMParameterBase::setFullName(std::string fullName) { this->fullName = full std::string NVMParameterBase::getFullName() const { return fullName; } -bool NVMParameterBase::getJsonFileExists() { return std::experimental::filesystem::exists(fullName); } +bool NVMParameterBase::getJsonFileExists() { return std::filesystem::exists(fullName); } void NVMParameterBase::printKeys() const { sif::info << "Printing keys for JSON file " << fullName << std::endl; diff --git a/mission/memory/NVMParameterBase.h b/mission/memory/NVMParameterBase.h index 16d9824c..eb839905 100644 --- a/mission/memory/NVMParameterBase.h +++ b/mission/memory/NVMParameterBase.h @@ -1,7 +1,7 @@ #ifndef BSP_Q7S_CORE_NVMPARAMS_NVMPARAMIF_H_ #define BSP_Q7S_CORE_NVMPARAMS_NVMPARAMIF_H_ -#include +#include #include #include From d1bfc512ec9adde8b30cc29a99d2e0a49ae778b0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Jul 2022 10:32:41 +0200 Subject: [PATCH 069/361] update .cproject file --- misc/eclipse/.cproject | 24 ++++++++++++------------ tmtc | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index d30ef1ec..19c18545 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -57,7 +57,7 @@ - + @@ -119,7 +119,7 @@ - + @@ -187,7 +187,7 @@ - + @@ -255,7 +255,7 @@ - + @@ -418,7 +418,7 @@ - + @@ -580,7 +580,7 @@ - + @@ -750,7 +750,7 @@ - + @@ -917,7 +917,7 @@ - + @@ -1084,7 +1084,7 @@ - + @@ -1149,7 +1149,7 @@ - + @@ -1317,7 +1317,7 @@ - + @@ -1386,7 +1386,7 @@ - + diff --git a/tmtc b/tmtc index 1a73fa1f..70435736 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 1a73fa1ff126466c9444664f1825e7c34a27453f +Subproject commit 704357369e6374dc7cf8c88d71fd24bce3b772e0 From 8b39f65472280ed5f9da6df62cd527519f41c5d7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Jul 2022 11:25:53 +0200 Subject: [PATCH 070/361] modify oss to append at end --- bsp_q7s/memory/scratchApi.cpp | 8 ++++---- bsp_q7s/memory/scratchApi.h | 4 ++-- mission/devices/ScexDeviceHandler.cpp | 5 +++-- tmtc | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/memory/scratchApi.cpp b/bsp_q7s/memory/scratchApi.cpp index 83bc8239..1948ece3 100644 --- a/bsp_q7s/memory/scratchApi.cpp +++ b/bsp_q7s/memory/scratchApi.cpp @@ -1,8 +1,8 @@ #include "scratchApi.h" ReturnValue_t scratch::writeString(std::string name, std::string string) { - std::ostringstream oss; - oss << "xsc_scratch write " << name << " \"" << string << "\""; + std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate); + oss << name << " \"" << string << "\""; int result = std::system(oss.str().c_str()); if (result != 0) { utility::handleSystemError(result, "scratch::writeString"); @@ -39,8 +39,8 @@ ReturnValue_t scratch::readString(std::string key, std::string &string) { } ReturnValue_t scratch::clearValue(std::string key) { - std::ostringstream oss; - oss << "xsc_scratch clear " << key; + std::ostringstream oss("xsc_scratch clear ", std::ostringstream::ate); + oss << key; int result = std::system(oss.str().c_str()); if (result != 0) { utility::handleSystemError(result, "scratch::clearValue"); diff --git a/bsp_q7s/memory/scratchApi.h b/bsp_q7s/memory/scratchApi.h index cd76fca1..b78fef7f 100644 --- a/bsp_q7s/memory/scratchApi.h +++ b/bsp_q7s/memory/scratchApi.h @@ -94,8 +94,8 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil template ::value>::type> inline ReturnValue_t writeNumber(std::string key, T num) noexcept { - std::ostringstream oss; - oss << "xsc_scratch write " << key << " " << std::to_string(num); + std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate); + oss << key << " " << std::to_string(num); int result = std::system(oss.str().c_str()); if (result != 0) { utility::handleSystemError(result, "scratch::writeNumber"); diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 4c84b40d..5cc11d7c 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -154,9 +154,10 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons ReturnValue_t status = RETURN_OK; auto oneFileHandler = [&](std::string cmdName) { fileId = random_string(6); - std::ostringstream oss("/tmp/scex-"); + std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); oss << cmdName << fileId << ".bin"; fileName = oss.str(); + std::cout << fileName << std::endl; ofstream out(fileName, ofstream::binary); if (out.bad()) { sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName @@ -172,7 +173,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { fileId = random_string(6); - std::ostringstream oss("/tmp/scex-"); + std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); oss << cmdName << fileId << ".bin"; fileName = oss.str(); fileNameSet = true; diff --git a/tmtc b/tmtc index 70435736..0a655f51 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 704357369e6374dc7cf8c88d71fd24bce3b772e0 +Subproject commit 0a655f51d4803d5561911101823e611d1f4a19ad From 8a236154627a730af48090cf2932230abd01bc18 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Jul 2022 12:02:32 +0200 Subject: [PATCH 071/361] added printout in scex uart reader --- linux/boardtest/UartTestClass.cpp | 3 ++- linux/devices/ScexUartReader.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 86404c44..d771fe37 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -29,6 +29,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) : TestTask(objectId), reader(reader) { mode = TestModes::SCEX; scexMode = ScexModes::READER_TASK; + // No one-cell and all-cell support implemented yet currCmd = scex::Cmds::FRAM; if (scexMode == ScexModes::SIMPLE) { auto encodingBuf = new std::array; @@ -213,7 +214,7 @@ void UartTestClass::scexPeriodic() { out << helper; } // fram - // packetcounter eins höher, wenn mehr packet verloren -> merkt sich welches packet fehlt + // packetcounter eins h�her, wenn mehr packet verloren -> merkt sich welches packet fehlt // was wenn erstes packet fehlt; mit boolean var (firstpacketarrived=false) die immer mit // finish false wird? // countdown (max 2min), wenn nicht if (helper.getPacketCounter() == diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index b4e48612..31fc4bf1 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -133,6 +133,7 @@ ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendD sif::warning << "ScexUartReader::sendMessage: Encoding failed" << std::endl; return RETURN_FAILED; } + arrayprinter::print(cmdbuf.data(), encodedLen); size_t bytesWritten = write(serialPort, cmdbuf.data(), encodedLen); if (bytesWritten != encodedLen) { sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed" From 201ef9cb0c9ced2b60bad8ea41dbc56f7d0a7ab0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Jul 2022 15:51:21 +0200 Subject: [PATCH 072/361] smaller bugfixes --- mission/devices/ScexDeviceHandler.cpp | 8 ++++---- tmtc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 5cc11d7c..edd9e6e9 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -84,7 +84,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic break; } case (FRAM): { - finishCountdown.setTimeout(SHORT_CD); + finishCountdown.setTimeout(LONG_CD); // countdown starten finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, @@ -123,11 +123,11 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3); insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, false, false, - DeviceHandlerIF::UNKNOWN_DEVICE_REPLY, &finishCountdown); + scex::Cmds::ALL_CELLS_CMD, &finishCountdown); insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, false, false, - DeviceHandlerIF::UNKNOWN_DEVICE_REPLY, &finishCountdown); + scex::Cmds::ONE_CELL, &finishCountdown); insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, false, false, - DeviceHandlerIF::UNKNOWN_DEVICE_REPLY, &finishCountdown); + scex::Cmds::FRAM, &finishCountdown); insertInReplyMap(scex::Cmds::ERROR_REPLY, 3); } diff --git a/tmtc b/tmtc index 0a655f51..937eb482 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 0a655f51d4803d5561911101823e611d1f4a19ad +Subproject commit 937eb4829883b17e3a7a842528675c3609e24768 From 3ca11b589437300a6b8f649ec33a517c3a9d3558 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jul 2022 17:35:49 +0200 Subject: [PATCH 073/361] run auto-formatter --- bsp_hosted/CMakeLists.txt | 1 - bsp_hosted/InitMission.cpp | 2 - bsp_hosted/ObjectFactory.cpp | 5 +- bsp_hosted/main.cpp | 4 +- mission/controller/CMakeLists.txt | 2 +- mission/tmtc/CMakeLists.txt | 7 +- mission/utility/CMakeLists.txt | 5 +- mission/utility/GlobalConfigFileDefinitions.h | 3 - mission/utility/GlobalConfigHandler.cpp | 347 +++++++++--------- mission/utility/GlobalConfigHandler.h | 83 +++-- unittest/controller/testConfigFileHandler.cpp | 78 ++-- 11 files changed, 268 insertions(+), 269 deletions(-) diff --git a/bsp_hosted/CMakeLists.txt b/bsp_hosted/CMakeLists.txt index 79383a2e..2804977d 100644 --- a/bsp_hosted/CMakeLists.txt +++ b/bsp_hosted/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp) - add_subdirectory(fsfwconfig) add_subdirectory(boardconfig) diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index 0200e575..6ec0ed35 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -173,8 +173,6 @@ void initmission::initTasks() { } #endif /* OBSW_ADD_TEST_CODE == 1 */ - - sif::info << "Starting tasks.." << std::endl; tmTcDistributor->startTask(); tmtcBridgeTask->startTask(); diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 693ec63c..2c3b20d2 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -26,7 +26,6 @@ #include #endif -#include "mission/utility/GlobalConfigHandler.h" #include #include #include @@ -45,6 +44,8 @@ #include #include +#include "mission/utility/GlobalConfigHandler.h" + void Factory::setStaticFrameworkObjectIds() { PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetDestination = objects::TM_FUNNEL; @@ -90,6 +91,4 @@ void ObjectFactory::produce(void* args) { new SusDummy(); new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT); new TestTask(objects::TEST_TASK); - } - diff --git a/bsp_hosted/main.cpp b/bsp_hosted/main.cpp index 50dc582f..e493c1c9 100644 --- a/bsp_hosted/main.cpp +++ b/bsp_hosted/main.cpp @@ -31,7 +31,9 @@ int main(void) { << "v" << common::OBSW_VERSION << " | FSFW v" << fsfw::FSFW_VERSION << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; - std::cout << "-- " <<" BSP HOSTED"<< " --" << std::endl; + std::cout << "-- " + << " BSP HOSTED" + << " --" << std::endl; initmission::initMission(); diff --git a/mission/controller/CMakeLists.txt b/mission/controller/CMakeLists.txt index 816a560a..8ecdb1a0 100644 --- a/mission/controller/CMakeLists.txt +++ b/mission/controller/CMakeLists.txt @@ -1,3 +1,3 @@ if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "") - target_sources(${LIB_EIVE_MISSION} PRIVATE ThermalController.cpp) + target_sources(${LIB_EIVE_MISSION} PRIVATE ThermalController.cpp) endif() diff --git a/mission/tmtc/CMakeLists.txt b/mission/tmtc/CMakeLists.txt index a952629a..0a931d0f 100644 --- a/mission/tmtc/CMakeLists.txt +++ b/mission/tmtc/CMakeLists.txt @@ -1,5 +1,2 @@ -target_sources(${LIB_EIVE_MISSION} PRIVATE - CCSDSHandler.cpp - VirtualChannel.cpp - TmFunnel.cpp -) +target_sources(${LIB_EIVE_MISSION} PRIVATE CCSDSHandler.cpp VirtualChannel.cpp + TmFunnel.cpp) diff --git a/mission/utility/CMakeLists.txt b/mission/utility/CMakeLists.txt index 6e862138..09baae92 100644 --- a/mission/utility/CMakeLists.txt +++ b/mission/utility/CMakeLists.txt @@ -1,2 +1,3 @@ -target_sources(${LIB_EIVE_MISSION} PRIVATE TmFunnel.cpp Timestamp.cpp - ProgressPrinter.cpp Filenaming.cpp GlobalConfigHandler.cpp) +target_sources( + ${LIB_EIVE_MISSION} PRIVATE TmFunnel.cpp Timestamp.cpp ProgressPrinter.cpp + Filenaming.cpp GlobalConfigHandler.cpp) diff --git a/mission/utility/GlobalConfigFileDefinitions.h b/mission/utility/GlobalConfigFileDefinitions.h index b4f5f394..2e7d133a 100644 --- a/mission/utility/GlobalConfigFileDefinitions.h +++ b/mission/utility/GlobalConfigFileDefinitions.h @@ -8,7 +8,6 @@ #ifndef MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ #define MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ - static constexpr double PARAM0_DEFAULT = 5.0; static constexpr int PARAM1_DEFAULT = 905; @@ -18,6 +17,4 @@ enum ParamIds : uint8_t { PARAM2 = 2, }; - - #endif /* MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ */ diff --git a/mission/utility/GlobalConfigHandler.cpp b/mission/utility/GlobalConfigHandler.cpp index df0b4566..36d1bafa 100644 --- a/mission/utility/GlobalConfigHandler.cpp +++ b/mission/utility/GlobalConfigHandler.cpp @@ -6,256 +6,263 @@ */ #include "GlobalConfigHandler.h" -#include -#include "fsfw/serviceinterface/ServiceInterface.h" + #include +#include #include +#include "fsfw/serviceinterface/ServiceInterface.h" MutexIF* GlobalConfigHandler::configLock = nullptr; -GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string configFilePath): - SystemObject(objectId), - NVMParameterBase(configFilePath), - commandQueue(QueueFactory::instance()->createMessageQueue(20)) - { - if (configLock == nullptr) { - configLock = MutexFactory::instance()->createMutex(); - } - +GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string configFilePath) + : SystemObject(objectId), + NVMParameterBase(configFilePath), + commandQueue(QueueFactory::instance()->createMessageQueue(20)) { + if (configLock == nullptr) { + configLock = MutexFactory::instance()->createMutex(); + } } -ReturnValue_t GlobalConfigHandler::initialize(){ - - ReturnValue_t result = SystemObject::initialize(); - if (result != RETURN_OK) { +ReturnValue_t GlobalConfigHandler::initialize() { + ReturnValue_t result = SystemObject::initialize(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::initialize: SystemObject::initialize() failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::initialize: SystemObject::initialize() failed with " + << result << std::endl; #endif - return result; - } + return result; + } - - result = ReadConfigFile(); - if(result!=RETURN_OK){ + result = ReadConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::initialize: Creating JSON file at " << getFullName() << std::endl; + sif::info << "GlobalConfigHandler::initialize: Creating JSON file at " << getFullName() + << std::endl; #endif - result=ResetConfigFile(); - if (result != RETURN_OK) { - return result; - } - } - + result = ResetConfigFile(); + if (result != RETURN_OK) { + return result; + } + } #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::initialize success " << std::endl; + sif::info << "GlobalConfigHandler::initialize success " << std::endl; #endif - return result; -} -GlobalConfigHandler::~GlobalConfigHandler() { - + return result; } +GlobalConfigHandler::~GlobalConfigHandler() {} ReturnValue_t GlobalConfigHandler::performOperation(uint8_t operationCode) { ReturnValue_t result = RETURN_OK; - sif::debug<<"GlobalConfigHandler::performOperation"<lockMutex(MutexIF::TimeoutType::WAITING, 10); - return result; -} -ReturnValue_t GlobalConfigHandler::unlockConfigFile(){ +ReturnValue_t GlobalConfigHandler::lockConfigFile() { ReturnValue_t result = RETURN_OK; - result=configLock->unlockMutex(); + result = configLock->lockMutex(MutexIF::TimeoutType::WAITING, 10); + return result; +} +ReturnValue_t GlobalConfigHandler::unlockConfigFile() { + ReturnValue_t result = RETURN_OK; + result = configLock->unlockMutex(); return result; } -template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data){ - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultSet = RETURN_OK; +template +ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) { + ReturnValue_t result = RETURN_OK; + ReturnValue_t resultSet = RETURN_OK; - result=lockConfigFile(); - if (result!= RETURN_OK){ + result = lockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::setConfigFileValue lock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::setConfigFileValue lock mutex failed with " << result + << std::endl; #endif - return result; - } + return result; + } - std:: string paramString; - paramString=PARAM_KEY_MAP[paramID]; + std::string paramString; + paramString = PARAM_KEY_MAP[paramID]; - //Check if key exists in map before setting value. No check is done in setValue! Somehow PARAM_KEY_MAP.count(paramID) == 0 does not work - if (paramString.empty() == true) { + // Check if key exists in map before setting value. No check is done in setValue! Somehow + // PARAM_KEY_MAP.count(paramID) == 0 does not work + if (paramString.empty() == true) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::setConfigFileValue ParamId " << PARAM_KEY_MAP[paramID]<<" not found!" << std::endl; + sif::info << "GlobalConfigHandler::setConfigFileValue ParamId " << PARAM_KEY_MAP[paramID] + << " not found!" << std::endl; #endif - triggerEvent(SET_CONFIGFILEVALUE_FAILED, 1, 0); - return RETURN_FAILED; - } + triggerEvent(SET_CONFIGFILEVALUE_FAILED, 1, 0); + return RETURN_FAILED; + } - resultSet=setValue(PARAM_KEY_MAP[paramID], data); - if(resultSet!=RETURN_OK){ - triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0); + resultSet = setValue(PARAM_KEY_MAP[paramID], data); + if (resultSet != RETURN_OK) { + triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << resultSet << std::endl; + sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << resultSet + << std::endl; #endif - } + } - - result=unlockConfigFile(); - if (result!= RETURN_OK){ + result = unlockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::setConfigFileValue unlock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::setConfigFileValue unlock mutex failed with " << result + << std::endl; #endif - return result; - } + return result; + } - return resultSet; + return resultSet; } -template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data){ - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultGet = RETURN_OK; +template +ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) { + ReturnValue_t result = RETURN_OK; + ReturnValue_t resultGet = RETURN_OK; - result=lockConfigFile(); - if (result!= RETURN_OK){ + result = lockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result + << std::endl; #endif - return result; - } + return result; + } - resultGet=getValue(PARAM_KEY_MAP[paramID], data); - if (resultGet!= RETURN_OK){ - triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0); + resultGet = getValue(PARAM_KEY_MAP[paramID], data); + if (resultGet != RETURN_OK) { + triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::getConfigFileValue getValue failed with " << resultGet << std::endl; + sif::info << "GlobalConfigHandler::getConfigFileValue getValue failed with " << resultGet + << std::endl; #endif - } - result=unlockConfigFile(); - if (result!= RETURN_OK){ + } + result = unlockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::getConfigFileValue unlock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::getConfigFileValue unlock mutex failed with " << result + << std::endl; #endif - return result; - } + return result; + } - return resultGet; + return resultGet; } -ReturnValue_t GlobalConfigHandler::resetConfigFileValues(){ - ReturnValue_t result = RETURN_OK; - result=lockConfigFile(); - if (result!= RETURN_OK){ +ReturnValue_t GlobalConfigHandler::resetConfigFileValues() { + ReturnValue_t result = RETURN_OK; + result = lockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::resetConfigFileValues lock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::resetConfigFileValues lock mutex failed with " << result + << std::endl; #endif - return result; - } - insertValue(PARAM_KEY_MAP[PARAM0], PARAM0_DEFAULT); - insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT); + return result; + } + insertValue(PARAM_KEY_MAP[PARAM0], PARAM0_DEFAULT); + insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT); - - result=unlockConfigFile(); - if (result!= RETURN_OK){ + result = unlockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::resetConfigFileValues unlock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::resetConfigFileValues unlock mutex failed with " << result + << std::endl; #endif - return result; - } - return result; + return result; + } + return result; } -ReturnValue_t GlobalConfigHandler::WriteConfigFile(){ - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultWrite = RETURN_OK; - result=lockConfigFile(); - if (result!= RETURN_OK){ +ReturnValue_t GlobalConfigHandler::WriteConfigFile() { + ReturnValue_t result = RETURN_OK; + ReturnValue_t resultWrite = RETURN_OK; + result = lockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::WriteConfigFile lock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::WriteConfigFile lock mutex failed with " << result + << std::endl; #endif - return result; - } + return result; + } - resultWrite =writeJsonFile(); - if(resultWrite!=RETURN_OK){ - triggerEvent(WRITE_CONFIGFILE_FAILED, 0, 0); + resultWrite = writeJsonFile(); + if (resultWrite != RETURN_OK) { + triggerEvent(WRITE_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << resultWrite << std::endl; + sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << resultWrite + << std::endl; #endif - } + } - - result=unlockConfigFile(); - if (result!= RETURN_OK){ + result = unlockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::WriteConfigFile unlock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::WriteConfigFile unlock mutex failed with " << result + << std::endl; #endif - return result; - } - return resultWrite; + return result; + } + return resultWrite; } -ReturnValue_t GlobalConfigHandler::ReadConfigFile(){ - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultRead = RETURN_OK; - result=lockConfigFile(); - if (result!= RETURN_OK){ +ReturnValue_t GlobalConfigHandler::ReadConfigFile() { + ReturnValue_t result = RETURN_OK; + ReturnValue_t resultRead = RETURN_OK; + result = lockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::ReadConfigFile lock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::ReadConfigFile lock mutex failed with " << result + << std::endl; #endif - return result; - } + return result; + } - resultRead=readJsonFile(); - if(resultRead!=RETURN_OK){ - triggerEvent(READ_CONFIGFILE_FAILED, 0, 0); + resultRead = readJsonFile(); + if (resultRead != RETURN_OK) { + triggerEvent(READ_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << resultRead << std::endl; + sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << resultRead + << std::endl; #endif - } + } - result=unlockConfigFile(); - if (result!= RETURN_OK){ + result = unlockConfigFile(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::ReadConfigFile unlock mutex failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::ReadConfigFile unlock mutex failed with " << result + << std::endl; #endif - return result; - } + return result; + } - return resultRead; + return resultRead; } -ReturnValue_t GlobalConfigHandler::ResetConfigFile(){ - ReturnValue_t result = RETURN_OK; - result=resetConfigFileValues(); - if (result!= RETURN_OK){ +ReturnValue_t GlobalConfigHandler::ResetConfigFile() { + ReturnValue_t result = RETURN_OK; + result = resetConfigFileValues(); + if (result != RETURN_OK) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::info << "GlobalConfigHandler::ResetConfigFile failed with " << result << std::endl; + sif::info << "GlobalConfigHandler::ResetConfigFile failed with " << result << std::endl; #endif - return result; - } - result =writeJsonFile(); - return result; + return result; + } + result = writeJsonFile(); + return result; } - -ReturnValue_t GlobalConfigHandler::setConfigFileName(std::string configFileName){ - ReturnValue_t result = RETURN_OK; - setFullName(configFileName); - result=ResetConfigFile(); - return result; +ReturnValue_t GlobalConfigHandler::setConfigFileName(std::string configFileName) { + ReturnValue_t result = RETURN_OK; + setFullName(configFileName); + result = ResetConfigFile(); + return result; } -std::string GlobalConfigHandler::getConfigFileName(){ +std::string GlobalConfigHandler::getConfigFileName() { return getFullName(); } - return getFullName(); -} - - -template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, double& data); -template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, int32_t& data); - -template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, double data); -template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, int32_t data); +template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, + double& data); +template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, + int32_t& data); +template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, + double data); +template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, + int32_t data); diff --git a/mission/utility/GlobalConfigHandler.h b/mission/utility/GlobalConfigHandler.h index cbb65d20..18a6ec60 100644 --- a/mission/utility/GlobalConfigHandler.h +++ b/mission/utility/GlobalConfigHandler.h @@ -8,73 +8,72 @@ #ifndef MISSION_UTILITY_GLOBALCONFIGHANDLER_H_ #define MISSION_UTILITY_GLOBALCONFIGHANDLER_H_ +#include +#include #include +#include #include #include + #include #include -#include -#include "mission/memory/NVMParameterBase.h" + +#include "GlobalConfigFileDefinitions.h" #include "OBSWConfig.h" #include "fsfw/parameters/HasParametersIF.h" #include "fsfw/parameters/ParameterHelper.h" -#include -#include - -#include "GlobalConfigFileDefinitions.h" +#include "mission/memory/NVMParameterBase.h" static std::map PARAM_KEY_MAP = { - {PARAM0, "Parameter0"}, - {PARAM1, "Parameter1"}, + {PARAM0, "Parameter0"}, + {PARAM1, "Parameter1"}, }; /* * Idea: This class is intended to be used as a subclass for the Core Controller. - * Its tasks is managing a configuration JSON file containing config values important for various object. - * If some function to read or write a config value is called, a mutex should be used so only one call is done at a time. + * Its tasks is managing a configuration JSON file containing config values important for various + * object. If some function to read or write a config value is called, a mutex should be used so + * only one call is done at a time. */ -class GlobalConfigHandler: public SystemObject, - public ExecutableObjectIF, - public NVMParameterBase{ -public: - GlobalConfigHandler(object_id_t objectId, std::string configFilePath); - virtual ~GlobalConfigHandler(); +class GlobalConfigHandler : public SystemObject, + public ExecutableObjectIF, + public NVMParameterBase { + public: + GlobalConfigHandler(object_id_t objectId, std::string configFilePath); + virtual ~GlobalConfigHandler(); - static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CONFIGHANDLER; + static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CONFIGHANDLER; - static constexpr Event SET_CONFIGFILEVALUE_FAILED = MAKE_EVENT(1, severity::MEDIUM); - static constexpr Event GET_CONFIGFILEVALUE_FAILED = MAKE_EVENT(2, severity::MEDIUM); - static constexpr Event INSERT_CONFIGFILEVALUE_FAILED = MAKE_EVENT(3, severity::MEDIUM); - static constexpr Event WRITE_CONFIGFILE_FAILED = MAKE_EVENT(4, severity::MEDIUM); - static constexpr Event READ_CONFIGFILE_FAILED = MAKE_EVENT(5, severity::MEDIUM); + static constexpr Event SET_CONFIGFILEVALUE_FAILED = MAKE_EVENT(1, severity::MEDIUM); + static constexpr Event GET_CONFIGFILEVALUE_FAILED = MAKE_EVENT(2, severity::MEDIUM); + static constexpr Event INSERT_CONFIGFILEVALUE_FAILED = MAKE_EVENT(3, severity::MEDIUM); + static constexpr Event WRITE_CONFIGFILE_FAILED = MAKE_EVENT(4, severity::MEDIUM); + static constexpr Event READ_CONFIGFILE_FAILED = MAKE_EVENT(5, severity::MEDIUM); - ReturnValue_t performOperation(uint8_t operationCode); + ReturnValue_t performOperation(uint8_t operationCode); - ReturnValue_t initialize(); + ReturnValue_t initialize(); + template + ReturnValue_t setConfigFileValue(ParamIds paramID, T data); + template + ReturnValue_t getConfigFileValue(ParamIds paramID, T& data); - template ReturnValue_t setConfigFileValue(ParamIds paramID, T data); - template ReturnValue_t getConfigFileValue(ParamIds paramID, T& data); + ReturnValue_t ResetConfigFile(); + ReturnValue_t WriteConfigFile(); + std::string getConfigFileName(); + private: + static MutexIF* configLock; - ReturnValue_t ResetConfigFile(); - ReturnValue_t WriteConfigFile(); - std::string getConfigFileName(); - -private: - static MutexIF* configLock ; - - ReturnValue_t lockConfigFile(); - ReturnValue_t unlockConfigFile(); - ReturnValue_t resetConfigFileValues(); - - ReturnValue_t setConfigFileName(std::string configFileName); - - ReturnValue_t ReadConfigFile(); - - MessageQueueIF* commandQueue; + ReturnValue_t lockConfigFile(); + ReturnValue_t unlockConfigFile(); + ReturnValue_t resetConfigFileValues(); + ReturnValue_t setConfigFileName(std::string configFileName); + ReturnValue_t ReadConfigFile(); + MessageQueueIF* commandQueue; }; #endif /* MISSION_UTILITY_GLOBALCONFIGHANDLER_H_ */ diff --git a/unittest/controller/testConfigFileHandler.cpp b/unittest/controller/testConfigFileHandler.cpp index cbfd24b6..0f994fba 100644 --- a/unittest/controller/testConfigFileHandler.cpp +++ b/unittest/controller/testConfigFileHandler.cpp @@ -1,65 +1,65 @@ #include +#include + #include #include #include #include #include "../testEnvironment.h" -#include TEST_CASE("Configfile Handler", "[ConfigHandler]") { + sif::debug << "Testcase config file handler" << std::endl; + testEnvironment::initialize(); + // Init handler + GlobalConfigHandler confighandler = GlobalConfigHandler(objects::CONFIG_TEST, "JSON.config"); + REQUIRE(confighandler.initialize() == HasReturnvaluesIF::RETURN_OK); - sif::debug<<"Testcase config file handler"< Date: Mon, 8 Aug 2022 17:12:22 +0200 Subject: [PATCH 074/361] re-point tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 6cb629c3..df4824af 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 6cb629c3c3ef0b109bc973e4b5b89ad176d373b3 +Subproject commit df4824af8da32951185976ef25ec1038e52e7446 From c0157ca506a5df740cc963699326e07dd6cda3f6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 13:09:58 +0200 Subject: [PATCH 075/361] remove etl submodule --- thirdparty/etl | 1 - 1 file changed, 1 deletion(-) delete mode 160000 thirdparty/etl diff --git a/thirdparty/etl b/thirdparty/etl deleted file mode 160000 index 5468eb65..00000000 --- a/thirdparty/etl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5468eb659c8b4ecdb3d08e8b8f0442c5a2549a48 From e6da1824df3e2b36854e844a109a45ca74ba31c6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 13:11:15 +0200 Subject: [PATCH 076/361] something went wrong here --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index ac6824b8..6ddc3978 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "generators/fsfwgen"] path = generators/deps/fsfwgen url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git -[submodule "thirdparty/arcsec_star_tracker"] - path = thirdparty/arcsec_star_tracker - url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git [submodule "thirdparty/json"] path = thirdparty/json url = https://github.com/nlohmann/json.git From 2eac346e41cd3ab257337d9a99ee0d1078b79597 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 13:11:34 +0200 Subject: [PATCH 077/361] re-add arcsec submodule --- .gitmodules | 3 +++ thirdparty/arcsec_star_tracker | 1 + 2 files changed, 4 insertions(+) create mode 160000 thirdparty/arcsec_star_tracker diff --git a/.gitmodules b/.gitmodules index 6ddc3978..c1b4332f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "thirdparty/rapidcsv"] path = thirdparty/rapidcsv url = https://github.com/d99kris/rapidcsv.git +[submodule "thirdparty/arcsec_star_tracker"] + path = thirdparty/arcsec_star_tracker + url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git diff --git a/thirdparty/arcsec_star_tracker b/thirdparty/arcsec_star_tracker new file mode 160000 index 00000000..93e93965 --- /dev/null +++ b/thirdparty/arcsec_star_tracker @@ -0,0 +1 @@ +Subproject commit 93e93965e2c6405170b62c523dea1990db02d2ad From ed6c90b106ea32df7087acfb9fe364bece9351a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 13:12:58 +0200 Subject: [PATCH 078/361] retain old order --- .gitmodules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index c1b4332f..ac6824b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,12 +13,12 @@ [submodule "generators/fsfwgen"] path = generators/deps/fsfwgen url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git +[submodule "thirdparty/arcsec_star_tracker"] + path = thirdparty/arcsec_star_tracker + url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git [submodule "thirdparty/json"] path = thirdparty/json url = https://github.com/nlohmann/json.git [submodule "thirdparty/rapidcsv"] path = thirdparty/rapidcsv url = https://github.com/d99kris/rapidcsv.git -[submodule "thirdparty/arcsec_star_tracker"] - path = thirdparty/arcsec_star_tracker - url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git From 79f5077a2522c952f9a377f4c845f753b689098b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 16 Aug 2022 18:46:10 +0200 Subject: [PATCH 079/361] some issues --- mission/utility/CMakeLists.txt | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/utility/CMakeLists.txt b/mission/utility/CMakeLists.txt index 09baae92..8a58630d 100644 --- a/mission/utility/CMakeLists.txt +++ b/mission/utility/CMakeLists.txt @@ -1,3 +1,3 @@ target_sources( - ${LIB_EIVE_MISSION} PRIVATE TmFunnel.cpp Timestamp.cpp ProgressPrinter.cpp + ${LIB_EIVE_MISSION} PRIVATE Timestamp.cpp ProgressPrinter.cpp Filenaming.cpp GlobalConfigHandler.cpp) diff --git a/tmtc b/tmtc index 3fa70080..ca9f85de 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 3fa700804e0592db4e9a5667de2a81323cac5dc7 +Subproject commit ca9f85de1b51e29e3c0cccd527d736083e374f7f From 745551479721877d4869edbdc105820d633cbe33 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Aug 2022 09:05:58 +0200 Subject: [PATCH 080/361] it compiles now --- common/config/commonSubsystemIds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/common/config/commonSubsystemIds.h b/common/config/commonSubsystemIds.h index 222325ac..55c55e88 100644 --- a/common/config/commonSubsystemIds.h +++ b/common/config/commonSubsystemIds.h @@ -33,6 +33,7 @@ enum : uint8_t { ACU_HANDLER = 135, PLOC_SUPV_HELPER = 136, SYRLINKS = 137, + CONFIGHANDLER = 138, COMMON_SUBSYSTEM_ID_END }; From 86d3732f65dea0e443dda139daf9c8469e714429 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 29 Aug 2022 15:57:26 +0200 Subject: [PATCH 081/361] retval replacements --- bsp_q7s/core/InitMission.cpp | 2 +- mission/system/tree/acsModeTree.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 3aed9bd8..01662b59 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -160,7 +160,7 @@ void initmission::initTasks() { } #endif result = sysTask->addComponent(objects::ACS_SUBSYSTEM); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM); } diff --git a/mission/system/tree/acsModeTree.cpp b/mission/system/tree/acsModeTree.cpp index bfab8c26..9f7d18df 100644 --- a/mission/system/tree/acsModeTree.cpp +++ b/mission/system/tree/acsModeTree.cpp @@ -382,7 +382,7 @@ void buildTargetPtSequence(Subsystem* ss, ModeListEntry& eh) { } void checkInsert(ReturnValue_t result, const char* ctx) { - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "satsystem::checkInsert: Insertion failed at " << ctx << std::endl; } } From 86337d8f4705872d282784f29a890fd64e6f38ea Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 29 Aug 2022 16:05:05 +0200 Subject: [PATCH 082/361] retval replacements --- linux/boardtest/UartTestClass.cpp | 24 +++++----- linux/boardtest/UartTestClass.h | 2 +- linux/devices/ScexHelper.cpp | 8 ++-- linux/devices/ScexHelper.h | 8 ++-- linux/devices/ScexUartReader.cpp | 44 ++++++++++--------- mission/devices/ScexDeviceHandler.cpp | 25 ++++++----- .../devicedefinitions/ScexDefinitions.cpp | 4 +- 7 files changed, 57 insertions(+), 58 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index ec243c4f..9843baa5 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -25,6 +25,8 @@ #define RPI_TEST_GPS_HANDLER 0 #endif +using namespace returnvalue; + UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) : TestTask(objectId), reader(reader) { mode = TestModes::SCEX; @@ -163,7 +165,7 @@ void UartTestClass::scexInit() { uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); reader->setDebugMode(false); ReturnValue_t result = reader->initializeInterface(uartCookie); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != OK) { sif::warning << "UartTestClass::scexInit: Initializing SCEX reader " "UART IF failed" << std::endl; @@ -306,7 +308,7 @@ void UartTestClass::scexSimpleInit() { void UartTestClass::scexSimplePeriodic() { using namespace scex; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = OK; if (not cmdSent) { // Flush received and unread data tcflush(serialPort, TCIFLUSH); @@ -315,7 +317,7 @@ void UartTestClass::scexSimplePeriodic() { sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl; prepareScexCmd(currCmd, false, tmpCmdBuf, &len); result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != OK) { sif::warning << "UartTestClass::scexSimplePeriodic: Encoding failed" << std::endl; return; } @@ -368,17 +370,11 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu cmdBuf[1] = 1; cmdBuf[2] = 1; uint16_t userDataLen = 0; - tmpCmdBuf[3] = (userDataLen >> 8) & 0xff; - tmpCmdBuf[4] = userDataLen & 0xff; - uint16_t crc = CRC::crc16ccitt(tmpCmdBuf.data(), 5); - tmpCmdBuf[5] = (crc >> 8) & 0xff; - tmpCmdBuf[6] = crc & 0xff; - ReturnValue_t result = - dleEncoder.encode(tmpCmdBuf.data(), 7, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != returnvalue::OK) { - sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; - return -1; - } + cmdBuf[3] = (userDataLen >> 8) & 0xff; + cmdBuf[4] = userDataLen & 0xff; + uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); + cmdBuf[5] = (crc >> 8) & 0xff; + cmdBuf[6] = crc & 0xff; return 0; } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index efe15dc1..1c1b9988 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -67,7 +67,7 @@ class UartTestClass : public TestTask { std::array cmdBuf = {}; std::array recBuf = {}; ScexDleParser* dleParser; - scex::Cmds cmdHelper; + scex::Cmds cmdHelper = scex::Cmds::INVALID; uint8_t recvCnt = 0; }; diff --git a/linux/devices/ScexHelper.cpp b/linux/devices/ScexHelper.cpp index 3e61d346..bce5fbda 100644 --- a/linux/devices/ScexHelper.cpp +++ b/linux/devices/ScexHelper.cpp @@ -4,11 +4,13 @@ #include "fsfw/serviceinterface.h" +using namespace returnvalue; + ScexHelper::ScexHelper() {} ReturnValue_t ScexHelper::serialize(uint8_t** buffer, size_t* size, size_t maxSize, Endianness streamEndianness) const { - return RETURN_FAILED; + return FAILED; } size_t ScexHelper::getSerializedSize() const { return totalPacketLen; } @@ -16,7 +18,7 @@ size_t ScexHelper::getSerializedSize() const { return totalPacketLen; } ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size, Endianness streamEndianness) { if (buffer == nullptr or size == nullptr) { - return RETURN_FAILED; + return FAILED; } if (*size < 7) { return STREAM_TOO_SHORT; @@ -45,7 +47,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size, if (CRC::crc16ccitt(start, totalPacketLen) != 0) { return INVALID_CRC; } - return RETURN_OK; + return OK; } scex::Cmds ScexHelper::getCmd() const { return cmd; } diff --git a/linux/devices/ScexHelper.h b/linux/devices/ScexHelper.h index eb258568..f2adf617 100644 --- a/linux/devices/ScexHelper.h +++ b/linux/devices/ScexHelper.h @@ -7,12 +7,10 @@ #include #include #include -// ScexHelper helper; -// helper.deSerialize(data, ...); -// sif::info << helper << std::endl; -class ScexHelper : public HasReturnvaluesIF, public SerializeIF { + +class ScexHelper : public SerializeIF { public: - static const ReturnValue_t INVALID_CRC = HasReturnvaluesIF::makeReturnCode(0, 2); + static const ReturnValue_t INVALID_CRC = returnvalue::makeCode(0, 2); ScexHelper(); ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 31fc4bf1..38286a7a 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -14,6 +14,8 @@ #include "OBSWConfig.h" +using namespace returnvalue; + ScexUartReader::ScexUartReader(object_id_t objectId) : SystemObject(objectId), decodeRingBuf(4096, true), @@ -58,7 +60,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { sif::info << "Received " << bytesRead << " bytes from the Solar Cell Experiment:" << std::endl; } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != OK) { sif::warning << "ScexUartReader::performOperation: Passing data to DLE parser failed" << std::endl; } @@ -67,13 +69,13 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { // task block comes here sif::info << "task was stopped" << std::endl; } - return RETURN_OK; + return OK; } ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { UartCookie *uartCookie = dynamic_cast(cookie); if (uartCookie == nullptr) { - return RETURN_FAILED; + return FAILED; } std::string devname = uartCookie->getDeviceFile(); /* Get file descriptor */ @@ -81,7 +83,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { if (serialPort < 0) { sif::warning << "ScexUartReader::initializeInterface: open call failed with error [" << errno << ", " << strerror(errno) << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return FAILED; } // Setting up UART parameters tty.c_cflag &= ~PARENB; // Clear parity bit @@ -111,46 +113,46 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { } // Flush received and unread data tcflush(serialPort, TCIOFLUSH); - return RETURN_OK; + return OK; } ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { if (sendData == nullptr or sendLen == 0) { - return HasReturnvaluesIF::RETURN_FAILED; + return FAILED; } lock->lockMutex(); if (state == States::NOT_READY or state == States::RUNNING) { lock->unlockMutex(); - return HasReturnvaluesIF::RETURN_FAILED; + return FAILED; } state = States::RUNNING; lock->unlockMutex(); size_t encodedLen = 0; ReturnValue_t result = dleEncoder.encode(sendData, sendLen, cmdbuf.data(), cmdbuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != OK) { sif::warning << "ScexUartReader::sendMessage: Encoding failed" << std::endl; - return RETURN_FAILED; + return FAILED; } arrayprinter::print(cmdbuf.data(), encodedLen); size_t bytesWritten = write(serialPort, cmdbuf.data(), encodedLen); if (bytesWritten != encodedLen) { sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed" << std::endl; - return RETURN_FAILED; + return FAILED; } result = semaphore->release(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != OK) { std::cout << "ScexUartReader::sendMessage: Releasing semaphore failed" << std::endl; } - return RETURN_OK; + return OK; } -ReturnValue_t ScexUartReader::getSendSuccess(CookieIF *cookie) { return RETURN_OK; } +ReturnValue_t ScexUartReader::getSendSuccess(CookieIF *cookie) { return OK; } ReturnValue_t ScexUartReader::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { - return RETURN_OK; + return OK; } void ScexUartReader::setDebugMode(bool enable) { this->debugMode = enable; } @@ -158,10 +160,10 @@ void ScexUartReader::setDebugMode(bool enable) { this->debugMode = enable; } ReturnValue_t ScexUartReader::finish() { MutexGuard mg(lock); if (state == States::IDLE) { - return HasReturnvaluesIF::RETURN_FAILED; + return FAILED; } state = States::FINISH; - return RETURN_OK; + return OK; } void ScexUartReader::foundDlePacketHandler(const ScexDleParser::Context &ctx) { @@ -178,11 +180,11 @@ void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) { // sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl; MutexGuard mg(lock); ReturnValue_t result = ipcQueue.insert(len); - if (result != RETURN_OK) { + if (result != OK) { sif::warning << "ScexUartReader::handleFoundDlePacket: IPCQueue error" << std::endl; } result = ipcRingBuf.writeData(packet, len); - if (result != RETURN_OK) { + if (result != OK) { sif::warning << "ScexUartReader::handleFoundDlePacket: IPCRingBuf error" << std::endl; } } @@ -192,13 +194,13 @@ ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **bu MutexGuard mg(lock); if (ipcQueue.empty()) { *size = 0; - return RETURN_OK; + return OK; } ipcQueue.retrieve(size); *buffer = ipcBuffer.data(); ReturnValue_t result = ipcRingBuf.readData(ipcBuffer.data(), *size, true); - if (result != RETURN_OK) { + if (result != OK) { sif::warning << "ScexUartReader::readReceivedMessage: Reading RingBuffer failed" << std::endl; } - return RETURN_OK; + return OK; } diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index edd9e6e9..15dd05cb 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -11,6 +11,7 @@ #include "mission/devices/devicedefinitions/ScexDefinitions.h" using std::ofstream; +using namespace returnvalue; ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie, SdCardMountedIF* sdcMan) @@ -26,11 +27,11 @@ void ScexDeviceHandler::doStartUp() { void ScexDeviceHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } ReturnValue_t ScexDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - return RETURN_OK; + return OK; } ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { - return RETURN_OK; + return OK; } ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, @@ -113,7 +114,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic } commandActive = true; rawPacket = cmdBuf.data(); - return RETURN_OK; + return OK; } void ScexDeviceHandler::fillCommandAndReplyMap() { @@ -144,14 +145,14 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai *foundId = helper.getCmd(); *foundLen = remainingSize; - return RETURN_OK; + return OK; } ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { // cmd auswertung (in file reinschreiben) using namespace scex; - ReturnValue_t status = RETURN_OK; + ReturnValue_t status = OK; auto oneFileHandler = [&](std::string cmdName) { fileId = random_string(6); std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); @@ -162,12 +163,12 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons if (out.bad()) { sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName << std::endl; - return RETURN_FAILED; + return FAILED; } if (debugMode) { out << helper; } - return RETURN_OK; + return OK; }; auto multiFileHandler = [&](std::string cmdName) { if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { @@ -181,7 +182,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons if (out.bad()) { sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName << std::endl; - return RETURN_FAILED; + return FAILED; } } else { ofstream out(fileName, @@ -191,7 +192,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons } } - return RETURN_OK; + return OK; }; switch (id) { case (PING): { @@ -249,16 +250,16 @@ void ScexDeviceHandler::performOperationHook() { } uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { - return RETURN_OK; + return OK; } ReturnValue_t ScexDeviceHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { - return RETURN_OK; + return OK; } ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { - return RETURN_OK; + return OK; } std::string ScexDeviceHandler::random_string(std::string::size_type length) { diff --git a/mission/devices/devicedefinitions/ScexDefinitions.cpp b/mission/devices/devicedefinitions/ScexDefinitions.cpp index 8685862e..c4319876 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.cpp +++ b/mission/devices/devicedefinitions/ScexDefinitions.cpp @@ -17,7 +17,7 @@ ReturnValue_t scex::prepareScexCmd(Cmds cmd, std::pair cmdBufP if (cmdBuf == nullptr or (cmdBufPair.second < usrDataPair.second + HEADER_LEN + CRC_LEN) or (usrDataPair.second > 0 and userData == nullptr)) { cmdLen = 0; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } cmdBuf[0] = createCmdByte(cmd, tempCheck); // These two fields are the packet counter and the total packet count. Those are 1 and 1 for each @@ -31,5 +31,5 @@ ReturnValue_t scex::prepareScexCmd(Cmds cmd, std::pair cmdBufP cmdBuf[usrDataPair.second + HEADER_LEN] = (crc >> 8) & 0xff; cmdBuf[usrDataPair.second + HEADER_LEN + 1] = crc & 0xff; cmdLen = usrDataPair.second + HEADER_LEN + CRC_LEN; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } From 13e89e13422b1208b54c18ad533a94486d89ec06 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 30 Aug 2022 16:34:24 +0200 Subject: [PATCH 083/361] bump deps --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 9a590a3f..141dcb1f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 9a590a3fcd81ed4dd48de503522b6d71f64205d2 +Subproject commit 141dcb1f149b824b5bd6e5d3339ecb712835751e diff --git a/tmtc b/tmtc index 05dd1738..b1eafd92 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 05dd17386070b9f333977f1f2b9f5651f9053b65 +Subproject commit b1eafd92c202385731a990d3bdba36c48267d63a From b156d7827459912e73080878673a5ef29a68e809 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 30 Aug 2022 16:51:30 +0200 Subject: [PATCH 084/361] huh --- CMakeLists.txt | 11 +- bsp_linux_board/InitMission.cpp | 2 +- linux/devices/Max31865RtdLowlevelHandler.cpp | 2 +- linux/devices/ScexUartReader.cpp | 6 +- linux/devices/ploc/PlocSupervisorHandler.cpp | 2 +- mission/devices/ScexDeviceHandler.cpp | 153 +++++++++++-------- 6 files changed, 101 insertions(+), 75 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03b2b512..6dab4525 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,10 +382,8 @@ add_subdirectory(${TEST_PATH}) add_subdirectory(${UNITTEST_PATH}) # This should have already been downloaded by the FSFW Still include it to be -# safe -# find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) -# Not installed, so use FetchContent to download and provide etl -# if(NOT etl_FOUND) +# safe find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) Not +# installed, so use FetchContent to download and provide etl if(NOT etl_FOUND) message( STATUS "No ETL installation was found with find_package. Installing and providing " @@ -454,8 +452,9 @@ if(TGT_BSP MATCHES "arm/q7s") target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC}) endif() -target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} - rapidcsv ${LIB_DUMMIES} ${LIB_GOMSPACE_CLIENTS}) +target_link_libraries( + ${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} rapidcsv ${LIB_DUMMIES} + ${LIB_GOMSPACE_CLIENTS}) if(TGT_BSP MATCHES "arm/egse") target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index ec77f668..d009030b 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -231,7 +231,7 @@ void initmission::createPstTasks(TaskFactory& factory, result = pst::pstSpi(spiPst); if (result != HasReturnvaluesIF::RETURN_OK) { if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { - sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; + sif::error << "InitMission::createPstTasks: Creating PST failed!" << std::endl; } } else { taskVec.push_back(spiPst); diff --git a/linux/devices/Max31865RtdLowlevelHandler.cpp b/linux/devices/Max31865RtdLowlevelHandler.cpp index f2815f5f..1be2b1c2 100644 --- a/linux/devices/Max31865RtdLowlevelHandler.cpp +++ b/linux/devices/Max31865RtdLowlevelHandler.cpp @@ -311,7 +311,7 @@ ReturnValue_t Max31865RtdReader::readReceivedMessage(CookieIF* cookie, uint8_t** return returnvalue::FAILED; } auto* rtdCookie = dynamic_cast(cookie); - if(rtdCookie == nullptr) { + if (rtdCookie == nullptr) { return returnvalue::FAILED; } uint8_t* exchangePtr = rtdCookie->exchangeBuf.data(); diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 38286a7a..84a7d7cc 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -34,7 +34,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { lock->unlockMutex(); while (true) { semaphore->acquire(); - sif::info << "task was started" << std::endl; + sif::info << "ScexUartReader::performOperation:task was started" << std::endl; int bytesRead = 0; while (true) { bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), @@ -42,7 +42,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { if (bytesRead == 0) { MutexGuard mg(lock); if (state == States::FINISH) { - sif::debug << "finish detected" << std::endl; + sif::debug << "ScexUartReader::performOperation:finish detected" << std::endl; state = States::IDLE; break; } @@ -67,7 +67,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { } }; // task block comes here - sif::info << "task was stopped" << std::endl; + sif::info << "ScexUartReader::performOperation: task was stopped" << std::endl; } return OK; } diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 1cff8884..3846e4a4 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -417,7 +417,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d break; } case LOGGING_SET_TOPIC: { - if(commandData == nullptr or commandDataLen == 0) { + if (commandData == nullptr or commandDataLen == 0) { return HasActionsIF::INVALID_PARAMETERS; } uint8_t tpc = *(commandData); diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 15dd05cb..b5f55a69 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -26,13 +26,9 @@ void ScexDeviceHandler::doStartUp() { void ScexDeviceHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } -ReturnValue_t ScexDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - return OK; -} +ReturnValue_t ScexDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { return OK; } -ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { - return OK; -} +ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { return OK; } ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData, @@ -88,6 +84,13 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic finishCountdown.setTimeout(LONG_CD); // countdown starten finishCountdown.resetTimer(); + if (debugMode) { + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + + sif::info << "ScexDeviceHandler::buildCommandFromCommand: RemainingMillis: " + << remainingMillis << std::endl; + } + prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); break; @@ -123,12 +126,13 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(scex::Cmds::TEMP_CMD, 3); insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3); + // TODO: Prüfen: richtige Variablen? insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, false, false, - scex::Cmds::ALL_CELLS_CMD, &finishCountdown); + scex::Cmds::ALL_CELLS_CMD, &finishCountdown); insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, false, false, - scex::Cmds::ONE_CELL, &finishCountdown); - insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, false, false, - scex::Cmds::FRAM, &finishCountdown); + scex::Cmds::ONE_CELL, &finishCountdown); + insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, false, false, scex::Cmds::FRAM, + &finishCountdown); insertInReplyMap(scex::Cmds::ERROR_REPLY, 3); } @@ -137,15 +141,78 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai DeviceCommandId_t* foundId, size_t* foundLen) { size_t len = remainingSize; ReturnValue_t result = helper.deSerialize(&start, &len); + bool commandFound = false; if (result == ScexHelper::INVALID_CRC) { sif::warning << "ScexDeviceHandler::scanForReply: CRC invalid" << std::endl; - return result; + } else { + *foundId = helper.getCmd(); + commandFound = true; + *foundLen = remainingSize; } - *foundId = helper.getCmd(); - *foundLen = remainingSize; - return OK; + if (commandFound) { + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + if (commandActive and finishCountdown.hasTimedOut()) { + triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); + reader.finish(); + sif::warning << "ScexDeviceHandler::performOperationHook: Reader timeout; RemMillis: " + << remainingMillis << std::endl; + fileNameSet = false; + commandActive = false; + } + } + + auto multiFileHandler = [&](std::string cmdName) { + if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { + fileId = random_string(6); + std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); + oss << cmdName << fileId << ".bin"; + fileName = oss.str(); + fileNameSet = true; + ofstream out(fileName, ofstream::binary); + if (debugMode) { + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + sif::info << "ScexDeviceHandler::interpretDeviceReply:MultifileHandler: RemMillis: " + << remainingMillis << std::endl; + } + if (out.bad()) { + sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName + << std::endl; + return FAILED; + } + } else { + ofstream out(fileName, + ofstream::binary | ofstream::app); // append + if (debugMode) { + out << helper; + } + } + + return OK; + }; + ReturnValue_t status = OK; + switch (helper.getCmd()) { + case (FRAM): { + if (debugMode) { + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + + sif::info << "ScexDeviceHandler::interpretDeviceReply: RemMillis: " << remainingMillis + << std::endl; + } + status = multiFileHandler("fram_"); + break; + } + case (ONE_CELL): { + status = multiFileHandler("one_cell_"); + break; + } + case (ALL_CELLS_CMD): { + status = multiFileHandler("all_cell_"); + break; + } + } + return result; } ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { @@ -170,30 +237,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons } return OK; }; - auto multiFileHandler = [&](std::string cmdName) { - if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { - fileId = random_string(6); - std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); - oss << cmdName << fileId << ".bin"; - fileName = oss.str(); - fileNameSet = true; - ofstream out(fileName, ofstream::binary); - if (out.bad()) { - sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName - << std::endl; - return FAILED; - } - } else { - ofstream out(fileName, - ofstream::binary | ofstream::app); // append - if (debugMode) { - out << helper; - } - } - - return OK; - }; switch (id) { case (PING): { status = oneFileHandler("ping_"); @@ -211,18 +255,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons status = oneFileHandler("exp_status_"); break; } - case (FRAM): { - status = multiFileHandler("fram_"); - break; - } - case (ONE_CELL): { - status = multiFileHandler("one_cell_"); - break; - } - case (ALL_CELLS_CMD): { - status = multiFileHandler("all_cell_"); - break; - } + default: // Unknown DeviceCommand return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; @@ -231,27 +264,21 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons reader.finish(); commandActive = false; if (id != PING) { - sif::info << "Reader is finished" << std::endl; + sif::info << "ScexDeviceHandler::interpretDeviceReply:Reader is finished" << std::endl; fileNameSet = false; } } - + if (debugMode) { + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + sif::info << __FILE__ << __func__ << "(" << __LINE__ << ") RemMillis: " << remainingMillis + << std::endl; + } return status; } -void ScexDeviceHandler::performOperationHook() { - if (commandActive and finishCountdown.hasTimedOut()) { - triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); - reader.finish(); - sif::warning << "ScexDeviceHandler::performOperationHook: Reader timeout" << std::endl; - fileNameSet = false; - commandActive = false; - } -} +void ScexDeviceHandler::performOperationHook() {} -uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { - return OK; -} +uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return OK; } ReturnValue_t ScexDeviceHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { return OK; From a6582313f74e352b90a2702f901903f61dcd1643 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 30 Aug 2022 18:36:00 +0200 Subject: [PATCH 085/361] writing file works now --- bsp_linux_board/InitMission.cpp | 16 +++--- bsp_linux_board/ObjectFactory.cpp | 7 +-- linux/devices/ScexUartReader.cpp | 1 - mission/devices/ScexDeviceHandler.cpp | 72 +++++++++++++++------------ mission/devices/ScexDeviceHandler.h | 3 +- tmtc | 2 +- 6 files changed, 52 insertions(+), 49 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index d009030b..c79af477 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -82,28 +82,28 @@ void initmission::initTasks() { PeriodicTaskIF* scexDevHandler = factory->createPeriodicTask( "SCEX_DEV", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc); result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("SCEX_DEV", objects::SCEX); } result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ); - result = HasReturnvaluesIF::RETURN_OK; + result = returnvalue::OK; PeriodicTaskIF* scexReaderTask = factory->createPeriodicTask( "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); result = scexReaderTask->addComponent(objects::SCEX_UART_READER); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); } #endif @@ -229,7 +229,7 @@ void initmission::createPstTasks(TaskFactory& factory, FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( "SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc); result = pst::pstSpi(spiPst); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { sif::error << "InitMission::createPstTasks: Creating PST failed!" << std::endl; } @@ -269,7 +269,7 @@ void initmission::createTestTasks(TaskFactory& factory, PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask( "SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); result = scexReaderTask->addComponent(objects::SCEX_UART_READER); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER); } taskVec.push_back(scexReaderTask); diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 19a00647..2804591b 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -47,8 +47,8 @@ #include "fsfw_hal/linux/spi/SpiCookie.h" void Factory::setStaticFrameworkObjectIds() { - PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; - PusServiceBase::packetDestination = objects::TM_FUNNEL; + PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR; + PusServiceBase::PACKET_DESTINATION = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; @@ -56,9 +56,6 @@ void Factory::setStaticFrameworkObjectIds() { TmFunnel::downlinkDestination = objects::TMTC_BRIDGE; // No storage object for now. TmFunnel::storageDestination = objects::NO_OBJECT; - - VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; - TmPacketBase::timeStamperId = objects::TIME_STAMPER; } void ObjectFactory::produce(void* args) { diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 84a7d7cc..f1d0d037 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -135,7 +135,6 @@ ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendD sif::warning << "ScexUartReader::sendMessage: Encoding failed" << std::endl; return FAILED; } - arrayprinter::print(cmdbuf.data(), encodedLen); size_t bytesWritten = write(serialPort, cmdbuf.data(), encodedLen); if (bytesWritten != encodedLen) { sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed" diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index b5f55a69..6432bcea 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -126,7 +126,6 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(scex::Cmds::TEMP_CMD, 3); insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3); - // TODO: Prüfen: richtige Variablen? insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, false, false, scex::Cmds::ALL_CELLS_CMD, &finishCountdown); insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, false, false, @@ -141,28 +140,29 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai DeviceCommandId_t* foundId, size_t* foundLen) { size_t len = remainingSize; ReturnValue_t result = helper.deSerialize(&start, &len); - bool commandFound = false; if (result == ScexHelper::INVALID_CRC) { sif::warning << "ScexDeviceHandler::scanForReply: CRC invalid" << std::endl; - } else { - *foundId = helper.getCmd(); - commandFound = true; *foundLen = remainingSize; + } else { + result = handleValidReply(remainingSize, foundId, foundLen); } - - if (commandFound) { - uint32_t remainingMillis = finishCountdown.getRemainingMillis(); - if (commandActive and finishCountdown.hasTimedOut()) { - triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); - reader.finish(); - sif::warning << "ScexDeviceHandler::performOperationHook: Reader timeout; RemMillis: " - << remainingMillis << std::endl; - fileNameSet = false; - commandActive = false; - } + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + if (commandActive and finishCountdown.hasTimedOut()) { + triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); + reader.finish(); + sif::warning << "ScexDeviceHandler::performOperationHook: Reader timeout; RemMillis: " + << remainingMillis << std::endl; + fileNameSet = false; + commandActive = false; } + return result; +} +ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandId_t* foundId, + size_t* foundLen) { + using namespace scex; + ReturnValue_t result = OK; auto multiFileHandler = [&](std::string cmdName) { if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { fileId = random_string(6); @@ -171,27 +171,28 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai fileName = oss.str(); fileNameSet = true; ofstream out(fileName, ofstream::binary); - if (debugMode) { - uint32_t remainingMillis = finishCountdown.getRemainingMillis(); - sif::info << "ScexDeviceHandler::interpretDeviceReply:MultifileHandler: RemMillis: " - << remainingMillis << std::endl; - } if (out.bad()) { sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName << std::endl; return FAILED; } + out << helper; } else { ofstream out(fileName, ofstream::binary | ofstream::app); // append - if (debugMode) { - out << helper; + if (out.bad()) { + sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName + << std::endl; + return FAILED; } + out << helper; } - - return OK; + if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { + *foundId = helper.getCmd(); + return OK; + } + return IGNORE_FULL_PACKET; }; - ReturnValue_t status = OK; switch (helper.getCmd()) { case (FRAM): { if (debugMode) { @@ -200,18 +201,23 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai sif::info << "ScexDeviceHandler::interpretDeviceReply: RemMillis: " << remainingMillis << std::endl; } - status = multiFileHandler("fram_"); + result = multiFileHandler("fram_"); break; } case (ONE_CELL): { - status = multiFileHandler("one_cell_"); + result = multiFileHandler("one_cell_"); break; } case (ALL_CELLS_CMD): { - status = multiFileHandler("all_cell_"); + result = multiFileHandler("all_cell_"); + break; + } + default: { + *foundId = helper.getCmd(); break; } } + *foundLen = remSize; return result; } @@ -225,16 +231,13 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); oss << cmdName << fileId << ".bin"; fileName = oss.str(); - std::cout << fileName << std::endl; ofstream out(fileName, ofstream::binary); if (out.bad()) { sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName << std::endl; return FAILED; } - if (debugMode) { - out << helper; - } + out << helper; return OK; }; @@ -258,6 +261,9 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons default: // Unknown DeviceCommand + if(id == FRAM or id == ONE_CELL or id == ALL_CELLS_CMD) { + break; + } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index eeaac755..69436e0b 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -22,7 +22,7 @@ class ScexDeviceHandler : public DeviceHandlerBase { std::string fileName = ""; bool fileNameSet = false; bool commandActive = false; - bool debugMode = true; + bool debugMode = false; scex::Cmds currCmd = scex::Cmds::PING; SdCardMountedIF *sdcMan = nullptr; @@ -45,6 +45,7 @@ class ScexDeviceHandler : public DeviceHandlerBase { ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; + ReturnValue_t handleValidReply(size_t remSize, DeviceCommandId_t *foundId, size_t *foundLen); uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override; diff --git a/tmtc b/tmtc index b1eafd92..b4d4a511 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b1eafd92c202385731a990d3bdba36c48267d63a +Subproject commit b4d4a51164af69a22eedd645775061dbb51702b1 From 0f91800cf8951aa57aab3b1815833180069a8d05 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 30 Aug 2022 18:52:50 +0200 Subject: [PATCH 086/361] works but reply handling is annoying --- mission/devices/ScexDeviceHandler.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 6432bcea..0c3049c8 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -93,6 +93,9 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); + // auto iter = deviceReplyMap.find(FRAM); + // auto& info = iter->second.command->second; + // actionHelper.finish(true,info.sendReplyTo, iter->first, OK); break; } case (ONE_CELL): { @@ -160,7 +163,7 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai } ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandId_t* foundId, - size_t* foundLen) { + size_t* foundLen) { using namespace scex; ReturnValue_t result = OK; auto multiFileHandler = [&](std::string cmdName) { @@ -261,9 +264,9 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons default: // Unknown DeviceCommand - if(id == FRAM or id == ONE_CELL or id == ALL_CELLS_CMD) { - break; - } + if (id == FRAM or id == ONE_CELL or id == ALL_CELLS_CMD) { + break; + } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { From 8c0e261f449a80ef2a2da023d0be0ac915bcd4af Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Wed, 31 Aug 2022 10:58:21 +0200 Subject: [PATCH 087/361] ScexDeviceHandler: fileId includes date and time --- mission/devices/ScexDeviceHandler.cpp | 42 +++++++++++++++++---------- mission/devices/ScexDeviceHandler.h | 2 +- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 0c3049c8..bd9211a6 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -168,7 +169,7 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI ReturnValue_t result = OK; auto multiFileHandler = [&](std::string cmdName) { if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { - fileId = random_string(6); + fileId = date_time_string(); std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); oss << cmdName << fileId << ".bin"; fileName = oss.str(); @@ -230,7 +231,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons ReturnValue_t status = OK; auto oneFileHandler = [&](std::string cmdName) { - fileId = random_string(6); + fileId = date_time_string(); std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); oss << cmdName << fileId << ".bin"; fileName = oss.str(); @@ -298,23 +299,32 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo return OK; } -std::string ScexDeviceHandler::random_string(std::string::size_type length) { - static auto& chrs = - "0123456789" - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +std::string ScexDeviceHandler::date_time_string() { + using namespace std; + string date_time; + time_t now = time(0); + tm* ltm = localtime(&now); + ostringstream oss(std::ostringstream::ate); - thread_local static std::mt19937 rg{std::random_device{}()}; - thread_local static std::uniform_int_distribution pick(0, - sizeof(chrs) - 2); + if (ltm->tm_hour < 10) { + oss << 1900 + ltm->tm_year << 1 + ltm->tm_mon << ltm->tm_mday << "_0" << ltm->tm_hour; + } else { + oss << 1900 + ltm->tm_year << 1 + ltm->tm_mon << ltm->tm_mday << "_" << ltm->tm_hour; + } + if (ltm->tm_min < 10) { + oss << 0 << ltm->tm_min; + } else { + oss << ltm->tm_min; + } + if (ltm->tm_sec < 10) { + oss << 0 << ltm->tm_sec; + } else { + oss << ltm->tm_sec; + } - std::string s; + date_time = oss.str(); - s.reserve(length); - - while (length--) s += chrs[pick(rg)]; - - return s; + return date_time; } void ScexDeviceHandler::modeChanged() {} diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index 69436e0b..39d333f5 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -28,7 +28,7 @@ class ScexDeviceHandler : public DeviceHandlerBase { SdCardMountedIF *sdcMan = nullptr; Countdown finishCountdown = Countdown(LONG_CD); - std::string random_string(std::string::size_type length); + std::string date_time_string(); // DeviceHandlerBase private function implementation void doStartUp() override; From 74d47413807ab8f3267bfa3d0510c19b9bfed47d Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Wed, 31 Aug 2022 11:06:37 +0200 Subject: [PATCH 088/361] ScexDeviceHandler: adjusted comments --- mission/devices/ScexDeviceHandler.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index bd9211a6..2d614765 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -155,7 +155,7 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai if (commandActive and finishCountdown.hasTimedOut()) { triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); reader.finish(); - sif::warning << "ScexDeviceHandler::performOperationHook: Reader timeout; RemMillis: " + sif::warning << "ScexDeviceHandler::scanForReply: Reader timeout; RemMillis: " << remainingMillis << std::endl; fileNameSet = false; commandActive = false; @@ -176,7 +176,7 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI fileNameSet = true; ofstream out(fileName, ofstream::binary); if (out.bad()) { - sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName + sif::error << "ScexDeviceHandler::handleValidReply: Could not open file " << fileName << std::endl; return FAILED; } @@ -185,7 +185,7 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI ofstream out(fileName, ofstream::binary | ofstream::app); // append if (out.bad()) { - sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName + sif::error << "ScexDeviceHandler::handleValidReply: Could not open file " << fileName << std::endl; return FAILED; } @@ -202,7 +202,7 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI if (debugMode) { uint32_t remainingMillis = finishCountdown.getRemainingMillis(); - sif::info << "ScexDeviceHandler::interpretDeviceReply: RemMillis: " << remainingMillis + sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis << std::endl; } result = multiFileHandler("fram_"); @@ -226,7 +226,6 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI } ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { - // cmd auswertung (in file reinschreiben) using namespace scex; ReturnValue_t status = OK; From 839851914acf851c5f8ca5220010f86e9b77ca04 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Aug 2022 16:07:38 +0200 Subject: [PATCH 089/361] update SCEX code --- generators/bsp_q7s_events.csv | 4 +- generators/bsp_q7s_returnvalues.csv | 9 +- generators/events/translateEvents.cpp | 10 +- generators/objects/translateObjects.cpp | 2 +- linux/devices/ScexUartReader.cpp | 3 - linux/fsfwconfig/events/translateEvents.cpp | 10 +- linux/fsfwconfig/objects/translateObjects.cpp | 2 +- mission/devices/ScexDeviceHandler.cpp | 133 ++++++++++-------- mission/devices/ScexDeviceHandler.h | 1 + .../devicedefinitions/ScexDefinitions.h | 5 +- tmtc | 2 +- 11 files changed, 103 insertions(+), 78 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index c7001a82..a38aa4e9 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -215,4 +215,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h 13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h 13703;0x3587;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h -13800;0x35e8;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h +13800;0x35e8;MISSING_PACKET;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h +13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h +13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;;mission/devices/devicedefinitions/ScexDefinitions.h diff --git a/generators/bsp_q7s_returnvalues.csv b/generators/bsp_q7s_returnvalues.csv index ab196298..7a1e52f8 100644 --- a/generators/bsp_q7s_returnvalues.csv +++ b/generators/bsp_q7s_returnvalues.csv @@ -1,6 +1,6 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path -0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h -0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h +0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h +0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h 0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NVMParameterBase.h 0x58a0;SUSS_ErrorUnlockMutex;;160;SUS_HANDLER;mission/devices/SusHandler.h 0x58a1;SUSS_ErrorLockMutex;;161;SUS_HANDLER;mission/devices/SusHandler.h @@ -361,8 +361,9 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x2cd2;CCS_TooShortBlockedPacket;;210;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h 0x2cd3;CCS_TooShortMapExtraction;;211;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h 0x4201;PUS11_InvalidTypeTimeWindow;;1;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h -0x4202;PUS11_TimeshiftingNotPossible;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h -0x4203;PUS11_InvalidRelativeTime;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4202;PUS11_InvalidTimeWindow;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4203;PUS11_TimeshiftingNotPossible;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4204;PUS11_InvalidRelativeTime;;4;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h 0x3401;DC_NoReplyReceived;;1;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3402;DC_ProtocolError;;2;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3403;DC_Nullpointer;;3;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index dda8b717..4448112c 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 217 translations. + * @brief Auto-generated event translation file. Contains 219 translations. * @details - * Generated on: 2022-08-24 16:53:50 + * Generated on: 2022-08-31 16:07:07 */ #include "translateEvents.h" @@ -217,7 +217,9 @@ const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED"; const char *REBOOT_HW_STRING = "REBOOT_HW"; +const char *MISSING_PACKET_STRING = "MISSING_PACKET"; const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; +const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE"; const char *translateEvents(Event event) { switch ((event & 0xFFFF)) { @@ -646,7 +648,11 @@ const char *translateEvents(Event event) { case (13703): return REBOOT_HW_STRING; case (13800): + return MISSING_PACKET_STRING; + case (13801): return EXPERIMENT_TIMEDOUT_STRING; + case (13802): + return MULTI_PACKET_COMMAND_DONE_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 215d47d8..8f5c084f 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 135 translations. - * Generated on: 2022-08-24 16:53:50 + * Generated on: 2022-08-31 16:07:07 */ #include "translateObjects.h" diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index f1d0d037..57239ed5 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -34,7 +34,6 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { lock->unlockMutex(); while (true) { semaphore->acquire(); - sif::info << "ScexUartReader::performOperation:task was started" << std::endl; int bytesRead = 0; while (true) { bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), @@ -66,8 +65,6 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { } } }; - // task block comes here - sif::info << "ScexUartReader::performOperation: task was stopped" << std::endl; } return OK; } diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index dda8b717..4448112c 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 217 translations. + * @brief Auto-generated event translation file. Contains 219 translations. * @details - * Generated on: 2022-08-24 16:53:50 + * Generated on: 2022-08-31 16:07:07 */ #include "translateEvents.h" @@ -217,7 +217,9 @@ const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE"; const char *REBOOT_SW_STRING = "REBOOT_SW"; const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED"; const char *REBOOT_HW_STRING = "REBOOT_HW"; +const char *MISSING_PACKET_STRING = "MISSING_PACKET"; const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; +const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE"; const char *translateEvents(Event event) { switch ((event & 0xFFFF)) { @@ -646,7 +648,11 @@ const char *translateEvents(Event event) { case (13703): return REBOOT_HW_STRING; case (13800): + return MISSING_PACKET_STRING; + case (13801): return EXPERIMENT_TIMEDOUT_STRING; + case (13802): + return MULTI_PACKET_COMMAND_DONE_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 215d47d8..8f5c084f 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 135 translations. - * Generated on: 2022-08-24 16:53:50 + * Generated on: 2022-08-31 16:07:07 */ #include "translateObjects.h" diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 2d614765..71bb4302 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -94,9 +94,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); - // auto iter = deviceReplyMap.find(FRAM); - // auto& info = iter->second.command->second; - // actionHelper.finish(true,info.sendReplyTo, iter->first, OK); + updatePeriodicReply(true, deviceCommand); break; } case (ONE_CELL): { @@ -105,6 +103,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); + updatePeriodicReply(true, deviceCommand); break; } case (ALL_CELLS_CMD): { @@ -113,6 +112,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); + updatePeriodicReply(true, deviceCommand); break; } default: { @@ -130,11 +130,11 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(scex::Cmds::TEMP_CMD, 3); insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3); - insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, false, false, + insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, true, false, scex::Cmds::ALL_CELLS_CMD, &finishCountdown); - insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, false, false, + insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, true, false, scex::Cmds::ONE_CELL, &finishCountdown); - insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, false, false, scex::Cmds::FRAM, + insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, true, false, scex::Cmds::FRAM, &finishCountdown); insertInReplyMap(scex::Cmds::ERROR_REPLY, 3); @@ -167,6 +167,56 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI size_t* foundLen) { using namespace scex; ReturnValue_t result = OK; + + switch (helper.getCmd()) { + case (FRAM): { + if (debugMode) { + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + + sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis + << std::endl; + } + actionHelper.finish(true, getCommanderQueueId(FRAM), FRAM, result); + result = APERIODIC_REPLY; + break; + } + case (ONE_CELL): { + actionHelper.finish(true, getCommanderQueueId(ONE_CELL), ONE_CELL, result); + result = APERIODIC_REPLY; + break; + } + case (ALL_CELLS_CMD): { + actionHelper.finish(true, getCommanderQueueId(ALL_CELLS_CMD), ALL_CELLS_CMD, result); + result = APERIODIC_REPLY; + break; + } + default: { + break; + } + } + *foundId = helper.getCmd(); + *foundLen = remSize; + return result; +} + +ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { + using namespace scex; + + ReturnValue_t status = OK; + auto oneFileHandler = [&](std::string cmdName) { + fileId = date_time_string(); + std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); + oss << cmdName << fileId << ".bin"; + fileName = oss.str(); + ofstream out(fileName, ofstream::binary); + if (out.bad()) { + sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName + << std::endl; + return FAILED; + } + out << helper; + return OK; + }; auto multiFileHandler = [&](std::string cmdName) { if ((helper.getPacketCounter() == 1) or (not fileNameSet)) { fileId = date_time_string(); @@ -191,59 +241,8 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI } out << helper; } - if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { - *foundId = helper.getCmd(); - return OK; - } - return IGNORE_FULL_PACKET; - }; - switch (helper.getCmd()) { - case (FRAM): { - if (debugMode) { - uint32_t remainingMillis = finishCountdown.getRemainingMillis(); - - sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis - << std::endl; - } - result = multiFileHandler("fram_"); - break; - } - case (ONE_CELL): { - result = multiFileHandler("one_cell_"); - break; - } - case (ALL_CELLS_CMD): { - result = multiFileHandler("all_cell_"); - break; - } - default: { - *foundId = helper.getCmd(); - break; - } - } - *foundLen = remSize; - return result; -} - -ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { - using namespace scex; - - ReturnValue_t status = OK; - auto oneFileHandler = [&](std::string cmdName) { - fileId = date_time_string(); - std::ostringstream oss("/tmp/scex-", std::ostringstream::ate); - oss << cmdName << fileId << ".bin"; - fileName = oss.str(); - ofstream out(fileName, ofstream::binary); - if (out.bad()) { - sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName - << std::endl; - return FAILED; - } - out << helper; return OK; }; - switch (id) { case (PING): { status = oneFileHandler("ping_"); @@ -261,12 +260,20 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons status = oneFileHandler("exp_status_"); break; } - + case(FRAM): { + status = multiFileHandler("fram_"); + break; + } + case(ONE_CELL): { + status = multiFileHandler("one_cell_"); + break; + } + case(ALL_CELLS_CMD): { + status = multiFileHandler("multi_cell_"); + break; + } default: // Unknown DeviceCommand - if (id == FRAM or id == ONE_CELL or id == ALL_CELLS_CMD) { - break; - } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { @@ -276,6 +283,10 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons sif::info << "ScexDeviceHandler::interpretDeviceReply:Reader is finished" << std::endl; fileNameSet = false; } + if(id == FRAM or id == ALL_CELLS_CMD or id == ONE_CELL) { + triggerEvent(MULTI_PACKET_COMMAND_DONE, id); + updatePeriodicReply(false, id); + } } if (debugMode) { uint32_t remainingMillis = finishCountdown.getRemainingMillis(); diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index 39d333f5..62973e41 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -4,6 +4,7 @@ #include #include #include +#include "commonSubsystemIds.h" class SdCardMountedIF; diff --git a/mission/devices/devicedefinitions/ScexDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h index 685f0cc0..dfa20f3d 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -14,8 +14,9 @@ namespace scex { static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SCEX_HANDLER; static constexpr Event MISSING_PACKET = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); - -static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); +static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 1, severity::LOW); +//! FRAM, One Cell or All cells command finished. P1: Command ID +static constexpr Event MULTI_PACKET_COMMAND_DONE = event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO); enum Cmds : DeviceCommandId_t { PING = 0b00111, diff --git a/tmtc b/tmtc index b4d4a511..e1d84c5b 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b4d4a51164af69a22eedd645775061dbb51702b1 +Subproject commit e1d84c5b99e99ea9a9687dcd298d815dc4d8d2b6 From 7c15ecbad2b67117069ab6412dd772391586b86d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Aug 2022 16:12:32 +0200 Subject: [PATCH 090/361] apply afmt --- linux/devices/ScexUartReader.cpp | 1 - mission/devices/ScexDeviceHandler.cpp | 13 ++++++------- mission/devices/ScexDeviceHandler.h | 1 + mission/devices/devicedefinitions/ScexDefinitions.h | 3 ++- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index 57239ed5..ca7013c4 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -41,7 +41,6 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { if (bytesRead == 0) { MutexGuard mg(lock); if (state == States::FINISH) { - sif::debug << "ScexUartReader::performOperation:finish detected" << std::endl; state = States::IDLE; break; } diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 71bb4302..675d6093 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -132,8 +132,8 @@ void ScexDeviceHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, true, false, scex::Cmds::ALL_CELLS_CMD, &finishCountdown); - insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, true, false, - scex::Cmds::ONE_CELL, &finishCountdown); + insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, true, false, scex::Cmds::ONE_CELL, + &finishCountdown); insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, true, false, scex::Cmds::FRAM, &finishCountdown); @@ -260,15 +260,15 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons status = oneFileHandler("exp_status_"); break; } - case(FRAM): { + case (FRAM): { status = multiFileHandler("fram_"); break; } - case(ONE_CELL): { + case (ONE_CELL): { status = multiFileHandler("one_cell_"); break; } - case(ALL_CELLS_CMD): { + case (ALL_CELLS_CMD): { status = multiFileHandler("multi_cell_"); break; } @@ -280,10 +280,9 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons reader.finish(); commandActive = false; if (id != PING) { - sif::info << "ScexDeviceHandler::interpretDeviceReply:Reader is finished" << std::endl; fileNameSet = false; } - if(id == FRAM or id == ALL_CELLS_CMD or id == ONE_CELL) { + if (id == FRAM or id == ALL_CELLS_CMD or id == ONE_CELL) { triggerEvent(MULTI_PACKET_COMMAND_DONE, id); updatePeriodicReply(false, id); } diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index 62973e41..7fc47858 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -4,6 +4,7 @@ #include #include #include + #include "commonSubsystemIds.h" class SdCardMountedIF; diff --git a/mission/devices/devicedefinitions/ScexDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h index dfa20f3d..4abe1249 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -16,7 +16,8 @@ static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SCEX_HANDLER; static constexpr Event MISSING_PACKET = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 1, severity::LOW); //! FRAM, One Cell or All cells command finished. P1: Command ID -static constexpr Event MULTI_PACKET_COMMAND_DONE = event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO); +static constexpr Event MULTI_PACKET_COMMAND_DONE = + event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO); enum Cmds : DeviceCommandId_t { PING = 0b00111, From da7cedc910ad4412eb165f2ce1618a6a2492a3ac Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Aug 2022 16:37:15 +0200 Subject: [PATCH 091/361] perform finish in command builder --- fsfw | 2 +- mission/devices/ScexDeviceHandler.cpp | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/fsfw b/fsfw index 2fa76d36..cfca2754 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 2fa76d366325372e92a2188f71f143a485e652fc +Subproject commit cfca27542a3cabf58f9b7cab238c89ab9ad9beea diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 675d6093..9a5ebf11 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -95,6 +95,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); updatePeriodicReply(true, deviceCommand); + actionHelper.finish(true, getCommanderQueueId(deviceCommand), deviceCommand, OK); break; } case (ONE_CELL): { @@ -104,6 +105,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); updatePeriodicReply(true, deviceCommand); + actionHelper.finish(true, getCommanderQueueId(deviceCommand), deviceCommand, OK); break; } case (ALL_CELLS_CMD): { @@ -112,6 +114,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic finishCountdown.resetTimer(); prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {commandData + 1, commandDataLen - 1}, tempCheck); + actionHelper.finish(true, getCommanderQueueId(deviceCommand), deviceCommand, OK); updatePeriodicReply(true, deviceCommand); break; } @@ -151,15 +154,6 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai } else { result = handleValidReply(remainingSize, foundId, foundLen); } - uint32_t remainingMillis = finishCountdown.getRemainingMillis(); - if (commandActive and finishCountdown.hasTimedOut()) { - triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); - reader.finish(); - sif::warning << "ScexDeviceHandler::scanForReply: Reader timeout; RemMillis: " - << remainingMillis << std::endl; - fileNameSet = false; - commandActive = false; - } return result; } @@ -176,17 +170,14 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis << std::endl; } - actionHelper.finish(true, getCommanderQueueId(FRAM), FRAM, result); result = APERIODIC_REPLY; break; } case (ONE_CELL): { - actionHelper.finish(true, getCommanderQueueId(ONE_CELL), ONE_CELL, result); result = APERIODIC_REPLY; break; } case (ALL_CELLS_CMD): { - actionHelper.finish(true, getCommanderQueueId(ALL_CELLS_CMD), ALL_CELLS_CMD, result); result = APERIODIC_REPLY; break; } @@ -295,7 +286,17 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons return status; } -void ScexDeviceHandler::performOperationHook() {} +void ScexDeviceHandler::performOperationHook() { + uint32_t remainingMillis = finishCountdown.getRemainingMillis(); + if (commandActive and finishCountdown.hasTimedOut()) { + triggerEvent(scex::EXPERIMENT_TIMEDOUT, currCmd, 0); + reader.finish(); + sif::warning << "ScexDeviceHandler::scanForReply: Reader timeout; RemMillis: " + << remainingMillis << std::endl; + fileNameSet = false; + commandActive = false; + } +} uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return OK; } From 31b3de784bf6ccac6ce25107abe4c10614d53bfd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Sep 2022 17:00:49 +0200 Subject: [PATCH 092/361] stuff --- bsp_q7s/core/CoreController.cpp | 1 + bsp_q7s/memory/SdCardManager.cpp | 18 +++++++++++------- bsp_q7s/memory/SdCardManager.h | 2 +- fsfw | 2 +- mission/memory/SdCardMountedIF.h | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index de36b01a..02d7330d 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -384,6 +384,7 @@ ReturnValue_t CoreController::sdStateMachine() { if (nonBlockingOpChecking(SdStates::DETERMINE_OTHER, 5, "Mounting SD card")) { sdInfo.prefState = sd::SdState::MOUNTED; currentStateSetter(sdInfo.pref, sd::SdState::MOUNTED); + sdcMan->setActiveSdCard(sdInfo.pref); } } } diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/memory/SdCardManager.cpp index e2702771..ac0df040 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/memory/SdCardManager.cpp @@ -412,13 +412,9 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() { return result; } -std::string SdCardManager::getCurrentMountPrefix() const { +const std::string& SdCardManager::getCurrentMountPrefix() const { MutexGuard mg(mutex); - if (sdInfo.active == sd::SdCard::SLOT_0) { - return SD_0_MOUNT_POINT; - } else { - return SD_1_MOUNT_POINT; - } + return currentPrefix; } SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) { @@ -552,6 +548,14 @@ ReturnValue_t SdCardManager::performFsck(sd::SdCard sdcard, bool printOutput, in return result; } -void SdCardManager::setActiveSdCard(sd::SdCard sdCard) { sdInfo.active = sdCard; } +void SdCardManager::setActiveSdCard(sd::SdCard sdCard) { + sdInfo.active = sdCard; + MutexGuard mg(mutex); + if (sdInfo.active == sd::SdCard::SLOT_0) { + currentPrefix = SD_0_MOUNT_POINT; + } else { + currentPrefix = SD_1_MOUNT_POINT; + } +} sd::SdCard SdCardManager::getActiveSdCard() const { return sdInfo.active; } diff --git a/bsp_q7s/memory/SdCardManager.h b/bsp_q7s/memory/SdCardManager.h index 87ed91d7..14101b0e 100644 --- a/bsp_q7s/memory/SdCardManager.h +++ b/bsp_q7s/memory/SdCardManager.h @@ -188,7 +188,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF { * @param prefSdCardPtr * @return */ - std::string getCurrentMountPrefix() const override; + const std::string& getCurrentMountPrefix() const override; OpStatus checkCurrentOp(Operations& currentOp); diff --git a/fsfw b/fsfw index cfca2754..cf8fe7ea 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit cfca27542a3cabf58f9b7cab238c89ab9ad9beea +Subproject commit cf8fe7ea728bea077b9936bcf0db96845bc6419e diff --git a/mission/memory/SdCardMountedIF.h b/mission/memory/SdCardMountedIF.h index 853c7e8d..ff0bf190 100644 --- a/mission/memory/SdCardMountedIF.h +++ b/mission/memory/SdCardMountedIF.h @@ -8,7 +8,7 @@ class SdCardMountedIF { public: virtual ~SdCardMountedIF(){}; - virtual std::string getCurrentMountPrefix() const = 0; + virtual const std::string& getCurrentMountPrefix() const = 0; virtual bool isSdCardMounted(sd::SdCard sdCard) = 0; virtual sd::SdCard getPreferredSdCard() const = 0; virtual void setActiveSdCard(sd::SdCard sdCard) = 0; From 7bc866a105ab6575bdc759e19dae8c32c6de9338 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Sep 2022 17:09:27 +0200 Subject: [PATCH 093/361] add RPI SD card manager --- bsp_linux_board/RPiSdCardManager.cpp | 15 +++++++++++++++ bsp_linux_board/RPiSdCardManager.h | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 bsp_linux_board/RPiSdCardManager.cpp create mode 100644 bsp_linux_board/RPiSdCardManager.h diff --git a/bsp_linux_board/RPiSdCardManager.cpp b/bsp_linux_board/RPiSdCardManager.cpp new file mode 100644 index 00000000..7913f33a --- /dev/null +++ b/bsp_linux_board/RPiSdCardManager.cpp @@ -0,0 +1,15 @@ +#include "RPiSdCardManager.h" + +RPiSdCardManager::RPiSdCardManager() {} + +RPiSdCardManager::RPiSdCardManager(std::string prefix) {} + +const std::string& RPiSdCardManager::getCurrentMountPrefix() const {} + +bool RPiSdCardManager::isSdCardMounted(sd::SdCard sdCard) {} + +sd::SdCard RPiSdCardManager::getPreferredSdCard() const {} + +void RPiSdCardManager::setActiveSdCard(sd::SdCard sdCard) {} + +sd::SdCard RPiSdCardManager::getActiveSdCard() const {} diff --git a/bsp_linux_board/RPiSdCardManager.h b/bsp_linux_board/RPiSdCardManager.h new file mode 100644 index 00000000..68e20c78 --- /dev/null +++ b/bsp_linux_board/RPiSdCardManager.h @@ -0,0 +1,17 @@ +#ifndef BSP_LINUX_BOARD_RPISDCARDMANAGER_H_ +#define BSP_LINUX_BOARD_RPISDCARDMANAGER_H_ +#include + +class RPiSdCardManager: public SdCardMountedIF { +public: + RPiSdCardManager(std::string prefix); + const std::string& getCurrentMountPrefix() const override; + bool isSdCardMounted(sd::SdCard sdCard) override; + sd::SdCard getPreferredSdCard() const override; + void setActiveSdCard(sd::SdCard sdCard) override; + sd::SdCard getActiveSdCard() const override; +}; + + + +#endif /* BSP_LINUX_BOARD_RPISDCARDMANAGER_H_ */ From 002f776bef7a5afb284aefd1a072c3a4628bc7bb Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Mon, 12 Sep 2022 17:15:02 +0200 Subject: [PATCH 094/361] start RPiSdCardManager --- bsp_linux_board/RPiSdCardManager.cpp | 16 +++++++++++----- bsp_linux_board/RPiSdCardManager.h | 4 +++- fsfw | 2 +- mission/devices/ScexDeviceHandler.cpp | 6 +++++- tmtc | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/bsp_linux_board/RPiSdCardManager.cpp b/bsp_linux_board/RPiSdCardManager.cpp index 7913f33a..73111a83 100644 --- a/bsp_linux_board/RPiSdCardManager.cpp +++ b/bsp_linux_board/RPiSdCardManager.cpp @@ -1,14 +1,20 @@ #include "RPiSdCardManager.h" -RPiSdCardManager::RPiSdCardManager() {} +RPiSdCardManager::RPiSdCardManager(const std::string& prefix):prefix(prefix) { -RPiSdCardManager::RPiSdCardManager(std::string prefix) {} +} -const std::string& RPiSdCardManager::getCurrentMountPrefix() const {} +const std::string& RPiSdCardManager::getCurrentMountPrefix() const { + return prefix; +} -bool RPiSdCardManager::isSdCardMounted(sd::SdCard sdCard) {} +bool RPiSdCardManager::isSdCardMounted(sd::SdCard sdCard) { + return true; +} -sd::SdCard RPiSdCardManager::getPreferredSdCard() const {} +sd::SdCard RPiSdCardManager::getPreferredSdCard() const { + +} void RPiSdCardManager::setActiveSdCard(sd::SdCard sdCard) {} diff --git a/bsp_linux_board/RPiSdCardManager.h b/bsp_linux_board/RPiSdCardManager.h index 68e20c78..144cfe0e 100644 --- a/bsp_linux_board/RPiSdCardManager.h +++ b/bsp_linux_board/RPiSdCardManager.h @@ -4,12 +4,14 @@ class RPiSdCardManager: public SdCardMountedIF { public: - RPiSdCardManager(std::string prefix); + RPiSdCardManager(const std::string& prefix); const std::string& getCurrentMountPrefix() const override; bool isSdCardMounted(sd::SdCard sdCard) override; sd::SdCard getPreferredSdCard() const override; void setActiveSdCard(sd::SdCard sdCard) override; sd::SdCard getActiveSdCard() const override; +private: + std::string prefix; }; diff --git a/fsfw b/fsfw index cf8fe7ea..141dcb1f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit cf8fe7ea728bea077b9936bcf0db96845bc6419e +Subproject commit 141dcb1f149b824b5bd6e5d3339ecb712835751e diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 9a5ebf11..5f3f9aa0 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -312,17 +312,21 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo std::string ScexDeviceHandler::date_time_string() { using namespace std; string date_time; + Clock::TimeOfDay_t tod; + Clock::getDateAndTime(&tod); time_t now = time(0); tm* ltm = localtime(&now); ostringstream oss(std::ostringstream::ate); + //TODO mit tod ersetzen if (ltm->tm_hour < 10) { - oss << 1900 + ltm->tm_year << 1 + ltm->tm_mon << ltm->tm_mday << "_0" << ltm->tm_hour; + oss << tod.year << tod.month << ltm->tm_mday << "_0" << ltm->tm_hour; } else { oss << 1900 + ltm->tm_year << 1 + ltm->tm_mon << ltm->tm_mday << "_" << ltm->tm_hour; } if (ltm->tm_min < 10) { oss << 0 << ltm->tm_min; + } else { oss << ltm->tm_min; } diff --git a/tmtc b/tmtc index e1d84c5b..b4d4a511 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit e1d84c5b99e99ea9a9687dcd298d815dc4d8d2b6 +Subproject commit b4d4a51164af69a22eedd645775061dbb51702b1 From 4649a75d40e8d1c8be364dbf079cdc85c02260d7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Sep 2022 17:23:43 +0200 Subject: [PATCH 095/361] update to new API --- bsp_linux_board/RPiSdCardManager.cpp | 8 +++++--- bsp_linux_board/RPiSdCardManager.h | 4 ++-- bsp_q7s/core/CoreController.cpp | 12 ++++++++++-- bsp_q7s/memory/FileSystemHandler.cpp | 12 ++++++++---- bsp_q7s/memory/SdCardManager.cpp | 12 +++++------- bsp_q7s/memory/SdCardManager.h | 4 ++-- fsfw | 2 +- mission/devices/PayloadPcduHandler.cpp | 4 ++-- mission/memory/SdCardMountedIF.h | 6 +++--- tmtc | 2 +- 10 files changed, 39 insertions(+), 27 deletions(-) diff --git a/bsp_linux_board/RPiSdCardManager.cpp b/bsp_linux_board/RPiSdCardManager.cpp index 73111a83..264d3cfa 100644 --- a/bsp_linux_board/RPiSdCardManager.cpp +++ b/bsp_linux_board/RPiSdCardManager.cpp @@ -12,10 +12,12 @@ bool RPiSdCardManager::isSdCardMounted(sd::SdCard sdCard) { return true; } -sd::SdCard RPiSdCardManager::getPreferredSdCard() const { - +std::optional RPiSdCardManager::getPreferredSdCard() const { + return std::nullopt; } void RPiSdCardManager::setActiveSdCard(sd::SdCard sdCard) {} -sd::SdCard RPiSdCardManager::getActiveSdCard() const {} +std::optional RPiSdCardManager::getActiveSdCard() const { + return std::nullopt; +} diff --git a/bsp_linux_board/RPiSdCardManager.h b/bsp_linux_board/RPiSdCardManager.h index 144cfe0e..b1c1d2cc 100644 --- a/bsp_linux_board/RPiSdCardManager.h +++ b/bsp_linux_board/RPiSdCardManager.h @@ -7,9 +7,9 @@ public: RPiSdCardManager(const std::string& prefix); const std::string& getCurrentMountPrefix() const override; bool isSdCardMounted(sd::SdCard sdCard) override; - sd::SdCard getPreferredSdCard() const override; + std::optional getPreferredSdCard() const override; void setActiveSdCard(sd::SdCard sdCard) override; - sd::SdCard getActiveSdCard() const override; + std::optional getActiveSdCard() const override; private: std::string prefix; }; diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 02d7330d..6f774b6d 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -139,7 +139,11 @@ ReturnValue_t CoreController::initialize() { ReturnValue_t CoreController::initializeAfterTaskCreation() { ReturnValue_t result = returnvalue::OK; - sdInfo.pref = sdcMan->getPreferredSdCard(); + auto sdCard = sdcMan->getPreferredSdCard(); + if(not sdCard) { + return returnvalue::FAILED; + } + sdInfo.pref = sdCard.value(); sdcMan->setActiveSdCard(sdInfo.pref); currMntPrefix = sdcMan->getCurrentMountPrefix(); if (BLOCKING_SD_INIT) { @@ -337,7 +341,11 @@ ReturnValue_t CoreController::sdStateMachine() { if (sdInfo.state == SdStates::SET_STATE_SELF) { if (not sdInfo.commandExecuted) { result = sdcMan->getSdCardsStatus(sdInfo.currentState); - sdInfo.pref = sdcMan->getPreferredSdCard(); + auto sdCard = sdcMan->getPreferredSdCard(); + if(not sdCard) { + return returnvalue::FAILED; + } + sdInfo.pref = sdCard.value(); updateSdInfoOther(); if (sdInfo.pref != sd::SdCard::SLOT_0 and sdInfo.pref != sd::SdCard::SLOT_1) { sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl; diff --git a/bsp_q7s/memory/FileSystemHandler.cpp b/bsp_q7s/memory/FileSystemHandler.cpp index cb122383..2c5fb729 100644 --- a/bsp_q7s/memory/FileSystemHandler.cpp +++ b/bsp_q7s/memory/FileSystemHandler.cpp @@ -71,8 +71,8 @@ void FileSystemHandler::fileSystemHandlerLoop() { void FileSystemHandler::fileSystemCheckup() { SdCardManager::SdStatePair statusPair; sdcMan->getSdCardsStatus(statusPair); - sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard(); - if ((preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) { + auto preferredSdCard = sdcMan->getPreferredSdCard(); + if (preferredSdCard and (preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) { currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT; } else if ((preferredSdCard == sd::SdCard::SLOT_1) and (statusPair.second == sd::SdState::MOUNTED)) { @@ -90,7 +90,7 @@ void FileSystemHandler::fileSystemCheckup() { sif::warning << "Preferred SD card is " << sdString << " but does not appear to be mounted. Attempting fix.." << std::endl; // This function will appear to fix the inconsistent state - ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard); + ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard.value()); if (result != returnvalue::OK) { // Oh no. triggerEvent(SdCardManager::SANITIZATION_FAILED, 0, 0); @@ -108,7 +108,11 @@ ReturnValue_t FileSystemHandler::initialize() { << std::endl; } sdcMan = SdCardManager::instance(); - sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard(); + auto sdCard = sdcMan->getPreferredSdCard(); + if(not sdCard) { + return returnvalue::FAILED; + } + sd::SdCard preferredSdCard = sdCard.value(); if (preferredSdCard == sd::SdCard::SLOT_0) { currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT; } else if (preferredSdCard == sd::SdCard::SLOT_1) { diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/memory/SdCardManager.cpp index ac0df040..c1b2b8de 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/memory/SdCardManager.cpp @@ -300,11 +300,6 @@ ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard p blocking = true; resetNonBlockingState = true; } - if (prefSdCard == sd::SdCard::NONE) { - result = getPreferredSdCard(); - if (result != returnvalue::OK) { - } - } if (statusPair == nullptr) { sdStatusPtr = std::make_unique(); statusPair = sdStatusPtr.get(); @@ -379,7 +374,7 @@ void SdCardManager::processSdStatusLine(std::pair& act idx++; } -sd::SdCard SdCardManager::getPreferredSdCard() const { +std::optional SdCardManager::getPreferredSdCard() const { MutexGuard mg(mutex); auto res = mg.getLockResult(); if (res != returnvalue::OK) { @@ -558,4 +553,7 @@ void SdCardManager::setActiveSdCard(sd::SdCard sdCard) { } } -sd::SdCard SdCardManager::getActiveSdCard() const { return sdInfo.active; } +std::optional SdCardManager::getActiveSdCard() const { + MutexGuard mg(mutex); + return sdInfo.active; +} diff --git a/bsp_q7s/memory/SdCardManager.h b/bsp_q7s/memory/SdCardManager.h index 14101b0e..d8bafe25 100644 --- a/bsp_q7s/memory/SdCardManager.h +++ b/bsp_q7s/memory/SdCardManager.h @@ -92,7 +92,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF { * @param sdCard * @return */ - sd::SdCard getPreferredSdCard() const override; + std::optional getPreferredSdCard() const override; /** * Switch on the specified SD card. @@ -159,7 +159,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF { * mounted * @return */ - sd::SdCard getActiveSdCard() const override; + std::optional getActiveSdCard() const override; /** * Unmount the specified SD card. This is recommended before switching it off. The SD card diff --git a/fsfw b/fsfw index 141dcb1f..cf8fe7ea 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 141dcb1f149b824b5bd6e5d3339ecb712835751e +Subproject commit cf8fe7ea728bea077b9936bcf0db96845bc6419e diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index e643a945..c811f5d3 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -491,8 +491,8 @@ void PayloadPcduHandler::checkAdcValues() { void PayloadPcduHandler::checkJsonFileInit() { if (not jsonFileInitComplete) { - sd::SdCard activeSd = sdcMan->getActiveSdCard(); - if (sdcMan->isSdCardMounted(activeSd)) { + auto activeSd = sdcMan->getActiveSdCard(); + if (activeSd and sdcMan->isSdCardMounted(activeSd.value())) { params.initialize(sdcMan->getCurrentMountPrefix()); jsonFileInitComplete = true; } diff --git a/mission/memory/SdCardMountedIF.h b/mission/memory/SdCardMountedIF.h index ff0bf190..3dd529d4 100644 --- a/mission/memory/SdCardMountedIF.h +++ b/mission/memory/SdCardMountedIF.h @@ -2,7 +2,7 @@ #define MISSION_MEMORY_SDCARDMOUNTERIF_H_ #include - +#include #include "definitions.h" class SdCardMountedIF { @@ -10,9 +10,9 @@ class SdCardMountedIF { virtual ~SdCardMountedIF(){}; virtual const std::string& getCurrentMountPrefix() const = 0; virtual bool isSdCardMounted(sd::SdCard sdCard) = 0; - virtual sd::SdCard getPreferredSdCard() const = 0; + virtual std::optional getPreferredSdCard() const = 0; virtual void setActiveSdCard(sd::SdCard sdCard) = 0; - virtual sd::SdCard getActiveSdCard() const = 0; + virtual std::optional getActiveSdCard() const = 0; private: }; diff --git a/tmtc b/tmtc index b4d4a511..e1d84c5b 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b4d4a51164af69a22eedd645775061dbb51702b1 +Subproject commit e1d84c5b99e99ea9a9687dcd298d815dc4d8d2b6 From fb3214fef9bfd03e22477ef6ffab23573c551776 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Sep 2022 17:25:20 +0200 Subject: [PATCH 096/361] swap order --- bsp_q7s/memory/SdCardManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/memory/SdCardManager.cpp index c1b2b8de..d4b22e59 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/memory/SdCardManager.cpp @@ -544,8 +544,8 @@ ReturnValue_t SdCardManager::performFsck(sd::SdCard sdcard, bool printOutput, in } void SdCardManager::setActiveSdCard(sd::SdCard sdCard) { - sdInfo.active = sdCard; MutexGuard mg(mutex); + sdInfo.active = sdCard; if (sdInfo.active == sd::SdCard::SLOT_0) { currentPrefix = SD_0_MOUNT_POINT; } else { From 38f435d1ae499d96bca3ef38a37ada11e0990ce1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 11:43:11 +0200 Subject: [PATCH 097/361] update for new FSFW code --- bsp_q7s/boardtest/Q7STestTask.cpp | 145 +---------- bsp_q7s/core/ObjectFactory.cpp | 6 +- bsp_q7s/memory/CMakeLists.txt | 2 +- bsp_q7s/memory/FileSystemHandler.cpp | 238 ------------------- bsp_q7s/memory/FileSystemHandler.h | 68 ------ bsp_q7s/memory/helpers.cpp | 8 + bsp_q7s/memory/helpers.h | 15 ++ fsfw | 2 +- linux/devices/ploc/PlocSupervisorHandler.cpp | 2 +- linux/obc/PtmeConfig.h | 2 +- mission/core/GenericFactory.cpp | 4 +- mission/devices/SusHandler.h | 3 +- mission/devices/devicedefinitions/SpBase.h | 2 +- mission/memory/NVMParameterBase.cpp | 2 +- mission/tmtc/CCSDSHandler.cpp | 6 +- mission/tmtc/CCSDSHandler.h | 5 +- mission/tmtc/TmFunnel.cpp | 2 + mission/tmtc/TmFunnel.h | 7 +- mission/tmtc/VirtualChannel.cpp | 3 + mission/tmtc/VirtualChannel.h | 2 + 20 files changed, 53 insertions(+), 471 deletions(-) delete mode 100644 bsp_q7s/memory/FileSystemHandler.cpp delete mode 100644 bsp_q7s/memory/FileSystemHandler.h create mode 100644 bsp_q7s/memory/helpers.cpp create mode 100644 bsp_q7s/memory/helpers.h diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 28c88ad2..3e08bf13 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -1,7 +1,6 @@ #include "Q7STestTask.h" #include -#include #include #include #include @@ -17,6 +16,7 @@ #include #include +#include "OBSWConfig.h" #include "bsp_q7s/memory/SdCardManager.h" #include "bsp_q7s/memory/scratchApi.h" #include "fsfw/tasks/TaskFactory.h" @@ -365,148 +365,7 @@ void Q7STestTask::testGpsDaemonSocket() { sif::info << "Longitude: " << gps->fix.longitude << std::endl; } -void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { - auto fsHandler = ObjectManager::instance()->get(objects::FILE_SYSTEM_HANDLER); - if (fsHandler == nullptr) { - sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.." - << std::endl; - } - FileSystemHandler::FsCommandCfg cfg = {}; - ReturnValue_t result = returnvalue::OK; - - // Lambda for common code - auto createNonEmptyTmpDir = [&]() { - if (not std::filesystem::exists("/tmp/test")) { - result = fsHandler->createDirectory("/tmp", "test", false, &cfg); - if (result != returnvalue::OK) { - return result; - } - } - // Creating sample files - sif::info << "Creating sample files in directory" << std::endl; - result = fsHandler->createFile("/tmp/test", "test1.txt", nullptr, 0, &cfg); - if (result != returnvalue::OK) { - return result; - } - result = fsHandler->createFile("/tmp/test", "test2.txt", nullptr, 0, &cfg); - if (result != returnvalue::OK) { - return result; - } - return result; - }; - - switch (opCode) { - case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): { - // No mount prefix, cause file is created in tmp - cfg.useMountPrefix = false; - sif::info << "Creating empty file in /tmp folder" << std::endl; - // Do not delete file, user can check existence in shell - fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); - break; - } - case (FsOpCodes::REMOVE_TMP_FILE): { - sif::info << "Deleting /tmp/test.txt sample file" << std::endl; - // No mount prefix, cause file is created in tmp - cfg.useMountPrefix = false; - if (not std::filesystem::exists("/tmp/test.txt")) { - // Creating sample file - sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl; - fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); - } - result = fsHandler->removeFile("/tmp", "test.txt", &cfg); - if (result == returnvalue::OK) { - sif::info << "File removed successfully" << std::endl; - } else { - sif::warning << "File removal failed!" << std::endl; - } - break; - } - case (FsOpCodes::CREATE_DIR_IN_TMP): { - // No mount prefix, cause file is created in tmp - cfg.useMountPrefix = false; - sif::info << "Creating empty file in /tmp folder" << std::endl; - // Do not delete file, user can check existence in shell - ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg); - if (result == returnvalue::OK) { - sif::info << "Directory created successfully" << std::endl; - } else { - sif::warning << "Directory creation failed!" << std::endl; - } - break; - } - case (FsOpCodes::REMOVE_EMPTY_DIR_IN_TMP): { - // No mount prefix, cause file is created in tmp - cfg.useMountPrefix = false; - if (not std::filesystem::exists("/tmp/test")) { - result = fsHandler->createDirectory("/tmp", "test", false, &cfg); - } else { - // Delete any leftover files to regular dir removal works - std::remove("/tmp/test/*"); - } - result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg); - if (result == returnvalue::OK) { - sif::info << "Directory removed successfully" << std::endl; - } else { - sif::warning << "Directory removal failed!" << std::endl; - } - break; - } - case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): { - result = createNonEmptyTmpDir(); - if (result != returnvalue::OK) { - return; - } - result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg); - if (result == returnvalue::OK) { - sif::info << "Directory removed recursively successfully" << std::endl; - } else { - sif::warning << "Recursive directory removal failed!" << std::endl; - } - break; - } - case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): { - result = createNonEmptyTmpDir(); - if (result != returnvalue::OK) { - return; - } - result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg); - if (result != returnvalue::OK) { - sif::info << "Directory removal attempt failed as expected" << std::endl; - } else { - sif::warning << "Directory removal worked when it should not have!" << std::endl; - } - break; - } - case (FsOpCodes::RENAME_FILE): { - // No mount prefix, cause file is created in tmp - cfg.useMountPrefix = false; - if (std::filesystem::exists("/tmp/test.txt")) { - fsHandler->removeDirectory("/tmp/", "test", false, &cfg); - } - sif::info << "Creating empty file /tmp/test.txt and rename to /tmp/test2.txt" << std::endl; - // Do not delete file, user can check existence in shell - fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); - fsHandler->renameFile("/tmp/", "test.txt", "test2.txt", &cfg); - break; - } - case (FsOpCodes::APPEND_TO_FILE): { - // No mount prefix, cause file is created in tmp - cfg.useMountPrefix = false; - if (std::filesystem::exists("/tmp/test.txt")) { - fsHandler->removeDirectory("/tmp/", "test", false, &cfg); - } - if (std::filesystem::exists("/tmp/test.txt")) { - fsHandler->removeDirectory("/tmp/", "test", false, &cfg); - } - sif::info << "Creating empty file /tmp/test.txt and adding content" << std::endl; - std::string content = "Hello World\n"; - // Do not delete file, user can check existence in shell - fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); - fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast(content.data()), - content.size(), 0, &cfg); - } - } -} +void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {} void Q7STestTask::xadcTest() { ReturnValue_t result = returnvalue::OK; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 6627d90d..40379f69 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -6,7 +6,6 @@ #include "bsp_q7s/callbacks/pcduSwitchCb.h" #include "bsp_q7s/callbacks/q7sGpioCallbacks.h" #include "bsp_q7s/callbacks/rwSpiCallback.h" -#include "bsp_q7s/memory/FileSystemHandler.h" #include "busConf.h" #include "ccsdsConfig.h" #include "devConf.h" @@ -908,10 +907,7 @@ void ObjectFactory::createBpxBatteryComponent() { #endif } -void ObjectFactory::createMiscComponents() { - new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); - new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); -} +void ObjectFactory::createMiscComponents() { new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); } void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) { CommandMessage msg; diff --git a/bsp_q7s/memory/CMakeLists.txt b/bsp_q7s/memory/CMakeLists.txt index d8ba4347..8598f44c 100644 --- a/bsp_q7s/memory/CMakeLists.txt +++ b/bsp_q7s/memory/CMakeLists.txt @@ -1,2 +1,2 @@ -target_sources(${OBSW_NAME} PRIVATE FileSystemHandler.cpp SdCardManager.cpp +target_sources(${OBSW_NAME} PRIVATE helpers.cpp SdCardManager.cpp scratchApi.cpp FilesystemHelper.cpp) diff --git a/bsp_q7s/memory/FileSystemHandler.cpp b/bsp_q7s/memory/FileSystemHandler.cpp deleted file mode 100644 index cb122383..00000000 --- a/bsp_q7s/memory/FileSystemHandler.cpp +++ /dev/null @@ -1,238 +0,0 @@ -#include "FileSystemHandler.h" - -#include -#include -#include - -#include "bsp_q7s/core/CoreController.h" -#include "fsfw/ipc/QueueFactory.h" -#include "fsfw/memory/GenericFileSystemMessage.h" -#include "fsfw/tasks/TaskFactory.h" - -FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler) - : SystemObject(fileSystemHandler) { - auto mqArgs = MqArgs(this->getObjectId()); - mq = QueueFactory::instance()->createMessageQueue(FS_MAX_QUEUE_SIZE, - MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); -} - -FileSystemHandler::~FileSystemHandler() { QueueFactory::instance()->deleteMessageQueue(mq); } - -ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) { - while (true) { - try { - fileSystemHandlerLoop(); - } catch (std::bad_alloc& e) { - // Restart OBSW, hints at a memory leak - sif::error << "Allocation error in FileSystemHandler::performOperation" << e.what() - << std::endl; - // Set up an error file or a special flag in the scratch buffer for these cases - triggerEvent(CoreController::ALLOC_FAILURE, 0, 0); - CoreController::incrementAllocationFailureCount(); - } - } -} - -void FileSystemHandler::fileSystemHandlerLoop() { - CommandMessage filemsg; - ReturnValue_t result = returnvalue::OK; - while (true) { - if (opCounter % 5 == 0) { - if (coreCtrl->sdInitFinished()) { - fileSystemCheckup(); - } - } - result = mq->receiveMessage(&filemsg); - if (result == MessageQueueIF::EMPTY) { - break; - } else if (result != returnvalue::FAILED) { - sif::warning << "FileSystemHandler::performOperation: Message reception failed!" << std::endl; - break; - } - Command_t command = filemsg.getCommand(); - switch (command) { - case (GenericFileSystemMessage::CMD_CREATE_DIRECTORY): { - break; - } - case (GenericFileSystemMessage::CMD_CREATE_FILE): { - break; - } - } - opCounter++; - } - - // This task will have a low priority and will run permanently in the background - // so we will just run in a permanent loop here and check file system - // messages permanently - opCounter++; - TaskFactory::instance()->delayTask(1000); -} - -void FileSystemHandler::fileSystemCheckup() { - SdCardManager::SdStatePair statusPair; - sdcMan->getSdCardsStatus(statusPair); - sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard(); - if ((preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) { - currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT; - } else if ((preferredSdCard == sd::SdCard::SLOT_1) and - (statusPair.second == sd::SdState::MOUNTED)) { - currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT; - } else { - std::string sdString; - if (preferredSdCard == sd::SdCard::SLOT_0) { - sdString = "0"; - } else { - sdString = "1"; - } - sif::warning << "FileSystemHandler::performOperation: " - "Inconsistent state detected" - << std::endl; - sif::warning << "Preferred SD card is " << sdString - << " but does not appear to be mounted. Attempting fix.." << std::endl; - // This function will appear to fix the inconsistent state - ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard); - if (result != returnvalue::OK) { - // Oh no. - triggerEvent(SdCardManager::SANITIZATION_FAILED, 0, 0); - sif::error << "FileSystemHandler::fileSystemCheckup: Sanitization failed" << std::endl; - } - } -} - -MessageQueueId_t FileSystemHandler::getCommandQueue() const { return mq->getId(); } - -ReturnValue_t FileSystemHandler::initialize() { - coreCtrl = ObjectManager::instance()->get(objects::CORE_CONTROLLER); - if (coreCtrl == nullptr) { - sif::error << "FileSystemHandler::initialize: Could not retrieve core controller handle" - << std::endl; - } - sdcMan = SdCardManager::instance(); - sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard(); - if (preferredSdCard == sd::SdCard::SLOT_0) { - currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT; - } else if (preferredSdCard == sd::SdCard::SLOT_1) { - currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT; - } - return returnvalue::OK; -} - -ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const char* filename, - const uint8_t* data, size_t size, - uint16_t packetNumber, FileSystemArgsIF* args) { - auto path = getInitPath(args) / repositoryPath / filename; - if (not std::filesystem::exists(path)) { - return FILE_DOES_NOT_EXIST; - } - std::ofstream file(path, std::ios_base::app | std::ios_base::out); - file.write(reinterpret_cast(data), size); - if (not file.good()) { - return GENERIC_FILE_ERROR; - } - return returnvalue::OK; -} - -ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const char* filename, - const uint8_t* data, size_t size, - FileSystemArgsIF* args) { - auto path = getInitPath(args) / filename; - if (std::filesystem::exists(path)) { - return FILE_ALREADY_EXISTS; - } - std::ofstream file(path); - file.write(reinterpret_cast(data), size); - if (not file.good()) { - return GENERIC_FILE_ERROR; - } - return returnvalue::OK; -} - -ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const char* filename, - FileSystemArgsIF* args) { - auto path = getInitPath(args) / repositoryPath / filename; - if (not std::filesystem::exists(path)) { - return FILE_DOES_NOT_EXIST; - } - int result = std::remove(path.c_str()); - if (result != 0) { - sif::warning << "FileSystemHandler::deleteFile: Failed with code " << result << std::endl; - return GENERIC_FILE_ERROR; - } - return returnvalue::OK; -} - -ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, const char* dirname, - bool createParentDirs, FileSystemArgsIF* args) { - auto path = getInitPath(args) / repositoryPath / dirname; - if (std::filesystem::exists(path)) { - return DIRECTORY_ALREADY_EXISTS; - } - if (std::filesystem::create_directory(path)) { - return returnvalue::OK; - } - sif::warning << "Creating directory " << path << " failed" << std::endl; - return GENERIC_FILE_ERROR; -} - -ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, const char* dirname, - bool deleteRecurively, FileSystemArgsIF* args) { - auto path = getInitPath(args) / repositoryPath / dirname; - if (not std::filesystem::exists(path)) { - return DIRECTORY_DOES_NOT_EXIST; - } - std::error_code err; - if (not deleteRecurively) { - if (std::filesystem::remove(path, err)) { - return returnvalue::OK; - } else { - // Check error code. Most probably denied permissions because folder is not empty - sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with " - "code " - << err.value() << ": " << strerror(err.value()) << std::endl; - if (err.value() == ENOTEMPTY) { - return DIRECTORY_NOT_EMPTY; - } else { - return GENERIC_FILE_ERROR; - } - } - } else { - if (std::filesystem::remove_all(path, err)) { - return returnvalue::OK; - } else { - sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with " - "code " - << err.value() << ": " << strerror(err.value()) << std::endl; - // Check error code - if (err.value() == ENOTEMPTY) { - return DIRECTORY_NOT_EMPTY; - } else { - return GENERIC_FILE_ERROR; - } - } - } - - return returnvalue::OK; -} - -ReturnValue_t FileSystemHandler::renameFile(const char* repositoryPath, const char* oldFilename, - const char* newFilename, FileSystemArgsIF* args) { - auto basepath = getInitPath(args) / repositoryPath; - std::filesystem::rename(basepath / oldFilename, basepath / newFilename); - return returnvalue::OK; -} - -void FileSystemHandler::parseCfg(FsCommandCfg* cfg, bool& useMountPrefix) { - if (cfg != nullptr) { - useMountPrefix = cfg->useMountPrefix; - } -} - -std::filesystem::path FileSystemHandler::getInitPath(FileSystemArgsIF* args) { - bool useMountPrefix = true; - parseCfg(reinterpret_cast(args), useMountPrefix); - std::string path; - if (useMountPrefix) { - path = currentMountPrefix; - } - return std::filesystem::path(path); -} diff --git a/bsp_q7s/memory/FileSystemHandler.h b/bsp_q7s/memory/FileSystemHandler.h deleted file mode 100644 index 282cddba..00000000 --- a/bsp_q7s/memory/FileSystemHandler.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_ -#define BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_ - -#include -#include - -#include "OBSWConfig.h" -#include "SdCardManager.h" -#include "eive/definitions.h" -#include "fsfw/ipc/MessageQueueIF.h" -#include "fsfw/memory/HasFileSystemIF.h" -#include "fsfw/objectmanager/SystemObject.h" -#include "fsfw/tasks/ExecutableObjectIF.h" - -class CoreController; - -class FileSystemHandler : public SystemObject, public ExecutableObjectIF, public HasFileSystemIF { - public: - struct FsCommandCfg : public FileSystemArgsIF { - // Can be used to automatically use mount prefix of active SD card. - // Otherwise, the operator has to specify the full path to the mounted SD card as well. - bool useMountPrefix = false; - }; - - FileSystemHandler(object_id_t fileSystemHandler); - virtual ~FileSystemHandler(); - - ReturnValue_t performOperation(uint8_t) override; - - ReturnValue_t initialize() override; - - /** - * Function to get the MessageQueueId_t of the implementing object - * @return MessageQueueId_t of the object - */ - MessageQueueId_t getCommandQueue() const override; - ReturnValue_t appendToFile(const char* repositoryPath, const char* filename, const uint8_t* data, - size_t size, uint16_t packetNumber, - FileSystemArgsIF* args = nullptr) override; - ReturnValue_t createFile(const char* repositoryPath, const char* filename, - const uint8_t* data = nullptr, size_t size = 0, - FileSystemArgsIF* args = nullptr) override; - ReturnValue_t removeFile(const char* repositoryPath, const char* filename, - FileSystemArgsIF* args = nullptr) override; - ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname, - bool createParentDirs, FileSystemArgsIF* args = nullptr) override; - ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname, - bool deleteRecurively = false, - FileSystemArgsIF* args = nullptr) override; - ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename, - const char* newFilename, FileSystemArgsIF* args = nullptr) override; - - private: - CoreController* coreCtrl = nullptr; - MessageQueueIF* mq = nullptr; - std::string currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT; - static constexpr uint32_t FS_MAX_QUEUE_SIZE = config::OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE; - - SdCardManager* sdcMan = nullptr; - uint8_t opCounter = 0; - - void fileSystemHandlerLoop(); - void fileSystemCheckup(); - std::filesystem::path getInitPath(FileSystemArgsIF* args); - void parseCfg(FsCommandCfg* cfg, bool& useMountPrefix); -}; - -#endif /* BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_ */ diff --git a/bsp_q7s/memory/helpers.cpp b/bsp_q7s/memory/helpers.cpp new file mode 100644 index 00000000..20ce8195 --- /dev/null +++ b/bsp_q7s/memory/helpers.cpp @@ -0,0 +1,8 @@ +#include "helpers.h" + +std::filesystem::path fshelpers::buildPrefixedPath(SdCardManager &man, + std::filesystem::path pathWihtoutPrefix) { + auto prefix = man.getCurrentMountPrefix(); + auto resPath = prefix / pathWihtoutPrefix; + return resPath; +} diff --git a/bsp_q7s/memory/helpers.h b/bsp_q7s/memory/helpers.h new file mode 100644 index 00000000..16c5f7c8 --- /dev/null +++ b/bsp_q7s/memory/helpers.h @@ -0,0 +1,15 @@ +#ifndef BSP_Q7S_MEMORY_HELPERS_H_ +#define BSP_Q7S_MEMORY_HELPERS_H_ + +#include + +#include + +namespace fshelpers { + +std::filesystem::path buildPrefixedPath(SdCardManager& man, + std::filesystem::path pathWihtoutPrefix); + +} + +#endif /* BSP_Q7S_MEMORY_HELPERS_H_ */ diff --git a/fsfw b/fsfw index 7e0a5d5a..3d2fc284 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7e0a5d5a9e4f38c6d818bbdd5b44d34d8007eb1e +Subproject commit 3d2fc2846833ee9c125d11107bbd56b3e13536f1 diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 3846e4a4..f36c5a8d 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -1,6 +1,6 @@ #include "PlocSupervisorHandler.h" -#include +#include #include #include diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index aa5c663a..9c5a85af 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -4,8 +4,8 @@ #include "AxiPtmeConfig.h" #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/returnvalues/returnvalue.h" -#include "returnvalues/classIds.h" #include "linux/obc/PtmeConfig.h" +#include "returnvalues/classIds.h" /** * @brief Class to configure donwlink specific parameters in the PTME IP core. diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index bbd2bb98..0c6ab421 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -75,7 +75,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { new PoolManager(objects::IPC_STORE, poolCfg); } - auto* ccsdsDistrib = new CCSDSDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR); + auto* ccsdsDistrib = new CcsdsDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR); new PusDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR, ccsdsDistrib); uint8_t vc = 0; diff --git a/mission/devices/SusHandler.h b/mission/devices/SusHandler.h index 94673c40..5645c47d 100644 --- a/mission/devices/SusHandler.h +++ b/mission/devices/SusHandler.h @@ -4,10 +4,9 @@ #include #include "devicedefinitions/SusDefinitions.h" +#include "events/subsystemIdRanges.h" #include "fsfw/globalfunctions/PeriodicOperationDivider.h" #include "mission/devices/max1227.h" - -#include "events/subsystemIdRanges.h" #include "returnvalues/classIds.h" /** diff --git a/mission/devices/devicedefinitions/SpBase.h b/mission/devices/devicedefinitions/SpBase.h index 2bcaa1dc..caa14d5f 100644 --- a/mission/devices/devicedefinitions/SpBase.h +++ b/mission/devices/devicedefinitions/SpBase.h @@ -39,7 +39,7 @@ class SpTcBase { } void updateSpFields() { - spParams.creator.setDataLen(spParams.dataFieldLen - 1); + spParams.creator.setDataLenField(spParams.dataFieldLen - 1); spParams.creator.setPacketType(ccsds::PacketType::TC); } diff --git a/mission/memory/NVMParameterBase.cpp b/mission/memory/NVMParameterBase.cpp index 38fa45bb..d656ccca 100644 --- a/mission/memory/NVMParameterBase.cpp +++ b/mission/memory/NVMParameterBase.cpp @@ -2,7 +2,7 @@ #include -#include "fsfw/memory/HasFileSystemIF.h" +#include "fsfw/filesystem/HasFileSystemIF.h" #include "fsfw/serviceinterface/ServiceInterface.h" NVMParameterBase::NVMParameterBase(std::string fullName) : fullName(fullName) {} diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index 06499ff6..b3b03d40 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -203,9 +203,9 @@ ReturnValue_t CCSDSHandler::getParameter(uint8_t domainId, uint8_t uniqueIdentif return returnvalue::OK; } -uint16_t CCSDSHandler::getIdentifier() { return 0; } +uint32_t CCSDSHandler::getIdentifier() const { return 0; } -MessageQueueId_t CCSDSHandler::getRequestQueue() { +MessageQueueId_t CCSDSHandler::getRequestQueue() const { // Forward packets directly to TC distributor return tcDistributorQueueId; } @@ -345,3 +345,5 @@ void CCSDSHandler::disableTransmit() { forwardLinkstate(); transmitterCountdown.setTimeout(0); } + +const char* CCSDSHandler::getName() const { return "CCSDS Handler"; } diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index 31a546b5..035f9e31 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -72,8 +72,9 @@ class CCSDSHandler : public SystemObject, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex); - uint16_t getIdentifier() override; - MessageQueueId_t getRequestQueue() override; + uint32_t getIdentifier() const override; + MessageQueueId_t getRequestQueue() const override; + const char* getName() const override; virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size); diff --git a/mission/tmtc/TmFunnel.cpp b/mission/tmtc/TmFunnel.cpp index f3543404..49e9ba6e 100644 --- a/mission/tmtc/TmFunnel.cpp +++ b/mission/tmtc/TmFunnel.cpp @@ -121,3 +121,5 @@ ReturnValue_t TmFunnel::initialize() { return SystemObject::initialize(); } + +const char* TmFunnel::getName() const { return "TM Funnel"; } diff --git a/mission/tmtc/TmFunnel.h b/mission/tmtc/TmFunnel.h index f4c9d14e..325f3709 100644 --- a/mission/tmtc/TmFunnel.h +++ b/mission/tmtc/TmFunnel.h @@ -28,9 +28,10 @@ class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public Sy uint8_t reportReceptionVc = 0); virtual ~TmFunnel(); - virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; - virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; - virtual ReturnValue_t initialize() override; + const char* getName() const override; + MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; + ReturnValue_t performOperation(uint8_t operationCode = 0) override; + ReturnValue_t initialize() override; protected: static object_id_t downlinkDestination; diff --git a/mission/tmtc/VirtualChannel.cpp b/mission/tmtc/VirtualChannel.cpp index 46ba3fe3..6ba404e4 100644 --- a/mission/tmtc/VirtualChannel.cpp +++ b/mission/tmtc/VirtualChannel.cpp @@ -12,6 +12,7 @@ VirtualChannel::VirtualChannel(uint8_t vcId, uint32_t tmQueueDepth, object_id_t auto mqArgs = MqArgs(ownerId, reinterpret_cast(vcId)); tmQueue = QueueFactory::instance()->createMessageQueue( tmQueueDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); + vcName = "VC " + vcId; } ReturnValue_t VirtualChannel::initialize() { @@ -65,3 +66,5 @@ void VirtualChannel::setPtmeObject(PtmeIF* ptme_) { } void VirtualChannel::setLinkState(bool linkIsUp_) { linkIsUp = linkIsUp_; } + +const char* VirtualChannel::getName() const { return vcName.c_str(); } diff --git a/mission/tmtc/VirtualChannel.h b/mission/tmtc/VirtualChannel.h index a47a3d59..b6ba8241 100644 --- a/mission/tmtc/VirtualChannel.h +++ b/mission/tmtc/VirtualChannel.h @@ -42,11 +42,13 @@ class VirtualChannel : public AcceptsTelemetryIF { * to ground station is down. */ void setLinkState(bool linkIsUp_); + const char* getName() const override; private: PtmeIF* ptme = nullptr; MessageQueueIF* tmQueue = nullptr; uint8_t vcId = 0; + std::string vcName; bool linkIsUp = false; From 26216eca88342494aae86a36d1bcfeb668f9682f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 11:53:33 +0200 Subject: [PATCH 098/361] new fs helper module --- bsp_q7s/CMakeLists.txt | 1 + bsp_q7s/boardtest/Q7STestTask.cpp | 2 +- bsp_q7s/core/CoreController.cpp | 2 +- bsp_q7s/core/CoreController.h | 2 +- bsp_q7s/fs/CMakeLists.txt | 2 ++ bsp_q7s/{memory => fs}/FilesystemHelper.cpp | 4 ++-- bsp_q7s/{memory => fs}/FilesystemHelper.h | 0 bsp_q7s/{memory => fs}/SdCardManager.cpp | 2 +- bsp_q7s/{memory => fs}/SdCardManager.h | 0 bsp_q7s/{memory => fs}/helpers.cpp | 0 bsp_q7s/{memory => fs}/helpers.h | 4 ++-- bsp_q7s/memory/CMakeLists.txt | 3 +-- linux/devices/ploc/PlocMPSoCHelper.cpp | 2 +- linux/devices/ploc/PlocMPSoCHelper.h | 2 +- linux/devices/ploc/PlocMemoryDumper.h | 2 +- linux/devices/ploc/PlocSupervisorHandler.h | 2 +- linux/devices/ploc/PlocSupvHelper.cpp | 4 ++-- linux/devices/ploc/PlocSupvHelper.h | 2 +- linux/devices/startracker/StrHelper.h | 2 +- 19 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 bsp_q7s/fs/CMakeLists.txt rename bsp_q7s/{memory => fs}/FilesystemHelper.cpp (92%) rename bsp_q7s/{memory => fs}/FilesystemHelper.h (100%) rename bsp_q7s/{memory => fs}/SdCardManager.cpp (99%) rename bsp_q7s/{memory => fs}/SdCardManager.h (100%) rename bsp_q7s/{memory => fs}/helpers.cpp (100%) rename bsp_q7s/{memory => fs}/helpers.h (87%) diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index f6dbf590..2c1bae48 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -24,3 +24,4 @@ endif() add_subdirectory(memory) add_subdirectory(callbacks) add_subdirectory(xadc) +add_subdirectory(fs) diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 3e08bf13..cbd1fbed 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -17,7 +17,7 @@ #include #include "OBSWConfig.h" -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/memory/scratchApi.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/timemanager/Stopwatch.h" diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index de36b01a..8406d78b 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -20,7 +20,7 @@ #include #include -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/memory/scratchApi.h" #include "bsp_q7s/xadc/Xadc.h" #include "linux/utility/utility.h" diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 2ebdd4ec..c1cdbf93 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -7,7 +7,7 @@ #include #include "CoreDefinitions.h" -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #include "events/subsystemIdRanges.h" #include "fsfw/controller/ExtendedControllerBase.h" #include "mission/devices/devicedefinitions/GPSDefinitions.h" diff --git a/bsp_q7s/fs/CMakeLists.txt b/bsp_q7s/fs/CMakeLists.txt new file mode 100644 index 00000000..0e51683d --- /dev/null +++ b/bsp_q7s/fs/CMakeLists.txt @@ -0,0 +1,2 @@ +target_sources(${OBSW_NAME} PRIVATE helpers.cpp SdCardManager.cpp + FilesystemHelper.cpp) diff --git a/bsp_q7s/memory/FilesystemHelper.cpp b/bsp_q7s/fs/FilesystemHelper.cpp similarity index 92% rename from bsp_q7s/memory/FilesystemHelper.cpp rename to bsp_q7s/fs/FilesystemHelper.cpp index 91dfa9c5..4a0df9e2 100644 --- a/bsp_q7s/memory/FilesystemHelper.cpp +++ b/bsp_q7s/fs/FilesystemHelper.cpp @@ -3,8 +3,8 @@ #include #include -#include "bsp_q7s/memory/SdCardManager.h" -#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +#include "SdCardManager.h" +#include "fsfw/serviceinterface.h" FilesystemHelper::FilesystemHelper() {} diff --git a/bsp_q7s/memory/FilesystemHelper.h b/bsp_q7s/fs/FilesystemHelper.h similarity index 100% rename from bsp_q7s/memory/FilesystemHelper.h rename to bsp_q7s/fs/FilesystemHelper.h diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/fs/SdCardManager.cpp similarity index 99% rename from bsp_q7s/memory/SdCardManager.cpp rename to bsp_q7s/fs/SdCardManager.cpp index e2702771..2a835806 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/fs/SdCardManager.cpp @@ -10,11 +10,11 @@ #include #include "OBSWConfig.h" +#include "bsp_q7s/memory/scratchApi.h" #include "common/config/commonObjects.h" #include "fsfw/ipc/MutexFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include "linux/utility/utility.h" -#include "scratchApi.h" SdCardManager* SdCardManager::INSTANCE = nullptr; diff --git a/bsp_q7s/memory/SdCardManager.h b/bsp_q7s/fs/SdCardManager.h similarity index 100% rename from bsp_q7s/memory/SdCardManager.h rename to bsp_q7s/fs/SdCardManager.h diff --git a/bsp_q7s/memory/helpers.cpp b/bsp_q7s/fs/helpers.cpp similarity index 100% rename from bsp_q7s/memory/helpers.cpp rename to bsp_q7s/fs/helpers.cpp diff --git a/bsp_q7s/memory/helpers.h b/bsp_q7s/fs/helpers.h similarity index 87% rename from bsp_q7s/memory/helpers.h rename to bsp_q7s/fs/helpers.h index 16c5f7c8..0b13fc26 100644 --- a/bsp_q7s/memory/helpers.h +++ b/bsp_q7s/fs/helpers.h @@ -1,10 +1,10 @@ #ifndef BSP_Q7S_MEMORY_HELPERS_H_ #define BSP_Q7S_MEMORY_HELPERS_H_ -#include - #include +#include "SdCardManager.h" + namespace fshelpers { std::filesystem::path buildPrefixedPath(SdCardManager& man, diff --git a/bsp_q7s/memory/CMakeLists.txt b/bsp_q7s/memory/CMakeLists.txt index 8598f44c..06909a0a 100644 --- a/bsp_q7s/memory/CMakeLists.txt +++ b/bsp_q7s/memory/CMakeLists.txt @@ -1,2 +1 @@ -target_sources(${OBSW_NAME} PRIVATE helpers.cpp SdCardManager.cpp - scratchApi.cpp FilesystemHelper.cpp) +target_sources(${OBSW_NAME} PRIVATE scratchApi.cpp) diff --git a/linux/devices/ploc/PlocMPSoCHelper.cpp b/linux/devices/ploc/PlocMPSoCHelper.cpp index 965c63e6..980b8889 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.cpp +++ b/linux/devices/ploc/PlocMPSoCHelper.cpp @@ -5,7 +5,7 @@ #include "OBSWConfig.h" #ifdef XIPHOS_Q7S -#include "bsp_q7s/memory/FilesystemHelper.h" +#include "bsp_q7s/fs/FilesystemHelper.h" #endif #include "mission/utility/Timestamp.h" diff --git a/linux/devices/ploc/PlocMPSoCHelper.h b/linux/devices/ploc/PlocMPSoCHelper.h index 3adffa77..b669b51b 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.h +++ b/linux/devices/ploc/PlocMPSoCHelper.h @@ -12,7 +12,7 @@ #include "fsfw_hal/linux/uart/UartComIF.h" #include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #ifdef XIPHOS_Q7S -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #endif /** diff --git a/linux/devices/ploc/PlocMemoryDumper.h b/linux/devices/ploc/PlocMemoryDumper.h index b41ee420..da72c558 100644 --- a/linux/devices/ploc/PlocMemoryDumper.h +++ b/linux/devices/ploc/PlocMemoryDumper.h @@ -5,7 +5,7 @@ #include #include "OBSWConfig.h" -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #include "fsfw/action/ActionHelper.h" #include "fsfw/action/CommandActionHelper.h" #include "fsfw/action/CommandsActionsIF.h" diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index 82ab4545..4bdf2efa 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -3,7 +3,7 @@ #include "OBSWConfig.h" #include "PlocSupvHelper.h" -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #include "devices/powerSwitcherList.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/timemanager/Countdown.h" diff --git a/linux/devices/ploc/PlocSupvHelper.cpp b/linux/devices/ploc/PlocSupvHelper.cpp index c34fdbe3..f0f94635 100644 --- a/linux/devices/ploc/PlocSupvHelper.cpp +++ b/linux/devices/ploc/PlocSupvHelper.cpp @@ -8,8 +8,8 @@ #include "OBSWConfig.h" #ifdef XIPHOS_Q7S -#include "bsp_q7s/memory/FilesystemHelper.h" -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/FilesystemHelper.h" +#include "bsp_q7s/fs/SdCardManager.h" #endif #include "fsfw/tasks/TaskFactory.h" diff --git a/linux/devices/ploc/PlocSupvHelper.h b/linux/devices/ploc/PlocSupvHelper.h index 82ce7522..30152e65 100644 --- a/linux/devices/ploc/PlocSupvHelper.h +++ b/linux/devices/ploc/PlocSupvHelper.h @@ -13,7 +13,7 @@ #include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h" #ifdef XIPHOS_Q7S -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #endif /** diff --git a/linux/devices/startracker/StrHelper.h b/linux/devices/startracker/StrHelper.h index 1bfff60b..a9c80d77 100644 --- a/linux/devices/startracker/StrHelper.h +++ b/linux/devices/startracker/StrHelper.h @@ -7,7 +7,7 @@ #include "OBSWConfig.h" #ifdef XIPHOS_Q7S -#include "bsp_q7s/memory/SdCardManager.h" +#include "bsp_q7s/fs/SdCardManager.h" #endif #include "fsfw/devicehandlers/CookieIF.h" From 547fcf22dd80b0f41dd217ca488dab7722b8ea46 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 12:05:50 +0200 Subject: [PATCH 099/361] add very basic test in Q7S Test task for FS helpers --- bsp_q7s/boardtest/Q7STestTask.cpp | 27 +++++++++++++++++++++++++-- bsp_q7s/core/InitMission.cpp | 10 ---------- bsp_q7s/fs/helpers.cpp | 2 +- bsp_q7s/fs/helpers.h | 2 +- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index cbd1fbed..f6745348 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -19,11 +20,14 @@ #include "OBSWConfig.h" #include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/memory/scratchApi.h" +#include "bsp_q7s/fs/helpers.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/timemanager/Stopwatch.h" #include "p60pdu.h" #include "test/DummyParameter.h" +using namespace returnvalue; + Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) { doTestSdCard = false; doTestScratchApi = false; @@ -71,7 +75,7 @@ ReturnValue_t Q7STestTask::performOneShotAction() { if (doTestProtHandler) { testProtHandler(); } - FsOpCodes opCode = FsOpCodes::APPEND_TO_FILE; + FsOpCodes opCode = FsOpCodes::CREATE_EMPTY_FILE_IN_TMP; testFileSystemHandlerDirect(opCode); return TestTask::performOneShotAction(); } @@ -365,7 +369,26 @@ void Q7STestTask::testGpsDaemonSocket() { sif::info << "Longitude: " << gps->fix.longitude << std::endl; } -void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {} +void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { + HostFilesystem hostFs; + auto* sdcMan = SdCardManager::instance(); + std::string mountPrefix = sdcMan->getCurrentMountPrefix(); + sif::info << "Current mount prefix: " << mountPrefix << std::endl; + auto prefixedPath = fshelpers::getPrefixedPath(*sdcMan, "conf/test.txt"); + sif::info << "Prefixed path: " << prefixedPath << std::endl; + if (opCode == FsOpCodes::CREATE_EMPTY_FILE_IN_TMP) { + FilesystemParams params("/tmp/hello.txt"); + auto res = hostFs.createFile(params); + if(res != OK) { + sif::warning << "Creating empty file in /tmp failed" << std::endl; + } + bool fileExists = std::filesystem::exists("/tmp/hello.txt"); + if(not fileExists) { + sif::warning << "File was not created!" << std::endl; + } + hostFs.removeFile("/tmp/hello.txt"); + } +} void Q7STestTask::xadcTest() { ReturnValue_t result = returnvalue::OK; diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index c6f7ce51..69da16f0 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -198,15 +198,6 @@ void initmission::initTasks() { } #endif /* OBSW_ADD_RTD_DEVICES */ - // FS task, task interval does not matter because it runs in permanent loop, priority low - // because it is a non-essential background task - PeriodicTaskIF* fsTask = factory->createPeriodicTask( - "FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); - result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER); - if (result != returnvalue::OK) { - initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER); - } - #if OBSW_ADD_STAR_TRACKER == 1 PeriodicTaskIF* strHelperTask = factory->createPeriodicTask( "STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); @@ -288,7 +279,6 @@ void initmission::initTasks() { ptmeTestTask->startTask(); #endif - fsTask->startTask(); #if OBSW_ADD_STAR_TRACKER == 1 strHelperTask->startTask(); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ diff --git a/bsp_q7s/fs/helpers.cpp b/bsp_q7s/fs/helpers.cpp index 20ce8195..e233d514 100644 --- a/bsp_q7s/fs/helpers.cpp +++ b/bsp_q7s/fs/helpers.cpp @@ -1,6 +1,6 @@ #include "helpers.h" -std::filesystem::path fshelpers::buildPrefixedPath(SdCardManager &man, +std::filesystem::path fshelpers::getPrefixedPath(SdCardManager &man, std::filesystem::path pathWihtoutPrefix) { auto prefix = man.getCurrentMountPrefix(); auto resPath = prefix / pathWihtoutPrefix; diff --git a/bsp_q7s/fs/helpers.h b/bsp_q7s/fs/helpers.h index 0b13fc26..f78e5fbe 100644 --- a/bsp_q7s/fs/helpers.h +++ b/bsp_q7s/fs/helpers.h @@ -7,7 +7,7 @@ namespace fshelpers { -std::filesystem::path buildPrefixedPath(SdCardManager& man, +std::filesystem::path getPrefixedPath(SdCardManager& man, std::filesystem::path pathWihtoutPrefix); } From 6b48fb64d816ebbdacf2f8ff33ec47136ddeec8d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 12:14:27 +0200 Subject: [PATCH 100/361] start integrating cfdp code --- bsp_q7s/OBSWConfig.h.in | 1 + bsp_q7s/boardtest/Q7STestTask.cpp | 6 +++--- bsp_q7s/fs/helpers.cpp | 2 +- bsp_q7s/fs/helpers.h | 3 +-- common/config/commonObjects.h | 3 ++- mission/core/GenericFactory.cpp | 34 +++++++++++++++++++++++++++---- 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index b9c27840..fe59d8d3 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -37,6 +37,7 @@ #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_CFDP_COMPONENTS 1 #define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 #define OBSW_MPSOC_JTAG_BOOT 0 diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index f6745348..a782ff6d 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -19,8 +19,8 @@ #include "OBSWConfig.h" #include "bsp_q7s/fs/SdCardManager.h" -#include "bsp_q7s/memory/scratchApi.h" #include "bsp_q7s/fs/helpers.h" +#include "bsp_q7s/memory/scratchApi.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/timemanager/Stopwatch.h" #include "p60pdu.h" @@ -379,11 +379,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { if (opCode == FsOpCodes::CREATE_EMPTY_FILE_IN_TMP) { FilesystemParams params("/tmp/hello.txt"); auto res = hostFs.createFile(params); - if(res != OK) { + if (res != OK) { sif::warning << "Creating empty file in /tmp failed" << std::endl; } bool fileExists = std::filesystem::exists("/tmp/hello.txt"); - if(not fileExists) { + if (not fileExists) { sif::warning << "File was not created!" << std::endl; } hostFs.removeFile("/tmp/hello.txt"); diff --git a/bsp_q7s/fs/helpers.cpp b/bsp_q7s/fs/helpers.cpp index e233d514..f1f31eba 100644 --- a/bsp_q7s/fs/helpers.cpp +++ b/bsp_q7s/fs/helpers.cpp @@ -1,7 +1,7 @@ #include "helpers.h" std::filesystem::path fshelpers::getPrefixedPath(SdCardManager &man, - std::filesystem::path pathWihtoutPrefix) { + std::filesystem::path pathWihtoutPrefix) { auto prefix = man.getCurrentMountPrefix(); auto resPath = prefix / pathWihtoutPrefix; return resPath; diff --git a/bsp_q7s/fs/helpers.h b/bsp_q7s/fs/helpers.h index f78e5fbe..b5dc7365 100644 --- a/bsp_q7s/fs/helpers.h +++ b/bsp_q7s/fs/helpers.h @@ -7,8 +7,7 @@ namespace fshelpers { -std::filesystem::path getPrefixedPath(SdCardManager& man, - std::filesystem::path pathWihtoutPrefix); +std::filesystem::path getPrefixedPath(SdCardManager& man, std::filesystem::path pathWihtoutPrefix); } diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index e0efbce7..89e4b8d3 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -121,7 +121,8 @@ enum commonObjects : uint32_t { ACS_BOARD_ASS = 0x73000001, SUS_BOARD_ASS = 0x73000002, TCS_BOARD_ASS = 0x73000003, - RW_ASS = 0x73000004 + RW_ASS = 0x73000004, + CFDP_HANDLER = 0x73000005, }; } diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 0c6ab421..d4e6fc9f 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -1,5 +1,6 @@ #include "GenericFactory.h" +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #include #include "OBSWConfig.h" @@ -56,17 +58,18 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); new VerificationReporter(); auto* timeStamper = new CdsShortTimeStamper(objects::TIME_STAMPER); - + StorageManagerIF* tcStore; + StorageManagerIF* tmStore; { PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {200, 64}, {200, 128}, {100, 1024}, {10, 2048}}; - new PoolManager(objects::TC_STORE, poolCfg); + tcStore = new PoolManager(objects::TC_STORE, poolCfg); } { PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {100, 64}, {100, 128}, {100, 1024}, {10, 2048}}; - new PoolManager(objects::TM_STORE, poolCfg); + tmStore = new PoolManager(objects::TM_STORE, poolCfg); } { @@ -83,7 +86,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { vc = config::LIVE_TM; #endif // Every TM packet goes through this funnel - new TmFunnel(objects::TM_FUNNEL, *timeStamper, 50, vc); + auto* funnel = new TmFunnel(objects::TM_FUNNEL, *timeStamper, 50, vc); // PUS service stack new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW, @@ -129,4 +132,27 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ tmtcBridge->setMaxNumberOfPacketsStored(300); #endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */ + +#if OBSW_ADD_CFDP_COMPONENTS == 1 + auto* hostFs = new HostFilesystem(); + FsfwHandlerParams params(objects::CFDP_HANDLER, *hostFs, *funnel, *tcStore, *tmStore); +// cfdp::IndicationCfg indicationCfg; +// UnsignedByteField apid(common::COMMON_CFDP_APID); +// cfdp::EntityId localId(apid); +// UnsignedByteField remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID); +// cfdp::EntityId remoteId(remoteEntityId); +// cfdp::RemoteEntityCfg remoteCfg(remoteId); +// remoteCfg.defaultChecksum = cfdp::ChecksumTypes::CRC_32; +// auto* remoteCfgProvider = new cfdp::OneRemoteConfigProvider(remoteCfg); +// auto* cfdpUserHandler = new CfdpExampleUserHandler(*hostFs); +// auto* cfdpFaultHandler = new CfdpExampleFaultHandler(); +// cfdp::PacketInfoList<64> packetList; +// cfdp::LostSegmentsList<128> lostSegments; +// CfdpHandlerCfg cfg(localId, indicationCfg, *cfdpUserHandler, *cfdpFaultHandler, packetList, +// lostSegments, *remoteCfgProvider); +// auto* cfdpHandler = new CfdpHandler(params, cfg); +// CcsdsDistributorIF::DestInfo info("CFDP Destination", common::COMMON_CFDP_APID, +// cfdpHandler->getRequestQueue(), true); +// ccsdsDistrib->registerApplication(info); +#endif } From 0b43c3137f3e6f4b2ddbcb11c4e4e91337dd9f67 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 12:22:46 +0200 Subject: [PATCH 101/361] add new constants for CFDP, clean up --- bsp_q7s/core/ObjectFactory.cpp | 2 +- common/config/commonConfig.cpp | 4 ++-- common/config/eive/definitions.h | 7 +++++++ common/config/tmtc/apid.h | 18 ------------------ mission/core/GenericFactory.cpp | 29 ++++++++++++++--------------- 5 files changed, 24 insertions(+), 36 deletions(-) delete mode 100644 common/config/tmtc/apid.h diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 40379f69..c7e170d2 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -40,7 +40,7 @@ #include "mission/system/fdir/RtdFdir.h" #include "mission/system/fdir/SusFdir.h" #include "mission/system/fdir/SyrlinksFdir.h" -#include "tmtc/apid.h" +#include "eive/definitions.h" #include "tmtc/pusIds.h" #if OBSW_TEST_LIBGPIOD == 1 #include "linux/boardtest/LibgpiodTest.h" diff --git a/common/config/commonConfig.cpp b/common/config/commonConfig.cpp index 08b7439f..f76817f4 100644 --- a/common/config/commonConfig.cpp +++ b/common/config/commonConfig.cpp @@ -1,8 +1,8 @@ #include "commonConfig.h" #include "fsfw/tmtcpacket/ccsds/defs.h" -#include "tmtc/apid.h" +#include "eive/definitions.h" const fsfw::Version common::OBSW_VERSION{OBSW_VERSION_MAJOR, OBSW_VERSION_MINOR, OBSW_VERSION_REVISION, OBSW_VERSION_CST_GIT_SHA1}; -const uint16_t common::PUS_PACKET_ID = ccsds::getTcSpacePacketIdFromApid(apid::EIVE_OBSW); +const uint16_t common::PUS_PACKET_ID = ccsds::getTcSpacePacketIdFromApid(config::EIVE_PUS_APID); diff --git a/common/config/eive/definitions.h b/common/config/eive/definitions.h index 6a7bad05..8ed59251 100644 --- a/common/config/eive/definitions.h +++ b/common/config/eive/definitions.h @@ -5,6 +5,11 @@ namespace config { +static constexpr uint16_t EIVE_PUS_APID = 0x65; +static constexpr uint16_t EIVE_CFDP_APID = 0x66; +static constexpr uint16_t EIVE_LOCAL_CFDP_ENTITY_ID = EIVE_CFDP_APID; +static constexpr uint16_t EIVE_GROUND_CFDP_ENTITY_ID = 1; + static constexpr uint32_t PL_PCDU_TRANSITION_TIMEOUT_MS = 20 * 60 * 1000; static constexpr uint32_t LONGEST_MODE_TIMEOUT_SECONDS = PL_PCDU_TRANSITION_TIMEOUT_MS / 1000; @@ -19,6 +24,8 @@ static constexpr uint8_t LIVE_TM = 0; static constexpr uint32_t MAX_PATH_SIZE = 100; static constexpr uint32_t MAX_FILENAME_SIZE = 50; + + } // namespace config #endif /* COMMON_CONFIG_DEFINITIONS_H_ */ diff --git a/common/config/tmtc/apid.h b/common/config/tmtc/apid.h deleted file mode 100644 index 8fbb4203..00000000 --- a/common/config/tmtc/apid.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FSFWCONFIG_TMTC_APID_H_ -#define FSFWCONFIG_TMTC_APID_H_ - -#include - -/** - * Application Process Definition: entity, uniquely identified by an - * application process ID (APID), capable of generating telemetry source - * packets and receiving telecommand packets - * - * EIVE APID: 0x65 / 101 / e - * APID is a 11 bit number - */ -namespace apid { -static const uint16_t EIVE_OBSW = 0x65; -} - -#endif /* FSFWCONFIG_TMTC_APID_H_ */ diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index d4e6fc9f..90fed322 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -25,7 +25,6 @@ #include "eive/definitions.h" #include "fsfw/pus/Service11TelecommandScheduling.h" #include "objects/systemObjectList.h" -#include "tmtc/apid.h" #include "tmtc/pusIds.h" #if OBSW_ADD_TCPIP_BRIDGE == 1 @@ -78,8 +77,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { new PoolManager(objects::IPC_STORE, poolCfg); } - auto* ccsdsDistrib = new CcsdsDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR); - new PusDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR, ccsdsDistrib); + 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 @@ -89,29 +88,29 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { auto* funnel = new TmFunnel(objects::TM_FUNNEL, *timeStamper, 50, vc); // PUS service stack - new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW, + new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, config::EIVE_PUS_APID, pus::PUS_SERVICE_1, objects::TM_FUNNEL, 20); - new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, apid::EIVE_OBSW, + new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, config::EIVE_PUS_APID, pus::PUS_SERVICE_2, 3, 10); - new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::EIVE_OBSW, + new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, config::EIVE_PUS_APID, pus::PUS_SERVICE_3); new Service5EventReporting( - PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15, + PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, config::EIVE_PUS_APID, pus::PUS_SERVICE_5), 15, 45); - new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW, + new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_8, 16, 60); new Service9TimeManagement( - PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9)); + PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_9)); new Service11TelecommandScheduling( - PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, apid::EIVE_OBSW, pus::PUS_SERVICE_11), + PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, config::EIVE_PUS_APID, pus::PUS_SERVICE_11), ccsdsDistrib); - new Service17Test(PsbParams(objects::PUS_SERVICE_17_TEST, apid::EIVE_OBSW, pus::PUS_SERVICE_17)); - new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::EIVE_OBSW, + new Service17Test(PsbParams(objects::PUS_SERVICE_17_TEST, config::EIVE_PUS_APID, pus::PUS_SERVICE_17)); + new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, config::EIVE_PUS_APID, pus::PUS_SERVICE_20); - new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::EIVE_OBSW, + new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_200, 8); - new CService201HealthCommanding(objects::PUS_SERVICE_201_HEALTH, apid::EIVE_OBSW, + new CService201HealthCommanding(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID, pus::PUS_SERVICE_201); #if OBSW_ADD_TCPIP_BRIDGE == 1 #if OBSW_USE_TMTC_TCP_BRIDGE == 0 @@ -136,7 +135,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { #if OBSW_ADD_CFDP_COMPONENTS == 1 auto* hostFs = new HostFilesystem(); FsfwHandlerParams params(objects::CFDP_HANDLER, *hostFs, *funnel, *tcStore, *tmStore); -// cfdp::IndicationCfg indicationCfg; + cfdp::IndicationCfg indicationCfg; // UnsignedByteField apid(common::COMMON_CFDP_APID); // cfdp::EntityId localId(apid); // UnsignedByteField remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID); From 68039d5d4a0eb828d43cb338d3b9cd154cde08bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 12:28:39 +0200 Subject: [PATCH 102/361] clean up config code --- bsp_q7s/core/ObjectFactory.cpp | 2 +- bsp_q7s/em/emObjectFactory.cpp | 2 +- bsp_q7s/fmObjectFactory.cpp | 2 +- bsp_q7s/fs/FilesystemHelper.h | 2 +- bsp_q7s/fs/SdCardManager.cpp | 2 +- common/config/commonConfig.cpp | 2 +- common/config/eive/definitions.h | 2 -- .../{commonSubsystemIds.h => eive/eventSubsystemIds.h} | 0 common/config/{commonObjects.h => eive/objects.h} | 0 .../config/{commonClassIds.h => eive/resultClassIds.h} | 0 linux/devices/GPSHyperionLinuxController.h | 2 +- linux/fsfwconfig/events/subsystemIdRanges.h | 2 +- linux/fsfwconfig/objects/systemObjectList.h | 2 +- linux/fsfwconfig/returnvalues/classIds.h | 3 ++- mission/controller/AcsController.h | 2 +- mission/core/GenericFactory.cpp | 10 ++++++---- mission/devices/GomspaceDeviceHandler.cpp | 2 +- mission/devices/P60DockHandler.h | 2 +- .../devices/devicedefinitions/SyrlinksDefinitions.h | 3 +-- mission/devices/devicedefinitions/powerDefinitions.h | 3 ++- mission/system/AcsBoardAssembly.h | 2 +- mission/system/fdir/AcsBoardFdir.cpp | 2 +- mission/system/fdir/RtdFdir.cpp | 2 +- mission/system/fdir/SusFdir.cpp | 2 +- 24 files changed, 27 insertions(+), 26 deletions(-) rename common/config/{commonSubsystemIds.h => eive/eventSubsystemIds.h} (100%) rename common/config/{commonObjects.h => eive/objects.h} (100%) rename common/config/{commonClassIds.h => eive/resultClassIds.h} (100%) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index c7e170d2..3a15d403 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -12,6 +12,7 @@ #include "devices/addresses.h" #include "devices/gpioIds.h" #include "devices/powerSwitcherList.h" +#include "eive/definitions.h" #include "fsfw/ipc/QueueFactory.h" #include "linux/ObjectFactory.h" #include "linux/boardtest/I2cTestClass.h" @@ -40,7 +41,6 @@ #include "mission/system/fdir/RtdFdir.h" #include "mission/system/fdir/SusFdir.h" #include "mission/system/fdir/SyrlinksFdir.h" -#include "eive/definitions.h" #include "tmtc/pusIds.h" #if OBSW_TEST_LIBGPIOD == 1 #include "linux/boardtest/LibgpiodTest.h" diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 9301f6d3..d1e9ba56 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -4,8 +4,8 @@ #include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/ObjectFactory.h" #include "busConf.h" -#include "commonObjects.h" #include "devConf.h" +#include "eive/objects.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "linux/ObjectFactory.h" #include "linux/callbacks/gpioCallbacks.h" diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index acce5dfb..89f4990e 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -2,8 +2,8 @@ #include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/ObjectFactory.h" #include "busConf.h" -#include "commonObjects.h" #include "devConf.h" +#include "eive/objects.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "linux/ObjectFactory.h" #include "linux/callbacks/gpioCallbacks.h" diff --git a/bsp_q7s/fs/FilesystemHelper.h b/bsp_q7s/fs/FilesystemHelper.h index 8233d4db..ea1b5703 100644 --- a/bsp_q7s/fs/FilesystemHelper.h +++ b/bsp_q7s/fs/FilesystemHelper.h @@ -3,7 +3,7 @@ #include -#include "commonClassIds.h" +#include "eive/resultClassIds.h" #include "fsfw/returnvalues/returnvalue.h" /** diff --git a/bsp_q7s/fs/SdCardManager.cpp b/bsp_q7s/fs/SdCardManager.cpp index 2a835806..95abc6aa 100644 --- a/bsp_q7s/fs/SdCardManager.cpp +++ b/bsp_q7s/fs/SdCardManager.cpp @@ -11,7 +11,7 @@ #include "OBSWConfig.h" #include "bsp_q7s/memory/scratchApi.h" -#include "common/config/commonObjects.h" +#include "eive/objects.h" #include "fsfw/ipc/MutexFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include "linux/utility/utility.h" diff --git a/common/config/commonConfig.cpp b/common/config/commonConfig.cpp index f76817f4..56388f8b 100644 --- a/common/config/commonConfig.cpp +++ b/common/config/commonConfig.cpp @@ -1,7 +1,7 @@ #include "commonConfig.h" -#include "fsfw/tmtcpacket/ccsds/defs.h" #include "eive/definitions.h" +#include "fsfw/tmtcpacket/ccsds/defs.h" const fsfw::Version common::OBSW_VERSION{OBSW_VERSION_MAJOR, OBSW_VERSION_MINOR, OBSW_VERSION_REVISION, OBSW_VERSION_CST_GIT_SHA1}; diff --git a/common/config/eive/definitions.h b/common/config/eive/definitions.h index 8ed59251..0786cdb3 100644 --- a/common/config/eive/definitions.h +++ b/common/config/eive/definitions.h @@ -24,8 +24,6 @@ static constexpr uint8_t LIVE_TM = 0; static constexpr uint32_t MAX_PATH_SIZE = 100; static constexpr uint32_t MAX_FILENAME_SIZE = 50; - - } // namespace config #endif /* COMMON_CONFIG_DEFINITIONS_H_ */ diff --git a/common/config/commonSubsystemIds.h b/common/config/eive/eventSubsystemIds.h similarity index 100% rename from common/config/commonSubsystemIds.h rename to common/config/eive/eventSubsystemIds.h diff --git a/common/config/commonObjects.h b/common/config/eive/objects.h similarity index 100% rename from common/config/commonObjects.h rename to common/config/eive/objects.h diff --git a/common/config/commonClassIds.h b/common/config/eive/resultClassIds.h similarity index 100% rename from common/config/commonClassIds.h rename to common/config/eive/resultClassIds.h diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index 35ce0a63..a4c12e57 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -1,7 +1,7 @@ #ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_ #define MISSION_DEVICES_GPSHYPERIONHANDLER_H_ -#include "commonSubsystemIds.h" +#include "eive/eventSubsystemIds.h" #include "fsfw/FSFW.h" #include "fsfw/controller/ExtendedControllerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" diff --git a/linux/fsfwconfig/events/subsystemIdRanges.h b/linux/fsfwconfig/events/subsystemIdRanges.h index f0a0316c..6b7a1c1d 100644 --- a/linux/fsfwconfig/events/subsystemIdRanges.h +++ b/linux/fsfwconfig/events/subsystemIdRanges.h @@ -3,7 +3,7 @@ #include -#include "common/config/commonSubsystemIds.h" +#include "eive/eventSubsystemIds.h" #include "fsfw/events/fwSubsystemIdRanges.h" /** diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index 669fcc9f..4a84e77f 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -5,7 +5,7 @@ #include -#include "commonObjects.h" +#include "eive/objects.h" // The objects will be instantiated in the ID order // For naming scheme see flight manual diff --git a/linux/fsfwconfig/returnvalues/classIds.h b/linux/fsfwconfig/returnvalues/classIds.h index ecfc8ca9..abd8f785 100644 --- a/linux/fsfwconfig/returnvalues/classIds.h +++ b/linux/fsfwconfig/returnvalues/classIds.h @@ -1,9 +1,10 @@ #ifndef FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ #define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ -#include #include +#include "eive/resultClassIds.h" + /** * Source IDs starts at 73 for now * Framework IDs for ReturnValues run from 0 to 56 diff --git a/mission/controller/AcsController.h b/mission/controller/AcsController.h index 14b710a2..c20ae94d 100644 --- a/mission/controller/AcsController.h +++ b/mission/controller/AcsController.h @@ -1,10 +1,10 @@ #ifndef MISSION_CONTROLLER_ACSCONTROLLER_H_ #define MISSION_CONTROLLER_ACSCONTROLLER_H_ -#include #include #include "controllerdefinitions/AcsCtrlDefinitions.h" +#include "eive/objects.h" #include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h" #include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "mission/devices/devicedefinitions/IMTQHandlerDefinitions.h" diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 90fed322..99324e4c 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -77,7 +77,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { new PoolManager(objects::IPC_STORE, poolCfg); } - auto* ccsdsDistrib = new CcsdsDistributor(config::EIVE_PUS_APID, objects::CCSDS_PACKET_DISTRIBUTOR); + 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; @@ -95,8 +96,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, config::EIVE_PUS_APID, pus::PUS_SERVICE_3); new Service5EventReporting( - PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, config::EIVE_PUS_APID, pus::PUS_SERVICE_5), 15, - 45); + PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, config::EIVE_PUS_APID, pus::PUS_SERVICE_5), + 15, 45); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_8, 16, 60); new Service9TimeManagement( @@ -105,7 +106,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { new Service11TelecommandScheduling( PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, config::EIVE_PUS_APID, pus::PUS_SERVICE_11), ccsdsDistrib); - new Service17Test(PsbParams(objects::PUS_SERVICE_17_TEST, config::EIVE_PUS_APID, pus::PUS_SERVICE_17)); + new Service17Test( + PsbParams(objects::PUS_SERVICE_17_TEST, config::EIVE_PUS_APID, pus::PUS_SERVICE_17)); new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, config::EIVE_PUS_APID, pus::PUS_SERVICE_20); new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, config::EIVE_PUS_APID, diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 412f2e46..254b6993 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -1,6 +1,5 @@ #include "GomspaceDeviceHandler.h" -#include #include #include @@ -8,6 +7,7 @@ #include "devicedefinitions/GomSpacePackets.h" #include "devicedefinitions/powerDefinitions.h" +#include "eive/objects.h" using namespace GOMSPACE; diff --git a/mission/devices/P60DockHandler.h b/mission/devices/P60DockHandler.h index fcad350f..b91907a8 100644 --- a/mission/devices/P60DockHandler.h +++ b/mission/devices/P60DockHandler.h @@ -4,7 +4,7 @@ #include #include "GomspaceDeviceHandler.h" -#include "commonSubsystemIds.h" +#include "eive/eventSubsystemIds.h" /** * @brief Device handler for the P60Dock. The P60Dock serves as carrier for the ACU, PDU1 and diff --git a/mission/devices/devicedefinitions/SyrlinksDefinitions.h b/mission/devices/devicedefinitions/SyrlinksDefinitions.h index 447b5cce..96ea1157 100644 --- a/mission/devices/devicedefinitions/SyrlinksDefinitions.h +++ b/mission/devices/devicedefinitions/SyrlinksDefinitions.h @@ -1,8 +1,7 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_ -#include - +#include "eive/eventSubsystemIds.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" namespace syrlinks { diff --git a/mission/devices/devicedefinitions/powerDefinitions.h b/mission/devices/devicedefinitions/powerDefinitions.h index 9060c3b9..8d1b5578 100644 --- a/mission/devices/devicedefinitions/powerDefinitions.h +++ b/mission/devices/devicedefinitions/powerDefinitions.h @@ -1,9 +1,10 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_POWERDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_POWERDEFINITIONS_H_ -#include #include +#include "eive/eventSubsystemIds.h" + namespace power { static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_HANDLER; diff --git a/mission/system/AcsBoardAssembly.h b/mission/system/AcsBoardAssembly.h index 412cb273..820060ce 100644 --- a/mission/system/AcsBoardAssembly.h +++ b/mission/system/AcsBoardAssembly.h @@ -1,13 +1,13 @@ #ifndef MISSION_SYSTEM_ACSBOARDASSEMBLY_H_ #define MISSION_SYSTEM_ACSBOARDASSEMBLY_H_ -#include #include #include #include #include "DualLaneAssemblyBase.h" #include "DualLanePowerStateMachine.h" +#include "eive/eventSubsystemIds.h" struct AcsBoardHelper { AcsBoardHelper(object_id_t mgm0Id, object_id_t mgm1Id, object_id_t mgm2Id, object_id_t mgm3Id, diff --git a/mission/system/fdir/AcsBoardFdir.cpp b/mission/system/fdir/AcsBoardFdir.cpp index 931f43c0..5e97c377 100644 --- a/mission/system/fdir/AcsBoardFdir.cpp +++ b/mission/system/fdir/AcsBoardFdir.cpp @@ -1,6 +1,6 @@ #include "AcsBoardFdir.h" -#include +#include "eive/objects.h" AcsBoardFdir::AcsBoardFdir(object_id_t sensorId) : DeviceHandlerFailureIsolation(sensorId, objects::ACS_BOARD_ASS) {} diff --git a/mission/system/fdir/RtdFdir.cpp b/mission/system/fdir/RtdFdir.cpp index f4f9806e..008dc405 100644 --- a/mission/system/fdir/RtdFdir.cpp +++ b/mission/system/fdir/RtdFdir.cpp @@ -1,6 +1,6 @@ #include "RtdFdir.h" -#include +#include "eive/objects.h" RtdFdir::RtdFdir(object_id_t sensorId) : DeviceHandlerFailureIsolation(sensorId, objects::TCS_BOARD_ASS) {} diff --git a/mission/system/fdir/SusFdir.cpp b/mission/system/fdir/SusFdir.cpp index a2e0aff4..894b92cb 100644 --- a/mission/system/fdir/SusFdir.cpp +++ b/mission/system/fdir/SusFdir.cpp @@ -1,6 +1,6 @@ #include "SusFdir.h" -#include +#include "eive/objects.h" SusFdir::SusFdir(object_id_t sensorId) : DeviceHandlerFailureIsolation(sensorId, objects::SUS_BOARD_ASS) {} From 8dce434746453faec16efbec42076e1e769ed69f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 12:34:05 +0200 Subject: [PATCH 103/361] fix bsp_hosted --- bsp_hosted/ObjectFactory.cpp | 2 +- bsp_hosted/fsfwconfig/events/subsystemIdRanges.h | 2 +- bsp_hosted/fsfwconfig/objects/systemObjectList.h | 2 +- bsp_hosted/fsfwconfig/returnvalues/classIds.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 64092bad..6172f3ed 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "eive/definitions.h" #include #include "OBSWConfig.h" diff --git a/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h b/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h index 9dc50c50..592c3624 100644 --- a/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h +++ b/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h @@ -1,7 +1,7 @@ #ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ -#include +#include "eive/eventSubsystemIds.h" #include diff --git a/bsp_hosted/fsfwconfig/objects/systemObjectList.h b/bsp_hosted/fsfwconfig/objects/systemObjectList.h index 4326c108..add077d4 100644 --- a/bsp_hosted/fsfwconfig/objects/systemObjectList.h +++ b/bsp_hosted/fsfwconfig/objects/systemObjectList.h @@ -1,7 +1,7 @@ #ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ -#include +#include "eive/objects.h" #include diff --git a/bsp_hosted/fsfwconfig/returnvalues/classIds.h b/bsp_hosted/fsfwconfig/returnvalues/classIds.h index b50e8ac0..deedca6a 100644 --- a/bsp_hosted/fsfwconfig/returnvalues/classIds.h +++ b/bsp_hosted/fsfwconfig/returnvalues/classIds.h @@ -3,7 +3,7 @@ #include -#include "commonClassIds.h" +#include "eive/resultClassIds.h" /** * Source IDs starts at 73 for now From 65f4daf305b7272c1d2213008df2cf68853312d1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 12:35:10 +0200 Subject: [PATCH 104/361] move config define --- bsp_q7s/OBSWConfig.h.in | 1 - common/config/commonConfig.h.in | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index fe59d8d3..b9c27840 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -37,7 +37,6 @@ #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_CFDP_COMPONENTS 1 #define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 #define OBSW_MPSOC_JTAG_BOOT 0 diff --git a/common/config/commonConfig.h.in b/common/config/commonConfig.h.in index 9581e751..1b0111e1 100644 --- a/common/config/commonConfig.h.in +++ b/common/config/commonConfig.h.in @@ -25,6 +25,8 @@ debugging. */ // CCSDS IP Cores. #define OBSW_USE_TMTC_TCP_BRIDGE 1 +#define OBSW_ADD_CFDP_COMPONENTS 1 + namespace common { static constexpr uint8_t OBSW_VERSION_MAJOR = @OBSW_VERSION_MAJOR@; From 54f73661fc4ebca11c1d7321d889370ea9ac329f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 14:01:54 +0200 Subject: [PATCH 105/361] fix init error --- CMakeLists.txt | 3 +++ bsp_q7s/OBSWConfig.h.in | 1 + bsp_q7s/core/InitMission.cpp | 8 +++++--- bsp_q7s/em/emObjectFactory.cpp | 5 ++--- dummies/helpers.cpp | 9 ++++++++- dummies/helpers.h | 2 ++ 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03c1eece..c5f3d1bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,9 @@ set(OBSW_ADD_ACS_BOARD set(OBSW_ADD_GPS_CTRL ${INIT_VAL} CACHE STRING "Add GPS controllers") +set(OBSW_ADD_TCS_CTRL + ${INIT_VAL} + CACHE STRING "Add TCS controllers") set(OBSW_ADD_ACS_CTRL ${INIT_VAL} CACHE STRING "Add ACS controller") diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index c20db3f1..9ff67209 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -32,6 +32,7 @@ #define OBSW_ADD_ACS_BOARD @OBSW_ADD_ACS_BOARD@ #define OBSW_ADD_ACS_CTRL @OBSW_ADD_ACS_CTRL@ #define OBSW_ADD_GPS_CTRL @OBSW_ADD_GPS_CTRL@ +#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_TMP_DEVICES @OBSW_ADD_TMP_DEVICES@ diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index e60c2caf..5116e808 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -189,8 +189,7 @@ void initmission::initTasks() { objects::RTD_14_IC17_TCS_BOARD, objects::RTD_15_IC18_IMTQ, }; - tcsTask->addComponent(objects::TCS_BOARD_ASS); - tcsTask->addComponent(objects::THERMAL_CONTROLLER); + for (const auto& rtd : rtdIds) { tcsTask->addComponent(rtd, DeviceHandlerIF::PERFORM_OPERATION); tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_WRITE); @@ -198,8 +197,11 @@ void initmission::initTasks() { tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_READ); tcsTask->addComponent(rtd, DeviceHandlerIF::GET_READ); } + tcsTask->addComponent(objects::TCS_BOARD_ASS); #endif /* OBSW_ADD_RTD_DEVICES */ - +#if OBSW_ADD_TCS_CTRL == 1 + tcsTask->addComponent(objects::THERMAL_CONTROLLER); +#endif // FS task, task interval does not matter because it runs in permanent loop, priority low // because it is a non-essential background task PeriodicTaskIF* fsTask = factory->createPeriodicTask( diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 219ed580..780b6b13 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -31,7 +31,6 @@ void ObjectFactory::produce(void* args) { dummyCfg.addCoreCtrlCfg = false; dummy::createDummies(dummyCfg); - createTmpComponents(); new CoreController(objects::CORE_CONTROLLER); gpioCallbacks::disableAllDecoder(gpioComIF); @@ -42,6 +41,8 @@ void ObjectFactory::produce(void* args) { // createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher); // createSyrlinksComponents(pwrSwitcher); // createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV); + // createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF); + // createTmpComponents(); createRadSensorComponent(gpioComIF); #if OBSW_ADD_ACS_BOARD == 1 @@ -49,8 +50,6 @@ void ObjectFactory::produce(void* args) { #endif createHeaterComponents(gpioComIF, pwrSwitcher, healthTable); createSolarArrayDeploymentComponents(); - - createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF); createPayloadComponents(gpioComIF); #if OBSW_ADD_MGT == 1 diff --git a/dummies/helpers.cpp b/dummies/helpers.cpp index 46cf207d..8eb73250 100644 --- a/dummies/helpers.cpp +++ b/dummies/helpers.cpp @@ -17,6 +17,7 @@ #include #include #include +#include using namespace dummy; @@ -27,7 +28,9 @@ void dummy::createDummies(DummyCfg cfg) { if (cfg.addCoreCtrlCfg) { new CoreControllerDummy(objects::CORE_CONTROLLER); } - + if (cfg.addRtdComIFDummy) { + new ComIFDummy(objects::SPI_RTD_COM_IF); + } new RwDummy(objects::RW1, objects::DUMMY_COM_IF, comCookieDummy); new RwDummy(objects::RW2, objects::DUMMY_COM_IF, comCookieDummy); new RwDummy(objects::RW3, objects::DUMMY_COM_IF, comCookieDummy); @@ -56,5 +59,9 @@ void dummy::createDummies(DummyCfg cfg) { if (cfg.addSusDummies) { new SusDummy(); } + + if (cfg.addTempSensorDummies) { + new TemperatureSensorsDummy(); + } new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); } diff --git a/dummies/helpers.h b/dummies/helpers.h index dfda7d81..680f97c1 100644 --- a/dummies/helpers.h +++ b/dummies/helpers.h @@ -7,6 +7,8 @@ struct DummyCfg { bool addPowerDummies = true; bool addAcsBoardDummies = true; bool addSusDummies = true; + bool addTempSensorDummies = true; + bool addRtdComIFDummy = true; }; void createDummies(DummyCfg cfg); From 2f183474306c8eea54a5e2b8c96598048a6f1b6a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 15:12:32 +0200 Subject: [PATCH 106/361] move object ID definition --- common/config/commonObjects.h | 3 +++ linux/fsfwconfig/objects/systemObjectList.h | 1 - linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index e0efbce7..6389046b 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -107,6 +107,9 @@ enum commonObjects : uint32_t { SYRLINKS_HK_HANDLER = 0x445300A3, + /* 0x49 ('I') for Communication Interfaces */ + SPI_RTD_COM_IF = 0x49020006, + // 0x60 for other stuff HEATER_0_PLOC_PROC_BRD = 0x60000000, HEATER_1_PCDU_BRD = 0x60000001, diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index 669fcc9f..4b49ce82 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -50,7 +50,6 @@ enum sourceObjects : uint32_t { SPI_MAIN_COM_IF = 0x49020004, GPIO_IF = 0x49010005, SPI_RW_COM_IF = 0x49020005, - SPI_RTD_COM_IF = 0x49020006, /* 0x54 ('T') for test handlers */ TEST_TASK = 0x54694269, diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 2535a10e..e11632c8 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -370,7 +370,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); #endif -#if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1 +#if OBSW_ADD_ACS_BOARD == 1 bool enableAside = true; bool enableBside = true; if (enableAside) { @@ -436,7 +436,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); } -#endif /* OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1 */ +#endif /* OBSW_ADD_ACS_BOARD == 1 */ return thisSequence->checkSequence(); } From cee114af7e3d1d05df0e2addef4829f0d852b906 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 15:13:22 +0200 Subject: [PATCH 107/361] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 3d2fc284..95aac7dc 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 3d2fc2846833ee9c125d11107bbd56b3e13536f1 +Subproject commit 95aac7dc8de8290c498cb4eb70ed63f20f39eda7 From 9411b740ae05bfcf77947f85e884b2e12785a5a9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 17:28:43 +0200 Subject: [PATCH 108/361] CFDP integration almost complete --- bsp_q7s/core/InitMission.cpp | 13 ++++++++ fsfw | 2 +- mission/CMakeLists.txt | 1 + mission/cfdp/CMakeLists.txt | 0 mission/cfdp/Config.h | 57 +++++++++++++++++++++++++++++++++ mission/core/GenericFactory.cpp | 49 +++++++++++++++++----------- tmtc | 2 +- 7 files changed, 103 insertions(+), 21 deletions(-) create mode 100644 mission/cfdp/CMakeLists.txt create mode 100644 mission/cfdp/Config.h diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 69da16f0..22ae8d40 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -124,6 +124,15 @@ void initmission::initTasks() { } #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ +#if OBSW_ADD_CFDP_COMPONENTS == 1 + PeriodicTaskIF* cfdpTask = factory->createPeriodicTask( + "CFDP Handler", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); + result = cfdpTask->addComponent(objects::CFDP_HANDLER); + if (result != returnvalue::OK) { + initmission::printAddObjectError("CFDP Handler", objects::CFDP_HANDLER); + } +#endif + PeriodicTaskIF* acsTask = factory->createPeriodicTask( "ACS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); #if OBSW_ADD_ACS_HANDLERS == 1 @@ -279,6 +288,10 @@ void initmission::initTasks() { ptmeTestTask->startTask(); #endif +#if OBSW_ADD_CFDP_COMPONENTS == 1 + cfdpTask->startTask(); +#endif + #if OBSW_ADD_STAR_TRACKER == 1 strHelperTask->startTask(); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ diff --git a/fsfw b/fsfw index 95aac7dc..e2c11583 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 95aac7dc8de8290c498cb4eb70ed63f20f39eda7 +Subproject commit e2c115833762f1887804fef76baebedf914e36d2 diff --git a/mission/CMakeLists.txt b/mission/CMakeLists.txt index 73b19b69..6b4248bf 100644 --- a/mission/CMakeLists.txt +++ b/mission/CMakeLists.txt @@ -6,3 +6,4 @@ add_subdirectory(memory) add_subdirectory(tmtc) add_subdirectory(system) add_subdirectory(csp) +add_subdirectory(cfdp) diff --git a/mission/cfdp/CMakeLists.txt b/mission/cfdp/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/mission/cfdp/Config.h b/mission/cfdp/Config.h new file mode 100644 index 00000000..d4ea3d2b --- /dev/null +++ b/mission/cfdp/Config.h @@ -0,0 +1,57 @@ +#ifndef MISSION_CFDP_CONFIG_H_ +#define MISSION_CFDP_CONFIG_H_ + +#include "fsfw/cfdp.h" + +namespace cfdp { + +class EiveUserHandler : public cfdp::UserBase { + public: + explicit EiveUserHandler(HasFileSystemIF& vfs) : cfdp::UserBase(vfs) {} + virtual ~EiveUserHandler() = default; + + void transactionIndication(const cfdp::TransactionId& id) override {} + void eofSentIndication(const cfdp::TransactionId& id) override {} + void transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) override { + sif::info << "File transaction finished for transaction with " << params.id << std::endl; + } + void metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) override { + sif::info << "Metadata received for transaction with " << params.id << std::endl; + } + void fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) override {} + void reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) override {} + void suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) override {} + void resumedIndication(const cfdp::TransactionId& id, size_t progress) override {} + void faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, + size_t progress) override {} + void abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code, + size_t progress) override {} + void eofRecvIndication(const cfdp::TransactionId& id) override { + sif::info << "EOF PDU received for transaction with " << id << std::endl; + } +}; + +class EiveFaultHandler : public cfdp::FaultHandlerBase { + public: + void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { + sif::warning << "Notice of suspension detected for transaction " << id + << " with condition code: " << cfdp::getConditionCodeString(code) << std::endl; + } + void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { + sif::warning << "Notice of suspension detected for transaction " << id + << " with condition code: " << cfdp::getConditionCodeString(code) << std::endl; + } + void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { + sif::warning << "Transaction " << id + << " was abandoned, condition code : " << cfdp::getConditionCodeString(code) + << std::endl; + } + void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override { + sif::warning << "Fault ignored for transaction " << id + << ", condition code: " << cfdp::getConditionCodeString(code) << std::endl; + } +}; + +} + +#endif /* MISSION_CFDP_CONFIG_H_ */ diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 99324e4c..c58895f5 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -1,9 +1,11 @@ #include "GenericFactory.h" #include +#include #include #include #include +#include #include #include #include @@ -22,6 +24,7 @@ #include #include "OBSWConfig.h" +#include "mission/cfdp/Config.h" #include "eive/definitions.h" #include "fsfw/pus/Service11TelecommandScheduling.h" #include "objects/systemObjectList.h" @@ -47,6 +50,20 @@ #define OBSW_TM_TO_PTME 0 #endif +namespace cfdp { + +PacketInfoList<64> PACKET_LIST; +LostSegmentsList<128> LOST_SEGMENTS; +EntityId REMOTE_CFDP_ID(UnsignedByteField(config::EIVE_GROUND_CFDP_ENTITY_ID)); +RemoteEntityCfg GROUND_REMOTE_CFG(REMOTE_CFDP_ID); +OneRemoteConfigProvider REMOTE_CFG_PROVIDER(GROUND_REMOTE_CFG); +HostFilesystem HOST_FS; +EiveUserHandler USER_HANDLER(HOST_FS); +EiveFaultHandler EIVE_FAULT_HANDLER; + +} + + void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { // Framework objects new EventManager(objects::EVENT_MANAGER); @@ -135,25 +152,19 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { #endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */ #if OBSW_ADD_CFDP_COMPONENTS == 1 - auto* hostFs = new HostFilesystem(); - FsfwHandlerParams params(objects::CFDP_HANDLER, *hostFs, *funnel, *tcStore, *tmStore); + using namespace cfdp; + auto* msgQueue = QueueFactory::instance()->createMessageQueue(32); + FsfwHandlerParams params(objects::CFDP_HANDLER, HOST_FS, *funnel, *tcStore, *tmStore, *msgQueue); cfdp::IndicationCfg indicationCfg; -// UnsignedByteField apid(common::COMMON_CFDP_APID); -// cfdp::EntityId localId(apid); -// UnsignedByteField remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID); -// cfdp::EntityId remoteId(remoteEntityId); -// cfdp::RemoteEntityCfg remoteCfg(remoteId); -// remoteCfg.defaultChecksum = cfdp::ChecksumTypes::CRC_32; -// auto* remoteCfgProvider = new cfdp::OneRemoteConfigProvider(remoteCfg); -// auto* cfdpUserHandler = new CfdpExampleUserHandler(*hostFs); -// auto* cfdpFaultHandler = new CfdpExampleFaultHandler(); -// cfdp::PacketInfoList<64> packetList; -// cfdp::LostSegmentsList<128> lostSegments; -// CfdpHandlerCfg cfg(localId, indicationCfg, *cfdpUserHandler, *cfdpFaultHandler, packetList, -// lostSegments, *remoteCfgProvider); -// auto* cfdpHandler = new CfdpHandler(params, cfg); -// CcsdsDistributorIF::DestInfo info("CFDP Destination", common::COMMON_CFDP_APID, -// cfdpHandler->getRequestQueue(), true); -// ccsdsDistrib->registerApplication(info); + UnsignedByteField apid(config::EIVE_LOCAL_CFDP_ENTITY_ID); + cfdp::EntityId localId(apid); + GROUND_REMOTE_CFG.defaultChecksum = cfdp::ChecksumType::CRC_32; + CfdpHandlerCfg cfg(localId, indicationCfg, USER_HANDLER, EIVE_FAULT_HANDLER, PACKET_LIST, + LOST_SEGMENTS, REMOTE_CFG_PROVIDER); + auto* cfdpHandler = new CfdpHandler(params, cfg); + // All CFDP packets arrive wrapped inside CCSDS space packets + CcsdsDistributorIF::DestInfo info("CFDP Destination", config::EIVE_CFDP_APID, + cfdpHandler->getRequestQueue(), true); + ccsdsDistrib->registerApplication(info); #endif } diff --git a/tmtc b/tmtc index 603b7e85..91f85537 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 603b7e8574d74ba60692115133cde3cd8b8bd423 +Subproject commit 91f85537ce9903514c411c02654410bc7489d6f4 From 8aa412e865393c8342d96b74cef5752448f05043 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 18:10:23 +0200 Subject: [PATCH 109/361] add CFDP APID to TCP parse list --- bsp_hosted/ObjectFactory.cpp | 2 +- .../fsfwconfig/events/subsystemIdRanges.h | 4 ++-- .../fsfwconfig/objects/systemObjectList.h | 4 ++-- bsp_q7s/core/InitMission.cpp | 6 +++++- common/config/commonConfig.cpp | 5 ++++- common/config/commonConfig.h.in | 1 + common/config/eive/objects.h | 1 + fsfw | 2 +- mission/cfdp/CMakeLists.txt | 1 + mission/cfdp/Config.h | 2 +- mission/core/GenericFactory.cpp | 18 +++++++++++------- tmtc | 2 +- 12 files changed, 31 insertions(+), 17 deletions(-) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 6172f3ed..6c85b04d 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -6,10 +6,10 @@ #include #include #include -#include "eive/definitions.h" #include #include "OBSWConfig.h" +#include "eive/definitions.h" #include "fsfw_tests/integration/task/TestTask.h" #if OBSW_USE_TMTC_TCP_BRIDGE == 0 diff --git a/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h b/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h index 592c3624..b99164db 100644 --- a/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h +++ b/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h @@ -1,10 +1,10 @@ #ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ -#include "eive/eventSubsystemIds.h" - #include +#include "eive/eventSubsystemIds.h" + /** * These IDs are part of the ID for an event thrown by a subsystem. * Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/) diff --git a/bsp_hosted/fsfwconfig/objects/systemObjectList.h b/bsp_hosted/fsfwconfig/objects/systemObjectList.h index add077d4..8b264882 100644 --- a/bsp_hosted/fsfwconfig/objects/systemObjectList.h +++ b/bsp_hosted/fsfwconfig/objects/systemObjectList.h @@ -1,10 +1,10 @@ #ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ -#include "eive/objects.h" - #include +#include "eive/objects.h" + // The objects will be instantiated in the ID order namespace objects { enum sourceObjects : uint32_t { diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 22ae8d40..75738905 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -84,6 +84,10 @@ void initmission::initTasks() { if (result != returnvalue::OK) { initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR); } + result = tmTcDistributor->addComponent(objects::CFDP_DISTRIBUTOR); + if (result != returnvalue::OK) { + initmission::printAddObjectError("CFDP_DISTRIBUTOR", objects::CFDP_DISTRIBUTOR); + } result = tmTcDistributor->addComponent(objects::TM_FUNNEL); if (result != returnvalue::OK) { initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL); @@ -126,7 +130,7 @@ void initmission::initTasks() { #if OBSW_ADD_CFDP_COMPONENTS == 1 PeriodicTaskIF* cfdpTask = factory->createPeriodicTask( - "CFDP Handler", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); + "CFDP Handler", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); result = cfdpTask->addComponent(objects::CFDP_HANDLER); if (result != returnvalue::OK) { initmission::printAddObjectError("CFDP Handler", objects::CFDP_HANDLER); diff --git a/common/config/commonConfig.cpp b/common/config/commonConfig.cpp index 56388f8b..cdc4e23f 100644 --- a/common/config/commonConfig.cpp +++ b/common/config/commonConfig.cpp @@ -5,4 +5,7 @@ const fsfw::Version common::OBSW_VERSION{OBSW_VERSION_MAJOR, OBSW_VERSION_MINOR, OBSW_VERSION_REVISION, OBSW_VERSION_CST_GIT_SHA1}; -const uint16_t common::PUS_PACKET_ID = ccsds::getTcSpacePacketIdFromApid(config::EIVE_PUS_APID); +const uint16_t common::PUS_PACKET_ID = + ccsds::getTcSpacePacketIdFromApid(config::EIVE_PUS_APID, true); +const uint16_t common::CFDP_PACKET_ID = + ccsds::getTcSpacePacketIdFromApid(config::EIVE_CFDP_APID, false); diff --git a/common/config/commonConfig.h.in b/common/config/commonConfig.h.in index 1b0111e1..83e1aaac 100644 --- a/common/config/commonConfig.h.in +++ b/common/config/commonConfig.h.in @@ -41,6 +41,7 @@ static constexpr uint32_t OBSW_MAX_SCHEDULED_TCS = @OBSW_MAX_SCHEDULED_TCS@; extern const fsfw::Version OBSW_VERSION; extern const uint16_t PUS_PACKET_ID; +extern const uint16_t CFDP_PACKET_ID; static constexpr uint32_t CCSDS_HANDLER_QUEUE_SIZE = 50; static constexpr uint8_t NUMBER_OF_VIRTUAL_CHANNELS = 4; diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index 89e4b8d3..4f89dd0a 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -123,6 +123,7 @@ enum commonObjects : uint32_t { TCS_BOARD_ASS = 0x73000003, RW_ASS = 0x73000004, CFDP_HANDLER = 0x73000005, + CFDP_DISTRIBUTOR = 0x73000006 }; } diff --git a/fsfw b/fsfw index e2c11583..c5b24f25 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e2c115833762f1887804fef76baebedf914e36d2 +Subproject commit c5b24f2516227ad84d92f34b12e386c7e0945a09 diff --git a/mission/cfdp/CMakeLists.txt b/mission/cfdp/CMakeLists.txt index e69de29b..8b137891 100644 --- a/mission/cfdp/CMakeLists.txt +++ b/mission/cfdp/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/mission/cfdp/Config.h b/mission/cfdp/Config.h index d4ea3d2b..45f84155 100644 --- a/mission/cfdp/Config.h +++ b/mission/cfdp/Config.h @@ -52,6 +52,6 @@ class EiveFaultHandler : public cfdp::FaultHandlerBase { } }; -} +} // namespace cfdp #endif /* MISSION_CFDP_CONFIG_H_ */ diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index c58895f5..748aa02e 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -1,5 +1,6 @@ #include "GenericFactory.h" +#include #include #include #include @@ -24,9 +25,9 @@ #include #include "OBSWConfig.h" -#include "mission/cfdp/Config.h" #include "eive/definitions.h" #include "fsfw/pus/Service11TelecommandScheduling.h" +#include "mission/cfdp/Config.h" #include "objects/systemObjectList.h" #include "tmtc/pusIds.h" @@ -61,8 +62,7 @@ HostFilesystem HOST_FS; EiveUserHandler USER_HANDLER(HOST_FS); EiveFaultHandler EIVE_FAULT_HANDLER; -} - +} // namespace cfdp void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { // Framework objects @@ -141,7 +141,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { auto tmtcBridge = 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}); + tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID, common::CFDP_PACKET_ID}); sif::info << "Created TCP server for TMTC commanding with listener port " << tcpServer->getTcpPort() << std::endl; #if OBSW_TCP_SERVER_WIRETAPPING == 1 @@ -153,15 +153,19 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { #if OBSW_ADD_CFDP_COMPONENTS == 1 using namespace cfdp; + MessageQueueIF* cfdpMsgQueue = QueueFactory::instance()->createMessageQueue(32); + CfdpDistribCfg distribCfg(objects::CFDP_DISTRIBUTOR, *tcStore, cfdpMsgQueue); + new CfdpDistributor(distribCfg); + auto* msgQueue = QueueFactory::instance()->createMessageQueue(32); FsfwHandlerParams params(objects::CFDP_HANDLER, HOST_FS, *funnel, *tcStore, *tmStore, *msgQueue); cfdp::IndicationCfg indicationCfg; UnsignedByteField apid(config::EIVE_LOCAL_CFDP_ENTITY_ID); cfdp::EntityId localId(apid); GROUND_REMOTE_CFG.defaultChecksum = cfdp::ChecksumType::CRC_32; - CfdpHandlerCfg cfg(localId, indicationCfg, USER_HANDLER, EIVE_FAULT_HANDLER, PACKET_LIST, - LOST_SEGMENTS, REMOTE_CFG_PROVIDER); - auto* cfdpHandler = new CfdpHandler(params, cfg); + CfdpHandlerCfg cfdpCfg(localId, indicationCfg, USER_HANDLER, EIVE_FAULT_HANDLER, PACKET_LIST, + LOST_SEGMENTS, REMOTE_CFG_PROVIDER); + auto* cfdpHandler = new CfdpHandler(params, cfdpCfg); // All CFDP packets arrive wrapped inside CCSDS space packets CcsdsDistributorIF::DestInfo info("CFDP Destination", config::EIVE_CFDP_APID, cfdpHandler->getRequestQueue(), true); diff --git a/tmtc b/tmtc index 91f85537..2210ddb1 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 91f85537ce9903514c411c02654410bc7489d6f4 +Subproject commit 2210ddb168508f0c2c1426a783725ccb78dadf3a From b48c5d528e2a47b9e77754a59a4456d8b5ce10c2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 18:16:52 +0200 Subject: [PATCH 110/361] larger TC and TM store --- mission/core/GenericFactory.cpp | 6 +++--- tmtc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 748aa02e..24870504 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -77,14 +77,14 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { StorageManagerIF* tcStore; StorageManagerIF* tmStore; { - PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {200, 64}, - {200, 128}, {100, 1024}, {10, 2048}}; + PoolManager::LocalPoolConfig poolCfg = {{200, 16}, {200, 32}, {150, 64}, + {100, 128}, {100, 1024}, {100, 2048}}; tcStore = new PoolManager(objects::TC_STORE, poolCfg); } { PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {100, 64}, - {100, 128}, {100, 1024}, {10, 2048}}; + {100, 128}, {100, 1024}, {100, 2048}}; tmStore = new PoolManager(objects::TM_STORE, poolCfg); } diff --git a/tmtc b/tmtc index 2210ddb1..e2811947 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 2210ddb168508f0c2c1426a783725ccb78dadf3a +Subproject commit e2811947dcb387a43e69593792027e1d62181677 From cb6366b2089bcd26b72007a18898af047377506c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 18:24:46 +0200 Subject: [PATCH 111/361] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index c5b24f25..79ab0c4a 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit c5b24f2516227ad84d92f34b12e386c7e0945a09 +Subproject commit 79ab0c4aa5f2c6441f97640301cba48052294581 From d2ca1139a767accaccb8dc9ab51230ebda7fe2b7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 18:29:41 +0200 Subject: [PATCH 112/361] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index e2811947..847a9dc0 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit e2811947dcb387a43e69593792027e1d62181677 +Subproject commit 847a9dc000da29ae6faca3c97eb0af660cf96572 From 0fc639cc11437b08e6b445f65649c5a4534e85f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 18:48:05 +0200 Subject: [PATCH 113/361] added action IDs for new commands --- bsp_q7s/core/CoreController.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index c1cdbf93..eca5563c 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -67,6 +67,11 @@ class CoreController : public ExtendedControllerBase { static constexpr ActionId_t SWITCH_IMG_LOCK = 7; static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8; + static constexpr ActionId_t COPY_OBSW_UPDATE_0_0 = 10; + static constexpr ActionId_t COPY_OBSW_UPDATE_0_1 = 11; + static constexpr ActionId_t COPY_OBSW_UPDATE_1_0 = 12; + static constexpr ActionId_t COPY_OBSW_UPDATE_1_1 = 13; + //! Reboot using the xsc_boot_copy command static constexpr ActionId_t XSC_REBOOT_OBC = 32; static constexpr ActionId_t MOUNT_OTHER_COPY = 33; From afba412fe218c08c0ace35fb0f2e5b246344c7c8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 18:53:11 +0200 Subject: [PATCH 114/361] separate script to create obsw version file --- scripts/create-version-file.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 scripts/create-version-file.sh diff --git a/scripts/create-version-file.sh b/scripts/create-version-file.sh new file mode 100755 index 00000000..4a822dcf --- /dev/null +++ b/scripts/create-version-file.sh @@ -0,0 +1,7 @@ +#!/bin/bash +obsw_version_filename="obsw_version.txt" +version_cmd="git describe --tags --always --exclude docker_*" +version_tag=$(${version_cmd}) +echo "-I- Running ${version_cmd} to retrieve OBSW version and store it into ${obsw_version_filename}" +echo "-I- Detected version tag ${version_tag}" +echo ${version_tag} > ${obsw_version_filename} From b308a037b4228f000d92e1009f9bfbe926a35165 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 18:56:03 +0200 Subject: [PATCH 115/361] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 79ab0c4a..808e3e04 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 79ab0c4aa5f2c6441f97640301cba48052294581 +Subproject commit 808e3e0462999d7caa1b6834174140dbbeb8b01c From 2ddd95c7fd6b4cf935974c74e16cf70259005a53 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 19:57:19 +0200 Subject: [PATCH 116/361] helper scripts and README section for OBSW update --- README.md | 51 ++++++++++++++++++++++++++++++++++ scripts/compress-obsw.sh | 9 ++++++ scripts/prepare-obsw-update.sh | 3 ++ 3 files changed, 63 insertions(+) create mode 100755 scripts/compress-obsw.sh create mode 100755 scripts/prepare-obsw-update.sh diff --git a/README.md b/README.md index fcff24d0..d3f419ec 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,57 @@ When using Windows, run theses steps in MSYS2. cmake --build . -j ``` +## Preparing and executing an OBSW update + +A OBSW update consists of the following two files + +1. Stripped OBSW binary compressed with `xz` with the name `eive-obsw.tar.xz` +2. OBSW version text file with the name `obsw_version.txt` + +These files can be created manually: + +1. Build the release image and then switch into the build directory +2. Run the following command: `tar -cJvf eive-obsw.tar.xz eive-obsw-stripped` +3. Run the following command to create the version file + + ```sh + git describe --tags --always --exclude docker_* > obsw_version.txt + ``` + +You can also use the helper script `prepare-obsw-update.sh` inside the build folder +after sourcing the `q7s-env.sh` helper script to perform all three steps. + +After creating these files, they need to be transferred onto the Q7S +to either the `/mnt/sd0/bin` or to the `/mnt/sd1/bin` folder depending on which +SD card is used. + +After both files are in place (this is checked by the OBSW), the example command +sequence is used by the OBSW to write the OBSW update to the QSPI chip 0 and +slot 0 using SD card 0: + +```sh +tar -xJvf eive-obsw.tar.xz +cp-to-other-slots.sh 0 0 /mnt/sd0/bin/eive-obsw-stripped /usr/bin/eive-obsw --np +cp-to-other-slots.sh 0 0 /mnt/sd0/bin/obsw_update.txt /usr/share/obsw_update.txt +``` + +The helper script `cp-to-other-slots.sh` performs the following steps: + +1. It mounts the target chip and copy combination into the `/tmp` folder + using the `xsc_mount_copy` utility. This also unlocks the + writeprotection for the chip. The mount point name inside `/tmp` depends + on which chip and copy is used + + - Chip 0 Copy 0: `/tmp/mntupdate-xdi-qspi0-nom-rootfs` + - Chip 0 Copy 1: `/tmp/mntupdate-xdi-qspi0-gold-rootfs` + - Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs` + - Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-gold-rootfs` +2. It writes the file with a regular `cp ` command +3. It enables the writeprotection using the `writeprotect` utility. + +This script also has an additional `--np` arguments to disable the +re-application of write-protection after the mount and copy operation. + ## Build for the Q7S target root filesystem with `yocto` The EIVE root filesystem will contain the EIVE OBSW and the Watchdog component. diff --git a/scripts/compress-obsw.sh b/scripts/compress-obsw.sh new file mode 100755 index 00000000..ca2b7254 --- /dev/null +++ b/scripts/compress-obsw.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -d eive-obsw-stripped ]; then + echo "No file eive-obsw-stripped found. Please ensure you are in the build folder" +fi + +cmd="tar -cJvf eive-obsw.tar.xz eive-obsw-stripped" +echo "Running command ${cmd} to generate compressed OBSW" +eval ${cmd} diff --git a/scripts/prepare-obsw-update.sh b/scripts/prepare-obsw-update.sh new file mode 100755 index 00000000..87a92105 --- /dev/null +++ b/scripts/prepare-obsw-update.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source create-version-file.sh +source compress-obsw.sh From 15641c61ea6ae6c018ac16735bf8297794973c98 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 10:56:57 +0200 Subject: [PATCH 117/361] these commands make more sense --- bsp_q7s/core/CoreController.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index eca5563c..ea3ae0ea 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -67,10 +67,9 @@ class CoreController : public ExtendedControllerBase { static constexpr ActionId_t SWITCH_IMG_LOCK = 7; static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8; - static constexpr ActionId_t COPY_OBSW_UPDATE_0_0 = 10; - static constexpr ActionId_t COPY_OBSW_UPDATE_0_1 = 11; - static constexpr ActionId_t COPY_OBSW_UPDATE_1_0 = 12; - static constexpr ActionId_t COPY_OBSW_UPDATE_1_1 = 13; + static constexpr ActionId_t OBSW_UPDATE_FROM_SD_0 = 10; + static constexpr ActionId_t OBSW_UPDATE_FROM_SD_1 = 11; + static constexpr ActionId_t OBSW_UPDATE_FROM_TMP = 12; //! Reboot using the xsc_boot_copy command static constexpr ActionId_t XSC_REBOOT_OBC = 32; From 65a7d38f544ffd67f418154ca00a8d461a87035a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 11:12:41 +0200 Subject: [PATCH 118/361] adaptions for update sequence --- README.md | 39 ++++++++++++++++++++------------- bsp_q7s/core/CoreController.cpp | 3 +++ bsp_q7s/core/CoreController.h | 6 +++++ scripts/compress-obsw.sh | 9 -------- scripts/create-sw-update.sh | 17 ++++++++++++++ scripts/prepare-obsw-update.sh | 2 +- 6 files changed, 51 insertions(+), 25 deletions(-) delete mode 100755 scripts/compress-obsw.sh create mode 100755 scripts/create-sw-update.sh diff --git a/README.md b/README.md index d3f419ec..d46b09a4 100644 --- a/README.md +++ b/README.md @@ -154,42 +154,53 @@ When using Windows, run theses steps in MSYS2. ## Preparing and executing an OBSW update -A OBSW update consists of the following two files +A OBSW update consists of a `xz` compressed file `eive-sw-update.tar.xz` +which contains the following two files: -1. Stripped OBSW binary compressed with `xz` with the name `eive-obsw.tar.xz` +1. Stripped OBSW binary `eive-obsw-stripped` 2. OBSW version text file with the name `obsw_version.txt` These files can be created manually: 1. Build the release image and then switch into the build directory -2. Run the following command: `tar -cJvf eive-obsw.tar.xz eive-obsw-stripped` -3. Run the following command to create the version file +2. Run the following command to create the version file ```sh git describe --tags --always --exclude docker_* > obsw_version.txt ``` +3. Run the following command to create the compressed archive + + ```sh + tar -cJvf eive-sw-update.tar.xz eive-obsw-stripped obsw_version.txt + ``` + You can also use the helper script `prepare-obsw-update.sh` inside the build folder after sourcing the `q7s-env.sh` helper script to perform all three steps. After creating these files, they need to be transferred onto the Q7S -to either the `/mnt/sd0/bin` or to the `/mnt/sd1/bin` folder depending on which -SD card is used. +to either the `/mnt/sd0/bin` or `/mnt/sd1/bin` folder if the OBSW update +is performed from the SD card. It can also be transferred to the `/tmp` folder +to perform the update from a temporary directory, which does not rely on any +of the SD cards being on and mounted. However, all files in the temporary +directory will be deleted if the Linux OS is rebooted for any reason. After both files are in place (this is checked by the OBSW), the example command sequence is used by the OBSW to write the OBSW update to the QSPI chip 0 and slot 0 using SD card 0: ```sh -tar -xJvf eive-obsw.tar.xz -cp-to-other-slots.sh 0 0 /mnt/sd0/bin/eive-obsw-stripped /usr/bin/eive-obsw --np -cp-to-other-slots.sh 0 0 /mnt/sd0/bin/obsw_update.txt /usr/share/obsw_update.txt +tar -xJvf eive-update.tar.xz +xsc_mount_copy 0 0 +cp eive-obsw-stripped /tmp/mntupdate-xdi-qspi0-nom-rootfs/usr/bin/eive-obsw +cp obsw_update.txt /tmp/mntupdate-xdi-qspi0-nom-rootfs/usr/share/obsw_update.txt +writeprotect 0 0 1 ``` -The helper script `cp-to-other-slots.sh` performs the following steps: +Some context information about the used commands: 1. It mounts the target chip and copy combination into the `/tmp` folder - using the `xsc_mount_copy` utility. This also unlocks the + using the `xsc_mount_copy ` utility. This also unlocks the writeprotection for the chip. The mount point name inside `/tmp` depends on which chip and copy is used @@ -197,11 +208,9 @@ The helper script `cp-to-other-slots.sh` performs the following steps: - Chip 0 Copy 1: `/tmp/mntupdate-xdi-qspi0-gold-rootfs` - Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs` - Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-gold-rootfs` -2. It writes the file with a regular `cp ` command -3. It enables the writeprotection using the `writeprotect` utility. -This script also has an additional `--np` arguments to disable the -re-application of write-protection after the mount and copy operation. +2. Writing the file with a regular `cp ` command +3. Enabling the writeprotection using the `writeprotect 1` utility. ## Build for the Q7S target root filesystem with `yocto` diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 8406d78b..08b179c8 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -198,6 +198,9 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ } return HasActionsIF::EXECUTION_FINISHED; } + case(OBSW_UPDATE_FROM_SD_0): { + break; + } case (SWITCH_IMG_LOCK): { if (size != 3) { return HasActionsIF::INVALID_PARAMETERS; diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index ea3ae0ea..666d0b82 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -51,6 +51,7 @@ class CoreController : public ExtendedControllerBase { static constexpr char CHIP_PROT_SCRIPT[] = "get-chip-prot-status.sh"; static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt"; static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt"; + static constexpr char OBSW_COMPRESSED_NAME[] = "eive-obsw.tar.xz"; static constexpr char CONF_FOLDER[] = "conf"; static constexpr char VERSION_FILE_NAME[] = "version.txt"; static constexpr char REBOOT_FILE_NAME[] = "reboot.txt"; @@ -61,6 +62,11 @@ class CoreController : public ExtendedControllerBase { "/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME); const std::string TIME_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(TIME_FILE_NAME); + static constexpr char CHIP_0_COPY_0_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi0-nom-rootfs"; + static constexpr char CHIP_0_COPY_1_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi0-gold-rootfs"; + 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 ActionId_t LIST_DIRECTORY_INTO_FILE = 0; static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5; static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6; diff --git a/scripts/compress-obsw.sh b/scripts/compress-obsw.sh deleted file mode 100755 index ca2b7254..00000000 --- a/scripts/compress-obsw.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ -d eive-obsw-stripped ]; then - echo "No file eive-obsw-stripped found. Please ensure you are in the build folder" -fi - -cmd="tar -cJvf eive-obsw.tar.xz eive-obsw-stripped" -echo "Running command ${cmd} to generate compressed OBSW" -eval ${cmd} diff --git a/scripts/create-sw-update.sh b/scripts/create-sw-update.sh new file mode 100755 index 00000000..89ad9aff --- /dev/null +++ b/scripts/create-sw-update.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ -f eive-obsw-stripped ]; then + echo "No file eive-obsw-stripped found. Please ensure you are in the " + echo "build folder and the OBSW was built properly" + exit 1 +fi + +if [ -f obsw_version.txt ]; then + echo "No OBSW version file found." + echo "You can use the create-version-file.sh script to create it" + exit 1 +fi + +cmd="tar -cJvf eive-obsw.tar.xz eive-obsw-stripped obsw_version.txt" +echo "Running command ${cmd} to generate compressed SW update archive" +eval ${cmd} diff --git a/scripts/prepare-obsw-update.sh b/scripts/prepare-obsw-update.sh index 87a92105..3d18df21 100755 --- a/scripts/prepare-obsw-update.sh +++ b/scripts/prepare-obsw-update.sh @@ -1,3 +1,3 @@ #!/bin/bash source create-version-file.sh -source compress-obsw.sh +source create-sw-update.sh From 80f0664139b4ae83ea6cbb232e27d43bb63f6cae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 11:15:37 +0200 Subject: [PATCH 119/361] added some more fixed file names --- bsp_q7s/core/CoreController.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 666d0b82..bf3e41d8 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -51,11 +51,16 @@ class CoreController : public ExtendedControllerBase { static constexpr char CHIP_PROT_SCRIPT[] = "get-chip-prot-status.sh"; static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt"; static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt"; - static constexpr char OBSW_COMPRESSED_NAME[] = "eive-obsw.tar.xz"; + static constexpr char CONF_FOLDER[] = "conf"; + + static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz"; + static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME = "eive-obsw-stripped"; + static constexpr char OBSW_VERSION_FILE_NAME = "obsw_version.txt"; static constexpr char VERSION_FILE_NAME[] = "version.txt"; static constexpr char REBOOT_FILE_NAME[] = "reboot.txt"; static constexpr char TIME_FILE_NAME[] = "time.txt"; + const std::string VERSION_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME); const std::string REBOOT_FILE = From ec91d9977a7f3fa9eb6743d4696c44a8dcfbed51 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 11:20:03 +0200 Subject: [PATCH 120/361] move shell scripts helpers to root --- bsp_q7s/core/CoreController.cpp | 2 +- scripts/q7s-env-em.sh => q7s-env-em.sh | 0 scripts/q7s-env.sh => q7s-env.sh | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename scripts/q7s-env-em.sh => q7s-env-em.sh (100%) rename scripts/q7s-env.sh => q7s-env.sh (100%) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 08b179c8..0770c933 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -199,7 +199,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return HasActionsIF::EXECUTION_FINISHED; } case(OBSW_UPDATE_FROM_SD_0): { - break; + return HasActionsIF::EXECUTION_FINISHED; } case (SWITCH_IMG_LOCK): { if (size != 3) { diff --git a/scripts/q7s-env-em.sh b/q7s-env-em.sh similarity index 100% rename from scripts/q7s-env-em.sh rename to q7s-env-em.sh diff --git a/scripts/q7s-env.sh b/q7s-env.sh similarity index 100% rename from scripts/q7s-env.sh rename to q7s-env.sh From 7d824f5448139f28195eb761e8ec0da6e9a54313 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 11:31:29 +0200 Subject: [PATCH 121/361] updated helper scripts --- README.md | 15 ++++++++++----- bsp_q7s/core/CoreController.h | 12 ++++++------ scripts/create-sw-update.sh | 12 ++++++++---- scripts/prepare-obsw-update.sh | 3 --- 4 files changed, 24 insertions(+), 18 deletions(-) delete mode 100755 scripts/prepare-obsw-update.sh diff --git a/README.md b/README.md index d46b09a4..4bf83845 100644 --- a/README.md +++ b/README.md @@ -162,21 +162,26 @@ which contains the following two files: These files can be created manually: -1. Build the release image and then switch into the build directory -2. Run the following command to create the version file +1. Build the release image inside `cmake-build-release-q7s` +2. Switch into the build directory +3. Run the following command to create the version file ```sh git describe --tags --always --exclude docker_* > obsw_version.txt ``` -3. Run the following command to create the compressed archive + You can also use the `create-version-file.sh` helper shell script + located in the `scripts` folder to do this. + +4. Run the following command to create the compressed archive ```sh tar -cJvf eive-sw-update.tar.xz eive-obsw-stripped obsw_version.txt ``` -You can also use the helper script `prepare-obsw-update.sh` inside the build folder -after sourcing the `q7s-env.sh` helper script to perform all three steps. +You can also use the helper script `create-sw-update.sh` inside the build folder +after sourcing the `q7s-env.sh` helper script to perform all steps including +a rebuild. After creating these files, they need to be transferred onto the Q7S to either the `/mnt/sd0/bin` or `/mnt/sd1/bin` folder if the OBSW update diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index bf3e41d8..381a134c 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -55,8 +55,8 @@ class CoreController : public ExtendedControllerBase { static constexpr char CONF_FOLDER[] = "conf"; static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz"; - static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME = "eive-obsw-stripped"; - static constexpr char OBSW_VERSION_FILE_NAME = "obsw_version.txt"; + static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped"; + static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt"; static constexpr char VERSION_FILE_NAME[] = "version.txt"; static constexpr char REBOOT_FILE_NAME[] = "reboot.txt"; static constexpr char TIME_FILE_NAME[] = "time.txt"; @@ -67,10 +67,10 @@ class CoreController : public ExtendedControllerBase { "/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME); const std::string TIME_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(TIME_FILE_NAME); - static constexpr char CHIP_0_COPY_0_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi0-nom-rootfs"; - static constexpr char CHIP_0_COPY_1_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi0-gold-rootfs"; - 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 char CHIP_0_COPY_0_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi0-nom-rootfs"; + static constexpr char CHIP_0_COPY_1_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi0-gold-rootfs"; + 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 ActionId_t LIST_DIRECTORY_INTO_FILE = 0; static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5; diff --git a/scripts/create-sw-update.sh b/scripts/create-sw-update.sh index 89ad9aff..3aff1c2d 100755 --- a/scripts/create-sw-update.sh +++ b/scripts/create-sw-update.sh @@ -1,17 +1,21 @@ #!/bin/bash -if [ -f eive-obsw-stripped ]; then +cmake --build . -j +source create-version-file.sh + +if [ ! -f eive-obsw-stripped ]; then echo "No file eive-obsw-stripped found. Please ensure you are in the " echo "build folder and the OBSW was built properly" exit 1 fi -if [ -f obsw_version.txt ]; then +if [ ! -f obsw_version.txt ]; then echo "No OBSW version file found." echo "You can use the create-version-file.sh script to create it" exit 1 fi -cmd="tar -cJvf eive-obsw.tar.xz eive-obsw-stripped obsw_version.txt" -echo "Running command ${cmd} to generate compressed SW update archive" +cmd="tar -cJvf eive-sw-update.tar.xz eive-obsw-stripped obsw_version.txt" +echo "Running command ${cmd} to generate compressed SW update archive." eval ${cmd} +echo "Generated eive-sw-update.tar.xz update archive." diff --git a/scripts/prepare-obsw-update.sh b/scripts/prepare-obsw-update.sh deleted file mode 100755 index 3d18df21..00000000 --- a/scripts/prepare-obsw-update.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -source create-version-file.sh -source create-sw-update.sh From 05adc91f94a896b85e04fdd02dce72217c9a1b82 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 11:39:17 +0200 Subject: [PATCH 122/361] moved definitions --- bsp_q7s/core/CoreController.cpp | 19 ++++++++++--------- bsp_q7s/core/CoreController.h | 2 -- bsp_q7s/fs/FilesystemHelper.cpp | 8 ++++---- bsp_q7s/fs/SdCardManager.cpp | 21 +++++++++++---------- bsp_q7s/fs/SdCardManager.h | 3 +-- common/config/eive/definitions.h | 6 ++++++ linux/devices/startracker/StrHelper.cpp | 8 ++++---- 7 files changed, 36 insertions(+), 31 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 0770c933..359d7c27 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -23,6 +23,7 @@ #include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/memory/scratchApi.h" #include "bsp_q7s/xadc/Xadc.h" +#include "eive/definitions.h" #include "linux/utility/utility.h" xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP; @@ -198,7 +199,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ } return HasActionsIF::EXECUTION_FINISHED; } - case(OBSW_UPDATE_FROM_SD_0): { + case (OBSW_UPDATE_FROM_SD_0): { return HasActionsIF::EXECUTION_FINISHED; } case (SWITCH_IMG_LOCK): { @@ -357,9 +358,9 @@ ReturnValue_t CoreController::sdStateMachine() { #if OBSW_VERBOSE_LEVEL >= 1 std::string mountString; if (sdInfo.pref == sd::SdCard::SLOT_0) { - mountString = SdCardManager::SD_0_MOUNT_POINT; + mountString = config::SD_0_MOUNT_POINT; } else { - mountString = SdCardManager::SD_1_MOUNT_POINT; + mountString = config::SD_1_MOUNT_POINT; } sif::info << "SD card " << sdInfo.prefChar << " already on and mounted at " << mountString << std::endl; @@ -579,9 +580,9 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS std::string mountString; sdcMan->setPrintCommandOutput(printOutput); if (sdCard == sd::SdCard::SLOT_0) { - mountString = SdCardManager::SD_0_MOUNT_POINT; + mountString = config::SD_0_MOUNT_POINT; } else { - mountString = SdCardManager::SD_1_MOUNT_POINT; + mountString = config::SD_1_MOUNT_POINT; } sd::SdState state = sd::SdState::OFF; @@ -1262,11 +1263,11 @@ void CoreController::performMountedSdCardOperations() { } }; if (sdInfo.pref == sd::SdCard::SLOT_1) { - mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, SdCardManager::SD_1_MOUNT_POINT); - mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, SdCardManager::SD_0_MOUNT_POINT); + mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT); + mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT); } else { - mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, SdCardManager::SD_0_MOUNT_POINT); - mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, SdCardManager::SD_1_MOUNT_POINT); + mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT); + mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT); } timeFileHandler(); } diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 381a134c..8c4d89b1 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -54,8 +54,6 @@ class CoreController : public ExtendedControllerBase { static constexpr char CONF_FOLDER[] = "conf"; - static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz"; - static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped"; static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt"; static constexpr char VERSION_FILE_NAME[] = "version.txt"; static constexpr char REBOOT_FILE_NAME[] = "reboot.txt"; diff --git a/bsp_q7s/fs/FilesystemHelper.cpp b/bsp_q7s/fs/FilesystemHelper.cpp index 4a0df9e2..68bf2178 100644 --- a/bsp_q7s/fs/FilesystemHelper.cpp +++ b/bsp_q7s/fs/FilesystemHelper.cpp @@ -4,6 +4,7 @@ #include #include "SdCardManager.h" +#include "eive/definitions.h" #include "fsfw/serviceinterface.h" FilesystemHelper::FilesystemHelper() {} @@ -14,14 +15,13 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) { sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl; return returnvalue::FAILED; } - if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) == - std::string(SdCardManager::SD_0_MOUNT_POINT)) { + if (path.substr(0, sizeof(config::SD_0_MOUNT_POINT)) == std::string(config::SD_0_MOUNT_POINT)) { if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl; return SD_NOT_MOUNTED; } - } else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) == - std::string(SdCardManager::SD_1_MOUNT_POINT)) { + } else if (path.substr(0, sizeof(config::SD_1_MOUNT_POINT)) == + std::string(config::SD_1_MOUNT_POINT)) { if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl; return SD_NOT_MOUNTED; diff --git a/bsp_q7s/fs/SdCardManager.cpp b/bsp_q7s/fs/SdCardManager.cpp index 95abc6aa..68155a20 100644 --- a/bsp_q7s/fs/SdCardManager.cpp +++ b/bsp_q7s/fs/SdCardManager.cpp @@ -11,6 +11,7 @@ #include "OBSWConfig.h" #include "bsp_q7s/memory/scratchApi.h" +#include "eive/definitions.h" #include "eive/objects.h" #include "fsfw/ipc/MutexFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" @@ -229,10 +230,10 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) { string mountPoint; if (sdCard == sd::SdCard::SLOT_0) { mountDev = SD_0_DEV_NAME; - mountPoint = SD_0_MOUNT_POINT; + mountPoint = config::SD_0_MOUNT_POINT; } else if (sdCard == sd::SdCard::SLOT_1) { mountDev = SD_1_DEV_NAME; - mountPoint = SD_1_MOUNT_POINT; + mountPoint = config::SD_1_MOUNT_POINT; } if (not filesystem::exists(mountDev)) { sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to" @@ -265,9 +266,9 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) { } string mountPoint; if (sdCard == sd::SdCard::SLOT_0) { - mountPoint = SD_0_MOUNT_POINT; + mountPoint = config::SD_0_MOUNT_POINT; } else if (sdCard == sd::SdCard::SLOT_1) { - mountPoint = SD_1_MOUNT_POINT; + mountPoint = config::SD_1_MOUNT_POINT; } if (not filesystem::exists(mountPoint)) { sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint @@ -415,9 +416,9 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() { std::string SdCardManager::getCurrentMountPrefix() const { MutexGuard mg(mutex); if (sdInfo.active == sd::SdCard::SLOT_0) { - return SD_0_MOUNT_POINT; + return config::SD_0_MOUNT_POINT; } else { - return SD_1_MOUNT_POINT; + return config::SD_1_MOUNT_POINT; } } @@ -494,9 +495,9 @@ bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) { ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) { std::ostringstream command; if (sdcard == sd::SdCard::SLOT_0) { - command << "grep -q '" << SD_0_MOUNT_POINT << " vfat ro,' /proc/mounts"; + command << "grep -q '" << config::SD_0_MOUNT_POINT << " vfat ro,' /proc/mounts"; } else { - command << "grep -q '" << SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts"; + command << "grep -q '" << config::SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts"; } ReturnValue_t result = cmdExecutor.load(command.str(), true, false); if (result != returnvalue::OK) { @@ -523,9 +524,9 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) { std::ostringstream command; if (sdcard == sd::SdCard::SLOT_0) { - command << "mount -o remount,rw " << SD_0_DEV_NAME << " " << SD_0_MOUNT_POINT; + command << "mount -o remount,rw " << SD_0_DEV_NAME << " " << config::SD_0_MOUNT_POINT; } else { - command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << SD_1_MOUNT_POINT; + command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << config::SD_1_MOUNT_POINT; } ReturnValue_t result = cmdExecutor.load(command.str(), true, false); if (result != returnvalue::OK) { diff --git a/bsp_q7s/fs/SdCardManager.h b/bsp_q7s/fs/SdCardManager.h index 87ed91d7..28886ffe 100644 --- a/bsp_q7s/fs/SdCardManager.h +++ b/bsp_q7s/fs/SdCardManager.h @@ -64,8 +64,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF { // C++17 does not support constexpr std::string yet static constexpr char SD_0_DEV_NAME[] = "/dev/mmcblk0p1"; static constexpr char SD_1_DEV_NAME[] = "/dev/mmcblk1p1"; - static constexpr char SD_0_MOUNT_POINT[] = "/mnt/sd0"; - static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1"; + static constexpr char SD_STATE_FILE[] = "/tmp/sd_status.txt"; virtual ~SdCardManager(); diff --git a/common/config/eive/definitions.h b/common/config/eive/definitions.h index 0786cdb3..7927d280 100644 --- a/common/config/eive/definitions.h +++ b/common/config/eive/definitions.h @@ -5,6 +5,12 @@ namespace config { +static constexpr char SD_0_MOUNT_POINT[] = "/mnt/sd0"; +static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1"; + +static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz"; +static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped"; + static constexpr uint16_t EIVE_PUS_APID = 0x65; static constexpr uint16_t EIVE_CFDP_APID = 0x66; static constexpr uint16_t EIVE_LOCAL_CFDP_ENTITY_ID = EIVE_CFDP_APID; diff --git a/linux/devices/startracker/StrHelper.cpp b/linux/devices/startracker/StrHelper.cpp index bee15d70..fa3971af 100644 --- a/linux/devices/startracker/StrHelper.cpp +++ b/linux/devices/startracker/StrHelper.cpp @@ -4,6 +4,7 @@ #include #include "OBSWConfig.h" +#include "eive/definitions.h" #include "fsfw/timemanager/Countdown.h" #include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" #include "mission/utility/Filenaming.h" @@ -541,14 +542,13 @@ ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) { #ifdef XIPHOS_Q7S ReturnValue_t StrHelper::checkPath(std::string name) { - if (name.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) == - std::string(SdCardManager::SD_0_MOUNT_POINT)) { + if (name.substr(0, sizeof(config::SD_0_MOUNT_POINT)) == std::string(config::SD_0_MOUNT_POINT)) { if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { sif::warning << "StrHelper::checkPath: SD card 0 not mounted" << std::endl; return SD_NOT_MOUNTED; } - } else if (name.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) == - std::string(SdCardManager::SD_1_MOUNT_POINT)) { + } else if (name.substr(0, sizeof(config::SD_1_MOUNT_POINT)) == + std::string(config::SD_1_MOUNT_POINT)) { if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { sif::warning << "StrHelper::checkPath: SD card 1 not mounted" << std::endl; return SD_NOT_MOUNTED; From b3275d015fcd1488a26d9f96393770eb65bb53ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 11:50:35 +0200 Subject: [PATCH 123/361] start update handler impl --- bsp_q7s/core/CoreController.cpp | 19 +++++++++++++++++++ bsp_q7s/core/CoreController.h | 1 - common/config/eive/definitions.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 359d7c27..398e1e85 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1,6 +1,7 @@ #include "CoreController.h" #include +#include #include #include "OBSWConfig.h" @@ -200,6 +201,24 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return HasActionsIF::EXECUTION_FINISHED; } case (OBSW_UPDATE_FROM_SD_0): { + using namespace std; + using namespace std::filesystem; + // At the very least, chip and copy ID need to be included in the command + if (size < 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + path archivePath = + path(config::SD_0_MOUNT_POINT) / path(config::OBSW_UPDATE_ARCHIVE_FILE_NAME); + if (not exists(archivePath)) { + return HasFileSystemIF::FILE_DOES_NOT_EXIST; + } + std::ostringstream cmd("tar -xJvf"); + cmd << " " << archivePath; + int result = std::system(cmd.str().c_str()); + if (result != 0) { + utility::handleSystemError(result, + "CoreController::executeAction: SW Update Decompression"); + } return HasActionsIF::EXECUTION_FINISHED; } case (SWITCH_IMG_LOCK): { diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 8c4d89b1..4a630863 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -54,7 +54,6 @@ class CoreController : public ExtendedControllerBase { static constexpr char CONF_FOLDER[] = "conf"; - static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt"; static constexpr char VERSION_FILE_NAME[] = "version.txt"; static constexpr char REBOOT_FILE_NAME[] = "reboot.txt"; static constexpr char TIME_FILE_NAME[] = "time.txt"; diff --git a/common/config/eive/definitions.h b/common/config/eive/definitions.h index 7927d280..c5ea5bf9 100644 --- a/common/config/eive/definitions.h +++ b/common/config/eive/definitions.h @@ -10,6 +10,7 @@ static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1"; static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz"; static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped"; +static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt"; static constexpr uint16_t EIVE_PUS_APID = 0x65; static constexpr uint16_t EIVE_CFDP_APID = 0x66; From eb0ace3bc6556154601ec2a1bd877f86684ed6dc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 12:00:57 +0200 Subject: [PATCH 124/361] continuing SW update impl --- README.md | 4 ++-- bsp_q7s/core/CoreController.cpp | 35 +++++++++++++++++++++++++++++++-- bsp_q7s/core/CoreController.h | 1 + 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4bf83845..65eb0cb8 100644 --- a/README.md +++ b/README.md @@ -211,8 +211,8 @@ Some context information about the used commands: - Chip 0 Copy 0: `/tmp/mntupdate-xdi-qspi0-nom-rootfs` - Chip 0 Copy 1: `/tmp/mntupdate-xdi-qspi0-gold-rootfs` - - Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs` - - Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-gold-rootfs` + - Slot 1 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs` + - Slot 1 Copy 1: `/tmp/mntupdate-xdi-qspi1-gold-rootfs` 2. Writing the file with a regular `cp ` command 3. Enabling the writeprotection using the `writeprotect 1` utility. diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 398e1e85..e5cdb1aa 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -207,18 +207,31 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ if (size < 2) { return HasActionsIF::INVALID_PARAMETERS; } + if (data[0] > 1 or data[1] > 1) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto chip = static_cast(data[0]); + auto copy = static_cast(data[1]); path archivePath = path(config::SD_0_MOUNT_POINT) / path(config::OBSW_UPDATE_ARCHIVE_FILE_NAME); if (not exists(archivePath)) { return HasFileSystemIF::FILE_DOES_NOT_EXIST; } - std::ostringstream cmd("tar -xJvf"); + ostringstream cmd("tar -xJvf"); cmd << " " << archivePath; - int result = std::system(cmd.str().c_str()); + int result = system(cmd.str().c_str()); if (result != 0) { utility::handleSystemError(result, "CoreController::executeAction: SW Update Decompression"); } + cmd.clear(); + cmd << "xsc_mount_copy " << data[0] << " " << data[1]; + result = system(cmd.str().c_str()); + if (result != 0) { + std::string ctxString = + "CoreController::executeAction: SW Update Mounting " + data[0] + " " + data[1]; + utility::handleSystemError(result, ctxString); + } return HasActionsIF::EXECUTION_FINISHED; } case (SWITCH_IMG_LOCK): { @@ -1868,6 +1881,24 @@ void CoreController::readHkData() { } } +const char *CoreController::getXscMountDir(xsc::Chip chip, xsc::Copy copy) { + if (chip == xsc::Chip::CHIP_0) { + if (copy == xsc::Copy::COPY_0) { + return CHIP_0_COPY_0_MOUNT_DIR; + } else if (copy == xsc::Copy::COPY_1) { + return CHIP_0_COPY_1_MOUNT_DIR; + } + } else if (chip == xsc::Chip::CHIP_1) { + if (copy == xsc::Copy::COPY_0) { + return CHIP_1_COPY_0_MOUNT_DIR; + } else if (copy == xsc::Copy::COPY_1) { + return CHIP_1_COPY_1_MOUNT_DIR; + } + } + sif::error << "Invalid chip or copy passed to CoreController::getXscMountDir" << std::endl; + return CHIP_0_COPY_0_MOUNT_DIR; +} + bool CoreController::isNumber(const std::string &s) { return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) { return !std::isdigit(c); }) == s.end(); diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 4a630863..d7f05769 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -119,6 +119,7 @@ class CoreController : public ExtendedControllerBase { static ReturnValue_t generateChipStateFile(); static ReturnValue_t incrementAllocationFailureCount(); static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy); + static const char* getXscMountDir(xsc::Chip chip, xsc::Copy copy); ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true); From 8161d1cd88d8c121571cafdf2e3efe1d1e66fbde Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 12:26:08 +0200 Subject: [PATCH 125/361] finished update cmd impl --- bsp_q7s/core/CoreController.cpp | 113 ++++++++++++++++++++++--------- bsp_q7s/core/CoreController.h | 4 ++ common/config/eive/definitions.h | 3 + linux/utility/utility.cpp | 4 +- 4 files changed, 90 insertions(+), 34 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index e5cdb1aa..25151bc7 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -201,38 +201,10 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return HasActionsIF::EXECUTION_FINISHED; } case (OBSW_UPDATE_FROM_SD_0): { - using namespace std; - using namespace std::filesystem; - // At the very least, chip and copy ID need to be included in the command - if (size < 2) { - return HasActionsIF::INVALID_PARAMETERS; - } - if (data[0] > 1 or data[1] > 1) { - return HasActionsIF::INVALID_PARAMETERS; - } - auto chip = static_cast(data[0]); - auto copy = static_cast(data[1]); - path archivePath = - path(config::SD_0_MOUNT_POINT) / path(config::OBSW_UPDATE_ARCHIVE_FILE_NAME); - if (not exists(archivePath)) { - return HasFileSystemIF::FILE_DOES_NOT_EXIST; - } - ostringstream cmd("tar -xJvf"); - cmd << " " << archivePath; - int result = system(cmd.str().c_str()); - if (result != 0) { - utility::handleSystemError(result, - "CoreController::executeAction: SW Update Decompression"); - } - cmd.clear(); - cmd << "xsc_mount_copy " << data[0] << " " << data[1]; - result = system(cmd.str().c_str()); - if (result != 0) { - std::string ctxString = - "CoreController::executeAction: SW Update Mounting " + data[0] + " " + data[1]; - utility::handleSystemError(result, ctxString); - } - return HasActionsIF::EXECUTION_FINISHED; + return executeSwUpdate(SwUpdateSources::SD_0, data, size); + } + case (OBSW_UPDATE_FROM_SD_1): { + return executeSwUpdate(SwUpdateSources::SD_1, data, size); } case (SWITCH_IMG_LOCK): { if (size != 3) { @@ -1899,6 +1871,83 @@ const char *CoreController::getXscMountDir(xsc::Chip chip, xsc::Copy copy) { return CHIP_0_COPY_0_MOUNT_DIR; } +ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const uint8_t *data, + size_t size) { + using namespace std; + using namespace std::filesystem; + // At the very least, chip and copy ID need to be included in the command + if (size < 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + if (data[0] > 1 or data[1] > 1) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto chip = static_cast(data[0]); + auto copy = static_cast(data[1]); + path prefixPath; + if (sourceDir == SwUpdateSources::SD_0) { + prefixPath = path(config::SD_0_MOUNT_POINT); + } else if (sourceDir == SwUpdateSources::SD_1) { + prefixPath = path(config::SD_1_MOUNT_POINT); + } else if (sourceDir == SwUpdateSources::TMP_DIR) { + prefixPath = path("/tmp"); + } + path archivePath = prefixPath / path(config::OBSW_UPDATE_ARCHIVE_FILE_NAME); + if (not exists(archivePath)) { + return HasFileSystemIF::FILE_DOES_NOT_EXIST; + } + ostringstream cmd("tar -xJvf"); + cmd << " " << archivePath; + int result = system(cmd.str().c_str()); + if (result != 0) { + utility::handleSystemError(result, "CoreController::executeAction: SW Update Decompression"); + } + path strippedImagePath = prefixPath / path(config::STRIPPED_OBSW_BINARY_FILE_NAME); + if (!exists(strippedImagePath)) { + // TODO: Custom returnvalue? + return returnvalue::FAILED; + } + path obswVersionFilePath = prefixPath / path(config::OBSW_VERSION_FILE_NAME); + if (!exists(obswVersionFilePath)) { + // TODO: Custom returnvalue? + return returnvalue::FAILED; + } + cmd.clear(); + cmd << "xsc_mount_copy " << data[0] << " " << data[1]; + result = system(cmd.str().c_str()); + if (result != 0) { + std::string contextString = "CoreController::executeAction: SW Update Mounting " + + std::to_string(data[0]) + " " + std::to_string(data[1]); + utility::handleSystemError(result, contextString); + } + cmd.clear(); + std::string xscMountDest = std::string(getXscMountDir(chip, copy)); + path obswDestPath = xscMountDest / config::OBSW_PATH; + cmd << "cp " << strippedImagePath << " " << obswDestPath; + result = system(cmd.str().c_str()); + if (result != 0) { + utility::handleSystemError(result, "CoreController::executeAction: Copying SW update"); + } + cmd.clear(); + path obswVersionDestPath = xscMountDest / config::OBSW_VERSION_FILE_PATH; + cmd << "cp " << obswVersionFilePath << " " << obswVersionDestPath; + result = system(cmd.str().c_str()); + if (result != 0) { + utility::handleSystemError(result, "CoreController::executeAction: Copying SW version file"); + } + cmd.clear(); + // TODO: This takes a long time and will block the core controller.. Maybe use command executor? + // For now dont care.. + cmd << "writeprotect " << data[0] << " " << data[1] << " 1"; + result = system(cmd.str().c_str()); + if (result != 0) { + std::string contextString = "CoreController::executeAction: Writeprotecting " + + std::to_string(data[0]) + " " + std::to_string(data[1]); + utility::handleSystemError(result, contextString); + } + return HasActionsIF::EXECUTION_FINISHED; +} + bool CoreController::isNumber(const std::string &s) { return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) { return !std::isdigit(c); }) == s.end(); diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index d7f05769..e49411a4 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -168,6 +168,9 @@ class CoreController : public ExtendedControllerBase { // Used if SD switches or mount commands are issued via telecommand SET_STATE_FROM_COMMAND, }; + + enum class SwUpdateSources { SD_0, SD_1, TMP_DIR }; + static constexpr bool BLOCKING_SD_INIT = false; SdCardManager* sdcMan = nullptr; @@ -230,6 +233,7 @@ class CoreController : public ExtendedControllerBase { void updateSdInfoOther(); ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar, bool printOutput = true); + ReturnValue_t executeSwUpdate(SwUpdateSources sourceDir, const uint8_t* data, size_t size); ReturnValue_t sdColdRedundantBlockingInit(); void currentStateSetter(sd::SdCard sdCard, sd::SdState newState); diff --git a/common/config/eive/definitions.h b/common/config/eive/definitions.h index c5ea5bf9..1e8faad9 100644 --- a/common/config/eive/definitions.h +++ b/common/config/eive/definitions.h @@ -12,6 +12,9 @@ static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz"; static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped"; static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt"; +static constexpr char OBSW_PATH[] = "/usr/bin/eive-obsw"; +static constexpr char OBSW_VERSION_FILE_PATH[] = "/usr/share/eive-obsw/obsw_version.txt"; + static constexpr uint16_t EIVE_PUS_APID = 0x65; static constexpr uint16_t EIVE_CFDP_APID = 0x66; static constexpr uint16_t EIVE_LOCAL_CFDP_ENTITY_ID = EIVE_CFDP_APID; diff --git a/linux/utility/utility.cpp b/linux/utility/utility.cpp index fb58109b..2f51aea2 100644 --- a/linux/utility/utility.cpp +++ b/linux/utility/utility.cpp @@ -8,9 +8,9 @@ #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/timemanager/Clock.h" -void utility::handleSystemError(int retcode, std::string function) { +void utility::handleSystemError(int retcode, std::string context) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::warning << function << ": System call failed with code " << retcode << ": " + sif::warning << context << ": System call failed with code " << retcode << ": " << strerror(retcode) << std::endl; #endif } From ab919131fb93d5f1d8ae7964824982318e35181c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 16:20:53 +0200 Subject: [PATCH 126/361] accept rsa keys for q7s-cp.py as well --- scripts/q7s-cp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/q7s-cp.py b/scripts/q7s-cp.py index d0543b45..a456a218 100755 --- a/scripts/q7s-cp.py +++ b/scripts/q7s-cp.py @@ -97,10 +97,11 @@ def build_cmd(args): target = f"/tmp" else: target = args.target + accepted_key_rsa_args = "-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa" if args.invert: - cmd += f"{port_args} {address}:{args.source} {target}" + cmd += f"{port_args} {accepted_key_rsa_args} {address}:{args.source} {target}" else: - cmd += f"{port_args} {args.source} {address}:{target}" + cmd += f"{port_args} {accepted_key_rsa_args} {args.source} {address}:{target}" return cmd From cbb1fdfd5e2c8cdf7364502a00bab25c3c5e1882 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 18:07:23 +0200 Subject: [PATCH 127/361] args not needed but keep them there (commented) --- scripts/q7s-cp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/q7s-cp.py b/scripts/q7s-cp.py index a456a218..2890a46d 100755 --- a/scripts/q7s-cp.py +++ b/scripts/q7s-cp.py @@ -97,7 +97,8 @@ def build_cmd(args): target = f"/tmp" else: target = args.target - accepted_key_rsa_args = "-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa" + # accepted_key_rsa_args = "-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa" + accepted_key_rsa_args = "" if args.invert: cmd += f"{port_args} {accepted_key_rsa_args} {address}:{args.source} {target}" else: From 9d440838e9d6d02dc5d7bf0a96071c62d4ba14b4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 18:40:31 +0200 Subject: [PATCH 128/361] set correct owner for SW update procedure --- README.md | 9 ++++++++- bsp_q7s/core/CoreController.cpp | 16 ++++++++++++++++ scripts/create-sw-update.sh | 13 +++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 65eb0cb8..040bc5ed 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,14 @@ These files can be created manually: You can also use the `create-version-file.sh` helper shell script located in the `scripts` folder to do this. -4. Run the following command to create the compressed archive +4. Set the Q7S user as the file owner for both files + + ```sh + sudo chown root:root eive-obsw-stripped + sudo chown root:root obsw_version.txt + ``` + +5. Run the following command to create the compressed archive ```sh tar -cJvf eive-sw-update.tar.xz eive-obsw-stripped obsw_version.txt diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 25151bc7..e3cad378 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1936,6 +1936,22 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u utility::handleSystemError(result, "CoreController::executeAction: Copying SW version file"); } cmd.clear(); + + // Set correct permission for both files + cmd << "chmod 0755 " << obswDestPath; + result = system(cmd.str().c_str()); + if (result != 0) { + utility::handleSystemError(result, "CoreController::executeAction: Copying SW permissions 0755"); + } + cmd.clear(); + + cmd << "chmod 0644 " << obswVersionDestPath; + result = system(cmd.str().c_str()); + if (result != 0) { + utility::handleSystemError(result, "CoreController::executeAction: Setting version file permission 0644"); + } + cmd.clear(); + // TODO: This takes a long time and will block the core controller.. Maybe use command executor? // For now dont care.. cmd << "writeprotect " << data[0] << " " << data[1] << " 1"; diff --git a/scripts/create-sw-update.sh b/scripts/create-sw-update.sh index 3aff1c2d..9f56fcae 100755 --- a/scripts/create-sw-update.sh +++ b/scripts/create-sw-update.sh @@ -15,7 +15,20 @@ if [ ! -f obsw_version.txt ]; then exit 1 fi +mkdir update-archive +cp eive-obsw-stripped update-archive +cp obsw_version.txt update-archive + +cd update-archive + +sudo chown root:root eive-obsw-stripped +sudo chown root:root obsw_version.txt + cmd="tar -cJvf eive-sw-update.tar.xz eive-obsw-stripped obsw_version.txt" echo "Running command ${cmd} to generate compressed SW update archive." eval ${cmd} +cp eive-sw-update.tar.xz .. +cd .. +rm -rf update-archive + echo "Generated eive-sw-update.tar.xz update archive." From d87baa8da929fac93d97fe2e442c27804ee447ca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Sep 2022 23:17:12 +0200 Subject: [PATCH 129/361] successfull SW update --- bsp_q7s/core/CoreController.cpp | 41 +++++++++++++++++++++++++-------- tmtc | 2 +- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index e3cad378..ab54e94c 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1884,6 +1884,20 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u } auto chip = static_cast(data[0]); auto copy = static_cast(data[1]); + const char *sourceStr = "unknown"; + if (sourceDir == SwUpdateSources::SD_0) { + sourceStr = "SD 0"; + } else if (sourceDir == SwUpdateSources::SD_1) { + sourceStr = "SD 1"; + } else { + sourceStr = "tmp directory"; + } + sif::info << "Executing SW update for Chip " << static_cast(data[0]) << " Copy " + << static_cast(data[1]) << " from " << sourceStr << std::endl; + if (chip == CURRENT_CHIP and copy == CURRENT_COPY) { + // Not allowed / possible. TODO: Dedicated returnvalue? + return returnvalue::FAILED; + } path prefixPath; if (sourceDir == SwUpdateSources::SD_0) { prefixPath = path(config::SD_0_MOUNT_POINT); @@ -1896,8 +1910,8 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u if (not exists(archivePath)) { return HasFileSystemIF::FILE_DOES_NOT_EXIST; } - ostringstream cmd("tar -xJvf"); - cmd << " " << archivePath; + ostringstream cmd("tar -xJf", ios::app); + cmd << " " << archivePath << " -C " << prefixPath; int result = system(cmd.str().c_str()); if (result != 0) { utility::handleSystemError(result, "CoreController::executeAction: SW Update Decompression"); @@ -1912,55 +1926,64 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u // TODO: Custom returnvalue? return returnvalue::FAILED; } + cmd.str(""); cmd.clear(); - cmd << "xsc_mount_copy " << data[0] << " " << data[1]; + cmd << "xsc_mount_copy " << std::to_string(data[0]) << " " << std::to_string(data[1]); result = system(cmd.str().c_str()); if (result != 0) { std::string contextString = "CoreController::executeAction: SW Update Mounting " + std::to_string(data[0]) + " " + std::to_string(data[1]); utility::handleSystemError(result, contextString); } + cmd.str(""); cmd.clear(); - std::string xscMountDest = std::string(getXscMountDir(chip, copy)); - path obswDestPath = xscMountDest / config::OBSW_PATH; + path xscMountDest(getXscMountDir(chip, copy)); + path obswDestPath = xscMountDest / path(relative(config::OBSW_PATH, "/")); cmd << "cp " << strippedImagePath << " " << obswDestPath; result = system(cmd.str().c_str()); if (result != 0) { utility::handleSystemError(result, "CoreController::executeAction: Copying SW update"); } + cmd.str(""); cmd.clear(); - path obswVersionDestPath = xscMountDest / config::OBSW_VERSION_FILE_PATH; + path obswVersionDestPath = xscMountDest / path(relative(config::OBSW_VERSION_FILE_PATH, "/")); cmd << "cp " << obswVersionFilePath << " " << obswVersionDestPath; result = system(cmd.str().c_str()); if (result != 0) { utility::handleSystemError(result, "CoreController::executeAction: Copying SW version file"); } + cmd.str(""); cmd.clear(); // Set correct permission for both files cmd << "chmod 0755 " << obswDestPath; result = system(cmd.str().c_str()); if (result != 0) { - utility::handleSystemError(result, "CoreController::executeAction: Copying SW permissions 0755"); + utility::handleSystemError(result, + "CoreController::executeAction: Copying SW permissions 0755"); } + cmd.str(""); cmd.clear(); cmd << "chmod 0644 " << obswVersionDestPath; result = system(cmd.str().c_str()); if (result != 0) { - utility::handleSystemError(result, "CoreController::executeAction: Setting version file permission 0644"); + utility::handleSystemError( + result, "CoreController::executeAction: Setting version file permission 0644"); } + cmd.str(""); cmd.clear(); // TODO: This takes a long time and will block the core controller.. Maybe use command executor? // For now dont care.. - cmd << "writeprotect " << data[0] << " " << data[1] << " 1"; + cmd << "writeprotect " << std::to_string(data[0]) << " " << std::to_string(data[1]) << " 1"; result = system(cmd.str().c_str()); if (result != 0) { std::string contextString = "CoreController::executeAction: Writeprotecting " + std::to_string(data[0]) + " " + std::to_string(data[1]); utility::handleSystemError(result, contextString); } + sif::info << "SW update complete" << std::endl; return HasActionsIF::EXECUTION_FINISHED; } diff --git a/tmtc b/tmtc index 847a9dc0..4307620a 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 847a9dc000da29ae6faca3c97eb0af660cf96572 +Subproject commit 4307620a56c1f030247e4ad4a73a8e07864dde92 From 2614239fe46277179b9b56681bc8b80c1d61c03f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 09:27:40 +0200 Subject: [PATCH 130/361] this should work for the same chip/copy as well --- bsp_q7s/core/CoreController.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index ab54e94c..210e1a20 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -206,6 +206,9 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ case (OBSW_UPDATE_FROM_SD_1): { return executeSwUpdate(SwUpdateSources::SD_1, data, size); } + case (OBSW_UPDATE_FROM_TMP): { + return executeSwUpdate(SwUpdateSources::TMP_DIR, data, size); + } case (SWITCH_IMG_LOCK): { if (size != 3) { return HasActionsIF::INVALID_PARAMETERS; @@ -1894,10 +1897,6 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u } sif::info << "Executing SW update for Chip " << static_cast(data[0]) << " Copy " << static_cast(data[1]) << " from " << sourceStr << std::endl; - if (chip == CURRENT_CHIP and copy == CURRENT_COPY) { - // Not allowed / possible. TODO: Dedicated returnvalue? - return returnvalue::FAILED; - } path prefixPath; if (sourceDir == SwUpdateSources::SD_0) { prefixPath = path(config::SD_0_MOUNT_POINT); From 9b6636fe31551ff51bc41e714cb54a222db0a11e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 09:33:34 +0200 Subject: [PATCH 131/361] rerun generators --- generators/bsp_q7s_events.csv | 5 +- generators/bsp_q7s_objects.csv | 2 + generators/bsp_q7s_returnvalues.csv | 673 +++++++++--------- generators/events/event_parser.py | 2 +- generators/events/translateEvents.cpp | 7 +- generators/objects/objects.py | 2 +- generators/objects/translateObjects.cpp | 10 +- .../returnvalues/returnvalues_parser.py | 2 +- linux/fsfwconfig/events/translateEvents.cpp | 7 +- linux/fsfwconfig/objects/translateObjects.cpp | 10 +- tmtc | 2 +- 11 files changed, 376 insertions(+), 346 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index d4258731..17361ebb 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -69,6 +69,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 7510;0x1d56;TRYING_RECOVERY;MEDIUM;;fsfw/src/fsfw/health/HasHealthIF.h 7511;0x1d57;RECOVERY_STEP;MEDIUM;;fsfw/src/fsfw/health/HasHealthIF.h 7512;0x1d58;RECOVERY_DONE;MEDIUM;;fsfw/src/fsfw/health/HasHealthIF.h +7600;0x1db0;HANDLE_PACKET_FAILED;LOW;;fsfw/src/fsfw/tcdistribution/definitions.h 7900;0x1edc;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h 7901;0x1edd;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h 7902;0x1ede;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h @@ -119,8 +120,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12003;0x2ee3;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report P1: ID of command for which the execution failed P2: Status code sent by the supervisor handler;linux/devices/ploc/PlocSupervisorHandler.h 12004;0x2ee4;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;linux/devices/ploc/PlocSupervisorHandler.h 12005;0x2ee5;SUPV_MPSOC_SHUWDOWN_BUILD_FAILED;LOW;Failed to build the command to shutdown the MPSoC;linux/devices/ploc/PlocSupervisorHandler.h -12100;0x2f44;SANITIZATION_FAILED;LOW;;bsp_q7s/memory/SdCardManager.h -12101;0x2f45;MOUNTED_SD_CARD;INFO;;bsp_q7s/memory/SdCardManager.h +12100;0x2f44;SANITIZATION_FAILED;LOW;;bsp_q7s/fs/SdCardManager.h +12101;0x2f45;MOUNTED_SD_CARD;INFO;;bsp_q7s/fs/SdCardManager.h 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 diff --git a/generators/bsp_q7s_objects.csv b/generators/bsp_q7s_objects.csv index 53ddb3a6..924ae0a0 100644 --- a/generators/bsp_q7s_objects.csv +++ b/generators/bsp_q7s_objects.csv @@ -128,6 +128,8 @@ 0x73000002;SUS_BOARD_ASS 0x73000003;TCS_BOARD_ASS 0x73000004;RW_ASS +0x73000005;CFDP_HANDLER +0x73000006;CFDP_DISTRIBUTOR 0x73000100;TM_FUNNEL 0x73500000;CCSDS_IP_CORE_BRIDGE 0xFFFFFFFF;NO_OBJECT diff --git a/generators/bsp_q7s_returnvalues.csv b/generators/bsp_q7s_returnvalues.csv index ab196298..4582657d 100644 --- a/generators/bsp_q7s_returnvalues.csv +++ b/generators/bsp_q7s_returnvalues.csv @@ -1,14 +1,13 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path -0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h -0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h -0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NVMParameterBase.h -0x58a0;SUSS_ErrorUnlockMutex;;160;SUS_HANDLER;mission/devices/SusHandler.h -0x58a1;SUSS_ErrorLockMutex;;161;SUS_HANDLER;mission/devices/SusHandler.h -0x66a0;SADPL_CommandNotSupported;;160;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h -0x66a1;SADPL_DeploymentAlreadyExecuting;;161;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h -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 +0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h +0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h +0x60a0;CCSDS_CommandNotImplemented;Received action message with unknown action id;160;CCSDS_HANDLER;mission/tmtc/CCSDSHandler.h +0x5d00;GOMS_PacketTooLong;;0;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h +0x5d01;GOMS_InvalidTableId;;1;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h +0x5d02;GOMS_InvalidAddress;;2;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h +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 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 @@ -21,12 +20,13 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x52a2;RWHA_SetSpeedCommandInvalidLength;Received set speed command has invalid length. Should be 6.;162;RW_HANDLER;mission/devices/RwHandler.h 0x52a3;RWHA_ExecutionFailed;Command execution failed;163;RW_HANDLER;mission/devices/RwHandler.h 0x52a4;RWHA_CrcError;Reaction wheel reply has invalid crc;164;RW_HANDLER;mission/devices/RwHandler.h -0x5d00;GOMS_PacketTooLong;;0;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h -0x5d01;GOMS_InvalidTableId;;1;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h -0x5d02;GOMS_InvalidAddress;;2;GOM_SPACE_HANDLER;mission/devices/GomspaceDeviceHandler.h -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 +0x4fa1;HEATER_CommandNotSupported;;161;HEATER_HANDLER;mission/devices/HeaterHandler.h +0x4fa2;HEATER_InitFailed;;162;HEATER_HANDLER;mission/devices/HeaterHandler.h +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 +0x58a0;SUSS_ErrorUnlockMutex;;160;SUS_HANDLER;mission/devices/SusHandler.h +0x58a1;SUSS_ErrorLockMutex;;161;SUS_HANDLER;mission/devices/SusHandler.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 @@ -44,126 +44,130 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x50a6;SYRLINKS_BadCrcAck;;166;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a7;SYRLINKS_ReplyWrongSize;;167;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h 0x50a8;SYRLINKS_MissingStartFrameCharacter;;168;SYRLINKS_HANDLER;mission/devices/SyrlinksHkHandler.h -0x4fa1;HEATER_CommandNotSupported;;161;HEATER_HANDLER;mission/devices/HeaterHandler.h -0x4fa2;HEATER_InitFailed;;162;HEATER_HANDLER;mission/devices/HeaterHandler.h -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 -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 -0x4801;HGIO_UnknownGpioId;;1;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h -0x4802;HGIO_DriveGpioFailure;;2;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h -0x4803;HGIO_GpioTypeFailure;;3;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h -0x4804;HGIO_GpioInvalidInstance;;4;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h -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 -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 -0x4403;UXOS_CommandError;Command execution failed;3;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h -0x4404;UXOS_NoCommandLoadedOrPending;;4;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h -0x4406;UXOS_PcloseCallError;;6;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h -0x2801;SM_DataTooLarge;;1;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h -0x2802;SM_DataStorageFull;;2;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h -0x2803;SM_IllegalStorageId;;3;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h -0x2804;SM_DataDoesNotExist;;4;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h -0x2805;SM_IllegalAddress;;5;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h -0x2806;SM_PoolTooLarge;;6;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h -0x0601;PP_DoItMyself;;1;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0602;PP_PointsToVariable;;2;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0603;PP_PointsToMemory;;3;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0604;PP_ActivityCompleted;;4;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0605;PP_PointsToVectorUint8;;5;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0606;PP_PointsToVectorUint16;;6;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0607;PP_PointsToVectorUint32;;7;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x0608;PP_PointsToVectorFloat;;8;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06a0;PP_DumpNotSupported;;160;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e0;PP_InvalidSize;;224;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e1;PP_InvalidAddress;;225;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e2;PP_InvalidContent;;226;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e3;PP_UnalignedAccess;;227;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x06e4;PP_WriteProtected;;228;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h -0x4300;FILS_GenericFileError;;0;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4301;FILS_IsBusy;;1;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4302;FILS_InvalidParameters;;2;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4305;FILS_FileDoesNotExist;;5;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4306;FILS_FileAlreadyExists;;6;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4307;FILS_FileLocked;;7;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x430a;FILS_DirectoryDoesNotExist;;10;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x430b;FILS_DirectoryAlreadyExists;;11;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x430c;FILS_DirectoryNotEmpty;;12;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x430f;FILS_SequencePacketMissingWrite;;15;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x4310;FILS_SequencePacketMissingRead;;16;FILE_SYSTEM;fsfw/src/fsfw/memory/HasFileSystemIF.h -0x13e0;MH_UnknownCmd;;224;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x13e1;MH_InvalidAddress;;225;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x13e2;MH_InvalidSize;;226;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x13e3;MH_StateMismatch;;227;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h -0x38a1;SGP4_InvalidEccentricity;;161;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x38a2;SGP4_InvalidMeanMotion;;162;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x38a3;SGP4_InvalidPerturbationElements;;163;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x38a4;SGP4_InvalidSemiLatusRectum;;164;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -0x38a5;SGP4_InvalidEpochElements;;165;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h -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 -0x1602;FMM_KeyDoesNotExist;;2;FIXED_MULTIMAP;fsfw/src/fsfw/container/FixedOrderedMultimap.h -0x3901;MUX_NotEnoughResources;;1;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3902;MUX_InsufficientMemory;;2;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3903;MUX_NoPrivilege;;3;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3904;MUX_WrongAttributeSetting;;4;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3905;MUX_MutexAlreadyLocked;;5;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3906;MUX_MutexNotFound;;6;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3907;MUX_MutexMaxLocks;;7;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3908;MUX_CurrThreadAlreadyOwnsMutex;;8;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3909;MUX_CurrThreadDoesNotOwnMutex;;9;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x390a;MUX_MutexTimeout;;10;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x390b;MUX_MutexInvalidId;;11;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x390c;MUX_MutexDestroyedWhileWaiting;;12;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h -0x3a01;MQI_Empty;;1;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x3a02;MQI_Full;No space left for more messages;2;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x3a03;MQI_NoReplyPartner;Returned if a reply method was called without partner;3;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x3a04;MQI_DestinationInvalid;Returned if the target destination is invalid.;4;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h -0x0f01;CM_UnknownCommand;;1;COMMAND_MESSAGE;fsfw/src/fsfw/ipc/CommandMessageIF.h +0x66a0;SADPL_CommandNotSupported;;160;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h +0x66a1;SADPL_DeploymentAlreadyExecuting;;161;SA_DEPL_HANDLER;mission/devices/SolarArrayDeploymentHandler.h +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 +0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NVMParameterBase.h +0x2c01;CCS_BcIsSetVrCommand;;1;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2c02;CCS_BcIsUnlockCommand;;2;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cb0;CCS_BcIllegalCommand;;176;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cb1;CCS_BoardReadingNotFinished;;177;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cf0;CCS_NsPositiveW;;240;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cf1;CCS_NsNegativeW;;241;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cf2;CCS_NsLockout;;242;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cf3;CCS_FarmInLockout;;243;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cf4;CCS_FarmInWait;;244;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce0;CCS_WrongSymbol;;224;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce1;CCS_DoubleStart;;225;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce2;CCS_StartSymbolMissed;;226;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce3;CCS_EndWithoutStart;;227;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce4;CCS_TooLarge;;228;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce5;CCS_TooShort;;229;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce6;CCS_WrongTfVersion;;230;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce7;CCS_WrongSpacecraftId;;231;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce8;CCS_NoValidFrameType;;232;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ce9;CCS_CrcFailed;;233;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cea;CCS_VcNotFound;;234;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ceb;CCS_ForwardingFailed;;235;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cec;CCS_ContentTooLarge;;236;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2ced;CCS_ResidualData;;237;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cee;CCS_DataCorrupted;;238;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cef;CCS_IllegalSegmentationFlag;;239;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cd0;CCS_IllegalFlagCombination;;208;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cd1;CCS_ShorterThanHeader;;209;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cd2;CCS_TooShortBlockedPacket;;210;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x2cd3;CCS_TooShortMapExtraction;;211;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +0x3b00;SPH_ConnBroken;;0;SEMAPHORE_IF;fsfw/src/fsfw/osal/common/TcpTmTcServer.h +0x2a01;IEC_NoConfigurationTable;;1;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a02;IEC_NoCpuTable;;2;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a03;IEC_InvalidWorkspaceAddress;;3;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a04;IEC_TooLittleWorkspace;;4;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a05;IEC_WorkspaceAllocation;;5;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a06;IEC_InterruptStackTooSmall;;6;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a07;IEC_ThreadExitted;;7;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a08;IEC_InconsistentMpInformation;;8;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a09;IEC_InvalidNode;;9;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a0a;IEC_NoMpci;;10;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a0b;IEC_BadPacket;;11;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a0c;IEC_OutOfPackets;;12;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a0d;IEC_OutOfGlobalObjects;;13;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a0e;IEC_OutOfProxies;;14;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a0f;IEC_InvalidGlobalId;;15;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a10;IEC_BadStackHook;;16;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a11;IEC_BadAttributes;;17;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a12;IEC_ImplementationKeyCreateInconsistency;;18;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a13;IEC_ImplementationBlockingOperationCancel;;19;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a14;IEC_MutexObtainFromBadState;;20;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h +0x2a15;IEC_UnlimitedAndMaximumIs0;;21;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h 0x0e01;HM_InvalidMode;;1;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h 0x0e02;HM_TransNotAllowed;;2;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h 0x0e03;HM_InTransition;;3;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h 0x0e04;HM_InvalidSubmode;;4;HAS_MODES_IF;fsfw/src/fsfw/modes/HasModesIF.h -0x0c02;MS_InvalidEntry;;2;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h -0x0c03;MS_TooManyElements;;3;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h -0x0c04;MS_CantStoreEmpty;;4;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h -0x0b01;SB_ChildNotFound;;1;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h -0x0b02;SB_ChildInfoUpdated;;2;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h -0x0b03;SB_ChildDoesntHaveModes;;3;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h -0x0b04;SB_CouldNotInsertChild;;4;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h -0x0b05;SB_TableContainsInvalidObjectId;;5;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h -0x0d01;SS_SequenceAlreadyExists;;1;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d02;SS_TableAlreadyExists;;2;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d03;SS_TableDoesNotExist;;3;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d04;SS_TableOrSequenceLengthInvalid;;4;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d05;SS_SequenceDoesNotExist;;5;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d06;SS_TableContainsInvalidObjectId;;6;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d07;SS_FallbackSequenceDoesNotExist;;7;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d08;SS_NoTargetTable;;8;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d09;SS_SequenceOrTableTooLong;;9;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d0b;SS_IsFallbackSequence;;11;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d0c;SS_AccessDenied;;12;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0d0e;SS_TableInUse;;14;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0da1;SS_TargetTableNotReached;;161;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x0da2;SS_TableCheckFailed;;162;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h -0x2501;EV_ListenerNotFound;;1;EVENT_MANAGER_IF;fsfw/src/fsfw/events/EventManagerIF.h +0x2e01;HPA_InvalidIdentifierId;;1;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h +0x2e02;HPA_InvalidDomainId;;2;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h +0x2e03;HPA_InvalidValue;;3;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h +0x2e05;HPA_ReadOnly;;5;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h +0x2d01;PAW_UnknownDatatype;;1;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x2d02;PAW_DatatypeMissmatch;;2;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x2d03;PAW_Readonly;;3;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x2d04;PAW_TooBig;;4;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x2d05;PAW_SourceNotSet;;5;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x2d06;PAW_OutOfBounds;;6;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x2d07;PAW_NotSet;;7;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x2d08;PAW_ColumnOrRowsZero;;8;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h +0x3201;CF_ObjectHasNoFunctions;;1;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h +0x3202;CF_AlreadyCommanding;;2;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h +0x3301;HF_IsBusy;;1;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x3302;HF_InvalidParameters;;2;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x3303;HF_ExecutionFinished;;3;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x3304;HF_InvalidActionId;;4;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h +0x0201;OM_InsertionFailed;;1;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x0202;OM_NotFound;;2;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x0203;OM_ChildInitFailed;;3;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x0204;OM_InternalErrReporterUninit;;4;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h +0x2600;FDI_YourFault;;0;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h +0x2601;FDI_MyFault;;1;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h +0x2602;FDI_ConfirmLater;;2;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h +0x2201;TMF_Busy;;1;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2202;TMF_LastPacketFound;;2;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2203;TMF_StopFetch;;3;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2204;TMF_Timeout;;4;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2205;TMF_TmChannelFull;;5;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2206;TMF_NotStored;;6;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2207;TMF_AllDeleted;;7;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2208;TMF_InvalidData;;8;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2209;TMF_NotReady;;9;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h +0x2101;TMB_Busy;;1;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2102;TMB_Full;;2;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2103;TMB_Empty;;3;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2104;TMB_NullRequested;;4;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2105;TMB_TooLarge;;5;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2106;TMB_NotReady;;6;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2107;TMB_DumpError;;7;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2108;TMB_CrcError;;8;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x2109;TMB_Timeout;;9;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x210a;TMB_IdlePacketFound;;10;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x210b;TMB_TelecommandFound;;11;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x210c;TMB_NoPusATm;;12;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x210d;TMB_TooSmall;;13;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x210e;TMB_BlockNotFound;;14;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x210f;TMB_InvalidRequest;;15;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +0x1c01;TCD_PacketLost;;1;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributorBase.h +0x1c02;TCD_DestinationNotFound;;2;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributorBase.h +0x1c03;TCD_ServiceIdAlreadyExists;;3;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributorBase.h +0x1b00;TCC_NoDestinationFound;;0;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b01;TCC_InvalidCcsdsVersion;;1;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b02;TCC_InvalidApid;;2;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b03;TCC_InvalidPacketType;;3;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b04;TCC_InvalidSecHeaderField;;4;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b05;TCC_IncorrectPrimaryHeader;;5;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b07;TCC_IncompletePacket;;7;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b08;TCC_InvalidPusVersion;;8;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b09;TCC_IncorrectChecksum;;9;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b0a;TCC_IllegalPacketSubtype;;10;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h +0x1b0b;TCC_IncorrectSecondaryHeader;;11;TMTC_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/definitions.h 0x04e1;RMP_CommandNoDescriptorsAvailable;;225;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x04e2;RMP_CommandBufferFull;;226;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x04e3;RMP_CommandChannelOutOfRange;;227;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h @@ -204,9 +208,95 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x040a;RMP_ReplyCommandNotImplementedOrNotAuthorised;;10;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x040b;RMP_ReplyRmwDataLengthError;;11;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h 0x040c;RMP_ReplyInvalidTargetLogicalAddress;;12;RMAP_CHANNEL;fsfw/src/fsfw/rmap/RMAP.h -0x1401;SE_BufferTooShort;;1;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h -0x1402;SE_StreamTooShort;;2;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h -0x1403;SE_TooManyElements;;3;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h +0x2801;SM_DataTooLarge;;1;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h +0x2802;SM_DataStorageFull;;2;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h +0x2803;SM_IllegalStorageId;;3;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h +0x2804;SM_DataDoesNotExist;;4;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h +0x2805;SM_IllegalAddress;;5;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h +0x2806;SM_PoolTooLarge;;6;STORAGE_MANAGER_IF;fsfw/src/fsfw/storagemanager/StorageManagerIF.h +0x38a1;SGP4_InvalidEccentricity;;161;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x38a2;SGP4_InvalidMeanMotion;;162;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x38a3;SGP4_InvalidPerturbationElements;;163;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x38a4;SGP4_InvalidSemiLatusRectum;;164;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +0x38a5;SGP4_InvalidEpochElements;;165;SGP4PROPAGATOR_CLASS;fsfw/src/fsfw/coordinates/Sgp4Propagator.h +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 +0x2401;MT_TooDetailedRequest;;1;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2402;MT_TooGeneralRequest;;2;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2403;MT_NoMatch;;3;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2404;MT_Full;;4;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x2405;MT_NewNodeCreated;;5;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h +0x3f01;DLEE_StreamTooShort;;1;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h +0x3f02;DLEE_DecodingError;;2;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h +0x2f01;ASC_TooLongForTargetType;;1;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h +0x2f02;ASC_InvalidCharacters;;2;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h +0x2f03;ASC_BufferTooSmall;;3;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h +0x0f01;CM_UnknownCommand;;1;COMMAND_MESSAGE;fsfw/src/fsfw/ipc/CommandMessageIF.h +0x3a01;MQI_Empty;;1;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3a02;MQI_Full;No space left for more messages;2;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3a03;MQI_NoReplyPartner;Returned if a reply method was called without partner;3;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3a04;MQI_DestinationInvalid;Returned if the target destination is invalid.;4;MESSAGE_QUEUE_IF;fsfw/src/fsfw/ipc/MessageQueueIF.h +0x3901;MUX_NotEnoughResources;;1;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3902;MUX_InsufficientMemory;;2;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3903;MUX_NoPrivilege;;3;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3904;MUX_WrongAttributeSetting;;4;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3905;MUX_MutexAlreadyLocked;;5;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3906;MUX_MutexNotFound;;6;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3907;MUX_MutexMaxLocks;;7;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3908;MUX_CurrThreadAlreadyOwnsMutex;;8;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3909;MUX_CurrThreadDoesNotOwnMutex;;9;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x390a;MUX_MutexTimeout;;10;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x390b;MUX_MutexInvalidId;;11;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x390c;MUX_MutexDestroyedWhileWaiting;;12;MUTEX_IF;fsfw/src/fsfw/ipc/MutexIF.h +0x3b01;SPH_SemaphoreTimeout;;1;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h +0x3b02;SPH_SemaphoreNotOwned;;2;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h +0x3b03;SPH_SemaphoreInvalid;;3;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h +0x1e00;PUS_InvalidPusVersion;;0;PUS_IF;fsfw/src/fsfw/tmtcpacket/pus/PusIF.h +0x1e01;PUS_InvalidCrc16;;1;PUS_IF;fsfw/src/fsfw/tmtcpacket/pus/PusIF.h +0x3601;CFDP_InvalidTlvType;;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3602;CFDP_InvalidDirectiveField;;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3603;CFDP_InvalidPduDatafieldLen;;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3604;CFDP_InvalidAckDirectiveFields;;4;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3605;CFDP_MetadataCantParseOptions;;5;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3606;CFDP_NakCantParseOptions;;6;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3607;CFDP_FinishedCantParseFsResponses;;7;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3608;CFDP_FilestoreRequiresSecondFile;;8;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x3609;CFDP_FilestoreResponseCantParseFsMessage;;9;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x360a;CFDP_InvalidPduFormat;;10;CFDP;fsfw/src/fsfw/cfdp/definitions.h +0x2901;TC_InvalidTargetState;;1;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h +0x29f1;TC_AboveOperationalLimit;;241;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h +0x29f2;TC_BelowOperationalLimit;;242;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h +0x0c02;MS_InvalidEntry;;2;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h +0x0c03;MS_TooManyElements;;3;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h +0x0c04;MS_CantStoreEmpty;;4;MODE_STORE_IF;fsfw/src/fsfw/subsystem/modes/ModeStoreIF.h +0x0d01;SS_SequenceAlreadyExists;;1;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d02;SS_TableAlreadyExists;;2;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d03;SS_TableDoesNotExist;;3;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d04;SS_TableOrSequenceLengthInvalid;;4;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d05;SS_SequenceDoesNotExist;;5;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d06;SS_TableContainsInvalidObjectId;;6;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d07;SS_FallbackSequenceDoesNotExist;;7;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d08;SS_NoTargetTable;;8;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d09;SS_SequenceOrTableTooLong;;9;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d0b;SS_IsFallbackSequence;;11;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d0c;SS_AccessDenied;;12;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0d0e;SS_TableInUse;;14;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0da1;SS_TargetTableNotReached;;161;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0da2;SS_TableCheckFailed;;162;SUBSYSTEM;fsfw/src/fsfw/subsystem/Subsystem.h +0x0b01;SB_ChildNotFound;;1;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h +0x0b02;SB_ChildInfoUpdated;;2;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h +0x0b03;SB_ChildDoesntHaveModes;;3;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h +0x0b04;SB_CouldNotInsertChild;;4;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h +0x0b05;SB_TableContainsInvalidObjectId;;5;SUBSYSTEM_BASE;fsfw/src/fsfw/subsystem/SubsystemBase.h +0x3e00;HKM_QueueOrDestinationInvalid;;0;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3e01;HKM_WrongHkPacketType;;1;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3e02;HKM_ReportingStatusUnchanged;;2;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3e03;HKM_PeriodicHelperInvalid;;3;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3e04;HKM_PoolobjectNotFound;;4;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3e05;HKM_DatasetNotFound;;5;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h +0x3c00;LPIF_PoolEntryNotFound;;0;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h +0x3c01;LPIF_PoolEntryTypeConflict;;1;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h 0x3da0;PVA_InvalidReadWriteMode;;160;POOL_VARIABLE_IF;fsfw/src/fsfw/datapool/PoolVariableIF.h 0x3da1;PVA_InvalidPoolEntry;;161;POOL_VARIABLE_IF;fsfw/src/fsfw/datapool/PoolVariableIF.h 0x0801;DPS_InvalidParameterDefinition;;1;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h @@ -215,19 +305,39 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x0804;DPS_DataSetUninitialised;;4;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h 0x0805;DPS_DataSetFull;;5;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h 0x0806;DPS_PoolVarNull;;6;DATA_SET_CLASS;fsfw/src/fsfw/datapool/DataSetIF.h -0x1c01;TCD_PacketLost;;1;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h -0x1c02;TCD_DestinationNotFound;;2;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h -0x1c03;TCD_ServiceIdAlreadyExists;;3;PACKET_DISTRIBUTION;fsfw/src/fsfw/tcdistribution/TcDistributor.h -0x1b00;TCC_InvalidCcsdsVersion;;0;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b01;TCC_InvalidApid;;1;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b02;TCC_InvalidPacketType;;2;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b03;TCC_InvalidSecHeaderField;;3;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b04;TCC_IncorrectPrimaryHeader;;4;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b05;TCC_IncompletePacket;;5;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b06;TCC_InvalidPusVersion;;6;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b07;TCC_IncorrectChecksum;;7;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b08;TCC_IllegalPacketSubtype;;8;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h -0x1b09;TCC_IncorrectSecondaryHeader;;9;PACKET_CHECK;fsfw/src/fsfw/tcdistribution/definitions.h +0x1000;TIM_UnsupportedTimeFormat;;0;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h +0x1001;TIM_NotEnoughInformationForTargetFormat;;1;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h +0x1002;TIM_LengthMismatch;;2;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h +0x1003;TIM_InvalidTimeFormat;;3;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h +0x1004;TIM_InvalidDayOfYear;;4;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h +0x1005;TIM_TimeDoesNotFitFormat;;5;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h +0x3701;TSI_BadTimestamp;;1;TIME_STAMPER_IF;fsfw/src/fsfw/timemanager/TimeStampIF.h +0x1d01;ATC_ActivityStarted;;1;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +0x1d02;ATC_InvalidSubservice;;2;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +0x1d03;ATC_IllegalApplicationData;;3;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +0x1d04;ATC_SendTmFailed;;4;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +0x1d05;ATC_Timeout;;5;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +0x4c00;SPPA_NoPacketFound;;0;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h +0x4c01;SPPA_SplitPacket;;1;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h +0x2001;CSB_ExecutionComplete;;1;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h +0x2002;CSB_NoStepMessage;;2;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h +0x2003;CSB_ObjectBusy;;3;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h +0x2004;CSB_Busy;;4;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h +0x2005;CSB_InvalidTc;;5;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h +0x2006;CSB_InvalidObject;;6;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h +0x2007;CSB_InvalidReply;;7;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h +0x1101;AL_Full;;1;ARRAY_LIST;fsfw/src/fsfw/container/ArrayList.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 +0x1602;FMM_KeyDoesNotExist;;2;FIXED_MULTIMAP;fsfw/src/fsfw/container/FixedOrderedMultimap.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 +0x2501;EV_ListenerNotFound;;1;EVENT_MANAGER_IF;fsfw/src/fsfw/events/EventManagerIF.h +0x1701;HHI_ObjectNotHealthy;;1;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h +0x1702;HHI_InvalidHealthState;;2;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h +0x1703;HHI_IsExternallyControlled;;3;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h 0x3001;POS_InPowerTransition;;1;POWER_SWITCHER;fsfw/src/fsfw/power/PowerSwitcher.h 0x3002;POS_SwitchStateMismatch;;2;POWER_SWITCHER;fsfw/src/fsfw/power/PowerSwitcher.h 0x0501;PS_SwitchOn;;1;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h @@ -235,76 +345,22 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x0502;PS_SwitchTimeout;;2;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h 0x0503;PS_FuseOn;;3;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h 0x0504;PS_FuseOff;;4;POWER_SWITCH_IF;fsfw/src/fsfw/power/PowerSwitchIF.h -0x3b00;SPH_ConnBroken;;0;SEMAPHORE_IF;fsfw/src/fsfw/osal/common/TcpTmTcServer.h -0x2a01;IEC_NoConfigurationTable;;1;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a02;IEC_NoCpuTable;;2;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a03;IEC_InvalidWorkspaceAddress;;3;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a04;IEC_TooLittleWorkspace;;4;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a05;IEC_WorkspaceAllocation;;5;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a06;IEC_InterruptStackTooSmall;;6;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a07;IEC_ThreadExitted;;7;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a08;IEC_InconsistentMpInformation;;8;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a09;IEC_InvalidNode;;9;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a0a;IEC_NoMpci;;10;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a0b;IEC_BadPacket;;11;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a0c;IEC_OutOfPackets;;12;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a0d;IEC_OutOfGlobalObjects;;13;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a0e;IEC_OutOfProxies;;14;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a0f;IEC_InvalidGlobalId;;15;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a10;IEC_BadStackHook;;16;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a11;IEC_BadAttributes;;17;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a12;IEC_ImplementationKeyCreateInconsistency;;18;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a13;IEC_ImplementationBlockingOperationCancel;;19;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a14;IEC_MutexObtainFromBadState;;20;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2a15;IEC_UnlimitedAndMaximumIs0;;21;INTERNAL_ERROR_CODES;fsfw/src/fsfw/osal/InternalErrorCodes.h -0x2600;FDI_YourFault;;0;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h -0x2601;FDI_MyFault;;1;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h -0x2602;FDI_ConfirmLater;;2;HANDLES_FAILURES_IF;fsfw/src/fsfw/fdir/ConfirmsFailuresIF.h -0x1e00;PUS_InvalidPusVersion;;0;PUS_IF;fsfw/src/fsfw/tmtcpacket/pus/PusIF.h -0x1e01;PUS_InvalidCrc16;;1;PUS_IF;fsfw/src/fsfw/tmtcpacket/pus/PusIF.h -0x0201;OM_InsertionFailed;;1;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x0202;OM_NotFound;;2;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x0203;OM_ChildInitFailed;;3;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x0204;OM_InternalErrReporterUninit;;4;OBJECT_MANAGER_IF;fsfw/src/fsfw/objectmanager/ObjectManagerIF.h -0x2201;TMF_Busy;;1;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2202;TMF_LastPacketFound;;2;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2203;TMF_StopFetch;;3;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2204;TMF_Timeout;;4;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2205;TMF_TmChannelFull;;5;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2206;TMF_NotStored;;6;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2207;TMF_AllDeleted;;7;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2208;TMF_InvalidData;;8;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2209;TMF_NotReady;;9;TM_STORE_FRONTEND_IF;fsfw/src/fsfw/tmstorage/TmStoreFrontendIF.h -0x2101;TMB_Busy;;1;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2102;TMB_Full;;2;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2103;TMB_Empty;;3;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2104;TMB_NullRequested;;4;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2105;TMB_TooLarge;;5;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2106;TMB_NotReady;;6;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2107;TMB_DumpError;;7;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2108;TMB_CrcError;;8;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2109;TMB_Timeout;;9;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x210a;TMB_IdlePacketFound;;10;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x210b;TMB_TelecommandFound;;11;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x210c;TMB_NoPusATm;;12;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x210d;TMB_TooSmall;;13;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x210e;TMB_BlockNotFound;;14;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x210f;TMB_InvalidRequest;;15;TM_STORE_BACKEND_IF;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -0x2d01;PAW_UnknownDatatype;;1;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2d02;PAW_DatatypeMissmatch;;2;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2d03;PAW_Readonly;;3;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2d04;PAW_TooBig;;4;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2d05;PAW_SourceNotSet;;5;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2d06;PAW_OutOfBounds;;6;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2d07;PAW_NotSet;;7;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2d08;PAW_ColumnOrRowsZero;;8;PARAMETER_WRAPPER;fsfw/src/fsfw/parameters/ParameterWrapper.h -0x2e01;HPA_InvalidIdentifierId;;1;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h -0x2e02;HPA_InvalidDomainId;;2;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h -0x2e03;HPA_InvalidValue;;3;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h -0x2e05;HPA_ReadOnly;;5;HAS_PARAMETERS_IF;fsfw/src/fsfw/parameters/HasParametersIF.h -0x3b01;SPH_SemaphoreTimeout;;1;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h -0x3b02;SPH_SemaphoreNotOwned;;2;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.h -0x3b03;SPH_SemaphoreInvalid;;3;SEMAPHORE_IF;fsfw/src/fsfw/tasks/SemaphoreIF.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 +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 +0x430a;FILS_FileDoesNotExist;;10;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x430b;FILS_FileAlreadyExists;;11;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x430c;FILS_NotAFile;;12;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x430d;FILS_FileLocked;;13;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x430e;FILS_PermissionDenied;;14;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x4315;FILS_DirectoryDoesNotExist;;21;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x4316;FILS_DirectoryAlreadyExists;;22;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x4317;FILS_NotADirectory;;23;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x4318;FILS_DirectoryNotEmpty;;24;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x431e;FILS_SequencePacketMissingWrite;;30;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h +0x431f;FILS_SequencePacketMissingRead;;31;FILE_SYSTEM;fsfw/src/fsfw/filesystem/HasFileSystemIF.h 0x1a01;TRC_NotEnoughSensors;;1;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h 0x1a02;TRC_LowestValueOol;;2;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h 0x1a03;TRC_HighestValueOol;;3;TRIPLE_REDUNDACY_CHECK;fsfw/src/fsfw/monitoring/TriplexMonitor.h @@ -323,52 +379,34 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x31e2;LIM_WrongPid;;226;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h 0x31e3;LIM_WrongLimitId;;227;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h 0x31ee;LIM_MonitorNotFound;;238;LIMITS_IF;fsfw/src/fsfw/monitoring/MonitoringIF.h -0x3601;CFDP_InvalidTlvType;;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3602;CFDP_InvalidDirectiveFields;;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3603;CFDP_InvalidPduDatafieldLen;;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3604;CFDP_InvalidAckDirectiveFields;;4;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3605;CFDP_MetadataCantParseOptions;;5;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3606;CFDP_FinishedCantParseFsResponses;;6;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3608;CFDP_FilestoreRequiresSecondFile;;8;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x3609;CFDP_FilestoreResponseCantParseFsMessage;;9;CFDP;fsfw/src/fsfw/cfdp/definitions.h -0x2c01;CCS_BcIsSetVrCommand;;1;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2c02;CCS_BcIsUnlockCommand;;2;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cb0;CCS_BcIllegalCommand;;176;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cb1;CCS_BoardReadingNotFinished;;177;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cf0;CCS_NsPositiveW;;240;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cf1;CCS_NsNegativeW;;241;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cf2;CCS_NsLockout;;242;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cf3;CCS_FarmInLockout;;243;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cf4;CCS_FarmInWait;;244;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce0;CCS_WrongSymbol;;224;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce1;CCS_DoubleStart;;225;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce2;CCS_StartSymbolMissed;;226;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce3;CCS_EndWithoutStart;;227;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce4;CCS_TooLarge;;228;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce5;CCS_TooShort;;229;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce6;CCS_WrongTfVersion;;230;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce7;CCS_WrongSpacecraftId;;231;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce8;CCS_NoValidFrameType;;232;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ce9;CCS_CrcFailed;;233;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cea;CCS_VcNotFound;;234;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ceb;CCS_ForwardingFailed;;235;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cec;CCS_ContentTooLarge;;236;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2ced;CCS_ResidualData;;237;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cee;CCS_DataCorrupted;;238;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cef;CCS_IllegalSegmentationFlag;;239;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cd0;CCS_IllegalFlagCombination;;208;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cd1;CCS_ShorterThanHeader;;209;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cd2;CCS_TooShortBlockedPacket;;210;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h -0x2cd3;CCS_TooShortMapExtraction;;211;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h 0x4201;PUS11_InvalidTypeTimeWindow;;1;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h -0x4202;PUS11_TimeshiftingNotPossible;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h -0x4203;PUS11_InvalidRelativeTime;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h -0x3401;DC_NoReplyReceived;;1;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3402;DC_ProtocolError;;2;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3403;DC_Nullpointer;;3;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3404;DC_InvalidCookieType;;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3405;DC_NotActive;;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h -0x3406;DC_TooMuchData;;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x4202;PUS11_InvalidTimeWindow;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4203;PUS11_TimeshiftingNotPossible;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x4204;PUS11_InvalidRelativeTime;;4;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h +0x0601;PP_DoItMyself;;1;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0602;PP_PointsToVariable;;2;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0603;PP_PointsToMemory;;3;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0604;PP_ActivityCompleted;;4;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0605;PP_PointsToVectorUint8;;5;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0606;PP_PointsToVectorUint16;;6;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0607;PP_PointsToVectorUint32;;7;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x0608;PP_PointsToVectorFloat;;8;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06a0;PP_DumpNotSupported;;160;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e0;PP_InvalidSize;;224;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e1;PP_InvalidAddress;;225;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e2;PP_InvalidContent;;226;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e3;PP_UnalignedAccess;;227;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x06e4;PP_WriteProtected;;228;HAS_MEMORY_IF;fsfw/src/fsfw/memory/HasMemoryIF.h +0x13e0;MH_UnknownCmd;;224;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x13e1;MH_InvalidAddress;;225;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x13e2;MH_InvalidSize;;226;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x13e3;MH_StateMismatch;;227;MEMORY_HELPER;fsfw/src/fsfw/memory/MemoryHelper.h +0x1201;AB_NeedSecondStep;;1;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1202;AB_NeedToReconfigure;;2;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1203;AB_ModeFallback;;3;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1204;AB_ChildNotCommandable;;4;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x1205;AB_NeedToChangeHealth;;5;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x12a1;AB_NotEnoughChildrenInCorrectState;;161;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h 0x03a0;DHB_InvalidChannel;;160;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h 0x03b0;DHB_AperiodicReply;;176;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h 0x03b1;DHB_IgnoreReplyData;;177;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -378,12 +416,12 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x03d0;DHB_NoSwitch;;208;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h 0x03e0;DHB_ChildTimeout;;224;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h 0x03e1;DHB_SwitchFailed;;225;DEVICE_HANDLER_BASE;fsfw/src/fsfw/devicehandlers/DeviceHandlerBase.h -0x1201;AB_NeedSecondStep;;1;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1202;AB_NeedToReconfigure;;2;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1203;AB_ModeFallback;;3;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1204;AB_ChildNotCommandable;;4;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x1205;AB_NeedToChangeHealth;;5;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h -0x12a1;AB_NotEnoughChildrenInCorrectState;;161;ASSEMBLY_BASE;fsfw/src/fsfw/devicehandlers/AssemblyBase.h +0x3401;DC_NoReplyReceived;;1;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3402;DC_ProtocolError;;2;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3403;DC_Nullpointer;;3;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3404;DC_InvalidCookieType;;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3405;DC_NotActive;;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3406;DC_TooMuchData;;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x27a0;DHI_NoCommandData;;160;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h 0x27a1;DHI_CommandNotSupported;;161;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h 0x27a2;DHI_CommandAlreadySent;;162;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h @@ -405,67 +443,38 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x27c3;DHI_DeviceReplyInvalid;;195;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h 0x27d0;DHI_InvalidCommandParameter;;208;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h 0x27d1;DHI_InvalidNumberOrLengthOfParameters;;209;DEVICE_HANDLER_IF;fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -0x2401;MT_TooDetailedRequest;;1;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2402;MT_TooGeneralRequest;;2;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2403;MT_NoMatch;;3;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2404;MT_Full;;4;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x2405;MT_NewNodeCreated;;5;MATCH_TREE_CLASS;fsfw/src/fsfw/globalfunctions/matching/MatchTree.h -0x3f01;DLEE_StreamTooShort;;1;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h -0x3f02;DLEE_DecodingError;;2;DLE_ENCODER;fsfw/src/fsfw/globalfunctions/DleEncoder.h -0x2f01;ASC_TooLongForTargetType;;1;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h -0x2f02;ASC_InvalidCharacters;;2;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h -0x2f03;ASC_BufferTooSmall;;3;ASCII_CONVERTER;fsfw/src/fsfw/globalfunctions/AsciiConverter.h -0x1701;HHI_ObjectNotHealthy;;1;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h -0x1702;HHI_InvalidHealthState;;2;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h -0x1703;HHI_IsExternallyControlled;;3;HAS_HEALTH_IF;fsfw/src/fsfw/health/HasHealthIF.h -0x3201;CF_ObjectHasNoFunctions;;1;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h -0x3202;CF_AlreadyCommanding;;2;COMMANDS_ACTIONS_IF;fsfw/src/fsfw/action/CommandsActionsIF.h -0x3301;HF_IsBusy;;1;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x3302;HF_InvalidParameters;;2;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x3303;HF_ExecutionFinished;;3;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x3304;HF_InvalidActionId;;4;HAS_ACTIONS_IF;fsfw/src/fsfw/action/HasActionsIF.h -0x1000;TIM_UnsupportedTimeFormat;;0;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h -0x1001;TIM_NotEnoughInformationForTargetFormat;;1;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h -0x1002;TIM_LengthMismatch;;2;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h -0x1003;TIM_InvalidTimeFormat;;3;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h -0x1004;TIM_InvalidDayOfYear;;4;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h -0x1005;TIM_TimeDoesNotFitFormat;;5;CCSDS_TIME_HELPER_CLASS;fsfw/src/fsfw/timemanager/CCSDSTime.h -0x3701;TSI_BadTimestamp;;1;TIME_STAMPER_IF;fsfw/src/fsfw/timemanager/TimeStampIF.h -0x3c00;LPIF_PoolEntryNotFound;;0;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h -0x3c01;LPIF_PoolEntryTypeConflict;;1;LOCAL_POOL_OWNER_IF;fsfw/src/fsfw/datapoollocal/localPoolDefinitions.h -0x3e00;HKM_QueueOrDestinationInvalid;;0;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3e01;HKM_WrongHkPacketType;;1;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3e02;HKM_ReportingStatusUnchanged;;2;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3e03;HKM_PeriodicHelperInvalid;;3;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3e04;HKM_PoolobjectNotFound;;4;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x3e05;HKM_DatasetNotFound;;5;HOUSEKEEPING_MANAGER;fsfw/src/fsfw/datapoollocal/LocalDataPoolManager.h -0x2901;TC_InvalidTargetState;;1;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h -0x29f1;TC_AboveOperationalLimit;;241;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h -0x29f2;TC_BelowOperationalLimit;;242;THERMAL_COMPONENT_IF;fsfw/src/fsfw/thermal/ThermalComponentIF.h -0x2001;CSB_ExecutionComplete;;1;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x2002;CSB_NoStepMessage;;2;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x2003;CSB_ObjectBusy;;3;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x2004;CSB_Busy;;4;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x2005;CSB_InvalidTc;;5;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x2006;CSB_InvalidObject;;6;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x2007;CSB_InvalidReply;;7;COMMAND_SERVICE_BASE;fsfw/src/fsfw/tmtcservices/CommandingServiceBase.h -0x4c00;SPPA_NoPacketFound;;0;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h -0x4c01;SPPA_SplitPacket;;1;SPACE_PACKET_PARSER;fsfw/src/fsfw/tmtcservices/SpacePacketParser.h -0x1d01;ATC_ActivityStarted;;1;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h -0x1d02;ATC_InvalidSubservice;;2;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h -0x1d03;ATC_IllegalApplicationData;;3;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h -0x1d04;ATC_SendTmFailed;;4;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h -0x1d05;ATC_Timeout;;5;ACCEPTS_TELECOMMANDS_IF;fsfw/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +0x1401;SE_BufferTooShort;;1;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h +0x1402;SE_StreamTooShort;;2;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h +0x1403;SE_TooManyElements;;3;SERIALIZE_IF;fsfw/src/fsfw/serialize/SerializeIF.h +0x4500;HSPI_HalTimeoutRetval;;0;HAL_SPI;fsfw/src/fsfw_hal/stm32h7/spi/spiDefinitions.h +0x4501;HSPI_HalBusyRetval;;1;HAL_SPI;fsfw/src/fsfw_hal/stm32h7/spi/spiDefinitions.h +0x4502;HSPI_HalErrorRetval;;2;HAL_SPI;fsfw/src/fsfw_hal/stm32h7/spi/spiDefinitions.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 +0x4801;HGIO_UnknownGpioId;;1;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h +0x4802;HGIO_DriveGpioFailure;;2;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h +0x4803;HGIO_GpioTypeFailure;;3;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h +0x4804;HGIO_GpioInvalidInstance;;4;HAL_GPIO;fsfw/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h +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 +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 +0x4403;UXOS_CommandError;Command execution failed;3;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h +0x4404;UXOS_NoCommandLoadedOrPending;;4;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h +0x4406;UXOS_PcloseCallError;;6;LINUX_OSAL;fsfw/src/fsfw_hal/linux/CommandExecutor.h +0x64a0;FSHLP_SdNotMounted;SD card specified with path string not mounted;160;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h +0x64a1;FSHLP_FileNotExists;Specified file does not exist on filesystem;161;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h +0x6a00;SDMA_OpOngoing;;0;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a01;SDMA_AlreadyOn;;1;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a02;SDMA_AlreadyMounted;;2;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a03;SDMA_AlreadyOff;;3;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a0a;SDMA_StatusFileNexists;;10;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a0b;SDMA_StatusFileFormatInvalid;;11;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a0c;SDMA_MountError;;12;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a0d;SDMA_UnmountError;;13;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a0e;SDMA_SystemCallError;;14;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h +0x6a0f;SDMA_PopenCallError;;15;SD_CARD_MANAGER;bsp_q7s/fs/SdCardManager.h 0x6b00;SCBU_KeyNotFound;;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h -0x64a0;FSHLP_SdNotMounted;SD card specified with path string not mounted;160;FILE_SYSTEM_HELPER;bsp_q7s/memory/FilesystemHelper.h -0x64a1;FSHLP_FileNotExists;Specified file does not exist on filesystem;161;FILE_SYSTEM_HELPER;bsp_q7s/memory/FilesystemHelper.h -0x6a00;SDMA_OpOngoing;;0;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a01;SDMA_AlreadyOn;;1;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a02;SDMA_AlreadyMounted;;2;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a03;SDMA_AlreadyOff;;3;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a0a;SDMA_StatusFileNexists;;10;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a0b;SDMA_StatusFileFormatInvalid;;11;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a0c;SDMA_MountError;;12;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a0d;SDMA_UnmountError;;13;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a0e;SDMA_SystemCallError;;14;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h -0x6a0f;SDMA_PopenCallError;;15;SD_CARD_MANAGER;bsp_q7s/memory/SdCardManager.h diff --git a/generators/events/event_parser.py b/generators/events/event_parser.py index 487fbc6c..8ab88a1b 100644 --- a/generators/events/event_parser.py +++ b/generators/events/event_parser.py @@ -60,7 +60,7 @@ FILE_SEPARATOR = ";" SUBSYSTEM_DEFINITION_DESTINATIONS = [ f"{FSFW_CONFIG_ROOT}/events/subsystemIdRanges.h", f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/events/fwSubsystemIdRanges.h", - f"{OBSW_ROOT_DIR}/common/config/commonSubsystemIds.h", + f"{OBSW_ROOT_DIR}/common/config/eive/eventSubsystemIds.h", ] SUBSYSTEM_DEFS_DEST_AS_PATH = [Path(x) for x in SUBSYSTEM_DEFINITION_DESTINATIONS] diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 21ba77b3..3efd2fc3 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 216 translations. + * @brief Auto-generated event translation file. Contains 217 translations. * @details - * Generated on: 2022-08-24 16:44:18 + * Generated on: 2022-09-27 09:32:46 */ #include "translateEvents.h" @@ -75,6 +75,7 @@ const char *OVERWRITING_HEALTH_STRING = "OVERWRITING_HEALTH"; const char *TRYING_RECOVERY_STRING = "TRYING_RECOVERY"; const char *RECOVERY_STEP_STRING = "RECOVERY_STEP"; const char *RECOVERY_DONE_STRING = "RECOVERY_DONE"; +const char *HANDLE_PACKET_FAILED_STRING = "HANDLE_PACKET_FAILED"; const char *RF_AVAILABLE_STRING = "RF_AVAILABLE"; const char *RF_LOST_STRING = "RF_LOST"; const char *BIT_LOCK_STRING = "BIT_LOCK"; @@ -360,6 +361,8 @@ const char *translateEvents(Event event) { return RECOVERY_STEP_STRING; case (7512): return RECOVERY_DONE_STRING; + case (7600): + return HANDLE_PACKET_FAILED_STRING; case (7900): return RF_AVAILABLE_STRING; case (7901): diff --git a/generators/objects/objects.py b/generators/objects/objects.py index 80eb106a..c64a61ed 100644 --- a/generators/objects/objects.py +++ b/generators/objects/objects.py @@ -51,7 +51,7 @@ OBJECTS_PATH = Path(f"{FSFW_CONFIG_ROOT}/objects/systemObjectList.h") FRAMEWORK_OBJECT_PATH = Path( f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/objectmanager/frameworkObjects.h" ) -COMMON_OBJECTS_PATH = Path(f"{OBSW_ROOT_DIR}/common/config/commonObjects.h") +COMMON_OBJECTS_PATH = Path(f"{OBSW_ROOT_DIR}/common/config/eive/objects.h") OBJECTS_DEFINITIONS = [OBJECTS_PATH, FRAMEWORK_OBJECT_PATH, COMMON_OBJECTS_PATH] SQL_DELETE_OBJECTS_CMD = """ diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 12e74bfe..0b1d3b05 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 133 translations. - * Generated on: 2022-08-24 16:44:18 + * Contains 135 translations. + * Generated on: 2022-09-27 09:32:46 */ #include "translateObjects.h" @@ -136,6 +136,8 @@ 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 *TM_FUNNEL_STRING = "TM_FUNNEL"; const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE"; const char *NO_OBJECT_STRING = "NO_OBJECT"; @@ -402,6 +404,10 @@ 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; case 0x73000100: return TM_FUNNEL_STRING; case 0x73500000: diff --git a/generators/returnvalues/returnvalues_parser.py b/generators/returnvalues/returnvalues_parser.py index 4cacd529..e79f79de 100644 --- a/generators/returnvalues/returnvalues_parser.py +++ b/generators/returnvalues/returnvalues_parser.py @@ -43,7 +43,7 @@ BSP_PATH = f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}" INTERFACE_DEFINITION_FILES = [ f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/returnvalues/FwClassIds.h", - f"{OBSW_ROOT_DIR}/common/config/commonClassIds.h", + f"{OBSW_ROOT_DIR}/common/config/eive/resultClassIds.h", f"{FSFW_CONFIG_ROOT}/returnvalues/classIds.h", ] RETURNVALUE_SOURCES = [ diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 21ba77b3..3efd2fc3 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 216 translations. + * @brief Auto-generated event translation file. Contains 217 translations. * @details - * Generated on: 2022-08-24 16:44:18 + * Generated on: 2022-09-27 09:32:46 */ #include "translateEvents.h" @@ -75,6 +75,7 @@ const char *OVERWRITING_HEALTH_STRING = "OVERWRITING_HEALTH"; const char *TRYING_RECOVERY_STRING = "TRYING_RECOVERY"; const char *RECOVERY_STEP_STRING = "RECOVERY_STEP"; const char *RECOVERY_DONE_STRING = "RECOVERY_DONE"; +const char *HANDLE_PACKET_FAILED_STRING = "HANDLE_PACKET_FAILED"; const char *RF_AVAILABLE_STRING = "RF_AVAILABLE"; const char *RF_LOST_STRING = "RF_LOST"; const char *BIT_LOCK_STRING = "BIT_LOCK"; @@ -360,6 +361,8 @@ const char *translateEvents(Event event) { return RECOVERY_STEP_STRING; case (7512): return RECOVERY_DONE_STRING; + case (7600): + return HANDLE_PACKET_FAILED_STRING; case (7900): return RF_AVAILABLE_STRING; case (7901): diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 12e74bfe..0b1d3b05 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 133 translations. - * Generated on: 2022-08-24 16:44:18 + * Contains 135 translations. + * Generated on: 2022-09-27 09:32:46 */ #include "translateObjects.h" @@ -136,6 +136,8 @@ 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 *TM_FUNNEL_STRING = "TM_FUNNEL"; const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE"; const char *NO_OBJECT_STRING = "NO_OBJECT"; @@ -402,6 +404,10 @@ 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; case 0x73000100: return TM_FUNNEL_STRING; case 0x73500000: diff --git a/tmtc b/tmtc index 4307620a..eaf79ba0 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 4307620a56c1f030247e4ad4a73a8e07864dde92 +Subproject commit eaf79ba03d66f2611c2491e1eac212e87076291e From 90962c9f8e9538a03b487514343cf96fb936d755 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 10:51:07 +0200 Subject: [PATCH 132/361] rudimentary SD commanding interface --- bsp_q7s/boardconfig/q7sConfig.h.in | 10 - bsp_q7s/core/CoreController.cpp | 387 +++++++++----------- bsp_q7s/core/CoreController.h | 35 +- bsp_q7s/fs/FilesystemHelper.cpp | 4 +- bsp_q7s/fs/SdCardManager.cpp | 9 +- bsp_q7s/fs/SdCardManager.h | 3 +- linux/devices/startracker/StrHelper.cpp | 4 +- mission/devices/PayloadPcduHandler.cpp | 2 +- mission/memory/SdCardMountedIF.h | 2 +- unittest/rebootLogic/src/CoreController.cpp | 12 +- unittest/rebootLogic/src/CoreController.h | 6 +- 11 files changed, 226 insertions(+), 248 deletions(-) diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index a678764a..ee9cd863 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -16,16 +16,6 @@ /** Other flags */ /*******************************************************************/ -#define Q7S_SD_NONE 0 -#define Q7S_SD_COLD_REDUNDANT 1 -#define Q7S_SD_HOT_REDUNDANT 2 -// The OBSW will perform different actions to set up the SD cards depending on the flag set here -// Set to Q7S_SD_NONE: Don't do anything -// Set to Q7S_COLD_REDUNDANT: On startup, get the prefered SD card, turn it on and mount it, and -// turn off the second SD card if it is on -// Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them -#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT - // Probably better if this is disabled for mission code. Convenient for development #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 210e1a20..6e66c655 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -62,6 +62,8 @@ CoreController::CoreController(object_id_t objectId) eventQueue = QueueFactory::instance()->createMessageQueue(5, EventMessage::MAX_MESSAGE_SIZE); } +CoreController::~CoreController() {} + ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) { return ExtendedControllerBase::handleCommandMessage(message); } @@ -141,8 +143,8 @@ ReturnValue_t CoreController::initialize() { ReturnValue_t CoreController::initializeAfterTaskCreation() { ReturnValue_t result = returnvalue::OK; - sdInfo.pref = sdcMan->getPreferredSdCard(); - sdcMan->setActiveSdCard(sdInfo.pref); + sdInfo.active = sdcMan->getPreferredSdCard(); + sdcMan->setActiveSdCard(sdInfo.active); currMntPrefix = sdcMan->getCurrentMountPrefix(); if (BLOCKING_SD_INIT) { ReturnValue_t result = initSdCardBlocking(); @@ -209,6 +211,33 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ case (OBSW_UPDATE_FROM_TMP): { return executeSwUpdate(SwUpdateSources::TMP_DIR, data, size); } + case (SWITCH_TO_SD_0): { + if (not startSdStateMachine(sd::SdCard::SLOT_0, SdCfgMode::COLD_REDUNDANT)) { + return HasActionsIF::IS_BUSY; + } + return returnvalue::OK; + } + case (SWITCH_TO_SD_1): { + if (not startSdStateMachine(sd::SdCard::SLOT_1, SdCfgMode::COLD_REDUNDANT)) { + return HasActionsIF::IS_BUSY; + } + return returnvalue::OK; + } + case (SWITCH_TO_BOTH_SD_CARDS): { + // An active SD still needs to be specified because the system needs to know which SD + // card to use for regular operations like telemetry storage. + if (size != 1) { + return HasActionsIF::INVALID_PARAMETERS; + } + if (data[0] != 0 and data[1] != 1) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto active = static_cast(data[0]); + if (not startSdStateMachine(active, SdCfgMode::HOT_REDUNDANT)) { + return HasActionsIF::IS_BUSY; + } + return returnvalue::OK; + } case (SWITCH_IMG_LOCK): { if (size != 3) { return HasActionsIF::INVALID_PARAMETERS; @@ -256,60 +285,59 @@ ReturnValue_t CoreController::initSdCardBlocking() { if (result != returnvalue::OK) { sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl; } -#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE - sif::info << "No SD card initialization will be performed" << std::endl; - return returnvalue::OK; -#else + if (sdInfo.cfgMode == SdCfgMode::PASSIVE) { + sif::info << "No SD card initialization will be performed" << std::endl; + return returnvalue::OK; + } result = sdcMan->getSdCardsStatus(sdInfo.currentState); if (result != returnvalue::OK) { sif::warning << "Getting SD card activity status failed" << std::endl; } -#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT - updateSdInfoOther(); - sif::info << "Cold redundant SD card configuration, preferred SD card: " - << static_cast(sdInfo.pref) << std::endl; - result = sdColdRedundantBlockingInit(); - // Update status file - sdcMan->updateSdCardStateFile(); - return result; -#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT - sif::info << "Hot redundant SD card configuration" << std::endl; - sdCardSetup(sd::SdCard::SLOT_0, sd::SdState::MOUNTED, "0", false); - sdCardSetup(sd::SdCard::SLOT_1, sd::SdState::MOUNTED, "1", false); - // Update status file - sdcMan->updateSdCardStateFile(); + if (sdInfo.cfgMode == SdCfgMode::COLD_REDUNDANT) { + updateSdInfoOther(); + sif::info << "Cold redundant SD card configuration, preferred SD card: " + << static_cast(sdInfo.active) << std::endl; + result = sdColdRedundantBlockingInit(); + // Update status file + sdcMan->updateSdCardStateFile(); + return result; + } + if (sdInfo.cfgMode == SdCfgMode::HOT_REDUNDANT) { + sif::info << "Hot redundant SD card configuration" << std::endl; + sdCardSetup(sd::SdCard::SLOT_0, sd::SdState::MOUNTED, "0", false); + sdCardSetup(sd::SdCard::SLOT_1, sd::SdState::MOUNTED, "1", false); + // Update status file + sdcMan->updateSdCardStateFile(); + } return returnvalue::OK; -#endif - -#endif /* Q7S_SD_CARD_CONFIG != Q7S_SD_NONE */ } ReturnValue_t CoreController::sdStateMachine() { ReturnValue_t result = returnvalue::OK; SdCardManager::Operations operation; - if (sdInfo.state == SdStates::IDLE) { + if (sdFsmState == SdStates::IDLE) { // Nothing to do return result; } - if (sdInfo.state == SdStates::START) { + if (sdFsmState == SdStates::START) { // Init will be performed by separate function if (BLOCKING_SD_INIT) { - sdInfo.state = SdStates::IDLE; + sdFsmState = SdStates::IDLE; sdInfo.initFinished = true; return result; } else { // Still update SD state file -#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE - sdInfo.state = SdStates::UPDATE_INFO; -#else - sdInfo.cycleCount = 0; - sdInfo.commandExecuted = false; - sdInfo.state = SdStates::GET_INFO; -#endif + if (sdInfo.cfgMode == SdCfgMode::PASSIVE) { + sdFsmState = SdStates::UPDATE_INFO; + } else { + sdInfo.cycleCount = 0; + sdInfo.commandExecuted = false; + sdFsmState = SdStates::GET_INFO; + } } } @@ -319,7 +347,7 @@ ReturnValue_t CoreController::sdStateMachine() { std::string opPrintout) { SdCardManager::OpStatus status = sdcMan->checkCurrentOp(operation); if (status == SdCardManager::OpStatus::SUCCESS) { - sdInfo.state = newStateOnSuccess; + sdFsmState = newStateOnSuccess; sdInfo.commandExecuted = false; sdInfo.cycleCount = 0; return true; @@ -331,9 +359,9 @@ ReturnValue_t CoreController::sdStateMachine() { return false; }; - if (sdInfo.state == SdStates::GET_INFO) { + if (sdFsmState == SdStates::GET_INFO) { if (not sdInfo.commandExecuted) { - // Create update status file + // Create updated status file result = sdcMan->updateSdCardStateFile(); if (result != returnvalue::OK) { sif::warning << "CoreController::initialize: Updating SD card state file failed" @@ -345,139 +373,141 @@ ReturnValue_t CoreController::sdStateMachine() { } } - if (sdInfo.state == SdStates::SET_STATE_SELF) { + if (sdFsmState == SdStates::SET_STATE_SELF) { if (not sdInfo.commandExecuted) { result = sdcMan->getSdCardsStatus(sdInfo.currentState); - sdInfo.pref = sdcMan->getPreferredSdCard(); updateSdInfoOther(); - if (sdInfo.pref != sd::SdCard::SLOT_0 and sdInfo.pref != sd::SdCard::SLOT_1) { + if (sdInfo.active != sd::SdCard::SLOT_0 and sdInfo.active != sd::SdCard::SLOT_1) { sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl; - sdInfo.pref = sd::SdCard::SLOT_0; + sdInfo.active = sd::SdCard::SLOT_0; } if (result != returnvalue::OK) { sif::warning << "Getting SD card activity status failed" << std::endl; } -#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT - sif::info << "Cold redundant SD card configuration, preferred SD card: " - << static_cast(sdInfo.pref) << std::endl; -#endif - if (sdInfo.prefState == sd::SdState::MOUNTED) { + if (sdInfo.cfgMode == SdCfgMode::COLD_REDUNDANT) { + sif::info << "Cold redundant SD card configuration, preferred SD card: " + << static_cast(sdInfo.active) << std::endl; + } + if (sdInfo.activeState == sd::SdState::MOUNTED) { #if OBSW_VERBOSE_LEVEL >= 1 std::string mountString; - if (sdInfo.pref == sd::SdCard::SLOT_0) { + if (sdInfo.active == sd::SdCard::SLOT_0) { mountString = config::SD_0_MOUNT_POINT; } else { mountString = config::SD_1_MOUNT_POINT; } - sif::info << "SD card " << sdInfo.prefChar << " already on and mounted at " << mountString + sif::info << "SD card " << sdInfo.activeChar << " already on and mounted at " << mountString << std::endl; #endif - sdInfo.state = SdStates::DETERMINE_OTHER; - } else if (sdInfo.prefState == sd::SdState::OFF) { - sdCardSetup(sdInfo.pref, sd::SdState::ON, sdInfo.prefChar, false); + sdcMan->setActiveSdCard(sdInfo.active); + sdFsmState = SdStates::DETERMINE_OTHER; + } else if (sdInfo.activeState == sd::SdState::OFF) { + sdCardSetup(sdInfo.active, sd::SdState::ON, sdInfo.activeChar, false); sdInfo.commandExecuted = true; - } else if (sdInfo.prefState == sd::SdState::ON) { - sdInfo.state = SdStates::MOUNT_SELF; + } else if (sdInfo.activeState == sd::SdState::ON) { + sdFsmState = SdStates::MOUNT_SELF; } } else { if (nonBlockingOpChecking(SdStates::MOUNT_SELF, 10, "Setting SDC state")) { - sdInfo.prefState = sd::SdState::ON; - currentStateSetter(sdInfo.pref, sd::SdState::ON); + sdInfo.activeState = sd::SdState::ON; + currentStateSetter(sdInfo.active, sd::SdState::ON); } } } - if (sdInfo.state == SdStates::MOUNT_SELF) { + if (sdFsmState == SdStates::MOUNT_SELF) { if (not sdInfo.commandExecuted) { - result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar); + result = sdCardSetup(sdInfo.active, sd::SdState::MOUNTED, sdInfo.activeChar); sdInfo.commandExecuted = true; } else { if (nonBlockingOpChecking(SdStates::DETERMINE_OTHER, 5, "Mounting SD card")) { - sdInfo.prefState = sd::SdState::MOUNTED; - currentStateSetter(sdInfo.pref, sd::SdState::MOUNTED); + sdcMan->setActiveSdCard(sdInfo.active); + sdInfo.activeState = sd::SdState::MOUNTED; + currentStateSetter(sdInfo.active, sd::SdState::MOUNTED); } } } - if (sdInfo.state == SdStates::DETERMINE_OTHER) { + if (sdFsmState == SdStates::DETERMINE_OTHER) { // Determine whether any additional operations have to be done for the other SD card // 1. Cold redundant case: Other SD card needs to be unmounted and switched off // 2. Hot redundant case: Other SD card needs to be mounted and switched on -#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT - if (sdInfo.otherState == sd::SdState::ON) { - sdInfo.state = SdStates::SET_STATE_OTHER; - } else if (sdInfo.otherState == sd::SdState::MOUNTED) { - sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER; - } else { - // Is already off, update info, but with a small delay - sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE; + if (sdInfo.cfgMode == SdCfgMode::COLD_REDUNDANT) { + if (sdInfo.otherState == sd::SdState::ON) { + sdFsmState = SdStates::SET_STATE_OTHER; + } else if (sdInfo.otherState == sd::SdState::MOUNTED) { + sdFsmState = SdStates::MOUNT_UNMOUNT_OTHER; + } else { + // Is already off, update info, but with a small delay + sdFsmState = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE; + } + } else if (sdInfo.cfgMode == SdCfgMode::HOT_REDUNDANT) { + if (sdInfo.otherState == sd::SdState::OFF) { + sdFsmState = SdStates::SET_STATE_OTHER; + } else if (sdInfo.otherState == sd::SdState::ON) { + sdFsmState = SdStates::MOUNT_UNMOUNT_OTHER; + } else { + // Is already on and mounted, update info + sdFsmState = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE; + } } -#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT - if (sdInfo.otherState == sd::SdState::OFF) { - sdInfo.state = SdStates::SET_STATE_OTHER; - } else if (sdInfo.otherState == sd::SdState::ON) { - sdInfo.state = SdStates::MOUNT_UNMOUNT_OTHER; - } else { - // Is already on and mounted, update info - sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE; - } -#endif } - if (sdInfo.state == SdStates::SET_STATE_OTHER) { + if (sdFsmState == SdStates::SET_STATE_OTHER) { // Set state of other SD card to ON or OFF, depending on redundancy mode -#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT - if (not sdInfo.commandExecuted) { - result = sdCardSetup(sdInfo.other, sd::SdState::OFF, sdInfo.otherChar, false); - sdInfo.commandExecuted = true; - } else { - if (nonBlockingOpChecking(SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE, 10, - "Switching off other SD card")) { - sdInfo.otherState = sd::SdState::OFF; - currentStateSetter(sdInfo.other, sd::SdState::OFF); + if (sdInfo.cfgMode == SdCfgMode::COLD_REDUNDANT) { + if (not sdInfo.commandExecuted) { + result = sdCardSetup(sdInfo.other, sd::SdState::OFF, sdInfo.otherChar, false); + sdInfo.commandExecuted = true; + } else { + if (nonBlockingOpChecking(SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE, 10, + "Switching off other SD card")) { + sdInfo.otherState = sd::SdState::OFF; + currentStateSetter(sdInfo.other, sd::SdState::OFF); + } + } + } else if (sdInfo.cfgMode == SdCfgMode::HOT_REDUNDANT) { + if (not sdInfo.commandExecuted) { + result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar, false); + sdInfo.commandExecuted = true; + } else { + if (nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10, + "Switching on other SD card")) { + sdInfo.otherState = sd::SdState::ON; + currentStateSetter(sdInfo.other, sd::SdState::ON); + } } } -#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT - if (not sdInfo.commandExecuted) { - result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar, false); - sdInfo.commandExecuted = true; - } else { - if (nonBlockingOpChecking(SdStates::MOUNT_UNMOUNT_OTHER, 10, "Switching on other SD card")) { - sdInfo.otherState = sd::SdState::ON; - currentStateSetter(sdInfo.other, sd::SdState::ON); - } - } -#endif } - if (sdInfo.state == SdStates::MOUNT_UNMOUNT_OTHER) { + if (sdFsmState == SdStates::MOUNT_UNMOUNT_OTHER) { // Mount or unmount other SD card, depending on redundancy mode -#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT - if (not sdInfo.commandExecuted) { - result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar); - sdInfo.commandExecuted = true; - } else { - if (nonBlockingOpChecking(SdStates::SET_STATE_OTHER, 10, "Unmounting other SD card")) { - sdInfo.otherState = sd::SdState::ON; - currentStateSetter(sdInfo.other, sd::SdState::ON); + if (sdInfo.cfgMode == SdCfgMode::COLD_REDUNDANT) { + if (not sdInfo.commandExecuted) { + result = sdCardSetup(sdInfo.other, sd::SdState::ON, sdInfo.otherChar); + sdInfo.commandExecuted = true; + } else { + if (nonBlockingOpChecking(SdStates::SET_STATE_OTHER, 10, "Unmounting other SD card")) { + sdInfo.otherState = sd::SdState::ON; + currentStateSetter(sdInfo.other, sd::SdState::ON); + } + } + } else if (sdInfo.cfgMode == SdCfgMode::HOT_REDUNDANT) { + if (not sdInfo.commandExecuted) { + result = sdCardSetup(sdInfo.other, sd::SdState::MOUNTED, sdInfo.otherChar); + sdInfo.commandExecuted = true; + } else { + if (nonBlockingOpChecking(SdStates::UPDATE_INFO, 4, "Mounting other SD card")) { + sdInfo.otherState = sd::SdState::MOUNTED; + currentStateSetter(sdInfo.other, sd::SdState::MOUNTED); + } } } -#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT - if (not sdInfo.commandExecuted) { - result = sdCardSetup(sdInfo.other, sd::SdState::MOUNTED, sdInfo.otherChar); - sdInfo.commandExecuted = true; - } else { - if (nonBlockingOpChecking(SdStates::UPDATE_INFO, 4, "Mounting other SD card")) { - sdInfo.otherState = sd::SdState::MOUNTED; - currentStateSetter(sdInfo.other, sd::SdState::MOUNTED); - } - } -#endif } - if (sdInfo.state == SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE) { - sdInfo.state = SdStates::UPDATE_INFO; - } else if (sdInfo.state == SdStates::UPDATE_INFO) { + if (sdFsmState == SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE) { + sdFsmState = SdStates::UPDATE_INFO; + } else if (sdFsmState == SdStates::UPDATE_INFO) { // It is assumed that all tasks are running by the point this section is reached. // Therefore, perform this operation in blocking mode because it does not take long // and the ready state of the SD card is available sooner @@ -488,10 +518,15 @@ ReturnValue_t CoreController::sdStateMachine() { sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl; } sdInfo.commandExecuted = false; - sdInfo.state = SdStates::IDLE; + sdFsmState = SdStates::IDLE; sdInfo.cycleCount = 0; sdcMan->setBlocking(false); sdcMan->getSdCardsStatus(sdInfo.currentState); + if (sdCommandingInfo.cmdPending) { + sdCommandingInfo.cmdPending = false; + actionHelper.finish(true, sdCommandingInfo.commander, sdCommandingInfo.actionId, + returnvalue::OK); + } if (not sdInfo.initFinished) { updateSdInfoOther(); sdInfo.initFinished = true; @@ -499,81 +534,10 @@ ReturnValue_t CoreController::sdStateMachine() { } } - if (sdInfo.state == SdStates::SET_STATE_FROM_COMMAND) { - if (not sdInfo.commandExecuted) { - executeNextExternalSdCommand(); - } else { - checkExternalSdCommandStatus(); - } - } - sdInfo.cycleCount++; return returnvalue::OK; } -void CoreController::executeNextExternalSdCommand() { - std::string sdChar; - sd::SdState currentStateOfCard = sd::SdState::OFF; - if (sdInfo.commandedCard == sd::SdCard::SLOT_0) { - sdChar = "0"; - currentStateOfCard = sdInfo.currentState.first; - } else { - sdChar = "1"; - currentStateOfCard = sdInfo.currentState.second; - } - if (currentStateOfCard == sd::SdState::OFF) { - if (sdInfo.commandedState == sd::SdState::ON) { - sdInfo.currentlyCommandedState = sdInfo.commandedState; - } else if (sdInfo.commandedState == sd::SdState::MOUNTED) { - sdInfo.currentlyCommandedState = sd::SdState::ON; - } else { - // SD card is already on target state - sdInfo.commandFinished = true; - sdInfo.state = SdStates::IDLE; - } - } else if (currentStateOfCard == sd::SdState::ON) { - if (sdInfo.commandedState == sd::SdState::OFF or - sdInfo.commandedState == sd::SdState::MOUNTED) { - sdInfo.currentlyCommandedState = sdInfo.commandedState; - } else { - // Already on target state - sdInfo.commandFinished = true; - sdInfo.state = SdStates::IDLE; - } - } else if (currentStateOfCard == sd::SdState::MOUNTED) { - if (sdInfo.commandedState == sd::SdState::ON) { - sdInfo.currentlyCommandedState = sdInfo.commandedState; - } else if (sdInfo.commandedState == sd::SdState::OFF) { - // This causes an unmount in sdCardSetup - sdInfo.currentlyCommandedState = sd::SdState::ON; - } else { - sdInfo.commandFinished = true; - } - } - sdCardSetup(sdInfo.commandedCard, sdInfo.commandedState, sdChar); - sdInfo.commandExecuted = true; -} - -void CoreController::checkExternalSdCommandStatus() { - SdCardManager::Operations operation; - SdCardManager::OpStatus status = sdcMan->checkCurrentOp(operation); - if (status == SdCardManager::OpStatus::SUCCESS) { - if (sdInfo.currentlyCommandedState == sdInfo.commandedState) { - sdInfo.state = SdStates::SKIP_CYCLE_BEFORE_INFO_UPDATE; - sdInfo.commandFinished = true; - } else { - // stay on same state machine state because the target state was not reached yet. - sdInfo.cycleCount = 0; - } - currentStateSetter(sdInfo.commandedCard, sdInfo.currentlyCommandedState); - sdInfo.commandExecuted = false; - } else if (sdInfo.cycleCount > 4) { - sif::warning << "CoreController::sdStateMachine: Commanding SD state " - "takes too long" - << std::endl; - } -} - void CoreController::currentStateSetter(sd::SdCard sdCard, sd::SdState newState) { if (sdCard == sd::SdCard::SLOT_0) { sdInfo.currentState.first = newState; @@ -645,12 +609,12 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS ReturnValue_t CoreController::sdColdRedundantBlockingInit() { ReturnValue_t result = returnvalue::OK; - result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar); + result = sdCardSetup(sdInfo.active, sd::SdState::MOUNTED, sdInfo.activeChar); if (result != SdCardManager::ALREADY_MOUNTED and result != returnvalue::OK) { sif::warning << "Setting up preferred card " << sdInfo.otherChar << " in cold redundant mode failed" << std::endl; // Try other SD card and mark set up operation as failed - sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar); + sdCardSetup(sdInfo.active, sd::SdState::MOUNTED, sdInfo.activeChar); result = returnvalue::FAILED; } @@ -967,21 +931,19 @@ ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy co return result; } -CoreController::~CoreController() {} - void CoreController::updateSdInfoOther() { - if (sdInfo.pref == sd::SdCard::SLOT_0) { - sdInfo.prefChar = "0"; + if (sdInfo.active == sd::SdCard::SLOT_0) { + sdInfo.activeChar = "0"; sdInfo.otherChar = "1"; sdInfo.otherState = sdInfo.currentState.second; - sdInfo.prefState = sdInfo.currentState.first; + sdInfo.activeState = sdInfo.currentState.first; sdInfo.other = sd::SdCard::SLOT_1; - } else if (sdInfo.pref == sd::SdCard::SLOT_1) { - sdInfo.prefChar = "1"; + } else if (sdInfo.active == sd::SdCard::SLOT_1) { + sdInfo.activeChar = "1"; sdInfo.otherChar = "0"; sdInfo.otherState = sdInfo.currentState.first; - sdInfo.prefState = sdInfo.currentState.second; + sdInfo.activeState = sdInfo.currentState.second; sdInfo.other = sd::SdCard::SLOT_0; } else { sif::warning << "CoreController::updateSdInfoOther: Invalid SD card passed" << std::endl; @@ -1254,7 +1216,7 @@ void CoreController::performWatchdogControlOperation() { void CoreController::performMountedSdCardOperations() { auto mountedSdCardOp = [&](bool &mntSwitch, sd::SdCard sdCard, std::string mntPoint) { if (mntSwitch) { - bool sdCardMounted = sdcMan->isSdCardMounted(sdCard); + bool sdCardMounted = sdcMan->isSdCardUsable(sdCard); if (sdCardMounted and not performOneShotSdCardOpsSwitch) { std::ostringstream path; path << mntPoint << "/" << CONF_FOLDER; @@ -1269,7 +1231,7 @@ void CoreController::performMountedSdCardOperations() { mntSwitch = false; } }; - if (sdInfo.pref == sd::SdCard::SLOT_1) { + if (sdInfo.active == sd::SdCard::SLOT_1) { mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT); mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT); } else { @@ -1283,13 +1245,15 @@ ReturnValue_t CoreController::performSdCardCheck() { bool mountedReadOnly = false; SdCardManager::SdStatePair active; sdcMan->getSdCardsStatus(active); + if (sdFsmState != SdStates::IDLE) { + return returnvalue::OK; + } auto sdCardCheck = [&](sd::SdCard sdCard) { ReturnValue_t result = sdcMan->isSdCardMountedReadOnly(sdCard, mountedReadOnly); if (result != returnvalue::OK) { sif::error << "CoreController::performSdCardCheck: Could not check " "read-only mount state" << std::endl; - mountedReadOnly = true; } if (mountedReadOnly) { int linuxErrno = 0; @@ -1986,6 +1950,17 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u return HasActionsIF::EXECUTION_FINISHED; } +bool CoreController::startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode) { + if (sdFsmState != SdStates::IDLE or sdCommandingInfo.cmdPending) { + return false; + } + sdFsmState = SdStates::START; + sdInfo.active = targetActiveSd; + sdInfo.cfgMode = mode; + sdCommandingInfo.cmdPending = true; + return true; +} + bool CoreController::isNumber(const std::string &s) { return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) { return !std::isdigit(c); }) == s.end(); diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index e49411a4..2f96e033 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -79,6 +79,10 @@ class CoreController : public ExtendedControllerBase { static constexpr ActionId_t OBSW_UPDATE_FROM_SD_1 = 11; static constexpr ActionId_t OBSW_UPDATE_FROM_TMP = 12; + static constexpr ActionId_t SWITCH_TO_SD_0 = 16; + static constexpr ActionId_t SWITCH_TO_SD_1 = 17; + static constexpr ActionId_t SWITCH_TO_BOTH_SD_CARDS = 18; + //! Reboot using the xsc_boot_copy command static constexpr ActionId_t XSC_REBOOT_OBC = 32; static constexpr ActionId_t MOUNT_OTHER_COPY = 33; @@ -164,9 +168,7 @@ class CoreController : public ExtendedControllerBase { SKIP_CYCLE_BEFORE_INFO_UPDATE, UPDATE_INFO, // SD initialization done - IDLE, - // Used if SD switches or mount commands are issued via telecommand - SET_STATE_FROM_COMMAND, + IDLE }; enum class SwUpdateSources { SD_0, SD_1, TMP_DIR }; @@ -176,27 +178,31 @@ class CoreController : public ExtendedControllerBase { SdCardManager* sdcMan = nullptr; MessageQueueIF* eventQueue = nullptr; - struct SdInfo { - sd::SdCard pref = sd::SdCard::NONE; + SdStates sdFsmState = SdStates::START; + enum SdCfgMode { PASSIVE, COLD_REDUNDANT, HOT_REDUNDANT }; + + struct SdFsmParams { + SdCfgMode cfgMode = SdCfgMode::COLD_REDUNDANT; + sd::SdCard active = sd::SdCard::NONE; sd::SdCard other = sd::SdCard::NONE; - sd::SdState prefState = sd::SdState::OFF; + sd::SdState activeState = sd::SdState::OFF; sd::SdState otherState = sd::SdState::OFF; - std::string prefChar = "0"; + std::string activeChar = "0"; std::string otherChar = "1"; std::pair mountSwitch = {true, true}; - SdStates state = SdStates::START; // Used to track whether a command was executed bool commandExecuted = true; bool initFinished = false; SdCardManager::SdStatePair currentState; uint16_t cycleCount = 0; - // These two flags are related to external commanding - bool commandIssued = false; - bool commandFinished = false; - sd::SdState currentlyCommandedState = sd::SdState::OFF; - sd::SdCard commandedCard = sd::SdCard::NONE; - sd::SdState commandedState = sd::SdState::OFF; } sdInfo; + + struct SdCommanding { + bool cmdPending = false; + MessageQueueId_t commander = MessageQueueIF::NO_QUEUE; + DeviceCommandId_t actionId; + } sdCommandingInfo; + RebootFile rebootFile = {}; std::string currMntPrefix; bool performOneShotSdCardOpsSwitch = true; @@ -227,6 +233,7 @@ class CoreController : public ExtendedControllerBase { ReturnValue_t initBootCopy(); ReturnValue_t initWatchdogFifo(); ReturnValue_t initSdCardBlocking(); + bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode); void initPrint(); ReturnValue_t sdStateMachine(); diff --git a/bsp_q7s/fs/FilesystemHelper.cpp b/bsp_q7s/fs/FilesystemHelper.cpp index 68bf2178..bc435d1c 100644 --- a/bsp_q7s/fs/FilesystemHelper.cpp +++ b/bsp_q7s/fs/FilesystemHelper.cpp @@ -16,13 +16,13 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) { return returnvalue::FAILED; } if (path.substr(0, sizeof(config::SD_0_MOUNT_POINT)) == std::string(config::SD_0_MOUNT_POINT)) { - if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { + if (!sdcMan->isSdCardUsable(sd::SLOT_0)) { sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl; return SD_NOT_MOUNTED; } } else if (path.substr(0, sizeof(config::SD_1_MOUNT_POINT)) == std::string(config::SD_1_MOUNT_POINT)) { - if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { + if (!sdcMan->isSdCardUsable(sd::SLOT_0)) { sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl; return SD_NOT_MOUNTED; } diff --git a/bsp_q7s/fs/SdCardManager.cpp b/bsp_q7s/fs/SdCardManager.cpp index 68155a20..ea238225 100644 --- a/bsp_q7s/fs/SdCardManager.cpp +++ b/bsp_q7s/fs/SdCardManager.cpp @@ -213,6 +213,9 @@ ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& active) { while (std::getline(sdStatus, line)) { processSdStatusLine(active, line, idx, currentSd); } + if (active.first != sd::SdState::MOUNTED && active.second != sd::SdState::MOUNTED) { + sdCardActive = false; + } return returnvalue::OK; } @@ -466,7 +469,7 @@ void SdCardManager::setBlocking(bool blocking) { this->blocking = blocking; } void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = print; } -bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) { +bool SdCardManager::isSdCardUsable(sd::SdCard sdCard) { SdCardManager::SdStatePair active; ReturnValue_t result = this->getSdCardsStatus(active); @@ -496,8 +499,10 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re std::ostringstream command; if (sdcard == sd::SdCard::SLOT_0) { command << "grep -q '" << config::SD_0_MOUNT_POINT << " vfat ro,' /proc/mounts"; - } else { + } else if (sdcard == sd::SdCard::SLOT_1) { command << "grep -q '" << config::SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts"; + } else { + return returnvalue::FAILED; } ReturnValue_t result = cmdExecutor.load(command.str(), true, false); if (result != returnvalue::OK) { diff --git a/bsp_q7s/fs/SdCardManager.h b/bsp_q7s/fs/SdCardManager.h index 28886ffe..ad222687 100644 --- a/bsp_q7s/fs/SdCardManager.h +++ b/bsp_q7s/fs/SdCardManager.h @@ -206,7 +206,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF { * * @return true if mounted, otherwise false */ - bool isSdCardMounted(sd::SdCard sdCard) override; + bool isSdCardUsable(sd::SdCard sdCard) override; ReturnValue_t isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly); @@ -218,6 +218,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF { CommandExecutor cmdExecutor; Operations currentOp = Operations::IDLE; bool blocking = false; + bool sdCardActive = true; bool printCmdOutput = true; MutexIF* mutex = nullptr; diff --git a/linux/devices/startracker/StrHelper.cpp b/linux/devices/startracker/StrHelper.cpp index fa3971af..685cf3b3 100644 --- a/linux/devices/startracker/StrHelper.cpp +++ b/linux/devices/startracker/StrHelper.cpp @@ -543,13 +543,13 @@ ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) { #ifdef XIPHOS_Q7S ReturnValue_t StrHelper::checkPath(std::string name) { if (name.substr(0, sizeof(config::SD_0_MOUNT_POINT)) == std::string(config::SD_0_MOUNT_POINT)) { - if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { + if (!sdcMan->isSdCardUsable(sd::SLOT_0)) { sif::warning << "StrHelper::checkPath: SD card 0 not mounted" << std::endl; return SD_NOT_MOUNTED; } } else if (name.substr(0, sizeof(config::SD_1_MOUNT_POINT)) == std::string(config::SD_1_MOUNT_POINT)) { - if (!sdcMan->isSdCardMounted(sd::SLOT_0)) { + if (!sdcMan->isSdCardUsable(sd::SLOT_0)) { sif::warning << "StrHelper::checkPath: SD card 1 not mounted" << std::endl; return SD_NOT_MOUNTED; } diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index e643a945..3a027b9a 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -492,7 +492,7 @@ void PayloadPcduHandler::checkAdcValues() { void PayloadPcduHandler::checkJsonFileInit() { if (not jsonFileInitComplete) { sd::SdCard activeSd = sdcMan->getActiveSdCard(); - if (sdcMan->isSdCardMounted(activeSd)) { + if (sdcMan->isSdCardUsable(activeSd)) { params.initialize(sdcMan->getCurrentMountPrefix()); jsonFileInitComplete = true; } diff --git a/mission/memory/SdCardMountedIF.h b/mission/memory/SdCardMountedIF.h index 853c7e8d..453a44d7 100644 --- a/mission/memory/SdCardMountedIF.h +++ b/mission/memory/SdCardMountedIF.h @@ -9,7 +9,7 @@ class SdCardMountedIF { public: virtual ~SdCardMountedIF(){}; virtual std::string getCurrentMountPrefix() const = 0; - virtual bool isSdCardMounted(sd::SdCard sdCard) = 0; + virtual bool isSdCardUsable(sd::SdCard sdCard) = 0; virtual sd::SdCard getPreferredSdCard() const = 0; virtual void setActiveSdCard(sd::SdCard sdCard) = 0; virtual sd::SdCard getActiveSdCard() const = 0; diff --git a/unittest/rebootLogic/src/CoreController.cpp b/unittest/rebootLogic/src/CoreController.cpp index 87268b45..2bc8bbef 100644 --- a/unittest/rebootLogic/src/CoreController.cpp +++ b/unittest/rebootLogic/src/CoreController.cpp @@ -21,7 +21,7 @@ CoreController::CoreController() { void CoreController::performRebootFileHandling(bool recreateFile) { using namespace std; - std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE; + std::string path = sdcMan->getCurrentMountPrefix(sdInfo.active) + REBOOT_FILE; if (not std::filesystem::exists(path) or recreateFile) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "CoreController::performRebootFileHandling: Recreating reboot file" << std::endl; @@ -400,7 +400,7 @@ bool CoreController::parseRebootFile(std::string path, RebootFile &rf) { } void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) { - std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE; + std::string path = sdcMan->getCurrentMountPrefix(sdInfo.active) + REBOOT_FILE; // Disable the reboot file mechanism parseRebootFile(path, rebootFile); if (tgtChip == xsc::ALL_CHIP and tgtCopy == xsc::ALL_COPY) { @@ -427,7 +427,7 @@ void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) { } void CoreController::rewriteRebootFile(RebootFile file) { - std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE; + std::string path = sdcMan->getCurrentMountPrefix(sdInfo.active) + REBOOT_FILE; std::ofstream rebootFile(path); if (rebootFile.is_open()) { // Initiate reboot file first. Reboot handling will be on on initialization @@ -450,7 +450,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ if (size < 1) { return HasActionsIF::INVALID_PARAMETERS; } - std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE; + std::string path = sdcMan->getCurrentMountPrefix(sdInfo.active) + REBOOT_FILE; // Disable the reboot file mechanism parseRebootFile(path, rebootFile); if (data[0] == 0) { @@ -490,7 +490,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ if (size < 1) { return HasActionsIF::INVALID_PARAMETERS; } - std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE; + std::string path = sdcMan->getCurrentMountPrefix(sdInfo.active) + REBOOT_FILE; // Disable the reboot file mechanism parseRebootFile(path, rebootFile); rebootFile.maxCount = data[0]; @@ -504,7 +504,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ } void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy) { - std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE; + std::string path = sdcMan->getCurrentMountPrefix(sdInfo.active) + REBOOT_FILE; // Disable the reboot file mechanism parseRebootFile(path, rebootFile); if (tgtChip == xsc::CHIP_0) { diff --git a/unittest/rebootLogic/src/CoreController.h b/unittest/rebootLogic/src/CoreController.h index c79a4ccd..1846c27f 100644 --- a/unittest/rebootLogic/src/CoreController.h +++ b/unittest/rebootLogic/src/CoreController.h @@ -66,9 +66,9 @@ class CoreController { void rewriteRebootFile(RebootFile file); private: - struct SdInfo { - sd::SdCard pref = sd::SdCard::NONE; - sd::SdState prefState = sd::SdState::OFF; + struct SdFsmParams { + sd::SdCard active = sd::SdCard::NONE; + sd::SdState activeState = sd::SdState::OFF; sd::SdCard other = sd::SdCard::NONE; sd::SdState otherState = sd::SdState::OFF; } sdInfo; From 8c0fd8d9e20cf330e69dc136f910ab60f2ba8a89 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 10:51:56 +0200 Subject: [PATCH 133/361] some informative docs --- bsp_q7s/core/CoreController.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 6e66c655..f01eb9a8 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -215,12 +215,14 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ if (not startSdStateMachine(sd::SdCard::SLOT_0, SdCfgMode::COLD_REDUNDANT)) { return HasActionsIF::IS_BUSY; } + // Completion will be reported by SD card state machine return returnvalue::OK; } case (SWITCH_TO_SD_1): { if (not startSdStateMachine(sd::SdCard::SLOT_1, SdCfgMode::COLD_REDUNDANT)) { return HasActionsIF::IS_BUSY; } + // Completion will be reported by SD card state machine return returnvalue::OK; } case (SWITCH_TO_BOTH_SD_CARDS): { @@ -236,6 +238,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ if (not startSdStateMachine(active, SdCfgMode::HOT_REDUNDANT)) { return HasActionsIF::IS_BUSY; } + // Completion will be reported by SD card state machine return returnvalue::OK; } case (SWITCH_IMG_LOCK): { From caca7f5da8c6bbc49dcbdbfab21184e19179b97c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 10:55:00 +0200 Subject: [PATCH 134/361] small bugfix --- bsp_q7s/core/CoreController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index f01eb9a8..de78f486 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -231,7 +231,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ if (size != 1) { return HasActionsIF::INVALID_PARAMETERS; } - if (data[0] != 0 and data[1] != 1) { + if (data[0] != 0 and data[0] != 1) { return HasActionsIF::INVALID_PARAMETERS; } auto active = static_cast(data[0]); From 51976730aa265040dbed696bbcaafc8e0623ab5c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 11:14:54 +0200 Subject: [PATCH 135/361] important bugfix --- bsp_q7s/core/CoreController.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index de78f486..57f307d2 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -49,7 +49,6 @@ CoreController::CoreController(object_id_t objectId) if (not BLOCKING_SD_INIT) { sdcMan->setBlocking(false); } - sdStateMachine(); result = initBootCopy(); if (result != returnvalue::OK) { @@ -144,6 +143,12 @@ ReturnValue_t CoreController::initialize() { ReturnValue_t CoreController::initializeAfterTaskCreation() { ReturnValue_t result = returnvalue::OK; sdInfo.active = sdcMan->getPreferredSdCard(); + if (sdInfo.active == sd::SdCard::NONE) { + sif::error << "CoreController::initializeAfterTaskCreation: " + "Issues getting preferred SD card, setting to 0" + << std::endl; + sdInfo.active = sd::SdCard::SLOT_0; + } sdcMan->setActiveSdCard(sdInfo.active); currMntPrefix = sdcMan->getCurrentMountPrefix(); if (BLOCKING_SD_INIT) { From 2c3c3c76af67529dbb9c8326971d41404282a80a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 12:14:33 +0200 Subject: [PATCH 136/361] check out explicit json version --- thirdparty/json | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/thirdparty/json b/thirdparty/json index fb1ee4f9..bc889afb 160000 --- a/thirdparty/json +++ b/thirdparty/json @@ -1 +1 @@ -Subproject commit fb1ee4f94b426a398969b2c96df9784be8e007e6 +Subproject commit bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d diff --git a/tmtc b/tmtc index eaf79ba0..aae1fbdd 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit eaf79ba03d66f2611c2491e1eac212e87076291e +Subproject commit aae1fbddf4f5a208b3407dd11f61e33bb526268f From ff243fa46c72878c6197ed3b798a7531c7dac769 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 12:19:42 +0200 Subject: [PATCH 137/361] some bugfixes --- bsp_q7s/core/CoreController.cpp | 15 ++++++++++----- bsp_q7s/core/CoreController.h | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 57f307d2..51ab2bbb 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -217,14 +217,16 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return executeSwUpdate(SwUpdateSources::TMP_DIR, data, size); } case (SWITCH_TO_SD_0): { - if (not startSdStateMachine(sd::SdCard::SLOT_0, SdCfgMode::COLD_REDUNDANT)) { + if (not startSdStateMachine(sd::SdCard::SLOT_0, SdCfgMode::COLD_REDUNDANT, commandedBy, + actionId)) { return HasActionsIF::IS_BUSY; } // Completion will be reported by SD card state machine return returnvalue::OK; } case (SWITCH_TO_SD_1): { - if (not startSdStateMachine(sd::SdCard::SLOT_1, SdCfgMode::COLD_REDUNDANT)) { + if (not startSdStateMachine(sd::SdCard::SLOT_1, SdCfgMode::COLD_REDUNDANT, commandedBy, + actionId)) { return HasActionsIF::IS_BUSY; } // Completion will be reported by SD card state machine @@ -240,7 +242,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return HasActionsIF::INVALID_PARAMETERS; } auto active = static_cast(data[0]); - if (not startSdStateMachine(active, SdCfgMode::HOT_REDUNDANT)) { + if (not startSdStateMachine(active, SdCfgMode::HOT_REDUNDANT, commandedBy, actionId)) { return HasActionsIF::IS_BUSY; } // Completion will be reported by SD card state machine @@ -393,7 +395,7 @@ ReturnValue_t CoreController::sdStateMachine() { sif::warning << "Getting SD card activity status failed" << std::endl; } if (sdInfo.cfgMode == SdCfgMode::COLD_REDUNDANT) { - sif::info << "Cold redundant SD card configuration, preferred SD card: " + sif::info << "Cold redundant SD card configuration, target SD card: " << static_cast(sdInfo.active) << std::endl; } if (sdInfo.activeState == sd::SdState::MOUNTED) { @@ -1958,13 +1960,16 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u return HasActionsIF::EXECUTION_FINISHED; } -bool CoreController::startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode) { +bool CoreController::startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode, + MessageQueueId_t commander, DeviceCommandId_t actionId) { if (sdFsmState != SdStates::IDLE or sdCommandingInfo.cmdPending) { return false; } sdFsmState = SdStates::START; sdInfo.active = targetActiveSd; sdInfo.cfgMode = mode; + sdCommandingInfo.actionId = actionId; + sdCommandingInfo.commander = commander; sdCommandingInfo.cmdPending = true; return true; } diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 2f96e033..206a93c9 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -233,7 +233,8 @@ class CoreController : public ExtendedControllerBase { ReturnValue_t initBootCopy(); ReturnValue_t initWatchdogFifo(); ReturnValue_t initSdCardBlocking(); - bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode); + bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode, MessageQueueId_t commander, + DeviceCommandId_t actionId); void initPrint(); ReturnValue_t sdStateMachine(); From 3c746e954b882892e4f6acdac2b373053f2a9e02 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 14:29:39 +0200 Subject: [PATCH 138/361] updates on same image are problematic.. --- bsp_q7s/core/CoreController.cpp | 51 +++++++++++++++++++++++++-------- tmtc | 2 +- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 51ab2bbb..ca63bb90 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -410,6 +410,7 @@ ReturnValue_t CoreController::sdStateMachine() { << std::endl; #endif sdcMan->setActiveSdCard(sdInfo.active); + currMntPrefix = sdcMan->getCurrentMountPrefix(); sdFsmState = SdStates::DETERMINE_OTHER; } else if (sdInfo.activeState == sd::SdState::OFF) { sdCardSetup(sdInfo.active, sd::SdState::ON, sdInfo.activeChar, false); @@ -432,6 +433,7 @@ ReturnValue_t CoreController::sdStateMachine() { } else { if (nonBlockingOpChecking(SdStates::DETERMINE_OTHER, 5, "Mounting SD card")) { sdcMan->setActiveSdCard(sdInfo.active); + currMntPrefix = sdcMan->getCurrentMountPrefix(); sdInfo.activeState = sd::SdState::MOUNTED; currentStateSetter(sdInfo.active, sd::SdState::MOUNTED); } @@ -1869,6 +1871,13 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u } else { sourceStr = "tmp directory"; } + bool sameChipAndCopy = false; + if(chip == CURRENT_CHIP and copy == CURRENT_COPY) { + // This is problematic if the OBSW is running as a systemd service. + // Do not allow for now. + return HasActionsIF::INVALID_PARAMETERS; + //sameChipAndCopy = true; + } sif::info << "Executing SW update for Chip " << static_cast(data[0]) << " Copy " << static_cast(data[1]) << " from " << sourceStr << std::endl; path prefixPath; @@ -1901,17 +1910,35 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u } cmd.str(""); cmd.clear(); - cmd << "xsc_mount_copy " << std::to_string(data[0]) << " " << std::to_string(data[1]); - result = system(cmd.str().c_str()); - if (result != 0) { - std::string contextString = "CoreController::executeAction: SW Update Mounting " + - std::to_string(data[0]) + " " + std::to_string(data[1]); - utility::handleSystemError(result, contextString); + path obswDestPath; + path obswVersionDestPath; + if(not sameChipAndCopy) { + cmd << "xsc_mount_copy " << std::to_string(data[0]) << " " << std::to_string(data[1]); + result = system(cmd.str().c_str()); + if (result != 0) { + std::string contextString = "CoreController::executeAction: SW Update Mounting " + + std::to_string(data[0]) + " " + std::to_string(data[1]); + utility::handleSystemError(result, contextString); + } + cmd.str(""); + cmd.clear(); + path xscMountDest(getXscMountDir(chip, copy)); + obswDestPath = xscMountDest / path(relative(config::OBSW_PATH, "/")); + obswVersionDestPath = xscMountDest / path(relative(config::OBSW_VERSION_FILE_PATH, "/")); + } else { + obswDestPath = path(config::OBSW_PATH); + obswVersionDestPath = path(config::OBSW_VERSION_FILE_PATH); + cmd << "writeprotect " << std::to_string(CURRENT_CHIP) << " " << std::to_string(CURRENT_COPY) + << " 0"; + result = system(cmd.str().c_str()); + if (result != 0) { + std::string contextString = "CoreController::executeAction: Unlocking current chip"; + utility::handleSystemError(result, contextString); + } + cmd.str(""); + cmd.clear(); } - cmd.str(""); - cmd.clear(); - path xscMountDest(getXscMountDir(chip, copy)); - path obswDestPath = xscMountDest / path(relative(config::OBSW_PATH, "/")); + cmd << "cp " << strippedImagePath << " " << obswDestPath; result = system(cmd.str().c_str()); if (result != 0) { @@ -1919,7 +1946,7 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u } cmd.str(""); cmd.clear(); - path obswVersionDestPath = xscMountDest / path(relative(config::OBSW_VERSION_FILE_PATH, "/")); + cmd << "cp " << obswVersionFilePath << " " << obswVersionDestPath; result = system(cmd.str().c_str()); if (result != 0) { @@ -1933,7 +1960,7 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u result = system(cmd.str().c_str()); if (result != 0) { utility::handleSystemError(result, - "CoreController::executeAction: Copying SW permissions 0755"); + "CoreController::executeAction: Setting SW permissions 0755"); } cmd.str(""); cmd.clear(); diff --git a/tmtc b/tmtc index aae1fbdd..a2991988 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit aae1fbddf4f5a208b3407dd11f61e33bb526268f +Subproject commit a2991988f56b631b5bab67e452e9d7c126b49480 From 24062071c047886be41a62dedc82653da759ed89 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 14:56:32 +0200 Subject: [PATCH 139/361] bump json dependency to concrete version v3.11.2 --- thirdparty/json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/json b/thirdparty/json index fb1ee4f9..bc889afb 160000 --- a/thirdparty/json +++ b/thirdparty/json @@ -1 +1 @@ -Subproject commit fb1ee4f94b426a398969b2c96df9784be8e007e6 +Subproject commit bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d From 5813c5dd4384bbe5b699a68ce7a98bcb92dcee6c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 14:58:40 +0200 Subject: [PATCH 140/361] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 7e0a5d5a..808e3e04 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7e0a5d5a9e4f38c6d818bbdd5b44d34d8007eb1e +Subproject commit 808e3e0462999d7caa1b6834174140dbbeb8b01c From 308a855d8c6716a893e9fd523e9e4e2b67b24c39 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 27 Sep 2022 18:54:48 +0200 Subject: [PATCH 141/361] bugfix for scex testcode --- bsp_linux_board/ObjectFactory.cpp | 7 +++---- bsp_q7s/boardconfig/busConf.h | 1 - bsp_q7s/core/InitMission.cpp | 1 - bsp_q7s/core/ObjectFactory.cpp | 5 ++++- bsp_q7s/fmObjectFactory.cpp | 3 ++- linux/InitMission.cpp | 3 ++- linux/InitMission.h | 3 ++- linux/ObjectFactory.cpp | 8 ++++---- linux/ObjectFactory.h | 4 ++-- linux/boardtest/UartTestClass.cpp | 24 ++++++++++++----------- linux/boardtest/UartTestClass.h | 2 +- linux/csp/CspComIF.cpp | 12 ++++++------ mission/devices/GomspaceDeviceHandler.cpp | 8 ++++---- mission/devices/GomspaceDeviceHandler.h | 7 +++---- mission/devices/ScexDeviceHandler.cpp | 17 +++++++--------- mission/devices/ScexDeviceHandler.h | 6 +++--- 16 files changed, 56 insertions(+), 55 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 950ae3ce..075d1af6 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -82,9 +82,9 @@ void ObjectFactory::produce(void* args) { #endif #endif - auto* sdcMan = new RPiSdCardManager("/tmp"); #if OBSW_ADD_SCEX_DEVICE == 1 - createScexComponents(uart::DEV, pwrSwitcher, *sdcMan, true); + auto* sdcMan = new RPiSdCardManager("/tmp"); + createScexComponents(uart::DEV, pwrSwitcher, *sdcMan, true, std::nullopt); #endif #if OBSW_ADD_SUN_SENSORS == 1 @@ -201,8 +201,7 @@ void ObjectFactory::createTestTasks() { #endif #if OBSW_ADD_UART_TEST_CODE == 1 - auto scexReader = new ScexUartReader(objects::SCEX_UART_READER); - new UartTestClass(objects::UART_TEST, scexReader); + new UartTestClass(objects::UART_TEST); #else new UartComIF(objects::UART_COM_IF); #endif diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 3bccf249..3fb8d801 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -17,7 +17,6 @@ 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/ul-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"; diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index e3cef398..725252a5 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -249,7 +249,6 @@ void initmission::initTasks() { scheduling::schedulingScex(*factory, scexDevHandler, scexReaderTask); #endif - std::vector pusTasks; createPusTasks(*factory, missedDeadlineFunc, pusTasks); std::vector pstTasks; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 6627d90d..29b42906 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,5 +1,7 @@ #include "ObjectFactory.h" +#include + #include "OBSWConfig.h" #include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/callbacks/gnssCallback.h" @@ -865,7 +867,8 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { new I2cTestClass(objects::I2C_TEST, q7s::I2C_DEFAULT_DEV); #endif #if OBSW_ADD_UART_TEST_CODE == 1 - new UartTestClass(objects::UART_TEST); + // auto* reader= new ScexUartReader(objects::SCEX_UART_READER); + new UartTestClass(objects::UART_TEST, nullptr); #endif } diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index 43b8d255..86fb8bd9 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -1,4 +1,5 @@ #include + #include "OBSWConfig.h" #include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/ObjectFactory.h" @@ -60,7 +61,7 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_SCEX_DEVICE == 1 createScexComponents(q7s::UART_GNSS_DEV, pwrSwitcher, *SdCardManager::instance(), false, - pcdu::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V); + pcdu::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V); #endif /* Test Task */ #if OBSW_ADD_TEST_CODE == 1 diff --git a/linux/InitMission.cpp b/linux/InitMission.cpp index 7388c974..eb8f677a 100644 --- a/linux/InitMission.cpp +++ b/linux/InitMission.cpp @@ -7,7 +7,8 @@ #include "OBSWConfig.h" #include "ObjectFactory.h" -void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, PeriodicTaskIF*& scexReaderTask) { +void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, + PeriodicTaskIF*& scexReaderTask) { using namespace initmission; ReturnValue_t result = returnvalue::OK; #if OBSW_PRINT_MISSED_DEADLINES == 1 diff --git a/linux/InitMission.h b/linux/InitMission.h index cc507265..e5a3afff 100644 --- a/linux/InitMission.h +++ b/linux/InitMission.h @@ -2,5 +2,6 @@ #include namespace scheduling { -void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, PeriodicTaskIF*& scexReaderTask); +void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, + PeriodicTaskIF*& scexReaderTask); } diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 84d62162..43e4109a 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -325,17 +325,17 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher, SdCardMountedIF& mountedIF, bool onImmediately, - std::optional switchId) { + std::optional switchId) { // objekte anlegen auto* cookie = new UartCookie(objects::SCEX, uartDev, uart::SCEX_BAUD, 4096); auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER); auto scexHandler = new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, mountedIF); - if(onImmediately) { - scexHandler->setStartUpImmediately(); + if (onImmediately) { + scexHandler->setStartUpImmediately(); } if (switchId) { - scexHandler->setPowerSwitcher(*pwrSwitcher, switchId.value()); + scexHandler->setPowerSwitcher(*pwrSwitcher, switchId.value()); } } diff --git a/linux/ObjectFactory.h b/linux/ObjectFactory.h index 8142df7e..f4ecc6e3 100644 --- a/linux/ObjectFactory.h +++ b/linux/ObjectFactory.h @@ -5,8 +5,8 @@ #include #include -#include #include +#include class GpioIF; class SpiComIF; @@ -21,7 +21,7 @@ void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* p void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher, SdCardMountedIF& mountedIF, bool onImmediately, - std::optional switchId); + std::optional switchId); void gpioChecker(ReturnValue_t result, std::string output); diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 9843baa5..7f18957a 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -27,12 +27,11 @@ using namespace returnvalue; -UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) - : TestTask(objectId), reader(reader) { +UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) { mode = TestModes::SCEX; - scexMode = ScexModes::READER_TASK; + scexMode = ScexModes::SIMPLE; // No one-cell and all-cell support implemented yet - currCmd = scex::Cmds::FRAM; + currCmd = scex::Cmds::PING; if (scexMode == ScexModes::SIMPLE) { auto encodingBuf = new std::array; DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()}; @@ -40,6 +39,8 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader) DleParser::BufPair decodingBufPair{decodedBuf->data(), decodedBuf->size()}; dleParser = new ScexDleParser(*(new SimpleRingBuffer(4096, true)), dleEncoder, encodingBufPair, decodingBufPair, &foundDlePacketHandler, this); + } else { + reader = new ScexUartReader(objects::SCEX_UART_READER); } } @@ -150,13 +151,13 @@ void UartTestClass::gpsPeriodic() { } void UartTestClass::scexInit() { - if (reader == nullptr) { - sif::warning << "UartTestClass::scexInit: Reader invalid" << std::endl; - return; - } if (scexMode == ScexModes::SIMPLE) { scexSimpleInit(); } else { + if (reader == nullptr) { + sif::warning << "UartTestClass::scexInit: Reader invalid" << std::endl; + return; + } #if defined(RASPBERRY_PI) std::string devname = "/dev/serial0"; #else @@ -176,13 +177,13 @@ void UartTestClass::scexInit() { void UartTestClass::scexPeriodic() { using namespace std; using namespace scex; - if (reader == nullptr) { - return; - } if (scexMode == ScexModes::SIMPLE) { scexSimplePeriodic(); } else { + if (reader == nullptr) { + return; + } if (not cmdSent) { size_t len = 0; prepareScexCmd(currCmd, false, cmdBuf.data(), &len); @@ -375,6 +376,7 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu uint16_t crc = CRC::crc16ccitt(cmdBuf, 5); cmdBuf[5] = (crc >> 8) & 0xff; cmdBuf[6] = crc & 0xff; + *len = 7; return 0; } diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 1c1b9988..14d74322 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -19,7 +19,7 @@ class ScexDleParser; class UartTestClass : public TestTask { public: - UartTestClass(object_id_t objectId, ScexUartReader* reader); + UartTestClass(object_id_t objectId); ReturnValue_t initialize() override; ReturnValue_t performOneShotAction() override; diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index 5d8c3fd6..ea508a31 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -166,23 +166,23 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s if (result != 0) { return returnvalue::FAILED; } - } else if(req == GOMSPACE::SpecialRequestTypes::SAVE_TABLE) { - if(sendLen < 2) { + } else if (req == GOMSPACE::SpecialRequestTypes::SAVE_TABLE) { + if (sendLen < 2) { return returnvalue::FAILED; } const TableInfo* tableInfo = reinterpret_cast(sendData); int result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, - tableInfo->targetTable); + tableInfo->targetTable); if (result != 0) { return returnvalue::FAILED; } - } else if(req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) { - if(sendLen < 2) { + } else if (req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) { + if (sendLen < 2) { return returnvalue::FAILED; } const TableInfo* tableInfo = reinterpret_cast(sendData); int result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, - tableInfo->targetTable); + tableInfo->targetTable); if (result != 0) { return returnvalue::FAILED; } diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index ebfcf2a9..412f2e46 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -87,7 +87,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } case (GOMSPACE::REQUEST_HK_TABLE): { DeviceType devType; - if(getDevType(devType) != returnvalue::OK) { + if (getDevType(devType) != returnvalue::OK) { return returnvalue::FAILED; } result = @@ -99,11 +99,11 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } case (GOMSPACE::REQUEST_CONFIG_TABLE): { DeviceType devType; - if(getDevType(devType) != returnvalue::OK) { + if (getDevType(devType) != returnvalue::OK) { return returnvalue::FAILED; } - result = generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize, - deviceCommand, cspCookie); + result = + generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize, deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index 528cd2dd..af9d3411 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -93,10 +93,9 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { * @param cspCookie * @return */ - ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType, - uint16_t tableSize, DeviceCommandId_t id, - CspCookie *cspCookie); - ReturnValue_t getDevType(GOMSPACE::DeviceType& type) const; + ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType, uint16_t tableSize, + DeviceCommandId_t id, CspCookie *cspCookie); + ReturnValue_t getDevType(GOMSPACE::DeviceType &type) const; /** * This command handles printing the HK table to the console. This is useful for debugging * purposes diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 8add8d6b..5dddec3e 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -20,9 +20,7 @@ ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reade ScexDeviceHandler::~ScexDeviceHandler() {} -void ScexDeviceHandler::doStartUp() { - setMode(MODE_ON); -} +void ScexDeviceHandler::doStartUp() { setMode(MODE_ON); } void ScexDeviceHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } @@ -305,9 +303,9 @@ void ScexDeviceHandler::performOperationHook() { uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return OK; } ReturnValue_t ScexDeviceHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { - if(switchId) { - *numberOfSwitches = 1; - *switches = &switchId.value(); + if (switchId) { + *numberOfSwitches = 1; + *switches = &switchId.value(); } return OK; } @@ -348,8 +346,7 @@ std::string ScexDeviceHandler::date_time_string() { void ScexDeviceHandler::modeChanged() {} -void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) -{ - DeviceHandlerBase::setPowerSwitcher(&powerSwitcher); - this->switchId = switchId; +void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) { + DeviceHandlerBase::setPowerSwitcher(&powerSwitcher); + this->switchId = switchId; } diff --git a/mission/devices/ScexDeviceHandler.h b/mission/devices/ScexDeviceHandler.h index 19ce2e52..6cf2492b 100644 --- a/mission/devices/ScexDeviceHandler.h +++ b/mission/devices/ScexDeviceHandler.h @@ -1,13 +1,13 @@ #ifndef MISSION_DEVICES_SCEXDEVICEHANDLER_H_ #define MISSION_DEVICES_SCEXDEVICEHANDLER_H_ -#include #include #include #include -#include "commonSubsystemIds.h" +#include +#include "commonSubsystemIds.h" class SdCardMountedIF; @@ -15,7 +15,7 @@ class ScexDeviceHandler : public DeviceHandlerBase { public: ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie, SdCardMountedIF &sdcMan); - void setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId); + void setPowerSwitcher(PowerSwitchIF &powerSwitcher, power::Switch_t switchId); virtual ~ScexDeviceHandler(); private: From 32c2b2038c5e006452c8aaa4c356822643943440 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 27 Sep 2022 19:06:55 +0200 Subject: [PATCH 142/361] constructor correction --- bsp_q7s/core/ObjectFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 29b42906..320c4fc9 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -868,7 +868,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { #endif #if OBSW_ADD_UART_TEST_CODE == 1 // auto* reader= new ScexUartReader(objects::SCEX_UART_READER); - new UartTestClass(objects::UART_TEST, nullptr); + new UartTestClass(objects::UART_TEST); #endif } From 071e00e0efb64d7f591977b358137325e50480a2 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 27 Sep 2022 19:17:24 +0200 Subject: [PATCH 143/361] dog fixed --- bsp_q7s/core/InitMission.cpp | 39 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 725252a5..42e7900c 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -525,24 +525,25 @@ void initmission::createTestTasks(TaskFactory& factory, #endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1 } + /** - â–„ â–„ - ▌▒█ ▄▀▒▌ - ▌▒▒█ ▄▀▒▒▒� - �▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒� - ▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒� - ▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌ - �▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌ - ▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒� - �░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌ - ▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌ - ▌▒▀�▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒� - �▒▒�▀�▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌ - �▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒� - ▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌ - �▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒� - ▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌ - ▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀ - ▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀ - ▒▒▒▒▒▒▒▒▒▒▀▀ + â–„ â–„ + ▌▒█ ▄▀▒▌ + ▌▒▒█ ▄▀▒▒▒■+ â–▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒■+ ▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒■+ ▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌ + â–▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌ + ▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒■+ â–░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌ + ▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌ + ▌▒▀â–▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒■+ â–â–’â–’â–â–€â–▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌ + â–▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒■+ ▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌ + â–â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–‘â–’â–‘â–’â–‘â–’â–’â–„â–’â–’â– + ▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌ + ▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀ + ▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀ + ▒▒▒▒▒▒▒▒▒▒▀▀ **/ From c7e06f8878c1bc8ba5640cb424dfa8399e8591a5 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 27 Sep 2022 19:22:06 +0200 Subject: [PATCH 144/361] changelog update --- CHANGELOG.md | 2 ++ fsfw | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a7e2259..e33ea978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ list yields a list of all related PRs for each release. - Increase number of allowed consescutive action commands from 3 to 16 PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/294 - 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 # [v1.13.0] 24.08.2022 diff --git a/fsfw b/fsfw index 7e0a5d5a..808e3e04 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7e0a5d5a9e4f38c6d818bbdd5b44d34d8007eb1e +Subproject commit 808e3e0462999d7caa1b6834174140dbbeb8b01c From f415adccc20a8f94c31f2b387b538b771d344567 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 27 Sep 2022 19:30:42 +0200 Subject: [PATCH 145/361] repoint fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 808e3e04..7e0a5d5a 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 808e3e0462999d7caa1b6834174140dbbeb8b01c +Subproject commit 7e0a5d5a9e4f38c6d818bbdd5b44d34d8007eb1e From 26dc4ba56e53ae49bd657342e040229f2fc8a545 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Tue, 27 Sep 2022 19:38:35 +0200 Subject: [PATCH 146/361] fixes for compilation --- mission/utility/GlobalConfigHandler.cpp | 66 ++++++++++++------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/mission/utility/GlobalConfigHandler.cpp b/mission/utility/GlobalConfigHandler.cpp index 36d1bafa..fc92714e 100644 --- a/mission/utility/GlobalConfigHandler.cpp +++ b/mission/utility/GlobalConfigHandler.cpp @@ -24,7 +24,7 @@ GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string confi } ReturnValue_t GlobalConfigHandler::initialize() { ReturnValue_t result = SystemObject::initialize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::initialize: SystemObject::initialize() failed with " << result << std::endl; @@ -33,13 +33,13 @@ ReturnValue_t GlobalConfigHandler::initialize() { } result = ReadConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::initialize: Creating JSON file at " << getFullName() << std::endl; #endif result = ResetConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } } @@ -52,29 +52,29 @@ ReturnValue_t GlobalConfigHandler::initialize() { GlobalConfigHandler::~GlobalConfigHandler() {} ReturnValue_t GlobalConfigHandler::performOperation(uint8_t operationCode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; sif::debug << "GlobalConfigHandler::performOperation" << std::endl; return result; } ReturnValue_t GlobalConfigHandler::lockConfigFile() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = configLock->lockMutex(MutexIF::TimeoutType::WAITING, 10); return result; } ReturnValue_t GlobalConfigHandler::unlockConfigFile() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = configLock->unlockMutex(); return result; } template ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) { - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultSet = RETURN_OK; + ReturnValue_t result = returnvalue::OK; + ReturnValue_t resultSet = returnvalue::OK; result = lockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::setConfigFileValue lock mutex failed with " << result << std::endl; @@ -93,11 +93,11 @@ ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) << " not found!" << std::endl; #endif triggerEvent(SET_CONFIGFILEVALUE_FAILED, 1, 0); - return RETURN_FAILED; + return returnvalue::FAILED; } resultSet = setValue(PARAM_KEY_MAP[paramID], data); - if (resultSet != RETURN_OK) { + if (resultSet != returnvalue::OK) { triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << resultSet @@ -106,7 +106,7 @@ ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) } result = unlockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::setConfigFileValue unlock mutex failed with " << result << std::endl; @@ -118,11 +118,11 @@ ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) } template ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) { - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultGet = RETURN_OK; + ReturnValue_t result = returnvalue::OK; + ReturnValue_t resultGet = returnvalue::OK; result = lockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result << std::endl; @@ -131,7 +131,7 @@ ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) } resultGet = getValue(PARAM_KEY_MAP[paramID], data); - if (resultGet != RETURN_OK) { + if (resultGet != returnvalue::OK) { triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::getConfigFileValue getValue failed with " << resultGet @@ -139,7 +139,7 @@ ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) #endif } result = unlockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::getConfigFileValue unlock mutex failed with " << result << std::endl; @@ -151,9 +151,9 @@ ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) } ReturnValue_t GlobalConfigHandler::resetConfigFileValues() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = lockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::resetConfigFileValues lock mutex failed with " << result << std::endl; @@ -164,7 +164,7 @@ ReturnValue_t GlobalConfigHandler::resetConfigFileValues() { insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT); result = unlockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::resetConfigFileValues unlock mutex failed with " << result << std::endl; @@ -174,10 +174,10 @@ ReturnValue_t GlobalConfigHandler::resetConfigFileValues() { return result; } ReturnValue_t GlobalConfigHandler::WriteConfigFile() { - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultWrite = RETURN_OK; + ReturnValue_t result = returnvalue::OK; + ReturnValue_t resultWrite = returnvalue::OK; result = lockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::WriteConfigFile lock mutex failed with " << result << std::endl; @@ -186,7 +186,7 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile() { } resultWrite = writeJsonFile(); - if (resultWrite != RETURN_OK) { + if (resultWrite != returnvalue::OK) { triggerEvent(WRITE_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << resultWrite @@ -195,7 +195,7 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile() { } result = unlockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::WriteConfigFile unlock mutex failed with " << result << std::endl; @@ -205,10 +205,10 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile() { return resultWrite; } ReturnValue_t GlobalConfigHandler::ReadConfigFile() { - ReturnValue_t result = RETURN_OK; - ReturnValue_t resultRead = RETURN_OK; + ReturnValue_t result = returnvalue::OK; + ReturnValue_t resultRead = returnvalue::OK; result = lockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::ReadConfigFile lock mutex failed with " << result << std::endl; @@ -217,7 +217,7 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile() { } resultRead = readJsonFile(); - if (resultRead != RETURN_OK) { + if (resultRead != returnvalue::OK) { triggerEvent(READ_CONFIGFILE_FAILED, 0, 0); #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << resultRead @@ -226,7 +226,7 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile() { } result = unlockConfigFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::ReadConfigFile unlock mutex failed with " << result << std::endl; @@ -237,9 +237,9 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile() { return resultRead; } ReturnValue_t GlobalConfigHandler::ResetConfigFile() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = resetConfigFileValues(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "GlobalConfigHandler::ResetConfigFile failed with " << result << std::endl; #endif @@ -250,7 +250,7 @@ ReturnValue_t GlobalConfigHandler::ResetConfigFile() { } ReturnValue_t GlobalConfigHandler::setConfigFileName(std::string configFileName) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; setFullName(configFileName); result = ResetConfigFile(); return result; From 1aa3cc3595e7aba7f07f4a305076f32e103ff89f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 21:45:22 +0200 Subject: [PATCH 147/361] cant build GW SW of windows --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b8190ec..a59783b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,7 +367,11 @@ if(EIVE_ADD_LINUX_FILES) add_subdirectory(${LINUX_PATH}) endif() add_subdirectory(${BSP_PATH}) -add_subdirectory(${LIB_GOMSPACE_PATH}) + +if(UNIX) + add_subdirectory(${LIB_GOMSPACE_PATH}) +endif() + add_subdirectory(${COMMON_PATH}) add_subdirectory(${DUMMY_PATH}) @@ -452,8 +456,7 @@ if(TGT_BSP MATCHES "arm/q7s") endif() target_link_libraries( - ${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} rapidcsv ${LIB_DUMMIES} - ${LIB_GOMSPACE_CLIENTS}) + ${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} rapidcsv ${LIB_DUMMIES}) if(TGT_BSP MATCHES "arm/egse") target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) From 0c75997ba08d1842a06e43272af19100a9ce16eb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 23:59:17 +0200 Subject: [PATCH 148/361] now it compiles for windows again --- CMakeLists.txt | 6 ++-- fsfw | 2 +- .../devicedefinitions/GomspaceDefinitions.h | 8 ++---- .../devicedefinitions/gomspaceDefines.h | 28 +++++++++++++++++++ 4 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 mission/devices/devicedefinitions/gomspaceDefines.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a59783b4..e8efc3fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -462,9 +462,9 @@ if(TGT_BSP MATCHES "arm/egse") target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) endif() -target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS}) -target_link_libraries(${LIB_EIVE_MISSION} PRIVATE ${LIB_GOMSPACE_CLIENTS}) -target_link_libraries(${LIB_DUMMIES} PRIVATE ${LIB_GOMSPACE_CLIENTS}) +if(UNIX) + target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS}) +endif() if(EIVE_ADD_ETL_LIB) target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET}) diff --git a/fsfw b/fsfw index 7e0a5d5a..03e1a932 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7e0a5d5a9e4f38c6d818bbdd5b44d34d8007eb1e +Subproject commit 03e1a9325034bd9805bfc3a1aa65e9c188762d12 diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index cab71362..879adf82 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -5,16 +5,12 @@ #include #include #include +#include "fsfw/platform.h" #include #include "devices/powerSwitcherList.h" -#include "p60acu_hk.h" -#include "p60acu_param.h" -#include "p60dock_hk.h" -#include "p60dock_param.h" -#include "p60pdu_hk.h" -#include "p60pdu_param.h" +#include "gomspaceDefines.h" namespace GOMSPACE { diff --git a/mission/devices/devicedefinitions/gomspaceDefines.h b/mission/devices/devicedefinitions/gomspaceDefines.h new file mode 100644 index 00000000..2260e7e6 --- /dev/null +++ b/mission/devices/devicedefinitions/gomspaceDefines.h @@ -0,0 +1,28 @@ +#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINES_H_ +#define MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINES_H_ + +#include "fsfw/platform.h" + +#ifdef PLATFORM_WIN + +static constexpr uint32_t P60DOCK_HK_SIZE = 0xBE; +static constexpr uint32_t P60DOCK_PARAM_SIZE = 0x19C; +static constexpr uint32_t P60PDU_HK_SIZE = 0x90; +static constexpr uint32_t P60PDU_PARAM_SIZE = 0x13E; +static constexpr uint32_t P60ACU_HK_SIZE = 0x7C; +static constexpr uint32_t P60ACU_PARAM_SIZE = 0x1B; + +#else + +#include "p60acu_hk.h" +#include "p60acu_param.h" +#include "p60dock_hk.h" +#include "p60dock_param.h" +#include "p60pdu_hk.h" +#include "p60pdu_param.h" + +#endif + + + +#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINES_H_ */ From 6888df5c44c3816a64bc635fb4d0d600ea3453ff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 23:59:38 +0200 Subject: [PATCH 149/361] afmt --- linux/obc/PtmeConfig.h | 2 +- mission/devices/SusHandler.h | 3 +-- mission/devices/devicedefinitions/GomspaceDefinitions.h | 2 +- mission/devices/devicedefinitions/gomspaceDefines.h | 2 -- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index aa5c663a..9c5a85af 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -4,8 +4,8 @@ #include "AxiPtmeConfig.h" #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/returnvalues/returnvalue.h" -#include "returnvalues/classIds.h" #include "linux/obc/PtmeConfig.h" +#include "returnvalues/classIds.h" /** * @brief Class to configure donwlink specific parameters in the PTME IP core. diff --git a/mission/devices/SusHandler.h b/mission/devices/SusHandler.h index 94673c40..5645c47d 100644 --- a/mission/devices/SusHandler.h +++ b/mission/devices/SusHandler.h @@ -4,10 +4,9 @@ #include #include "devicedefinitions/SusDefinitions.h" +#include "events/subsystemIdRanges.h" #include "fsfw/globalfunctions/PeriodicOperationDivider.h" #include "mission/devices/max1227.h" - -#include "events/subsystemIdRanges.h" #include "returnvalues/classIds.h" /** diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 879adf82..40a4fc59 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -5,11 +5,11 @@ #include #include #include -#include "fsfw/platform.h" #include #include "devices/powerSwitcherList.h" +#include "fsfw/platform.h" #include "gomspaceDefines.h" namespace GOMSPACE { diff --git a/mission/devices/devicedefinitions/gomspaceDefines.h b/mission/devices/devicedefinitions/gomspaceDefines.h index 2260e7e6..af96c228 100644 --- a/mission/devices/devicedefinitions/gomspaceDefines.h +++ b/mission/devices/devicedefinitions/gomspaceDefines.h @@ -23,6 +23,4 @@ static constexpr uint32_t P60ACU_PARAM_SIZE = 0x1B; #endif - - #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINES_H_ */ From e2b83f92228ba72b7d78c506fe24272d798f37d6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Sep 2022 00:02:03 +0200 Subject: [PATCH 150/361] update .cproject file --- misc/eclipse/.cproject | 66 +++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 9bb5f401..082b64f2 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -19,7 +19,7 @@ - +