Merge remote-tracking branch 'origin/develop' into thermal_controller
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2023-03-17 17:36:51 +01:00
commit d44142ac26
17 changed files with 144 additions and 108 deletions

View File

@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
## Fixed
- SA deployment file handling: Use exceptionless API.
- Fix deadlock in SD card manager constructor: Double lock of preferred SD card lock.
## Added ## Added
- Failure of Safe Mode Ctrl will now trigger an event. As this can only be caused by sensors not - Failure of Safe Mode Ctrl will now trigger an event. As this can only be caused by sensors not
@ -28,6 +33,7 @@ will consitute of a breaking change warranting a new major release:
- I2C PST now has a polling frequency of 0.4 seconds instead of 0.2 seconds. - I2C PST now has a polling frequency of 0.4 seconds instead of 0.2 seconds.
- GS PST now has a polling frequency of 0.5 seconds instead of 1 second. - GS PST now has a polling frequency of 0.5 seconds instead of 1 second.
- Bump FSFW: merged upstream. - Bump FSFW: merged upstream.
- Move BPX battery scheduling to ACS PST to avoid clashes with IMTQ scheduling / polling
# [v1.37.2] 2023-03-14 # [v1.37.2] 2023-03-14
@ -75,6 +81,15 @@ eive-tmtc: v2.19.1
the transmitter from going off during fallbacks to the SAFE mode, which might not always be the transmitter from going off during fallbacks to the SAFE mode, which might not always be
desired. desired.
## Changed
- Initialize switch states to a special `SWITCH_STATE_UNKNOWN` (2) variable. Return
`PowerSwitchIF::SWITCH_UNKNOWN` in switch state getter if this is the state.
- Wait 1 second before commanding SAFE mode. This ensures or at least increases the chance that
the switch states were initialized.
- Dual Lane Assemblies: The returnvalues of the dual lane power state machine FSM are not ignored
anymore.
# [v1.37.0] 2023-03-11 # [v1.37.0] 2023-03-11
eive-tmtc: v2.18.1 eive-tmtc: v2.18.1

View File

