Add check HASP_USE_* > 0

This commit is contained in:
fvanroie 2020-05-07 01:10:01 +02:00
parent 9a17fbc3f9
commit a425d6400a
4 changed files with 7 additions and 8 deletions

View File

@ -110,7 +110,6 @@ String lcdFirmwareUrl = "http://haswitchplate.com/update/HASwitchPlate.tft";
#if HASP_USE_MQTT > 0
extern char mqttNodeName[16];
extern char mqttNodeName[16];
#else
char mqttNodeName[3] = "na";
#endif
@ -505,7 +504,7 @@ void webHandleInfo()
char mqttClientId[64];
String mac = halGetMacAddress(3, "");
mac.toLowerCase();
snprintf_P(mqttNodeName, sizeof(mqttNodeName), PSTR("plate_%s"), mac.c_str());
snprintf_P(mqttClientId, sizeof(mqttClientId), PSTR("%s-%s"), mqttNodeName, mac.c_str());
httpMessage += mqttClientId;
}

View File

@ -1,5 +1,5 @@
#include "hasp_conf.h"
#if HASP_USE_MQTT
#if HASP_USE_MQTT>0
#include <Arduino.h>
#include "ArduinoJson.h"
@ -190,7 +190,7 @@ void mqtt_send_statusupdate()
snprintf_P(data, sizeof(data), PSTR("{\"status\":\"available\",\"version\":\"%s\",\"uptime\":%lu,"),
haspGetVersion().c_str(), long(millis() / 1000));
strcat(buffer, data);
#if HASP_USE_WIFI
#if HASP_USE_WIFI>0
snprintf_P(buffer, sizeof(buffer), PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%s\","), WiFi.SSID().c_str(),
WiFi.RSSI(), WiFi.localIP().toString().c_str());
strcat(data, buffer);

View File

@ -14,7 +14,7 @@
#include "hasp_config.h"
#include "hasp_dispatch.h"
#if HASP_USE_QRCODE != 0
#if HASP_USE_QRCODE > 0
#include "lv_qrcode.h"
#endif
@ -128,7 +128,7 @@ static void oobeSetupQR(const char * ssid, const char * pass)
lv_obj_set_style_local_bg_opa(container, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0);
lv_obj_set_style_local_border_opa(container, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0);
#if HASP_USE_QRCODE != 0
#if HASP_USE_QRCODE > 0
snprintf_P(buffer, sizeof(buffer), PSTR("WIFI:S:%s;T:WPA;P:%s;;"), ssid, pass);
lv_obj_t * qr = lv_qrcode_create(oobepage[0], 120, LV_COLOR_BLACK, LV_COLOR_WHITE);

View File

@ -5,7 +5,7 @@
#include "hasp_conf.h"
#include "hasp_spiffs.h"
#if HASP_USE_SPIFFS
#if HASP_USE_SPIFFS>0
#if defined(ARDUINO_ARCH_ESP32)
#include "SPIFFS.h"
#endif
@ -91,7 +91,7 @@ void spiffsSetup()
{
// no SPIFFS settings, as settings depend on SPIFFS
#if HASP_USE_SPIFFS
#if HASP_USE_SPIFFS>0
#if defined(ARDUINO_ARCH_ESP8266)
if(!SPIFFS.begin()) {
#else