small tweaks
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-01-13 11:59:11 +01:00
parent 4ebf73bd03
commit 3f079b415d
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -1,8 +1,8 @@
#include "obsw.h" #include "obsw.h"
#include <filesystem> #include <filesystem>
#include <iostream>
#include <fstream> #include <fstream>
#include <iostream>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "commonConfig.h" #include "commonConfig.h"
@ -39,24 +39,25 @@ int obsw::obsw() {
#endif #endif
// Init delay handling. // Init delay handling.
if(std::filesystem::exists("$HOME/boot_delay.txt")) { if (std::filesystem::exists("$HOME/boot_delay_secs.txt")) {
std::ifstream ifile("$HOME/boot_delay.txt"); std::ifstream ifile("$HOME/boot_delay_secs.txt");
std::string lineStr; std::string lineStr;
unsigned int bootDelaySecs = 0; unsigned int bootDelaySecs = 0;
unsigned int line = 0; unsigned int line = 0;
// Try to reas delay seconds from file. // Try to reas delay seconds from file.
while(std::getline(ifile, lineStr)) { while (std::getline(ifile, lineStr)) {
std::istringstream iss(lineStr); std::istringstream iss(lineStr);
if(!(iss >> bootDelaySecs)) { if (!(iss >> bootDelaySecs)) {
break; break;
} }
line++; line++;
} }
if(line == 0) { if (line == 0) {
// If the file is empty, assume default of 6 seconds // If the file is empty, assume default of 6 seconds
bootDelaySecs = 6; bootDelaySecs = 6;
} }
TaskFactory::delayTask(bootDelaySecs); std::cout << "Delaying OBSW start for " << bootDelaySecs << " seconds" << std::endl;
TaskFactory::delayTask(bootDelaySecs);
} }
scheduling::initMission(); scheduling::initMission();