From e52df1d798d564f54b0ef23d9f7411f20804653a Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Mon, 28 Feb 2022 14:21:55 +0100 Subject: [PATCH] move passwords and update build env --- .gitignore | 2 ++ platformio.ini | 14 ++++++++++++-- src/main.cpp | 14 ++++++-------- src/main.h | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index dcf82d9..95ceab5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.pio .pioenvs .piolibdeps @@ -8,3 +9,4 @@ local/ share/ src/passwords.h +export_secrets.sh diff --git a/platformio.ini b/platformio.ini index 1ae92e8..74591bd 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,7 +11,8 @@ [env:nodemcu] ;platform = https://github.com/platformio/platform-espressif8266.git#feature/stage ;platform = https://github.com/platformio/platform-espressif8266.git -platform = espressif8266@1.7.3 +;platform = espressif8266@1.7.3 +platform = espressif8266 board = nodemcu framework = arduino board_build.f_cpu = 80000000L @@ -28,6 +29,15 @@ build_flags = ; -DDEBUG_ESP_HTTP_CLIENT ; -DDEBUG_ESP_WIFI ; -D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH + -DWIFI_SSID="\"${sysenv.WIFI_SSID}\"" + -DWIFI_PASSWD="\"${sysenv.WIFI_PASSWD}\"" + -DWIFI_SSID2="\"${sysenv.WIFI_SSID2}\"" + -DWIFI_PASSWD2="\"${sysenv.WIFI_PASSWD2}\"" + -DWIFI_SSID3="\"${sysenv.WIFI_SSID3}\"" + -DWIFI_PASSWD3="\"${sysenv.WIFI_PASSWD3}\"" + -DMQTT_BROKER_URI="\"${sysenv.MQTT_BROKER_URI}\"" + -DMQTT_USERNAME="\"${sysenv.MQTT_USERNAME}\"" + -DMQTT_PASSWORD="\"${sysenv.MQTT_PASSWORD}\"" lib_deps = ArduinoJson @@ -39,4 +49,4 @@ lib_deps = Nova Fitness Sds dust sensors library ; EspSoftwareSerial RunningAverage - MQTT + 256dpi/MQTT diff --git a/src/main.cpp b/src/main.cpp index c163a20..cfea129 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,14 +27,13 @@ extern "C" { #include #include "main.h" -#include "passwords.h" const char* server PROGMEM = "ingress.opensensemap.org"; #define MQTT_MAX_PACKET_SIZE 512 const char* mqttserver PROGMEM = "home.xd0.de"; -const char* mqttusername PROGMEM = "esp-weatherstation"; -const char* mqttpassword PROGMEM = PWD_MQTT; +//const char* mqttusername PROGMEM = "esp-weatherstation"; +//const char* mqttpassword PROGMEM = MQTT_PASSWORD; constexpr unsigned int postingInterval = 60000; //Uploadintervall in Millisekunden constexpr unsigned int dhcp_interval = 60*60*1000; @@ -386,7 +385,7 @@ void ICACHE_FLASH_ATTR sendValues() { #endif mqttclient.begin(mqttserver, 8883, net); constexpr unsigned int retry_delay = 500; - for (int tries=0; tries<5 && !mqttclient.connect(mqttusername, mqttusername, mqttpassword); tries++ ) { + for (int tries=0; tries<5 && !mqttclient.connect(MQTT_USERNAME, MQTT_USERNAME, MQTT_PASSWORD); tries++ ) { DEBUG_MSG("."); delay(retry_delay); } @@ -453,10 +452,9 @@ void setup() { WiFi.persistent(false); // don't load and save credentials to flash WiFi.mode(WIFI_STA); - wifiMulti.addAP("nether.net", PWD_NETHERNET); - wifiMulti.addAP("LNet", PWD_LNET); - wifiMulti.addAP("hw1_gast", PWD_HW1); - wifiMulti.addAP("Freifunk", ""); + wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD); + wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2); + wifiMulti.addAP(WIFI_SSID3, WIFI_PASSWD3); previousMillis = rtcMillis(); DEBUG_MSG("[DEBUG] ready.\n"); //Serial.flush(); diff --git a/src/main.h b/src/main.h index 40c1f70..712be70 100644 --- a/src/main.h +++ b/src/main.h @@ -7,6 +7,6 @@ #define DEBUG_MSG(...) #endif -#define FW_VERSION 41 +#define FW_VERSION 42 #endif /* _MAIN_H */