Add compiled feature information

5.14.0a
 * Add compiled feature information to Status 4
This commit is contained in:
Theo Arends 2018-05-17 15:36:45 +02:00
parent 80ffea085b
commit 496b41dfbd
22 changed files with 261 additions and 6 deletions

View File

@ -2,6 +2,7 @@
* Add Eastron SDM630 energy meter (#2735)
* Add KNX communication enhancement (#2742)
* Add KNX energy data (#2750)
* Add compiled feature information to Status 4
* Fix display selection of un-available GPIO options in Module Configuration webpage (#2718)
* Fix timer re-trigger within one minute after restart (#2744)
* Fix IRSend not accepting data value of 0 (#2751)

View File

@ -57,6 +57,7 @@
#define D_JSON_EVERY "Every"
#define D_JSON_FAILED "Failed"
#define D_JSON_FALLBACKTOPIC "FallbackTopic"
#define D_JSON_FEATURES "Features"
#define D_JSON_FLASHMODE "FlashMode"
#define D_JSON_FLASHSIZE "FlashSize"
#define D_JSON_FREEMEMORY "Free"
@ -391,6 +392,9 @@
#define INCLUDE_FILE(x) QUOTEME(language/x.h)
#include INCLUDE_FILE(MY_LANGUAGE)
#endif
#ifndef LANGUAGE_LCID
#define LANGUAGE_LCID 2057 // en-GB
#endif
// Common
enum UnitNames {

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1026
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "bg"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1029
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "cs"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1031
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "de"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1032
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "el"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 2057
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "en"

View File

@ -33,6 +33,7 @@
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 11274
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "es"

View File

@ -33,6 +33,7 @@
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1036
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "fr"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1038
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "hu"

View File

@ -33,6 +33,7 @@
#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1040
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "it"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1043
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "nl"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1045
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "pl"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1046
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "pt"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 2070
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "pt"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1049
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "ru"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 2052
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "zh"

View File

@ -33,6 +33,7 @@
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
#define LANGUAGE_LCID 1028
// HTML (ISO 639-1) Language Code
#define D_HTML_LANGUAGE "zh"

View File

@ -112,6 +112,9 @@ typedef unsigned long power_t; // Power (Relay) type
#define max(a,b) ((a)>(b)?(a):(b))
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
//enum ws2812NeopixelbusFeature { NEO_RGB, NEO_GRB, NEO_BRG, NEO_RBG, NEO_3LED, NEO_RGBW, NEO_GRBW }; // Doesn't work
#define NEO_RGB 0 // Neopixel RGB leds
#define NEO_GRB 1 // Neopixel GRB leds

View File

@ -97,6 +97,10 @@ const char kTasmotaCommands[] PROGMEM =
D_CMND_I2CSCAN "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALDELIMITER;
// Global variables
unsigned long feature_drv1; // Compiled driver feature map
unsigned long feature_drv2; // Compiled driver feature map
unsigned long feature_sns1; // Compiled sensor feature map
unsigned long feature_sns2; // Compiled sensor feature map
int baudrate = APP_BAUDRATE; // Serial interface baud rate
SerialConfig serial_config = SERIAL_8N1; // Serial interface configuration 8 data bits, No parity, 1 stop bit
byte serial_in_byte; // Received byte
@ -176,7 +180,6 @@ uint8_t spi_flg = 0; // SPI configured
uint8_t light_type = 0; // Light types
bool pwm_present = false; // Any PWM channel configured with SetOption15 0
boolean mdns_begun = false;
unsigned long features = 0UL;
uint8_t ntp_force_sync = 0; // Force NTP sync
char my_version[33]; // Composed version string
@ -1333,8 +1336,8 @@ void PublishStatus(uint8_t payload)
}
if ((0 == payload) || (4 == payload)) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%d,\"" D_JSON_PROGRAMFLASHSIZE "\":%d,\"" D_JSON_FLASHSIZE "\":%d,\"" D_JSON_FLASHMODE "\":%d}}"),
ESP.getSketchSize()/1024, ESP.getFreeSketchSpace()/1024, ESP.getFreeHeap()/1024, ESP.getFlashChipSize()/1024, ESP.getFlashChipRealSize()/1024, ESP.getFlashChipMode());
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%d,\"" D_JSON_PROGRAMFLASHSIZE "\":%d,\"" D_JSON_FLASHSIZE "\":%d,\"" D_JSON_FLASHMODE "\":%d,\"" D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]}}"),
ESP.getSketchSize()/1024, ESP.getFreeSketchSpace()/1024, ESP.getFreeHeap()/1024, ESP.getFlashChipSize()/1024, ESP.getFlashChipRealSize()/1024, ESP.getFlashChipMode(), LANGUAGE_LCID, feature_drv1, feature_drv2, feature_sns1, feature_sns2);
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "4"));
}
@ -2372,6 +2375,8 @@ void setup()
OsWatchInit();
GetFeatures();
baudrate = Settings.baudrate * 1200;
seriallog_level = Settings.seriallog_level;
seriallog_timer = SERIALLOG_TIMER;

