bugfix for scex testcode
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:
parent
a1cc5b0ca7
commit
308a855d8c
@ -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
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr
|
||||
|
||||
auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER);
|
||||
auto scexHandler = new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, mountedIF);
|
||||
if(onImmediately) {
|
||||
if (onImmediately) {
|
||||
scexHandler->setStartUpImmediately();
|
||||
}
|
||||
if (switchId) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -166,8 +166,8 @@ 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<const TableInfo*>(sendData);
|
||||
@ -176,8 +176,8 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
||||
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<const TableInfo*>(sendData);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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,7 +303,7 @@ 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) {
|
||||
if (switchId) {
|
||||
*numberOfSwitches = 1;
|
||||
*switches = &switchId.value();
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user