diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index bbc6e0be..8137b86c 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -317,7 +317,8 @@ PROGMEM const char* const custom_reset_string[] = { // You will need the fingerprint for your MQTT server, example for CloudMQTT: // $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem // $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1 -#define MQTT_USE_SSL 0 +#define MQTT_SSL_ENABLED 0 +#define MQTT_SSL_FINGERPRINT "" #define MQTT_SERVER "" // Default MQTT broker address #define MQTT_PORT 1883 // MQTT broker port diff --git a/code/espurna/mqtt.ino b/code/espurna/mqtt.ino index fecd7926..07055786 100644 --- a/code/espurna/mqtt.ino +++ b/code/espurna/mqtt.ino @@ -307,12 +307,12 @@ void mqttConnect() { DEBUG_MSG_P(PSTR("\n")); #if ASYNC_TCP_SSL_ENABLED - bool secure = getSetting("mqttUseSSL", MQTT_USE_SSL).toInt() == 1; + bool secure = getSetting("mqttUseSSL", MQTT_SSL_ENABLED).toInt() == 1; mqtt.setSecure(secure); if (secure) { DEBUG_MSG_P(PSTR("[MQTT] Using SSL\n")); unsigned char fp[20]; - if (fp2array(getSetting("mqttFP").c_str(), fp)) { + if (fp2array(getSetting("mqttFP", MQTT_SSL_FINGERPRINT).c_str(), fp)) { mqtt.addServerFingerprint(fp); } } diff --git a/code/espurna/web.ino b/code/espurna/web.ino index 56f968f0..f62b8c6e 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -20,7 +20,7 @@ Copyright (C) 2016-2017 by Xose PĂ©rez #include "static/index.html.gz.h" #endif -#if ASYNC_TCP_SSL_ENABLED & WEB_USE_SSL +#if ASYNC_TCP_SSL_ENABLED & WEB_SSL_ENABLED #include "static/server.cer.h" #include "static/server.key.h" #endif @@ -980,11 +980,11 @@ void _onHome(AsyncWebServerRequest *request) { } #endif -#if ASYNC_TCP_SSL_ENABLED & WEB_USE_SSL +#if ASYNC_TCP_SSL_ENABLED & WEB_SSL_ENABLED int _onCertificate(void * arg, const char *filename, uint8_t **buf) { -#if EMBEDDED_WEB +#if WEB_EMBEDDED if (strcmp(filename, "server.cer") == 0) { uint8_t * nbuf = (uint8_t*) malloc(server_cer_len); @@ -1081,10 +1081,10 @@ void webSetup() { snprintf_P(_last_modified, sizeof(_last_modified), PSTR("%s %s GMT"), __DATE__, __TIME__); // Create server - #if ASYNC_TCP_SSL_ENABLED & WEB_USE_SSL + #if ASYNC_TCP_SSL_ENABLED & WEB_SSL_ENABLED unsigned int port = 443; #else - unsigned int port = getSetting("webPort", WEBSERVER_PORT).toInt(); + unsigned int port = getSetting("webPort", WEB_PORT).toInt(); #endif _server = new AsyncWebServer(port); @@ -1120,7 +1120,7 @@ void webSetup() { }); // Run server - #if ASYNC_TCP_SSL_ENABLED & WEB_USE_SSL + #if ASYNC_TCP_SSL_ENABLED & WEB_SSL_ENABLED _server->onSslFileRequest(_onCertificate, NULL); _server->beginSecure("server.cer", "server.key", NULL); #else diff --git a/code/platformio.ini b/code/platformio.ini index d13e9e92..02e53be1 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -50,6 +50,8 @@ board = d1_mini lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1 +upload_speed = 460800 +monitor_baud = 115200 [env:wemos-d1mini-relayshield-ota] platform = espressif8266 @@ -61,10 +63,9 @@ build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=S upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -monitor_baud = 115200 [env:nodemcu-lolin] -platform = espressif8266 +platform = espressif8266_stage framework = arduino board = nodemcuv2 lib_deps = ${common.lib_deps} @@ -80,6 +81,8 @@ board = nodemcuv2 lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1 +upload_speed = 460800 +monitor_baud = 115200 [env:nodemcu-lolin-ota] platform = espressif8266