Skip to content

Commit

Permalink
added drift compensation values to reported values
Browse files Browse the repository at this point in the history
  • Loading branch information
klues committed Sep 8, 2021
1 parent 148e1ed commit 977426c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions FLipWare/FLipWare.ino
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ int x, y;
int pressure;
float dz = 0, force = 0, angle = 0;
int xLocalMax = 0, yLocalMax = 0;
int xDriftComp = 0, yDriftComp = 0;
int16_t cx = 0, cy = 0;

uint8_t blinkCount = 0;
Expand Down Expand Up @@ -251,6 +252,10 @@ void reportValues()
}
Serial.print(",");
Serial.print(actSlot);
Serial.print(",");
Serial.print(xDriftComp);
Serial.print(",");
Serial.print(yDriftComp);
Serial.println("");
/*
Serial.print("AnalogRAW:");
Expand Down Expand Up @@ -287,8 +292,10 @@ void applyDriftCorrection()
if (yLocalMax > settings.rv) yLocalMax = settings.rv;
if (yLocalMax < -settings.rv) yLocalMax = -settings.rv;

x -= xLocalMax * ((float)settings.gh / 250);
y -= yLocalMax * ((float)settings.gv / 250);
xDriftComp = xLocalMax * ((float)settings.gh / 250);
yDriftComp = yLocalMax * ((float)settings.gv / 250);
x -= xDriftComp;
y -= yDriftComp;
}

void applyDeadzone()
Expand Down

0 comments on commit 977426c

Please sign in to comment.