Attempt to make good

This commit is contained in:
Luca Warmenhoven
2024-05-28 15:58:25 +02:00
parent 5a226dd56b
commit 5789f4c0dd
2 changed files with 4 additions and 3 deletions

View File

@@ -76,7 +76,7 @@ public class ExerciseManager {
content.get(PROPERTY_NAME).getAsString(), content.get(PROPERTY_NAME).getAsString(),
content.get(PROPERTY_DESC).getAsString(), content.get(PROPERTY_DESC).getAsString(),
gesturePathFromString(content.get(PROPERTY_VECTORS).getAsString()), gesturePathFromString(content.get(PROPERTY_VECTORS).getAsString()),
DEFAULT_SEGMENT_SPEED gesturePathFromString(content.get(PROPERTY_SEGMENT_SPEED).getAsString())
); );
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@@ -108,9 +108,10 @@ public class PersonalMotionPreviewElement extends View {
// Handler that is called every time the motion processor receives new data. // Handler that is called every time the motion processor receives new data.
this.motionProcessor.setMotionDataEventHandler((processed, preprocessed, sampleIndex, sampleRate, deviceId) -> { this.motionProcessor.setMotionDataEventHandler((processed, preprocessed, sampleIndex, sampleRate, deviceId) -> {
this.exerciseProgress = Math.min(1, Math.max(0, this.motionProcessor.getAverageError(this.paths[0], 0) / 10)); double progress = this.motionProcessor.getAverageError(this.paths[0], 0);
this.exerciseProgress = Math.min(1, Math.max(0, progress));
this.invalidate(); this.invalidate();
Log.i("MotionProcessor", "Processed data: " + processed); Log.i("MotionProcessor", "Processed data: " + progress + " (" + preprocessed + ")");
}); });
saySomethingNice(); saySomethingNice();
} }