@ -77,6 +77,8 @@ using gpio::Levels;
#include <mission/devices/GyrAdis1650XHandler.h> #include <mission/devices/GyrAdis1650XHandler.h>
#include <mission/devices/ImtqHandler.h> #include <mission/devices/ImtqHandler.h>
#include <mission/devices/PcduHandler.h> #include <mission/devices/PcduHandler.h>
#include <mission/devices/Pdu1Handler.h>
#include <mission/devices/Pdu2Handler.h>
#include <mission/devices/SyrlinksHandler.h> #include <mission/devices/SyrlinksHandler.h>
#include <mission/devices/devicedefinitions/rwHelpers.h> #include <mission/devices/devicedefinitions/rwHelpers.h>
#include <mission/tmtc/VirtualChannelWithQueue.h> #include <mission/tmtc/VirtualChannelWithQueue.h>
@ -105,8 +107,6 @@ using gpio::Levels;
#include "mission/devices/HeaterHandler.h" #include "mission/devices/HeaterHandler.h"
#include "mission/devices/Max31865PT1000Handler.h" #include "mission/devices/Max31865PT1000Handler.h"
#include "mission/devices/P60DockHandler.h" #include "mission/devices/P60DockHandler.h"
#include "mission/devices/PDU1Handler.h"
#include "mission/devices/PDU2Handler.h"
#include "mission/devices/PayloadPcduHandler.h" #include "mission/devices/PayloadPcduHandler.h"
#include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h" #include "mission/devices/RwHandler.h"
@ -196,17 +196,17 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie, p60Fdir); new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie, p60Fdir);
auto pdu1Fdir = new GomspacePowerFdir(objects::PDU1_HANDLER); auto pdu1Fdir = new GomspacePowerFdir(objects::PDU1_HANDLER);
PDU1Handler* pdu1handler = Pdu1Handler* pdu1handler =
new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie, pdu1Fdir); new Pdu1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie, pdu1Fdir);
auto pdu2Fdir = new GomspacePowerFdir(objects::PDU2_HANDLER); auto pdu2Fdir = new GomspacePowerFdir(objects::PDU2_HANDLER);
PDU2Handler* pdu2handler = Pdu2Handler* pdu2handler =
new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir); new Pdu2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir);
auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER); auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER);
ACUHandler* acuhandler = ACUHandler* acuhandler =
new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir); new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir);
auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50);
/** /**
* Setting PCDU devices to mode normal immediately after start up because PCDU is always * Setting PCDU devices to mode normal immediately after start up because PCDU is always

View File

@ -487,7 +487,7 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
#if OBSW_ADD_I2C_TEST_CODE == 0 #if OBSW_ADD_I2C_TEST_CODE == 0
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask( FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
"I2C_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.4, missedDeadlineFunc); "I2C_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.4, missedDeadlineFunc);
result = pst::pstI2c(i2cPst); result = pst::pstI2cProcessingSystem(i2cPst);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "scheduling::initTasks: I2C PST is empty" << std::endl; sif::warning << "scheduling::initTasks: I2C PST is empty" << std::endl;

View File

@ -37,7 +37,6 @@ SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor
sif::warning << "CoreController::sdCardInit: " sif::warning << "CoreController::sdCardInit: "
"Preferred SD card not set. Setting to 0" "Preferred SD card not set. Setting to 0"
<< std::endl; << std::endl;
setPreferredSdCard(sd::SdCard::SLOT_0);
scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sd::SdCard::SLOT_0)); scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sd::SdCard::SLOT_0));
prefSdRaw = sd::SdCard::SLOT_0; prefSdRaw = sd::SdCard::SLOT_0;

View File

@ -67,6 +67,8 @@ int obsw::obsw(int argc, char* argv[]) {
// Command the EIVE system to safe mode // Command the EIVE system to safe mode
#if OBSW_COMMAND_SAFE_MODE_AT_STARTUP == 1 #if OBSW_COMMAND_SAFE_MODE_AT_STARTUP == 1
// This ensures that the PCDU switches were updated.
TaskFactory::delayTask(1000);
commandComSubsystemRxOnly(); commandComSubsystemRxOnly();
commandEiveSystemToSafe(); commandEiveSystemToSafe();
#else #else

View File

@ -180,9 +180,11 @@ void AcsController::performSafe() {
safeCtrlFailureCounter++; safeCtrlFailureCounter++;
if (safeCtrlFailureCounter > 50) { if (safeCtrlFailureCounter > 50) {
safeCtrlFailureFlag = false; safeCtrlFailureFlag = false;
safeCtrlFailureCounter = 0;
} }
} else { } else {
safeCtrlFailureFlag = false; safeCtrlFailureFlag = false;
safeCtrlFailureCounter = 0;
} }
actuatorCmd.cmdDipolMtq(magMomMtq, cmdDipolMtqs, actuatorCmd.cmdDipolMtq(magMomMtq, cmdDipolMtqs,

View File

@ -36,31 +36,25 @@ ReturnValue_t pst::pstSyrlinks(FixedTimeslotTaskIF *thisSequence) {
// I don't think this needs to be in a PST because linux takes care of bus serialization, but // I don't think this needs to be in a PST because linux takes care of bus serialization, but
// keep it like this for now, it works // keep it like this for now, it works
ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstI2cProcessingSystem(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle // Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length); static_cast<void>(length);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.3, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.3, DeviceHandlerIF::GET_READ);
// These are actually part of another bus, but this works, so keep it like this for now // These are actually part of another bus, but this works, so keep it like this for now
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.2,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.45, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.3, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.45, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.3, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.55, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.55, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
@ -68,9 +62,9 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.65, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.7,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.65, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.7,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
// damaged // damaged
/* /*
@ -90,9 +84,9 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8, thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.85, thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.9,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.85, thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.9,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
static_cast<void>(length); static_cast<void>(length);
return thisSequence->checkSequence(); return thisSequence->checkSequence();
@ -562,6 +556,12 @@ ReturnValue_t pst::pstTcsAndAcs(FixedTimeslotTaskIF *thisSequence, AcsPstCfg cfg
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * config::spiSched::SCHED_BLOCK_8_PERIOD, thisSequence->addSlot(objects::PLPCDU_HANDLER, length * config::spiSched::SCHED_BLOCK_8_PERIOD,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * config::spiSched::SCHED_BLOCK_8_PERIOD,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * config::spiSched::SCHED_BLOCK_8_PERIOD, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * config::spiSched::SCHED_BLOCK_8_PERIOD, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * config::spiSched::SCHED_BLOCK_9_PERIOD, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * config::spiSched::SCHED_BLOCK_9_PERIOD, DeviceHandlerIF::GET_READ);
#if OBSW_ADD_RAD_SENSORS == 1 #if OBSW_ADD_RAD_SENSORS == 1
/* Radiation sensor */ /* Radiation sensor */

