Browse Source

move passwords and update build env

main
Hendrik Langer 3 years ago
parent
commit
e52df1d798
  1. 2
      .gitignore
  2. 14
      platformio.ini
  3. 14
      src/main.cpp
  4. 2
      src/main.h

2
.gitignore

@ -1,3 +1,4 @@
.pio
.pioenvs .pioenvs
.piolibdeps .piolibdeps
@ -8,3 +9,4 @@ local/
share/ share/
src/passwords.h src/passwords.h
export_secrets.sh

14
platformio.ini

@ -11,7 +11,8 @@
[env:nodemcu] [env:nodemcu]
;platform = https://github.com/platformio/platform-espressif8266.git#feature/stage ;platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
;platform = https://github.com/platformio/platform-espressif8266.git ;platform = https://github.com/platformio/platform-espressif8266.git
platform = espressif8266@1.7.3 ;platform = espressif8266@1.7.3
platform = espressif8266
board = nodemcu board = nodemcu
framework = arduino framework = arduino
board_build.f_cpu = 80000000L board_build.f_cpu = 80000000L
@ -28,6 +29,15 @@ build_flags =
; -DDEBUG_ESP_HTTP_CLIENT ; -DDEBUG_ESP_HTTP_CLIENT
; -DDEBUG_ESP_WIFI ; -DDEBUG_ESP_WIFI
; -D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH ; -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 = lib_deps =
ArduinoJson ArduinoJson
@ -39,4 +49,4 @@ lib_deps =
Nova Fitness Sds dust sensors library Nova Fitness Sds dust sensors library
; EspSoftwareSerial ; EspSoftwareSerial
RunningAverage RunningAverage
MQTT 256dpi/MQTT

14
src/main.cpp

@ -27,14 +27,13 @@ extern "C" {
#include <XD0OTA.h> #include <XD0OTA.h>
#include "main.h" #include "main.h"
#include "passwords.h"
const char* server PROGMEM = "ingress.opensensemap.org"; const char* server PROGMEM = "ingress.opensensemap.org";
#define MQTT_MAX_PACKET_SIZE 512 #define MQTT_MAX_PACKET_SIZE 512
const char* mqttserver PROGMEM = "home.xd0.de"; const char* mqttserver PROGMEM = "home.xd0.de";
const char* mqttusername PROGMEM = "esp-weatherstation"; //const char* mqttusername PROGMEM = "esp-weatherstation";
const char* mqttpassword PROGMEM = PWD_MQTT; //const char* mqttpassword PROGMEM = MQTT_PASSWORD;
constexpr unsigned int postingInterval = 60000; //Uploadintervall in Millisekunden constexpr unsigned int postingInterval = 60000; //Uploadintervall in Millisekunden
constexpr unsigned int dhcp_interval = 60*60*1000; constexpr unsigned int dhcp_interval = 60*60*1000;
@ -386,7 +385,7 @@ void ICACHE_FLASH_ATTR sendValues() {
#endif #endif
mqttclient.begin(mqttserver, 8883, net); mqttclient.begin(mqttserver, 8883, net);
constexpr unsigned int retry_delay = 500; 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("."); DEBUG_MSG(".");
delay(retry_delay); delay(retry_delay);
} }
@ -453,10 +452,9 @@ void setup() {
WiFi.persistent(false); // don't load and save credentials to flash WiFi.persistent(false); // don't load and save credentials to flash
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
wifiMulti.addAP("nether.net", PWD_NETHERNET); wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD);
wifiMulti.addAP("LNet", PWD_LNET); wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2);
wifiMulti.addAP("hw1_gast", PWD_HW1); wifiMulti.addAP(WIFI_SSID3, WIFI_PASSWD3);
wifiMulti.addAP("Freifunk", "");
previousMillis = rtcMillis(); previousMillis = rtcMillis();
DEBUG_MSG("[DEBUG] ready.\n"); //Serial.flush(); DEBUG_MSG("[DEBUG] ready.\n"); //Serial.flush();

2
src/main.h

@ -7,6 +7,6 @@
#define DEBUG_MSG(...) #define DEBUG_MSG(...)
#endif #endif
#define FW_VERSION 41 #define FW_VERSION 42
#endif /* _MAIN_H */ #endif /* _MAIN_H */

Loading…
Cancel
Save