You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include <wiringPi.h>
|
|
|
|
#include "cmd_line_args.h"
|
|
|
|
#include "easylogging++.h"
|
|
|
|
#include "easylogging++.cc"
|
|
|
|
#include "task_manager.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
|
|
|
|
INITIALIZE_EASYLOGGINGPP
|
|
|
|
|
|
|
|
#define PIN 0
|
|
|
|
|
|
|
|
static std::stringstream schedule = std::stringstream(
|
|
|
|
"0 0 10 ? * MON-SAT HIGH(0)\n"
|
|
|
|
"0 0 13 ? * MON-SAT LOW(0)\n"
|
|
|
|
"0 0 15 ? * MON-SAT HIGH(0)\n"
|
|
|
|
"0 0 19 ? * MON-SAT LOW(0)\n"
|
|
|
|
"* * * * * SUN LOW(0)\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
el::Loggers::reconfigureAllLoggers(el::ConfigurationType::ToStandardOutput, "true");
|
|
|
|
el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
|
|
|
|
|
|
|
|
parsed_opts opts = parse_opts(argc, argv);
|
|
|
|
if(opts.config_file.empty()) {
|
|
|
|
LOG(ERROR) << "Config file is not set!";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG(INFO) << opts.config_file;
|
|
|
|
|
|
|
|
TaskManager manager{schedule, digitalWrite};
|
|
|
|
|
|
|
|
wiringPiSetup ();
|
|
|
|
pinMode (PIN, OUTPUT);
|
|
|
|
|
|
|
|
while(true) {
|
|
|
|
manager.doWork();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|