View File

@ -51,7 +51,7 @@ ReturnValue_t pstSyrlinks(FixedTimeslotTaskIF* thisSequence);
ReturnValue_t pstTcsAndAcs(FixedTimeslotTaskIF* thisSequence, AcsPstCfg cfg); ReturnValue_t pstTcsAndAcs(FixedTimeslotTaskIF* thisSequence, AcsPstCfg cfg);
ReturnValue_t pstI2c(FixedTimeslotTaskIF* thisSequence); ReturnValue_t pstI2cProcessingSystem(FixedTimeslotTaskIF* thisSequence);
/** /**
* Generic test PST * Generic test PST

View File

@ -5,8 +5,8 @@ target_sources(
Tmp1075Handler.cpp Tmp1075Handler.cpp
PcduHandler.cpp PcduHandler.cpp
P60DockHandler.cpp P60DockHandler.cpp
PDU1Handler.cpp Pdu1Handler.cpp
PDU2Handler.cpp Pdu2Handler.cpp
ACUHandler.cpp ACUHandler.cpp
SyrlinksHandler.cpp SyrlinksHandler.cpp
Max31865PT1000Handler.cpp Max31865PT1000Handler.cpp

View File

@ -7,7 +7,7 @@
#include <mission/devices/PcduHandler.h> #include <mission/devices/PcduHandler.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize) PcduHandler::PcduHandler(object_id_t setObjectId, size_t cmdQueueSize)
: SystemObject(setObjectId), : SystemObject(setObjectId),
poolManager(this, nullptr), poolManager(this, nullptr),
p60CoreHk(objects::P60DOCK_HANDLER), p60CoreHk(objects::P60DOCK_HANDLER),
@ -19,11 +19,12 @@ PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize)
commandQueue = QueueFactory::instance()->createMessageQueue( commandQueue = QueueFactory::instance()->createMessageQueue(
cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
pwrLock = MutexFactory::instance()->createMutex(); pwrLock = MutexFactory::instance()->createMutex();
std::memset(switchStates, SWITCH_STATE_UNKNOWN, sizeof(switchStates));
} }
PCDUHandler::~PCDUHandler() {} PcduHandler::~PcduHandler() {}
ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { ReturnValue_t PcduHandler::performOperation(uint8_t counter) {
if (counter == DeviceHandlerIF::PERFORM_OPERATION) { if (counter == DeviceHandlerIF::PERFORM_OPERATION) {
readCommandQueue(); readCommandQueue();
} }
@ -51,7 +52,7 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) {
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PCDUHandler::initialize() { ReturnValue_t PcduHandler::initialize() {
ReturnValue_t result; ReturnValue_t result;
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE); IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
@ -99,7 +100,7 @@ ReturnValue_t PCDUHandler::initialize() {
return returnvalue::OK; return returnvalue::OK;
} }
void PCDUHandler::initializeSwitchStates() { void PcduHandler::initializeSwitchStates() {
using namespace pcdu; using namespace pcdu;
try { try {
for (uint8_t idx = 0; idx < power::NUMBER_OF_SWITCHES; idx++) { for (uint8_t idx = 0; idx < power::NUMBER_OF_SWITCHES; idx++) {
@ -116,7 +117,7 @@ void PCDUHandler::initializeSwitchStates() {
} }
} }
void PCDUHandler::readCommandQueue() { void PcduHandler::readCommandQueue() {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
CommandMessage command; CommandMessage command;
@ -129,9 +130,9 @@ void PCDUHandler::readCommandQueue() {
} }
} }
MessageQueueId_t PCDUHandler::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t PcduHandler::getCommandQueue() const { return commandQueue->getId(); }
void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) { void PcduHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) {
if (sid == sid_t(objects::PDU2_HANDLER, static_cast<uint32_t>(P60System::SetIds::CORE))) { if (sid == sid_t(objects::PDU2_HANDLER, static_cast<uint32_t>(P60System::SetIds::CORE))) {
updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset); updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset);
updatePdu2SwitchStates(); updatePdu2SwitchStates();
@ -143,7 +144,7 @@ void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool*
} }
} }
void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset, void PcduHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset,
CCSDSTime::CDS_short* datasetTimeStamp) { CCSDSTime::CDS_short* datasetTimeStamp) {
ReturnValue_t result; ReturnValue_t result;
@ -169,7 +170,7 @@ void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSet
} }
} }
void PCDUHandler::updatePdu2SwitchStates() { void PcduHandler::updatePdu2SwitchStates() {
using namespace pcdu; using namespace pcdu;
using namespace PDU2; using namespace PDU2;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
@ -207,7 +208,7 @@ void PCDUHandler::updatePdu2SwitchStates() {
} }
} }
void PCDUHandler::updatePdu1SwitchStates() { void PcduHandler::updatePdu1SwitchStates() {
using namespace pcdu; using namespace pcdu;
using namespace PDU1; using namespace PDU1;
PoolReadGuard rg0(&switcherSet); PoolReadGuard rg0(&switcherSet);
@ -244,9 +245,9 @@ void PCDUHandler::updatePdu1SwitchStates() {
} }
} }
LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { return &poolManager; } LocalDataPoolManager* PcduHandler::getHkManagerHandle() { return &poolManager; }
ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { ReturnValue_t PcduHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
using namespace pcdu; using namespace pcdu;
ReturnValue_t result; ReturnValue_t result;
uint16_t memoryAddress = 0; uint16_t memoryAddress = 0;
@ -396,9 +397,9 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO
return result; return result;
} }
ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; } ReturnValue_t PcduHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; }
ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { ReturnValue_t PcduHandler::getSwitchState(uint8_t switchNr) const {
if (switchNr >= power::NUMBER_OF_SWITCHES) { if (switchNr >= power::NUMBER_OF_SWITCHES) {
sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl; sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
@ -408,6 +409,9 @@ ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
MutexGuard mg(pwrLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX); MutexGuard mg(pwrLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
currentState = switchStates[switchNr]; currentState = switchStates[switchNr];
} }
if (currentState == SWITCH_STATE_UNKNOWN) {
return PowerSwitchIF::SWITCH_UNKNOWN;
}
if (currentState == 1) { if (currentState == 1) {
return PowerSwitchIF::SWITCH_ON; return PowerSwitchIF::SWITCH_ON;
} else { } else {
@ -415,13 +419,13 @@ ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
} }
} }
ReturnValue_t PCDUHandler::getFuseState(uint8_t fuseNr) const { return returnvalue::OK; } ReturnValue_t PcduHandler::getFuseState(uint8_t fuseNr) const { return returnvalue::OK; }
uint32_t PCDUHandler::getSwitchDelayMs(void) const { return 20000; } uint32_t PcduHandler::getSwitchDelayMs(void) const { return 20000; }
object_id_t PCDUHandler::getObjectId() const { return SystemObject::getObjectId(); } object_id_t PcduHandler::getObjectId() const { return SystemObject::getObjectId(); }
ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t PcduHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
using namespace pcdu; using namespace pcdu;
localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches); localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches);
@ -432,7 +436,7 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PCDUHandler::initializeAfterTaskCreation() { ReturnValue_t PcduHandler::initializeAfterTaskCreation() {
if (executingTask != nullptr) { if (executingTask != nullptr) {
pstIntervalMs = executingTask->getPeriodMs(); pstIntervalMs = executingTask->getPeriodMs();
} }
@ -443,11 +447,11 @@ ReturnValue_t PCDUHandler::initializeAfterTaskCreation() {
return returnvalue::OK; return returnvalue::OK;
} }
uint32_t PCDUHandler::getPeriodicOperationFrequency() const { return pstIntervalMs; } uint32_t PcduHandler::getPeriodicOperationFrequency() const { return pstIntervalMs; }
void PCDUHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; } void PcduHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; }
LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase* PcduHandler::getDataSetHandle(sid_t sid) {
if (sid == switcherSet.getSid()) { if (sid == switcherSet.getSid()) {
return &switcherSet; return &switcherSet;
} else { } else {
@ -456,7 +460,7 @@ LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) {
} }
} }
void PCDUHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, power::Switches switchIdx, void PcduHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, power::Switches switchIdx,
uint8_t setValue) { uint8_t setValue) {
using namespace pcdu; using namespace pcdu;
if (switchStates[switchIdx] != setValue) { if (switchStates[switchIdx] != setValue) {

View File

@ -20,13 +20,13 @@
* This is necessary because the FSFW manages all power related functionalities via one * This is necessary because the FSFW manages all power related functionalities via one
* power object. This includes for example switching on and off of devices. * power object. This includes for example switching on and off of devices.
*/ */
class PCDUHandler : public PowerSwitchIF, class PcduHandler : public PowerSwitchIF,
public HasLocalDataPoolIF, public HasLocalDataPoolIF,
public SystemObject, public SystemObject,
public ExecutableObjectIF { public ExecutableObjectIF {
public: public:
PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize = 20); PcduHandler(object_id_t setObjectId, size_t cmdQueueSize = 20);
virtual ~PCDUHandler(); virtual ~PcduHandler();
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
virtual ReturnValue_t performOperation(uint8_t counter) override; virtual ReturnValue_t performOperation(uint8_t counter) override;
@ -35,7 +35,11 @@ class PCDUHandler : public PowerSwitchIF,
virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override; virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;
virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override; virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) override;
virtual ReturnValue_t getSwitchState(uint8_t switchNr) const override; /**
* @param switchNr
* @return returnvalue::FAILED if the switch state has not been updated yet.
*/
ReturnValue_t getSwitchState(uint8_t switchNr) const override;
virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override; virtual ReturnValue_t getFuseState(uint8_t fuseNr) const override;
virtual uint32_t getSwitchDelayMs(void) const override; virtual uint32_t getSwitchDelayMs(void) const override;
virtual object_id_t getObjectId() const override; virtual object_id_t getObjectId() const override;
@ -84,6 +88,7 @@ class PCDUHandler : public PowerSwitchIF,
/** The timeStamp of the current pdu1HkTableDataset */ /** The timeStamp of the current pdu1HkTableDataset */
CCSDSTime::CDS_short timeStampPdu1HkDataset; CCSDSTime::CDS_short timeStampPdu1HkDataset;
uint8_t SWITCH_STATE_UNKNOWN = 2;
uint8_t switchStates[power::NUMBER_OF_SWITCHES]; uint8_t switchStates[power::NUMBER_OF_SWITCHES];
/** /**
* Pointer to the IPCStore. * Pointer to the IPCStore.

View File

@ -1,11 +1,10 @@
#include "PDU1Handler.h"
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/Pdu1Handler.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, Pdu1Handler::Pdu1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
FailureIsolationBase *customFdir) FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, cfg, customFdir), : GomspaceDeviceHandler(objectId, comIF, comCookie, cfg, customFdir),
coreHk(this), coreHk(this),
@ -13,23 +12,23 @@ PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comC
initPduConfigTable(); initPduConfigTable();
} }
PDU1Handler::~PDU1Handler() {} Pdu1Handler::~Pdu1Handler() {}
ReturnValue_t PDU1Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t Pdu1Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
*id = GOMSPACE::REQUEST_HK_TABLE; *id = GOMSPACE::REQUEST_HK_TABLE;
return buildCommandFromCommand(*id, NULL, 0); return buildCommandFromCommand(*id, NULL, 0);
} }
void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { void Pdu1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet); parseHkTableReply(packet);
} }
void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) { void Pdu1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) {
this->channelSwitchHook = hook; this->channelSwitchHook = hook;
this->hookArgs = args; this->hookArgs = args;
} }
ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker, ReturnValue_t Pdu1Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
bool afterExecution) { bool afterExecution) {
using namespace PDU1; using namespace PDU1;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1;
@ -79,15 +78,15 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
return returnvalue::OK; return returnvalue::OK;
} }
void PDU1Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { void Pdu1Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id); handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id);
} }
void PDU1Handler::parseHkTableReply(const uint8_t *packet) { void Pdu1Handler::parseHkTableReply(const uint8_t *packet) {
GomspaceDeviceHandler::parsePduHkTable(coreHk, auxHk, packet); GomspaceDeviceHandler::parsePduHkTable(coreHk, auxHk, packet);
} }
ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t Pdu1Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {
initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU1); initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU1);
poolManager.subscribeForDiagPeriodicPacket( poolManager.subscribeForDiagPeriodicPacket(
@ -97,7 +96,7 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDat
return returnvalue::OK; return returnvalue::OK;
} }
LocalPoolDataSetBase *PDU1Handler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase *Pdu1Handler::getDataSetHandle(sid_t sid) {
if (sid == coreHk.getSid()) { if (sid == coreHk.getSid()) {
return &coreHk; return &coreHk;
} else if (sid == auxHk.getSid()) { } else if (sid == auxHk.getSid()) {
@ -106,7 +105,7 @@ LocalPoolDataSetBase *PDU1Handler::getDataSetHandle(sid_t sid) {
return nullptr; return nullptr;
} }
ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { ReturnValue_t Pdu1Handler::printStatus(DeviceCommandId_t cmd) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
switch (cmd) { switch (cmd) {
case (GOMSPACE::PRINT_SWITCH_V_I): { case (GOMSPACE::PRINT_SWITCH_V_I): {
@ -137,7 +136,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) {
return result; return result;
} }
void PDU1Handler::printHkTableSwitchVI() { void Pdu1Handler::printHkTableSwitchVI() {
using namespace PDU1; using namespace PDU1;
sif::info << "PDU1 Info: " << std::endl; sif::info << "PDU1 Info: " << std::endl;
sif::info << "Boot Cause: " << auxHk.bootcause << " | Boot Count: " << std::setw(4) << std::right sif::info << "Boot Cause: " << auxHk.bootcause << " | Boot Count: " << std::setw(4) << std::right
@ -163,7 +162,7 @@ void PDU1Handler::printHkTableSwitchVI() {
printerHelper("Syrlinks", Channels::SYRLINKS); printerHelper("Syrlinks", Channels::SYRLINKS);
} }
void PDU1Handler::printHkTableLatchups() { void Pdu1Handler::printHkTableLatchups() {
using namespace PDU1; using namespace PDU1;
sif::info << "PDU1 Latchup Information" << std::endl; sif::info << "PDU1 Latchup Information" << std::endl;
auto printerHelper = [&](std::string channelStr, Channels idx) { auto printerHelper = [&](std::string channelStr, Channels idx) {

View File

@ -19,11 +19,11 @@
* ACS 3.3V for Side A group, channel 7 * ACS 3.3V for Side A group, channel 7
* Unoccupied, 5V, channel 8 * Unoccupied, 5V, channel 8
*/ */
class PDU1Handler : public GomspaceDeviceHandler { class Pdu1Handler : public GomspaceDeviceHandler {
public: public:
PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, Pdu1Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
FailureIsolationBase* customFdir); FailureIsolationBase* customFdir);
virtual ~PDU1Handler(); virtual ~Pdu1Handler();
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;

