Skip to content

Commit

Permalink
swapped a few defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydeetay committed Apr 30, 2016
1 parent a7a6385 commit 43d5e4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PlainSmootherModelAdaptor implements SensorListener {
@Inject
PlainSmootherModelAdaptor(AstronomerModel model, SharedPreferences sharedPreferences) {
this.model = model;
reverseMagneticZaxis = !sharedPreferences.getBoolean(REVERSE_MAGNETIC_Z_PREFKEY, false);
reverseMagneticZaxis = sharedPreferences.getBoolean(REVERSE_MAGNETIC_Z_PREFKEY, false);
}

@Override
Expand All @@ -56,8 +56,10 @@ public void onSensorChanged(int sensor, float[] values) {
magneticValues.y = values[1];
// The z direction for the mag magneticField sensor is in the opposite
// direction to that for accelerometer, except on some phones that are doing it wrong.
// TODO(johntaylor): this might not be the best place to reverse this.
magneticValues.z = reverseMagneticZaxis ? -values[2] : values[2];
// Yes that's right, the right thing to do is to invert it. So if we reverse that,
// we don't invert it. Got it?
// TODO(johntaylor): this might not be the best place to do this.
magneticValues.z = reverseMagneticZaxis ? values[2] : -values[2];
} else {
Log.e(TAG, "Pump is receiving values that aren't accel or magnetic");
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/preference_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
android:entries="@array/sensor_damping"
android:defaultValue="EXTRA HIGH" />
<CheckBoxPreference
android:defaultValue="true"
android:defaultValue="false"
android:title="@string/sensor_reverse_preference_title"
android:summary="@string/sensor_reverse_preference_summary"
android:key="reverse_magnetic_z"/>
Expand Down

0 comments on commit 43d5e4e

Please sign in to comment.