• I believe it's to do with execution speed. It turns out require("SX127x").connect doesn't execute immediately, and so you should only use it maybe 10ms after calling it.

    When you upload you get that delay automatically because of the upload, but executing from flash it's too quick.

    Just doing:

    var sx = require("SX127x").connect({spi: SPI1, cs: D6, rst : D7 });
    //....
    setTimeout(function() {
     sx.setTxConfig(config);
    console.log('Sending..');
    sx.send("Hello", function() {
      console.log("TX done");
    });
    }, 10);
    

    should do it - ideally there should be a callback function when initialisation is done

About

Avatar for Gordon @Gordon started