factory reset

is a full factory reset available anywhere in the c# sdk? i'm not seeing it. if not, could it be added in a future release? thanks much.

Comments

  • What do you mean by "full factory reset"?

  • sorry, i misremembered the precise name.

    there are two options in the (old?) iOS API app and SDK.

    1) in app: "Soft Reset" / in iOS SDK code: "resetDevice"

    Perform a software reset of the device.

    2) in app: "Reset To Factory Defaults" / in iOS SDK code: "setConfigurationAsync"

    Upon calling it will erase all non-volatile memory the device (which requires disconnect), then perform reset, once its comes back online we will connect and invoke the setupEvents method. Then the runOnDeviceBoot method is invoked and all calls in that method are persisted device side so after any future reset these settings will be applied automatically.

    I believe the #1 "Soft Reset" is available in the C# SDK as GetModule().ResetAsync() but it's not clear if the #2 "Reset To Factory Defaults" is available anywhere.

  • setConfigurationAsync from the previous iOS SDK pertains to erasing macros. If you aren't programming any macros, you can just use the normal ResetAsync function.

  • for our application we do need to erase macros and do the setupEvents / runOnDeviceBoot piece. we also use that call for the secondary purpose of resetting the neopixel hardware. if there are reliable ways to do both of those via other means, that's fine; otherwise it's been working great to do all that at once in our iOS app.

  • Macro documentation should suffice:
    https://mbientlab.com/csdocs/0/macro.html

  • that doesn't help with the second need to reset the neopixel.

    our goal is to reset the board fully to a known-good configuration as part of the connection sequence. this is a sort of sledgehammer approach but given various issues we've had in day to day use in the field, it is the most reliable approach and reduces our customer-support burdens.

    in some situations that means erasing macros and stored commands, presumably "macro.EraseAll()" will work but we've not gotten far enough to test that. but in some cases that means resetting the neopixel, and so far it appears that the existing neopixel calls don't handle some situations. there may be other reset-based needs that are not immediately apparent given that we've been using this strategy for a while.

  • Once the macros have been erased, the board won't rerun the previous commands on boot. All you need to do after that is reset the board.

    metawear.GetModule<IMacro>().EraseAll();
    metawear.GetModule<IDebug>().ResetAfterGc();
    metawear.GetModule<IDebug>().DisconnectAsync();
    
  • as mentioned in my last, the macro side doesn't really address the full problem.

    regardless of that detail, we've gotten a little off track. we're trying to move from the iOS SDK to the C# SDK. one of the features we've been relying on for years is not in the C# SDK. can it be added?

  • edited November 2018

    Test the code I posted before prematurely concluding that it does not do what you need.

  • tested. it does not do what we need.

    • What was the behavior your saw vs. what you expected?
    • What commands are you executing to setup the board?
  • expected v actual:

    • expected: programs / macros erased, LED & neopixel turned off / deallocated.
    • actual: programs / macros erased, neopixel stays lit and is not controllable

    please note that i did not yet do exhaustive testing with all three models of board that we use, etc.

    setup commands:

    • IMetaWearBoard.InitializeAsync();
    • (get serial #, ReadBatteryLevelAsync() , etc...)

    all of this works fine, so long as the board has been "wiped" by calling setConfigurationAsync() called from the iOS side first.

    the main problem right now is with the neopixel module. it is possible that other issues may appear that have been heretofore masked by using setConfigurationAsync() to start from a known-good state on every connection.

  • What are the exact functions are you running?

  • metawear.InitializeAsync();
    metawear.GetModule().EraseAll();
    metawear.GetModule().ResetAfterGc();
    metawear.GetModule().DisconnectAsync();

    [ wait, scan, find it again... ]

    metawear.InitializeAsync();
    metawear.ReadDeviceInformationAsync();
    metawear.ReadBatteryLevelAsync();

    INeoPixel pxl = metawear.GetModule();
    IStrand strd = pxl.InitializeStrand(0, ColorOrdering.WS2811_GRB, StrandSpeed.Slow, 0, 1);
    strd.SetRgb(0, 255, 0, 255);

  • Wrap your code with the appropriate Markdown code tags. Otherwise, code looks fine to me.

    You mentioned that you are using 3 models.

    • Does setConfigurationAsync work for all of your boards?
    • Did the C# reset code work for any of them?
      • What are the hardware revision, firmware revision, and board model of the boards that work / didn't work
This discussion has been closed.