• I took a pass at the esp8266 wifi library and reorganized Neil's code (the core of the code is largely unchanged). I'd like to discuss the result in the context of the generic wifi library. I tried to document each function as well as I can, but I'm sure there's room for improvement. The result can be seen at https://s3.amazonaws.com/s3.voneicken.co­m/espruino/functions.html#wifi
    For reference, the wiki discussion about all this was at https://github.com/espruino/Espruino/wik­i/Generic-WiFi-Design
    The reorg follows much of the wiki, but isn't the same by a long shot.

    One item I have not resolved is asynchronicity. It seems that all functions have to be async in order to work for wifi modules connected via serial. Is that true or does it not really matter when a high enough baud rate is used? I have to admit that I don't like the async getters because it turns simple things like finding out what the IP address is into callback hell. The best I can come up with is to add an optional callback parameter and to document that using the direct return value may not be as portable. This way the user can decide whether to use the more portable callback stuff or not. :-)

    Note that what I have isn't yet working. I worked on the docs first in order to get this discussion going so I'm not changing the whole thing twice..

    NB: I also tweaked the ESP8266 library to remove some overlap and there are remains of the ESP8266WiFi library in the doc file that will go away.

    NNB: I find the formatting of the documentation to be really painful. Specifically, I can't figure out how to reliably get a bullet list into the description section and I find the fact that each newline starts a new paragraph (as opposed to needing an empty line) frustrating too.

About

Avatar for tve @tve started