File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 3434#include " OLEDDisplay.h"
3535#include < Wire.h>
3636
37+ #if defined(ARDUINO_ARCH_ESP32)
38+ #define I2C_OLED_TRANSFER_BYTE 64 /* * ESP32 can Transfer Max 128 bytes */
39+ #else
40+ #define I2C_OLED_TRANSFER_BYTE 16
41+ #endif
42+
3743#define SH1106_SET_PUMP_VOLTAGE 0X30
3844#define SH1106_SET_PUMP_MODE 0XAD
3945#define SH1106_PUMP_ON 0X8B
@@ -142,7 +148,7 @@ class SH1106Wire : public OLEDDisplay {
142148 }
143149 _wire->write (buffer[x + y * displayWidth]);
144150 k++;
145- if (k == 16 ) {
151+ if (k == I2C_OLED_TRANSFER_BYTE ) {
146152 _wire->endTransmission ();
147153 k = 0 ;
148154 }
@@ -163,10 +169,10 @@ class SH1106Wire : public OLEDDisplay {
163169 sendCommand (0xB0 +y);
164170 sendCommand (0x02 );
165171 sendCommand (0x10 );
166- for ( uint8_t x=0 ; x<8 ; x++) {
172+ for ( uint8_t x=0 ; x<( 128 /I2C_OLED_TRANSFER_BYTE) ; x++) {
167173 _wire->beginTransmission (_address);
168174 _wire->write (0x40 );
169- for (uint8_t k = 0 ; k < 16 ; k++) {
175+ for (uint8_t k = 0 ; k < I2C_OLED_TRANSFER_BYTE ; k++) {
170176 _wire->write (*p++);
171177 }
172178 _wire->endTransmission ();
You can’t perform that action at this time.
0 commit comments