this works
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

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

View File

@ -4,6 +4,10 @@
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include "OBSWConfig.h"
#include "commonConfig.h"
#include "core/scheduling.h"
@ -38,9 +42,15 @@ int obsw::obsw() {
}
#endif
const char* homedir = nullptr;
homedir = getenv("HOME");
if(homedir == nullptr) {
homedir = getpwuid(getuid())->pw_dir;
}
std::filesystem::path bootDelayFile = std::filesystem::path(homedir) / "boot_delay_secs.txt";
// Init delay handling.
if (std::filesystem::exists("$HOME/boot_delay_secs.txt")) {
std::ifstream ifile("$HOME/boot_delay_secs.txt");
if (std::filesystem::exists(bootDelayFile)) {
std::ifstream ifile(bootDelayFile);
std::string lineStr;
unsigned int bootDelaySecs = 0;
unsigned int line = 0;
@ -57,7 +67,7 @@ int obsw::obsw() {
bootDelaySecs = 6;
}
std::cout << "Delaying OBSW start for " << bootDelaySecs << " seconds" << std::endl;
TaskFactory::delayTask(bootDelaySecs);
TaskFactory::delayTask(bootDelaySecs * 1000);
}
scheduling::initMission();