Skip to content

Commit 0572db8

Browse files
committed
- Added missing library link for ThingSpeak in heading section of main.ino
- Changed Access Point SSID and password - Added displayAccessPoint and displayWiFIAP to aid connection to ESP32 Access Point - Dark theme and signal strength percentage for Access Point page
1 parent ec40ffa commit 0572db8

File tree

3 files changed

+94
-17
lines changed

3 files changed

+94
-17
lines changed

main/main.ino

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- https://github.com/Sensirion/arduino-i2c-scd4x
88
- https://github.com/tzapu/WiFiManager
99
- https://github.com/Bodmer/TFT_eSPI
10-
- https://github.com/PowerBroker2/SafeString
10+
- https://github.com/mathworks/thingspeak-arduino
1111
1212
2.
1313
ThingSpeak setup
@@ -29,10 +29,10 @@
2929
//----------------- Timers Definition ---------------------------------
3030
#include "millisDelay.h"
3131
millisDelay thingSpeakDelay;
32-
int thingSpeakDelaylenght = 10 *60000; // [minutes] Set the interval to gather data and push to ThingSpeak
32+
int thingSpeakDelaylenght = 10 *60000; // [minutes] Set the interval to gather data and push to GSheet
3333
int thingSpeakDelayfirstrunlenght = 10 *1000; // [seconds] Set the interval for the first run of timer above
3434
millisDelay readingsSCD41Delay;
35-
int readingsSCD41Delaylenght = 1 *60000; // [minutes] Set the interval to gather data and push to ThingSpeak
35+
int readingsSCD41Delaylenght = 1 *60000; // [minutes] Set the interval to gather data and push to GSheet
3636
int thingSpeakCounter = 0;
3737

3838
millisDelay displayDelay;
@@ -80,14 +80,13 @@ void setup()
8080
delay(100);
8181

8282
//---------------------------------------------------------------------
83-
//------------- Initialize DIsplay and call "Hello" -------------------
83+
//--------------------- Initialize DIsplay ----------------------------
8484
displaySetup();
85-
displayHello();
86-
delay(3000);
8785

8886
//---------------------------------------------------------------------
8987
//------------------------ Wi-Fi Manager ------------------------------
90-
displayWiFi();
88+
displayWiFIAP();
89+
delay(2000);
9190
initializeWiFiManager();
9291

9392
pinMode(WiFiReset_pin, INPUT_PULLUP); // Set the wifi reset pin as input with pullup
@@ -195,4 +194,4 @@ void loop()
195194

196195
}
197196

198-
}
197+
}

main/tftRoundSPI.ino

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,24 +307,92 @@ void displayHello()
307307

308308
}
309309

