Fixes and Updates for EM build #468

Merged
meggert merged 11 commits from bugfixes_em_build into develop 2023-03-14 13:35:07 +01:00
16 changed files with 191 additions and 42 deletions
Showing only changes of commit 192c7c6f31 - Show all commits

View File

@ -613,7 +613,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit
std::stringstream consumer;
auto* camSwitcher =
new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, pcdu::PDU2_CH8_PAYLOAD_CAMERA);
camSwitcher->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
camSwitcher->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
#if OBSW_ADD_PLOC_MPSOC == 1
consumer << "0x" << std::hex << objects::PLOC_MPSOC_HANDLER;
auto gpioConfigMPSoC = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_MPSOC_UART,
@ -629,7 +629,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit
auto* mpsocHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, plocMpsocHelper,
Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER);
mpsocHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
mpsocHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER;
@ -646,7 +646,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit
auto* supvHandler = new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, supervisorCookie,
Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
pcdu::PDU1_CH6_PLOC_12V, *supvHelper);
supvHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
supvHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
static_cast<void>(consumer);
}
@ -901,7 +901,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
plPcduHandler->setToGoToNormalModeImmediately(true);
plPcduHandler->enablePeriodicPrintout(true, 10);
#endif
plPcduHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
plPcduHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
}
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {

View File

@ -1,4 +1,6 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <dummies/ComCookieDummy.h>
#include <dummies/PcduHandlerDummy.h>
#include <fsfw/health/HealthTableIF.h>
#include <fsfw/power/DummyPowerSwitcher.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
@ -56,7 +58,8 @@ void ObjectFactory::produce(void* args) {
PowerSwitchIF* pwrSwitcher = nullptr;
#if OBSW_ADD_GOMSPACE_PCDU == 0
pwrSwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
auto* comCookieDummy = new ComCookieDummy();
pwrSwitcher = new PcduHandlerDummy(objects::PCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
#else
createPcduComponents(gpioComIF, &pwrSwitcher);
#endif

View File

@ -7,6 +7,7 @@ target_sources(
ComCookieDummy.cpp
RwDummy.cpp
Max31865Dummy.cpp
PcduHandlerDummy.cpp
StarTrackerDummy.cpp
SyrlinksDummy.cpp
ImtqDummy.cpp

View File

@ -0,0 +1,62 @@
#include "PcduHandlerDummy.h"
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
PcduHandlerDummy::PcduHandlerDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie), dummySwitcher(objectId, 18, 18, false) {}
PcduHandlerDummy::~PcduHandlerDummy() {}
void PcduHandlerDummy::doStartUp() { setMode(MODE_NORMAL); }
void PcduHandlerDummy::doShutDown() { setMode(MODE_OFF); }
ReturnValue_t PcduHandlerDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PcduHandlerDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PcduHandlerDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return returnvalue::OK;
}
ReturnValue_t PcduHandlerDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return returnvalue::OK;
}
ReturnValue_t PcduHandlerDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return returnvalue::OK;
}
void PcduHandlerDummy::fillCommandAndReplyMap() {}
uint32_t PcduHandlerDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t PcduHandlerDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return returnvalue::OK;
}
ReturnValue_t PcduHandlerDummy::sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) {
return dummySwitcher.sendSwitchCommand(switchNr, onOff);
}
ReturnValue_t PcduHandlerDummy::sendFuseOnCommand(uint8_t fuseNr) {
return dummySwitcher.sendFuseOnCommand(fuseNr);
}
ReturnValue_t PcduHandlerDummy::getSwitchState(power::Switch_t switchNr) const {
return dummySwitcher.getSwitchState(switchNr);
}
ReturnValue_t PcduHandlerDummy::getFuseState(uint8_t fuseNr) const {
return dummySwitcher.getFuseState(fuseNr);
}
uint32_t PcduHandlerDummy::getSwitchDelayMs(void) const { return dummySwitcher.getSwitchDelayMs(); }

View File

@ -0,0 +1,39 @@
#pragma once
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/power/DummyPowerSwitcher.h>
class PcduHandlerDummy : public DeviceHandlerBase, public PowerSwitchIF {
public:
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
static const DeviceCommandId_t PERIODIC_REPLY = 2;
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
PcduHandlerDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
virtual ~PcduHandlerDummy();
protected:
DummyPowerSwitcher dummySwitcher;
void doStartUp() override;
void doShutDown() 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,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
ReturnValue_t sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) override;
ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override;
ReturnValue_t getSwitchState(power::Switch_t switchNr) const override;
ReturnValue_t getFuseState(uint8_t fuseNr) const override;
uint32_t getSwitchDelayMs(void) const override;
};

View File

@ -210,18 +210,18 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
}
}
auto* camSwitcher = new CamSwitcher(objects::CAM_SWITCHER, pwrSwitcher, power::NO_SWITCH);
camSwitcher->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
camSwitcher->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy);
scexDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
scexDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
auto* plPcduDummy =
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
plPcduDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
plPcduDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
if (cfg.addPlocDummies) {
auto* plocMpsocDummy =
new PlocMpsocDummy(objects::PLOC_MPSOC_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
plocMpsocDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
plocMpsocDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
auto* plocSupervisorDummy = new PlocSupervisorDummy(objects::PLOC_SUPERVISOR_HANDLER,
objects::DUMMY_COM_IF, comCookieDummy);
plocSupervisorDummy->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
plocSupervisorDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
}
}

View File

