Update Package #95

Merged
meierj merged 16 commits from mueller/update-voltage-switch-cmds into develop 2021-09-20 15:59:19 +02:00
8 changed files with 121 additions and 42 deletions
Showing only changes of commit 2aa76766af - Show all commits

View File

@ -14,7 +14,8 @@
#include "mission/core/GenericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/utility/TmFunnel.h" #include "mission/utility/TmFunnel.h"
#include <mission/devices/GPSHyperionHandler.h> #include <mission/devices/GPSHyperionHandler.h>
#include "mission/devices/MGMHandlerLIS3MDL.h" #include <mission/devices/MgmLIS3MDLHandler.h>
#include "mission/devices/MGMHandlerRM3100.h" #include "mission/devices/MGMHandlerRM3100.h"
#include "mission/devices/GyroADIS16507Handler.h" #include "mission/devices/GyroADIS16507Handler.h"

View File

@ -1,3 +1,4 @@
#include <mission/devices/MgmLIS3MDLHandler.h>
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "devConf.h" #include "devConf.h"
@ -36,7 +37,6 @@
#include "mission/devices/GyroADIS16507Handler.h" #include "mission/devices/GyroADIS16507Handler.h"
#include "mission/devices/IMTQHandler.h" #include "mission/devices/IMTQHandler.h"
#include "mission/devices/SyrlinksHkHandler.h" #include "mission/devices/SyrlinksHkHandler.h"
#include "mission/devices/MGMHandlerLIS3MDL.h"
#include "mission/devices/PlocMPSoCHandler.h" #include "mission/devices/PlocMPSoCHandler.h"
#include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.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, 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); MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie); objects::SPI_COM_IF, spiCookie, 0);
mgmLis3Handler->setStartUpImmediately(); mgmLis3Handler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, 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, 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); MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie); objects::SPI_COM_IF, spiCookie, 0);
mgmLis3Handler2->setStartUpImmediately(); mgmLis3Handler2->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,

View File

@ -1,6 +1,6 @@
target_sources(${TARGET_NAME} PUBLIC target_sources(${TARGET_NAME} PUBLIC
GPSHyperionHandler.cpp GPSHyperionHandler.cpp
MGMHandlerLIS3MDL.cpp MgmLIS3MDLHandler.cpp
GomspaceDeviceHandler.cpp GomspaceDeviceHandler.cpp
Tmp1075Handler.cpp Tmp1075Handler.cpp
PCDUHandler.cpp PCDUHandler.cpp

View File

@ -1,12 +1,11 @@
#include "MGMHandlerLIS3MDL.h" #include <mission/devices/MgmLIS3MDLHandler.h>
#include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/datapool/PoolReadGuard.h"
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
#include "fsfw/globalfunctions/PeriodicOperationDivider.h" #include "fsfw/globalfunctions/PeriodicOperationDivider.h"
#endif #endif
MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication,
object_id_t deviceCommunication, CookieIF* comCookie): CookieIF* comCookie, uint8_t switchId, uint32_t transitionDelay):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this) { dataset(this) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1

View File

@ -30,8 +30,8 @@ public:
//Notifies a command to change the setup parameters //Notifies a command to change the setup parameters
static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW); static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW);
MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, CookieIF* comCookie,
CookieIF* comCookie); uint8_t switchId, uint32_t transitionDelay = 10000);
virtual ~MGMHandlerLIS3MDL(); virtual ~MGMHandlerLIS3MDL();
protected: protected:
@ -59,6 +59,34 @@ protected:
private: private:
MGMLIS3MDL::MgmPrimaryDataset dataset; 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 */ /* Device specific commands and variables */
@ -119,24 +147,6 @@ private:
virtual ReturnValue_t setOperatingMode(const uint8_t *commandData, virtual ReturnValue_t setOperatingMode(const uint8_t *commandData,
size_t commandDataLen); 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 * We always update all registers together, so this method updates
* the rawpacket and rawpacketLen, so we just manipulate the local * the rawpacket and rawpacketLen, so we just manipulate the local
@ -145,18 +155,6 @@ private:
*/ */
ReturnValue_t prepareCtrlRegisterWrite(); 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 #if OBSW_VERBOSE_LEVEL >= 1
PeriodicOperationDivider* debugDivider; PeriodicOperationDivider* debugDivider;
#endif #endif

View File

@ -312,6 +312,18 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(
ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
switch(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): { case(GOMSPACE::PRINT_OUT_ENB_STATUS): {
PoolReadGuard pg(&pdu2HkTableDataset); PoolReadGuard pg(&pdu2HkTableDataset);
ReturnValue_t readResult = pg.getReadResult(); ReturnValue_t readResult = pg.getReadResult();
@ -322,6 +334,26 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
printOutputSwitchStates(); printOutputSwitchStates();
return HasReturnvaluesIF::RETURN_OK; 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: { default: {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
@ -348,3 +380,45 @@ void PDU2Handler::printOutputSwitchStates() {
sif::info << "PDU2 payload camera enable state: " sif::info << "PDU2 payload camera enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; << 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;
}

View File

@ -40,6 +40,9 @@ private:
PDU2::PDU2HkTableDataset pdu2HkTableDataset; PDU2::PDU2HkTableDataset pdu2HkTableDataset;
void printOutputSwitchStates(); void printOutputSwitchStates();
void printOutputCurrents();
void printOutputVoltages();
void parseHkTableReply(const uint8_t *packet); void parseHkTableReply(const uint8_t *packet);
}; };

View File

@ -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_GET = 0; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t PARAM_SET = 255; //!< [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 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]
} }