bugfix for scex testcode
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Irini Kosmidou 2022-09-27 18:54:48 +02:00
parent a1cc5b0ca7
commit 308a855d8c
16 changed files with 56 additions and 55 deletions

View File

@ -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

View File

@ -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";

View File

@ -249,7 +249,6 @@ void initmission::initTasks() {
scheduling::schedulingScex(*factory, scexDevHandler, scexReaderTask);
#endif
std::vector<PeriodicTaskIF*> pusTasks;
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
std::vector<PeriodicTaskIF*> pstTasks;

View File

@ -1,5 +1,7 @@
#include "ObjectFactory.h"
#include <linux/devices/ScexUartReader.h>
#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
}

View File

@ -1,4 +1,5 @@
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"

View File

@ -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

View File

@ -2,5 +2,6 @@
#include <fsfw/tasks/TaskFactory.h>
namespace scheduling {
void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, PeriodicTaskIF*& scexReaderTask);
void schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler,
PeriodicTaskIF*& scexReaderTask);
}

View File

@ -5,8 +5,8 @@
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include <mission/memory/SdCardMountedIF.h>
#include <string>
#include <optional>
#include <string>
class GpioIF;
class SpiComIF;

View File

@ -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<uint8_t, 4096>;
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 (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";
#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;
}

View File

@ -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;

View File

@ -102,8 +102,8 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
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;
}

View File

@ -93,9 +93,8 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
* @param cspCookie
* @return
*/
ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType,
uint16_t tableSize, DeviceCommandId_t id,
CspCookie *cspCookie);
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

View File

@ -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); }
@ -348,8 +346,7 @@ std::string ScexDeviceHandler::date_time_string() {
void ScexDeviceHandler::modeChanged() {}
void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId)
{
void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) {
DeviceHandlerBase::setPowerSwitcher(&powerSwitcher);
this->switchId = switchId;
}

View File

@ -1,13 +1,13 @@
#ifndef MISSION_DEVICES_SCEXDEVICEHANDLER_H_
#define MISSION_DEVICES_SCEXDEVICEHANDLER_H_
#include <optional>
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <linux/devices/ScexHelper.h>
#include <linux/devices/ScexUartReader.h>
#include "commonSubsystemIds.h"
#include <optional>
#include "commonSubsystemIds.h"
class SdCardMountedIF;