Unable to Write Macro to device

Laura,
I finally got the code working to calibrate my sensors, but now I am having issues with storing the calibration data in a macro. I followed the code examples to store the data and it seams to work except that it returns null for the macro ID and when I reconnect to the sensor the calibration data is gone. Here is the code I am using:

    CancellationTokenSource cts = new CancellationTokenSource();
                sensorFusionBosch.start();
                sensorFusionBosch.calibrate(cts.getToken(), state -> {
                    Log.i("MainActivity", state.toString());
                })
                        .onSuccess(task2 -> {
                            sensorFusionBosch.stop();
                            final Macro macro2 = metawear.getModule(Macro.class);
                            macro2.startRecord(true);
                            sensorFusionBosch.writeCalibrationData(task2.getResult());
                            macro2.endRecordAsync().continueWith(new Continuation<Byte, Void>() {
                                @Override
                                public Void then(Task<Byte> task) throws Exception {
                                    Log.i("MainActivity", "Macro ID = " + task.getResult());
                                    return null;
                                }
                            });
                            return null;
                        });

Comments

  • Does anyone have any ideas as to why I cannot write the calibration data to the device and store it in a macro? Why the macro ID always returns null? I am using a MetaMotion R model 5 hardware version .4 with the firmware 1.7.2. The app I am using is an Android app running on Android 12.
    implementation 'com.mbientlab:metawear:3.8.2'
    implementation 'com.mbientlab.bletoolbox:scanner:0.3.1'
    implementation 'no.nordicsemi.android:dfu:2.0.2'

    Any help would be greatly appreciated.

    Thank you,
    Jeffrey Winkler

  • I am wondering if there is a problem with the 1.7.2 firmware. Since I upgraded to the 1.7.3 firmware the macro does seem to save the data and the code returns a value for the macro id.

  • Yes, there was an issue with the memory in 1.7.2 and that's why we immediately released 1.7.3.
    The issue only affected MMR/MMRL hardware version 0.4

  • Once I upgraded to 1.7.3 the macro is being saved. But now I have an issue with the sensor disconnecting at odd times. My app works great when the firmware on the sensor is 1.5.1, but not 1.7.3

  • What do you mean by "my app works great"?

  • The app that I created for Android works great when the sensor has a firmware version of 1.5.1, but not when the sensor has firmware version 1.7.3. The sensor disconnects from the phone after a minute or two if it has 1.7.3

  • edited May 2022

    Can you put some debug statements in your app and also look into the bluetooth raw packets to help debug?

Sign In or Register to comment.