Merge pull request #48 from hpsaturn/av/wifi_env_variables

Added alternative to set WiFi params via environment variables
This commit is contained in:
Lewis He
2024-09-24 09:26:08 +08:00
committed by GitHub
4 changed files with 16 additions and 8 deletions
+3
View File
@@ -36,6 +36,9 @@ examples
8. Click (→) to upload firmware
9. Click (plug symbol) to monitor serial output
Optional:
You can upload the assets contents for the speaker demo, using the "Upload Filesystem Image" on PlatformIO menu.
### ArduinoIDE
+1 -1
View File
@@ -264,7 +264,7 @@ static void wifi_event_cb(WiFiEvent_t event)
void setupWiFi()
{
WiFi.onEvent(wifi_event_cb);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
WiFi.begin(WIFI_SSID, WIFI_PASS);
configTzTime(DEFAULT_TIMEZONE, NTP_SERVER1, NTP_SERVER2);
// set notification call-back function
+2 -2
View File
@@ -5,8 +5,8 @@
#define WIFI_SSID "You WIFI SSID"
#endif
#ifndef WIFI_PASSWORD
#define WIFI_PASSWORD "You WIFI PASSWORD"
#ifndef WIFI_PASS
#define WIFI_PASS "You WIFI PASSWORD"
#endif
#define NTP_SERVER1 "pool.ntp.org"
+10 -5
View File
@@ -7,6 +7,11 @@
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[wifi]
ssid = ${sysenv.PIO_WIFI_SSID}
password = ${sysenv.PIO_WIFI_PASSWORD}
[platformio]
; default_envs = T-Keyboard
; src_dir = examples/Keyboard_ESP32C3
@@ -44,14 +49,14 @@ framework = arduino
upload_speed = 921600
monitor_speed = 115200
build_flags =
-DBOARD_HAS_PSRAM
-DBOARD_HAS_PSRAM=1
-DCORE_DEBUG_LEVEL=5
; Enable UARDUINO_ USB_ CDC_ ON_ BOOT will start printing and wait for terminal access during startup
-DARDUINO_USB_CDC_ON_BOOT=1
'-DWIFI_SSID="${wifi.ssid}"'
'-DWIFI_PASS="${wifi.password}"'
; Enable UARDUINO_USB_CDC_ON_BOOT will turn off printing and will not block when using the battery
; -UARDUINO_USB_CDC_ON_BOOT
-DDISABLE_ALL_LIBRARY_WARNINGS
; -DDISABLE_ALL_LIBRARY_WARNINGS