You are reading a single comment by @yngv126399 and its replies. Click here to read the full conversation.
  • I've got some code that may be helpful. I'm able to do a partial refresh on my Watchy using this, although the LUT is not quite right (seems very dark compared to regular full refresh). First of all, I extended some of your commands.. I didn't see you calling cmd(0x12) (software reset) so I created a fullReset():

    SSD16xx.prototype.fullReset = function() {
      return new Promise((resolve)=>{
        digitalWrite(this.resetPin, 0);
        setTimeout(()=>{
          digitalWrite(this.resetPin, 1);
          this.sc(0x12);
          this.partial=false;
          setTimeout(resolve,this.hwResetTimeOut);­
        },this.hwResetTimeOut);
      });
    };
    

    I also use this to send commands WITH data, then wait (if necessary) for the RST pin (some commands are so fast that a watch on RST falling doesn't register):

    SSD16xx.prototype.waitCmdData = function(command, data){
      return new Promise((resolve,reject)=>{
        console.log("sending a busy command!");
        this.sc(command);
        this.psd();
        this.sd(data);
        if(this.busyPin.read()) 
          setWatch(resolve, this.busyPin, { repeat:false, edge:'falling' });
        else
          resolve();
      });
    };
    

    This sets up using partial refresh by uploading a special LUT:

    SSD16xx.prototype.setFastRefresh = function() {
      const WF_PARTIAL = new Uint8Array([ 0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0­,0x0,0x0,0x80,0x80,0x0,0x0,0x0,0x0,0x0,0­x0,0x0,0x0,0x0,0x0,0x40,0x40,0x0,0x0,0x0­,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0­,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0­,0x0,0x0,0x0,0x0, 0xF,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x0,­0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,­0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,­0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,­0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,­0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,­0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,­0x0,0x0,0x0,0x0,0x22,0x22,0x22,0x22,0x22­,0x22,0x0,0x0,0x0,0x02,0x17,0x41,0xB0,0x­32,0x28,
        ]);	
    
      this.fullReset().then(()=>{
        this.waitCmdData(0x32, WF_PARTIAL.slice(0,153)).then(()=>{
          this.scd(0x3F, WF_PARTIAL[153]);
          this.scd(0x03, WF_PARTIAL[154]);
          this.scd(0x04, WF_PARTIAL.slice(155, 158)); 
          this.scd(0x2C, WF_PARTIAL[158]);
          this.scd(0x37, [0,0,0,0,0,0x40,0,0,0,0]); 
          this.waitCmdData(0x3C, 0x80).then(()=>{
            this.partial = true;
          });
        });
      });
      
    };
    

    It sets an internal flag (partial) so the flip() command knows what to send:

    SSD16xx.prototype.flip = function() {
        this.scd(0x4E, 0);
        this.scd(0x4F, [0,0]);
        this.scd(0x24, this.g.bw.buffer);
      
        if(this.display.coloredDisplay){
            this.scd(0x4E, 0);
            this.scd(0x4F, [0,0]);
            this.scd(0x26, this.g.cw.buffer);
        }
      
        if(this.partial) {
          print("flip:partial");
          this.scd(0x22, 0xcf);
        } else {
          print("flip:full");
          //this.scd(0x22, 0xF7);
        }
        return this.refreshDisplay();
    };
    

    That much works for me on the Watchy. Hope it helps. Like I said, LUTs are tricky things, so your results may be better/worse. I'm still trying to figure the out...

About

Avatar for yngv126399 @yngv126399 started