From e1b3688869c8d08e390302e760be11968798dbda Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 Oct 2022 19:55:20 +0200 Subject: [PATCH] finish file handling --- mission/devices/SolarArrayDeploymentHandler.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mission/devices/SolarArrayDeploymentHandler.cpp b/mission/devices/SolarArrayDeploymentHandler.cpp index af281d1d..dc5ae63e 100644 --- a/mission/devices/SolarArrayDeploymentHandler.cpp +++ b/mission/devices/SolarArrayDeploymentHandler.cpp @@ -110,7 +110,7 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename) { } } else if (lineNum == 1) { iss >> word; - if (word.find("phase:") == string::npos) { + if (word.find("secs_since_start:") == string::npos) { return false; } @@ -159,7 +159,20 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename) { } } if(stateSwitch or updateUptime) { - // TODO: Write new file here + std::ofstream of(filename); + of << "phase: " ; + if(deplState == AutonomousDeplState::INIT) { + of << PHASE_INIT_STR << "\n"; + } else if(deplState == AutonomousDeplState::FIRST_BURN) { + of << PHASE_FIRST_BURN_STR << "\n"; + } else if(deplState == AutonomousDeplState::WAIT) { + 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; }