Quote Originally Posted by KurtE View Post
Thanks Mike,

Not sure at times how much these change help or not... Often times it depends on how much time the code overhead is versus how many times it avoids with reducing the bytes sent out SPI. Example did same code change for the ST7735/89_t3 code base and tried it on T4 with ST7789 2" version... Code change:

I tried it with and without the change:
Code:
#if 1
  uint16_t _previous_addr_x0 = 0xffff; 
  uint16_t _previous_addr_x1 = 0xffff; 
  uint16_t _previous_addr_y0 = 0xffff; 
  uint16_t _previous_addr_y1 = 0xffff; 

  void setAddr(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
    __attribute__((always_inline)) {
      if ((x0 != _previous_addr_x0) || (x1 != _previous_addr_x1)) {
        writecommand(ST7735_CASET); // Column addr set
        writedata16(x0+_xstart);   // XSTART 
        writedata16(x1+_xstart);   // XEND
        _previous_addr_x0 = x0;
        _previous_addr_x1 = x1;
      }
      if ((y0 != _previous_addr_y0) || (y1 != _previous_addr_y1)) {
        writecommand(ST7735_RASET); // Row addr set
        writedata16(y0+_ystart);   // YSTART
        writedata16(y1+_ystart);   // YEND
        _previous_addr_y0 = y0;
        _previous_addr_y1 = y1;
    }
  }
#else
  void setAddr(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
    __attribute__((always_inline)) {
        writecommand(ST7735_CASET); // Column addr set
        writedata16(x0+_xstart);   // XSTART 
        writedata16(x1+_xstart);   // XEND
        writecommand(ST7735_RASET); // Row addr set
        writedata16(y0+_ystart);   // YSTART
        writedata16(y1+_ystart);   // YEND
  }
#endif
Using a version of the graphic test that works in all 4 orientations and prints out timings...
And not much difference:

Code:
	BEFORE			AFTER	
Rotations	0	1		0	1
tftPrintTest: 	1611	1611		1610	1610
testlines: 	536	535		535	535
tftPrintTest: 	73	73		73	74
testdrawrects: 	65	71		65	70
tftPrintTest: 	593	1199		592	1199
testfill/drawcircles: 	204	205	191	190
testroundrects: 	124	123		121	122
testtriangles: 	73	80		74	79
mediabuttons: 	1115	1114		1115	1115
Totals:	4394	5012		4376	4995
I show two of the orientations. Find that the landscape versus portrait at least on one of the tests is a lot different in timing...
But the before versus the later is not a big difference.
Doesn't x change permanently and y only rarely when using the frame buffer?
Maybe only check if x has changed if framebuffer is not active.