instructions unclear, wrote a whole state machine
This commit is contained in:
parent
4ee84c0a78
commit
f4abb3fed6
@ -70,6 +70,9 @@ void EiveSystem::performChildOperation() {
|
|||||||
}
|
}
|
||||||
pdecRecoveryLogic();
|
pdecRecoveryLogic();
|
||||||
i2cRecoveryLogic();
|
i2cRecoveryLogic();
|
||||||
|
if (forcePlOffState != ForcePlOffState::NONE) {
|
||||||
|
forceOffPayload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EiveSystem::initialize() {
|
ReturnValue_t EiveSystem::initialize() {
|
||||||
@ -203,7 +206,7 @@ void EiveSystem::handleEventMessages() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case power::POWER_LEVEL_LOW: {
|
case power::POWER_LEVEL_LOW: {
|
||||||
forceOffPayload();
|
forcePlOffState = ForcePlOffState::FORCE_ALL_EXCEPT_SUPV_OFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case power::POWER_LEVEL_CRITICAL:
|
case power::POWER_LEVEL_CRITICAL:
|
||||||
@ -403,37 +406,45 @@ void EiveSystem::pdecRecoveryLogic() {
|
|||||||
|
|
||||||
void EiveSystem::forceOffPayload() {
|
void EiveSystem::forceOffPayload() {
|
||||||
CommandMessage msg;
|
CommandMessage msg;
|
||||||
|
ReturnValue_t result;
|
||||||
// set PL to faulty
|
// set PL to faulty
|
||||||
HealthMessage::setHealthMessage(&msg, HealthMessage::HEALTH_SET, HasHealthIF::FAULTY);
|
HealthMessage::setHealthMessage(&msg, HealthMessage::HEALTH_SET, HasHealthIF::FAULTY);
|
||||||
|
|
||||||
ReturnValue_t result = commandQueue->sendMessage(plPcduQueueId, &msg);
|
if (forcePlOffState == ForcePlOffState::FORCE_ALL_EXCEPT_SUPV_OFF) {
|
||||||
if (result != returnvalue::OK) {
|
result = commandQueue->sendMessage(plocMpsocQueueId, &msg);
|
||||||
sif::error << "EIVE System: Sending FAULTY command to PL PCDU failed" << std::endl;
|
if (result != returnvalue::OK) {
|
||||||
|
sif::error << "EIVE System: Sending FAULTY command to PLOC MPSOC failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = commandQueue->sendMessage(cameraQueueId, &msg);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
sif::error << "EIVE System: Sending FAULTY command to PL CAM failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = commandQueue->sendMessage(scexQueueId, &msg);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
sif::error << "EIVE System: Sending FAULTY command to SCEX failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = commandQueue->sendMessage(radSensorQueueId, &msg);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
sif::error << "EIVE System: Sending FAULTY command to RAD SENSOR failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = commandQueue->sendMessage(plPcduQueueId, &msg);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
sif::error << "EIVE System: Sending FAULTY command to PL PCDU failed" << std::endl;
|
||||||
|
}
|
||||||
|
forcePlOffState = ForcePlOffState::WAITING;
|
||||||
|
supvOffDelay.resetTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
result = commandQueue->sendMessage(plocMpsocQueueId, &msg);
|
if (forcePlOffState == ForcePlOffState::WAITING and supvOffDelay.hasTimedOut()) {
|
||||||
if (result != returnvalue::OK) {
|
forcePlOffState == ForcePlOffState::FORCE_SUPV_OFF;
|
||||||
sif::error << "EIVE System: Sending FAULTY command to PLOC MPSOC failed" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = commandQueue->sendMessage(plocSupervisorQueueId, &msg);
|
if (forcePlOffState == ForcePlOffState::FORCE_SUPV_OFF) {
|
||||||
if (result != returnvalue::OK) {
|
result = commandQueue->sendMessage(plocSupervisorQueueId, &msg);
|
||||||
sif::error << "EIVE System: Sending FAULTY command to PLOC SUPERVISOR failed" << std::endl;
|
if (result != returnvalue::OK) {
|
||||||
}
|
sif::error << "EIVE System: Sending FAULTY command to PLOC SUPERVISOR failed" << std::endl;
|
||||||
|
}
|
||||||
result = commandQueue->sendMessage(cameraQueueId, &msg);
|
forcePlOffState = ForcePlOffState::NONE;
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
sif::error << "EIVE System: Sending FAULTY command to PL CAM failed" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = commandQueue->sendMessage(scexQueueId, &msg);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
sif::error << "EIVE System: Sending FAULTY command to SCEX failed" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = commandQueue->sendMessage(radSensorQueueId, &msg);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
sif::error << "EIVE System: Sending FAULTY command to RAD SENSOR failed" << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@ class EiveSystem : public Subsystem, public HasActionsIF {
|
|||||||
[[nodiscard]] MessageQueueId_t getCommandQueue() const override;
|
[[nodiscard]] MessageQueueId_t getCommandQueue() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum class ForcePlOffState {
|
||||||
|
NONE,
|
||||||
|
FORCE_ALL_EXCEPT_SUPV_OFF,
|
||||||
|
WAITING,
|
||||||
|
FORCE_SUPV_OFF
|
||||||
|
} forcePlOffState = ForcePlOffState::NONE;
|
||||||
enum class I2cRebootState {
|
enum class I2cRebootState {
|
||||||
NONE,
|
NONE,
|
||||||
SYSTEM_MODE_BOOT,
|
SYSTEM_MODE_BOOT,
|
||||||
@ -37,6 +43,7 @@ class EiveSystem : public Subsystem, public HasActionsIF {
|
|||||||
bool alreadyTriedI2cRecovery = false;
|
bool alreadyTriedI2cRecovery = false;
|
||||||
|
|
||||||
uint8_t frameDirtyErrorCounter = 0;
|
uint8_t frameDirtyErrorCounter = 0;
|
||||||
|
Countdown supvOffDelay = Countdown(3000);
|
||||||
Countdown frameDirtyCheckCd = Countdown(10000);
|
Countdown frameDirtyCheckCd = Countdown(10000);
|
||||||
// If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that
|
// If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that
|
||||||
// only a full reboot will fix the issue.
|
// only a full reboot will fix the issue.
|
||||||
|
Loading…
Reference in New Issue
Block a user