move GNSS NReset handling to assembly #194

Merged
meierj merged 3 commits from mueller/move-gnss-nreset-handling into develop 2022-04-01 14:55:50 +02:00
8 changed files with 58 additions and 27 deletions

View File

@ -127,12 +127,14 @@ void initmission::initTasks() {
"SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); "SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
result = sysTask->addComponent(objects::ACS_BOARD_ASS); result = sysTask->addComponent(objects::ACS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ACS_ASS", objects::ACS_BOARD_ASS); initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
} }
#if OBSW_ADD_SUS_BOARD_ASS == 1
result = sysTask->addComponent(objects::SUS_BOARD_ASS); result = sysTask->addComponent(objects::SUS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SUS_ASS", objects::SUS_BOARD_ASS); initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
} }
#endif
result = sysTask->addComponent(objects::TCS_BOARD_ASS); result = sysTask->addComponent(objects::TCS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS); initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);

View File

@ -252,10 +252,8 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie);
PDU1Handler* pdu1handler = PDU1Handler* pdu1handler =
new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie);
pdu1handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF);
PDU2Handler* pdu2handler = PDU2Handler* pdu2handler =
new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie);
pdu2handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie);
auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50);
@ -558,15 +556,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
acsBoardHelper, gpioComIF); acsBoardHelper, gpioComIF);
static_cast<void>(acsAss); static_cast<void>(acsAss);
#if OBSW_TEST_ACS_BOARD_ASS == 1
CommandMessage msg;
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
duallane::A_SIDE);
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Sending mode command failed" << std::endl;
}
#endif
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */ #endif /* OBSW_ADD_ACS_HANDLERS == 1 */
} }
@ -962,3 +951,13 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
new UartTestClass(objects::UART_TEST); new UartTestClass(objects::UART_TEST);
#endif #endif
} }
void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) {
CommandMessage msg;
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
duallane::A_SIDE);
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Sending mode command failed" << std::endl;
}
}

View File

@ -6,6 +6,7 @@ class UartComIF;
class SpiComIF; class SpiComIF;
class I2cComIF; class I2cComIF;
class PowerSwitchIF; class PowerSwitchIF;
class AcsBoardAssembly;
namespace ObjectFactory { namespace ObjectFactory {
@ -29,6 +30,8 @@ void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF); void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
void createTestComponents(LinuxLibgpioIF* gpioComIF); void createTestComponents(LinuxLibgpioIF* gpioComIF);
void testAcsBrdAss(AcsBoardAssembly* assAss);
}; // namespace ObjectFactory }; // namespace ObjectFactory
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */ #endif /* BSP_Q7S_OBJECTFACTORY_H_ */

@ -1 +1 @@
Subproject commit 1c8be25e185aada13392a75234fa463240f424a0 Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5

View File

@ -44,6 +44,7 @@ debugging. */
#define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_SUPERVISOR 0
#define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_PLOC_MPSOC 0
#define OBSW_ADD_SUN_SENSORS 1 #define OBSW_ADD_SUN_SENSORS 1
#define OBSW_ADD_SUS_BOARD_ASS 1
#define OBSW_ADD_ACS_BOARD 1 #define OBSW_ADD_ACS_BOARD 1
#define OBSW_ADD_ACS_HANDLERS 1 #define OBSW_ADD_ACS_HANDLERS 1
#define OBSW_ADD_RW 0 #define OBSW_ADD_RW 0
@ -115,7 +116,6 @@ debugging. */
#define OBSW_ADD_UART_TEST_CODE 0 #define OBSW_ADD_UART_TEST_CODE 0
#define OBSW_TEST_ACS 0 #define OBSW_TEST_ACS 0
#define OBSW_TEST_ACS_BOARD_ASS 0
#define OBSW_DEBUG_ACS 0 #define OBSW_DEBUG_ACS 0
#define OBSW_TEST_SUS 0 #define OBSW_TEST_SUS 0
#define OBSW_DEBUG_SUS 0 #define OBSW_DEBUG_SUS 0

View File

