Project for an Autonomous Sailing Boat



  • @neoniousTR

    I understood two things :

    • the content (not the directory) of "static_files" is "compiled" and stored somewhere
    • the content (not the directory) of "factory_files" is copied in the user filesystem as "root" files

    also I modified the code.main to "/index.js"
    and in my user parameters the place of mutable files

    It works well
    the restart time is reduced from 1 minute to 6 seconds. !!!
    the process time is reduced from 4 seconds to 0.5 seconds. !!!

    Thanks a lot !!



  • factory_files is only copied on --init, not on future flashes without --init, here you will want to keep your data files.

    I really need to replace the SPIFFS file system. If it does not find a file, it searches through every sector. Not really feasable for Node.JS which looks in many locations. I have on the list to switch to littlefs, that should help with this problem. Till then, good to hear we have a solution.



  • @neoniousTR

    Sometime when my process start the system date&time is not set.
    How and when is it done ?

    --- User program's output: ---
    [00:00:02] 	-----------------------------------------------------------------
    [13:57:40] isWithRestart:	true
    [13:57:40] 	runAndUpdate
    [13:57:40] DatabaseManager:	database has been restored.
    [13:57:40] Actionneur:	run
    [13:57:44] DatabaseManager:	database has been dumped asynchronously ! 2111bytes
    [13:58:17] 	loop         #1	3724msec	 freemem = 1018k	 delta = 324k
    


  • Whenever it has Internet access. But, as you opened the other topic regarding this, I guess you already figured that out 🙂



  • @neoniousTR
    I choose to post some general informations outside the "project item", what do you prefer ?



  • Not sure about what you are asking with your question. Your posts have always been on topic, so I did not have any problem with your posts yet, in or outside of this project item 🙂



  • Process cleanup :

    In my program I need to have a snapshot of my permanent datas when the application exit.

    With nodejs, I defined a cleanup process to do that.

    When a signal process is 'exit', 'SIGINT', 'uncaughtException'.
    With lows, I never succeeded to observe the process.

    For exemple if I send manually lowsync stop or if I stop with the IDE

    My module :

    // Object to capture process exits and call app specific cleanup function
    
    module.exports = {
        cleanup:cleanup
    }
    
    function noOp() {};
    
    function cleanup(callback) {
    
      // attach user callback to the process event emitter
      // if no callback, it will still exit gracefully on Ctrl-C
      callback = callback || noOp;
      process.on('cleanup',callback);
    
      // do app specific cleaning before exiting
      process.on('exit', function () {
        process.emit('cleanup');
      });
    
      // catch ctrl+c event and exit normally
      process.on('SIGINT', function () {
        process.exit(0);
      });
    
      //catch uncaught exceptions, trace, then exit normally
      process.on('uncaughtException', function(e) {
        console.log('Uncaught Exception...');
        console.log(e.stack);
        process.exit(99);
      });
    };
    

    Can I have a best solution ?



  • In my software, I need absolutely to control the end of the process if an unknown exception is happening or if I execute during my tests a lowsync stop.
    What events are fired in the process ?
    Can you help me ?



  • All of that code should work. Uncaught exceptions are handled, the exit event is also handled...if you use process.exit.

    However that lowsync stop is like kill -KILL, so not observable. So I see the problem.

    lowsync stop or the stop button in the IDE should first try gracefully, then do it non-gracefully.

    Adding this to the TODO list. However currently on vacation till the 26th.



  • @neoniousTR Good vacation !


Log in to reply