• So to answer your question - what is wait() - it was a hack that I knew would one day need to be discussed. Its the bad bit of code below:

    // quick hack
    function wait(ms){
      var start = new Date().getTime();
      var end = start;
      while(end < start + ms) {
        end = new Date().getTime();
      }
    }
    

    What is really needed is a yield(ms) function that gracefully yields but comes back to the same thread in ms time.

    So the question is how to code using timers something like this:

    function setupPSMOO() {
      log_debug("setupGPS() PSMOO");
      UBX_CFG_RESET();
      wait(100);
      
      UBX_CFG_PM2(settings.update, settings.search);
      wait(20);
      
      UBX_CFG_RXM();
      wait(20);
      
      UBX_CFG_SAVE();
      wait(20);
    }
    
About

Avatar for HughB @HughB started