Skip to content

Commit 3b89701

Browse files
uwewoessnertobst
authored andcommitted
sc fixes
1 parent 64c99bc commit 3b89701

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/OpenCOVER/plugins/hlrs/TacxFTMS/TacxFTMS.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ bool TacxFTMS::init() {
8888
std::cerr << "Devicename found" << i->deviceName << std::endl;
8989
if (i->deviceName == "TacxNeo") {
9090
supportedDeviceFound = true;
91+
start();
9192
}
9293
else if (i->deviceName == "Alpine")
9394
{
@@ -128,7 +129,7 @@ void TacxFTMS::addDevice(const opencover::deviceInfo *i)
128129
//unsigned short localPortAlpine = configInt("Alpine", "localPort", 31322)->value();
129130
std::string host = "";
130131
std::cerr << "Devicename found" << i->deviceName << std::endl;
131-
if (i->deviceName == "TacxNeo")
132+
if (i->deviceName == "TacxNeo" && udpNeo ==nullptr)
132133
{
133134
host = i->address;
134135
std::cerr << "TacxFTMS config: UDP: TacxHost: " << host << std::endl;
@@ -267,12 +268,14 @@ void TacxFTMS::run() {
267268
}
268269

269270
void TacxFTMS::updateThread() {
271+
std::cerr << "ut" << endl;
270272
if (udpListen) {
271273
char tmpBuf[10000];
272274
int status;
273275

274276
status = udpListen->receive(&tmpBuf, 10000);
275277

278+
std::cerr << "status" << status << endl;
276279
if (status == -1) {
277280
if (isEnabled()) // otherwise we are not supposed to receive
278281
// anything
@@ -281,16 +284,17 @@ void TacxFTMS::updateThread() {
281284
<< std::endl;
282285
}
283286
} else if (status >= sizeof(FTMSBikeData)) {
284-
if (!isEnabled()) {
287+
/* if (!isEnabled()) {
285288
if (udpNeo) // still receiving data, send stop
286289
udpNeo->send("stop");
287290
if (udpAlpine)
288291
udpAlpine->send("stop");
289292
return;
290-
}
293+
}*/
291294
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
292295
memcpy(&ftmsData, tmpBuf, sizeof(FTMSBikeData));
293296
sendIndoorBikeSimulationParameters();
297+
cerr << "speed" << ftmsData.speed << endl;
294298

295299
} else if (status >= sizeof(AlpineData)) {
296300

src/OpenCOVER/plugins/hlrs/TacxFTMS/TacxFTMS.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class PLUGINEXPORT TacxFTMS : public opencover::coVRPlugin, public opencover::co
8383
osg::Matrix TacxFTMSPos;
8484
void setEnabled(bool) override;
8585
void updateThread();
86-
std::unique_ptr<UDPComm> udpNeo;
86+
std::unique_ptr<UDPComm> udpNeo=nullptr;
8787
std::unique_ptr<UDPComm> udpAlpine;
8888
std::unique_ptr<UDPComm> udpListen; // for listening to all devices
8989
FTMSBikeData ftmsData;

0 commit comments

Comments
 (0)