|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
#include "ObjectFactory.h"
|
|
|
|
|
|
|
|
|
|
#include <fsfw/power/PowerSwitchIF.h>
|
|
|
|
|
#include <fsfw/subsystem/Subsystem.h>
|
|
|
|
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
|
|
|
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
|
|
|
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
|
|
|
@ -15,10 +16,11 @@
|
|
|
|
|
#include <mission/devices/Max31865PT1000Handler.h>
|
|
|
|
|
#include <mission/devices/ScexDeviceHandler.h>
|
|
|
|
|
#include <mission/devices/SusHandler.h>
|
|
|
|
|
#include <mission/system/SusAssembly.h>
|
|
|
|
|
#include <mission/system/TcsBoardAssembly.h>
|
|
|
|
|
#include <mission/system/fdir/RtdFdir.h>
|
|
|
|
|
#include <mission/system/fdir/SusFdir.h>
|
|
|
|
|
#include <mission/system/objects/SusAssembly.h>
|
|
|
|
|
#include <mission/system/objects/TcsBoardAssembly.h>
|
|
|
|
|
#include "mission/system/tree/acsModeTree.h"
|
|
|
|
|
|
|
|
|
|
#include "OBSWConfig.h"
|
|
|
|
|
#include "devConf.h"
|
|
|
|
@ -26,6 +28,7 @@
|
|
|
|
|
#include "devices/gpioIds.h"
|
|
|
|
|
#include "eive/definitions.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF,
|
|
|
|
|
PowerSwitchIF* pwrSwitcher, std::string spiDev) {
|
|
|
|
|
using namespace gpio;
|
|
|
|
@ -79,7 +82,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[0] =
|
|
|
|
|
new SusHandler(objects::SUS_0_N_LOC_XFYFZM_PT_XF, 0, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
|
|
|
|
susHandlers[0]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[0]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -87,7 +89,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[1] =
|
|
|
|
|
new SusHandler(objects::SUS_1_N_LOC_XBYFZM_PT_XB, 1, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_1_N_LOC_XBYFZM_PT_XB);
|
|
|
|
|
susHandlers[1]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[1]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -95,7 +96,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[2] =
|
|
|
|
|
new SusHandler(objects::SUS_2_N_LOC_XFYBZB_PT_YB, 2, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_2_N_LOC_XFYBZB_PT_YB);
|
|
|
|
|
susHandlers[2]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[2]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -103,7 +103,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[3] =
|
|
|
|
|
new SusHandler(objects::SUS_3_N_LOC_XFYBZF_PT_YF, 3, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_3_N_LOC_XFYBZF_PT_YF);
|
|
|
|
|
susHandlers[3]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[3]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -111,7 +110,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[4] =
|
|
|
|
|
new SusHandler(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, 4, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_4_N_LOC_XMYFZF_PT_ZF);
|
|
|
|
|
susHandlers[4]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[4]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -119,7 +117,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[5] =
|
|
|
|
|
new SusHandler(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, 5, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
|
|
|
|
|
susHandlers[5]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[5]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -127,7 +124,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[6] =
|
|
|
|
|
new SusHandler(objects::SUS_6_R_LOC_XFYBZM_PT_XF, 6, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
|
|
|
|
|
susHandlers[6]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[6]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -135,7 +131,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[7] =
|
|
|
|
|
new SusHandler(objects::SUS_7_R_LOC_XBYBZM_PT_XB, 7, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_7_R_LOC_XBYBZM_PT_XB);
|
|
|
|
|
susHandlers[7]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[7]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -143,7 +138,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[8] =
|
|
|
|
|
new SusHandler(objects::SUS_8_R_LOC_XBYBZB_PT_YB, 8, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_8_R_LOC_XBYBZB_PT_YB);
|
|
|
|
|
susHandlers[8]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[8]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -151,7 +145,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[9] =
|
|
|
|
|
new SusHandler(objects::SUS_9_R_LOC_XBYBZB_PT_YF, 9, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_9_R_LOC_XBYBZB_PT_YF);
|
|
|
|
|
susHandlers[9]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[9]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -159,7 +152,6 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[10] =
|
|
|
|
|
new SusHandler(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, 10, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_10_N_LOC_XMYBZF_PT_ZF);
|
|
|
|
|
susHandlers[10]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[10]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, SUS::MAX_CMD_SIZE,
|
|
|
|
@ -167,11 +159,24 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
susHandlers[11] =
|
|
|
|
|
new SusHandler(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, 11, objects::SPI_MAIN_COM_IF, spiCookie);
|
|
|
|
|
fdir = new SusFdir(objects::SUS_11_R_LOC_XBYMZB_PT_ZB);
|
|
|
|
|
susHandlers[11]->setParent(objects::SUS_BOARD_ASS);
|
|
|
|
|
susHandlers[11]->setCustomFdir(fdir);
|
|
|
|
|
|
|
|
|
|
std::array<object_id_t, 12> susIds = {
|
|
|
|
|
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
|
|
|
|
|
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
|
|
|
|
|
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
|
|
|
|
|
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
|
|
|
|
|
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
|
|
|
|
|
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
|
|
|
|
|
SusAssHelper susAssHelper = SusAssHelper(susIds);
|
|
|
|
|
auto susAss = new SusAssembly(objects::SUS_BOARD_ASS, pwrSwitcher, susAssHelper);
|
|
|
|
|
for (auto& sus : susHandlers) {
|
|
|
|
|
if (sus != nullptr) {
|
|
|
|
|
ReturnValue_t result = sus->connectModeTreeParent(*susAss);
|
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
|
sif::error << "Connecting SUS " << sus->getObjectId() << " to SUS assembly failed"
|
|
|
|
|
<< std::endl;
|
|
|
|
|
}
|
|
|
|
|
#if OBSW_TEST_SUS == 1
|
|
|
|
|
sus->setStartUpImmediately();
|
|
|
|
|
sus->setToGoToNormalMode(true);
|
|
|
|
@ -181,17 +186,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::array<object_id_t, 12> susIds = {
|
|
|
|
|
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
|
|
|
|
|
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
|
|
|
|
|
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
|
|
|
|
|
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
|
|
|
|
|
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
|
|
|
|
|
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
|
|
|
|
|
SusAssHelper susAssHelper = SusAssHelper(susIds);
|
|
|
|
|
auto susAss =
|
|
|
|
|
new SusAssembly(objects::SUS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, susAssHelper);
|
|
|
|
|
static_cast<void>(susAss);
|
|
|
|
|
susAss->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
|
|
|
|
|
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -293,6 +288,11 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
|
|
|
|
std::array<SpiCookie*, NUM_RTDS> rtdCookies = {};
|
|
|
|
|
std::array<Max31865EiveHandler*, NUM_RTDS> rtds = {};
|
|
|
|
|
RtdFdir* rtdFdir = nullptr;
|
|
|
|
|
|
|
|
|
|
TcsBoardHelper helper(rtdInfos);
|
|
|
|
|
TcsBoardAssembly* tcsBoardAss = new TcsBoardAssembly(
|
|
|
|
|
objects::TCS_BOARD_ASS, pwrSwitcher, pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
|
|
|
|
|
static_cast<void>(tcsBoardAss);
|
|
|
|
|
// Create special low level reader communication interface
|
|
|
|
|
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF, gpioComIF);
|
|
|
|
|
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
|
|
|
|
@ -304,7 +304,11 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
|
|
|
|
rtds[idx] =
|
|
|
|
|
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
|
|
|
|
|
rtds[idx]->setDeviceInfo(idx, rtdInfos[idx].second);
|
|
|
|
|
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
|
|
|
|
|
ReturnValue_t result = rtds[idx]->connectModeTreeParent(*tcsBoardAss);
|
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
|
sif::error << "Connecting RTD " << static_cast<int>(idx) << " to RTD Assembly failed"
|
|
|
|
|
<< std::endl;
|
|
|
|
|
}
|
|
|
|
|
rtdFdir = new RtdFdir(rtdInfos[idx].first);
|
|
|
|
|
rtds[idx]->setCustomFdir(rtdFdir);
|
|
|
|
|
#if OBSW_DEBUG_RTD == 1
|
|
|
|
@ -316,11 +320,6 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TcsBoardHelper helper(rtdInfos);
|
|
|
|
|
TcsBoardAssembly* tcsBoardAss =
|
|
|
|
|
new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
|
|
|
|
|
pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
|
|
|
|
|
static_cast<void>(tcsBoardAss);
|
|
|
|
|
#endif // OBSW_ADD_RTD_DEVICES == 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -341,10 +340,16 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ObjectFactory::createThermalController() {
|
|
|
|
|
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
|
|
|
|
|
new ThermalController(objects::THERMAL_CONTROLLER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ObjectFactory::createAcsController() { new AcsController(objects::ACS_CONTROLLER); }
|
|
|
|
|
AcsController* ObjectFactory::createAcsController(bool connectSubsystem) {
|
|
|
|
|
auto acsCtrl = new AcsController(objects::ACS_CONTROLLER);
|
|
|
|
|
if (connectSubsystem) {
|
|
|
|
|
acsCtrl->connectModeTreeParent(satsystem::ACS_SUBSYSTEM);
|
|
|
|
|
}
|
|
|
|
|
return acsCtrl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
|