@ -325,7 +325,7 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr
if (switchId) {
scexHandler->setPowerSwitcher(*pwrSwitcher, switchId.value());
}
scexHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM);
scexHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
}
AcsController* ObjectFactory::createAcsController(bool connectSubsystem) {

View File

@ -9,4 +9,5 @@ add_subdirectory(csp)
add_subdirectory(cfdp)
add_subdirectory(config)
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp trace.cpp)
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp payloadDefs.cpp
trace.cpp)

32
mission/payloadDefs.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "payloadDefs.h"
const char* payload::getModeStr(Mode mode) {
static const char* modeStr = "UNKNOWN";
switch (mode) {
case (Mode::CAM_STREAM): {
modeStr = "CAM STREAM";
break;
}
case (Mode::EARTH_OBSV): {
modeStr = "EARTH OBSV";
break;
}
case (Mode::MPSOC_STREAM): {
modeStr = "MPSOC STREAM";
break;
}
case (Mode::OFF): {
modeStr = "OFF";
break;
}
case (Mode::SUPV_ONLY): {
modeStr = "SUPV ONLY";
break;
}
case (Mode::SCEX): {
modeStr = "SCEX";
break;
}
}
return modeStr;
}

24
mission/payloadDefs.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
#include <cstdint>
namespace payload {
enum Mode {
OFF = 0,
SUPV_ONLY = 10,
MPSOC_STREAM = 11,
CAM_STREAM = 12,
EARTH_OBSV = 13,
SCEX = 14
};
extern const char* getModeStr(Mode mode);
namespace ploc {
enum Modes { OFF = 0, SUPV_ONLY = 1, MPSOC_ON = 2 };
}
} // namespace payload

View File

@ -1,5 +1,13 @@
#include "PayloadSubsystem.h"
#include "mission/payloadDefs.h"
PayloadSubsystem::PayloadSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
uint32_t maxNumberOfTables)
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) {}
void PayloadSubsystem::announceMode(bool recursive) {
const char* modeStr = payload::getModeStr(static_cast<payload::Mode>(mode));
sif::info << "PAYLOAD subsystem is now in " << modeStr << " mode" << std::endl;
Subsystem::announceMode(recursive);
}

View File

@ -9,6 +9,7 @@ class PayloadSubsystem : public Subsystem {
uint32_t maxNumberOfTables);
private:
void announceMode(bool recursive) override;
};
#endif /* MISSION_SYSTEM_PAYLOADSUBSYSTEM_H_ */

View File

@ -1,5 +1,4 @@
#ifndef MISSION_SYSTEM_DEFINITIONS_H_
#define MISSION_SYSTEM_DEFINITIONS_H_
#pragma once
#include <fsfw/modes/ModeMessage.h>
@ -15,24 +14,3 @@ namespace duallane {
enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 };
} // namespace duallane
namespace payload {
enum Mode {
OFF = 0,
SUPV_ONLY = 10,
MPSOC_STREAM = 11,
CAM_STREAM = 12,
EARTH_OBSV = 13,
SCEX = 14
};
namespace ploc {
enum Modes { OFF = 0, SUPV_ONLY = 1, MPSOC_ON = 2 };
}
} // namespace payload
#endif /* MISSION_SYSTEM_DEFINITIONS_H_ */

View File

@ -7,6 +7,7 @@
#include "eive/objects.h"
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/payloadDefs.h"
#include "mission/system/objects/PayloadSubsystem.h"
#include "mission/system/objects/definitions.h"
#include "util.h"
@ -20,7 +21,7 @@ void initEarthObsvSequence(Subsystem& ss, ModeListEntry& eh);
void initScexSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
PayloadSubsystem satsystem::pl::SUBSYSTEM = PayloadSubsystem(objects::PL_SUBSYSTEM, 12, 24);
PayloadSubsystem satsystem::payload::SUBSYSTEM = PayloadSubsystem(objects::PL_SUBSYSTEM, 12, 24);
const auto check = subsystem::checkInsert;
static const auto OFF = HasModesIF::MODE_OFF;
@ -77,7 +78,7 @@ auto PL_TABLE_SCEX_TGT =
auto PL_TABLE_SCEX_TRANS_0 =
std::make_pair((payload::Mode::SCEX << 24) | 2, FixedArrayList<ModeListEntry, 1>());
Subsystem& satsystem::pl::init() {
Subsystem& satsystem::payload::init() {
ModeListEntry entry;
initOffSequence(SUBSYSTEM, entry);
initPlMpsocStreamSequence(SUBSYSTEM, entry);

View File

@ -5,12 +5,12 @@
namespace satsystem {
namespace pl {
namespace payload {
extern PayloadSubsystem SUBSYSTEM;
Subsystem& init();
} // namespace pl
} // namespace payload
} // namespace satsystem

View File

@ -26,7 +26,7 @@ static const auto NML = DeviceHandlerIF::MODE_NORMAL;
void satsystem::init() {
auto& acsSubsystem = acs::init();
acsSubsystem.connectModeTreeParent(EIVE_SYSTEM);
auto& payloadSubsystem = pl::init();
auto& payloadSubsystem = payload::init();
payloadSubsystem.connectModeTreeParent(EIVE_SYSTEM);
auto& tcsSubsystem = tcs::init();
tcsSubsystem.connectModeTreeParent(EIVE_SYSTEM);
@ -87,8 +87,7 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) {
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TGT.second);
check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TGT.first, &EIVE_TABLE_SAFE_TGT.second)), ctxc);
// Build SAFE transition 0. Two transitions to reduce number of consecutive events and because
// consecutive commanding of TCS and ACS can lead to SPI issues.
// Build SAFE transition 0.
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_SAFE_TRANS_0.second);
iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_SAFE_TRANS_0.second);
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TRANS_0.second);