Shouldn't this.ow.write(cmd[i],i==3); be this.ow.write(cmd[i],i==(cmd.length-1)); though? I should probably add 'arrays as arguments to OneWire.write' and 'multiple OneWire read' to the bug tracker too?
Can we change the name to something like DS2xxx as well? If there is any other OneWire memory out there (I imagine there is) then OWmem could be confusing.
What do you think about:
exports.connect = function(ow, pgsz, cap,n,device) {
if (pgsz=="DS2431") return new OWmem(ow, ....);
return new OWmem(ow, pgsz, cap,n,device);
};
Not sure what you think of @allObjects suggestion about connect? I guess you could do something like:
So we keep the 'connect' form which is used all over, but if you don't call connect then you get the base class. I'm not sure you really need that though, and you can always get to the list of prototypes from the instantiated object very easily.
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.
Looks great,
Shouldn't
this.ow.write(cmd[i],i==3);
bethis.ow.write(cmd[i],i==(cmd.length-1));
though? I should probably add 'arrays as arguments to OneWire.write' and 'multiple OneWire read' to the bug tracker too?Can we change the name to something like
DS2xxx
as well? If there is any other OneWire memory out there (I imagine there is) thenOWmem
could be confusing.What do you think about:
Not sure what you think of @allObjects suggestion about connect? I guess you could do something like:
So we keep the 'connect' form which is used all over, but if you don't call
connect
then you get the base class. I'm not sure you really need that though, and you can always get to the list of prototypes from the instantiated object very easily.