From 548a89f82461e2089d840631c268e729ab326c2d Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Sun, 22 Jan 2023 11:14:37 -0500 Subject: [PATCH] Create config header --- src/config.h | 7 +++++++ src/main.cpp | 10 ++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/config.h diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..6d02e4d --- /dev/null +++ b/src/config.h @@ -0,0 +1,7 @@ +#ifndef CONFIG_H_ +#define CONFIG_H_ + +#define WIFI_SSID "REPLACE_WITH_YOUR_SSID" +#define WIFI_PASSWORD "REPLACE_WITH_YOUR_PASSWORD" + +#endif // CONFIG_H_ diff --git a/src/main.cpp b/src/main.cpp index 45b6c19..49e0a86 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,9 +3,7 @@ #include #include #include - -const char* ssid = "REPLACE_WITH_YOUR_SSID"; -const char* password = "REPLACE_WITH_YOUR_PASSWORD"; +#include "config.h" class App { public: @@ -21,7 +19,7 @@ public: M5.Display.setFont(&fonts::Font0); M5.Display.setEpdMode(epd_text); M5.Display.setCursor(0, 10); - M5.Display.printf("SSID: %s\n", ssid); + M5.Display.printf("SSID: %s\n", WIFI_SSID); M5.Display.printf("IP Address: %s\n", WiFi.localIP().toString()); M5.Display.printf("\n\n"); M5.Display.printf("Web server running on port 80\n"); @@ -96,7 +94,7 @@ void setup(void) { M5.Display.endWrite(); WiFi.mode(WIFI_STA); - WiFi.begin(ssid, password); + WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.println(""); // Wait for connection @@ -106,7 +104,7 @@ void setup(void) { } Serial.println(""); Serial.print("Connected to "); - Serial.println(ssid); + Serial.println(WIFI_SSID); Serial.print("IP address: "); Serial.println(WiFi.localIP());