310-
void displayWiFi()
310+
void displayWiFIAP()
311311
{
312312
tft.fillScreen(TFT_BLACK);
313313

314-
uint16_t xco2text = 120; // Position of text
315-
uint16_t yco2text = 120;
316-
317314
// Set datum to Middle Right
318315
tft.setTextDatum(MC_DATUM);
319-
320-
tft.setTextSize(5);
316+
317+
uint16_t xAP1 = 120; // Position of text
318+
uint16_t yAP1 = 120;
319+
320+
tft.setTextSize(2);
321+
tft.setTextColor(TFT_WHITE, TFT_BLACK);
322+
tft.drawString("Connect to WiFi", xAP1, yAP1);
323+
324+
}
325+
326+
void displayAccessPoint()
327+
{
328+
tft.fillScreen(TFT_BLACK);
329+
330+
uint16_t xAP2 = 120; // Position of text
331+
uint16_t yAP2 = 35;
332+
333+
// Set datum to Middle Right
334+
tft.setTextDatum(MC_DATUM);
335+
336+
tft.setTextSize(2);
337+
tft.setTextColor(TFT_WHITE, TFT_BLACK);
338+
tft.drawString("SSID, PSW:", xAP2, yAP2);
339+
340+
uint16_t xAP3 = 120; // Position of text
341+
uint16_t yAP3 = 70;
342+
343+
// Set datum to Middle Right
344+
tft.setTextDatum(MC_DATUM);
345+
346+
tft.setTextSize(2);
347+
tft.setTextColor(TFT_WHITE, TFT_BLACK);
348+
tft.drawString("ESP32, 444ap444", xAP3, yAP3);
349+
350+
uint16_t xAP4= 120; // Position of text
351+
uint16_t yAP4 = 120;
352+
353+
// Set datum to Middle Right
354+
tft.setTextDatum(MC_DATUM);
355+
356+
tft.setTextSize(2);
357+
tft.setTextColor(TFT_WHITE, TFT_BLACK);
358+
tft.drawString("Visit:", xAP4, yAP4);
359+
360+
uint16_t xAP5 = 120; // Position of text
361+
uint16_t yAP5 = 170;
362+
363+
// Set datum to Middle Right
364+
tft.setTextDatum(MC_DATUM);
365+
366+
tft.setTextSize(3);
321367
tft.setTextColor(TFT_WHITE, TFT_BLACK);
322-
tft.drawString("WiFi", xco2text, yco2text);
368+
tft.drawString("192.168.4.1", xAP5, yAP5);
323369

324370
}
325371

326372
void displayWiFiOK()
327373
{
374+
tft.fillScreen(TFT_BLACK);
375+
376+
// Set datum to Middle Right
377+
tft.setTextDatum(MC_DATUM);
378+
379+
uint16_t xAP6 = 120; // Position of text
380+
uint16_t yAP6 = 80;
381+
382+
tft.setTextSize(2);
383+
tft.setTextColor(TFT_WHITE, TFT_BLACK);
384+
tft.drawString("Connected to:", xAP6, yAP6);
385+
386+
uint16_t xAP7 = 120; // Position of text
387+
uint16_t yAP7 = 125;
388+
389+
// Set datum to Middle Right
390+
tft.setTextDatum(MC_DATUM);
391+
392+
tft.setTextSize(2);
393+
tft.setTextColor(TFT_WHITE, TFT_BLACK);
394+
tft.drawString(ssidName, xAP7, yAP7);
395+
328396
uint16_t fg_color = TFT_GREEN;
329397
uint16_t bg_color = TFT_BLACK; // This is the background colour used for smoothing (anti-aliasing)
330398

@@ -347,6 +415,11 @@ void displayWiFiOK()
347415

348416
void displayWiFiNG()
349417
{
418+
tft.fillScreen(TFT_BLACK);
419+
420+
// Set datum to Middle Right
421+
tft.setTextDatum(MC_DATUM);
422+
350423
uint16_t fg_color = TFT_RED;
351424
uint16_t bg_color = TFT_BLACK; // This is the background colour used for smoothing (anti-aliasing)
352425

main/wifiMngr.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ void resetWiFicredentials()
1414
**********************************************************************************/
1515
void initializeWiFiManager()
1616
{
17-
17+
18+
displayAccessPoint();
19+
1820
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
1921
// it is a good practice to make sure your code sets wifi mode how you want it.
2022

@@ -34,10 +36,13 @@ void initializeWiFiManager()
3436
// if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect())
3537
// then goes into a blocking loop awaiting configuration and will return success result
3638

39+
wm.setClass("invert"); // dark theme
40+
wm.setScanDispPerc(true); // display percentages instead of graphs for RSSI
41+
3742
bool res;
3843
// res = wm.autoConnect(); // auto generated AP name from chipid
3944
// res = wm.autoConnect("ESP32SetupWiFi"); // anonymous ap
40-
res = wm.autoConnect("ESP32SetupWiFi","esp32wifisetuppsw"); // password protected ap
45+
res = wm.autoConnect("ESP32","444ap444"); // password protected ap
4146

4247
if(!res) {
4348
Serial.println("Failed to connect");

0 commit comments

Comments
 (0)