@ -142,12 +142,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm0Lis3IdSideA, helper.mgm0SideAMode, ModeTableIdx::MGM_0_A); cmdSeq(helper.mgm0Lis3IdSideA, helper.mgm0SideAMode, ModeTableIdx::MGM_0_A);
cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A); cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A);
if (gpsUsable) { if (gpsUsable) {
if (gpioIF->pullLow(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { gpioHandler(gpioIds::GNSS_0_NRESET, true,
#if OBSW_VERBOSE_LEVEL >= 1 "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low" "of GNSS 0 high (used GNSS)");
<< std::endl; gpioHandler(gpioIds::GNSS_1_NRESET, false,
#endif "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
} "of GNSS 1 low (unused GNSS)");
gpioHandler(gpioIds::GNSS_SELECT, false,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low");
} }
break; break;
} }
@ -165,12 +167,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B); cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B);
cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B);
if (gpsUsable) { if (gpsUsable) {
if (gpioIF->pullHigh(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { gpioHandler(gpioIds::GNSS_0_NRESET, false,
#if OBSW_VERBOSE_LEVEL >= 1 "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high" "of GNSS 0 low (unused GNSS)");
<< std::endl; gpioHandler(gpioIds::GNSS_1_NRESET, true,
#endif "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
} "of GNSS 1 high (used GNSS)");
gpioHandler(gpioIds::GNSS_SELECT, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high");
} }
break; break;
} }
@ -186,6 +190,12 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B);
ReturnValue_t status = RETURN_OK; ReturnValue_t status = RETURN_OK;
if (gpsUsable) { if (gpsUsable) {
gpioHandler(gpioIds::GNSS_0_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 0 high (used GNSS)");
gpioHandler(gpioIds::GNSS_1_NRESET, true,
"AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin"
"of GNSS 1 high (used GNSS)");
if (defaultSubmode == Submodes::A_SIDE) { if (defaultSubmode == Submodes::A_SIDE) {
status = gpioIF->pullLow(gpioIds::GNSS_SELECT); status = gpioIF->pullLow(gpioIds::GNSS_SELECT);
} else { } else {
@ -233,6 +243,20 @@ void AcsBoardAssembly::selectGpsInDualMode(duallane::Submodes side) {
} }
} }
void AcsBoardAssembly::gpioHandler(gpioId_t gpio, bool high, std::string error) {
ReturnValue_t result = RETURN_OK;
if(high) {
result = gpioIF->pullHigh(gpio);
} else {
result = gpioIF->pullLow(gpio);
}
if (result != HasReturnvaluesIF::RETURN_OK) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::error << error << std::endl;
#endif
}
}
void AcsBoardAssembly::refreshHelperModes() { void AcsBoardAssembly::refreshHelperModes() {
try { try {
helper.gyro0SideAMode = childrenMap.at(helper.gyro0AdisIdSideA).mode; helper.gyro0SideAMode = childrenMap.at(helper.gyro0AdisIdSideA).mode;

View File

@ -4,6 +4,7 @@
#include <common/config/commonSubsystemIds.h> #include <common/config/commonSubsystemIds.h>
#include <devices/powerSwitcherList.h> #include <devices/powerSwitcherList.h>
#include <fsfw/objectmanager/frameworkObjects.h> #include <fsfw/objectmanager/frameworkObjects.h>
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
#include "DualLaneAssemblyBase.h" #include "DualLaneAssemblyBase.h"
#include "DualLanePowerStateMachine.h" #include "DualLanePowerStateMachine.h"
@ -115,6 +116,7 @@ class AcsBoardAssembly : public DualLaneAssemblyBase {
GpioIF* gpioIF = nullptr; GpioIF* gpioIF = nullptr;
FixedArrayList<ModeListEntry, NUMBER_DEVICES_MODE_TABLE> modeTable; FixedArrayList<ModeListEntry, NUMBER_DEVICES_MODE_TABLE> modeTable;
void gpioHandler(gpioId_t gpio, bool high, std::string error);
ReturnValue_t initialize() override; ReturnValue_t initialize() override;

View File

@ -50,6 +50,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
* @return * @return
*/ */
bool isUseable(object_id_t object, Mode_t mode); bool isUseable(object_id_t object, Mode_t mode);
/** /**
* Thin wrapper function which is required because the helper class * Thin wrapper function which is required because the helper class
* can not access protected member functions. * can not access protected member functions.