Skip to content

Commit c0735d6

Browse files
committed
Fixed some warnings
1 parent 56c7885 commit c0735d6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/LcdScreen.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ extern LcdScreen EsploraTFT;
150150
#define BUFFPIXEL 20
151151

152152
void LcdScreen::image(PImage & img, uint16_t x, uint16_t y) {
153-
int w, h, row, col;
153+
int w, h, wb, hb, row, col;
154154
uint8_t r, g, b;
155155
uint32_t pos = 0;
156156
uint8_t sdbuffer[3*BUFFPIXEL]; // pixel buffer (R+G+B per pixel)
@@ -159,8 +159,10 @@ void LcdScreen::image(PImage & img, uint16_t x, uint16_t y) {
159159
// Crop area to be loaded
160160
w = img._bmpWidth;
161161
h = img._bmpHeight;
162-
if((x+w-1) >= width()) w = width() - x;
163-
if((y+h-1) >= height()) h = height() - y;
162+
wb = x + w - 1;
163+
hb = y + h - 1;
164+
if(wb >= width()) w = width() - x;
165+
if(hb >= height()) h = height() - y;
164166

165167
//// Set TFT address window to clipped image bounds
166168
//setAddrWindow(x, y, x+w-1, y+h-1);
@@ -234,7 +236,7 @@ PImage PImage::loadImage(const char * fileName) {
234236

235237

236238
// Open requested file on SD card
237-
if ((bmpFile = SD.open(fileName)) == NULL) {
239+
if ((bmpFile = SD.open(fileName)) == false) {
238240
Serial.print(F("loadImage: file not found: "));
239241
Serial.println(fileName);
240242
return PImage(); // load error

src/utility/PImage.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class LcdScreen;
1515
/// @author Enrico Gueli <[email protected]>
1616
class PImage {
1717
public:
18-
PImage() :
19-
_valid(false),
18+
PImage() :
2019
_bmpWidth(0),
21-
_bmpHeight(0) { }
20+
_bmpHeight(0),
21+
_valid(false) { }
2222

2323
void draw(Adafruit_GFX & glcd, int16_t x, int16_t y);
2424

0 commit comments

Comments
 (0)