Unsolved Threshold checking for a realtime signal
-
Hi
I have a realtime signal from a sensor. I need logic to implement a masking time once the signal is above a threshold. Here, masking time is a time period masked for any threshold checking. This is how I can differentiate positive and negative pulse As shown below:
(during a postive pulse there is a negative-going side but it should not detect as a "negative pulse").Lets say the masking time period is 0.5 seconds in my case. How do I implement this logic in Qt.
I can get the current time and compare for a threshold as shown below, but don't know how to mask for threshold checking for a period of time (say 0.5sec)static QTime time(QTime::currentTime()); // calculate two new data points: double key = time.elapsed()/1000.0; // time elapsed since start of demo, in seconds if(a_vertical> onThreshold) // is this check correct for masking time? { ui->rdo_btn_vertical->setStyleSheet(StyleSheetOn1); // On LED lastKey = key; } else { ui->rdo_btn_vertical->setStyleSheet(StyleSheetOff1); // Off LED }
Any ideas / feedbacks are welcome
-
Let's start with the basics: do you get any measurable values from the port the signaling device is connected?
If so, based on your drawings, knowing the threshold value:- assume threshold is zero.
- treat all the values below the threshold (zero) as negative in relation to threshold.
- accordingly, all the values above threshold (zero) as positive in relation to threshold.
- sum all those up.
- if value is positive you have negative pulse, otherwise negative.
But that assumes that you have measurable values from the sensor + that drawings represent accurate tendencies.