• Hi, I'm a student using a ESP32 in combination with espruino to create a webserver for some sort of control panel.

    I can run my code fine if use "save to ram" in the IDE options but when I set the option to "Direct to flash (execute code at boot)" I get this error:

    this is the code I'm trying to run (created a pastebin because the forum doesn't let me paste the whole thing):

    https://pastebin.com/FnkHNNdW

    I've tried erasing flash and reflashing but that doesn't seem to do anything.
    Also, is this code a good way of making a webserver or would you suggest something else?

  • Your last line, "onInit ();", do not save to flash.
    When you reset, "onInit ();" run automatically.
    And I'm waiting to start other features that rely on that
    the wifi is connected like this.

        wifi.connect (ssid, {password: password}, function () {
    });
    
       wifi.on ('connected', function () {
         console.log ('Connected to Wifi. IP address is:', wifi.getIP () .ip);
         server start ();
         }
       });
    
    

    Maybe it can help you further.

  • I've deleted my last line "onInit();" and applied your wifi change but it still gives me a weird error:

    I have Modules uploaded as functions turned on as I want to save more RAM. Also tried turning it off and then I get this error:

    Does anyone have a suggestion?

  • wifi.on ('connected', function () {
       console.log ('Connected to Wifi. IP address is:', wifi.getIP () .ip);
       setTimeout (start server, 400);
    });
    
    

    I do not think that 'storage.write ("1.css", ...) is fast enough before the server starts, so I used a delay, maybe it should be different on your system.
    I tried with 'setTimeout (StartServer, 400);' and got this picture on screen.
    Hope it will take you on.


    1 Attachment

    • Opera Snapshot_2018-06-10_150700_192.168.20.50.png
  • Ah yes, that seemed to do the trick.

    Thank you very much!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Storage.write not working when using save on send

Posted by Avatar for user90767 @user90767

Actions