[ExpASFilter] Fix deadline calculation and other changes

This commit is contained in:
X9VoiD 2020-07-28 15:06:36 +08:00
parent 2087cf7358
commit 60b283b16e
No known key found for this signature in database
GPG key ID: 3AC5DBB8A2717CFF

View file

@ -35,8 +35,16 @@ namespace OpenTabletDriverPlugins
Polynomial xCoeff, yCoeff;
var weights = CalcWeight(Weight);
xCoeff = new Polynomial(Fit.PolynomialWeighted(timeMatrix, x, weights, Degree));
yCoeff = new Polynomial(Fit.PolynomialWeighted(timeMatrix, y, weights, Degree));
try
{
xCoeff = new Polynomial(Fit.PolynomialWeighted(timeMatrix, x, weights, Degree));
yCoeff = new Polynomial(Fit.PolynomialWeighted(timeMatrix, y, weights, Degree));
}
catch (Exception)
{
Log.Write("ExpASFilter", "Error in calculation");
return point;
}
double predictAhead;
predictAhead = (date - _timeSeriesPoints.First.Value.Date).TotalMilliseconds + Compensation;
@ -50,7 +58,7 @@ namespace OpenTabletDriverPlugins
}
var now = DateTime.Now;
if ((now - date).TotalMilliseconds > CalcReportRateAvg())
if ((now - date).TotalMilliseconds > 1000.0 / CalcReportRateAvg())
Log.Write("ExpASFilter", now + ": High CPU Latency. Report delayed.");
_lastTime = date;
@ -220,7 +228,7 @@ namespace OpenTabletDriverPlugins
private void CompensationFunc(ref double a, double value)
{
if (value == 0)
Log.Write("ExpASFilter", "Mode: Sub-Zero Latency Cursor Correction");
Log.Write("ExpASFilter", "Mode: Low Latency Cursor Correction");
else if (value > 0)
{
Log.Write("ExpASFilter", "Mode: Latency Compensation");