View File

@ -516,6 +516,235 @@ uint32_t GetHash(const char *buffer, size_t size)
return hash;
}
/*********************************************************************************************\
* Fill feature list
\*********************************************************************************************/
void GetFeatures()
{
feature_drv1 = 0x00000000; // xdrv_00_mqtt.ino, xdrv_01_light.ino, xdrv_04_snfbridge.ino
// feature_drv1 |= 0x00000001;
// feature_drv1 |= 0x00000002;
#ifdef USE_I2C
feature_drv1 |= 0x00000004; // sonoff.ino
#endif
#ifdef USE_SPI
feature_drv1 |= 0x00000008; // sonoff.ino
#endif
#ifdef USE_DISCOVERY
feature_drv1 |= 0x00000010; // sonoff.ino
#endif
#ifdef USE_ARDUINO_OTA
feature_drv1 |= 0x00000020; // sonoff.ino
#endif
#ifdef USE_MQTT_TLS
feature_drv1 |= 0x00000040; // sonoff.ino
#endif
#ifdef USE_WEBSERVER
feature_drv1 |= 0x00000080; // webserver.ino
#endif
#ifdef WEBSERVER_ADVERTISE
feature_drv1 |= 0x00000100; // webserver.ino
#endif
#ifdef USE_EMULATION
feature_drv1 |= 0x00000200; // xplg_wemohue.ino
#endif
#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT)
feature_drv1 |= 0x00000400; // xdrv_00_mqtt.ino
#endif
#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
feature_drv1 |= 0x00000800; // xdrv_00_mqtt.ino
#endif
#if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO)
feature_drv1 |= 0x00001000; // xdrv_00_mqtt.ino
#endif
#ifdef MQTT_HOST_DISCOVERY
feature_drv1 |= 0x00002000; // xdrv_00_mqtt.ino
#endif
#ifdef USE_ARILUX_RF
feature_drv1 |= 0x00004000; // xdrv_01_light.ino
#endif
#ifdef USE_WS2812
feature_drv1 |= 0x00008000; // xdrv_01_light.ino
#endif
#ifdef USE_WS2812_DMA
feature_drv1 |= 0x00010000; // xdrv_01_light.ino
#endif
#ifdef USE_IR_REMOTE
feature_drv1 |= 0x00020000; // xdrv_02_irremote.ino
#endif
#ifdef USE_IR_HVAC
feature_drv1 |= 0x00040000; // xdrv_02_irremote.ino
#endif
#ifdef USE_IR_RECEIVE
feature_drv1 |= 0x00080000; // xdrv_02_irremote.ino
#endif
#ifdef USE_DOMOTICZ
feature_drv1 |= 0x00100000; // xdrv_05_domoticz.ino
#endif
#ifdef USE_DISPLAY
feature_drv1 |= 0x00200000; // xdrv_06_display.ino
#endif
#ifdef USE_HOME_ASSISTANT
feature_drv1 |= 0x00400000; // xdrv_07_home_assistant.ino
#endif
#ifdef USE_SERIAL_BRIDGE
feature_drv1 |= 0x00800000; // xdrv_08_serial_bridge.ino
#endif
#ifdef USE_TIMERS
feature_drv1 |= 0x01000000; // xdrv_09_timers.ino
#endif
#ifdef USE_SUNRISE
feature_drv1 |= 0x02000000; // xdrv_09_timers.ino
#endif
#ifdef USE_TIMERS_WEB
feature_drv1 |= 0x04000000; // xdrv_09_timers.ino
#endif
#ifdef USE_RULES
feature_drv1 |= 0x08000000; // xdrv_10_rules.ino
#endif
#ifdef USE_KNX
feature_drv1 |= 0x10000000; // xdrv_11_knx.ino
#endif
/*********************************************************************************************/
feature_drv2 = 0x00000000;
#ifdef USE_CONFIG_OVERRIDE
feature_drv2 |= 0x00000001; // user_config(_override).h
#endif
#ifdef BE_MINIMAL
feature_drv2 |= 0x00000002; // user_config(_override).h
#endif
#ifdef USE_ALL_SENSORS
feature_drv2 |= 0x00000004; // user_config(_override).h
#endif
#ifdef USE_CLASSIC
feature_drv2 |= 0x00000008; // user_config(_override).h
#endif
#ifdef USE_KNX_NO_EMULATION
feature_drv2 |= 0x00000010; // user_config(_override).h
#endif
#ifdef VTABLES_IN_FLASH
feature_drv2 |= 0x04000000; // platformio.ini
#endif
#ifdef PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
feature_drv2 |= 0x08000000; // platformio.ini
#endif
#ifdef PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
feature_drv2 |= 0x10000000; // platformio.ini
#endif
#ifdef PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
feature_drv2 |= 0x20000000; // platformio.ini
#endif
#ifdef DEBUG_THEO
feature_drv2 |= 0x40000000; // xdrv_99_debug.ino
#endif
#ifdef USE_DEBUG_DRIVER
feature_drv2 |= 0x80000000; // xdrv_99_debug.ino
#endif
/*********************************************************************************************/
feature_sns1 = 0x00000000; // xsns_01_counter.ino, xsns_04_snfsc.ino
// feature_sns1 |= 0x00000001;
#ifndef USE_ADC_VCC
feature_sns1 |= 0x00000002; // support.ino (ADC)
#endif
#ifdef USE_ENERGY_SENSOR
feature_sns1 |= 0x00000004; // xdrv_03_energy.ino
#endif
#ifdef USE_PZEM004T
feature_sns1 |= 0x00000008; // xdrv_03_energy.ino
#endif
#ifdef USE_DS18B20
feature_sns1 |= 0x00000010; // xsns_05_ds18b20.ino
#endif
#ifdef USE_DS18x20_LEGACY
feature_sns1 |= 0x00000020; // xsns_05_ds18x20_legacy.ino
#endif
#ifdef USE_DS18x20
feature_sns1 |= 0x00000040; // xsns_05_ds18x20.ino
#endif
#ifdef USE_DHT
feature_sns1 |= 0x00000080; // xsns_06_dht.ino
#endif
#ifdef USE_SHT
feature_sns1 |= 0x00000100; // xsns_07_sht1x.ino
#endif
#ifdef USE_HTU
feature_sns1 |= 0x00000200; // xsns_08_htu21.ino
#endif
#ifdef USE_BMP
feature_sns1 |= 0x00000400; // xsns_09_bmp.ino
#endif
#ifdef USE_BME680
feature_sns1 |= 0x00000800; // xsns_09_bmp.ino - BME680
#endif
#ifdef USE_BH1750
feature_sns1 |= 0x00001000; // xsns_10_bh1750.ino
#endif
#ifdef USE_VEML6070
feature_sns1 |= 0x00002000; // xsns_11_veml6070.ino
#endif
#ifdef USE_ADS1115_I2CDEV
feature_sns1 |= 0x00004000; // xsns_12_ads1115_i2cdev.ino
#endif
#ifdef USE_ADS1115
feature_sns1 |= 0x00008000; // xsns_12_ads1115.ino
#endif
#ifdef USE_INA219
feature_sns1 |= 0x00010000; // xsns_13_ina219.ino
#endif
#ifdef USE_SHT3X
feature_sns1 |= 0x00020000; // xsns_14_sht3x.ino
#endif
#ifdef USE_MHZ19
feature_sns1 |= 0x00040000; // xsns_15_mhz19.ino
#endif
#ifdef USE_TSL2561
feature_sns1 |= 0x00080000; // xsns_16_tsl2561.ino
#endif
#ifdef USE_SENSEAIR
feature_sns1 |= 0x00100000; // xsns_17_senseair.ino
#endif
#ifdef USE_PMS5003
feature_sns1 |= 0x00200000; // xsns_18_pms5003.ino
#endif
#ifdef USE_MGS
feature_sns1 |= 0x00400000; // xsns_19_mgs.ino
#endif
#ifdef USE_NOVA_SDS
feature_sns1 |= 0x00800000; // xsns_20_novasds.ino
#endif
#ifdef USE_SGP30
feature_sns1 |= 0x01000000; // xsns_21_sgp30.ino
#endif
#ifdef USE_SR04
feature_sns1 |= 0x02000000; // xsns_22_sr04.ino
#endif
#ifdef USE_SDM120
feature_sns1 |= 0x04000000; // xsns_23_sdm120.ino
#endif
#ifdef USE_SI1145
feature_sns1 |= 0x08000000; // xsns_24_si1145.ino
#endif
#ifdef USE_SDM630
feature_sns1 |= 0x10000000; // xsns_25_sdm630.ino
#endif
/*********************************************************************************************/
feature_sns2 = 0x00000000;
}
/*********************************************************************************************\
* Wifi
\*********************************************************************************************/

View File

@ -25,9 +25,6 @@
* Based on source by AlexT (https://github.com/tzapu)
\*********************************************************************************************/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
const char HTTP_HEAD[] PROGMEM =
"<!DOCTYPE html><html lang=\"" D_HTML_LANGUAGE "\" class=\"\">"
"<head>"