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
a0ca1fb3
Commit
a0ca1fb3
authored
Apr 29, 2021
by
Thomas Edwards
Browse files
Added timestamps to SteamReader log error messages
parent
3aa80943
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Filter_Obs.cpp
View file @
a0ca1fb3
...
...
@@ -219,6 +219,9 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
struct
timespec
this_timeblock_edge
;
// Timestamp as string for logging
std
::
string
timestamp
;
time_t
now
=
time
(
0
);
tm
*
gmtm
=
gmtime
(
&
now
);
std
::
string
log_time_str
=
asctime
(
gmtm
);
// Hard limiter for the que
// currently set to 10 seconds at 128 Hz
...
...
@@ -385,6 +388,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// --------------------------------------------------------------
// If we find more than one block elapsed, then we've probably skipped some data. Let's hold off and get some extra data first.
if
(
round
(
num_blocks
)
>
1
)
{
now
=
time
(
0
);
gmtm
=
gmtime
(
&
now
);
log_time_str
=
asctime
(
gmtm
);
log_time_str
.
pop_back
();
// remove the endline char
std
::
cerr
<<
"["
<<
log_time_str
<<
"] "
;
std
::
cerr
<<
"[!!!] Time skip detected! Waiting for more data."
<<
std
::
endl
;
}
// See if we can run at least one filter
...
...
@@ -408,6 +416,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Check slip count to see if we need to slip
if
(
slip_count
>
slip_limit
)
{
now
=
time
(
0
);
gmtm
=
gmtime
(
&
now
);
log_time_str
=
asctime
(
gmtm
);
log_time_str
.
pop_back
();
// remove the endline char
std
::
cerr
<<
"["
<<
log_time_str
<<
"] "
;
std
::
cerr
<<
"[!!!] Slipping data to fit time!"
<<
std
::
endl
;
slip_count
=
0
;
filter_jitter
=
tofilter1
.
size
()
%
8
;
...
...
@@ -480,10 +493,20 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Check the data: Do we have too much or too little?
// --------------------------------------------------------------
if
(
tofilter1
.
size
()
>
max_filter1
)
{
now
=
time
(
0
);
gmtm
=
gmtime
(
&
now
);
log_time_str
=
asctime
(
gmtm
);
log_time_str
.
pop_back
();
// remove the endline char
std
::
cerr
<<
"["
<<
log_time_str
<<
"] "
;
std
::
cerr
<<
"[!!!] Too much data!"
<<
std
::
endl
;
// [TODO] Reset everthing, try to start again
}
else
if
(
tofilter1
.
size
()
<
min_filter1
)
{
now
=
time
(
0
);
gmtm
=
gmtime
(
&
now
);
log_time_str
=
asctime
(
gmtm
);
log_time_str
.
pop_back
();
// remove the endline char
std
::
cerr
<<
"["
<<
log_time_str
<<
"] "
;
std
::
cerr
<<
"[!!!] Not enough data!"
<<
std
::
endl
;
}
else
{
// std::cerr << "[!!!] Enough to run filter! But for some reason we didn't!" << std::endl;
...
...
@@ -499,6 +522,11 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// check error state
if
(
tofilter1
.
size
()
>
que_limit
)
{
now
=
time
(
0
);
gmtm
=
gmtime
(
&
now
);
log_time_str
=
asctime
(
gmtm
);
log_time_str
.
pop_back
();
// remove the endline char
std
::
cerr
<<
"["
<<
log_time_str
<<
"] "
;
std
::
cerr
<<
"[!!!] WARNING! Que limit has been reached! Restarting filter!"
<<
std
::
endl
;
// remove all data in ques
for
(
int
ix
=
0
;
ix
<
tofilter1
.
size
();
ix
++
)
{
...
...
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