small fix in power state machine

This commit is contained in:
Robin Müller 2022-03-17 10:48:35 +01:00
parent dabc3e1fbc
commit 4fef5781a8
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
6 changed files with 39 additions and 31 deletions

View File

@ -312,9 +312,12 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF,
spiCookieRadSensor, gpioComIF);
static_cast<void>(radSensor);
#if OBSW_TEST_RAD_SENSOR == 1
// The radiation sensor ADC is powered by the 5V stack connector which should always be on
radSensor->setStartUpImmediately();
// It's a simple sensor, so just to to normal mode immediately
radSensor->setToGoToNormalModeImmediately();
#if OBSW_DEBUG_RAD_SENSOR == 1
radSensor->enablePeriodicDataPrint(true);
#endif
}

View File

@ -54,7 +54,7 @@ debugging. */
#define OBSW_ADD_RW 0
#define OBSW_ADD_RTD_DEVICES 1
#define OBSW_ADD_TMP_DEVICES 0
#define OBSW_ADD_RAD_SENSORS 0
#define OBSW_ADD_RAD_SENSORS 1
#define OBSW_ADD_PL_PCDU 0
#define OBSW_ADD_SYRLINKS 0
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
@ -99,7 +99,7 @@ debugging. */
#define OBSW_DEBUG_SUS 0
#define OBSW_TEST_RTD 0
#define OBSW_DEBUG_RTD 0
#define OBSW_TEST_RAD_SENSOR 0
#define OBSW_TEST_RAD_SENSOR 1
#define OBSW_DEBUG_RAD_SENSOR 0
#define OBSW_TEST_PL_PCDU 0
#define OBSW_DEBUG_PL_PCDU 0

View File

@ -153,17 +153,16 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
offset += 2;
dataset.ain7 = (*(packet + offset) << 8 | *(packet + offset + 1));
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_RAD_SENSOR == 1
sif::info << "Radiation sensor temperature: " << dataset.temperatureCelcius << " °C"
<< std::endl;
sif::info << std::dec;
sif::info << "Radiation sensor ADC value channel 0: " << dataset.ain0 << std::endl;
sif::info << "Radiation sensor ADC value channel 1: " << dataset.ain1 << std::endl;
sif::info << "Radiation sensor ADC value channel 4: " << dataset.ain4 << std::endl;
sif::info << "Radiation sensor ADC value channel 5: " << dataset.ain5 << std::endl;
sif::info << "Radiation sensor ADC value channel 6: " << dataset.ain6 << std::endl;
sif::info << "Radiation sensor ADC value channel 7: " << dataset.ain7 << std::endl;
#endif
if (printPeriodicData) {
sif::info << "Radiation sensor temperature: " << dataset.temperatureCelcius << " °C"
<< std::dec << std::endl;
sif::info << "Radiation sensor ADC value channel 0: " << dataset.ain0 << std::endl;
sif::info << "Radiation sensor ADC value channel 1: " << dataset.ain1 << std::endl;
sif::info << "Radiation sensor ADC value channel 4: " << dataset.ain4 << std::endl;
sif::info << "Radiation sensor ADC value channel 5: " << dataset.ain5 << std::endl;
sif::info << "Radiation sensor ADC value channel 6: " << dataset.ain6 << std::endl;
sif::info << "Radiation sensor ADC value channel 7: " << dataset.ain7 << std::endl;
}
break;
}
default: {
@ -191,3 +190,7 @@ ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPoo
}
void RadiationSensorHandler::setToGoToNormalModeImmediately() { this->goToNormalMode = true; }
void RadiationSensorHandler::enablePeriodicDataPrint(bool enable) {
this->printPeriodicData = enable;
}

View File

@ -19,6 +19,7 @@ class RadiationSensorHandler : public DeviceHandlerBase {
GpioIF *gpioIF);
virtual ~RadiationSensorHandler();
void setToGoToNormalModeImmediately();
void enablePeriodicDataPrint(bool enable);
protected:
void doStartUp() override;
@ -40,6 +41,7 @@ class RadiationSensorHandler : public DeviceHandlerBase {
enum class InternalState { SETUP, CONFIGURED };
bool printPeriodicData = false;
RAD_SENSOR::RadSensorDataset dataset;
static const uint8_t MAX_CMD_LEN = RAD_SENSOR::READ_SIZE;
GpioIF *gpioIF = nullptr;

View File

@ -125,6 +125,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
}
switch (submode) {
case (A_SIDE): {
modeTable[ModeTableIdx::GYRO_2_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_2_B].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::GYRO_3_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_3_B].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_2_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_2_B].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_3_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_3_B].setSubmode(SUBMODE_NONE);
cmdSeq(helper.gyro0AdisIdSideA, helper.gyro0SideAMode, ModeTableIdx::GYRO_0_A);
cmdSeq(helper.gyro1L3gIdSideA, helper.gyro1SideAMode, ModeTableIdx::GYRO_1_A);
cmdSeq(helper.mgm0Lis3IdSideA, helper.mgm0SideAMode, ModeTableIdx::MGM_0_A);
@ -137,17 +145,17 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
<< std::endl;
#endif
}
modeTable[ModeTableIdx::GYRO_2_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_2_B].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::GYRO_3_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_3_B].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_2_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_2_B].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_3_B].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_3_B].setSubmode(SUBMODE_NONE);
return result;
}
case (B_SIDE): {
modeTable[ModeTableIdx::GYRO_0_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_0_A].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::GYRO_1_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_1_A].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_0_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_0_A].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_1_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_1_A].setSubmode(SUBMODE_NONE);
cmdSeq(helper.gyro2AdisIdSideB, helper.gyro2SideBMode, ModeTableIdx::GYRO_2_B);
cmdSeq(helper.gyro3L3gIdSideB, helper.gyro3SideBMode, ModeTableIdx::GYRO_3_B);
cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B);
@ -159,14 +167,6 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
<< std::endl;
#endif
}
modeTable[ModeTableIdx::GYRO_0_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_0_A].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::GYRO_1_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::GYRO_1_A].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_0_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_0_A].setSubmode(SUBMODE_NONE);
modeTable[ModeTableIdx::MGM_1_A].setMode(MODE_OFF);
modeTable[ModeTableIdx::MGM_1_A].setSubmode(SUBMODE_NONE);
return result;
}
case (DUAL_MODE): {

View File

@ -99,7 +99,7 @@ duallane::OpCodes DualLanePowerStateMachine::powerStateMachine() {
pwrSwitcher->sendSwitchCommand(SWITCH_A, PowerSwitchIF::SWITCH_OFF);
}
if (switchStateB != PowerSwitchIF::SWITCH_ON) {
pwrSwitcher->sendSwitchCommand(SWITCH_B, PowerSwitchIF::SWITCH_OFF);
pwrSwitcher->sendSwitchCommand(SWITCH_B, PowerSwitchIF::SWITCH_ON);
}
checkTimeout.resetTimer();
break;