Commit 627e8b5e authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Formatting

parent f1e99fb7
......@@ -159,12 +159,12 @@ int Driver_Obs_Serial::set_term(const char* term, int termlen) {
********************************************************************************/
int Driver_Obs_Serial::set_baud(int baud) {
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//
// Set the baud rate
// Set the baud rate of serial port
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
if (serial.set_baud(baud) < 0) {
return (-1);
}
......@@ -195,7 +195,6 @@ int Driver_Obs_Serial::set_baud(const char* init_chars) {
* Several init strings are passed.
*
******************************************************************************/
int Driver_Obs_Serial::set_baud(char* init_chars[], int init_chars_num) {
////////////////////////////////////////////////////////////////////////
......@@ -218,17 +217,17 @@ int Driver_Obs_Serial::set_baud(char* init_chars[], int init_chars_num) {
//printf("---- Test baud rate: %7d ----\n", valid_baudrates[i]);
serial.set_baud(valid_baudrates[i]);
usleep(10000);
for (int j = 0; j<init_chars_num-1; j++){
printf("BAUD: %s\n",init_chars[j]);
//printf("BAUD: %s\n",init_chars[j]);
send(init_chars[j]);
usleep(10000);
flush();
}
send(init_chars[init_chars_num-1]);
if (serial.receive(buf, sizeof(buf), 1) >= 0) {
send(init_chars[init_chars_num-1]);
if (serial.receive(buf, sizeof(buf), 1) >= 0) {
baud = valid_baudrates[i];
break;
}
......
/********************************************************************************
* WRITTEN BY ACHIM MORSCHHAUSER, GFZ POTSDAM, April 2016 *
* mors//gfz-potsdam.de *
* *
* This class provides a container for observatory data. *
* It can store only timestamping data, but may be extended to store more data. *
* For example, see the classes data_olbs_scalar and data_obs_vector. *
* *
********************************************************************************/
/*******************************************************************************
* WRITTEN BY ACHIM MORSCHHAUSER, GFZ POTSDAM, April 2016 *
* mors//gfz-potsdam.de *
* *
* This class provides a container for observatory data. *
* It can store only timestamping data, but may be extended to store more data.*
* For example, see the classes data_obs_scalar and data_obs_vector. *
* *
******************************************************************************/
// C++ Headers
#include <iomanip> // For parsing strings
......
......@@ -16,50 +16,45 @@
int main() {
// Read from parameters file
Parameters_Reader par = Parameters_Reader("usr/parameters.par");
// Set the calibration constants.
double R = par.get_dbl("R");
double X_s = par.get_dbl("X_s");
double Y_s = par.get_dbl("Y_s");
double Z_s = par.get_dbl("Z_s");
// Initialize new buffer for STDOUT
buffer_obs_pipe pipe = buffer_obs_pipe(5);
// Initialize the calibration constants
Obs_Calibration_Vector cal = Obs_Calibration_Vector(X_s/R,Y_s/R,Z_s/R);
// Initialize new OBSDAQ device
driver_obs_obsdaq obsdaq = driver_obs_obsdaq(par.get_str("PORT"), &pipe,
&cal, par.get_int("BAUD"), 1);
// Get some data
/*
data_obs_vector data=data_obs_vector();
printf("First try\n");
obsdaq.get(&data);
pipe.put(&data);
printf("Second try\n");
obsdaq.get(&data);
pipe.put(&data);
*/
// Take continuous measurements
fprintf(stderr,"Run\n");
obsdaq.freerun(par.get_dbl("Freq"));
// Read from parameters file
Parameters_Reader par = Parameters_Reader("usr/parameters.par");
// Set the calibration constants.
double R = par.get_dbl("R");
double X_s = par.get_dbl("X_s");
double Y_s = par.get_dbl("Y_s");
double Z_s = par.get_dbl("Z_s");
// Initialize new buffer for STDOUT
buffer_obs_pipe pipe = buffer_obs_pipe(5);
// Initialize the calibration constants
Obs_Calibration_Vector cal = Obs_Calibration_Vector(X_s/R,Y_s/R,Z_s/R);
// Initialize new OBSDAQ device
driver_obs_obsdaq obsdaq = driver_obs_obsdaq(par.get_str("PORT"), &pipe,
&cal, par.get_int("BAUD"), 1);
// Get some data
/*
data_obs_vector data=data_obs_vector();
printf("First try\n");
obsdaq.get(&data);
pipe.put(&data);
printf("Second try\n");
obsdaq.get(&data);
pipe.put(&data);
*/
// Take continuous measurements
fprintf(stderr,"Run\n");
obsdaq.freerun(par.get_dbl("Freq"));
}
......
Supports Markdown
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