included jitter correction on client
This commit is contained in:
@@ -14,6 +14,8 @@ TriggerEngine::TriggerEngine()
|
||||
stopped_(false),
|
||||
prevValue_(0.0),
|
||||
prevValid_(false),
|
||||
lastTime_(0.0),
|
||||
lastTimeValid_(false),
|
||||
trigTime_(0.0),
|
||||
firedPreSec_(0.0),
|
||||
firedPostSec_(0.0),
|
||||
@@ -82,6 +84,11 @@ bool TriggerEngine::GetStopped() const {
|
||||
void TriggerEngine::CheckSample(float64 t, float64 v) {
|
||||
(void) mutex_.FastLock();
|
||||
|
||||
/* Track the newest watched timestamp in every state so Force() has a
|
||||
* reference time to latch the capture window around. */
|
||||
lastTime_ = t;
|
||||
lastTimeValid_ = true;
|
||||
|
||||
if (state_ != kTrigArmed) {
|
||||
mutex_.FastUnLock();
|
||||
return;
|
||||
@@ -122,6 +129,25 @@ void TriggerEngine::CheckSample(float64 t, float64 v) {
|
||||
mutex_.FastUnLock();
|
||||
}
|
||||
|
||||
bool TriggerEngine::Force() {
|
||||
(void) mutex_.FastLock();
|
||||
|
||||
bool ok = lastTimeValid_ && (state_ != kTrigCollecting);
|
||||
if (ok) {
|
||||
state_ = kTrigCollecting;
|
||||
trigTime_ = lastTime_;
|
||||
firedPreSec_ = config_.windowSec * config_.prePercent / 100.0;
|
||||
firedPostSec_ = config_.windowSec - firedPreSec_;
|
||||
firedValid_ = true;
|
||||
REPORT_ERROR_STATIC(MARTe::ErrorManagement::Information,
|
||||
"TriggerEngine: forced at t=%.6f (pre=%.4fs post=%.4fs)",
|
||||
trigTime_, firedPreSec_, firedPostSec_);
|
||||
}
|
||||
|
||||
mutex_.FastUnLock();
|
||||
return ok;
|
||||
}
|
||||
|
||||
TrigState TriggerEngine::GetState() const {
|
||||
(void) mutex_.FastLock();
|
||||
TrigState ret = state_;
|
||||
|
||||
Reference in New Issue
Block a user