From c3b1e1f0860b157fdd0e0fe54dd743687e4065ab Mon Sep 17 00:00:00 2001
From: Janis Streib <me@janis-streib.de>
Date: Fri, 19 May 2023 16:06:28 +0200
Subject: [PATCH] ADD: configurable pollPeriod

---
 src/G4Export.cpp |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/G4Export.cpp b/src/G4Export.cpp
index 4ad269d..9f25037 100644
--- a/src/G4Export.cpp
+++ b/src/G4Export.cpp
@@ -20,6 +20,7 @@
 int RunCollect=0;
 std::unique_ptr<UdpTransmitSocket> transmitSocket;
 bool use_text = false;
+int pollPeriod = 8;
 
 
 void* Collect(REND_STRUCT* prs){
@@ -76,7 +77,7 @@
 			}
 			transmitSocket->Send( p.Data(), p.Size() );
 		}
-		usleep(15000);
+		usleep(pollPeriod*1000);
 		// usleep(8000);
 	}
 
@@ -100,10 +101,11 @@
 	option("-t", "--text").set(use_text).doc("send strings in osc messages instead of a float bundle"),
         value("c4g configuration file", cfgFile),
         value("osc sink address", oscSinkAddr),
-        integer("osc sink port", oscSinkPort)
+        integer("osc sink port", oscSinkPort),
+        integer("polling period in ms (imprecise). You realistically won't need less than 8 ms.", pollPeriod)
   );
 
-  if(!parse(argc, argv, cli)) {
+  if(!parse(argc, argv, cli) || pollPeriod <= 0) {
   	cout << make_man_page(cli, argv[0]);
 	return 1;
   }

--
Gitblit v1.9.1