@@ -51,13 +51,9 @@ class OLED {
51
51
static bool isInitDone ();
52
52
// Draw the buffer out to the LCD if any content has changed.
53
53
static void refresh () {
54
- uint32_t hash = 0 ;
55
- const int len = FRAMEBUFFER_START + (OLED_WIDTH * 2 );
56
- for (int i = 0 ; i < len; i++) {
57
- hash += (i * screenBuffer[i]);
58
- }
59
- if (hash != displayChecksum) {
60
- displayChecksum = hash;
54
+
55
+ if (checkDisplayBufferChecksum ()) {
56
+ const int len = FRAMEBUFFER_START + (OLED_WIDTH * 2 );
61
57
I2C_CLASS::Transmit (DEVICEADDR_OLED, screenBuffer, len);
62
58
// DMA tx time is ~ 20mS Ensure after calling this you delay for at least 25ms
63
59
// or we need to goto double buffering
@@ -118,6 +114,17 @@ class OLED {
118
114
static void transitionScrollDown ();
119
115
120
116
private:
117
+ static bool checkDisplayBufferChecksum (){
118
+ uint32_t hash = 0 ;
119
+ const int len = FRAMEBUFFER_START + (OLED_WIDTH * 2 );
120
+ for (int i = 0 ; i < len; i++) {
121
+ hash += (i * screenBuffer[i]);
122
+ }
123
+
124
+ bool result = hash!=displayChecksum;
125
+ displayChecksum= hash;
126
+ return result;
127
+ }
121
128
static void drawChar (uint16_t charCode, FontStyle fontStyle); // Draw a character to the current cursor location
122
129
static void setFramebuffer (uint8_t *buffer);
123
130
static uint8_t *firstStripPtr; // Pointers to the strips to allow for buffer having extra content
0 commit comments