View File

@ -1,11 +1,10 @@
#include "PDU2Handler.h"
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/Pdu2Handler.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, Pdu2Handler::Pdu2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
FailureIsolationBase *customFdir) FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, cfg, customFdir), : GomspaceDeviceHandler(objectId, comIF, comCookie, cfg, customFdir),
coreHk(this), coreHk(this),
@ -13,27 +12,27 @@ PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comC
initPduConfigTable(); initPduConfigTable();
} }
PDU2Handler::~PDU2Handler() {} Pdu2Handler::~Pdu2Handler() {}
ReturnValue_t PDU2Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t Pdu2Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
*id = GOMSPACE::REQUEST_HK_TABLE; *id = GOMSPACE::REQUEST_HK_TABLE;
return buildCommandFromCommand(*id, NULL, 0); return buildCommandFromCommand(*id, NULL, 0);
} }
void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { void Pdu2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet); parseHkTableReply(packet);
} }
void PDU2Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) { void Pdu2Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id); handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id);
} }
void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) { void Pdu2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) {
this->channelSwitchHook = hook; this->channelSwitchHook = hook;
this->hookArgs = args; this->hookArgs = args;
} }
LocalPoolDataSetBase *PDU2Handler::getDataSetHandle(sid_t sid) { LocalPoolDataSetBase *Pdu2Handler::getDataSetHandle(sid_t sid) {
if (sid == coreHk.getSid()) { if (sid == coreHk.getSid()) {
return &coreHk; return &coreHk;
} else if (sid == auxHk.getSid()) { } else if (sid == auxHk.getSid()) {
@ -42,11 +41,11 @@ LocalPoolDataSetBase *PDU2Handler::getDataSetHandle(sid_t sid) {
return nullptr; return nullptr;
} }
void PDU2Handler::parseHkTableReply(const uint8_t *packet) { void Pdu2Handler::parseHkTableReply(const uint8_t *packet) {
GomspaceDeviceHandler::parsePduHkTable(coreHk, auxHk, packet); GomspaceDeviceHandler::parsePduHkTable(coreHk, auxHk, packet);
} }
ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t Pdu2Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {
initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU2); initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU2);
poolManager.subscribeForDiagPeriodicPacket( poolManager.subscribeForDiagPeriodicPacket(
@ -56,7 +55,7 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDat
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { ReturnValue_t Pdu2Handler::printStatus(DeviceCommandId_t cmd) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
switch (cmd) { switch (cmd) {
case (GOMSPACE::PRINT_SWITCH_V_I): { case (GOMSPACE::PRINT_SWITCH_V_I): {
@ -87,7 +86,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
return result; return result;
} }
void PDU2Handler::printHkTableSwitchVI() { void Pdu2Handler::printHkTableSwitchVI() {
using namespace PDU2; using namespace PDU2;
sif::info << "PDU2 Info:" << std::endl; sif::info << "PDU2 Info:" << std::endl;
sif::info << "Boot Cause: " << auxHk.bootcause << " | Boot Count: " << std::setw(4) << std::right sif::info << "Boot Cause: " << auxHk.bootcause << " | Boot Count: " << std::setw(4) << std::right
@ -111,7 +110,7 @@ void PDU2Handler::printHkTableSwitchVI() {
printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA); printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA);
} }
void PDU2Handler::printHkTableLatchups() { void Pdu2Handler::printHkTableLatchups() {
using namespace PDU2; using namespace PDU2;
sif::info << "PDU2 Latchup Information" << std::endl; sif::info << "PDU2 Latchup Information" << std::endl;
auto printerHelper = [&](std::string channelStr, Channels idx) { auto printerHelper = [&](std::string channelStr, Channels idx) {
@ -129,7 +128,7 @@ void PDU2Handler::printHkTableLatchups() {
printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA); printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA);
} }
ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker, ReturnValue_t Pdu2Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
bool afterExecution) { bool afterExecution) {
using namespace PDU2; using namespace PDU2;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;

View File

@ -19,11 +19,11 @@
* ACS Board (Gyro, MGMs, GPS), 3.3V channel 7 * ACS Board (Gyro, MGMs, GPS), 3.3V channel 7
* Payload Camera, 8V, channel 8 * Payload Camera, 8V, channel 8
*/ */
class PDU2Handler : public GomspaceDeviceHandler { class Pdu2Handler : public GomspaceDeviceHandler {
public: public:
PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, Pdu2Handler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
FailureIsolationBase* customFdir); FailureIsolationBase* customFdir);
virtual ~PDU2Handler(); virtual ~Pdu2Handler();
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;

View File

@ -157,10 +157,14 @@ ReturnValue_t SolarArrayDeploymentHandler::performAutonomousDepl(sd::SdCard sdCa
return returnvalue::OK; return returnvalue::OK;
} }
bool SolarArrayDeploymentHandler::autonomousDeplForFile(sd::SdCard sdCard, const char* filename, bool SolarArrayDeploymentHandler::autonomousDeplForFile(sd::SdCard sdCard, const char* infoFile,
bool dryRun) { bool dryRun) {
using namespace std; using namespace std;
ifstream file(filename); std::error_code e;
ifstream file(infoFile);
if (file.bad()) {
return false;
}
string line; string line;
string word; string word;
unsigned int lineNum = 0; unsigned int lineNum = 0;
@ -211,14 +215,14 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(sd::SdCard sdCard, const
stateSwitch = true; stateSwitch = true;
} }
}; };
if ((secsSinceBoot > FIRST_BURN_START_TIME) and (secsSinceBoot < FIRST_BURN_END_TIME)) { if ((secsSinceBoot >= FIRST_BURN_START_TIME) and (secsSinceBoot < FIRST_BURN_END_TIME)) {
switchCheck(AutonomousDeplState::FIRST_BURN); switchCheck(AutonomousDeplState::FIRST_BURN);
} else if ((secsSinceBoot > WAIT_START_TIME) and (secsSinceBoot < WAIT_END_TIME)) { } else if ((secsSinceBoot >= WAIT_START_TIME) and (secsSinceBoot < WAIT_END_TIME)) {
switchCheck(AutonomousDeplState::WAIT); switchCheck(AutonomousDeplState::WAIT);
} else if ((secsSinceBoot > SECOND_BURN_START_TIME) and } else if ((secsSinceBoot >= SECOND_BURN_START_TIME) and
(secsSinceBoot < SECOND_BURN_END_TIME)) { (secsSinceBoot < SECOND_BURN_END_TIME)) {
switchCheck(AutonomousDeplState::SECOND_BURN); switchCheck(AutonomousDeplState::SECOND_BURN);
} else if (secsSinceBoot > SECOND_BURN_END_TIME) { } else if (secsSinceBoot >= SECOND_BURN_END_TIME) {
switchCheck(AutonomousDeplState::DONE); switchCheck(AutonomousDeplState::DONE);
} }
} }
@ -240,15 +244,18 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(sd::SdCard sdCard, const
} }
} }
if (deplState == AutonomousDeplState::DONE) { if (deplState == AutonomousDeplState::DONE) {
remove(filename); std::filesystem::remove(infoFile, e);
if (sdCard == sd::SdCard::SLOT_0) { if (sdCard == sd::SdCard::SLOT_0) {
remove(SD_0_DEPL_FILE); std::filesystem::remove(SD_0_DEPL_FILE, e);
} else { } else {
remove(SD_1_DEPL_FILE); std::filesystem::remove(SD_1_DEPL_FILE, e);
} }
triggerEvent(AUTONOMOUS_DEPLOYMENT_COMPLETED); triggerEvent(AUTONOMOUS_DEPLOYMENT_COMPLETED);
} else { } else {
std::ofstream of(filename); std::ofstream of(infoFile);
if (of.bad()) {
return false;
}
of << "phase: "; of << "phase: ";
if (deplState == AutonomousDeplState::INIT) { if (deplState == AutonomousDeplState::INIT) {
of << PHASE_INIT_STR << "\n"; of << PHASE_INIT_STR << "\n";

View File

@ -19,7 +19,10 @@ DualLaneAssemblyBase::DualLaneAssemblyBase(object_id_t objectId, PowerSwitchIF*
void DualLaneAssemblyBase::performChildOperation() { void DualLaneAssemblyBase::performChildOperation() {
using namespace duallane; using namespace duallane;
if (pwrStateMachine.active()) { if (pwrStateMachine.active()) {
pwrStateMachineWrapper(); ReturnValue_t result = pwrStateMachineWrapper();
if (result != returnvalue::OK) {
handleModeTransitionFailed(result);
}
} }
// Only perform the regular child operation if the power state machine is not active. // Only perform the regular child operation if the power state machine is not active.
// It does not make any sense to command device modes while the power switcher is busy // It does not make any sense to command device modes while the power switcher is busy
@ -112,6 +115,7 @@ void DualLaneAssemblyBase::handleModeReached() {
pwrStateMachine.start(targetMode, targetSubmode); pwrStateMachine.start(targetMode, targetSubmode);
// Now we can switch off the power. After that, the AssemblyBase::handleModeReached function // Now we can switch off the power. After that, the AssemblyBase::handleModeReached function
// will be called // will be called
// Ignore failures for now.
pwrStateMachineWrapper(); pwrStateMachineWrapper();
} else { } else {
finishModeOp(); finishModeOp();