Bugfix for epaper display
This commit is contained in:
		
							parent
							
								
									854dea2dc2
								
							
						
					
					
						commit
						6a3a9a15b9
					
				
					 2 changed files with 11 additions and 32 deletions
				
			
		| 
						 | 
				
			
			@ -10,26 +10,7 @@ void WatchyDisplayBase::clearScreen(uint8_t value)
 | 
			
		|||
{
 | 
			
		||||
  writeScreenBuffer(value);
 | 
			
		||||
  refresh(true);
 | 
			
		||||
 | 
			
		||||
  if (!_using_partial_mode) {
 | 
			
		||||
    InitPart();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _startTransfer();
 | 
			
		||||
  TransferCommand(0x24);
 | 
			
		||||
  for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++) {
 | 
			
		||||
    _transfer(value);
 | 
			
		||||
  }
 | 
			
		||||
  _endTransfer();
 | 
			
		||||
 | 
			
		||||
  // Is this necessary? Come back to this - FIXME
 | 
			
		||||
  _startTransfer();
 | 
			
		||||
  TransferCommand(0x26);
 | 
			
		||||
  for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++) {
 | 
			
		||||
    _transfer(value);
 | 
			
		||||
  }
 | 
			
		||||
  _endTransfer();
 | 
			
		||||
  _initial_write = false; // initial full screen buffer clean done
 | 
			
		||||
  writeScreenBufferAgain(value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// init controller memory (default white)
 | 
			
		||||
| 
						 | 
				
			
			@ -48,8 +29,6 @@ void WatchyDisplayBase::writeScreenBuffer(uint8_t value)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    _endTransfer();
 | 
			
		||||
 | 
			
		||||
    _initial_write = false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _startTransfer();
 | 
			
		||||
| 
						 | 
				
			
			@ -60,6 +39,8 @@ void WatchyDisplayBase::writeScreenBuffer(uint8_t value)
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  _endTransfer();
 | 
			
		||||
 | 
			
		||||
  _initial_write = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void WatchyDisplayBase::writeScreenBufferAgain(uint8_t value)
 | 
			
		||||
| 
						 | 
				
			
			@ -86,15 +67,7 @@ void WatchyDisplayBase::writeImage(const uint8_t * bitmap, int16_t x, int16_t y,
 | 
			
		|||
void WatchyDisplayBase::writeImageInternal(uint8_t command, const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
 | 
			
		||||
{
 | 
			
		||||
  if (_initial_write) {
 | 
			
		||||
    _startTransfer();
 | 
			
		||||
    TransferCommand(0x24);
 | 
			
		||||
 | 
			
		||||
    for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++) {
 | 
			
		||||
      _transfer(0xFF);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _endTransfer();
 | 
			
		||||
    _initial_write = false;
 | 
			
		||||
    writeScreenBuffer();
 | 
			
		||||
  }
 | 
			
		||||
#if defined(ESP8266) || defined(ESP32)
 | 
			
		||||
  yield(); // avoid wdt
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +93,7 @@ void WatchyDisplayBase::writeImageInternal(uint8_t command, const uint8_t * bitm
 | 
			
		|||
 | 
			
		||||
  SetPartialRamArea(x1, y1, w1, h1);
 | 
			
		||||
  _startTransfer();
 | 
			
		||||
  TransferCommand(0x24);
 | 
			
		||||
  TransferCommand(command);
 | 
			
		||||
 | 
			
		||||
  for (int16_t i = 0; i < h1; i++) {
 | 
			
		||||
    for (int16_t j = 0; j < w1 / 8; j++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -156,6 +129,11 @@ void WatchyDisplayBase::writeImageForFullRefresh(const uint8_t * bitmap, int16_t
 | 
			
		|||
  writeImageInternal(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void WatchyDisplayBase::writeImageAgain(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
 | 
			
		||||
{
 | 
			
		||||
  writeImageInternal(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// screen refresh from controller memory, partial screen
 | 
			
		||||
void WatchyDisplayBase::writeImagePart(const uint8_t * bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,7 @@ public:
 | 
			
		|||
  void writeScreenBufferAgain(uint8_t value = 0xFF) override;
 | 
			
		||||
  void writeImage(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
 | 
			
		||||
  void writeImageForFullRefresh(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
 | 
			
		||||
  void writeImageAgain(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
 | 
			
		||||
 | 
			
		||||
  // screen refresh from controller memory, partial screen
 | 
			
		||||
  void writeImagePart(const uint8_t * bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue