Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

FFI Error while calling Sys.reboot(0)

rodrmigurodrmigu Fairfax, Virginia

Hello,

Trying to call Sys.reboot(0), I get the following: MJS callback error: failed to call FFIed function: got 1 actuals, but function takes 0 args

init.js

load('api_sys.js');
load('api_timer.js');
load('api_config.js');

Timer.set(10000, 0, function() {
    Sys.reboot(0);
}, null);

log

[Dec 21 10:52:31.310] mgos_mqtt_ev         MQTT CONNACK 0
[Dec 21 10:52:31.315] mgos_event_trigger   ev MOS4 triggered 0 handlers
[Dec 21 10:52:35.006]   at init.js:6
[Dec 21 10:52:35.015] MJS callback error: failed to call FFIed function: got 1 actuals, but function takes 0 args
[Dec 21 10:53:32.107] mqtt_handler         Send PINGREQ
[Dec 21 10:53:32.107] mgos_mqtt_ev         MQTT event: 213

Regards
Rodrigo

Comments

  • nliviunliviu Romania
    edited December 2018

    There is an error in the docs. Sys.reboot does not take any argument.

    Sys.reboot();
    
    Thanked by 1rodrmigu
  • rodrmigurodrmigu Fairfax, Virginia

    Weird, I tried that as well and didn't work, but now it works.

    Anyway, thanks
    Rodrigo

  • rodrmigurodrmigu Fairfax, Virginia

    Looks like there was a recent change and now the parameter needs to be provided.

    Sys.reboot was changed from mgos_system_restart to mgos_system_restart_after

      // ## **`Sys.reboot(ms)`**
      // Reboot the system after `ms` milliseconds. Return value: none.
      reboot: ffi('void mgos_system_restart_after(int)'),
    

    Regards

  • changed it to the following, it worked:

    Sys.reboot(1); // 1 ms

Sign In or Register to comment.