@@ -126,19 +126,19 @@ OLEDDISPLAY_COLOR OLEDDisplay::getColor() {
126126void OLEDDisplay::setPixel (int16_t x, int16_t y) {
127127 if (x >= 0 && x < this ->width () && y >= 0 && y < this ->height ()) {
128128 switch (color) {
129- case WHITE: buffer[x + (y >> 3 ) * this ->width ()] |= (1 << (y & 7 )); break ;
130- case BLACK: buffer[x + (y >> 3 ) * this ->width ()] &= ~(1 << (y & 7 )); break ;
131- case INVERSE: buffer[x + (y >> 3 ) * this ->width ()] ^= (1 << (y & 7 )); break ;
129+ case WHITE: buffer[x + (y / 8 ) * this ->width ()] |= (1 << (y & 7 )); break ;
130+ case BLACK: buffer[x + (y / 8 ) * this ->width ()] &= ~(1 << (y & 7 )); break ;
131+ case INVERSE: buffer[x + (y / 8 ) * this ->width ()] ^= (1 << (y & 7 )); break ;
132132 }
133133 }
134134}
135135
136136void OLEDDisplay::setPixelColor (int16_t x, int16_t y, OLEDDISPLAY_COLOR color) {
137137 if (x >= 0 && x < this ->width () && y >= 0 && y < this ->height ()) {
138138 switch (color) {
139- case WHITE: buffer[x + (y >> 3 ) * this ->width ()] |= (1 << (y & 7 )); break ;
140- case BLACK: buffer[x + (y >> 3 ) * this ->width ()] &= ~(1 << (y & 7 )); break ;
141- case INVERSE: buffer[x + (y >> 3 ) * this ->width ()] ^= (1 << (y & 7 )); break ;
139+ case WHITE: buffer[x + (y / 8 ) * this ->width ()] |= (1 << (y & 7 )); break ;
140+ case BLACK: buffer[x + (y / 8 ) * this ->width ()] &= ~(1 << (y & 7 )); break ;
141+ case INVERSE: buffer[x + (y / 8 ) * this ->width ()] ^= (1 << (y & 7 )); break ;
142142 }
143143 }
144144}
@@ -171,7 +171,7 @@ void OLEDDisplay::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1) {
171171 dx = x1 - x0;
172172 dy = abs (y1 - y0);
173173
174- int16_t err = dx >> 1 ;
174+ int16_t err = dx / 2 ;
175175 int16_t ystep;
176176
177177 if (y0 < y1) {
@@ -289,7 +289,7 @@ void OLEDDisplay::fillCircle(int16_t x0, int16_t y0, int16_t radius) {
289289
290290
291291 } while (x < y);
292- drawHorizontalLine (x0 - radius, y0, radius << 1 );
292+ drawHorizontalLine (x0 - radius, y0, 2 * radius );
293293
294294}
295295
@@ -400,10 +400,10 @@ void OLEDDisplay::drawVerticalLine(int16_t x, int16_t y, int16_t length) {
400400}
401401
402402void OLEDDisplay::drawProgressBar (uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t progress) {
403- uint16_t radius = height >> 1 ;
403+ uint16_t radius = height / 2 ;
404404 uint16_t xRadius = x + radius;
405405 uint16_t yRadius = y + radius;
406- uint16_t doubleRadius = radius << 1 ;
406+ uint16_t doubleRadius = 2 * radius ;
407407 uint16_t innerRadius = radius - 2 ;
408408
409409 setColor (WHITE);
@@ -424,15 +424,15 @@ void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int
424424}
425425
426426void OLEDDisplay::drawXbm (int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm) {
427- int16_t widthInXbm = (width + 7 ) >> 3 ;
427+ int16_t widthInXbm = (width + 7 ) / 8 ;
428428 uint8_t data = 0 ;
429429
430430 for (int16_t y = 0 ; y < height; y++) {
431431 for (int16_t x = 0 ; x < width; x++ ) {
432432 if (x & 7 ) {
433433 data >>= 1 ; // Move a bit
434434 } else { // Read new data every 8 bit
435- data = pgm_read_byte (xbm + (x >> 3 ) + y * widthInXbm);
435+ data = pgm_read_byte (xbm + (x / 8 ) + y * widthInXbm);
436436 }
437437 // if there is a bit draw it
438438 if (data & 0x01 ) {
@@ -527,7 +527,7 @@ void OLEDDisplay::drawString(int16_t xMove, int16_t yMove, String strUser) {
527527 lb += (text[i] == 10 );
528528 }
529529 // Calculate center
530- yOffset = (lb * lineHeight) >> 1 ;
530+ yOffset = (lb * lineHeight) / 2 ;
531531 }
532532
533533 uint16_t line = 0 ;
0 commit comments