Init Boot Delay OBSW #340
@ -4,6 +4,10 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "commonConfig.h"
|
#include "commonConfig.h"
|
||||||
#include "core/scheduling.h"
|
#include "core/scheduling.h"
|
||||||
@ -38,9 +42,15 @@ int obsw::obsw() {
|
|||||||
}
|
}
|
||||||
#endif
|
#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.
|
// Init delay handling.
|
||||||
if (std::filesystem::exists("$HOME/boot_delay_secs.txt")) {
|
if (std::filesystem::exists(bootDelayFile)) {
|
||||||
std::ifstream ifile("$HOME/boot_delay_secs.txt");
|
std::ifstream ifile(bootDelayFile);
|
||||||
std::string lineStr;
|
std::string lineStr;
|
||||||
unsigned int bootDelaySecs = 0;
|
unsigned int bootDelaySecs = 0;
|
||||||
unsigned int line = 0;
|
unsigned int line = 0;
|
||||||
@ -57,7 +67,7 @@ int obsw::obsw() {
|
|||||||
bootDelaySecs = 6;
|
bootDelaySecs = 6;
|
||||||
}
|
}
|
||||||
std::cout << "Delaying OBSW start for " << bootDelaySecs << " seconds" << std::endl;
|
std::cout << "Delaying OBSW start for " << bootDelaySecs << " seconds" << std::endl;
|
||||||
TaskFactory::delayTask(bootDelaySecs);
|
TaskFactory::delayTask(bootDelaySecs * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduling::initMission();
|
scheduling::initMission();
|
||||||
|
Loading…
Reference in New Issue
Block a user