• I figured this out. setIP() returns true when it successfully finishes.

    Updated onInit code:

    function onInit() {
      console.log("Connecting to Ethernet");
    
      SPI2.setup({ mosi:B15, miso:B14, sck:B13 });
      eth = require("WIZnet").connect(SPI2, B10);
    
      console.log("Connect?: " + isConnected);
    
      isConnected = eth.setIP();
      console.log("Connect?: " + isConnected);
    
      if (isConnected == true) {
        mqttConnect();
      }
    
      //eth.getIP();
      eth.getIP(function(f,ip) {
        console.log("IP: ",ip);
        mqttConnect();
      });
    
    }
    
About

Avatar for d0773d @d0773d started