Pep crack cocaine

This commit is contained in:
Luca Warmenhoven
2024-05-28 15:00:48 +02:00
parent 31135d1aa7
commit 62e1320b3c
2 changed files with 6 additions and 13 deletions

View File

@@ -102,7 +102,7 @@ public class PersonalMotionPreviewElement extends View {
this.qiContext = context; this.qiContext = context;
if ( this.motionProcessor != null ) if ( this.motionProcessor != null )
this.motionProcessor.stopListening(); this.motionProcessor.stopListening();
this.motionProcessor = new MotionProcessor(qiContext); this.motionProcessor = new MotionProcessor();
this.motionProcessor.startListening(); this.motionProcessor.startListening();
this.motionProcessor.setMotionDataEventHandler((processed, preprocessed, sampleIndex, sampleRate, deviceId) -> { this.motionProcessor.setMotionDataEventHandler((processed, preprocessed, sampleIndex, sampleRate, deviceId) -> {
// TODO: Implement the calculation of the `performingPath` based on the motion data // TODO: Implement the calculation of the `performingPath` based on the motion data

View File

@@ -28,12 +28,8 @@ public class MotionProcessor {
private GesturePath path; private GesturePath path;
private WebServer server; private WebServer server;
private QiContext context;
private long lastMessage = System.nanoTime(); public MotionProcessor() {
public MotionProcessor(QiContext context) {
this.context = context;
} }
@@ -73,11 +69,6 @@ public class MotionProcessor {
*/ */
public void parsePacket(@NotNull String data) { public void parsePacket(@NotNull String data) {
if ( System.nanoTime() - lastMessage < 2 * 1E9)
return;
lastMessage = System.nanoTime();
FitnessCycle.say("Informatie ontvangen", context);
/*
// If the message starts with 'data', it's a data packet. // If the message starts with 'data', it's a data packet.
if ( data.startsWith("data")) { if ( data.startsWith("data")) {
Log.i("MotionProcessor", "Received data packet: " + data.split(" ")[1]); Log.i("MotionProcessor", "Received data packet: " + data.split(" ")[1]);
@@ -93,10 +84,12 @@ public class MotionProcessor {
Float.parseFloat(vectorData[1]), Float.parseFloat(vectorData[1]),
Float.parseFloat(vectorData[2]) Float.parseFloat(vectorData[2])
); );
Log.i("MotionProcessor", "Device calibrated at " + ZERO.toString()); Log.i("MotionProcessor", "Device calibrated at " + ZERO);
} else if ( data.startsWith("sampleRate")) { } else if ( data.startsWith("sampleRate")) {
this.sampleRate = Float.parseFloat(data.split(" ")[1]); this.sampleRate = Float.parseFloat(data.split(" ")[1]);
}*/ } else {
Log.i("MotionProcessor", "Received unknown packet: " + data);
}
} }
/** /**