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:
parent
83af40679a
commit
2babfa0625
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue