How to finalize my project ?

Posted on
  • Hey folks,

    at first its great to be here. It seems like this is a great community where everyone love the same thing.

    About my problem:

    I made a piece of HW with a ESP32 on it. To control this ( its some switching and sensor reading ) I wrote a server script for the ESP and a html for my client. I just sended everything to the ESP.
    The code works like expected and it seems to be good.

    Well to put the html on the device I used this in the IDE:

    let fs = require('fs');
    try {
      fs.readdirSync();
     } catch (e) { //'Uncaught Error: Unable to mount media : NO_FILESYSTEM'
      console.log('Formatting FS - only need to do once');
      E.flashFatFS({ format: true });
    }
    fs.writeFileSync('index.html', 'here is my code I want to put in the index');
    
    

    Wich worked perfectly.
    My code for the ESP was also just putted on the device by the IDE.
    I did some research how I could simplify this without progress.

    Is it possible to create a own binary wich got this included ?
    Or does anyone got an idea what to do next ?

    Thanks in advance

    Chris

  • Look at the onInit(){...} function and on its purpose. Place the startup code in it, upload the code again - it will (should) do nothing application-wise - and enter save() in the console... and you are done (save() is saving the code into FLASH from where Espruino will pick it up at the end of saving and on every power-up to com). Powering on the device in disconnected mode will call the onInit() as the last thing of startup.

  • Well I probably explained it wrong. I just want to upload my project on github as a openSource project and dont want the crowd to have so much struggle to get it on the device. I had something in my mind to just flash the device with my software build in. Or something like a script wich does the actual flash and afterwards the transmission of my scripts. Something like this.

    Thanks
    Chris

  • You could upload the code, save() it, and then read it out (using esptool), and distribute that file, couldn't you?

  • Thr 2018.08.16

    Hello Chris @user93073, are you trying to do something that would result like this:

    https://raw.githubusercontent.com/espruiĀ­no/EspruinoDocs/master/modules/MQTT.js

    If so, I agree with @DrAzzy

    or, if the idea is to have the user run the IDE anyway, wouldn't it be just as easy to provide the detail as in link above and just Ctrl+A Ctrl+C to copy while at that source page, then place the cursor caret within the right-hand pane of the IDE and Ctrl+V to copy the contents there, and then just press the upload button of the IDE?

  • What you can do is use the esptool and copy out the entire 4mb flash contents to a file. You can then host that in github, and people can download the image and flash with that. Please note wifi settings with passwords will be in the file, so you might want to blank thouse before you dump the image.

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

How to finalize my project ?

Posted by Avatar for user93073 @user93073

Actions