From 260082c425742227bedd936cf3a2f2c2eec70fd9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:46:34 +0200 Subject: [PATCH 01/15] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index bc6b29e6..8f3edc90 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit bc6b29e652a90f5a14bb32a1bcc2a956e410e678 +Subproject commit 8f3edc90ba844b9a4551bb77a71e6dcbdae6e9ee From adb0147ea994d4ab88fda3cf46014df1cb74545c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:52:03 +0200 Subject: [PATCH 02/15] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index b3bc1fe2..9d1cae08 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b3bc1fe28c73d51f0b8319cf67705807596e5518 +Subproject commit 9d1cae0809a7784f0dceb01359f723975a5903e7 From 00711c148a362e9cf3a33a6d4d4037d59451a427 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 13:40:29 +0200 Subject: [PATCH 03/15] rm3100 changes --- bsp_q7s/core/ObjectFactory.cpp | 2 ++ linux/fsfwconfig/FSFWConfig.h.in | 1 + 2 files changed, 3 insertions(+) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index bdad3dac..de34ab7a 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -457,6 +457,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); + mgmRm3100Handler->setToGoToNormalMode(true); spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -469,6 +470,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); + mgmRm3100Handler->setToGoToNormalMode(true); // Commented until ACS board V2 in in clean room again // Gyro 0 Side A diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 89d8b9a7..32474f21 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -75,5 +75,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 +#define FSFW_HAL_RM3100_MGM_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ From 2aa76766af50cfc24265bd2f86afaa2494504901 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 14:51:14 +0200 Subject: [PATCH 04/15] added print commands for PCDU --- bsp_linux_board/ObjectFactory.cpp | 3 +- bsp_q7s/core/ObjectFactory.cpp | 6 +- mission/devices/CMakeLists.txt | 2 +- ...ndlerLIS3MDL.cpp => MgmLIS3MDLHandler.cpp} | 7 +- ...GMHandlerLIS3MDL.h => MgmLIS3MDLHandler.h} | 62 ++++++++-------- mission/devices/PDU2Handler.cpp | 74 +++++++++++++++++++ mission/devices/PDU2Handler.h | 3 + .../devicedefinitions/GomspaceDefinitions.h | 6 +- 8 files changed, 121 insertions(+), 42 deletions(-) rename mission/devices/{MGMHandlerLIS3MDL.cpp => MgmLIS3MDLHandler.cpp} (98%) rename mission/devices/{MGMHandlerLIS3MDL.h => MgmLIS3MDLHandler.h} (98%) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 372fbf25..60ca5b6e 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -14,7 +14,8 @@ #include "mission/core/GenericFactory.h" #include "mission/utility/TmFunnel.h" #include -#include "mission/devices/MGMHandlerLIS3MDL.h" +#include + #include "mission/devices/MGMHandlerRM3100.h" #include "mission/devices/GyroADIS16507Handler.h" diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index de34ab7a..8f88a1c7 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,3 +1,4 @@ +#include #include "ObjectFactory.h" #include "OBSWConfig.h" #include "devConf.h" @@ -36,7 +37,6 @@ #include "mission/devices/GyroADIS16507Handler.h" #include "mission/devices/IMTQHandler.h" #include "mission/devices/SyrlinksHkHandler.h" -#include "mission/devices/MGMHandlerLIS3MDL.h" #include "mission/devices/PlocMPSoCHandler.h" #include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RwHandler.h" @@ -449,7 +449,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, @@ -462,7 +462,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler2->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index b5a1e20f..356115d3 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -1,6 +1,6 @@ target_sources(${TARGET_NAME} PUBLIC GPSHyperionHandler.cpp - MGMHandlerLIS3MDL.cpp + MgmLIS3MDLHandler.cpp GomspaceDeviceHandler.cpp Tmp1075Handler.cpp PCDUHandler.cpp diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MgmLIS3MDLHandler.cpp similarity index 98% rename from mission/devices/MGMHandlerLIS3MDL.cpp rename to mission/devices/MgmLIS3MDLHandler.cpp index 0e1da93e..b5701e1e 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MgmLIS3MDLHandler.cpp @@ -1,12 +1,11 @@ -#include "MGMHandlerLIS3MDL.h" - +#include #include "fsfw/datapool/PoolReadGuard.h" #if OBSW_VERBOSE_LEVEL >= 1 #include "fsfw/globalfunctions/PeriodicOperationDivider.h" #endif -MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, - object_id_t deviceCommunication, CookieIF* comCookie): +MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication, + CookieIF* comCookie, uint8_t switchId, uint32_t transitionDelay): DeviceHandlerBase(objectId, deviceCommunication, comCookie), dataset(this) { #if OBSW_VERBOSE_LEVEL >= 1 diff --git a/mission/devices/MGMHandlerLIS3MDL.h b/mission/devices/MgmLIS3MDLHandler.h similarity index 98% rename from mission/devices/MGMHandlerLIS3MDL.h rename to mission/devices/MgmLIS3MDLHandler.h index 1b7b9c9a..0e36b9d3 100644 --- a/mission/devices/MGMHandlerLIS3MDL.h +++ b/mission/devices/MgmLIS3MDLHandler.h @@ -30,8 +30,8 @@ public: //Notifies a command to change the setup parameters static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW); - MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie); + MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, + uint8_t switchId, uint32_t transitionDelay = 10000); virtual ~MGMHandlerLIS3MDL(); protected: @@ -59,6 +59,34 @@ protected: private: MGMLIS3MDL::MgmPrimaryDataset dataset; + //Length a sindgle command SPI answer + static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; + + //Single SPIcommand has 2 bytes, first for adress, second for content + size_t singleComandSize = 2; + //has the size for all adresses of the lis3mdl + the continous write bit + uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; + + /** + * We want to save the registers we set, so we dont have to read the + * registers when we want to change something. + * --> everytime we change set a register we have to save it + */ + uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; + + uint8_t statusRegister = 0; + + enum class InternalState { + STATE_NONE, + STATE_FIRST_CONTACT, + STATE_SETUP, + STATE_CHECK_REGISTERS, + STATE_NORMAL + }; + + InternalState internalState = InternalState::STATE_NONE; + CommunicationStep communicationStep = CommunicationStep::DATA; + bool commandExecuted = false; /*------------------------------------------------------------------------*/ /* Device specific commands and variables */ @@ -119,24 +147,6 @@ private: virtual ReturnValue_t setOperatingMode(const uint8_t *commandData, size_t commandDataLen); - - //Length a sindgle command SPI answer - static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; - - //Single SPIcommand has 2 bytes, first for adress, second for content - size_t singleComandSize = 2; - //has the size for all adresses of the lis3mdl + the continous write bit - uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; - - /** - * We want to save the registers we set, so we dont have to read the - * registers when we want to change something. - * --> everytime we change set a register we have to save it - */ - uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; - - uint8_t statusRegister = 0; - /** * We always update all registers together, so this method updates * the rawpacket and rawpacketLen, so we just manipulate the local @@ -145,18 +155,6 @@ private: */ ReturnValue_t prepareCtrlRegisterWrite(); - enum class InternalState { - STATE_NONE, - STATE_FIRST_CONTACT, - STATE_SETUP, - STATE_CHECK_REGISTERS, - STATE_NORMAL - }; - - InternalState internalState = InternalState::STATE_NONE; - CommunicationStep communicationStep = CommunicationStep::DATA; - bool commandExecuted = false; - #if OBSW_VERBOSE_LEVEL >= 1 PeriodicOperationDivider* debugDivider; #endif diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 8789695e..bd760d77 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -312,6 +312,18 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { + case(GOMSPACE::PRINT_ALL): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputSwitchStates(); + printOutputCurrents(); + printOutputVoltages(); + return HasReturnvaluesIF::RETURN_OK; + } case(GOMSPACE::PRINT_OUT_ENB_STATUS): { PoolReadGuard pg(&pdu2HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); @@ -322,6 +334,26 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { printOutputSwitchStates(); return HasReturnvaluesIF::RETURN_OK; } + case(GOMSPACE::PRINT_OUT_CURRENTS): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputCurrents(); + return HasReturnvaluesIF::RETURN_OK; + } + case(GOMSPACE::PRINT_OUT_VOLTAGES): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputVoltages(); + return HasReturnvaluesIF::RETURN_OK; + } default: { return HasReturnvaluesIF::RETURN_FAILED; } @@ -348,3 +380,45 @@ void PDU2Handler::printOutputSwitchStates() { sif::info << "PDU2 payload camera enable state: " << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; } + +void PDU2Handler::printOutputCurrents() { + sif::info << "PDU2 Q7S current: " << + pdu2HkTableDataset.currentOutQ7S.value << std::endl; + sif::info << "PDU2 Payload PCDU current: " << + pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << std::endl; + sif::info << "PDU2 RW currents: " << + pdu2HkTableDataset.currentOutReactionWheels.value << std::endl; + sif::info << "PDU2 TCS Board Heater In Current: " << + pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << std::endl; + sif::info << "PDU2 SuS Redundant current: " << + pdu2HkTableDataset.currentOutSUSRedundant.value << std::endl; + sif::info << "PDU2 Depl-Mechanism current: " << + pdu2HkTableDataset.currentOutDeplMechanism.value << std::endl; + sif::info << "PDU2 Payload PCDU current: " << + pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << std::endl; + sif::info << "PDU2 ACS Board current: " << + pdu2HkTableDataset.currentOutACSBoardSideB.value << std::endl; + sif::info << "PDU2 Payload Camera current: " << + pdu2HkTableDataset.currentOutPayloadCamera.value << std::endl; +} + +void PDU2Handler::printOutputVoltages() { + sif::info << "PDU2 Q7S voltage: " << + pdu2HkTableDataset.voltageOutQ7S.value << std::endl; + sif::info << "PDU2 Payload PCDU voltage: " << + pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl; + sif::info << "PDU2 RW voltage: " << + pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl; + sif::info << "PDU2 TCS Board Heater In voltage: " << + pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl; + sif::info << "PDU2 SuS Redundant voltage: " << + pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl; + sif::info << "PDU2 Depl-Mechanism voltage: " << + pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl; + sif::info << "PDU2 Payload PCDU voltage: " << + pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value << std::endl; + sif::info << "PDU2 ACS Board voltage: " << + pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl; + sif::info << "PDU2 Payload Camera voltage: " << + pdu2HkTableDataset.voltageOutPayloadCamera.value << std::endl; +} diff --git a/mission/devices/PDU2Handler.h b/mission/devices/PDU2Handler.h index 0aa7f0b5..93f9200e 100644 --- a/mission/devices/PDU2Handler.h +++ b/mission/devices/PDU2Handler.h @@ -40,6 +40,9 @@ private: PDU2::PDU2HkTableDataset pdu2HkTableDataset; void printOutputSwitchStates(); + void printOutputCurrents(); + void printOutputVoltages(); + void parseHkTableReply(const uint8_t *packet); }; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index f4e50466..5f067bed 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -33,7 +33,11 @@ static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_ENB_STATUS = 17; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_ALL = 32; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_OUT_ENB_STATUS = 33; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_OUT_CURRENTS = 34; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_OUT_VOLTAGES = 35; //!< [EXPORT] : [COMMAND] + } From 0f57fc33c8973ecb150a860ebab1190893b27192 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 14:51:51 +0200 Subject: [PATCH 05/15] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 9d1cae08..6da94c73 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9d1cae0809a7784f0dceb01359f723975a5903e7 +Subproject commit 6da94c73d0568c64e41d6c4b803539e09409c942 From 536c0cb0feb9035c4da08d97b12dcc86d61deed4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 15:00:31 +0200 Subject: [PATCH 06/15] new commands now working --- mission/devices/GomspaceDeviceHandler.cpp | 12 +++++-- mission/devices/PDU2Handler.cpp | 38 ++++++++++++----------- tmtc | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index c7de02bb..72c2766e 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -7,11 +7,11 @@ GomspaceDeviceHandler::GomspaceDeviceHandler(object_id_t objectId, object_id_t c DeviceHandlerBase(objectId, comIF, comCookie), maxConfigTableAddress(maxConfigTableAddress), maxHkTableAddress(maxHkTableAddress), hkTableReplySize(hkTableReplySize), hkTableDataset(hkTableDataset) { - if (comCookie == NULL) { + if (comCookie == nullptr) { sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid com cookie" << std::endl; } - if (hkTableDataset == NULL) { + if (hkTableDataset == nullptr) { sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid hk table data set" << std::endl; } @@ -75,7 +75,10 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } - case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + case(GOMSPACE::PRINT_OUT_ENB_STATUS): + case(GOMSPACE::PRINT_ALL): + case(GOMSPACE::PRINT_OUT_CURRENTS): + case(GOMSPACE::PRINT_OUT_VOLTAGES): { result = printStatus(deviceCommand); break; } @@ -99,7 +102,10 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); + this->insertInCommandMap(GOMSPACE::PRINT_ALL); this->insertInCommandMap(GOMSPACE::PRINT_OUT_ENB_STATUS); + this->insertInCommandMap(GOMSPACE::PRINT_OUT_VOLTAGES); + this->insertInCommandMap(GOMSPACE::PRINT_OUT_CURRENTS); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index bd760d77..06e60002 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -382,43 +382,45 @@ void PDU2Handler::printOutputSwitchStates() { } void PDU2Handler::printOutputCurrents() { - sif::info << "PDU2 Q7S current: " << + sif::info << "Printing PDU2 currents [mA]: " << std::endl; + sif::info << "PDU2 Q7S:" << pdu2HkTableDataset.currentOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU current: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW currents: " << + sif::info << "PDU2 RW:" << pdu2HkTableDataset.currentOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In Current: " << + sif::info << "PDU2 TCS Board Heater In:" << pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant current: " << + sif::info << "PDU2 SuS Redundant:" << pdu2HkTableDataset.currentOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism current: " << + sif::info << "PDU2 Depl-Mechanism:" << pdu2HkTableDataset.currentOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU current: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board current: " << + sif::info << "PDU2 ACS Board:" << pdu2HkTableDataset.currentOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera current: " << + sif::info << "PDU2 Payload Camera:" << pdu2HkTableDataset.currentOutPayloadCamera.value << std::endl; } void PDU2Handler::printOutputVoltages() { - sif::info << "PDU2 Q7S voltage: " << + sif::info << "Printing PDU2 voltages [mV]: " << std::endl; + sif::info << "PDU2 Q7S:" << pdu2HkTableDataset.voltageOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU voltage: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW voltage: " << + sif::info << "PDU2 RW:" << pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In voltage: " << + sif::info << "PDU2 TCS Board Heater In:" << pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant voltage: " << + sif::info << "PDU2 SuS Redundant:" << pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism voltage: " << + sif::info << "PDU2 Depl-Mechanism:" << pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU voltage: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board voltage: " << + sif::info << "PDU2 ACS Board voltage:" << pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera voltage: " << + sif::info << "PDU2 Payload Camera voltage:" << pdu2HkTableDataset.voltageOutPayloadCamera.value << std::endl; } diff --git a/tmtc b/tmtc index 6da94c73..5c65390a 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 6da94c73d0568c64e41d6c4b803539e09409c942 +Subproject commit 5c65390a8b0344c41728d276729cae0a2cc1d9d1 From 00bafd98fe2711c261151c8dbaedc6c867e5413e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:24:34 +0200 Subject: [PATCH 07/15] obsw config, gps update --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++++---- common/config/devConf.h | 4 ++-- linux/fsfwconfig/OBSWConfig.h.in | 1 + mission/devices/GPSHyperionHandler.cpp | 12 ++++++++++-- mission/devices/GPSHyperionHandler.h | 6 +++++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 8f88a1c7..7b5247f8 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -457,7 +457,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); - mgmRm3100Handler->setToGoToNormalMode(true); + //mgmRm3100Handler->setToGoToNormalMode(true); spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -470,7 +470,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); - mgmRm3100Handler->setToGoToNormalMode(true); + //mgmRm3100Handler->setToGoToNormalMode(true); // Commented until ACS board V2 in in clean room again // Gyro 0 Side A @@ -502,6 +502,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gyroL3gHandler->setStartUpImmediately(); //gyroL3gHandler->setGoNormalModeAtStartup(); + bool debugGps = false; +#if OBSW_DEBUG_GPS == 1 + debugGps = true; +#endif resetArgsGnss1.gnss1 = true; resetArgsGnss1.gpioComIF = gpioComIF; resetArgsGnss1.waitPeriodMs = 100; @@ -517,11 +521,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI uartCookieGps1->setToFlushInput(true); uartCookieGps1->setReadCycles(6); auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, - uartCookieGps0, true); + uartCookieGps0, debugGps); gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); gpsHandler0->setStartUpImmediately(); auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, - uartCookieGps1, true); + uartCookieGps1, debugGps); gpsHandler1->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss1); gpsHandler1->setStartUpImmediately(); } diff --git a/common/config/devConf.h b/common/config/devConf.h index 41126fdd..e1d95b5e 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -26,10 +26,10 @@ static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000; static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3; -static constexpr uint32_t RW_SPEED = 300000; +static constexpr uint32_t RW_SPEED = 300'000; static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0; -static constexpr uint32_t RTD_SPEED = 2000000; +static constexpr uint32_t RTD_SPEED = 2'000'000; } diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index dc397635..32f29a09 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -63,6 +63,7 @@ debugging. */ #define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_PDU1 0 #define OBSW_DEBUG_PDU2 0 +#define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_IMQT 0 diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 5e44f89c..26b86a76 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -23,7 +23,6 @@ GPSHyperionHandler::~GPSHyperionHandler() {} void GPSHyperionHandler::doStartUp() { if(internalState == InternalStates::NONE) { commandExecuted = false; - updatePeriodicReply(true, GpsHyperion::GPS_REPLY); internalState = InternalStates::WAIT_FIRST_MESSAGE; } @@ -76,7 +75,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { // Pass data to GPS library if(len > 0) { - sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; + // sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; if (internalState == InternalStates::WAIT_FIRST_MESSAGE) { // TODO: Check whether data is valid by checking whether NMEA start string is valid? commandExecuted = true; @@ -202,3 +201,12 @@ void GPSHyperionHandler::setResetPinTriggerFunction(gpioResetFunction_t resetCal void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId, uint32_t parameter) { } + +ReturnValue_t GPSHyperionHandler::initialize() { + ReturnValue_t result = DeviceHandlerBase::initialize(); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + // Enable reply immediately for now + return updatePeriodicReply(true, GpsHyperion::GPS_REPLY); +} diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index 03c572a3..13591b44 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -14,12 +14,16 @@ */ class GPSHyperionHandler: public DeviceHandlerBase { public: - using gpioResetFunction_t = ReturnValue_t (*) (void* args); + GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, bool debugHyperionGps = false); virtual ~GPSHyperionHandler(); + using gpioResetFunction_t = ReturnValue_t (*) (void* args); + void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args); + + ReturnValue_t initialize() override; protected: gpioResetFunction_t resetCallback = nullptr; From 2cb562cdee3f9a3cb8f0a95e06696b7ac8fa0415 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:25:16 +0200 Subject: [PATCH 08/15] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 5c65390a..a5d9fedc 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5c65390a8b0344c41728d276729cae0a2cc1d9d1 +Subproject commit a5d9fedc649966c901a7ede9bbbe915df9ed9446 From 8dcd2f0c9569e292134b317e6617e1bf35759403 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:33:47 +0200 Subject: [PATCH 09/15] some cfg improvements --- CMakeLists.txt | 1 - bsp_q7s/core/ObjectFactory.cpp | 16 ++++++++++++---- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 1 + linux/fsfwconfig/OBSWConfig.h.in | 1 - 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f366b744..e9b1b68c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,6 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() if(TGT_BSP) - message(STATUS ${TGT_BSP}) if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack" ) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 7b5247f8..49e036d6 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -457,7 +457,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); - //mgmRm3100Handler->setToGoToNormalMode(true); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -470,7 +472,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); - //mgmRm3100Handler->setToGoToNormalMode(true); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif // Commented until ACS board V2 in in clean room again // Gyro 0 Side A @@ -486,7 +490,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); - //gyroL3gHandler->setGoNormalModeAtStartup(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + gyroL3gHandler->setGoNormalModeAtStartup(); +#endif // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, @@ -500,7 +506,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); - //gyroL3gHandler->setGoNormalModeAtStartup(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + gyroL3gHandler->setGoNormalModeAtStartup(); +#endif bool debugGps = false; #if OBSW_DEBUG_GPS == 1 diff --git a/fsfw b/fsfw index 8f3edc90..6d0d04ac 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8f3edc90ba844b9a4551bb77a71e6dcbdae6e9ee +Subproject commit 6d0d04ac230962024580ef3769cc8ec063db4093 diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 32474f21..4f278cef 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -74,6 +74,7 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 + #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #define FSFW_HAL_RM3100_MGM_DEBUG 0 diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 32f29a09..58797c2d 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -68,7 +68,6 @@ debugging. */ #define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_IMQT 0 #define OBSW_DEBUG_ADIS16507 0 -#define OBSW_DEBUG_L3GD20_GYRO 0 #define OBSW_DEBUG_RAD_SENSOR 0 #define OBSW_DEBUG_SUS 0 #define OBSW_DEBUG_RTD 0 From 48a8a52b1c867c01ee2f946057954cb425b34761 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 18:51:06 +0200 Subject: [PATCH 10/15] moved lis3mdl to fsfw --- bsp_q7s/core/ObjectFactory.cpp | 12 +- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 1 + .../pollingSequenceFactory.cpp | 102 ++-- mission/devices/CMakeLists.txt | 1 - mission/devices/MgmLIS3MDLHandler.cpp | 497 ------------------ mission/devices/MgmLIS3MDLHandler.h | 163 ------ .../MGMHandlerLIS3Definitions.h | 178 ------- 8 files changed, 62 insertions(+), 894 deletions(-) delete mode 100644 mission/devices/MgmLIS3MDLHandler.cpp delete mode 100644 mission/devices/MgmLIS3MDLHandler.h delete mode 100644 mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 49e036d6..26c4df6d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,4 +1,3 @@ -#include #include "ObjectFactory.h" #include "OBSWConfig.h" #include "devConf.h" @@ -53,6 +52,7 @@ #include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartCookie.h" +#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "fsfw_hal/linux/i2c/I2cCookie.h" @@ -448,9 +448,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI std::string spiDev = q7s::SPI_DEFAULT_DEV; SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); @@ -463,9 +466,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, + auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler2->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler2->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); diff --git a/fsfw b/fsfw index 6d0d04ac..b1a56a71 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 6d0d04ac230962024580ef3769cc8ec063db4093 +Subproject commit b1a56a71cdba538e82b4052413e1663b34cfee90 diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 4f278cef..7314b275 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -77,5 +77,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #define FSFW_HAL_RM3100_MGM_DEBUG 0 +#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index f45f5f32..a0064fc5 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,16 +425,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -447,27 +447,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -480,16 +480,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -502,16 +502,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index 356115d3..dd17728c 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -1,6 +1,5 @@ target_sources(${TARGET_NAME} PUBLIC GPSHyperionHandler.cpp - MgmLIS3MDLHandler.cpp GomspaceDeviceHandler.cpp Tmp1075Handler.cpp PCDUHandler.cpp diff --git a/mission/devices/MgmLIS3MDLHandler.cpp b/mission/devices/MgmLIS3MDLHandler.cpp deleted file mode 100644 index b5701e1e..00000000 --- a/mission/devices/MgmLIS3MDLHandler.cpp +++ /dev/null @@ -1,497 +0,0 @@ -#include -#include "fsfw/datapool/PoolReadGuard.h" -#if OBSW_VERBOSE_LEVEL >= 1 -#include "fsfw/globalfunctions/PeriodicOperationDivider.h" -#endif - -MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie, uint8_t switchId, uint32_t transitionDelay): - DeviceHandlerBase(objectId, deviceCommunication, comCookie), - dataset(this) { -#if OBSW_VERBOSE_LEVEL >= 1 - debugDivider = new PeriodicOperationDivider(5); -#endif - /* Set to default values right away. */ - registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; - registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT; - registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT; - registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT; - registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT; - -} - -MGMHandlerLIS3MDL::~MGMHandlerLIS3MDL() { -} - - -void MGMHandlerLIS3MDL::doStartUp() { - switch (internalState) { - case(InternalState::STATE_NONE): { - internalState = InternalState::STATE_FIRST_CONTACT; - break; - } - case(InternalState::STATE_FIRST_CONTACT): { - /* Will be set by checking device ID (WHO AM I register) */ - if(commandExecuted) { - commandExecuted = false; - internalState = InternalState::STATE_SETUP; - } - break; - } - case(InternalState::STATE_SETUP): { - internalState = InternalState::STATE_CHECK_REGISTERS; - break; - } - case(InternalState::STATE_CHECK_REGISTERS): { - /* Set up cached registers which will be used to configure the MGM. */ - if(commandExecuted) { - commandExecuted = false; -#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 - setMode(MODE_NORMAL); -#else - setMode(_MODE_TO_ON); -#endif - } - break; - } - default: - break; - } - -} - -void MGMHandlerLIS3MDL::doShutDown() { - setMode(_MODE_POWER_DOWN); -} - -ReturnValue_t MGMHandlerLIS3MDL::buildTransitionDeviceCommand( - DeviceCommandId_t *id) { - switch (internalState) { - case(InternalState::STATE_NONE): - case(InternalState::STATE_NORMAL): { - return HasReturnvaluesIF::RETURN_OK; - } - case(InternalState::STATE_FIRST_CONTACT): { - *id = MGMLIS3MDL::IDENTIFY_DEVICE; - break; - } - case(InternalState::STATE_SETUP): { - *id = MGMLIS3MDL::SETUP_MGM; - break; - } - case(InternalState::STATE_CHECK_REGISTERS): { - *id = MGMLIS3MDL::READ_CONFIG_AND_DATA; - break; - } - default: { - /* might be a configuration error. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << - std::endl; -#else - sif::printWarning("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - return HasReturnvaluesIF::RETURN_OK; - } - - } - return buildCommandFromCommand(*id, NULL, 0); -} - -uint8_t MGMHandlerLIS3MDL::readCommand(uint8_t command, bool continuousCom) { - command |= (1 << MGMLIS3MDL::RW_BIT); - if (continuousCom == true) { - command |= (1 << MGMLIS3MDL::MS_BIT); - } - return command; -} - -uint8_t MGMHandlerLIS3MDL::writeCommand(uint8_t command, bool continuousCom) { - command &= ~(1 << MGMLIS3MDL::RW_BIT); - if (continuousCom == true) { - command |= (1 << MGMLIS3MDL::MS_BIT); - } - return command; -} - -void MGMHandlerLIS3MDL::setupMgm() { - - registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; - registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT; - registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT; - registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT; - registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT; - - prepareCtrlRegisterWrite(); -} - -ReturnValue_t MGMHandlerLIS3MDL::buildNormalDeviceCommand( - DeviceCommandId_t *id) { - // Data/config register will be read in an alternating manner. - if(communicationStep == CommunicationStep::DATA) { - *id = MGMLIS3MDL::READ_CONFIG_AND_DATA; - communicationStep = CommunicationStep::TEMPERATURE; - return buildCommandFromCommand(*id, NULL, 0); - } - else { - *id = MGMLIS3MDL::READ_TEMPERATURE; - communicationStep = CommunicationStep::DATA; - return buildCommandFromCommand(*id, NULL, 0); - } - -} - -ReturnValue_t MGMHandlerLIS3MDL::buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) { - switch(deviceCommand) { - case(MGMLIS3MDL::READ_CONFIG_AND_DATA): { - std::memset(commandBuffer, 0, sizeof(commandBuffer)); - commandBuffer[0] = readCommand(MGMLIS3MDL::CTRL_REG1, true); - - rawPacket = commandBuffer; - rawPacketLen = MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1; - return RETURN_OK; - } - case(MGMLIS3MDL::READ_TEMPERATURE): { - std::memset(commandBuffer, 0, 3); - commandBuffer[0] = readCommand(MGMLIS3MDL::TEMP_LOWBYTE, true); - - rawPacket = commandBuffer; - rawPacketLen = 3; - return RETURN_OK; - } - case(MGMLIS3MDL::IDENTIFY_DEVICE): { - return identifyDevice(); - } - case(MGMLIS3MDL::TEMP_SENSOR_ENABLE): { - return enableTemperatureSensor(commandData, commandDataLen); - } - case(MGMLIS3MDL::SETUP_MGM): { - setupMgm(); - return HasReturnvaluesIF::RETURN_OK; - } - case(MGMLIS3MDL::ACCURACY_OP_MODE_SET): { - return setOperatingMode(commandData, commandDataLen); - } - default: - return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; - } - return HasReturnvaluesIF::RETURN_FAILED; -} - -ReturnValue_t MGMHandlerLIS3MDL::identifyDevice() { - uint32_t size = 2; - commandBuffer[0] = readCommand(MGMLIS3MDL::IDENTIFY_DEVICE_REG_ADDR); - commandBuffer[1] = 0x00; - - rawPacket = commandBuffer; - rawPacketLen = size; - - return RETURN_OK; -} - -ReturnValue_t MGMHandlerLIS3MDL::scanForReply(const uint8_t *start, - size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { - *foundLen = len; - if (len == MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1) { - *foundLen = len; - *foundId = MGMLIS3MDL::READ_CONFIG_AND_DATA; - // Check validity by checking config registers - if (start[1] != registers[0] or start[2] != registers[1] or - start[3] != registers[2] or start[4] != registers[3] or - start[5] != registers[4]) { -#if OBSW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl; -#else - sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n"); -#endif -#endif - return DeviceHandlerIF::INVALID_DATA; - } - if(mode == _MODE_START_UP) { - commandExecuted = true; - } - - } - else if(len == MGMLIS3MDL::TEMPERATURE_REPLY_LEN) { - *foundLen = len; - *foundId = MGMLIS3MDL::READ_TEMPERATURE; - } - else if (len == MGMLIS3MDL::SETUP_REPLY_LEN) { - *foundLen = len; - *foundId = MGMLIS3MDL::SETUP_MGM; - } - else if (len == SINGLE_COMMAND_ANSWER_LEN) { - *foundLen = len; - *foundId = getPendingCommand(); - if(*foundId == MGMLIS3MDL::IDENTIFY_DEVICE) { - if(start[1] != MGMLIS3MDL::DEVICE_ID) { -#if OBSW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl; -#else - sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n"); -#endif -#endif - return DeviceHandlerIF::INVALID_DATA; - } - - if(mode == _MODE_START_UP) { - commandExecuted = true; - } - } - } - else { - return DeviceHandlerIF::INVALID_DATA; - } - - /* Data with SPI Interface always has this answer */ - if (start[0] == 0b11111111) { - return RETURN_OK; - } - else { - return DeviceHandlerIF::INVALID_DATA; - } - -} -ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, - const uint8_t *packet) { - - switch (id) { - case MGMLIS3MDL::IDENTIFY_DEVICE: { - break; - } - case MGMLIS3MDL::SETUP_MGM: { - break; - } - case MGMLIS3MDL::READ_CONFIG_AND_DATA: { - // TODO: Store configuration in new local datasets. - float sensitivityFactor = getSensitivityFactor(getSensitivity(registers[2])); - - int16_t mgmMeasurementRawX = packet[MGMLIS3MDL::X_HIGHBYTE_IDX] << 8 - | packet[MGMLIS3MDL::X_LOWBYTE_IDX] ; - int16_t mgmMeasurementRawY = packet[MGMLIS3MDL::Y_HIGHBYTE_IDX] << 8 - | packet[MGMLIS3MDL::Y_LOWBYTE_IDX] ; - int16_t mgmMeasurementRawZ = packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8 - | packet[MGMLIS3MDL::Z_LOWBYTE_IDX] ; - - /* Target value in microtesla */ - float mgmX = static_cast(mgmMeasurementRawX) * sensitivityFactor - * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; - float mgmY = static_cast(mgmMeasurementRawY) * sensitivityFactor - * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; - float mgmZ = static_cast(mgmMeasurementRawZ) * sensitivityFactor - * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; - -#if OBSW_VERBOSE_LEVEL >= 1 - if(debugDivider->checkAndIncrement()) { - /* Set terminal to utf-8 if there is an issue with micro printout. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "MGMHandlerLIS3: Magnetic field strength in" - " microtesla:" << std::endl; - sif::info << "X: " << mgmX << " uT" << std::endl; - sif::info << "Y: " << mgmY << " uT" << std::endl; - sif::info << "Z: " << mgmZ << " uT" << std::endl; -#else - sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n"); - sif::printInfo("X: %f uT\n", mgmX); - sif::printInfo("Y: %f uT\n", mgmY); - sif::printInfo("Z: %f uT\n", mgmZ); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ - } -#endif /* OBSW_VERBOSE_LEVEL >= 1 */ - PoolReadGuard readHelper(&dataset); - if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { - dataset.fieldStrengthX = mgmX; - dataset.fieldStrengthY = mgmY; - dataset.fieldStrengthZ = mgmZ; - dataset.setValidity(true, true); - } - break; - } - - case MGMLIS3MDL::READ_TEMPERATURE: { - int16_t tempValueRaw = packet[2] << 8 | packet[1]; - float tempValue = 25.0 + ((static_cast(tempValueRaw)) / 8.0); -#if OBSW_VERBOSE_LEVEL >= 1 - if(debugDivider->check()) { - /* Set terminal to utf-8 if there is an issue with micro printout. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << - std::endl; -#else - sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n"); -#endif - } -#endif - ReturnValue_t result = dataset.read(); - if(result == HasReturnvaluesIF::RETURN_OK) { - dataset.temperature = tempValue; - dataset.commit(); - } - break; - } - - default: { - return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; - } - - } - return RETURN_OK; -} - -MGMLIS3MDL::Sensitivies MGMHandlerLIS3MDL::getSensitivity(uint8_t ctrlRegister2) { - bool fs0Set = ctrlRegister2 & (1 << MGMLIS3MDL::FSO); // Checks if FS0 bit is set - bool fs1Set = ctrlRegister2 & (1 << MGMLIS3MDL::FS1); // Checks if FS1 bit is set - - if (fs0Set && fs1Set) - return MGMLIS3MDL::Sensitivies::GAUSS_16; - else if (!fs0Set && fs1Set) - return MGMLIS3MDL::Sensitivies::GAUSS_12; - else if (fs0Set && !fs1Set) - return MGMLIS3MDL::Sensitivies::GAUSS_8; - else - return MGMLIS3MDL::Sensitivies::GAUSS_4; -} - -float MGMHandlerLIS3MDL::getSensitivityFactor(MGMLIS3MDL::Sensitivies sens) { - switch(sens) { - case(MGMLIS3MDL::GAUSS_4): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; - } - case(MGMLIS3MDL::GAUSS_8): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_8_SENS; - } - case(MGMLIS3MDL::GAUSS_12): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_12_SENS; - } - case(MGMLIS3MDL::GAUSS_16): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_16_SENS; - } - default: { - // Should never happen - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; - } - } -} - - -ReturnValue_t MGMHandlerLIS3MDL::enableTemperatureSensor( - const uint8_t *commandData, size_t commandDataLen) { - triggerEvent(CHANGE_OF_SETUP_PARAMETER); - uint32_t size = 2; - commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1); - if (commandDataLen > 1) { - return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; - } - switch (*commandData) { - case (MGMLIS3MDL::ON): { - commandBuffer[1] = registers[0] | (1 << 7); - break; - } - case (MGMLIS3MDL::OFF): { - commandBuffer[1] = registers[0] & ~(1 << 7); - break; - } - default: - return INVALID_COMMAND_PARAMETER; - } - registers[0] = commandBuffer[1]; - - rawPacket = commandBuffer; - rawPacketLen = size; - - return RETURN_OK; -} - -ReturnValue_t MGMHandlerLIS3MDL::setOperatingMode(const uint8_t *commandData, - size_t commandDataLen) { - triggerEvent(CHANGE_OF_SETUP_PARAMETER); - if (commandDataLen != 1) { - return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; - } - - switch (commandData[0]) { - case MGMLIS3MDL::LOW: - registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) & (~(1 << MGMLIS3MDL::OM0)); - registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) & (~(1 << MGMLIS3MDL::OMZ0)); - break; - case MGMLIS3MDL::MEDIUM: - registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) | (1 << MGMLIS3MDL::OM0); - registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) | (1 << MGMLIS3MDL::OMZ0); - break; - - case MGMLIS3MDL::HIGH: - registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) & (~(1 << MGMLIS3MDL::OM0)); - registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) & (~(1 << MGMLIS3MDL::OMZ0)); - break; - - case MGMLIS3MDL::ULTRA: - registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) | (1 << MGMLIS3MDL::OM0); - registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) | (1 << MGMLIS3MDL::OMZ0); - break; - default: - break; - } - - return prepareCtrlRegisterWrite(); -} - -void MGMHandlerLIS3MDL::fillCommandAndReplyMap() { - /* - * Regarding ArduinoBoard: - * Actually SPI answers directly, but as commanding ArduinoBoard the - * communication could be delayed - * SPI always has to be triggered, so there could be no periodic answer of - * the device, the device has to asked with a command, so periodic is zero. - * - * We dont read single registers, we just expect special - * reply from he Readall_MGM - */ - insertInCommandAndReplyMap(MGMLIS3MDL::READ_CONFIG_AND_DATA, 1, &dataset); - insertInCommandAndReplyMap(MGMLIS3MDL::READ_TEMPERATURE, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::SETUP_MGM, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::IDENTIFY_DEVICE, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::TEMP_SENSOR_ENABLE, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::ACCURACY_OP_MODE_SET, 1); -} - -ReturnValue_t MGMHandlerLIS3MDL::prepareCtrlRegisterWrite() { - commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1, true); - - for (size_t i = 0; i < MGMLIS3MDL::NR_OF_CTRL_REGISTERS; i++) { - commandBuffer[i + 1] = registers[i]; - } - rawPacket = commandBuffer; - rawPacketLen = MGMLIS3MDL::NR_OF_CTRL_REGISTERS + 1; - - /* We dont have to check if this is working because we just did it */ - return RETURN_OK; -} - -void MGMHandlerLIS3MDL::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { - -} - -uint32_t MGMHandlerLIS3MDL::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 20000; -} - -void MGMHandlerLIS3MDL::modeChanged(void) { - internalState = InternalState::STATE_NONE; -} - -ReturnValue_t MGMHandlerLIS3MDL::initializeLocalDataPool( - localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_X, - new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Y, - new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Z, - new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, - new PoolEntry({0.0})); - return HasReturnvaluesIF::RETURN_OK; -} diff --git a/mission/devices/MgmLIS3MDLHandler.h b/mission/devices/MgmLIS3MDLHandler.h deleted file mode 100644 index 0e36b9d3..00000000 --- a/mission/devices/MgmLIS3MDLHandler.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ -#define MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ - -#include "OBSWConfig.h" -#include "devicedefinitions/MGMHandlerLIS3Definitions.h" -#include "events/subsystemIdRanges.h" - -#include "fsfw/devicehandlers/DeviceHandlerBase.h" - -class PeriodicOperationDivider; - -/** - * @brief Device handler object for the LIS3MDL 3-axis magnetometer - * by STMicroeletronics - * @details - * Datasheet can be found online by googling LIS3MDL. - * Flight manual: - * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/LIS3MDL_MGM - * @author L. Loidold, R. Mueller - */ -class MGMHandlerLIS3MDL: public DeviceHandlerBase { -public: - enum class CommunicationStep { - DATA, - TEMPERATURE - }; - - static const uint8_t INTERFACE_ID = CLASS_ID::MGM_LIS3MDL; - static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::MGM_LIS3MDL; - //Notifies a command to change the setup parameters - static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW); - - MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, - uint8_t switchId, uint32_t transitionDelay = 10000); - virtual ~MGMHandlerLIS3MDL(); - -protected: - - /** DeviceHandlerBase overrides */ - void doShutDown() override; - void doStartUp() override; - void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override; - uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; - ReturnValue_t buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) override; - ReturnValue_t buildTransitionDeviceCommand( - DeviceCommandId_t *id) override; - ReturnValue_t buildNormalDeviceCommand( - DeviceCommandId_t *id) 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; - void modeChanged(void) override; - ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, - LocalDataPoolManager &poolManager) override; - -private: - MGMLIS3MDL::MgmPrimaryDataset dataset; - //Length a sindgle command SPI answer - static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; - - //Single SPIcommand has 2 bytes, first for adress, second for content - size_t singleComandSize = 2; - //has the size for all adresses of the lis3mdl + the continous write bit - uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; - - /** - * We want to save the registers we set, so we dont have to read the - * registers when we want to change something. - * --> everytime we change set a register we have to save it - */ - uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; - - uint8_t statusRegister = 0; - - enum class InternalState { - STATE_NONE, - STATE_FIRST_CONTACT, - STATE_SETUP, - STATE_CHECK_REGISTERS, - STATE_NORMAL - }; - - InternalState internalState = InternalState::STATE_NONE; - CommunicationStep communicationStep = CommunicationStep::DATA; - bool commandExecuted = false; - - /*------------------------------------------------------------------------*/ - /* Device specific commands and variables */ - /*------------------------------------------------------------------------*/ - /** - * Sets the read bit for the command - * @param single command to set the read-bit at - * @param boolean to select a continuous read bit, default = false - */ - uint8_t readCommand(uint8_t command, bool continuousCom = false); - - /** - * Sets the write bit for the command - * @param single command to set the write-bit at - * @param boolean to select a continuous write bit, default = false - */ - uint8_t writeCommand(uint8_t command, bool continuousCom = false); - - /** - * This Method gets the full scale for the measurement range - * e.g.: +- 4 gauss. See p.25 datasheet. - * @return The ReturnValue does not contain the sign of the value - */ - MGMLIS3MDL::Sensitivies getSensitivity(uint8_t ctrlReg2); - - /** - * The 16 bit value needs to be multiplied with a sensitivity factor - * which depends on the sensitivity configuration - * - * @param sens Configured sensitivity of the LIS3 device - * @return Multiplication factor to get the sensor value from raw data. - */ - float getSensitivityFactor(MGMLIS3MDL::Sensitivies sens); - - /** - * This Command detects the device ID - */ - ReturnValue_t identifyDevice(); - - virtual void setupMgm(); - - /*------------------------------------------------------------------------*/ - /* Non normal commands */ - /*------------------------------------------------------------------------*/ - /** - * Enables/Disables the integrated Temperaturesensor - * @param commandData On or Off - * @param length of the commandData: has to be 1 - */ - virtual ReturnValue_t enableTemperatureSensor(const uint8_t *commandData, - size_t commandDataLen); - - /** - * Sets the accuracy of the measurement of the axis. The noise is changing. - * @param commandData LOW, MEDIUM, HIGH, ULTRA - * @param length of the command, has to be 1 - */ - virtual ReturnValue_t setOperatingMode(const uint8_t *commandData, - size_t commandDataLen); - - /** - * We always update all registers together, so this method updates - * the rawpacket and rawpacketLen, so we just manipulate the local - * saved register - * - */ - ReturnValue_t prepareCtrlRegisterWrite(); - -#if OBSW_VERBOSE_LEVEL >= 1 - PeriodicOperationDivider* debugDivider; -#endif -}; - -#endif /* MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ */ diff --git a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h b/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h deleted file mode 100644 index 98d881cf..00000000 --- a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_ -#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_ - -#include -#include -#include -#include - -namespace MGMLIS3MDL { - -enum Set { - ON, OFF -}; -enum OpMode { - LOW, MEDIUM, HIGH, ULTRA -}; - -enum Sensitivies: uint8_t { - GAUSS_4 = 4, - GAUSS_8 = 8, - GAUSS_12 = 12, - GAUSS_16 = 16 -}; - -/* Actually 15, we just round up a bit */ -static constexpr size_t MAX_BUFFER_SIZE = 16; - -/* Field data register scaling */ -static constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100; -static constexpr float FIELD_LSB_PER_GAUSS_4_SENS = 1.0 / 6842.0; -static constexpr float FIELD_LSB_PER_GAUSS_8_SENS = 1.0 / 3421.0; -static constexpr float FIELD_LSB_PER_GAUSS_12_SENS = 1.0 / 2281.0; -static constexpr float FIELD_LSB_PER_GAUSS_16_SENS = 1.0 / 1711.0; - -static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x00; -static const DeviceCommandId_t SETUP_MGM = 0x01; -static const DeviceCommandId_t READ_TEMPERATURE = 0x02; -static const DeviceCommandId_t IDENTIFY_DEVICE = 0x03; -static const DeviceCommandId_t TEMP_SENSOR_ENABLE = 0x04; -static const DeviceCommandId_t ACCURACY_OP_MODE_SET = 0x05; - -/* Number of all control registers */ -static const uint8_t NR_OF_CTRL_REGISTERS = 5; -/* Number of registers in the MGM */ -static const uint8_t NR_OF_REGISTERS = 19; -/* Total number of adresses for all registers */ -static const uint8_t TOTAL_NR_OF_ADRESSES = 52; -static const uint8_t NR_OF_DATA_AND_CFG_REGISTERS = 14; -static const uint8_t TEMPERATURE_REPLY_LEN = 3; -static const uint8_t SETUP_REPLY_LEN = 6; - -/*------------------------------------------------------------------------*/ -/* Register adresses */ -/*------------------------------------------------------------------------*/ -/* Register adress returns identifier of device with default 0b00111101 */ -static const uint8_t IDENTIFY_DEVICE_REG_ADDR = 0b00001111; -static const uint8_t DEVICE_ID = 0b00111101; // Identifier for Device - -/* Register adress to access register 1 */ -static const uint8_t CTRL_REG1 = 0b00100000; -/* Register adress to access register 2 */ -static const uint8_t CTRL_REG2 = 0b00100001; -/* Register adress to access register 3 */ -static const uint8_t CTRL_REG3 = 0b00100010; -/* Register adress to access register 4 */ -static const uint8_t CTRL_REG4 = 0b00100011; -/* Register adress to access register 5 */ -static const uint8_t CTRL_REG5 = 0b00100100; - -/* Register adress to access status register */ -static const uint8_t STATUS_REG_IDX = 8; -static const uint8_t STATUS_REG = 0b00100111; - -/* Register adress to access low byte of x-axis */ -static const uint8_t X_LOWBYTE_IDX = 9; -static const uint8_t X_LOWBYTE = 0b00101000; -/* Register adress to access high byte of x-axis */ -static const uint8_t X_HIGHBYTE_IDX = 10; -static const uint8_t X_HIGHBYTE = 0b00101001; -/* Register adress to access low byte of y-axis */ -static const uint8_t Y_LOWBYTE_IDX = 11; -static const uint8_t Y_LOWBYTE = 0b00101010; -/* Register adress to access high byte of y-axis */ -static const uint8_t Y_HIGHBYTE_IDX = 12; -static const uint8_t Y_HIGHBYTE = 0b00101011; -/* Register adress to access low byte of z-axis */ -static const uint8_t Z_LOWBYTE_IDX = 13; -static const uint8_t Z_LOWBYTE = 0b00101100; -/* Register adress to access high byte of z-axis */ -static const uint8_t Z_HIGHBYTE_IDX = 14; -static const uint8_t Z_HIGHBYTE = 0b00101101; - -/* Register adress to access low byte of temperature sensor */ -static const uint8_t TEMP_LOWBYTE = 0b00101110; -/* Register adress to access high byte of temperature sensor */ -static const uint8_t TEMP_HIGHBYTE = 0b00101111; - -/*------------------------------------------------------------------------*/ -/* Initialize Setup Register set bits */ -/*------------------------------------------------------------------------*/ -/* General transfer bits */ -// Read=1 / Write=0 Bit -static const uint8_t RW_BIT = 7; -// Continous Read/Write Bit, increment adress -static const uint8_t MS_BIT = 6; - -/* CTRL_REG1 bits */ -static const uint8_t ST = 0; // Self test enable bit, enabled = 1 -// Enable rates higher than 80 Hz enabled = 1 -static const uint8_t FAST_ODR = 1; -static const uint8_t DO0 = 2; // Output data rate bit 2 -static const uint8_t DO1 = 3; // Output data rate bit 3 -static const uint8_t DO2 = 4; // Output data rate bit 4 -static const uint8_t OM0 = 5; // XY operating mode bit 5 -static const uint8_t OM1 = 6; // XY operating mode bit 6 -static const uint8_t TEMP_EN = 7; // Temperature sensor enable enabled = 1 -static const uint8_t CTRL_REG1_DEFAULT = (1 << TEMP_EN) | (1 << OM1) | - (1 << DO0) | (1 << DO1) | (1 << DO2); - -/* CTRL_REG2 bits */ -//reset configuration registers and user registers -static const uint8_t SOFT_RST = 2; -static const uint8_t REBOOT = 3; //reboot memory content -static const uint8_t FSO = 5; //full-scale selection bit 5 -static const uint8_t FS1 = 6; //full-scale selection bit 6 -static const uint8_t CTRL_REG2_DEFAULT = 0; - -/* CTRL_REG3 bits */ -static const uint8_t MD0 = 0; //Operating mode bit 0 -static const uint8_t MD1 = 1; //Operating mode bit 1 -//SPI serial interface mode selection enabled = 3-wire-mode -static const uint8_t SIM = 2; -static const uint8_t LP = 5; //low-power mode -static const uint8_t CTRL_REG3_DEFAULT = 0; - -/* CTRL_REG4 bits */ -//big/little endian data selection enabled = MSb at lower adress -static const uint8_t BLE = 1; -static const uint8_t OMZ0 = 2; //Z operating mode bit 2 -static const uint8_t OMZ1 = 3; //Z operating mode bit 3 -static const uint8_t CTRL_REG4_DEFAULT = (1 << OMZ1); - -/* CTRL_REG5 bits */ -static const uint8_t BDU = 6; //Block data update -static const uint8_t FAST_READ = 7; //Fast read enabled = 1 -static const uint8_t CTRL_REG5_DEFAULT = 0; - -static const uint32_t MGM_DATA_SET_ID = READ_CONFIG_AND_DATA; - -enum MgmPoolIds: lp_id_t { - FIELD_STRENGTH_X, - FIELD_STRENGTH_Y, - FIELD_STRENGTH_Z, - TEMPERATURE_CELCIUS -}; - -class MgmPrimaryDataset: public StaticLocalDataSet<5> { -public: - MgmPrimaryDataset(HasLocalDataPoolIF* hkOwner): - StaticLocalDataSet(hkOwner, MGM_DATA_SET_ID) {} - - MgmPrimaryDataset(object_id_t mgmId): - StaticLocalDataSet(sid_t(mgmId, MGM_DATA_SET_ID)) {} - - lp_var_t fieldStrengthX = lp_var_t(sid.objectId, - FIELD_STRENGTH_X, this); - lp_var_t fieldStrengthY = lp_var_t(sid.objectId, - FIELD_STRENGTH_Y, this); - lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, - FIELD_STRENGTH_Z, this); - lp_var_t temperature = lp_var_t(sid.objectId, - TEMPERATURE_CELCIUS, this); -}; - -} - - -#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_ */ From 5cb6ab841656bf0b68f2b95f16cb15426aeb7bce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 17 Sep 2021 13:08:03 +0200 Subject: [PATCH 11/15] more acs tests --- fsfw | 2 +- .../pollingSequenceFactory.cpp | 102 +++++++++--------- tmtc | 2 +- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/fsfw b/fsfw index b1a56a71..7d44aab9 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit b1a56a71cdba538e82b4052413e1663b34cfee90 +Subproject commit 7d44aab98e6861bc7999541e97085ba5a62b6633 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index a0064fc5..f45f5f32 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,16 +425,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -447,27 +447,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -// -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -480,16 +480,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -502,16 +502,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { diff --git a/tmtc b/tmtc index a5d9fedc..3f29dff6 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a5d9fedc649966c901a7ede9bbbe915df9ed9446 +Subproject commit 3f29dff6067e8c6a486deda93f071b705b7dc699 From 87d00dbceea39685362130d5c74da34bf5594c97 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 17 Sep 2021 16:53:15 +0200 Subject: [PATCH 12/15] some more acs board tests --- fsfw | 2 +- linux/boardtest/SpiTestClass.cpp | 2 +- .../pollingSequenceFactory.cpp | 22 +++++++++---------- tmtc | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fsfw b/fsfw index 7d44aab9..e8050183 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7d44aab98e6861bc7999541e97085ba5a62b6633 +Subproject commit e8050183f4f54452caceba67a9d4da50bd230770 diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 08d7c14c..bdd9a2dd 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -24,7 +24,7 @@ gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::MGM_RM3100; + testMode = TestModes::MGM_LIS3MDL; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index f45f5f32..0d189476 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -447,16 +447,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -479,7 +479,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // DeviceHandlerIF::SEND_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, diff --git a/tmtc b/tmtc index 3f29dff6..58da80cb 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 3f29dff6067e8c6a486deda93f071b705b7dc699 +Subproject commit 58da80cb9e2426e6b9d7fc1efb661077c35541f5 From 487b6fd5caa1f0731ff6703ad59dc4c913eb3704 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 11:22:11 +0200 Subject: [PATCH 13/15] updated print commands for PDUs --- mission/devices/GomspaceDeviceHandler.cpp | 10 +- mission/devices/PDU1Handler.cpp | 81 +++++++---- mission/devices/PDU1Handler.h | 4 +- mission/devices/PDU2Handler.cpp | 136 ++++++------------ mission/devices/PDU2Handler.h | 4 +- .../devicedefinitions/GomspaceDefinitions.h | 8 +- tmtc | 2 +- 7 files changed, 108 insertions(+), 137 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 72c2766e..348bd35e 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -75,10 +75,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } - case(GOMSPACE::PRINT_OUT_ENB_STATUS): - case(GOMSPACE::PRINT_ALL): - case(GOMSPACE::PRINT_OUT_CURRENTS): - case(GOMSPACE::PRINT_OUT_VOLTAGES): { + case(GOMSPACE::PRINT_HK_TABLE): { result = printStatus(deviceCommand); break; } @@ -102,10 +99,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); - this->insertInCommandMap(GOMSPACE::PRINT_ALL); - this->insertInCommandMap(GOMSPACE::PRINT_OUT_ENB_STATUS); - this->insertInCommandMap(GOMSPACE::PRINT_OUT_VOLTAGES); - this->insertInCommandMap(GOMSPACE::PRINT_OUT_CURRENTS); + this->insertInCommandMap(GOMSPACE::PRINT_HK_TABLE); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index 8df972e5..378a9589 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -1,7 +1,7 @@ -#include +#include "OBSWConfig.h" #include "PDU1Handler.h" -#include -#include + +#include PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, @@ -72,27 +72,6 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac #endif } -void PDU1Handler::printOutputSwitchStates() { - sif::info << "PDU1 TCS Board switch: " << - static_cast(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl; - sif::info << "PDU1 Syrlinks switch: " << - static_cast(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl; - sif::info << "PDU1 star tracker switch: " << - static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl; - sif::info << "PDU1 MGT switch: " << - static_cast(pdu1HkTableDataset.outEnabledMGT.value) << std::endl; - sif::info << "PDU1 SUS nominal switch: " << - static_cast(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl; - sif::info << "PDU1 solar cell experiment switch: " << - static_cast(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl; - sif::info << "PDU1 PLOC switch: " << - static_cast(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl; - sif::info << "PDU1 ACS Side A switch: " << - static_cast(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl; - sif::info << "PDU1 channel 8 switch: " << - static_cast(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl; -} - void PDU1Handler::parseHkTableReply(const uint8_t *packet) { uint16_t dataOffset = 0; PoolReadGuard pg(&pdu1HkTableDataset); @@ -356,14 +335,14 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool( ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + case(GOMSPACE::PRINT_HK_TABLE): { PoolReadGuard pg(&pdu1HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { sif::warning << "Reading PDU1 HK table failed!" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } - printOutputSwitchStates(); + printHkTable(); return HasReturnvaluesIF::RETURN_OK; } default: { @@ -371,3 +350,53 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { } } } + +void PDU1Handler::printHkTable() { + sif::info << "PDU1 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << std::setw(30) << std::left << "TCS Board" << std::dec << "| " << + unsigned(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutTCSBoard3V3.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutTCSBoard3V3.value << std::endl; + sif::info << std::setw(30) << std::left << "Syrlinks" << std::dec << "| " << + unsigned(pdu1HkTableDataset.outEnabledSyrlinks.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutSyrlinks.value << ", " << std::setw(4) << + pdu1HkTableDataset.currentOutSyrlinks.value << std::endl; + sif::info << std::setw(30) << std::left << "Star Tracker" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutStarTracker.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutStarTracker.value << std::endl; + sif::info << std::setw(30) << std::left << "MGT" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledMGT.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutMGT.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutMGT.value << std::endl; + sif::info << std::setw(30) << std::left << "SuS nominal" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledSUSNominal.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutSUSNominal.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutSUSNominal.value << std::endl; + sif::info << std::setw(30) << std::left << "Solar Cell Experiment" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledSolarCellExp.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutSolarCellExp.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutSolarCellExp.value << std::endl; + sif::info << std::setw(30) << std::left << "PLOC" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledPLOC.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutPLOC.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutPLOC.value << std::endl; + sif::info << std::setw(30) << std::left << "ACS Side A" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutACSBoardSideA.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutACSBoardSideA.value << std::endl; + sif::info << std::setw(30) << std::left << "Channel 8" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledChannel8.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutChannel8.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutChannel8.value << std::right << std::endl; +} + diff --git a/mission/devices/PDU1Handler.h b/mission/devices/PDU1Handler.h index fa73b584..3df99776 100644 --- a/mission/devices/PDU1Handler.h +++ b/mission/devices/PDU1Handler.h @@ -2,7 +2,7 @@ #define MISSION_DEVICES_PDU1Handler_H_ #include "GomspaceDeviceHandler.h" -#include +#include "devicedefinitions/GomspaceDefinitions.h" /** * @brief This is the device handler for the PDU1. @@ -38,7 +38,7 @@ private: /** Dataset for the housekeeping table of the PDU1 */ PDU1::PDU1HkTableDataset pdu1HkTableDataset; - void printOutputSwitchStates(); + void printHkTable(); void parseHkTableReply(const uint8_t *packet); }; diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 06e60002..15166323 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -312,46 +312,14 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_ALL): { + case(GOMSPACE::PRINT_HK_TABLE): { PoolReadGuard pg(&pdu2HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; + sif::warning << "Reading PDU1 HK table failed!" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } - printOutputSwitchStates(); - printOutputCurrents(); - printOutputVoltages(); - return HasReturnvaluesIF::RETURN_OK; - } - case(GOMSPACE::PRINT_OUT_ENB_STATUS): { - PoolReadGuard pg(&pdu2HkTableDataset); - ReturnValue_t readResult = pg.getReadResult(); - if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - printOutputSwitchStates(); - return HasReturnvaluesIF::RETURN_OK; - } - case(GOMSPACE::PRINT_OUT_CURRENTS): { - PoolReadGuard pg(&pdu2HkTableDataset); - ReturnValue_t readResult = pg.getReadResult(); - if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - printOutputCurrents(); - return HasReturnvaluesIF::RETURN_OK; - } - case(GOMSPACE::PRINT_OUT_VOLTAGES): { - PoolReadGuard pg(&pdu2HkTableDataset); - ReturnValue_t readResult = pg.getReadResult(); - if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - printOutputVoltages(); + printHkTable(); return HasReturnvaluesIF::RETURN_OK; } default: { @@ -360,67 +328,51 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { } } -void PDU2Handler::printOutputSwitchStates() { - sif::info << "PDU2 Q7S enable state: " << - unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << std::endl; - sif::info << "PDU2 Payload PCDU channel 1 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << std::endl; - sif::info << "PDU2 reaction wheels enable state: " - << unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << std::endl; - sif::info << "PDU2 TCS Board 8V heater input enable state: " - << unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << std::endl; - sif::info << "PDU2 redundant SUS group enable state: " - << unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << std::endl; - sif::info << "PDU2 deployment mechanism enable state: " - << unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << std::endl; - sif::info << "PDU2 PCDU channel 6 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << std::endl; - sif::info << "PDU2 ACS board side B enable state: " - << unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << std::endl; - sif::info << "PDU2 payload camera enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; -} - -void PDU2Handler::printOutputCurrents() { - sif::info << "Printing PDU2 currents [mA]: " << std::endl; - sif::info << "PDU2 Q7S:" << - pdu2HkTableDataset.currentOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << - pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW:" << - pdu2HkTableDataset.currentOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In:" << - pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant:" << - pdu2HkTableDataset.currentOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism:" << - pdu2HkTableDataset.currentOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << - pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board:" << - pdu2HkTableDataset.currentOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera:" << - pdu2HkTableDataset.currentOutPayloadCamera.value << std::endl; -} - -void PDU2Handler::printOutputVoltages() { - sif::info << "Printing PDU2 voltages [mV]: " << std::endl; - sif::info << "PDU2 Q7S:" << - pdu2HkTableDataset.voltageOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << +void PDU2Handler::printHkTable() { + sif::info << "PDU2 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << std::setw(30) << std::left << "Q7S" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutQ7S.value << ", " << std::setw(4) << + pdu2HkTableDataset.voltageOutQ7S.value << std::endl; + sif::info << std::setw(30) << std::left << "Payload PCDU Channel 1" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW:" << + sif::info << std::setw(30) << std::left << "Reaction Wheels" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutReactionWheels.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In:" << + sif::info << std::setw(30) << std::left << "TCS Board 8V heater input" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant:" << + sif::info << std::setw(30) << std::left << "Redundant SUS group" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutSUSRedundant.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism:" << + sif::info << std::setw(30) << std::left << "Deployment mechanism" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutDeplMechanism.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << - pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board voltage:" << + sif::info << std::setw(30) << std::left << "Payload PCDU Channel 6" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << ", " << std::setw(4) << + pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value<< std::endl; + sif::info << std::setw(30) << std::left << "ACS Board Side B" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutACSBoardSideB.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera voltage:" << - pdu2HkTableDataset.voltageOutPayloadCamera.value << std::endl; + sif::info << std::setw(30) << std::left << "Payload Camera enable state" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutPayloadCamera.value << ", " << std::setw(4) << + pdu2HkTableDataset.voltageOutPayloadCamera.value << std::right << std::endl; } diff --git a/mission/devices/PDU2Handler.h b/mission/devices/PDU2Handler.h index 93f9200e..c44d1267 100644 --- a/mission/devices/PDU2Handler.h +++ b/mission/devices/PDU2Handler.h @@ -39,9 +39,7 @@ private: /** Dataset for the housekeeping table of the PDU2 */ PDU2::PDU2HkTableDataset pdu2HkTableDataset; - void printOutputSwitchStates(); - void printOutputCurrents(); - void printOutputVoltages(); + void printHkTable(); void parseHkTableReply(const uint8_t *packet); }; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 5f067bed..e14745a4 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -9,7 +9,7 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ -#include +#include #include #include #include @@ -33,10 +33,8 @@ static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_ALL = 32; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_ENB_STATUS = 33; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_CURRENTS = 34; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_VOLTAGES = 35; //!< [EXPORT] : [COMMAND] +//!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console +static const DeviceCommandId_t PRINT_HK_TABLE = 32; } diff --git a/tmtc b/tmtc index 58da80cb..f3a2e755 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 58da80cb9e2426e6b9d7fc1efb661077c35541f5 +Subproject commit f3a2e755fdc73ee791ea32dc6f2dfce43af70e60 From cbb7fdfa9969ff090ed2b2f079cabc8dfee4ae05 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 11:47:19 +0200 Subject: [PATCH 14/15] p60 print command --- mission/devices/GomspaceDeviceHandler.cpp | 4 +- mission/devices/P60DockHandler.cpp | 101 ++++++++++++++++-- mission/devices/P60DockHandler.h | 8 ++ mission/devices/PDU1Handler.cpp | 2 +- mission/devices/PDU2Handler.cpp | 2 +- .../devicedefinitions/GomspaceDefinitions.h | 5 +- tmtc | 2 +- 7 files changed, 109 insertions(+), 15 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 348bd35e..e5912969 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -75,7 +75,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { result = printStatus(deviceCommand); break; } @@ -99,7 +99,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); - this->insertInCommandMap(GOMSPACE::PRINT_HK_TABLE); + this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 357bee30..928a9883 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -1,3 +1,4 @@ +#include #include "P60DockHandler.h" #include "OBSWConfig.h" @@ -27,15 +28,24 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t * #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_P60DOCK == 1 p60dockHkTableDataset.read(); - sif::info << "P60 Dock: ACU VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl; - sif::info << "P60 Dock: PDU1 VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl; - sif::info << "P60 Dock: PDU2 VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl; - sif::info << "P60 Dock: ACU VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl; - sif::info << "P60 Dock: PDU1 VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl; - sif::info << "P60 Dock: PDU2 VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl; - sif::info << "P60 Dock: Stack VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl; - sif::info << "P60 Dock: Stack 3V3 switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl; - sif::info << "P60 Dock: Stack 5V switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl; + sif::info << "P60 Dock: ACU VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl; + sif::info << "P60 Dock: PDU1 VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl; + sif::info << "P60 Dock: PDU2 VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl; + sif::info << "P60 Dock: ACU VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl; + sif::info << "P60 Dock: PDU1 VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl; + sif::info << "P60 Dock: PDU2 VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl; + sif::info << "P60 Dock: Stack VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl; + sif::info << "P60 Dock: Stack 3V3 switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl; + sif::info << "P60 Dock: Stack 5V switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl; float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1; sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl; @@ -395,3 +405,76 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool( return HasReturnvaluesIF::RETURN_OK; } + + +ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) { + switch(cmd) { + case(GOMSPACE::PRINT_SWITCH_V_I): { + PoolReadGuard pg(&p60dockHkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU1 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printHkTable(); + return HasReturnvaluesIF::RETURN_OK; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} + +void P60DockHandler::printHkTable() { + sif::info << "P60 Dock Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + + sif::info << std::setw(30) << std::left << "ACU VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentAcuVcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageAcuVcc.value << std::endl; + sif::info << std::setw(30) << std::left << "ACU VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentAcuVbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageAcuVbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "PDU1 VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu1Vcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu1Vcc.value << std::endl; + sif::info << std::setw(30) << std::left << "PDU1 VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu1Vbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu1Vbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "PDU2 VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu2Vcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu2Vcc.value << std::endl; + sif::info << std::setw(30) << std::left << "PDU2 VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu2Vbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu2Vbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "Stack VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStackVbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStackVbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStackVbat.value << std::endl; + sif::info << std::setw(30) << std::left << "Stack 3V3" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStack3V3.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStack3V3.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStack3V3.value << std::endl; + sif::info << std::setw(30) << std::left << "Stack 5V" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStack5V.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStack5V.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStack5V.value << std::endl; +} + diff --git a/mission/devices/P60DockHandler.h b/mission/devices/P60DockHandler.h index 6326e407..cee0ecec 100644 --- a/mission/devices/P60DockHandler.h +++ b/mission/devices/P60DockHandler.h @@ -26,6 +26,14 @@ protected: virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + /** + * This command handles printing the HK table to the console. This is useful for debugging + * purposes + * @return + */ + ReturnValue_t printStatus(DeviceCommandId_t cmd) override; + + void printHkTable(); private: P60Dock::HkTableDataset p60dockHkTableDataset; diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index 378a9589..a17b4abb 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -335,7 +335,7 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool( ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&pdu1HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 15166323..e0400b6f 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -312,7 +312,7 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&pdu2HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index e14745a4..bd509239 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -34,7 +34,7 @@ static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] //!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console -static const DeviceCommandId_t PRINT_HK_TABLE = 32; +static const DeviceCommandId_t PRINT_SWITCH_V_I = 32; } @@ -379,6 +379,9 @@ static const uint16_t HK_TABLE_REPLY_SIZE = 407; /** * @brief This class defines a dataset for the hk table of the P60 Dock. + * @details + * The GS port and X3 are not required for EIVE. X3 is another slot on the P60 dock and + * GS is required for a module from Gomspace which is not used. */ class HkTableDataset: public StaticLocalDataSet { diff --git a/tmtc b/tmtc index f3a2e755..53bf6508 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f3a2e755fdc73ee791ea32dc6f2dfce43af70e60 +Subproject commit 53bf65083889af10f77c3899972b1153ea835f3c From cf9ff87560680c3f7194ab5d179bcb5a577dec7a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 14:34:39 +0200 Subject: [PATCH 15/15] bugfixes for new print commands --- .../pollingSequenceFactory.cpp | 186 +++++++++--------- mission/devices/P60DockHandler.cpp | 2 +- mission/devices/PDU1Handler.cpp | 4 +- mission/devices/PDU2Handler.cpp | 2 +- 4 files changed, 101 insertions(+), 93 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 0d189476..727334d2 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,93 +425,101 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + bool enableAside = false; + bool enableBside = true; + if(enableAside) { + // A side + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, + // DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, + // DeviceHandlerIF::SEND_WRITE); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, + // DeviceHandlerIF::GET_WRITE); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, + // DeviceHandlerIF::SEND_READ); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, + // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + } -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -// - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + if(enableBside) { + // B side + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, + // DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, + // DeviceHandlerIF::SEND_WRITE); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, + // DeviceHandlerIF::GET_WRITE); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, + // DeviceHandlerIF::SEND_READ); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, + // DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + } #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { @@ -547,13 +555,13 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); + DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); + DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); + DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + DeviceHandlerIF::GET_READ); #endif thisSequence->addSlot(objects::PLOC_UPDATER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -563,13 +571,13 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); + DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); + DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); + DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + DeviceHandlerIF::GET_READ); #endif #if Q7S_ADD_SYRLINKS_HANDLER == 1 diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 928a9883..4ade2a0b 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -426,7 +426,7 @@ ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) { } void P60DockHandler::printHkTable() { - sif::info << "P60 Dock Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << "P60 Dock Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl; sif::info << std::setw(30) << std::left << "ACU VCC" << std::dec << "| " << unsigned(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << ", " << diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index a17b4abb..1676e488 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -352,7 +352,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { } void PDU1Handler::printHkTable() { - sif::info << "PDU1 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << "PDU1 Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl; sif::info << std::setw(30) << std::left << "TCS Board" << std::dec << "| " << unsigned(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << ", " << std::setw(4) << std::right << @@ -362,7 +362,7 @@ void PDU1Handler::printHkTable() { unsigned(pdu1HkTableDataset.outEnabledSyrlinks.value) << ", " << std::setw(4) << std::right << pdu1HkTableDataset.currentOutSyrlinks.value << ", " << std::setw(4) << - pdu1HkTableDataset.currentOutSyrlinks.value << std::endl; + pdu1HkTableDataset.voltageOutSyrlinks.value << std::endl; sif::info << std::setw(30) << std::left << "Star Tracker" << std::dec << "| " << static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << ", " << std::setw(4) << std::right << diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index e0400b6f..287fdaf3 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -329,7 +329,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { } void PDU2Handler::printHkTable() { - sif::info << "PDU2 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << "PDU2 Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl; sif::info << std::setw(30) << std::left << "Q7S" << std::dec << "| " << unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << ", " << std::setw(4) << std::right <<