Failed to change device name permanently
Hi,
I try to change my device name permanently using Macros- here is my code:
When I run the code, sometimes i get this error "Did not receive macro id within 250ms" . on the other times i get id=0 .Also, i do see the name changes bug after reset it returns to "MetaWear" , and i can see that the macro wasn't saved in flash
1. Do i miss something?
2. Can i increase the response time ?
```
metawear = Application.GetMetaWearBoard(mac);
metawear.InitializeAsync().Wait();
IMacro macro = metawear.GetModule<IMacro>();
macro.EraseAll();
macro.StartRecord(true);
ISettings settings = metawear.GetModule<ISettings>();
settings.EditBleAdConfig(name : newName)
byte id = await macro.EndRecordAsync();```
Comments
Follow the example code for erasing macros:
https://mbientlab.com/csdocs/0/macro.html#erasing-macros
I'm not sure what you mean by "response time"
How are you resetting the board?
Hi Eric,
1. I re-wrote the code (see below) and it seems to give me the new name after calling ResetAsync. However, when i reset from MetaBase android app, the name goes back to "MetaWear". Is renaming devcie as "MetaWear" is part of the Metabse code? is there a difference from MetaBase "Reset" and "ResetAsync"? can you confirm that my code does the correct behavior for replacing name permanently?
2. Is it normal that i get the Id for macro with value "0"? the Ids are zero based?
3. how can i test the macro is working after FW reset beside using ResetAsync? when i will do "Hard restart" the macro will still be there?
4. Should i do DisconnectAsync after ResetAsync? cause i tried and the code seems to be "hangout" in the line of the disconnect
I don't see any call to
ResetAsync
in your posted code.Search the forums before posting:
https://mbientlab.com/community/search?Search="metabase+reset"
How IDs are created is irrelevant to the caller.
That is how to you test the macro.
What is "hard restart"?
Why are you interacting with the board after it has been reset? I don't see "ResetAsync" in your code anyways.
Actually, there is a call to
ResetAsync
- note the line " await metawear.GetModule().ResetAsync(); " at the end of the third blocki did search but i assumed it is not relevant cause this is C++ thread. However, I read it now and i understood that metabase clears macros, and ResetAsync not (you called it "simple reset" in the thread. Is this correct?
OK so getting 0 is normal..
I mean Hard RESET... as explained at the MBIENTLAB TROUBLESHOOTING page [https://mbientlab.com/troubleshooting/ ] at Hard Reset (PROs ONLY) section...
So there is not point to call disconnect after reset i understand. Is there is an option to add callback on disconnect asynch to do the rests in the c# SDK ?
The first statement of that sections says
Why are you shorting the board if it is working fine?
I'm not sure what you are asking here.