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.

system_deep_sleep (ESP8266)

I've just started using Mongoose OS (v2.7.1) and I have to say I like it so far, but I've encountered a problem with trying to use system_deep_sleep on an ESP8266.

If I try to use system_deep_sleep from C following the suggestion elsewhere by including <user_interface.h> the code will compile but fails to link with as it can't find 'system_deep_sleep(unsigned long long)'.

Trying with Javascript and mJS I can enter deep sleep. I could continue my project in JS (need to work out some async issues and the fact that the module won't sleep once MQTT is connected to AWS) but I'd really like to know why the link fails in C!

Any ideas?

Cheers

Mike

Comments

  • Do you try to use it in a C++ file? If yes:

    #ifdef __cplusplus
    extern "C" {
    #endif
    #include <user_interface.h>
    #ifdef __cplusplus
    }
    #endif
    

    The mJS source code for ESP8266.deepSleep is here

    Thanked by 1meyek68
  • Good call.

    I thought I'd tried extern, but if I did I didn't also make sure the timeout was a double. All working now.

Sign In or Register to comment.