Well looks like the 3V regulator is shot;
4.89 Volts at C-USB (no-load)
4.79 Volts at C-USB with ESP8266 (good board)
4.73 Volts at C-USB with GIGA at 5V ref
4.73 Volts at board 5 Volt Pins
0.537 Volts at board 3.3 Volt pins
Dang, just when I was having fun... LoL
Time to order another GIGA, I don't understand the only thing that was on the board was the GIGA Display which I've been programming as a Thermostat Display. It has 3 buttons and figures that is it.
Here is the sketch I was running.
Rob - K0RU
/*
This example uses the Arduino_GigaDisplayTouch and
Arduino_GigaDisplay_GFX library to change the
display whenever it is touched, inverting the colors.
The circuit:
- GIGA R1 WiFi
- GIGA Display Shield
created 10 sept 2023
by Karl Söderby
This example code is in the public domain.
*/
#include <Arduino_DebugUtils.h>
#include "Arduino_GigaDisplay_GFX.h"
#include "Arduino_GigaDisplayTouch.h"
#include <Arduino_GigaDisplay.h>
#include "Adafruit_GFX.h"
#include <Fonts/FreeSans12pt7b_mod.h>
#include <Fonts/FreeSans24pt7b.h>
/*
FreeMono12pt7b.h FreeSansBoldOblique12pt7b.h
FreeMono18pt7b.h FreeSansBoldOblique18pt7b.h
FreeMono24pt7b.h FreeSansBoldOblique24pt7b.h
FreeMono9pt7b.h FreeSansBoldOblique9pt7b.h
FreeMonoBold12pt7b.h FreeSansOblique12pt7b.h
FreeMonoBold18pt7b.h FreeSansOblique18pt7b.h
FreeMonoBold24pt7b.h FreeSansOblique24pt7b.h
FreeMonoBold9pt7b.h FreeSansOblique9pt7b.h
FreeMonoBoldOblique12pt7b.h FreeSerif12pt7b.h
FreeMonoBoldOblique18pt7b.h FreeSerif18pt7b.h
FreeMonoBoldOblique24pt7b.h FreeSerif24pt7b.h
FreeMonoBoldOblique9pt7b.h FreeSerif9pt7b.h
FreeMonoOblique12pt7b.h FreeSerifBold12pt7b.h
FreeMonoOblique18pt7b.h FreeSerifBold18pt7b.h
FreeMonoOblique24pt7b.h FreeSerifBold24pt7b.h
FreeMonoOblique9pt7b.h FreeSerifBold9pt7b.h
FreeSans12pt7b.h FreeSerifBoldItalic12pt7b.h
FreeSans18pt7b.h FreeSerifBoldItalic18pt7b.h
FreeSans24pt7b.h FreeSerifBoldItalic24pt7b.h
FreeSans9pt7b.h FreeSerifBoldItalic9pt7b.h
FreeSansBold12pt7b.h FreeSerifItalic12pt7b.h
FreeSansBold18pt7b.h FreeSerifItalic18pt7b.h
FreeSansBold24pt7b.h FreeSerifItalic24pt7b.h
FreeSansBold9pt7b.h FreeSerifItalic9pt7b.h
*/
Arduino_GigaDisplayTouch touchDetector;
GigaDisplay_GFX display;
GigaDisplayRGB rgb;
Adafruit_GFX_Button button0, button1, button2; // button1, button2;
///< COLOR: Definitions / RGB COLOR CODE
#define BLACK 0x0000 /* 0, 0, 0 */
#define BLUE 0x00FF /* 0, 0, 255 */
#define RED 0xF800 /* 255, 0, 0 */
#define GREEN 0x07E0 /* 0, 255, 0 */
#define CYAN 0x07FF /* 0, 255, 255 */
#define MAGENTA 0xF81F /* 255, 0, 255 */
#define YELLOW 0xFFE0 /* 255, 255, 0 */
#define WHITE 0xFFFF /* 255, 255, 255 */
#define NAVY 0x000F /* 0, 0, 128 */
#define DARKGREEN 0x03E0 /* 0, 128, 0 */
#define DARKCYAN 0x03EF /* 0, 128, 128 */
#define MAROON 0x7800 /* 128, 0, 0 */
#define PURPLE 0x780F /* 128, 0, 128 */
#define OLIVE 0x7BE0 /* 128, 128, 0 */
#define ST7735_GRAY 0x8410
#define LIGHTGREY 0xC618 /* 192, 192, 192 */
#define DARKGREY 0x7BEF /* 128, 128, 128 */
#define ORANGE 0xFD20 /* 255, 165, 0 */
#define ST7735_ORANGE 0xFA60
#define GREENYELLOW 0xAFE5 /* 173, 255, 47 */
#define PINK 0xF81F /* 255, 0, 255 */
#define PINK2 0xF8FF
#define AQUA 0x04FF
#define LIME 0x9FE0 /* 153, 255, 0 */
#define RDUColor 0xBFE0
#define screen_size_x 800 // display.setCursor(Y=800, X=480); Y0=top_LEFT X0=bottom_LEFT
#define screen_size_y 480
#define button0_area_xB 380 // button0_y 400 380
#define button0_area_xT 473 // button0_x 300 473
#define button0_area_yL 160 // button0_y 400 250
#define button0_area_yR 300 // button0_y 400 390
#define button1_area_xT button0_area_xT //button0_x 300
#define button1_area_xB button0_area_xB // button0_y 400
#define button1_area_yL button1_R + button0_area_yL // button0_y 400
#define button1_area_yR button1_R + button0_area_yR + 10 // button0_y 400
#define button2_area_xT button0_area_xT //button0_x 300
#define button2_area_xB button0_area_xB // button0_y 400
#define button2_area_yL button2_R + button1_area_yL // button0_y 400
#define button2_area_yR button2_R + button1_area_yR + 10 // button0_y 400
#define button0_Rw 180 // display.setCursor(Y=800, X=480); Y0=LEFT X0=TOP
#define button0_Dh 80 // display.setCursor(Y=800, X=480); Y0=LEFT X0=TOP
#define button1_Rw 180 // display.setCursor(Y=800, X=480); Y0=LEFT X0=TOP
#define button1_Dh 80 // display.setCursor(Y=800, X=480); Y0=LEFT X0=TOP
#define button2_Rw 180 // display.setCursor(Y=800, X=480); Y0=LEFT X0=TOP
#define button2_Dh 80 // display.setCursor(Y=800, X=480); Y0=LEFT X0=TOP
#define button0_spacing 10
#define button0_offset_x 390
#define button1_spacing 10
#define button1_offset_x 390
#define button2_spacing 10
#define button2_offset_x 390
#define button0_Lx 125 // display.setCursor(Y=BOTTOM LEFT OF BUTTON, X=BOTTOM LEFT OF BUTTON); Y0=LEFT X0=TOP
#define button1_Lx button0_Lx + button1_Rw + button1_spacing
#define button2_Lx button1_Lx + button2_Rw + button2_spacing
#define button0_Ty 0 // display.setCursor(Y=800, X=480); Y0=LEFT X0=TOP
#define button1_Ty button0_Ty
#define button2_Ty button1_Ty
// FULL WINDOW OF DISPLAY
#define window0_Lx 0
#define window0_Ty 0 // 90
#define window0_Rw 800
#define window0_Dh 480 // 479
// BOTTOM 2/3 OF DISPLAY
#define window1_Lx 0
#define window1_Ty 90 // 90
#define window1_Rw 800
#define window1_Dh 390 // 479
#define textcenter_x 400
#define textcenter_y 240
//******* TEXTSIZE EQUALS { 0=5px, 1=10px, 2=20px, 3=30px, 4=40px, 5=50px, 6=60px, 7=70px, 8=80px };
//const int16_t textspacing[9] = { 10, 10, 20, 30, 40, 50, 60, 70, 80 }; // display.setTextSize
const int16_t textspacing[9] = { 60, 60, 105, 120, 110, 120, 120, 140, 160 }; // #include <Fonts/FreeSans24pt7b.h>
char button0_text[8] = "LOAD";
char button1_text[8] = "SAVE";
char button2_text[8] = "RESET";
int16_t degree0 = 15;
char display0_text[8] = "78.9";
char display1_text[8] = "68.5";
char display2_text[8] = "65.5";
#define COLOR_BKGR LIGHTGREY
int16_t touch_x = 0;
int16_t touch_y = 0;
int16_t contacts = 0, randNumber = 0, fontsize = 0;
GDTpoint_t points[5];
uint16_t lastTouch, threshold = 250;
bool switch_1;
/*
Adafruit_GFX_Button(void);
// "Classic" initButton() uses center & size
void initButton(Adafruit_GFX *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);
void initButton(Adafruit_GFX *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_x,
uint8_t textsize_y);
// New/alt initButton() uses upper-left corner & size
void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w,
uint16_t h, uint16_t outline, uint16_t fill,
uint16_t textcolor, char *label, uint8_t textsize);
void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w,
uint16_t h, uint16_t outline, uint16_t fill,
uint16_t textcolor, char *label, uint8_t textsize_x,
uint8_t textsize_y);
void drawButton(bool inverted = false);
bool contains(int16_t x, int16_t y);
@brief Sets button state, should be done by some touch function
@param p True for pressed, false for not.
void press(bool p) {
laststate = currstate;
currstate = p;
}
bool justPressed();
bool justReleased();
@brief Query whether the button is currently pressed
@returns True if pressed
bool isPressed(void) { return currstate; };
*/
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// while (!Serial.available()) { // DEBUG TIMESTAMP
// ; // DEBUG TIMESTAMP
// } // DEBUG TIMESTAMP
Debug.timestampOn(); // DEBUG TIMESTAMP
display.begin();
rgb.begin();
display.setRotation(1);
display.cp437(true);
// display.setFont(&FreeSans12pt7b_mod);
fontsize = 1; // TEXTSIZE EQUALS { 0=5px, 1=10px, 2=20px, 3=30px, 4=40px, 5=50px, 6=60px, 7=70px, 8=80px };
display.setTextColor(RDUColor); // DEBUG CODE
display.setTextSize(fontsize); // DEBUG LINE
Serial.println("Starting up now..."); // DEBUG LINE
if (touchDetector.begin()) {
Serial.println("Touch controller init - OK");
} else {
Serial.println("Touch controller init - FAILED");
while (1)
;
}
// create button
button0.initButtonUL(&display, button0_Lx, button0_Ty, button0_Rw, button0_Dh, CYAN, BLUE, YELLOW, button0_text, 3);
// button0.initButton(&display, button0_x, button0_y, button_w, button_h, CYAN, BLUE, YELLOW, button0_text, 2);
button1.initButtonUL(&display, button1_Lx, button1_Ty, button1_Rw, button1_Dh, CYAN, BLUE, YELLOW, button1_text, 3);
// button1.init(&display, display.width() - 40, 20, 70, 40, CYAN, BLUE, YELLOW, "Reset", 2);
// button1.initButton(&display, button1_x, button1_y, button_w, button_h, CYAN, BLUE, YELLOW, button1_text, 2);
button2.initButtonUL(&display, button2_Lx, button2_Ty, button2_Rw, button2_Dh, CYAN, BLUE, YELLOW, button2_text, 3);
// button2.initButton(&display, button2_x, button2_y, button_w, button_h, CYAN, BLUE, YELLOW, button2_text, 2);
display.fillScreen(BLACK); // Clear Screen
drawallbuttons(false); // Draw Buttons, no inverting
initializeWindows(window1_Lx, window1_Ty, window1_Rw, window1_Dh, WHITE, BLACK); // TEST WINDOW
rgb_run(); // Flash onboard LED Lite
Serial.println("Running LOOP now..."); // Tell me about whats going on
display.setTextSize(fontsize);
drawCentreString("Tggggh", textcenter_x, textcenter_y);
drawCentreString("when", textcenter_x, textcenter_y + textspacing[fontsize]);
drawCentreString("70.8", textcenter_x, textcenter_y + textspacing[fontsize] * 2);
drawdegreesym(textcenter_x, textcenter_y + textspacing[fontsize] * 2, fontsize, RDUColor);
// drawdegreesym(textcenter_x, textcenter_y, 3, RED);
// drawCentreString("printing", textcenter_x, textcenter_y / 2 + textspacing[fontsize] * 3);
// drawCentreString("multiple", textcenter_x, textcenter_y / 2 + textspacing[fontsize] * 4);
// drawCentreString("lines", textcenter_x, textcenter_y / 2 + textspacing[fontsize] * 5);
}
void loop() {
contacts = touchDetector.getTouchPoints(points);
if (contacts > 0 && (millis() - lastTouch > threshold)) { // millis() is compare to lastTouch & threshold to prevent DEBOUNCE
//record the x,y coordinates
for (int16_t i = 0; i < contacts; i++) {
touch_x = points[i].x;
touch_y = points[i].y;
Serial.print("Number of Contacts made on the Display = ");
Serial.println(contacts);
Serial.print(points[i].x);
Serial.print(" <== X");
Serial.print("\tis area_xT <?");
Serial.print(button0_area_xT);
Serial.print("\tis area_xB >?");
Serial.println(button0_area_xB);
Serial.print(points[i].y);
Serial.print(" <== Y");
Serial.print("\tis area_yL >?");
Serial.print(button0_area_yL);
Serial.print("\tis area_yR <?");
Serial.println(button0_area_yR);
Serial.print("Button Effected = ");
}
// if (touch_x < button0_area_xT && touch_x > button0_area_xB && touch_y > button0_area_yL && touch_y < button0_area_yR) {
if (button0.contains(touch_y, touch_x - button0_offset_x)) {
button0.press(true);
Serial.println("button0-True");
} else {
button0.press(false);
}
if (button0.justPressed()) {
Serial.println("Button0");
display.setTextSize(fontsize);
initializeWindows(window0_Lx, window0_Ty, window0_Rw, window0_Dh, WHITE, BLACK);
drawallbuttons(false);
drawCentreString(button0_text, textcenter_x, textcenter_y + textspacing[fontsize]);
drawCentreString("PRESSED", textcenter_x, textcenter_y);
lastTouch = millis();
}
/*
if (mybutton.contains(p.x, p.y)) { // (-1, -1) will always fail
mybutton.press(true);
} else {
mybutton.press(false);
}
if ( mybutton.justPressed() ) {
mybutton.drawButton( true ); // draw inverted
// any other code to run at press time
}
*/
// if (touch_x < button1_area_xT && touch_x > button1_area_xB && touch_y > button1_area_yL && touch_y < button1_area_yR) {
if (button1.contains(touch_y, touch_x - button1_offset_x)) {
button1.press(true);
Serial.println("button1-True");
} else {
button1.press(false);
}
if (button1.justPressed()) {
Serial.println("Button1");
Serial.print("textspacing = ");
Serial.println(textspacing[fontsize]);
display.setTextSize(fontsize);
initializeWindows(window1_Lx, window1_Ty, window1_Rw, window1_Dh, WHITE, BLACK); // TEST WINDOW
drawCentreString("75.6", textcenter_x, textcenter_y);
drawdegreesym(textcenter_x, textcenter_y, fontsize, RDUColor);
/*
for (int xy = 0; xy <= 20; xy++) {
display.drawCircleHelper((textcenter_x - 379) + (xy * 30), textcenter_y + 150, 5, xy, GREENYELLOW);
display.drawCircleHelper((textcenter_x - 379) + (xy * 30), textcenter_y + 150, 4, xy, GREENYELLOW);
}
display.drawCircleHelper(textcenter_x + 100, textcenter_y + 50, 4, degree0, GREENYELLOW);
display.drawCircleHelper(textcenter_x + 100, textcenter_y + 50, 5, degree0, GREENYELLOW);
*/
drawCentreString("PRESSED", textcenter_x, textcenter_y + textspacing[fontsize]);
drawCentreString("degrees", textcenter_x, textcenter_y + textspacing[fontsize] * 2);
drawCentreString(button1_text, textcenter_x, textcenter_y + textspacing[fontsize] * 3);
drawCentreString("PRESSED", textcenter_x, textcenter_y + textspacing[fontsize] * 4);
lastTouch = millis();
}
// if (touch_x < button2_area_xT && touch_x > button2_area_xB && touch_y > button2_area_yL && touch_y < button2_area_yR) {
if (button2.contains(touch_y, touch_x - button2_offset_x)) {
button2.press(true);
Serial.println("button2-True");
} else {
button2.press(false);
}
if (button2.justPressed()) {
Serial.println("Button2");
display.setTextSize(fontsize);
initializeWindows(window1_Lx, window1_Ty, window1_Rw, window1_Dh, WHITE, BLACK); // TEST WINDOW
drawCentreString(button2_text, textcenter_x, textcenter_y + textspacing[fontsize]);
drawCentreString("PRESSED", textcenter_x, textcenter_y);
lastTouch = millis();
}
delay(10); // DEBOUNCE DELAY
}
}
// drawdegreesym(int16_t Left0; int16_t Down0; int16_t Size0; int16_t Color0)
// Left0 = Left Size position, Down0 = How far Down from top of screen, Size0 = Fontsize, Color0 = color of circle
void drawdegreesym(int16_t Left0, int16_t Down0, int16_t Size0, int16_t Color0) {
int16_t circles = 1;
// Left0 = Left0 + (fontsize * 10); // Displays original font
//Left0 = Left0 + (fontsize * 25); // FreeFont Settings
// Down0 = (Down0 / 2) + (textspacing[fontsize] * 2); // Displays original font
//Down0 = (Down0 / 2) + (textspacing[fontsize]); // FreeFont Settings
switch (fontsize) {
case 0:
Left0 += 65; // Left0 += 15; // Original Font
Down0 += -25; // Down0 += 0; // Original Font
circles = 5; // circles = 3; // Original Font
Size0 = 5; // Size0 = Size0 // Original Font
break;
case 1:
Left0 += 65; // Left0 += 15; // Original Font
Down0 += -25; // Down0 += 0; // Original Font
circles = 5; // circles = 3; // Original Font
Size0 = 5; // Size0 = Size0 // Original Font
break;
case 2:
Left0 += 110; // FreeFont Settings = 10 Left0 += 10; // Original Font
Down0 += 35; // FreeFont Settings = 25 Down0 += 3; // Original Font
circles = 5; // FreeFont Settings = 3 circles = 3; // Original Font
Size0 = 5; // FreeFont Settings = *2 Size0 = Size0 (no change)
break;
case 3:
Left0 += 17; // Left0 += 17;
Down0 += 30; // Down0 += 5;
circles = 5; // circles = 3;
Size0 = Size0 * 2; // Size0 = Size0 (no change)
break;
case 4:
Left0 += 25; // Left0 += 17;
Down0 += 60; // Down0 += 5;
circles = 6; // circles = 3;
Size0 = Size0 * 2; // Size0 = Size0 (no change)
break;
case 5:
Left0 += 20;
Down0 += 5;
circles = 4;
break;
case 6:
Left0 += 30;
Down0 += 5;
circles = 5;
break;
case 7 ... 8:
Left0 += 40;
Down0 += 7;
circles = 7;
break;
default:
Left0 += 0;
Down0 += 0;
circles = 1;
display.drawCircle(Left0, Down0, Size0, Color0);
return;
}
Color0 = RDUColor; // DEBUG CODE=
int c = Left0;
for (c = Left0; Left0 >= 10; c--) {
uint16_t j = display.getPixel(Left0 - c, Down0-20);
if (j != 0) {
display.drawFastVLine(Left0 - c, Down0, 100, RED);
display.drawFastVLine(Left0 - c, Down0 - 100, 100, RED);
Serial.print("Value of variable j is ");
Serial.print(j, HEX);
Serial.print(" at location Left: ");
Serial.print(Left0 - c);
Serial.print(" Down: ");
Serial.print(Down0);
Serial.println();
break;
}
}
for (int c = 1; c <= circles; c++) {
display.drawCircle(Left0, Down0, Size0 + c, Color0);
}
}
// Draw TEXT STRING Centered in WINDOW X,Y = (buf=Char TEXT, x=LEFT, y=DOWN)
void drawCentreString(const char* buf, int16_t x, int16_t y) {
int16_t x1, y1;
uint16_t w, h;
display.getTextBounds(buf, x, y, &x1, &y1, &w, &h); //calc width of new string
display.setCursor(x - w / 2, y);
display.print(buf);
}
// Draw TEXT STRING Centered in DISPLAY 480x800 area = (buf=Char TEXT, x=LEFT, y=DOWN)
void drawCentre_A(const char* buf, int16_t a, int16_t b) {
int16_t x1, y1, x, y;
uint16_t w, h;
x = display.width() / a;
y = display.height() / b;
display.getTextBounds(buf, x, y, &x1, &y1, &w, &h); //calc width of new string
display.setCursor(x - w / 2, y);
display.print(buf);
}
// Draws all BUTTONS
void drawallbuttons(bool invertyn) {
// display.fillScreen(color);
// initializeWindows(window_x, window_y, window_w, window_h, WHITE, BLACK);
display.setFont();
button0.drawButton(invertyn);
button1.drawButton(invertyn);
button2.drawButton(invertyn);
// display.setFont(&FreeSans12pt7b_mod);
display.setFont(&FreeSans24pt7b);
rgb_run();
}
// Creates Window with textColor and Background Color being set
void initializeWindows(int16_t left, int16_t top, int16_t right, int16_t down, int16_t textColor, int16_t backgdColor) {
int16_t i;
int16_t locatecolor = GREEN;
display.fillRect(left, top, right, down, backgdColor); // TEMPORARY
display.drawRect(left, top, right, down, backgdColor); // BOTTOM 2/3 WINDOW
for (i = 0; i <= 40; i++) {
// Top LEFT
display.writePixel(left - i, top, locatecolor);
display.writePixel(left, top - i, locatecolor);
display.writePixel(left + i, top, locatecolor);
display.writePixel(left, top + i, locatecolor);
/* // Bottom RIGHT left,top,
display.writePixel((right - 1), ((down - 1) + top) - i, locatecolor);
display.writePixel((right - 1) - i, ((down - 1) + top), locatecolor);
display.writePixel((right - 1), ((down - 1) + top) + i, locatecolor);
display.writePixel((right - 1) + i, ((down - 1) + top), locatecolor);
*/
// Bottom RIGHT
display.writePixel((right - 1), ((down - 1) + top) - i, locatecolor);
display.writePixel((right - 1) - i, ((down - 1) + top), locatecolor);
display.writePixel((right - 1), ((down - 1) + top) + i, locatecolor);
display.writePixel((right - 1) + i, ((down - 1) + top), locatecolor);
/*
// DEBUG LINES
DEBUG_INFO("top = %d", (top));
DEBUG_INFO("top + i = %d", (top + i));
DEBUG_INFO("top - i = %d", (top - i));
DEBUG_INFO("top = %d", (top));
DEBUG_INFO("top + i = %d", (top + i));
DEBUG_INFO("top - i = %d", (top - i));
delay(500);
DEBUG_INFO("right = %d", (right - 1));
DEBUG_INFO("right + i = %d", (right - 1) + i);
DEBUG_INFO("right - i = %d", (right - 1) - i);
DEBUG_INFO("(down + top) = %d", (down + top));
DEBUG_INFO("(down + top) + i = %d", (down + top) + i);
DEBUG_INFO("(down + top) - i = %d", (down + top) - i);
delay(250);
*/
}
display.setCursor(top + 20, left + 20);
}
void fontdisplay() {
char myChar;
drawallbuttons(BLACK);
display.setCursor(20, 100);
Serial.println("\n\nprinting font table now");
display.println("printing font table now");
for (byte yz = 60; yz <= 120; yz++) {
myChar = yz;
display.print(myChar);
delay(100);
}
delay(1000);
}
// Flashes the RED, GREEN & BLUE LED Lite on Display
void rgb_run() {
//
// RED LED ON
rgb.on(255, 0, 0);
delay(50);
rgb.on(0, 0, 0);
delay(50);
rgb.on(255, 0, 0);
delay(50);
rgb.on(0, 0, 0);
delay(50);
rgb.on(255, 0, 0);
delay(50);
rgb.on(0, 0, 0);
rgb.off();
}
/*
void OLED() {
float theta;
uint8_t x;
uint8_t y;
static uint8_t lasttx;
static uint8_t lastty;
static uint8_t lastwdx;
static uint8_t lastwdy;
const uint8_t radiust = 60;
const uint8_t radiuswd = 50;
const uint8_t centre = 64;
int8_t secondAdjusted = (second(t_now) - 15) % 60;
char timestring[12];
theta = (secondAdjusted * pi) / 30;
x = centre + (uint8_t)radiust * (cos(theta));
y = centre + (uint8_t)radiust * (sin(theta));
tft.fillCircle(lasttx, lastty, 3, BLACK);
tft.drawCircle(centre, centre, radiust, 0x528A);
tft.fillCircle(x, y, 3, GREEN);
lasttx = x;
lastty = y;
float windAngleAdjusted = windAngle - (pi / 2);
if (windAngleAdjusted < 0) {
windAngleAdjusted = windAngleAdjusted + (2 * pi);
}
x = centre + (uint8_t)radiuswd * (cos(windAngleAdjusted));
y = centre + (uint8_t)radiuswd * (sin(windAngleAdjusted));
if (lastwdx != x || lastwdy != y) {
tft.fillCircle(lastwdx, lastwdy, 3, BLACK);
tft.drawCircle(centre, centre, radiuswd, 0x528A);
tft.fillCircle(x, y, 3, YELLOW);
lastwdx = x;
lastwdy = y;
}
tft.setTextSize(1);
sprintf(timestring, "%02d:%02d:%02d", hour(t_now), minute(t_now), second(t_now));
tft.setCursor(41, 32);
tft.print(timestring);
if (windSpeedMPH < 100){
if (windSpeedMPH < 10){
sprintf(timestring, "0%3.2f", windSpeedMPH);
} else {
sprintf(timestring, "%4.2f", windSpeedMPH);
}
tft.setTextSize(2);
tft.setCursor(35, 48);
tft.print(timestring);
}
if (windSpeedMPHMax < 100){
if (windSpeedMPHMax < 10){
sprintf(timestring, "0%3.2f", windSpeedMPHMax);
} else {
sprintf(timestring, "%4.2f", windSpeedMPHMax);
}
tft.setTextSize(2);
tft.setCursor(35, 64);
tft.print(timestring);
}
}
*/