diff --git a/mission/devices/SolarArrayDeploymentHandler.cpp b/mission/devices/SolarArrayDeploymentHandler.cpp index 0b085cf6..af281d1d 100644 --- a/mission/devices/SolarArrayDeploymentHandler.cpp +++ b/mission/devices/SolarArrayDeploymentHandler.cpp @@ -141,11 +141,15 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename) { } lineNum++; } - if (initUptime) { - secsSinceBoot = initUptime.value(); + bool updateUptime = false; + if(opDivider.checkAndIncrement()) { + if (initUptime) { + secsSinceBoot = initUptime.value(); + } + // Uptime has increased by X seconds so we need to update the uptime count inside the file + secsSinceBoot += Clock::getUptime().tv_sec; + updateUptime = true; } - // Uptime has increased by X seconds so we need to update the uptime count inside the file - secsSinceBoot += Clock::getUptime().tv_sec; if (stateSwitch) { if (deplState == AutonomousDeplState::FIRST_BURN or deplState == AutonomousDeplState::SECOND_BURN) { @@ -154,6 +158,9 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename) { startFsm(false, false); } } + if(stateSwitch or updateUptime) { + // TODO: Write new file here + } return true; } diff --git a/mission/devices/SolarArrayDeploymentHandler.h b/mission/devices/SolarArrayDeploymentHandler.h index b94ba67c..019c6bf6 100644 --- a/mission/devices/SolarArrayDeploymentHandler.h +++ b/mission/devices/SolarArrayDeploymentHandler.h @@ -1,6 +1,7 @@ #ifndef MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ #define MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ +#include #include #include "devices/powerSwitcherList.h" @@ -109,6 +110,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF, bool actionActive = false; ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID; std::optional initUptime; + PeriodicOperationDivider opDivider = PeriodicOperationDivider(5); uint8_t retryCounter = 3; struct FsmInfo { // false if OFF, true is ON