some more testing and bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-10-14 14:55:37 +02:00
parent 99f703a2eb
commit 3cff1c48e9
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
9 changed files with 100 additions and 87 deletions

View File

@ -36,8 +36,8 @@ static constexpr uint32_t MAX_FILENAME_SIZE = 50;
static constexpr uint32_t SA_DEPL_INIT_BUFFER_SECS = 120;
// Burn time for autonomous deployment
static constexpr uint32_t SA_DEPL_BURN_TIME_SECS = 180;
static constexpr uint32_t SA_DEPL_WAIT_TIME_SECS = 45 * 60;
static constexpr uint32_t SA_DEPL_BURN_TIME_SECS = 60; // 180;
static constexpr uint32_t SA_DEPL_WAIT_TIME_SECS = 90; // 45 * 60;
// HW constraints (current limit) mean that the GPIO channels need to be switched on in alternation
static constexpr uint32_t SA_DEPL_CHANNEL_ALTERNATION_INTERVAL_SECS = 5;
// Maximum allowed burn time allowed by the software.

View File

@ -100,6 +100,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
11505;0x2cf1;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;;mission/devices/SolarArrayDeploymentHandler.h
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/devices/ploc/PlocMPSoCHandler.h
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/devices/ploc/PlocMPSoCHandler.h
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/devices/ploc/PlocMPSoCHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
100 11505 0x2cf1 DEPL_SA2_GPIO_SWTICH_ON_FAILED HIGH mission/devices/SolarArrayDeploymentHandler.h
101 11506 0x2cf2 DEPL_SA1_GPIO_SWTICH_OFF_FAILED HIGH mission/devices/SolarArrayDeploymentHandler.h
102 11507 0x2cf3 DEPL_SA2_GPIO_SWTICH_OFF_FAILED HIGH mission/devices/SolarArrayDeploymentHandler.h
103 11508 0x2cf4 AUTONOMOUS_DEPLOYMENT_COMPLETED INFO mission/devices/SolarArrayDeploymentHandler.h
104 11601 0x2d51 MEMORY_READ_RPT_CRC_FAILURE LOW PLOC crc failure in telemetry packet linux/devices/ploc/PlocMPSoCHandler.h
105 11602 0x2d52 ACK_FAILURE LOW PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field linux/devices/ploc/PlocMPSoCHandler.h
106 11603 0x2d53 EXE_FAILURE LOW PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field linux/devices/ploc/PlocMPSoCHandler.h

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 228 translations.
* @brief Auto-generated event translation file. Contains 229 translations.
* @details
* Generated on: 2022-10-14 11:53:48
* Generated on: 2022-10-14 14:54:47
*/
#include "translateEvents.h"
@ -106,6 +106,7 @@ const char *DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_ON_FAI
const char *DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_ON_FAILED";
const char *DEPL_SA1_GPIO_SWTICH_OFF_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_OFF_FAILED";
const char *DEPL_SA2_GPIO_SWTICH_OFF_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_OFF_FAILED";
const char *AUTONOMOUS_DEPLOYMENT_COMPLETED_STRING = "AUTONOMOUS_DEPLOYMENT_COMPLETED";
const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE";
const char *ACK_FAILURE_STRING = "ACK_FAILURE";
const char *EXE_FAILURE_STRING = "EXE_FAILURE";
@ -434,6 +435,8 @@ const char *translateEvents(Event event) {
return DEPL_SA1_GPIO_SWTICH_OFF_FAILED_STRING;
case (11507):
return DEPL_SA2_GPIO_SWTICH_OFF_FAILED_STRING;
case (11508):
return AUTONOMOUS_DEPLOYMENT_COMPLETED_STRING;
case (11601):
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (11602):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 138 translations.
* Generated on: 2022-10-14 11:53:48
* Generated on: 2022-10-14 14:54:47
*/
#include "translateObjects.h"

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 228 translations.
* @brief Auto-generated event translation file. Contains 229 translations.
* @details
* Generated on: 2022-10-14 11:53:48
* Generated on: 2022-10-14 14:54:47
*/
#include "translateEvents.h"
@ -106,6 +106,7 @@ const char *DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_ON_FAI
const char *DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_ON_FAILED";
const char *DEPL_SA1_GPIO_SWTICH_OFF_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_OFF_FAILED";
const char *DEPL_SA2_GPIO_SWTICH_OFF_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_OFF_FAILED";
const char *AUTONOMOUS_DEPLOYMENT_COMPLETED_STRING = "AUTONOMOUS_DEPLOYMENT_COMPLETED";
const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE";
const char *ACK_FAILURE_STRING = "ACK_FAILURE";
const char *EXE_FAILURE_STRING = "EXE_FAILURE";
@ -434,6 +435,8 @@ const char *translateEvents(Event event) {
return DEPL_SA1_GPIO_SWTICH_OFF_FAILED_STRING;
case (11507):
return DEPL_SA2_GPIO_SWTICH_OFF_FAILED_STRING;
case (11508):
return AUTONOMOUS_DEPLOYMENT_COMPLETED_STRING;
case (11601):
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (11602):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 138 translations.
* Generated on: 2022-10-14 11:53:48
* Generated on: 2022-10-14 14:54:47
*/
#include "translateObjects.h"

View File

@ -60,6 +60,62 @@ ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCod
return returnvalue::OK;
}
void SolarArrayDeploymentHandler::handleStateMachine() {
if (stateMachine == MAIN_POWER_ON) {
mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
mainSwitchCountdown.setTimeout(mainLineSwitcher.getSwitchDelayMs());
stateMachine = WAIT_MAIN_POWER_ON;
sif::info << "S/A Deployment: Deployment power line on" << std::endl;
}
if (stateMachine == MAIN_POWER_OFF) {
// These should never fail
allOff();
stateMachine = WAIT_MAIN_POWER_OFF;
sif::info << "S/A Deployment: Deployment power line off" << std::endl;
}
if (stateMachine == WAIT_MAIN_POWER_ON) {
if (checkMainPowerOn()) {
if (DEBUG_MODE) {
sif::debug << "SA DEPL FSM: WAIT_MAIN_POWER_ON done -> SWITCH_DEPL_GPIOS" << std::endl;
}
stateMachine = SWITCH_DEPL_GPIOS;
}
}
if (stateMachine == WAIT_MAIN_POWER_OFF) {
if (checkMainPowerOff()) {
if (DEBUG_MODE) {
sif::debug << "SA DEPL FSM: WAIT_MAIN_POWER_OFF done -> FSM DONE" << std::endl;
}
sif::info << "S/A Deployment: FSM done" << std::endl;
finishFsm(returnvalue::OK);
}
}
if (stateMachine == SWITCH_DEPL_GPIOS) {
burnCountdown.setTimeout(fsmInfo.burnCountdownMs);
// This should never fail
channelAlternationCd.resetTimer();
if (not fsmInfo.dryRun) {
sa2Off();
sa1On();
fsmInfo.alternationDummy = true;
}
sif::info << "S/A Deployment: Burning" << std::endl;
triggerEvent(BURN_PHASE_START, fsmInfo.burnCountdownMs, fsmInfo.dryRun);
stateMachine = BURNING;
}
if (stateMachine == BURNING) {
saGpioAlternation();
if (burnCountdown.hasTimedOut()) {
if (DEBUG_MODE) {
sif::debug << "SA DEPL FSM: BURNING done -> WAIT_MAIN_POWER_OFF" << std::endl;
}
allOff();
triggerEvent(BURN_PHASE_DONE, fsmInfo.burnCountdownMs, fsmInfo.dryRun);
stateMachine = WAIT_MAIN_POWER_OFF;
}
}
}
ReturnValue_t SolarArrayDeploymentHandler::performAutonomousDepl(sd::SdCard sdCard, bool dryRun) {
using namespace std::filesystem;
using namespace std;
@ -72,21 +128,22 @@ ReturnValue_t SolarArrayDeploymentHandler::performAutonomousDepl(sd::SdCard sdCa
if (not exists(SD_0_DEPLY_INFO)) {
initFile(SD_0_DEPLY_INFO);
}
if (not autonomousDeplForFile(SD_0_DEPLY_INFO, dryRun)) {
if (not autonomousDeplForFile(sd::SdCard::SLOT_0, SD_0_DEPLY_INFO, dryRun)) {
initFile(SD_0_DEPLY_INFO);
}
} else if (sdCard == sd::SdCard::SLOT_1) {
if (not exists(SD_1_DEPLY_INFO)) {
initFile(SD_1_DEPLY_INFO);
}
if (not autonomousDeplForFile(SD_1_DEPLY_INFO, dryRun)) {
if (not autonomousDeplForFile(sd::SdCard::SLOT_1, SD_1_DEPLY_INFO, dryRun)) {
initFile(SD_1_DEPLY_INFO);
}
}
return returnvalue::OK;
}
bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename, bool dryRun) {
bool SolarArrayDeploymentHandler::autonomousDeplForFile(sd::SdCard sdCard, const char* filename,
bool dryRun) {
using namespace std;
ifstream file(filename);
string line;
@ -166,6 +223,15 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename, bo
startFsmOff();
}
}
if (deplState == AutonomousDeplState::DONE) {
remove(filename);
if (sdCard == sd::SdCard::SLOT_0) {
remove(SD_0_DEPL_FILE);
} else {
remove(SD_1_DEPL_FILE);
}
triggerEvent(AUTONOMOUS_DEPLOYMENT_COMPLETED);
} else {
std::ofstream of(filename);
of << "phase: ";
if (deplState == AutonomousDeplState::INIT) {
@ -176,69 +242,12 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename, bo
of << PHASE_WAIT_STR << "\n";
} else if (deplState == AutonomousDeplState::SECOND_BURN) {
of << PHASE_SECOND_BURN_STR << "\n";
} else if (deplState == AutonomousDeplState::DONE) {
of << PHASE_DONE << "\n";
}
of << "secs_since_start: " << std::to_string(secsSinceBoot) << "\n";
}
return true;
}
void SolarArrayDeploymentHandler::handleStateMachine() {
if (stateMachine == MAIN_POWER_ON) {
mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
mainSwitchCountdown.setTimeout(mainLineSwitcher.getSwitchDelayMs());
stateMachine = WAIT_MAIN_POWER_ON;
sif::info << "S/A Deployment: Deployment power line on" << std::endl;
}
if (stateMachine == MAIN_POWER_OFF) {
// These should never fail
allOff();
stateMachine = WAIT_MAIN_POWER_OFF;
sif::info << "S/A Deployment: Deployment power line off" << std::endl;
}
if (stateMachine == WAIT_MAIN_POWER_ON) {
if (checkMainPowerOn()) {
if (DEBUG_MODE) {
sif::debug << "SA DEPL FSM: WAIT_MAIN_POWER_ON done -> SWITCH_DEPL_GPIOS" << std::endl;
}
stateMachine = SWITCH_DEPL_GPIOS;
}
}
if (stateMachine == WAIT_MAIN_POWER_OFF) {
if (checkMainPowerOff()) {
if (DEBUG_MODE) {
sif::debug << "SA DEPL FSM: WAIT_MAIN_POWER_OFF done -> FSM DONE" << std::endl;
}
sif::info << "S/A Deployment: FSM done" << std::endl;
finishFsm(returnvalue::OK);
}
}
if (stateMachine == SWITCH_DEPL_GPIOS) {
burnCountdown.setTimeout(fsmInfo.burnCountdownMs);
// This should never fail
channelAlternationCd.resetTimer();
if (not fsmInfo.dryRun) {
sa2Off();
sa1On();
fsmInfo.alternationDummy = true;
}
sif::info << "S/A Deployment: Burning" << std::endl;
triggerEvent(BURN_PHASE_START, fsmInfo.burnCountdownMs, fsmInfo.dryRun);
stateMachine = BURNING;
}
if (stateMachine == BURNING) {
saGpioAlternation();
if (burnCountdown.hasTimedOut()) {
if (DEBUG_MODE) {
sif::debug << "SA DEPL FSM: BURNING done -> WAIT_MAIN_POWER_OFF" << std::endl;
}
allOff();
triggerEvent(BURN_PHASE_DONE, fsmInfo.burnCountdownMs, fsmInfo.dryRun);
stateMachine = WAIT_MAIN_POWER_OFF;
}
}
}
bool SolarArrayDeploymentHandler::checkMainPowerOn() { return checkMainPower(true); }
bool SolarArrayDeploymentHandler::checkMainPowerOff() { return checkMainPower(false); }
@ -276,7 +285,6 @@ bool SolarArrayDeploymentHandler::startFsmOn(uint32_t burnCountdownSecs, bool dr
if (burnCountdownSecs > config::SA_DEPL_MAX_BURN_TIME) {
burnCountdownSecs = config::SA_DEPL_MAX_BURN_TIME;
}
fsmInfo.onOff = true;
fsmInfo.dryRun = dryRun;
fsmInfo.burnCountdownMs = burnCountdownSecs * 1000;
stateMachine = StateMachine::MAIN_POWER_ON;
@ -289,7 +297,6 @@ void SolarArrayDeploymentHandler::startFsmOff() {
// off commands override the state machine. Cancel any active action commands.
finishFsm(returnvalue::FAILED);
}
fsmInfo.onOff = false;
retryCounter = 0;
stateMachine = StateMachine::MAIN_POWER_OFF;
}
@ -298,7 +305,6 @@ void SolarArrayDeploymentHandler::finishFsm(ReturnValue_t resultForActionHelper)
retryCounter = 0;
stateMachine = StateMachine::IDLE;
fsmInfo.dryRun = false;
fsmInfo.onOff = false;
fsmInfo.alternationDummy = false;
if (actionActive) {
bool success = false;

View File

@ -117,8 +117,6 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
struct FsmInfo {
// Not required anymore
// DeploymentChannels channel;
// false if OFF, true is ON
bool onOff;
bool dryRun;
bool alternationDummy = false;
uint32_t burnCountdownMs = config::SA_DEPL_MAX_BURN_TIME;
@ -147,6 +145,8 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
event::makeEvent(SUBSYSTEM_ID, 6, severity::HIGH);
static constexpr Event DEPL_SA2_GPIO_SWTICH_OFF_FAILED =
event::makeEvent(SUBSYSTEM_ID, 7, severity::HIGH);
static constexpr Event AUTONOMOUS_DEPLOYMENT_COMPLETED =
event::makeEvent(SUBSYSTEM_ID, 8, severity::INFO);
FsmInfo fsmInfo;
StateMachine stateMachine = IDLE;
@ -164,7 +164,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
ReturnValue_t performAutonomousDepl(sd::SdCard sdCard, bool dryRun);
bool dryRunStringInFile(const char* filename);
bool autonomousDeplForFile(const char* filename, bool dryRun);
bool autonomousDeplForFile(sd::SdCard sdCard, const char* filename, bool dryRun);
/**
* This countdown is used to check if the PCDU sets the 8V line on in the intended time.
*/

2
tmtc

@ -1 +1 @@
Subproject commit 772c86ab04c453b12459d65327fdaaf4d1472279
Subproject commit 646cf1a14e0fa61d5e91e26a46017be557bad642