How to log properly?
I am trying to use the multimw tutorial code to connect to multiple boards, but I cannot find any documentation on how the logging works.
In perticular, I want the logger to collect 64 samples and then send them to the phone.
I tried the delay function, but this sais that only 4 bytes can be delayed, which is not enough.
When I try to log the data most of the time I get a 'creation logger timed out', sometimes 4 or 5 samples, and every now and then a 100 samples.
I don't understand what is happening at the moment, and how to tell the board to log 64 samples before.
In perticular, I want the logger to collect 64 samples and then send them to the phone.
I tried the delay function, but this sais that only 4 bytes can be delayed, which is not enough.
When I try to log the data most of the time I get a 'creation logger timed out', sometimes 4 or 5 samples, and every now and then a 100 samples.
I don't understand what is happening at the moment, and how to tell the board to log 64 samples before.
This discussion has been closed.
Comments
return accelerometer.acceleration().addRouteAsync(new RouteBuilder() {And then in then after starting the accelerometer and logging:@Override
public void configure(RouteComponent source) {
source.log(new Subscriber() {
int samples = 0;
@Override
public void apply(final Data data, Object... env) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
newDeviceState.accelValue [samples] = data.value(Acceleration.class).toString();
connectedDevices.notifyDataSetChanged();
Log.i("MainActivityFragment", "State changed: ");
samples++;
}
});
}
});
}
});
loggingCapture.get().downloadAsync(100, new Logging.LogDownloadUpdateHandler() {@Override
public void receivedUpdate(long nEntriesLeft, long totalEntries) {
Log.i("MainActivityFragment", "Progress Update = " + nEntriesLeft + "/" + totalEntries);
}
}).continueWithTask(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(Task<Void> task) throws Exception {
Log.i("MainActivityFragment", "Download completed at " + accelCapture.get().getOdr());
loggingCapture.get().stop();
return null;
}
});