Merge remote-tracking branch 'origin/develop' into irini
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
commit
a1cc5b0ca7
@ -17,6 +17,10 @@ list yields a list of all related PRs for each release.
|
|||||||
GomSpace TM tables
|
GomSpace TM tables
|
||||||
- Add API to retrieve GomSpace device parameter tables
|
- Add API to retrieve GomSpace device parameter tables
|
||||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/287
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/287
|
||||||
|
- Add API to save and load GomSpace config tables
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/293
|
||||||
|
- Increase number of allowed consescutive action commands from 3 to 16
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/294
|
||||||
|
|
||||||
# [v1.13.0] 24.08.2022
|
# [v1.13.0] 24.08.2022
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp gpioInit.cpp
|
target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp gpioInit.cpp
|
||||||
ObjectFactory.cpp)
|
ObjectFactory.cpp RPiSdCardManager.cpp)
|
||||||
|
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
add_subdirectory(boardtest)
|
add_subdirectory(boardtest)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
#include <linux/InitMission.h>
|
||||||
#include <mission/utility/InitMission.h>
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -78,34 +79,10 @@ void initmission::initTasks() {
|
|||||||
sif::error << "Add component TMTC Polling failed" << std::endl;
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_SCEX == 1
|
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||||
PeriodicTaskIF* scexDevHandler = factory->createPeriodicTask(
|
PeriodicTaskIF* scexDevHandler;
|
||||||
"SCEX_DEV", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc);
|
PeriodicTaskIF* scexReaderTask;
|
||||||
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION);
|
scheduling::schedulingScex(*factory, scexDevHandler, scexReaderTask);
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
initmission::printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
||||||
}
|
|
||||||
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
initmission::printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
||||||
}
|
|
||||||
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
initmission::printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
||||||
}
|
|
||||||
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
initmission::printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
||||||
}
|
|
||||||
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
|
|
||||||
|
|
||||||
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 != returnvalue::OK) {
|
|
||||||
initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
@ -140,7 +117,7 @@ void initmission::initTasks() {
|
|||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
taskStarter(pstTasks, "PST Tasks");
|
taskStarter(pstTasks, "PST Tasks");
|
||||||
|
|
||||||
#if OBSW_ADD_SCEX == 1
|
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||||
scexDevHandler->startTask();
|
scexDevHandler->startTask();
|
||||||
scexReaderTask->startTask();
|
scexReaderTask->startTask();
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define OBSW_ADD_RTD_DEVICES 0
|
#define OBSW_ADD_RTD_DEVICES 0
|
||||||
#define OBSW_ADD_PL_PCDU 0
|
#define OBSW_ADD_PL_PCDU 0
|
||||||
#define OBSW_ADD_TMP_DEVICES 0
|
#define OBSW_ADD_TMP_DEVICES 0
|
||||||
#define OBSW_ADD_SCEX 1
|
#define OBSW_ADD_SCEX_DEVICE 1
|
||||||
#define OBSW_ADD_RAD_SENSORS 0
|
#define OBSW_ADD_RAD_SENSORS 0
|
||||||
#define OBSW_ADD_SYRLINKS 0
|
#define OBSW_ADD_SYRLINKS 0
|
||||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
|
#include <bsp_linux_board/RPiSdCardManager.h>
|
||||||
#include <linux/devices/ScexUartReader.h>
|
#include <linux/devices/ScexUartReader.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
@ -81,8 +82,9 @@ void ObjectFactory::produce(void* args) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_SCEX == 1
|
auto* sdcMan = new RPiSdCardManager("/tmp");
|
||||||
createScexComponents(uart::DEV, pwrSwitcher);
|
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||||
|
createScexComponents(uart::DEV, pwrSwitcher, *sdcMan, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_SUN_SENSORS == 1
|
#if OBSW_ADD_SUN_SENSORS == 1
|
||||||
|
@ -1,23 +1,13 @@
|
|||||||
#include "RPiSdCardManager.h"
|
#include "RPiSdCardManager.h"
|
||||||
|
|
||||||
RPiSdCardManager::RPiSdCardManager(const std::string& prefix):prefix(prefix) {
|
RPiSdCardManager::RPiSdCardManager(std::string prefix) : prefix(std::move(prefix)) {}
|
||||||
|
|
||||||
}
|
const std::string& RPiSdCardManager::getCurrentMountPrefix() const { return prefix; }
|
||||||
|
|
||||||
const std::string& RPiSdCardManager::getCurrentMountPrefix() const {
|
bool RPiSdCardManager::isSdCardMounted(sd::SdCard sdCard) { return true; }
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RPiSdCardManager::isSdCardMounted(sd::SdCard sdCard) {
|
std::optional<sd::SdCard> RPiSdCardManager::getPreferredSdCard() const { return std::nullopt; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<sd::SdCard> RPiSdCardManager::getPreferredSdCard() const {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RPiSdCardManager::setActiveSdCard(sd::SdCard sdCard) {}
|
void RPiSdCardManager::setActiveSdCard(sd::SdCard sdCard) {}
|
||||||
|
|
||||||
std::optional<sd::SdCard> RPiSdCardManager::getActiveSdCard() const {
|
std::optional<sd::SdCard> RPiSdCardManager::getActiveSdCard() const { return std::nullopt; }
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
@ -2,18 +2,17 @@
|
|||||||
#define BSP_LINUX_BOARD_RPISDCARDMANAGER_H_
|
#define BSP_LINUX_BOARD_RPISDCARDMANAGER_H_
|
||||||
#include <mission/memory/SdCardMountedIF.h>
|
#include <mission/memory/SdCardMountedIF.h>
|
||||||
|
|
||||||
class RPiSdCardManager: public SdCardMountedIF {
|
class RPiSdCardManager : public SdCardMountedIF {
|
||||||
public:
|
public:
|
||||||
RPiSdCardManager(const std::string& prefix);
|
RPiSdCardManager(std::string prefix);
|
||||||
const std::string& getCurrentMountPrefix() const override;
|
const std::string& getCurrentMountPrefix() const override;
|
||||||
bool isSdCardMounted(sd::SdCard sdCard) override;
|
bool isSdCardMounted(sd::SdCard sdCard) override;
|
||||||
std::optional<sd::SdCard> getPreferredSdCard() const override;
|
std::optional<sd::SdCard> getPreferredSdCard() const override;
|
||||||
void setActiveSdCard(sd::SdCard sdCard) override;
|
void setActiveSdCard(sd::SdCard sdCard) override;
|
||||||
std::optional<sd::SdCard> getActiveSdCard() const override;
|
std::optional<sd::SdCard> getActiveSdCard() const override;
|
||||||
private:
|
|
||||||
|
private:
|
||||||
std::string prefix;
|
std::string prefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_LINUX_BOARD_RPISDCARDMANAGER_H_ */
|
#endif /* BSP_LINUX_BOARD_RPISDCARDMANAGER_H_ */
|
||||||
|
@ -15,6 +15,8 @@ static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc";
|
|||||||
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
|
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
|
||||||
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";
|
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";
|
||||||
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str";
|
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_PDEC_REGISTERS[] = "/dev/uio0";
|
||||||
static constexpr char UIO_PTME[] = "/dev/uio1";
|
static constexpr char UIO_PTME[] = "/dev/uio1";
|
||||||
|
@ -140,7 +140,7 @@ ReturnValue_t CoreController::initialize() {
|
|||||||
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
auto sdCard = sdcMan->getPreferredSdCard();
|
auto sdCard = sdcMan->getPreferredSdCard();
|
||||||
if(not sdCard) {
|
if (not sdCard) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
sdInfo.pref = sdCard.value();
|
sdInfo.pref = sdCard.value();
|
||||||
@ -342,7 +342,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
result = sdcMan->getSdCardsStatus(sdInfo.currentState);
|
result = sdcMan->getSdCardsStatus(sdInfo.currentState);
|
||||||
auto sdCard = sdcMan->getPreferredSdCard();
|
auto sdCard = sdcMan->getPreferredSdCard();
|
||||||
if(not sdCard) {
|
if (not sdCard) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
sdInfo.pref = sdCard.value();
|
sdInfo.pref = sdCard.value();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "bsp_q7s/core/InitMission.h"
|
#include "bsp_q7s/core/InitMission.h"
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
|
#include <linux/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -242,6 +243,12 @@ void initmission::initTasks() {
|
|||||||
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||||
|
PeriodicTaskIF* scexDevHandler;
|
||||||
|
PeriodicTaskIF* scexReaderTask;
|
||||||
|
scheduling::schedulingScex(*factory, scexDevHandler, scexReaderTask);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
std::vector<PeriodicTaskIF*> pusTasks;
|
std::vector<PeriodicTaskIF*> pusTasks;
|
||||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||||
@ -280,8 +287,9 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
taskStarter(pstTasks, "PST task vector");
|
taskStarter(pstTasks, "PST task vector");
|
||||||
taskStarter(pusTasks, "PUS task vector");
|
taskStarter(pusTasks, "PUS task vector");
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||||
taskStarter(testTasks, "Test task vector");
|
scexDevHandler->startTask();
|
||||||
|
scexReaderTask->startTask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
@ -304,6 +312,11 @@ void initmission::initTasks() {
|
|||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
supvHelperTask->startTask();
|
supvHelperTask->startTask();
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
|
|
||||||
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
|
taskStarter(testTasks, "Test task vector");
|
||||||
|
#endif
|
||||||
|
|
||||||
sif::info << "Tasks started.." << std::endl;
|
sif::info << "Tasks started.." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,23 +527,23 @@ void initmission::createTestTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
▄ ▄
|
â–„ â–„
|
||||||
▌▒█ ▄▀▒▌
|
▌▒█ ▄▀▒▌
|
||||||
▌▒▒█ ▄▀▒▒▒▐
|
▌▒▒█ ▄▀▒▒▒â–<EFBFBD>
|
||||||
▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
|
â–<EFBFBD>▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒â–<EFBFBD>
|
||||||
▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
|
▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒â–<EFBFBD>
|
||||||
▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
|
▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
|
||||||
▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
|
â–<EFBFBD>▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
|
||||||
▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
|
▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒â–<EFBFBD>
|
||||||
▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
|
â–<EFBFBD>░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
|
||||||
▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
|
▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
|
||||||
▌▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐
|
▌▒▀â–<EFBFBD>▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒â–<EFBFBD>
|
||||||
▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
|
â–<EFBFBD>â–’â–’â–<EFBFBD>â–€â–<EFBFBD>▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
|
||||||
▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐
|
â–<EFBFBD>▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒â–<EFBFBD>
|
||||||
▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌
|
▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌
|
||||||
▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐
|
â–<EFBFBD>â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–’â–‘â–’â–‘â–’â–‘â–’â–’â–„â–’â–’â–<EFBFBD>
|
||||||
▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌
|
▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌
|
||||||
▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
|
▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
|
||||||
▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
|
▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
|
||||||
▒▒▒▒▒▒▒▒▒▒▀▀
|
▒▒▒▒▒▒▒▒▒▒▀▀
|
||||||
**/
|
**/
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "bsp_q7s/core/CoreController.h"
|
#include "bsp_q7s/core/CoreController.h"
|
||||||
#include "bsp_q7s/core/ObjectFactory.h"
|
#include "bsp_q7s/core/ObjectFactory.h"
|
||||||
@ -56,6 +57,11 @@ void ObjectFactory::produce(void* args) {
|
|||||||
#if OBSW_USE_CCSDS_IP_CORE == 1
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||||
createCcsdsComponents(gpioComIF);
|
createCcsdsComponents(gpioComIF);
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
|
||||||
|
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||||
|
createScexComponents(q7s::UART_GNSS_DEV, pwrSwitcher, *SdCardManager::instance(), false,
|
||||||
|
pcdu::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V);
|
||||||
|
#endif
|
||||||
/* Test Task */
|
/* Test Task */
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
createTestComponents(gpioComIF);
|
createTestComponents(gpioComIF);
|
||||||
|
@ -72,7 +72,8 @@ void FileSystemHandler::fileSystemCheckup() {
|
|||||||
SdCardManager::SdStatePair statusPair;
|
SdCardManager::SdStatePair statusPair;
|
||||||
sdcMan->getSdCardsStatus(statusPair);
|
sdcMan->getSdCardsStatus(statusPair);
|
||||||
auto preferredSdCard = sdcMan->getPreferredSdCard();
|
auto preferredSdCard = sdcMan->getPreferredSdCard();
|
||||||
if (preferredSdCard and (preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) {
|
if (preferredSdCard and (preferredSdCard == sd::SdCard::SLOT_0) and
|
||||||
|
(statusPair.first == sd::SdState::MOUNTED)) {
|
||||||
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||||
} else if ((preferredSdCard == sd::SdCard::SLOT_1) and
|
} else if ((preferredSdCard == sd::SdCard::SLOT_1) and
|
||||||
(statusPair.second == sd::SdState::MOUNTED)) {
|
(statusPair.second == sd::SdState::MOUNTED)) {
|
||||||
@ -109,7 +110,7 @@ ReturnValue_t FileSystemHandler::initialize() {
|
|||||||
}
|
}
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
auto sdCard = sdcMan->getPreferredSdCard();
|
auto sdCard = sdcMan->getPreferredSdCard();
|
||||||
if(not sdCard) {
|
if (not sdCard) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
sd::SdCard preferredSdCard = sdCard.value();
|
sd::SdCard preferredSdCard = sdCard.value();
|
||||||
|
@ -6,4 +6,4 @@ add_subdirectory(devices)
|
|||||||
add_subdirectory(fsfwconfig)
|
add_subdirectory(fsfwconfig)
|
||||||
add_subdirectory(obc)
|
add_subdirectory(obc)
|
||||||
|
|
||||||
target_sources(${OBSW_NAME} PUBLIC ObjectFactory.cpp)
|
target_sources(${OBSW_NAME} PUBLIC ObjectFactory.cpp InitMission.cpp)
|
||||||
|
46
linux/InitMission.cpp
Normal file
46
linux/InitMission.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#include "InitMission.h"
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
|
void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, PeriodicTaskIF*& scexReaderTask) {
|
||||||
|
using namespace initmission;
|
||||||
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||||
|
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
||||||
|
#else
|
||||||
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
|
#endif
|
||||||
|
scexDevHandler = factory.createPeriodicTask(
|
||||||
|
"SCEX_DEV", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc);
|
||||||
|
|
||||||
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
||||||
|
}
|
||||||
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
||||||
|
}
|
||||||
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
||||||
|
}
|
||||||
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
||||||
|
}
|
||||||
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
result = returnvalue::OK;
|
||||||
|
scexReaderTask = factory.createPeriodicTask(
|
||||||
|
"SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
|
result = scexReaderTask->addComponent(objects::SCEX_UART_READER);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER);
|
||||||
|
}
|
||||||
|
}
|
6
linux/InitMission.h
Normal file
6
linux/InitMission.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
|
||||||
|
namespace scheduling {
|
||||||
|
void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, PeriodicTaskIF*& scexReaderTask);
|
||||||
|
}
|
@ -323,14 +323,20 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
|||||||
#endif // OBSW_ADD_RTD_DEVICES == 1
|
#endif // OBSW_ADD_RTD_DEVICES == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher) {
|
void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher,
|
||||||
|
SdCardMountedIF& mountedIF, bool onImmediately,
|
||||||
|
std::optional<power::Switch_t> switchId) {
|
||||||
// objekte anlegen
|
// objekte anlegen
|
||||||
SdCardMountedIF* sdcMan = nullptr;
|
|
||||||
auto* cookie = new UartCookie(objects::SCEX, uartDev, uart::SCEX_BAUD, 4096);
|
auto* cookie = new UartCookie(objects::SCEX, uartDev, uart::SCEX_BAUD, 4096);
|
||||||
|
|
||||||
auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER);
|
auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER);
|
||||||
auto scexHandler = new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, sdcMan);
|
auto scexHandler = new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, mountedIF);
|
||||||
|
if(onImmediately) {
|
||||||
scexHandler->setStartUpImmediately();
|
scexHandler->setStartUpImmediately();
|
||||||
|
}
|
||||||
|
if (switchId) {
|
||||||
|
scexHandler->setPowerSwitcher(*pwrSwitcher, switchId.value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createThermalController() {
|
void ObjectFactory::createThermalController() {
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <fsfw/power/definitions.h>
|
||||||
#include <fsfw/returnvalues/returnvalue.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
#include <mission/memory/SdCardMountedIF.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
class GpioIF;
|
class GpioIF;
|
||||||
class SpiComIF;
|
class SpiComIF;
|
||||||
@ -16,7 +19,9 @@ void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitc
|
|||||||
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher,
|
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher,
|
||||||
SpiComIF* comIF);
|
SpiComIF* comIF);
|
||||||
|
|
||||||
void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher);
|
void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher,
|
||||||
|
SdCardMountedIF& mountedIF, bool onImmediately,
|
||||||
|
std::optional<power::Switch_t> switchId);
|
||||||
|
|
||||||
void gpioChecker(ReturnValue_t result, std::string output);
|
void gpioChecker(ReturnValue_t result, std::string output);
|
||||||
|
|
||||||
|
@ -166,6 +166,26 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
|||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
} else if(req == GOMSPACE::SpecialRequestTypes::SAVE_TABLE) {
|
||||||
|
if(sendLen < 2) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
const TableInfo* tableInfo = reinterpret_cast<const TableInfo*>(sendData);
|
||||||
|
int result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable,
|
||||||
|
tableInfo->targetTable);
|
||||||
|
if (result != 0) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
} else if(req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) {
|
||||||
|
if(sendLen < 2) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
const TableInfo* tableInfo = reinterpret_cast<const TableInfo*>(sendData);
|
||||||
|
int result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable,
|
||||||
|
tableInfo->targetTable);
|
||||||
|
if (result != 0) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No CSP fixed port was selected. Send data to the specified port and
|
/* No CSP fixed port was selected. Send data to the specified port and
|
||||||
|
@ -96,7 +96,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
|
|||||||
PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15,
|
PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15,
|
||||||
45);
|
45);
|
||||||
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW,
|
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW,
|
||||||
pus::PUS_SERVICE_8, 3, 60);
|
pus::PUS_SERVICE_8, 16, 60);
|
||||||
new Service9TimeManagement(
|
new Service9TimeManagement(
|
||||||
PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9));
|
PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9));
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include "CspCookie.h"
|
#include "CspCookie.h"
|
||||||
|
|
||||||
|
using namespace GOMSPACE;
|
||||||
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
|
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
|
||||||
: maxReplyLength(maxReplyLength_),
|
: maxReplyLength(maxReplyLength_),
|
||||||
cspAddress(cspAddress_),
|
cspAddress(cspAddress_),
|
||||||
timeoutMs(timeoutMs),
|
timeoutMs(timeoutMs),
|
||||||
reqType(GOMSPACE::DEFAULT_COM_IF) {}
|
reqType(SpecialRequestTypes::DEFAULT_COM_IF) {}
|
||||||
|
|
||||||
CspCookie::~CspCookie() {}
|
CspCookie::~CspCookie() {}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class CspCookie : public CookieIF {
|
|||||||
uint32_t getTimeout() const;
|
uint32_t getTimeout() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t cspPort;
|
uint8_t cspPort = 0;
|
||||||
uint16_t maxReplyLength;
|
uint16_t maxReplyLength;
|
||||||
uint8_t cspAddress;
|
uint8_t cspAddress;
|
||||||
size_t replyLen = 0;
|
size_t replyLen = 0;
|
||||||
|
@ -44,6 +44,8 @@ ReturnValue_t GomspaceDeviceHandler::buildTransitionDeviceCommand(DeviceCommandI
|
|||||||
ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t* commandData,
|
const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
|
auto* cspCookie = dynamic_cast<CspCookie*>(comCookie);
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::DEFAULT_COM_IF, 0);
|
||||||
ReturnValue_t result = childCommandHook(deviceCommand, commandData, commandDataLen);
|
ReturnValue_t result = childCommandHook(deviceCommand, commandData, commandDataLen);
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (GOMSPACE::PING): {
|
case (GOMSPACE::PING): {
|
||||||
@ -84,37 +86,87 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GOMSPACE::REQUEST_HK_TABLE): {
|
case (GOMSPACE::REQUEST_HK_TABLE): {
|
||||||
auto reqType = SpecialRequestTypes::DEFAULT_COM_IF;
|
DeviceType devType;
|
||||||
if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
if(getDevType(devType) != returnvalue::OK) {
|
||||||
reqType = SpecialRequestTypes::GET_PDU_HK;
|
return returnvalue::FAILED;
|
||||||
} else if (getObjectId() == objects::ACU_HANDLER) {
|
|
||||||
reqType = SpecialRequestTypes::GET_ACU_HK;
|
|
||||||
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
|
|
||||||
reqType = SpecialRequestTypes::GET_P60DOCK_HK;
|
|
||||||
}
|
}
|
||||||
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize,
|
result =
|
||||||
deviceCommand);
|
generateRequestFullHkTableCmd(devType, tableCfg.hkTableSize, deviceCommand, cspCookie);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
|
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
|
||||||
auto reqType = SpecialRequestTypes::DEFAULT_COM_IF;
|
DeviceType devType;
|
||||||
if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
if(getDevType(devType) != returnvalue::OK) {
|
||||||
reqType = SpecialRequestTypes::GET_PDU_CONFIG;
|
return returnvalue::FAILED;
|
||||||
} else if (getObjectId() == objects::ACU_HANDLER) {
|
|
||||||
reqType = SpecialRequestTypes::GET_ACU_CONFIG;
|
|
||||||
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
|
|
||||||
reqType = SpecialRequestTypes::GET_P60DOCK_CONFIG;
|
|
||||||
}
|
}
|
||||||
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG,
|
result = generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize,
|
||||||
tableCfg.cfgTableSize, deviceCommand);
|
deviceCommand, cspCookie);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case (GOMSPACE::LOAD_TABLE): {
|
||||||
|
if (commandDataLen != 2) {
|
||||||
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
|
}
|
||||||
|
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(cspPacket);
|
||||||
|
info->sourceTable = commandData[0];
|
||||||
|
info->targetTable = commandData[1];
|
||||||
|
rawPacket = cspPacket;
|
||||||
|
rawPacketLen = sizeof(GOMSPACE::TableInfo);
|
||||||
|
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::LOAD_TABLE, 0);
|
||||||
|
rememberCommandId = deviceCommand;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (GOMSPACE::SAVE_TABLE_FILE): {
|
||||||
|
if (commandDataLen > 2) {
|
||||||
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
|
}
|
||||||
|
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(cspPacket);
|
||||||
|
if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and
|
||||||
|
commandData[0] != 4) {
|
||||||
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
|
}
|
||||||
|
info->sourceTable = commandData[0];
|
||||||
|
if (info->sourceTable != 4) {
|
||||||
|
if (commandDataLen == 2) {
|
||||||
|
info->targetTable = commandData[1];
|
||||||
|
} else {
|
||||||
|
info->targetTable = info->sourceTable;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Will be ignored, still set the value which is always used
|
||||||
|
info->targetTable = 4;
|
||||||
|
}
|
||||||
|
rawPacket = cspPacket;
|
||||||
|
rawPacketLen = sizeof(GOMSPACE::TableInfo);
|
||||||
|
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0);
|
||||||
|
rememberCommandId = deviceCommand;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (GOMSPACE::SAVE_TABLE_DEFAULT): {
|
||||||
|
if (commandDataLen != 1) {
|
||||||
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
|
}
|
||||||
|
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(cspPacket);
|
||||||
|
if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) {
|
||||||
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
|
}
|
||||||
|
info->sourceTable = commandData[0];
|
||||||
|
info->targetTable = info->sourceTable + 4;
|
||||||
|
rawPacket = cspPacket;
|
||||||
|
rawPacketLen = sizeof(GOMSPACE::TableInfo);
|
||||||
|
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0);
|
||||||
|
rememberCommandId = deviceCommand;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
@ -131,6 +183,9 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap() {
|
|||||||
this->insertInCommandMap(GOMSPACE::GNDWDT_RESET);
|
this->insertInCommandMap(GOMSPACE::GNDWDT_RESET);
|
||||||
this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I);
|
this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I);
|
||||||
this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS);
|
this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS);
|
||||||
|
insertInCommandMap(GOMSPACE::SAVE_TABLE_FILE);
|
||||||
|
insertInCommandMap(GOMSPACE::SAVE_TABLE_DEFAULT);
|
||||||
|
insertInCommandMap(GOMSPACE::LOAD_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
@ -443,6 +498,19 @@ bool GomspaceDeviceHandler::validTableId(uint8_t id) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GomspaceDeviceHandler::getDevType(GOMSPACE::DeviceType& type) const {
|
||||||
|
if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
||||||
|
type = DeviceType::PDU;
|
||||||
|
} else if (getObjectId() == objects::ACU_HANDLER) {
|
||||||
|
type = DeviceType::ACU;
|
||||||
|
} else if (getObjectId() == objects::P60DOCK_HANDLER) {
|
||||||
|
type = DeviceType::P60DOCK;
|
||||||
|
} else {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
return returnvalue::OK;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
||||||
WatchdogResetCommand watchdogResetCommand;
|
WatchdogResetCommand watchdogResetCommand;
|
||||||
size_t cspPacketLen = 0;
|
size_t cspPacketLen = 0;
|
||||||
@ -462,19 +530,40 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType,
|
ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(DeviceType dev,
|
||||||
uint8_t tableId,
|
|
||||||
uint16_t tableReplySize,
|
uint16_t tableReplySize,
|
||||||
DeviceCommandId_t id) {
|
DeviceCommandId_t id,
|
||||||
uint16_t querySize = tableReplySize;
|
CspCookie* cspCookie) {
|
||||||
if (reqType == SpecialRequestTypes::DEFAULT_COM_IF) {
|
if (dev == DeviceType::ACU) {
|
||||||
sif::warning << "Default communication for table requests not implemented anymore" << std::endl;
|
cspCookie->setRequest(SpecialRequestTypes::GET_ACU_HK, tableReplySize);
|
||||||
return returnvalue::FAILED;
|
} else if (dev == DeviceType::P60DOCK) {
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_HK, tableReplySize);
|
||||||
|
} else if (dev == DeviceType::PDU) {
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::GET_PDU_HK, tableReplySize);
|
||||||
}
|
}
|
||||||
auto* cspCookie = dynamic_cast<CspCookie*>(comCookie);
|
|
||||||
cspCookie->setRequest(reqType, tableReplySize);
|
|
||||||
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||||
rememberRequestedSize = querySize;
|
rememberRequestedSize = tableReplySize;
|
||||||
|
rememberCommandId = id;
|
||||||
|
return returnvalue::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GomspaceDeviceHandler::generateRequestFullCfgTableCmd(DeviceType dev,
|
||||||
|
uint16_t tableReplySize,
|
||||||
|
DeviceCommandId_t id,
|
||||||
|
CspCookie* cspCookie) {
|
||||||
|
if (dev == DeviceType::ACU) {
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::GET_ACU_CONFIG, tableReplySize);
|
||||||
|
} else if (dev == DeviceType::P60DOCK) {
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_CONFIG, tableReplySize);
|
||||||
|
} else if (dev == DeviceType::PDU) {
|
||||||
|
cspCookie->setRequest(SpecialRequestTypes::GET_PDU_CONFIG, tableReplySize);
|
||||||
|
}
|
||||||
|
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||||
|
// Unfortunately, this does not work..
|
||||||
|
// cspPacket[0] = defaultTable;
|
||||||
|
// rawPacket = cspPacket;
|
||||||
|
// rawPacketLen = 1;
|
||||||
|
rememberRequestedSize = tableReplySize;
|
||||||
rememberCommandId = id;
|
rememberCommandId = id;
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -82,10 +82,21 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
|
|||||||
* @brief The command to generate a request to receive the full housekeeping table is device
|
* @brief The command to generate a request to receive the full housekeeping table is device
|
||||||
* specific. Thus the child has to build this command.
|
* specific. Thus the child has to build this command.
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType,
|
ReturnValue_t generateRequestFullHkTableCmd(GOMSPACE::DeviceType devType, uint16_t tableSize,
|
||||||
uint8_t tableId, uint16_t tableSize,
|
DeviceCommandId_t id, CspCookie *cspCookie);
|
||||||
DeviceCommandId_t id);
|
/**
|
||||||
|
* Unfortunately, it was not possible to specify the table ID (e.g. request table from
|
||||||
|
* default store)
|
||||||
|
* @param devType
|
||||||
|
* @param tableSize
|
||||||
|
* @param id
|
||||||
|
* @param cspCookie
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
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
|
* This command handles printing the HK table to the console. This is useful for debugging
|
||||||
* purposes
|
* purposes
|
||||||
|
@ -15,13 +15,12 @@ using std::ofstream;
|
|||||||
using namespace returnvalue;
|
using namespace returnvalue;
|
||||||
|
|
||||||
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie,
|
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie,
|
||||||
SdCardMountedIF* sdcMan)
|
SdCardMountedIF& sdcMan)
|
||||||
: DeviceHandlerBase(objectId, reader.getObjectId(), cookie), sdcMan(sdcMan), reader(reader) {}
|
: DeviceHandlerBase(objectId, reader.getObjectId(), cookie), sdcMan(sdcMan), reader(reader) {}
|
||||||
|
|
||||||
ScexDeviceHandler::~ScexDeviceHandler() {}
|
ScexDeviceHandler::~ScexDeviceHandler() {}
|
||||||
|
|
||||||
void ScexDeviceHandler::doStartUp() {
|
void ScexDeviceHandler::doStartUp() {
|
||||||
// mode on
|
|
||||||
setMode(MODE_ON);
|
setMode(MODE_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,9 +195,11 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
ReturnValue_t status = OK;
|
ReturnValue_t status = OK;
|
||||||
auto oneFileHandler = [&](std::string cmdName) {
|
auto oneFileHandler = [&](std::string cmdName) {
|
||||||
fileId = date_time_string();
|
fileId = date_time_string();
|
||||||
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
|
std::ostringstream oss;
|
||||||
oss << cmdName << fileId << ".bin";
|
auto prefix = sdcMan.getCurrentMountPrefix();
|
||||||
|
oss << prefix << "/scex-" << cmdName << fileId << ".bin";
|
||||||
fileName = oss.str();
|
fileName = oss.str();
|
||||||
|
sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName << std::endl;
|
||||||
ofstream out(fileName, ofstream::binary);
|
ofstream out(fileName, ofstream::binary);
|
||||||
if (out.bad()) {
|
if (out.bad()) {
|
||||||
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
||||||
@ -211,9 +212,12 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
auto multiFileHandler = [&](std::string cmdName) {
|
auto multiFileHandler = [&](std::string cmdName) {
|
||||||
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
||||||
fileId = date_time_string();
|
fileId = date_time_string();
|
||||||
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
|
std::ostringstream oss;
|
||||||
oss << cmdName << fileId << ".bin";
|
auto prefix = sdcMan.getCurrentMountPrefix();
|
||||||
|
oss << prefix << "/scex-" << cmdName << fileId << ".bin";
|
||||||
fileName = oss.str();
|
fileName = oss.str();
|
||||||
|
sif::info << "ScexDeviceHandler::interpretDeviceReply: FileName: " << fileName
|
||||||
|
<< std::endl; // TODO remove
|
||||||
fileNameSet = true;
|
fileNameSet = true;
|
||||||
ofstream out(fileName, ofstream::binary);
|
ofstream out(fileName, ofstream::binary);
|
||||||
if (out.bad()) {
|
if (out.bad()) {
|
||||||
@ -301,6 +305,10 @@ 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) {
|
ReturnValue_t ScexDeviceHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
||||||
|
if(switchId) {
|
||||||
|
*numberOfSwitches = 1;
|
||||||
|
*switches = &switchId.value();
|
||||||
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,26 +322,23 @@ std::string ScexDeviceHandler::date_time_string() {
|
|||||||
string date_time;
|
string date_time;
|
||||||
Clock::TimeOfDay_t tod;
|
Clock::TimeOfDay_t tod;
|
||||||
Clock::getDateAndTime(&tod);
|
Clock::getDateAndTime(&tod);
|
||||||
time_t now = time(0);
|
|
||||||
tm* ltm = localtime(&now);
|
|
||||||
ostringstream oss(std::ostringstream::ate);
|
ostringstream oss(std::ostringstream::ate);
|
||||||
|
|
||||||
//TODO mit tod ersetzen
|
if (tod.hour < 10) {
|
||||||
if (ltm->tm_hour < 10) {
|
oss << tod.year << tod.month << tod.day << "_0" << tod.hour;
|
||||||
oss << tod.year << tod.month << ltm->tm_mday << "_0" << ltm->tm_hour;
|
|
||||||
} else {
|
} else {
|
||||||
oss << 1900 + ltm->tm_year << 1 + ltm->tm_mon << ltm->tm_mday << "_" << ltm->tm_hour;
|
oss << tod.year << tod.month << tod.day << "_" << tod.hour;
|
||||||
}
|
}
|
||||||
if (ltm->tm_min < 10) {
|
if (tod.minute < 10) {
|
||||||
oss << 0 << ltm->tm_min;
|
oss << 0 << tod.minute;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
oss << ltm->tm_min;
|
oss << tod.minute;
|
||||||
}
|
}
|
||||||
if (ltm->tm_sec < 10) {
|
if (tod.second < 10) {
|
||||||
oss << 0 << ltm->tm_sec;
|
oss << 0 << tod.second;
|
||||||
} else {
|
} else {
|
||||||
oss << ltm->tm_sec;
|
oss << tod.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
date_time = oss.str();
|
date_time = oss.str();
|
||||||
@ -342,3 +347,9 @@ std::string ScexDeviceHandler::date_time_string() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScexDeviceHandler::modeChanged() {}
|
void ScexDeviceHandler::modeChanged() {}
|
||||||
|
|
||||||
|
void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId)
|
||||||
|
{
|
||||||
|
DeviceHandlerBase::setPowerSwitcher(&powerSwitcher);
|
||||||
|
this->switchId = switchId;
|
||||||
|
}
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
#ifndef MISSION_DEVICES_SCEXDEVICEHANDLER_H_
|
#ifndef MISSION_DEVICES_SCEXDEVICEHANDLER_H_
|
||||||
#define MISSION_DEVICES_SCEXDEVICEHANDLER_H_
|
#define MISSION_DEVICES_SCEXDEVICEHANDLER_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
#include <linux/devices/ScexHelper.h>
|
#include <linux/devices/ScexHelper.h>
|
||||||
#include <linux/devices/ScexUartReader.h>
|
#include <linux/devices/ScexUartReader.h>
|
||||||
|
|
||||||
#include "commonSubsystemIds.h"
|
#include "commonSubsystemIds.h"
|
||||||
|
|
||||||
|
|
||||||
class SdCardMountedIF;
|
class SdCardMountedIF;
|
||||||
|
|
||||||
class ScexDeviceHandler : public DeviceHandlerBase {
|
class ScexDeviceHandler : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie,
|
ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie,
|
||||||
SdCardMountedIF *sdcMan);
|
SdCardMountedIF &sdcMan);
|
||||||
|
void setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId);
|
||||||
virtual ~ScexDeviceHandler();
|
virtual ~ScexDeviceHandler();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -20,6 +23,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
|
|||||||
static constexpr uint32_t SHORT_CD = 7000;
|
static constexpr uint32_t SHORT_CD = 7000;
|
||||||
std::array<uint8_t, 64> cmdBuf = {};
|
std::array<uint8_t, 64> cmdBuf = {};
|
||||||
|
|
||||||
|
std::optional<power::Switch_t> switchId;
|
||||||
std::string fileId = "";
|
std::string fileId = "";
|
||||||
std::string fileName = "";
|
std::string fileName = "";
|
||||||
bool fileNameSet = false;
|
bool fileNameSet = false;
|
||||||
@ -27,7 +31,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
|
|||||||
bool debugMode = false;
|
bool debugMode = false;
|
||||||
|
|
||||||
scex::Cmds currCmd = scex::Cmds::PING;
|
scex::Cmds currCmd = scex::Cmds::PING;
|
||||||
SdCardMountedIF *sdcMan = nullptr;
|
SdCardMountedIF &sdcMan;
|
||||||
Countdown finishCountdown = Countdown(LONG_CD);
|
Countdown finishCountdown = Countdown(LONG_CD);
|
||||||
|
|
||||||
std::string date_time_string();
|
std::string date_time_string();
|
||||||
|
@ -18,14 +18,23 @@
|
|||||||
|
|
||||||
namespace GOMSPACE {
|
namespace GOMSPACE {
|
||||||
|
|
||||||
enum SpecialRequestTypes {
|
struct TableInfo {
|
||||||
|
uint8_t sourceTable;
|
||||||
|
uint8_t targetTable;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DeviceType { PDU, ACU, P60DOCK };
|
||||||
|
|
||||||
|
enum class SpecialRequestTypes {
|
||||||
DEFAULT_COM_IF,
|
DEFAULT_COM_IF,
|
||||||
GET_PDU_HK,
|
GET_PDU_HK,
|
||||||
GET_PDU_CONFIG,
|
GET_PDU_CONFIG,
|
||||||
GET_ACU_HK,
|
GET_ACU_HK,
|
||||||
GET_ACU_CONFIG,
|
GET_ACU_CONFIG,
|
||||||
GET_P60DOCK_HK,
|
GET_P60DOCK_HK,
|
||||||
GET_P60DOCK_CONFIG
|
GET_P60DOCK_CONFIG,
|
||||||
|
SAVE_TABLE,
|
||||||
|
LOAD_TABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CspPorts : uint8_t {
|
enum CspPorts : uint8_t {
|
||||||
@ -53,14 +62,18 @@ static const uint8_t P60_PORT_GNDWDT_RESET = 9;
|
|||||||
* Device commands are derived from the rparam.h of the gomspace lib..
|
* Device commands are derived from the rparam.h of the gomspace lib..
|
||||||
* IDs above 50 are reserved for device specific commands.
|
* IDs above 50 are reserved for device specific commands.
|
||||||
*/
|
*/
|
||||||
|
static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND]
|
||||||
static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND]
|
static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND]
|
||||||
static const DeviceCommandId_t NONE = 2; // Set when no command is pending
|
static const DeviceCommandId_t NONE = 2; // Set when no command is pending
|
||||||
static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND]
|
static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND]
|
||||||
static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND]
|
static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND]
|
||||||
static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND]
|
|
||||||
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
|
|
||||||
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
|
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
|
||||||
static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND]
|
static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND]
|
||||||
|
static const DeviceCommandId_t SAVE_TABLE_FILE = 18;
|
||||||
|
static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19;
|
||||||
|
static const DeviceCommandId_t LOAD_TABLE = 20;
|
||||||
|
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
|
||||||
|
|
||||||
// Not implemented yet
|
// Not implemented yet
|
||||||
// static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND]
|
// static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND]
|
||||||
//! [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console
|
//! [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#ifndef MISSION_MEMORY_SDCARDMOUNTERIF_H_
|
#ifndef MISSION_MEMORY_SDCARDMOUNTERIF_H_
|
||||||
#define MISSION_MEMORY_SDCARDMOUNTERIF_H_
|
#define MISSION_MEMORY_SDCARDMOUNTERIF_H_
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
|
|
||||||
class SdCardMountedIF {
|
class SdCardMountedIF {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
#ifndef MISSION_UTILITY_INITMISSION_H_
|
#pragma once
|
||||||
#define MISSION_UTILITY_INITMISSION_H_
|
|
||||||
|
|
||||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
namespace initmission {
|
namespace initmission {
|
||||||
|
|
||||||
void printAddObjectError(const char* name, object_id_t objectId) {
|
static void printAddObjectError(const char* name, object_id_t objectId) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "InitMission::printAddError: Adding object " << name << " with object ID 0x"
|
sif::error << "InitMission::printAddError: Adding object " << name << " with object ID 0x"
|
||||||
<< std::hex << std::setfill('0') << std::setw(8) << objectId << " failed!" << std::dec
|
<< std::hex << std::setfill('0') << std::setw(8) << objectId << " failed!" << std::dec
|
||||||
@ -18,5 +17,3 @@ void printAddObjectError(const char* name, object_id_t objectId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace initmission
|
} // namespace initmission
|
||||||
|
|
||||||
#endif /* MISSION_UTILITY_INITMISSION_H_ */
|
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit e1d84c5b99e99ea9a9687dcd298d815dc4d8d2b6
|
Subproject commit a7714747bc45dfa6a9ccb41cc6eb890b21ca0481
|
Loading…
Reference in New Issue
Block a user