checkQrs method

int checkQrs(
  1. double diffEcg,
  2. int index,
  3. double thres1,
  4. double thres2,
)

Implementation

int checkQrs(double diffEcg, int index, double thres1, double thres2) {
  width = 0;
  if (diffEcg > thres1 || diffEcg < thres2) {
    if (ind > 0) {
      if (ind - index < qrsWindow) {
        cnt += ind - index;
        ind = index;

        if (cnt > 0.04 * fs) {
          if (qrsBool == true) {
            width = ind - index;
          } else {
            width = cnt;
            qrsBool = true;
          }
        }
      } else {
        cnt = 0;
        ind = 0;
        qrsBool = false;
      }
    }
    ind = index;
  }
  return width;
}