Duplicate logger issue

edited May 2017 in C#
Hello,

I am trying to build Windows Forms application on Windows 10. I use MetaWear CPRO device with 1.2.5 firmware.

I have done pairing, connecting, renaming, streaming data successfully. I am trying to test logging but I am encountering a strange problem that I haven't able found a solution. The problem is that when I register for acc signal log, the API calls logger ready callback once but when I use mbl_mw_logger_lookup_id function I see id 0 and id 1 are filled with same logger.

When I download log, I get half of the log what receivedProgressUpdate function tells. I don't get receivedUnknownEntry callback either.

Relevant code is below:


            loggerDelegate = new Fn_IntPtr(logger =>
            {
                if (logger != IntPtr.Zero)
                {
                    // below variables are equal to logger value above
                    var logger0 = mbl_mw_logger_lookup_id(board, 0);
                    var logger1 = mbl_mw_logger_lookup_id(board, 1);

                    mbl_mw_logger_subscribe(logger, dataPtr =>
                    {
                        Data data = Marshal.PtrToStructure<Data>(dataPtr);
                        var cf = Marshal.PtrToStructure<CartesianFloat>(data.value);

                        // ...
                    });
                }
                else
                {
                    Console.WriteLine("Failed to create the logger\n");
                }
            });

            var acc_signal = mbl_mw_acc_get_acceleration_data_signal(board);

            mbl_mw_datasignal_log(acc_signal, loggerDelegate);

            mbl_mw_logging_start(board, 0);
            mbl_mw_acc_enable_acceleration_sampling(board);
            mbl_mw_acc_start(board);


Comments

  • That is expected behavior for accelerometer data.  The only metric that matters is number of samples downloaded.  If your sample count is roughly equal to sampling rate * logging time, then you are good to go.  All of these other values mentioned are internal to the firmware and API.
  • Thanks Eric!

    It is really annoying for the beginners. Because you cannot know whether or not you are doing something wrong.
  • If

    # of samples = sampling rate * recording time

    Is true, then you're doing it right.  If you're logging, you can also check the time difference between consecutive samples.
This discussion has been closed.