Commit 589530a6 authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Check baud for new ObsDAQ version

parent 7d22395e
......@@ -24,6 +24,7 @@
#include <iostream>
#include <iomanip>
#include <unordered_map>
#include <algorithm> // for making string uppercase
// Library C++ headers
#include <buffer_obs.hpp> // Buffer for data
......@@ -677,11 +678,22 @@ int driver_obs_obsdaq::checked_send(const char* cmd, const char* reply,
return (-1);
}
strbuf=std::string(buf);
// Construct expected answer
expected = "!" + RS485_addrstr + reply;
// Convert to uppercase for comparison !! FIND STHG BETTER HERE !!
std::transform(expected.begin(), expected.end(),expected.begin(), ::toupper);
int i=0;
while (buf[i] != '\0') {
if (buf[i] >= 'a' && buf[i] <= 'z') {
buf[i] = buf[i] - 32;
}
i++;
}
// Check address part of answer
if ((expected.compare(1, 2, &buf[1], 2) != 0)
&& (RS485_addr != 0x0F)){
......@@ -1274,7 +1286,7 @@ int driver_obs_obsdaq::check_baud(int baud){
//send("$M");
// Check for expected response
if (checked_send("$M","<ObsDaq",7,0.2,0) != 0) {
if (checked_send("$M","<OBSDAQ",7,0.2,1) != 0) {
// No response, but freerun mode might be running, so check for data
int n=0;
for (int i=0; i<5; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment