MetaWear-SDK-Cpp icon indicating copy to clipboard operation
MetaWear-SDK-Cpp copied to clipboard

Сhange the device name permanently with macro not working

Open tagplus5 opened this issue 10 months ago • 0 comments

I need to change name of device. I change it using a method in the api, but after the battery runs out, the device name returns to default. I tried using macro. The macro is recorded successfully, if I call it after recording, the device name changes, but after the battery is discharged, the macro does not start automatically and the script crashes when manually started. Has anyone experienced this behavior?

Macro example from c++ api:

In this example, we will change the device name permanently:

#include "metawear/core/macro.h"
#include "metawear/peripheral/led.h"

void setup_macro(MblMwMetaWearBoard* board) {
    static auto callback = [](MblMwMetaWearBoard* board, int32_t id) {
        cout << "Macro ID = " << id << endl;
        macro_id = id;
    };

    // Change on boot
    mbl_mw_macro_record(board, 1);
    auto new_name = "METAMOO";
    mbl_mw_settings_set_device_name(board, new_name, 7);
    mbl_mw_macro_end_record(board, callback);

    // Change the name now
    mbl_mw_macro_execute(macro_id);
}

tagplus5 avatar Aug 29 '23 10:08 tagplus5