Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Achim Morschhauser
GeomagLogger
Commits
a946e602
Commit
a946e602
authored
Dec 14, 2021
by
Achim Morschhauser
Browse files
Bugfixes for OBSDAQ_Calibrate
- Change german phrases to english - Bugfix temperature
parent
f6c2c781
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
a946e602
...
...
@@ -25,6 +25,8 @@ usr/*
usr/src/*
!usr/src/GSM_Logger.cpp
!usr/src/OBSDAQ_Logger.cpp
!usr/src/OBSDAQ_Calibrate.cpp
!usr/src/OBSDAQ_Logger.cpp
!usr/src/Serial_Talk.cpp
!usr/src/Stream_Reader.cpp
!usr/par/
...
...
src/driver_obs_obsdaq.cpp
View file @
a946e602
...
...
@@ -476,10 +476,10 @@ int driver_obs_obsdaq::calibrate(int repeat, std::string mode) {
if
(
mode
==
"MANUAL"
)
{
std
::
string
msg
=
"
Für diese Konfiguration auf Kana
l "
+
std
::
to_string
(
i
)
+
"
\n
"
+
"
wurde bereits eine Kalib
ration"
+
"
durchgeführt.
\n
Soll diese überschrieben werden
?"
;
"
Calibration for channe
l "
+
std
::
to_string
(
i
+
1
)
+
"
already exists
\n
"
+
"for this configu
ration
.
"
+
"
Overwrite
?"
;
std
::
string
rsp
=
ask_message
(
msg
,
std
::
vector
<
std
::
string
>
{
"y"
,
"n"
});
if
(
rsp
==
"y"
)
{
...
...
@@ -622,6 +622,8 @@ int driver_obs_obsdaq::calibrate_channel(int channel, int repeat,
std
::
string
cal_do
;
std
::
string
channel_str
=
std
::
to_string
(
channel
+
1
);
/////////////////////////////////////////////////////////////////////////
//
// Initialize: Set triggering off.
...
...
@@ -633,7 +635,7 @@ int driver_obs_obsdaq::calibrate_channel(int channel, int repeat,
usleep
(
1e6
);
// Write info for user
cmd_str
=
"Calibrate channel "
+
std
::
to_string
(
channel
)
;
cmd_str
=
"Calibrate channel "
+
channel
_str
;
write_message
(
cmd_str
);
/////////////////////////////////////////////////////////////////////////
...
...
@@ -659,7 +661,7 @@ int driver_obs_obsdaq::calibrate_channel(int channel, int repeat,
if
(
mode
==
"MANUAL"
)
{
std
::
string
tmp
;
if
(
cs
==
1
)
{
cmd_str
=
"Shortcut channel "
+
std
::
to_string
(
channel
)
+
cmd_str
=
"Shortcut channel "
+
channel
_str
+
" and press [ENTER]."
;
write_message
(
cmd_str
);
getchar
();
getchar
();
...
...
@@ -667,7 +669,7 @@ int driver_obs_obsdaq::calibrate_channel(int channel, int repeat,
do_scale
=
false
;
cal_cmd
[
1
]
=
'3'
;
}
else
if
(
cs
==
2
)
{
cmd_str
=
"Apply +10V to channel "
+
std
::
to_string
(
channel
)
+
cmd_str
=
"Apply +10V to channel "
+
channel
_str
+
" and press [ENTER]."
;
write_message
(
cmd_str
);
getchar
();
...
...
@@ -748,15 +750,17 @@ int driver_obs_obsdaq::calibrate_channel(int channel, int repeat,
tmp
=
mode
.
substr
(
0
,
4
)
+
"-CALIBRATE"
;
// Get temperature
std
::
cout
<<
"Read ObsDAQ temperature :"
;
data_obs_vector
data
(
5
);
get
(
&
data
);
double
T
=
data
.
get_supp
(
1
);
std
::
cout
<<
"OBSDAQ temperature: "
<<
T
<<
std
::
endl
;
double
T
=
data
.
get_supp
(
2
);
std
::
cout
<<
T
<<
std
::
endl
;
cal
->
add_adc_calibrate
(
config
,
offset_str
,
scale_str
,
T
,
mode
.
substr
(
0
,
4
),
tmp
);
std
::
cout
<<
"CALIBRATION FOR CHANNEL "
<<
channel
<<
" FINISHED"
// Start counting from '1': channel+1
std
::
cout
<<
"CALIBRATION FOR CHANNEL "
<<
channel_str
<<
" FINISHED"
<<
std
::
endl
;
return
(
0
);
...
...
usr/src/OBSDAQ_Calibrate.cpp
0 → 100644
View file @
a946e602
// C Headers
#include
<stdio.h>
#include
<cctype>
// toupper-function
// C++ headers
#include
<vector>
#include
<algorithm>
// std::find
#include
<iostream>
#include
<sched.h>
#include
<sys/resource.h>
#include
<sys/time.h>
#include
<ctime>
#include
<iomanip>
// put_time
//#include <thread>
//#include <vector>
// C++ Headers from library (should use dynamic linking in future)
#include
<data_obs_vector.hpp>
#include
<driver_obs_obsdaq.hpp>
#include
<buffer_obs_pipe.hpp>
#include
<buffer_obs_file_ascii.hpp>
#include
<buffer_obs_file_binary.hpp>
#include
<buffer_obs_mult.hpp>
#include
<buffer_obs_queue.hpp>
#include
<Obs_Calibration_Vector.hpp>
#include
<Parameters_Reader.hpp>
std
::
string
ask_message
(
std
::
string
msg
);
std
::
string
ask_message
(
std
::
string
msg
,
std
::
vector
<
std
::
string
>
);
int
main
(
int
argc
,
char
*
argv
[])
{
std
::
string
rsp
;
std
::
string
msg
;
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"Please specify one parameter file to use !
\n
"
);
return
(
-
1
);
}
// Read from parameters file
Parameters_Reader
par
=
Parameters_Reader
(
argv
[
1
]);
msg
=
"Is the temperature stable and ObsDAQ switched ON since at least ten minutes? "
;
rsp
=
ask_message
(
msg
,
std
::
vector
<
std
::
string
>
{
"y"
,
"n"
});
if
(
rsp
==
"n"
){
std
::
cerr
<<
"Please wait for ten minutes after switching ON the ObsDAQ."
<<
std
::
endl
;
return
(
-
1
);
}
// Initialize the calibration constants for FGE
Obs_Calibration_Vector
cal
=
Obs_Calibration_Vector
(
8
);
// Initialize the calibration constants for ObsDAQ
cal
.
set_adc_calibrate
(
par
.
get_str
(
"FILE_ADC_CONFIG"
));
// Add standard pipe buffer
buffer_obs_pipe
buf
(
5
);
// Initialize new OBSDAQ device
driver_obs_obsdaq
obsdaq
=
driver_obs_obsdaq
(
par
.
get_str
(
"PORT_VEC"
),
par
.
get_int
(
"BAUD_VEC"
),
&
buf
,
&
cal
,
par
.
get_int
(
"ADDRESS"
));
obsdaq
.
manual_calibrate
(
5
,
par
.
get_dbl
(
"FREQ_VEC"
));
}
std
::
string
ask_message
(
std
::
string
msg
){
std
::
vector
<
std
::
string
>
val
;
return
(
ask_message
(
msg
,
val
));
}
std
::
string
ask_message
(
std
::
string
msg
,
std
::
vector
<
std
::
string
>
val
){
// Intitialize
std
::
string
rsp
;
int
rsp_valid
=
0
;
// Write message
std
::
cout
<<
msg
;
if
(
!
val
.
empty
())
{
std
::
cout
<<
" ["
;
for
(
auto
i
:
val
){
std
::
cout
<<
i
<<
"/"
;
}
std
::
cout
<<
"]: "
;
}
else
{
std
::
cout
<<
": "
;
}
// check for response
std
::
vector
<
std
::
string
>::
iterator
it
;
while
(
rsp_valid
==
0
){
std
::
cin
>>
rsp
;
it
=
find
(
val
.
begin
(),
val
.
end
(),
rsp
);
if
(
it
!=
val
.
end
()
||
val
.
empty
()){
rsp_valid
=
1
;
}
else
{
std
::
cout
<<
"Please write allowed value: ["
;
for
(
auto
i
:
val
){
std
::
cout
<<
i
<<
"/"
;
}
std
::
cout
<<
"]: "
;
}
}
return
(
rsp
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment