-
Sat 2020.09.19
'I can't get my hands on the module source code'
Clarification re: 'How does this provide me with the source code of the wifi-module?'
An external Javascript module may be accessed, such as for GPS
http://www.espruino.com/modules/GPS.js
full list:
http://www.espruino.com/modules/Whereas an internal module is made up of 'C' source that is built into the compiled firmware, as in the WiFi example
Walk up the folder tree
these may helphttps://github.com/espruino/Espruino/issues/1358
wifi.startAP()
https://github.com/espruino/Espruino/blob/9ffc5162047e93200e1356c3334b05f5ab67db53/libs/network/esp32/jswrap_esp32_network.c#L817
See @parasquid #31 example explanationUse of
wifi
anddump()
at the WebIDE command line in the L-Hand panel may provide additional debug feedback
-
Oh, that makes perfect sense, thanks 🙂! Unfortunately it means that I can't easily take the wifi-module source code and add the extra functionaly in there directly--so I have to stick with the current approach.
Great suggestion with using dump 👍. It does seem a little strange. It's as if some stuff (eg. the onInit) is defined twice. I guess the pinMode is stuff generated by default. This is what I get:
var ssid = "EDITED OUT"; var password = "EDITED OUT"; var Wifi = undefined; function onInit() { const w = wifi.connect(ssid, { password: password }, () => { console.log("Connected"); Wifi = w; wifi.enableMDNS("abcd", "iot", 80, function (result) { console.log("enableMDNS result: " + result); }); }); } pinMode(D0, "input_pullup", true); pinMode(D12, "input_pullup", true); pinMode(D13, "input_pullup", true); pinMode(D14, "input_pullup", true); pinMode(D15, "input_pullup", true); pinMode(D18, "input_pullup", true); pinMode(D19, "input_pullup", true); pinMode(D21, "input_pullup", true); pinMode(D22, "input_pullup", true); pinMode(D25, "input_pullup", true); pinMode(D26, "input_pullup", true); pinMode(D27, "input_pullup", true); pinMode(D34, "input_pullup", true); pinMode(D35, "input_pullup", true); pinMode(D36, "input_pullup", true); pinMode(D37, "input_pullup", true); pinMode(D38, "input_pullup", true); pinMode(D39, "input_pullup", true); // Code saved with E.setBootCode // ************************************************************ // *** IMPORTS // ************************************************************ const ssid = "EDITED OUT"; const password = "EDITED OUT"; // ************************************************************ // *** IMPORTS / CONSTANTS // ************************************************************ //const ssid = "<ACCESS_POINT_SSID>"; // const password = "<PASSWORD>"; const wifi = require("Wifi"); let Wifi = null; wifi.enableMDNS = (hostname, serviceType, port, callback) => { let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n"; Wifi.at.cmd(mdns, 500, function (d) { callback(d); }); }; // ************************************************************ // *** MAIN // ************************************************************ /* * Called on boot */ function onInit() { const w = wifi.connect(ssid, { password: password }, () => { console.log("Connected"); Wifi = w; wifi.enableMDNS("abcd", "iot", 80, function (result) { console.log("enableMDNS result: " + result); }); }); }
Hi Robin 🙂.
Thanks for your suggestion! Sorry, I don't see what information I'm supposed to be getting from https://github.com/espruino/Espruino/blob/master/libs/network/jswrap_wifi.c#L207 😥. How does this provide me with the source code of the wifi-module 🙂?
About post #19: yes, indianaJones ends up suggesting some code based on #19, in post #23, and this is the code I'm trying to use.
http://forum.espruino.com/comments/14957853/