elan: Simplify calibration check for ELAN_0C42

Check for the mean calibration being outside of range to know whether we
require a recalibration. Continue with the usual checks if the
calibration value is within range.
This commit is contained in:
Dave 2019-04-09 02:30:07 -04:00 committed by Bastien Nocera
parent 83af40679a
commit 2babfa0625

View file

@ -603,6 +603,14 @@ static int elan_need_calibration(struct elan_dev *elandev)
g_assert(frame_size != 0); g_assert(frame_size != 0);
if (elandev->dev_type == ELAN_0C42) {
if (calib_mean > 5500 ||
calib_mean < 2500) {
fp_dbg("Forcing needed recalibration");
return 1;
}
}
for (int i = 0; i < frame_size; i++) for (int i = 0; i < frame_size; i++)
bg_mean += elandev->background[i]; bg_mean += elandev->background[i];
bg_mean /= frame_size; bg_mean /= frame_size;