Browse Source

Small changes in config variables

fastled
Xose Pérez 7 years ago
parent
commit
f9fba898c6
4 changed files with 15 additions and 11 deletions
  1. +2
    -1
      code/espurna/config/general.h
  2. +2
    -2
      code/espurna/mqtt.ino
  3. +6
    -6
      code/espurna/web.ino
  4. +5
    -2
      code/platformio.ini

+ 2
- 1
code/espurna/config/general.h View File

@ -317,7 +317,8 @@ PROGMEM const char* const custom_reset_string[] = {
// You will need the fingerprint for your MQTT server, example for CloudMQTT: // You will need the fingerprint for your MQTT server, example for CloudMQTT:
// $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem // $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem
// $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1 // $ 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_SERVER "" // Default MQTT broker address
#define MQTT_PORT 1883 // MQTT broker port #define MQTT_PORT 1883 // MQTT broker port


+ 2
- 2
code/espurna/mqtt.ino View File

@ -307,12 +307,12 @@ void mqttConnect() {
DEBUG_MSG_P(PSTR("\n")); DEBUG_MSG_P(PSTR("\n"));
#if ASYNC_TCP_SSL_ENABLED #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); mqtt.setSecure(secure);
if (secure) { if (secure) {
DEBUG_MSG_P(PSTR("[MQTT] Using SSL\n")); DEBUG_MSG_P(PSTR("[MQTT] Using SSL\n"));
unsigned char fp[20]; unsigned char fp[20];
if (fp2array(getSetting("mqttFP").c_str(), fp)) {
if (fp2array(getSetting("mqttFP", MQTT_SSL_FINGERPRINT).c_str(), fp)) {
mqtt.addServerFingerprint(fp); mqtt.addServerFingerprint(fp);
} }
} }


+ 6
- 6
code/espurna/web.ino View File

@ -20,7 +20,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
#include "static/index.html.gz.h" #include "static/index.html.gz.h"
#endif #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.cer.h"
#include "static/server.key.h" #include "static/server.key.h"
#endif #endif
@ -980,11 +980,11 @@ void _onHome(AsyncWebServerRequest *request) {
} }
#endif #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) { int _onCertificate(void * arg, const char *filename, uint8_t **buf) {
#if EMBEDDED_WEB
#if WEB_EMBEDDED
if (strcmp(filename, "server.cer") == 0) { if (strcmp(filename, "server.cer") == 0) {
uint8_t * nbuf = (uint8_t*) malloc(server_cer_len); 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__); snprintf_P(_last_modified, sizeof(_last_modified), PSTR("%s %s GMT"), __DATE__, __TIME__);
// Create server // Create server
#if ASYNC_TCP_SSL_ENABLED & WEB_USE_SSL
#if ASYNC_TCP_SSL_ENABLED & WEB_SSL_ENABLED
unsigned int port = 443; unsigned int port = 443;
#else #else
unsigned int port = getSetting("webPort", WEBSERVER_PORT).toInt();
unsigned int port = getSetting("webPort", WEB_PORT).toInt();
#endif #endif
_server = new AsyncWebServer(port); _server = new AsyncWebServer(port);
@ -1120,7 +1120,7 @@ void webSetup() {
}); });
// Run server // Run server
#if ASYNC_TCP_SSL_ENABLED & WEB_USE_SSL
#if ASYNC_TCP_SSL_ENABLED & WEB_SSL_ENABLED
_server->onSslFileRequest(_onCertificate, NULL); _server->onSslFileRequest(_onCertificate, NULL);
_server->beginSecure("server.cer", "server.key", NULL); _server->beginSecure("server.cer", "server.key", NULL);
#else #else


+ 5
- 2
code/platformio.ini View File

@ -50,6 +50,8 @@ board = d1_mini
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1 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] [env:wemos-d1mini-relayshield-ota]
platform = espressif8266 platform = espressif8266
@ -61,10 +63,9 @@ build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=S
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200
[env:nodemcu-lolin] [env:nodemcu-lolin]
platform = espressif8266
platform = espressif8266_stage
framework = arduino framework = arduino
board = nodemcuv2 board = nodemcuv2
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
@ -80,6 +81,8 @@ board = nodemcuv2
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1 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] [env:nodemcu-lolin-ota]
platform = espressif8266 platform = espressif8266


Loading…
Cancel
Save