Skip to content

Commit

Permalink
Replace deprecated boolean type
Browse files Browse the repository at this point in the history
Note that Processing sketches (pde type) do not accept bool, so boolean is correct.
  • Loading branch information
Bodmer committed Mar 31, 2021
1 parent f6e9034 commit 91c34af
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 36 deletions.
4 changes: 3 additions & 1 deletion Extensions/Touch.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
// Convert raw x,y values to calibrated and correctly rotated screen coordinates
void convertRawXY(uint16_t *x, uint16_t *y);
// Get the screen touch coordinates, returns true if screen has been touched
// if the touch cordinates are off screen then x and y are not updated
// if the touch coordinates are off screen then x and y are not updated
// The returned value can be treated as a bool type, false or 0 means touch not detected
// In future the function may return an 8 "quality" (jitter) value.
uint8_t getTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);

// Run screen calibration and test, report calibration values to the serial port
Expand Down
2 changes: 1 addition & 1 deletion examples/160 x 128/TFT_Clock/TFT_Clock.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static uint8_t conv2d(const char* p) {

uint8_t hh=conv2d(__TIME__), mm=conv2d(__TIME__+3), ss=conv2d(__TIME__+6); // Get H, M, S from compile time

boolean initial = 1;
bool initial = 1;

void setup(void) {
tft.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/160 x 128/TFT_Clock_Digital/TFT_Clock_Digital.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
uint32_t targetTime = 0; // for next 1 second timeout

byte omm = 99;
boolean initial = 1;
bool initial = 1;
byte xcolon = 0;
unsigned int colour = 0;

Expand Down
2 changes: 1 addition & 1 deletion examples/320 x 240/Keypad_240x320/Keypad_240x320.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void loop(void) {
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates

// Pressed will be set true is there is a valid touch on the screen
boolean pressed = tft.getTouch(&t_x, &t_y);
bool pressed = tft.getTouch(&t_x, &t_y);

// / Check if any key coordinate boxes contain the touch coordinates
for (uint8_t b = 0; b < 15; b++) {
Expand Down
2 changes: 1 addition & 1 deletion examples/320 x 240/TFT_Clock/TFT_Clock.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ uint32_t targetTime = 0; // for next 1 second timeout
static uint8_t conv2d(const char* p); // Forward declaration needed for IDE 1.6.x
uint8_t hh=conv2d(__TIME__), mm=conv2d(__TIME__+3), ss=conv2d(__TIME__+6); // Get H, M, S from compile time

boolean initial = 1;
bool initial = 1;

void setup(void) {
tft.init();
Expand Down
4 changes: 2 additions & 2 deletions examples/320 x 240/TFT_Terminal/TFT_Terminal.ino
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ uint16_t xPos = 0;
byte data = 0;

// A few test variables used during debugging
boolean change_colour = 1;
boolean selected = 1;
bool change_colour = 1;
bool selected = 1;

// We have to blank the top line each time the display is scrolled, but this takes up to 13 milliseconds
// for a full width line, meanwhile the serial buffer may be filling... and overflowing
Expand Down
8 changes: 4 additions & 4 deletions examples/480 x 320/Graph_2/Graph_2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library with defau
// and will mimize flicker
// also create some variables to store the old x and y, if you draw 2 graphs on the same display
// you will need to store ox and oy per each display
boolean display1 = true;
boolean update1 = true;
bool display1 = true;
bool update1 = true;

double ox = -999, oy = -999; // Force them to be off screen

Expand Down Expand Up @@ -97,7 +97,7 @@ void Graph(TFT_eSPI &tft, double x, double y, byte dp,
double xlo, double xhi, double xinc,
double ylo, double yhi, double yinc,
char *title, char *xlabel, char *ylabel,
boolean &redraw, unsigned int color) {
bool &redraw, unsigned int color) {

double ydiv, xdiv;
double i;
Expand Down Expand Up @@ -191,7 +191,7 @@ void Trace(TFT_eSPI &tft, double x, double y, byte dp,
double xlo, double xhi, double xinc,
double ylo, double yhi, double yinc,
char *title, char *xlabel, char *ylabel,
boolean &update1, unsigned int color)
bool &update1, unsigned int color)
{
double ydiv, xdiv;
double i;
Expand Down
2 changes: 1 addition & 1 deletion examples/480 x 320/Keypad_480x320/Keypad_480x320.ino
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void loop(void) {
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates

// Pressed will be set true is there is a valid touch on the screen
boolean pressed = tft.getTouch(&t_x, &t_y);
bool pressed = tft.getTouch(&t_x, &t_y);

// / Check if any key coordinate boxes contain the touch coordinates
for (uint8_t b = 0; b < 15; b++) {
Expand Down
4 changes: 2 additions & 2 deletions examples/480 x 320/TFT_ring_meter/TFT_ring_meter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ uint32_t runTime = -99999; // time for next update

int reading = 0; // Value to be displayed
int d = 0; // Variable used for the sinewave test waveform
boolean range_error = 0;
bool range_error = 0;
int8_t ramp = 1;

void setup(void) {
Expand Down Expand Up @@ -180,7 +180,7 @@ int ringMeter(int value, int vmin, int vmax, int x, int y, int r, const char *un
return x + r;
}

void drawAlert(int x, int y , int side, boolean draw)
void drawAlert(int x, int y , int side, bool draw)
{
if (draw && !range_error) {
drawIcon(alert, x - alertWidth/2, y - alertHeight/2, alertWidth, alertHeight);
Expand Down
2 changes: 1 addition & 1 deletion examples/Generic/Animated_Eyes_1/eye_functions.ino
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void frame(uint16_t iScale) // Iris scale (0-1023)
// Periodically initiates motion to a new random point, random speed,
// holds there for random period until next motion.

static boolean eyeInMotion = false;
static bool eyeInMotion = false;
static int16_t eyeOldX = 512, eyeOldY = 512, eyeNewX = 512, eyeNewY = 512;
static uint32_t eyeMoveStartTime = 0L;
static int32_t eyeMoveDuration = 0L;
Expand Down
2 changes: 1 addition & 1 deletion examples/Generic/Animated_Eyes_2/eye_functions.ino
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void frame(uint16_t iScale) // Iris scale (0-1023)
// Periodically initiates motion to a new random point, random speed,
// holds there for random period until next motion.

static boolean eyeInMotion = false;
static bool eyeInMotion = false;
static int16_t eyeOldX = 512, eyeOldY = 512, eyeNewX = 512, eyeNewY = 512;
static uint32_t eyeMoveStartTime = 0L;
static int32_t eyeMoveDuration = 0L;
Expand Down
4 changes: 2 additions & 2 deletions examples/Generic/ESP32_SDcard_jpeg/ESP32_SDcard_jpeg.ino
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ void drawSdJpeg(const char *filename, int xpos, int ypos) {
Serial.println("===========================");

// Use one of the following methods to initialise the decoder:
boolean decoded = JpegDec.decodeSdFile(jpegFile); // Pass the SD file handle to the decoder,
//boolean decoded = JpegDec.decodeSdFile(filename); // or pass the filename (String or character array)
bool decoded = JpegDec.decodeSdFile(jpegFile); // Pass the SD file handle to the decoder,
//bool decoded = JpegDec.decodeSdFile(filename); // or pass the filename (String or character array)

if (decoded) {
// print information about the image to the serial port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void frame( // Process motion for a single frame of left or right eye
// Periodically initiates motion to a new random point, random speed,
// holds there for random period until next motion.

static boolean eyeInMotion = false;
static bool eyeInMotion = false;
static int32_t eyeOldX=512, eyeOldY=512, eyeNewX=512, eyeNewY=512;
static uint32_t eyeMoveStartTime = 0L;
static int32_t eyeMoveDuration = 0L;
Expand Down
2 changes: 1 addition & 1 deletion examples/Generic/On_Off_Button/On_Off_Button.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
// Repeat calibration if you change the screen rotation.
#define REPEAT_CAL false

boolean SwitchOn = false;
bool SwitchOn = false;

// Comment out to stop drawing black spots
#define BLACK_SPOT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void loop() {
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates

// Get current touch state and coordinates
boolean pressed = tft.getTouch(&t_x, &t_y);
bool pressed = tft.getTouch(&t_x, &t_y);

// Adjust press state of each key appropriately
for (uint8_t b = 0; b < NUM_KEYS; b++) {
Expand Down
16 changes: 8 additions & 8 deletions examples/Generic/TFT_Screen_Capture/processing_sketch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ String image_type = ".png"; // Lossless compression
//String image_type = ".bmp"; // #
//String image_type = ".tif"; // #
// #
boolean save_border = true; // Save the image with a border #
bool save_border = true; // Save the image with a border #
int border = 5; // Border pixel width #
boolean fade = false; // Fade out image after saving #
bool fade = false; // Fade out image after saving #
// #
int max_images = 100; // Maximum of numbered file images before over-writing files #
// #
Expand Down Expand Up @@ -82,9 +82,9 @@ color frameColor = 42;
color buttonStopped = color(255, 0, 0);
color buttonRunning = color(128, 204, 206);
color buttonDimmed = color(180, 0, 0);
boolean dimmed = false;
boolean running = true;
boolean mouseClick = false;
bool dimmed = false;
bool running = true;
bool mouseClick = false;
int[] rgb = new int[3]; // Buffer for the colour bytes
int indexRed = 0; // Colour byte index in the array
Expand Down Expand Up @@ -288,7 +288,7 @@ void flushBuffer()
while ( millis() < clearTime ) serial.clear();
}
boolean getSize()
bool getSize()
{
if ( serial.available() > 6 ) {
println();
Expand Down Expand Up @@ -371,7 +371,7 @@ void getFilename()
else if (inByte == 't') image_type =".tif";
}
boolean unicodeCheck(int unicode)
bool unicodeCheck(int unicode)
{
if ( unicode >= '0' && unicode <= '9' ) return true;
if ( (unicode >= 'A' && unicode <= 'Z' ) || (unicode >= 'a' && unicode <= 'z')) return true;
Expand Down Expand Up @@ -475,7 +475,7 @@ void percent(float percentage)
text(" [ " + (int)percentage + "% ]", 10, height-8);
}
boolean fadedImage()
bool fadedImage()
{
int opacity = frameCount - drawLoopCount; // So we get increasing fade
if (fade)
Expand Down
12 changes: 6 additions & 6 deletions examples/Generic/TFT_Screen_Capture/screenServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
// Screen server call with no filename
//====================================================================================
// Start a screen dump server (serial or network) - no filename specified
boolean screenServer(void)
bool screenServer(void)
{
// With no filename the screenshot will be saved with a default name e.g. tft_screen_#.xxx
// where # is a number 0-9 and xxx is a file type specified below
Expand All @@ -59,12 +59,12 @@ boolean screenServer(void)
// Screen server call with filename
//====================================================================================
// Start a screen dump server (serial or network) - filename specified
boolean screenServer(String filename)
bool screenServer(String filename)
{
delay(0); // Equivalent to yield() for ESP8266;

boolean result = serialScreenServer(filename); // Screenshot serial port server
//boolean result = wifiScreenServer(filename); // Screenshot WiFi UDP port server (WIP)
bool result = serialScreenServer(filename); // Screenshot serial port server
//bool result = wifiScreenServer(filename); // Screenshot WiFi UDP port server (WIP)

delay(0); // Equivalent to yield()

Expand All @@ -78,13 +78,13 @@ boolean screenServer(String filename)
//====================================================================================
// Serial server function that sends the data to the client
//====================================================================================
boolean serialScreenServer(String filename)
bool serialScreenServer(String filename)
{
// Precautionary receive buffer garbage flush for 50ms
uint32_t clearTime = millis() + 50;
while ( millis() < clearTime && Serial.read() >= 0) delay(0); // Equivalent to yield() for ESP8266;

boolean wait = true;
bool wait = true;
uint32_t lastCmdTime = millis(); // Initialise start of command time-out

// Wait for the starting flag with a start time-out
Expand Down
2 changes: 1 addition & 1 deletion examples/Generic/Touch_calibrate/Touch_calibrate.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void loop(void) {
uint16_t x = 0, y = 0; // To store the touch coordinates

// Pressed will be set true is there is a valid touch on the screen
boolean pressed = tft.getTouch(&x, &y);
bool pressed = tft.getTouch(&x, &y);

// Draw a white spot at the detected coordinates
if (pressed) {
Expand Down

0 comments on commit 91c34af

Please sign in to comment.