Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/abstractingndparenting' into abs…
Browse files Browse the repository at this point in the history
…tractingndparenting
  • Loading branch information
powerfulHermes committed Jan 20, 2024
2 parents 1fd3013 + 30f6358 commit ddf1e0a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ private class ServoCounter extends Thread {
private int count = 0;

public void run() {
android.util.Log.w("AXON_THREAD", "Starting thread");
double lastPosition = getCurrentPosition();
while (true) {
android.util.Log.w("AXON_THREAD", "LOOP");
//android.util.Log.w("AXON_THREAD", "LOOP");
double currentPosition = getCurrentPosition();
// Negative wrap-around from 360 -> 0
// Positive wrap-around from 0 -> 360
if (currentPosition > 180 && lastPosition < 180 && innerServo.getPower() > 0) {
count--;
}
// Positive wrap-around from 0 -> 360
// Negative wrap-around from 360 -> 0
if (currentPosition < 180 && lastPosition > 180 && innerServo.getPower() < 0) {
count++;
}
Expand Down

0 comments on commit ddf1e0a

Please sign in to comment.