Skip to content

Commit

Permalink
Update to v1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
GrazianoCapelli committed Aug 28, 2024
2 parents 3791726 + 429efc3 commit 5fe3ed0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
Binary file added apk/Clinometer-1.2.4.apk
Binary file not shown.
Binary file modified apk/Clinometer-latest.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {

// -----------------------------------------------------------------------------------------
// We use the Semantic Versioning (https://semver.org/):
versionName '1.2.3'
versionCode 9
versionName '1.2.4'
versionCode 10
// -----------------------------------------------------------------------------------------

vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public class CalibrationActivity extends AppCompatActivity implements SensorEven
private final float[] calibrationGain = new float[3]; // The Gains of accelerometers
private final float[] calibrationAngle = new float[3]; // The calibration angles

private float calibrationPrecisionIncrement = 0; // The increment of the MIN_CALIBRATION_PRECISION in case of calibration reset

private AppCompatButton buttonNext;
private ProgressBar progressBar;
private ImageView imageViewMain;
Expand Down Expand Up @@ -441,17 +443,28 @@ public void onSensorChanged(SensorEvent event) {
getString(R.string.calibration_tolerance),
mvGravity0.getTolerance()));
int progress1 = (int) (10 * mvGravity0.percentLoaded());
int progress2 = (int) (Math.min(1000, Math.max(0, 1000 - 1000 *(mvGravity0.getTolerance() / MIN_CALIBRATION_PRECISION))));
int progress2 = (int) (Math.min(1000, Math.max(0, 1000 - 1000 *(mvGravity0.getTolerance() / (MIN_CALIBRATION_PRECISION + calibrationPrecisionIncrement)))));
progressBar.setSecondaryProgress(Math.max(progress1, progress2));
progressBar.setProgress(Math.min(progress1, progress2));


// DEVICE MOVED

if (mvGravity0.isReady() && (mvGravity0.getTolerance() > MIN_CALIBRATION_PRECISION)) {
//Log.d("Clinometer",String.format("[#] Mean value = %+1.5f Reading = %+1.5f Difference = %+1.5f", mvGravity0.getMeanValue(), event.values[0], mvGravity0.getMeanValue() - event.values[0]));

//if (mvGravity0.isReady() && (mvGravity0.getTolerance() > MIN_CALIBRATION_PRECISION)) {
if (mvGravity0.isReady() && (
(Math.abs(mvGravity0.getMeanValue() - event.values[0]) > (MIN_CALIBRATION_PRECISION + calibrationPrecisionIncrement)) ||
(Math.abs(mvGravity1.getMeanValue() - event.values[1]) > (MIN_CALIBRATION_PRECISION + calibrationPrecisionIncrement)) ||
(Math.abs(mvGravity2.getMeanValue() - event.values[2]) > (MIN_CALIBRATION_PRECISION + calibrationPrecisionIncrement)))
) {
mvGravity0.reset();
mvGravity1.reset();
mvGravity2.reset();
if (calibrationPrecisionIncrement < 0.15f) calibrationPrecisionIncrement += 0.01f;
//Log.d("Clinometer",String.format("[#] Mean value = %+1.5f Reading = %+1.5f Difference = %+1.5f", mvGravity0.getMeanValue(), event.values[0], mvGravity0.getMeanValue() - event.values[0]));
Log.d("Clinometer",String.format("[#] New calibration precision = %+1.5f", MIN_CALIBRATION_PRECISION + calibrationPrecisionIncrement));

}

// END OF CALIBRATION STEP
Expand All @@ -467,6 +480,8 @@ public void onSensorChanged(SensorEvent event) {

beep();

calibrationPrecisionIncrement = 0;

currentStep++;
startStep();
}
Expand Down
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixes the calibration problem in some devices
Binary file added sourcecode/Clinometer-1.2.4 - Source.zip
Binary file not shown.

0 comments on commit 5fe3ed0

Please sign in to comment.