@@ -466,6 +466,18 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
466466 return 0 ;
467467 }
468468
469+ if (_partialUpdateCounter>=_partialUpdateLimiter && _partialUpdateLimiter != 0 )
470+ {
471+ // Force full update.
472+ display1b (leaveOn);
473+
474+ // Reset the counter!
475+ _partialUpdateCounter = 0 ;
476+
477+ // Go back!
478+ return 0 ;
479+ }
480+
469481 uint32_t _pos = (E_INK_WIDTH * E_INK_HEIGHT / 8 ) - 1 ;
470482 // uint32_t _send;
471483 uint8_t data;
@@ -530,9 +542,33 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
530542 einkOff ();
531543 memcpy (DMemoryNew, _partial, E_INK_WIDTH * E_INK_HEIGHT / 8 );
532544
545+ if (_partialUpdateLimiter!=0 )
546+ _partialUpdateCounter++;
547+
533548 return changeCount;
534549}
535550
551+ /* *
552+ * @brief Set the number of partial updates afterwhich full screen update is performed.
553+ *
554+ * @param uint16_t _numberOfPartialUpdates
555+ * Number of allowed partial updates afterwhich full update is performed.
556+ * 0 = disabled, no automatic full update will be performed.
557+ *
558+ * @note By default, this is disabled, but to keep best image quality perform a full update
559+ * every 60-80 partial updates.
560+ */
561+ void Inkplate::setFullUpdateThreshold (uint16_t _numberOfPartialUpdates)
562+ {
563+ // Copy the value into the local variable.
564+ _partialUpdateLimiter = _numberOfPartialUpdates;
565+
566+ // If the limiter is enabled, force full update.
567+ if (_numberOfPartialUpdates != 0 )
568+ _blockPartial = 1 ;
569+ }
570+
571+
536572/* *
537573 * @brief Wake a single or multiple peripherals for Inkplate 4TEMPERA.
538574 * They are in deep sleep by default so this function MUST be called
0 commit comments