From 816462939735c5af70fa2e2f7157c3b3977c4aa4 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Tue, 11 May 2021 21:38:26 +0100 Subject: [PATCH] Fix #1168 --- Extensions/Button.cpp | 3 ++- Extensions/Button.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Extensions/Button.cpp b/Extensions/Button.cpp index 9467d63..440c3f6 100644 --- a/Extensions/Button.cpp +++ b/Extensions/Button.cpp @@ -3,10 +3,11 @@ ** Grabbed from Adafruit_GFX library and enhanced to handle any label font ***************************************************************************************/ TFT_eSPI_Button::TFT_eSPI_Button(void) { - _gfx = 0; + _gfx = nullptr; _xd = 0; _yd = 0; _textdatum = MC_DATUM; + _label[9] = '\0'; } // Classic initButton() function: pass center & size diff --git a/Extensions/Button.h b/Extensions/Button.h index ae1381f..99da997 100644 --- a/Extensions/Button.h +++ b/Extensions/Button.h @@ -10,7 +10,7 @@ class TFT_eSPI_Button { public: TFT_eSPI_Button(void); - // "Classic" initButton() uses center & size + // "Classic" initButton() uses centre & size void initButton(TFT_eSPI *gfx, int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, uint16_t textcolor, char *label, uint8_t textsize); @@ -34,7 +34,7 @@ class TFT_eSPI_Button { private: TFT_eSPI *_gfx; int16_t _x1, _y1; // Coordinates of top-left corner of button - int16_t _xd, _yd; // Button text datum offsets (wrt center of button) + int16_t _xd, _yd; // Button text datum offsets (wrt centre of button) uint16_t _w, _h; // Width and height of button uint8_t _textsize, _textdatum; // Text size multiplier and text datum for button uint16_t _outlinecolor, _fillcolor, _textcolor;