• Hi Robin 🙂!

    It's uploaded from the right-hand side, then uploaded to Flash using the "Send to Espruino" button in the IDE.

    I have boiled down the code to this (right-hand side):

    // ****************************************­*********************
    // *** CONST / VARS
    // ****************************************­*********************
    
    // Pins
    const PIN_RESET = D17;
    const PIN_CS = D4;
    const PIN_SCK = D5;
    const PIN_MISO = D19;
    const PIN_MOSI = D23;
    
    let sx;
    
    // ****************************************­*********************
    // *** MAIN
    // ****************************************­*********************
    
    /*
     * Called on boot
     */
    function onInit() {
    
        try {
            SPI1.setup({ sck: PIN_SCK, miso: PIN_MISO, mosi: PIN_MOSI });
    
            sx = require('SX127x').connect({
                spi: SPI1,
                cs: PIN_CS,
                rst: PIN_RESET
            });
    
        } catch (e) {
            console.log('e: ', e);
        }
    
    }
    

    Should this be taken literally as actual error text?

    No, the error is always as shown below:

    Uncaught Error: Radio not found!
     at line 1 col 65
    ...ow Error("Radio not found!");this.setOpMode(0);this.mask(1,1­...
    

    Persusing the source will reveal what var objects are created as the module is fetched/parsed. Maybe a conditional test against 'undefined' or what might be expected as those are initialized, and/or throw your own user defined error to catch?

    I don't quite understand what you are suggesting 🙂. Which properties could I test against undefined? I mean the error is happening inside the Espruino module, and apparently I'm unable to catch it externally. Modules are not my strongest side, but should't I be able to do that?--I mean, why throw an error if you are prevented from handling it 🤔..

    Thanks for taking the time to help 😁!

About

Avatar for rj @rj started