You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Looks great,

    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:

    OWmem.connect = function(ow, pgsz, cap,n,device) {
    };
    exports = OWmem;
    

    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.

About

Avatar for Gordon @Gordon started