format, str, contrast, saturation, brihtness, speed

This commit is contained in:
2021-10-15 18:51:03 +02:00
parent 790dcd2259
commit 4ea8ce944f

View File

@@ -30,6 +30,7 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include "TimeoutSerial.h"
#include "YmodemFileReceive.h"
@@ -38,6 +39,7 @@
using namespace std;
using namespace boost;
using boost::format;
namespace po = boost::program_options;
typedef vector< string > split_vector_type;
@@ -112,7 +114,7 @@ int main(int argc, char* argv[])
float pressure = NAN;
po::variables_map vm;
std::string port,path,filename;
int speed;
int speed,brightness,saturation,contrast;
po::options_description desc("Allowed options");
desc.add_options()
@@ -124,7 +126,10 @@ int main(int argc, char* argv[])
("path", po::value<string>(&path)->default_value("/tmp"),"directory for file of capture")
("capture", "capture photo of camera")
("port", po::value<string>(&port)->default_value("/dev/ttyUSB0"), "port to read from")
("speed", po::value<int>(&speed)->default_value(115200), "speed read from port")
("speed", po::value<int>(&speed)->default_value(460800), "speed read from port")
("brightness", po::value<int>(&brightness)->default_value(0), "set brightness")
("saturation", po::value<int>(&saturation)->default_value(0), "set saturation")
("contrast", po::value<int>(&contrast)->default_value(0), "set contrast")
("temperature", "get and print temprature")
("humidity", "get and print humidity")
("pressure", "get and print pressure")
@@ -228,8 +233,23 @@ int main(int argc, char* argv[])
return 0;
}
if (vm.count("brightness")) {
serial.writeString(str(format("bright %d\r\n") % brightness));
}
if (vm.count("saturation")) {
serial.writeString(str(format("satur %d\r\n") % saturation));
}
if (vm.count("contrast")) {
serial.writeString(str(format("contr %d\r\n") % contrast));
}
if (vm.count("capture")) {
serial.writeString("capture\r\n");
boost::this_thread::sleep(posix_time::milliseconds(100));