• Okay Gordon, I'm really not getting it. Here is the Github for what we got goin:

    https://github.com/giokincade/autolocato­rjs.git

    The current file I am deploying is mw-test.js. The relevant code is:

    const connectToWifi = () => {
    	wifi.connect(WIFI_NAME, WIFI_OPTIONS, (err)  => {
    		if (err) {
    		  console.log("Connection error: " + err);
    		  return;
    		} else {
    			console.log("Wifi Connected!");
    			
    			var info = {
    				ip: "192.168.1.9"
    			};
    			
    			wifi.setIP(info, wifi.getIP((err) => {
    				console.log("IP set!");
    				startServer();
    			}));
    		}
    	});
    };
    

    I checked that it's syntactically valid, etc.-- seems fine. But the Espy is throwing an error w underlying code, I believe. And it is looping the upload process. Here's one cycle. Also, I'm including my deploy process as well. I'm a newbie so some basic mistake is totally possible.

    Matts-MacBook-Pro:autolocatorjs mattwalsh$ ./script/deploy
    + set -e
    + source script/env
    +++ espruino --list
    +++ grep usbmodem
    +++ awk '{print $1}'
    +++ head -1
    (node:2022) Warning: N-API is an experimental feature and could change at any time.
    ++ BOARD_PORT=/dev/tty.usbmodem1421
    + echo /dev/tty.usbmodem1421
    /dev/tty.usbmodem1421
    + espruino --port /dev/tty.usbmodem1421 --board board.json --watch src/mw-test.js
    Espruino Command-line Tool 0.1.31
    -----------------------------------
    
    Explicit board JSON supplied: "board.json"
    Connecting to '/dev/tty.usbmodem1421'
    (node:2026) Warning: N-API is an experimental feature and could change at any time.
    Connected
    Module Wifi not found
    
     ____                 _ 
    |  __|___ ___ ___ _ _|_|___ ___ 
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v05 (c) 2019 G.Williams
    
    >
    >Upload Complete
    Wifi Connected!
    IP set!
    Starting Server
    Uncaught Error: Function "b" not found!
     at line 1 col 12
    if("OK"==a)b(null);else return b("setIP failed: "+(a?a:"Time...
               ^
    in function "c" called from line 1 col 25
    g=void 0;var b;c&&(b=c(a))?(g=e,c=b):clearTimeout(d);­void 0=...
                            ^
    in function "g" called from line 2 col 4
    g(f)}b=b.substr(a+1);if(p&&d)return q("");"\n"==b[0]&&(b=b.s...
       ^
    in function called from system
    Uncaught Error: Function "b" not found!
     at line 1 col 32
    ...OK"==a)b(null);else return b("setIP failed: "+(a?a:"Timeout"...
                                  ^
    in function "c" called from line 1 col 15
    g=void 0;c&&c();void 0===g&&0<k.length&&f.cmd.apply(f,k.shif.­..
                  ^
    in function called from system
    

    What am I doing wrong here? For what it's worth, our initial test.js works:

    >Upload Complete
    Wifi Connected!
    IP Address: 192.168.1.158
    Starting Server
    Processing request
    Processing request
    

    The setIP part of this is causing the failure. I don't get it. Any ideas?

About

Avatar for mattw @mattw started