• E.showMessage("Configuring GPS") on its own, it flashes on screen and is gone very quickly

    Is it possible that setupGPS(); or something like that clears the screen?

    But it is ugly as sin :(

    That is why JavaScript has promises...

    function delay(ms) {
      return new Promise(resolve => setTimeout(resolve, ms));
    }
    
    log_debug("setupGPS() PSMOO");
    Promise.resolve().then(function() {
      UBX_CFG_RESET();
      return delay(100);
    }).then(function() {
      UBX_CFG_PM2(settings.update, settings.search);
      return delay(20);
    }).then(function() {
      UBX_CFG_RXM();
      return delay(20);
    }).then(function() {
      UBX_CFG_SAVE();
      return delay(20);
    }).then(function() {
      // finished!
    });
    

    It's just one of the gotchas of working with JS. Since it's not actually multithreaded you can't just yield - and it's one of the reasons I don't provide a wait function in Espruino (because it'd just get abused ;).

About

Avatar for Gordon @Gordon started