Replace deprecated boolean type

Note that Processing sketches (pde type) do not accept bool, so boolean is correct.
This commit is contained in:
Bodmer
2021-03-31 13:52:42 +01:00
parent f6e90349d8
commit 91c34afc49
18 changed files with 38 additions and 36 deletions

View File

@@ -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

View File

@@ -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();

View File

@@ -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;

View File

@@ -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++) {

View File

@@ -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();

View File

@@ -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

View File

@@ -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
@@ -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;
@@ -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;

View File

@@ -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++) {

View File

@@ -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) {
@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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++) {

View File

@@ -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 #
// #
@@ -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
@@ -288,7 +288,7 @@ void flushBuffer()
while ( millis() < clearTime ) serial.clear();
}
boolean getSize()
bool getSize()
{
if ( serial.available() > 6 ) {
println();
@@ -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;
@@ -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)

View File

@@ -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
@@ -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()
@@ -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

View File

@@ -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) {