Furthermore, I'd prefer an object over a list of parameters.
Yes, although I think in some cases (args that are always there) it could be preferable to include them? Maybe not though - I'm open to changes.
Of course if there is some existing standard or convention in Espruino, I would follow that
Yeah, it's Node.js. Generally node.js callbacks all have error as the first argument (I think so you can have varying numbers of arguments - including none - and still find the error).
Also, I'd just add:
wifi.setIP(object, callback)
Where object can have ip, mac, subnet, gateway and dns in it (if some are left out they're kept as-is). Basically it matches the object that you get from getIP.
If you just call setIP() it does DHCP - at least that's what WiFi and Ethernet do right now. Not sure if it's worth adding a specific DHCP function though?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, although I think in some cases (args that are always there) it could be preferable to include them? Maybe not though - I'm open to changes.
Yeah, it's Node.js. Generally node.js callbacks all have error as the first argument (I think so you can have varying numbers of arguments - including none - and still find the error).
Also, I'd just add:
wifi.setIP(object, callback)
Where object can have
ip
,mac
,subnet
,gateway
anddns
in it (if some are left out they're kept as-is). Basically it matches the object that you get fromgetIP
.If you just call
setIP()
it does DHCP - at least that's what WiFi and Ethernet do right now. Not sure if it's worth adding a specific DHCP function though?