We only want to leave the power on when we issue the copy scratchpad command, not for other commands. This is the only time that s() gets called with a 4 element array, all other times it's called with 1 or 3 element array - hence checking for i==3 is true for the write scratchpad command only.
Re: allObjects' comment about connect - Hmm. Not sure what to do here. Am I understanding correctly that the issue is that if you don't export the whole class, then you can't add things to the prototype? And thus, if you had multiple eeproms and wanted to add somethign to the prototypes (like the helper functions I mentioned above for converting numbers to bytes or w/e). What are the disadvantages of exporting the class?
Worth noting - there aren't any other EEPROMs for the OneWire bus as far as I can tell, just the line from Dallas Semi.
© Espruino, powered by microcosm.
Report a problem