You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Maybe... Busy-waiting is a really bad idea in Espruino though.

    The best bet would be to return the last temp reading if no callback was supplied (the current behaviour), and if there was a callback, to kick off a new reading, wait and return that.

    The code above waits 1 second for the callback - seems pretty extreme? I doubt many people would be happy with that.

    I'm still a bit confused here - does the existing DS18B20 library not work with ESP8266? My understanding was just that the current one was fine, but it just returned the previous reading (which means the first one returns 85 or something like that).

    There is no versioning in modules, so if the library code was updated there is no easy way to tell if an update has been made.

    Well, there's GitHub's versioning? Each version of each module has a unique Git hash. I guess that could be added to each module in espruino.com/modules?

    Then if you want to go back to a certain version, pull it straight off GitHub, eg: require("https://raw.githubusercontent.c­om/espruino/EspruinoDocs/47ca0f6b2ba6076­62071822f115cf3a3b57f5d93/devices/DS18B2­0.js")

    Would a simple 1.2 type version number in the module header suffice?

    Maybe. What do you expect to do with it though? Most people won't look at the module number until something goes wrong, and then it's too late. How would you then work back to find the older version?

About

Avatar for Gordon @Gordon started