Skip to content

Сhange the device name permanently with macro not working #33

Open
@tagplus5

Description

@tagplus5

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions