From 4ea8ce944f3539e6773654e3d9835a86c0f4c286 Mon Sep 17 00:00:00 2001 From: Jaro Date: Fri, 15 Oct 2021 18:51:03 +0200 Subject: [PATCH] format, str, contrast, saturation, brihtness, speed --- main.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index b53a3d0..7df1c81 100755 --- a/main.cpp +++ b/main.cpp @@ -30,6 +30,7 @@ #include #include +#include #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(&path)->default_value("/tmp"),"directory for file of capture") ("capture", "capture photo of camera") ("port", po::value(&port)->default_value("/dev/ttyUSB0"), "port to read from") - ("speed", po::value(&speed)->default_value(115200), "speed read from port") + ("speed", po::value(&speed)->default_value(460800), "speed read from port") + ("brightness", po::value(&brightness)->default_value(0), "set brightness") + ("saturation", po::value(&saturation)->default_value(0), "set saturation") + ("contrast", po::value(&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));