mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Prep for easier preconfigurations
This commit is contained in:
parent
d8f750ebb9
commit
d1b1585d1c
@ -17,166 +17,6 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DOMOTICZ_UPDATE_TIMER
|
||||
#define DOMOTICZ_UPDATE_TIMER 0 // [DomoticzUpdateTimer] Send relay status (0 = disable, 1 - 3600 seconds) (Optional)
|
||||
#endif
|
||||
|
||||
#ifndef EMULATION
|
||||
#define EMULATION EMUL_NONE // [Emulation] Select Belkin WeMo (single relay/light) or Hue Bridge emulation (multi relay/light) (EMUL_NONE, EMUL_WEMO or EMUL_HUE)
|
||||
#endif
|
||||
|
||||
#ifndef MTX_ADDRESS1 // Add Display Support for up to eigth Matrices
|
||||
#define MTX_ADDRESS1 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS2
|
||||
#define MTX_ADDRESS2 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS3
|
||||
#define MTX_ADDRESS3 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS4
|
||||
#define MTX_ADDRESS4 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS5
|
||||
#define MTX_ADDRESS5 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS6
|
||||
#define MTX_ADDRESS6 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS7
|
||||
#define MTX_ADDRESS7 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS8
|
||||
#define MTX_ADDRESS8 0
|
||||
#endif
|
||||
|
||||
#ifndef HOME_ASSISTANT_DISCOVERY_ENABLE
|
||||
#define HOME_ASSISTANT_DISCOVERY_ENABLE 0
|
||||
#endif
|
||||
|
||||
#ifndef LATITUDE
|
||||
#define LATITUDE 48.858360 // [Latitude] Your location to be used with sunrise and sunset
|
||||
#endif
|
||||
#ifndef LONGITUDE
|
||||
#define LONGITUDE 2.294442 // [Longitude] Your location to be used with sunrise and sunset
|
||||
#endif
|
||||
|
||||
#ifndef WORKING_PERIOD
|
||||
#define WORKING_PERIOD 5 // Working period of the SDS Sensor, Takes a reading every X Minutes
|
||||
#endif
|
||||
|
||||
#ifndef COLOR_TEXT
|
||||
#define COLOR_TEXT "#000" // Global text color - Black
|
||||
#endif
|
||||
#ifndef COLOR_BACKGROUND
|
||||
#define COLOR_BACKGROUND "#fff" // Global background color - White
|
||||
#endif
|
||||
#ifndef COLOR_FORM
|
||||
#define COLOR_FORM "#f2f2f2" // Form background color - Greyish
|
||||
#endif
|
||||
#ifndef COLOR_INPUT_TEXT
|
||||
#define COLOR_INPUT_TEXT "#000" // Input text color - Black
|
||||
#endif
|
||||
#ifndef COLOR_INPUT
|
||||
#define COLOR_INPUT "#fff" // Input background color - White
|
||||
#endif
|
||||
#ifndef COLOR_CONSOLE_TEXT
|
||||
#define COLOR_CONSOLE_TEXT "#000" // Console text color - Black
|
||||
#endif
|
||||
#ifndef COLOR_CONSOLE
|
||||
#define COLOR_CONSOLE "#fff" // Console background color - White
|
||||
#endif
|
||||
#ifndef COLOR_TEXT_WARNING
|
||||
#define COLOR_TEXT_WARNING "#f00" // Warning text color - Red
|
||||
#endif
|
||||
#ifndef COLOR_TEXT_SUCCESS
|
||||
#define COLOR_TEXT_SUCCESS "#008000" // Success text color - Green
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_TEXT
|
||||
#define COLOR_BUTTON_TEXT "#fff" // Button text color - White
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON
|
||||
#define COLOR_BUTTON "#1fa3ec" // Button color - Blueish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_HOVER
|
||||
#define COLOR_BUTTON_HOVER "#0e70a4" // Button color when hovered over - Darker blueish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_RESET
|
||||
#define COLOR_BUTTON_RESET "#d43535" // Restart/Reset/Delete button color - Redish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_RESET_HOVER
|
||||
#define COLOR_BUTTON_RESET_HOVER "#931f1f" // Restart/Reset/Delete button color when hovered over - Darker redish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_SAVE
|
||||
#define COLOR_BUTTON_SAVE "#47c266" // Save button color - Greenish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_SAVE_HOVER
|
||||
#define COLOR_BUTTON_SAVE_HOVER "#5aaf6f" // Save button color when hovered over - Darker greenish
|
||||
#endif
|
||||
#ifndef COLOR_TIMER_TAB_TEXT
|
||||
#define COLOR_TIMER_TAB_TEXT "#fff" // Config timer tab text color - White
|
||||
#endif
|
||||
#ifndef COLOR_TIMER_TAB_BACKGROUND
|
||||
#define COLOR_TIMER_TAB_BACKGROUND "#999" // Config timer tab background color - Light grey
|
||||
#endif
|
||||
#ifndef COLOR_TITLE_TEXT
|
||||
#define COLOR_TITLE_TEXT COLOR_TEXT // Title text color defaults to global text color either dark or light
|
||||
#endif
|
||||
#ifndef IR_RCV_MIN_UNKNOWN_SIZE
|
||||
#define IR_RCV_MIN_UNKNOWN_SIZE 6 // Set the smallest sized "UNKNOWN" message packets we actually care about (default 6, max 255)
|
||||
#endif
|
||||
#ifndef ENERGY_OVERTEMP
|
||||
#define ENERGY_OVERTEMP 90 // Overtemp in Celsius
|
||||
#endif
|
||||
#ifndef DEFAULT_DIMMER_MAX
|
||||
#define DEFAULT_DIMMER_MAX 100
|
||||
#endif
|
||||
#ifndef DEFAULT_DIMMER_MIN
|
||||
#define DEFAULT_DIMMER_MIN 0
|
||||
#endif
|
||||
#ifndef DEFAULT_LIGHT_DIMMER
|
||||
#define DEFAULT_LIGHT_DIMMER 10
|
||||
#endif
|
||||
#ifndef DEFAULT_LIGHT_COMPONENT
|
||||
#define DEFAULT_LIGHT_COMPONENT 255
|
||||
#endif
|
||||
#ifndef CORS_ENABLED_ALL
|
||||
#define CORS_ENABLED_ALL "*"
|
||||
#endif
|
||||
|
||||
|
||||
enum WebColors {
|
||||
COL_TEXT, COL_BACKGROUND, COL_FORM,
|
||||
COL_INPUT_TEXT, COL_INPUT, COL_CONSOLE_TEXT, COL_CONSOLE,
|
||||
COL_TEXT_WARNING, COL_TEXT_SUCCESS,
|
||||
COL_BUTTON_TEXT, COL_BUTTON, COL_BUTTON_HOVER, COL_BUTTON_RESET, COL_BUTTON_RESET_HOVER, COL_BUTTON_SAVE, COL_BUTTON_SAVE_HOVER,
|
||||
COL_TIMER_TAB_TEXT, COL_TIMER_TAB_BACKGROUND, COL_TITLE,
|
||||
COL_LAST };
|
||||
|
||||
const char kWebColors[] PROGMEM =
|
||||
COLOR_TEXT "|" COLOR_BACKGROUND "|" COLOR_FORM "|"
|
||||
COLOR_INPUT_TEXT "|" COLOR_INPUT "|" COLOR_CONSOLE_TEXT "|" COLOR_CONSOLE "|"
|
||||
COLOR_TEXT_WARNING "|" COLOR_TEXT_SUCCESS "|"
|
||||
COLOR_BUTTON_TEXT "|" COLOR_BUTTON "|" COLOR_BUTTON_HOVER "|" COLOR_BUTTON_RESET "|" COLOR_BUTTON_RESET_HOVER "|" COLOR_BUTTON_SAVE "|" COLOR_BUTTON_SAVE_HOVER "|"
|
||||
COLOR_TIMER_TAB_TEXT "|" COLOR_TIMER_TAB_BACKGROUND "|" COLOR_TITLE_TEXT;
|
||||
|
||||
enum TasmotaSerialConfig {
|
||||
TS_SERIAL_5N1, TS_SERIAL_6N1, TS_SERIAL_7N1, TS_SERIAL_8N1,
|
||||
TS_SERIAL_5N2, TS_SERIAL_6N2, TS_SERIAL_7N2, TS_SERIAL_8N2,
|
||||
TS_SERIAL_5E1, TS_SERIAL_6E1, TS_SERIAL_7E1, TS_SERIAL_8E1,
|
||||
TS_SERIAL_5E2, TS_SERIAL_6E2, TS_SERIAL_7E2, TS_SERIAL_8E2,
|
||||
TS_SERIAL_5O1, TS_SERIAL_6O1, TS_SERIAL_7O1, TS_SERIAL_8O1,
|
||||
TS_SERIAL_5O2, TS_SERIAL_6O2, TS_SERIAL_7O2, TS_SERIAL_8O2 };
|
||||
|
||||
const uint8_t kTasmotaSerialConfig[] PROGMEM = {
|
||||
SERIAL_5N1, SERIAL_6N1, SERIAL_7N1, SERIAL_8N1,
|
||||
SERIAL_5N2, SERIAL_6N2, SERIAL_7N2, SERIAL_8N2,
|
||||
SERIAL_5E1, SERIAL_6E1, SERIAL_7E1, SERIAL_8E1,
|
||||
SERIAL_5E2, SERIAL_6E2, SERIAL_7E2, SERIAL_8E2,
|
||||
SERIAL_5O1, SERIAL_6O1, SERIAL_7O1, SERIAL_8O1,
|
||||
SERIAL_5O2, SERIAL_6O2, SERIAL_7O2, SERIAL_8O2
|
||||
};
|
||||
|
||||
/*********************************************************************************************\
|
||||
* RTC memory
|
||||
\*********************************************************************************************/
|
||||
|
@ -30,7 +30,6 @@
|
||||
* Default sensor states
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define CODE_IMAGE 0
|
||||
#define CODE_IMAGE_STR "tasmota"
|
||||
|
||||
#define USE_LIGHT // Enable light control
|
||||
@ -155,19 +154,6 @@ const uint32_t LOOP_SLEEP_DELAY = 50; // Lowest number of milliseconds to
|
||||
#define MAX_RULE_TIMERS 8 // Max number of rule timers (4 bytes / timer)
|
||||
#define MAX_RULE_VARS 16 // Max number of rule variables (33 bytes / variable)
|
||||
|
||||
/*
|
||||
// Removed from esp8266 core since 20171105
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
*/
|
||||
#define tmin(a,b) ((a)<(b)?(a):(b))
|
||||
#define tmax(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
#define STR_HELPER(x) #x
|
||||
#ifndef STR
|
||||
#define STR(x) STR_HELPER(x)
|
||||
#endif
|
||||
|
||||
//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
|
||||
@ -303,7 +289,8 @@ enum SettingsTextIndex { SET_OTAURL,
|
||||
SET_BUTTON1, SET_BUTTON2, SET_BUTTON3, SET_BUTTON4, SET_BUTTON5, SET_BUTTON6, SET_BUTTON7, SET_BUTTON8,
|
||||
SET_BUTTON9, SET_BUTTON10, SET_BUTTON11, SET_BUTTON12, SET_BUTTON13, SET_BUTTON14, SET_BUTTON15, SET_BUTTON16,
|
||||
SET_MQTT_GRP_TOPIC2, SET_MQTT_GRP_TOPIC3, SET_MQTT_GRP_TOPIC4,
|
||||
SET_TEMPLATE_NAME, SET_DEV_GROUP_NAME1, SET_DEV_GROUP_NAME2, SET_DEV_GROUP_NAME3, SET_DEV_GROUP_NAME4,
|
||||
SET_TEMPLATE_NAME,
|
||||
SET_DEV_GROUP_NAME1, SET_DEV_GROUP_NAME2, SET_DEV_GROUP_NAME3, SET_DEV_GROUP_NAME4,
|
||||
SET_MAX };
|
||||
|
||||
enum DevGroupMessageType { DGR_MSGTYP_FULL_STATUS, DGR_MSGTYP_PARTIAL_UPDATE, DGR_MSGTYP_UPDATE, DGR_MSGTYP_UPDATE_MORE_TO_COME, DGR_MSGTYP_UPDATE_DIRECT, DGR_MSGTYPE_UPDATE_COMMAND };
|
||||
@ -336,4 +323,21 @@ const char kCommandSource[] PROGMEM = "I|MQTT|Restart|Button|Switch|Backlog|Seri
|
||||
|
||||
const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 };
|
||||
|
||||
enum TasmotaSerialConfig {
|
||||
TS_SERIAL_5N1, TS_SERIAL_6N1, TS_SERIAL_7N1, TS_SERIAL_8N1,
|
||||
TS_SERIAL_5N2, TS_SERIAL_6N2, TS_SERIAL_7N2, TS_SERIAL_8N2,
|
||||
TS_SERIAL_5E1, TS_SERIAL_6E1, TS_SERIAL_7E1, TS_SERIAL_8E1,
|
||||
TS_SERIAL_5E2, TS_SERIAL_6E2, TS_SERIAL_7E2, TS_SERIAL_8E2,
|
||||
TS_SERIAL_5O1, TS_SERIAL_6O1, TS_SERIAL_7O1, TS_SERIAL_8O1,
|
||||
TS_SERIAL_5O2, TS_SERIAL_6O2, TS_SERIAL_7O2, TS_SERIAL_8O2 };
|
||||
|
||||
const uint8_t kTasmotaSerialConfig[] PROGMEM = {
|
||||
SERIAL_5N1, SERIAL_6N1, SERIAL_7N1, SERIAL_8N1,
|
||||
SERIAL_5N2, SERIAL_6N2, SERIAL_7N2, SERIAL_8N2,
|
||||
SERIAL_5E1, SERIAL_6E1, SERIAL_7E1, SERIAL_8E1,
|
||||
SERIAL_5E2, SERIAL_6E2, SERIAL_7E2, SERIAL_8E2,
|
||||
SERIAL_5O1, SERIAL_6O1, SERIAL_7O1, SERIAL_8O1,
|
||||
SERIAL_5O2, SERIAL_6O2, SERIAL_7O2, SERIAL_8O2
|
||||
};
|
||||
|
||||
#endif // _TASMOTA_H_
|
||||
|
@ -38,7 +38,7 @@
|
||||
#ifdef USE_MQTT_TLS
|
||||
#include <t_bearssl.h> // we need to include before "tasmota_post.h" to take precedence over the BearSSL version in Arduino
|
||||
#endif // USE_MQTT_TLS
|
||||
#include "tasmota_post.h" // Configuration overrides for all previous includes
|
||||
#include "tasmota_globals.h" // Function prototypes and global configuration
|
||||
#include "i18n.h" // Language support configured by my_user_config.h
|
||||
#include "tasmota_template.h" // Hardware configuration
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
tasmota_post.h - Post header file for Tasmota
|
||||
tasmota_configurations.h - Configurations for Tasmota
|
||||
|
||||
Copyright (C) 2020 Theo Arends
|
||||
|
||||
@ -17,73 +17,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TASMOTA_POST_H_
|
||||
#define _TASMOTA_POST_H_
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Function prototypes
|
||||
\*********************************************************************************************/
|
||||
|
||||
// Needed for core 2.3.0 compilation (#6721)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "user_interface.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
//#ifdef USE_KNX // Enabling this will fail compilation. It has no impact if not used. (20180417)
|
||||
#include <esp-knx-ip.h>
|
||||
void KNX_CB_Action(message_t const &msg, void *arg);
|
||||
//#endif // USE_KNX
|
||||
|
||||
void DomoticzTempHumPressureSensor(float temp, float hum, float baro = -1);
|
||||
char* ToHex_P(const unsigned char * in, size_t insz, char * out, size_t outsz, char inbetween = '\0');
|
||||
extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack, uint32_t stack_end);
|
||||
extern "C" void resetPins();
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Default global defines
|
||||
\*********************************************************************************************/
|
||||
|
||||
#ifndef ENERGY_OVERTEMP
|
||||
#define ENERGY_OVERTEMP 90 // Overtemp in Celsius
|
||||
#endif
|
||||
|
||||
#ifdef USE_EMULATION_HUE
|
||||
#define USE_EMULATION
|
||||
#endif
|
||||
#ifdef USE_EMULATION_WEMO
|
||||
#define USE_EMULATION
|
||||
#endif
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
#define USE_EMULATION
|
||||
#endif
|
||||
|
||||
#ifdef USE_MQTT_TLS
|
||||
const uint16_t WEB_LOG_SIZE = 2000; // Max number of characters in weblog
|
||||
#else
|
||||
const uint16_t WEB_LOG_SIZE = 4000; // Max number of characters in weblog
|
||||
#endif
|
||||
|
||||
#if defined(USE_MQTT_TLS) && defined(ARDUINO_ESP8266_RELEASE_2_3_0)
|
||||
#error "TLS is no more supported on Core 2.3.0, use 2.4.2 or higher."
|
||||
#endif
|
||||
|
||||
#ifndef MODULE
|
||||
#define MODULE SONOFF_BASIC // [Module] Select default model
|
||||
#endif
|
||||
|
||||
#ifdef USE_PWM_DIMMER_REMOTE
|
||||
#ifdef USE_PWM_DIMMER
|
||||
#ifndef USE_DEVICE_GROUPS
|
||||
#define USE_DEVICE_GROUPS
|
||||
#endif // USE_DEVICE_GROUPS
|
||||
#else // USE_PWM_DIMMER
|
||||
#undef USE_PWM_DIMMER_REMOTE
|
||||
#endif // USE_PWM_DIMMER
|
||||
#endif // USE_PWM_DIMMER_REMOTE
|
||||
#ifndef _TASMOTA_CONFIGURATIONS_H_
|
||||
#define _TASMOTA_CONFIGURATIONS_H_
|
||||
|
||||
/*********************************************************************************************\
|
||||
* [tasmota-sensors.bin]
|
||||
@ -92,8 +27,6 @@ extern "C" void resetPins();
|
||||
|
||||
#ifdef FIRMWARE_SENSORS
|
||||
|
||||
#undef CODE_IMAGE
|
||||
#define CODE_IMAGE 2
|
||||
#undef CODE_IMAGE_STR
|
||||
#define CODE_IMAGE_STR "sensors"
|
||||
|
||||
@ -257,8 +190,6 @@ extern "C" void resetPins();
|
||||
|
||||
#ifdef FIRMWARE_KNX_NO_EMULATION
|
||||
|
||||
#undef CODE_IMAGE
|
||||
#define CODE_IMAGE 3
|
||||
#undef CODE_IMAGE_STR
|
||||
#define CODE_IMAGE_STR "knx"
|
||||
|
||||
@ -282,8 +213,6 @@ extern "C" void resetPins();
|
||||
|
||||
#ifdef FIRMWARE_DISPLAYS
|
||||
|
||||
#undef CODE_IMAGE
|
||||
#define CODE_IMAGE 5
|
||||
#undef CODE_IMAGE_STR
|
||||
#define CODE_IMAGE_STR "display"
|
||||
|
||||
@ -355,8 +284,6 @@ extern "C" void resetPins();
|
||||
|
||||
#ifdef FIRMWARE_IR
|
||||
|
||||
#undef CODE_IMAGE
|
||||
#define CODE_IMAGE 6
|
||||
#undef CODE_IMAGE_STR
|
||||
#define CODE_IMAGE_STR "ir"
|
||||
|
||||
@ -462,8 +389,6 @@ extern "C" void resetPins();
|
||||
|
||||
#ifdef FIRMWARE_LITE
|
||||
|
||||
#undef CODE_IMAGE
|
||||
#define CODE_IMAGE 4
|
||||
#undef CODE_IMAGE_STR
|
||||
#define CODE_IMAGE_STR "lite"
|
||||
|
||||
@ -579,8 +504,6 @@ extern "C" void resetPins();
|
||||
|
||||
#ifdef FIRMWARE_MINIMAL
|
||||
|
||||
#undef CODE_IMAGE
|
||||
#define CODE_IMAGE 1
|
||||
#undef CODE_IMAGE_STR
|
||||
#define CODE_IMAGE_STR "minimal"
|
||||
|
||||
@ -692,95 +615,4 @@ extern "C" void resetPins();
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
#endif // FIRMWARE_MINIMAL
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Mandatory defines satisfying possible disabled defines
|
||||
\*********************************************************************************************/
|
||||
|
||||
// See https://github.com/esp8266/Arduino/pull/4889
|
||||
#undef NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions)
|
||||
|
||||
#ifndef USE_SONOFF_RF
|
||||
#undef USE_RF_FLASH // Disable RF firmware flash when SOnoff Rf is disabled
|
||||
#endif
|
||||
|
||||
#ifndef SWITCH_MODE
|
||||
#define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state)
|
||||
#endif
|
||||
|
||||
#ifndef STARTING_OFFSET // NOVA SDS parameter used in settings
|
||||
#define STARTING_OFFSET 30
|
||||
#endif
|
||||
|
||||
#ifndef MQTT_FINGERPRINT1
|
||||
// Set an all-zeros default fingerprint to activate auto-learning on first connection (AWS IoT)
|
||||
#define MQTT_FINGERPRINT1 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
|
||||
#endif
|
||||
|
||||
#ifndef MQTT_FINGERPRINT2
|
||||
#define MQTT_FINGERPRINT2 "A5 02 FF 13 99 9F 8B 39 8E F1 83 4F 11 23 65 0B 32 36 FC 07"
|
||||
#endif
|
||||
|
||||
#ifndef WS2812_LEDS
|
||||
#define WS2812_LEDS 30 // [Pixels] Number of LEDs
|
||||
#endif
|
||||
|
||||
#ifndef MQTT_MAX_PACKET_SIZE
|
||||
#define MQTT_MAX_PACKET_SIZE 1200 // Bytes
|
||||
#endif
|
||||
#ifndef MQTT_KEEPALIVE
|
||||
#define MQTT_KEEPALIVE 30 // Seconds
|
||||
#endif
|
||||
#ifndef MQTT_TIMEOUT
|
||||
#define MQTT_TIMEOUT 10000 // milli seconds
|
||||
#endif
|
||||
#ifndef MQTT_CLEAN_SESSION
|
||||
#define MQTT_CLEAN_SESSION 1 // 0 = No clean session, 1 = Clean session (default)
|
||||
#endif
|
||||
|
||||
#ifndef MESSZ
|
||||
//#define MESSZ 1040 // Max number of characters in JSON message string (Hass discovery and nice MQTT_MAX_PACKET_SIZE = 1200)
|
||||
#define MESSZ (MQTT_MAX_PACKET_SIZE -TOPSZ -7) // Max number of characters in JSON message string
|
||||
#endif
|
||||
|
||||
//#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
|
||||
#ifndef ARDUINO_ESP8266_RELEASE
|
||||
#define ARDUINO_ESP8266_RELEASE "STAGE"
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ESP8266_RELEASE_2_3_0 // Disable not supported features in core 2.3.0
|
||||
#undef USE_MQTT_TLS_CA_CERT
|
||||
#endif
|
||||
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
#define SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, ...) _SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, __VA_ARGS__, 0)
|
||||
#define SendLocalDeviceGroupMessage(REQUEST_TYPE, ...) _SendDeviceGroupMessage(0, REQUEST_TYPE, __VA_ARGS__, 0)
|
||||
#define DEVICE_GROUP_MESSAGE "M-TASMOTA_DGR/"
|
||||
const char kDeviceGroupMessage[] PROGMEM = DEVICE_GROUP_MESSAGE;
|
||||
uint8_t device_group_count = 1;
|
||||
#endif // USE_DEVICE_GROUPS
|
||||
|
||||
#ifdef DEBUG_TASMOTA_CORE
|
||||
#define DEBUG_CORE_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_CORE_LOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TASMOTA_DRIVER
|
||||
#define DEBUG_DRIVER_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_DRIVER_LOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TASMOTA_SENSOR
|
||||
#define DEBUG_SENSOR_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_SENSOR_LOG(...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TASMOTA_TRACE
|
||||
#define DEBUG_TRACE_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_TRACE_LOG(...)
|
||||
#endif
|
||||
|
||||
#endif // _TASMOTA_POST_H_
|
||||
#endif // _TASMOTA_CONFIGURATIONS_H_
|
335
tasmota/tasmota_globals.h
Normal file
335
tasmota/tasmota_globals.h
Normal file
@ -0,0 +1,335 @@
|
||||
/*
|
||||
tasmota_globals.h - Function prototypes and global configurations for Tasmota
|
||||
|
||||
Copyright (C) 2020 Theo Arends
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TASMOTA_GLOBALS_H_
|
||||
#define _TASMOTA_GLOBALS_H_
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Function prototypes
|
||||
\*********************************************************************************************/
|
||||
|
||||
// Needed for core 2.3.0 compilation (#6721)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "user_interface.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
//#ifdef USE_KNX // Enabling this will fail compilation. It has no impact if not used. (20180417)
|
||||
#include <esp-knx-ip.h>
|
||||
void KNX_CB_Action(message_t const &msg, void *arg);
|
||||
//#endif // USE_KNX
|
||||
|
||||
void DomoticzTempHumPressureSensor(float temp, float hum, float baro = -1);
|
||||
char* ToHex_P(const unsigned char * in, size_t insz, char * out, size_t outsz, char inbetween = '\0');
|
||||
extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack, uint32_t stack_end);
|
||||
extern "C" void resetPins();
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Preconfigured configurations
|
||||
\*********************************************************************************************/
|
||||
|
||||
#include "tasmota_configurations.h" // Preconfigured configurations
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Mandatory defines satisfying disabled defines
|
||||
\*********************************************************************************************/
|
||||
|
||||
#ifndef MODULE
|
||||
#define MODULE SONOFF_BASIC // [Module] Select default model
|
||||
#endif
|
||||
|
||||
#ifdef USE_EMULATION_HUE
|
||||
#define USE_EMULATION
|
||||
#endif
|
||||
#ifdef USE_EMULATION_WEMO
|
||||
#define USE_EMULATION
|
||||
#endif
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
#define USE_EMULATION
|
||||
#endif
|
||||
// See https://github.com/esp8266/Arduino/pull/4889
|
||||
#undef NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions)
|
||||
|
||||
#ifndef USE_SONOFF_RF
|
||||
#undef USE_RF_FLASH // Disable RF firmware flash when Sonoff Rf is disabled
|
||||
#endif
|
||||
|
||||
#ifndef SWITCH_MODE
|
||||
#define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state)
|
||||
#endif
|
||||
|
||||
#ifndef MQTT_FINGERPRINT1
|
||||
// Set an all-zeros default fingerprint to activate auto-learning on first connection (AWS IoT)
|
||||
#define MQTT_FINGERPRINT1 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
|
||||
#endif
|
||||
#ifndef MQTT_FINGERPRINT2
|
||||
#define MQTT_FINGERPRINT2 "A5 02 FF 13 99 9F 8B 39 8E F1 83 4F 11 23 65 0B 32 36 FC 07"
|
||||
#endif
|
||||
|
||||
#ifndef WS2812_LEDS
|
||||
#define WS2812_LEDS 30 // [Pixels] Number of LEDs
|
||||
#endif
|
||||
|
||||
#ifdef USE_MQTT_TLS
|
||||
const uint16_t WEB_LOG_SIZE = 2000; // Max number of characters in weblog
|
||||
#else
|
||||
const uint16_t WEB_LOG_SIZE = 4000; // Max number of characters in weblog
|
||||
#endif
|
||||
|
||||
#if defined(USE_MQTT_TLS) && defined(ARDUINO_ESP8266_RELEASE_2_3_0)
|
||||
#error "TLS is no more supported on Core 2.3.0, use 2.4.2 or higher."
|
||||
#endif
|
||||
|
||||
#ifndef MQTT_MAX_PACKET_SIZE
|
||||
#define MQTT_MAX_PACKET_SIZE 1200 // Bytes
|
||||
#endif
|
||||
#ifndef MQTT_KEEPALIVE
|
||||
#define MQTT_KEEPALIVE 30 // Seconds
|
||||
#endif
|
||||
#ifndef MQTT_TIMEOUT
|
||||
#define MQTT_TIMEOUT 10000 // milli seconds
|
||||
#endif
|
||||
#ifndef MQTT_CLEAN_SESSION
|
||||
#define MQTT_CLEAN_SESSION 1 // 0 = No clean session, 1 = Clean session (default)
|
||||
#endif
|
||||
|
||||
#ifndef MESSZ
|
||||
//#define MESSZ 1040 // Max number of characters in JSON message string (Hass discovery and nice MQTT_MAX_PACKET_SIZE = 1200)
|
||||
#define MESSZ (MQTT_MAX_PACKET_SIZE -TOPSZ -7) // Max number of characters in JSON message string
|
||||
#endif
|
||||
|
||||
#ifndef ARDUINO_ESP8266_RELEASE
|
||||
#define ARDUINO_ESP8266_RELEASE "STAGE"
|
||||
#endif
|
||||
|
||||
#ifdef USE_PWM_DIMMER_REMOTE
|
||||
#ifdef USE_PWM_DIMMER
|
||||
#ifndef USE_DEVICE_GROUPS
|
||||
#define USE_DEVICE_GROUPS
|
||||
#endif // USE_DEVICE_GROUPS
|
||||
#else // USE_PWM_DIMMER
|
||||
#undef USE_PWM_DIMMER_REMOTE
|
||||
#endif // USE_PWM_DIMMER
|
||||
#endif // USE_PWM_DIMMER_REMOTE
|
||||
|
||||
#ifndef DOMOTICZ_UPDATE_TIMER
|
||||
#define DOMOTICZ_UPDATE_TIMER 0 // [DomoticzUpdateTimer] Send relay status (0 = disable, 1 - 3600 seconds) (Optional)
|
||||
#endif
|
||||
|
||||
#ifndef EMULATION
|
||||
#define EMULATION EMUL_NONE // [Emulation] Select Belkin WeMo (single relay/light) or Hue Bridge emulation (multi relay/light) (EMUL_NONE, EMUL_WEMO or EMUL_HUE)
|
||||
#endif
|
||||
|
||||
#ifndef MTX_ADDRESS1 // Add Display Support for up to eigth Matrices
|
||||
#define MTX_ADDRESS1 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS2
|
||||
#define MTX_ADDRESS2 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS3
|
||||
#define MTX_ADDRESS3 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS4
|
||||
#define MTX_ADDRESS4 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS5
|
||||
#define MTX_ADDRESS5 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS6
|
||||
#define MTX_ADDRESS6 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS7
|
||||
#define MTX_ADDRESS7 0
|
||||
#endif
|
||||
#ifndef MTX_ADDRESS8
|
||||
#define MTX_ADDRESS8 0
|
||||
#endif
|
||||
|
||||
#ifndef HOME_ASSISTANT_DISCOVERY_ENABLE
|
||||
#define HOME_ASSISTANT_DISCOVERY_ENABLE 0
|
||||
#endif
|
||||
|
||||
#ifndef LATITUDE
|
||||
#define LATITUDE 48.858360 // [Latitude] Your location to be used with sunrise and sunset
|
||||
#endif
|
||||
#ifndef LONGITUDE
|
||||
#define LONGITUDE 2.294442 // [Longitude] Your location to be used with sunrise and sunset
|
||||
#endif
|
||||
|
||||
#ifndef IR_RCV_MIN_UNKNOWN_SIZE
|
||||
#define IR_RCV_MIN_UNKNOWN_SIZE 6 // Set the smallest sized "UNKNOWN" message packets we actually care about (default 6, max 255)
|
||||
#endif
|
||||
|
||||
#ifndef ENERGY_OVERTEMP
|
||||
#define ENERGY_OVERTEMP 90 // Overtemp in Celsius
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_DIMMER_MAX
|
||||
#define DEFAULT_DIMMER_MAX 100
|
||||
#endif
|
||||
#ifndef DEFAULT_DIMMER_MIN
|
||||
#define DEFAULT_DIMMER_MIN 0
|
||||
#endif
|
||||
#ifndef DEFAULT_LIGHT_DIMMER
|
||||
#define DEFAULT_LIGHT_DIMMER 10
|
||||
#endif
|
||||
#ifndef DEFAULT_LIGHT_COMPONENT
|
||||
#define DEFAULT_LIGHT_COMPONENT 255
|
||||
#endif
|
||||
|
||||
#ifndef CORS_ENABLED_ALL
|
||||
#define CORS_ENABLED_ALL "*"
|
||||
#endif
|
||||
|
||||
#ifndef WORKING_PERIOD
|
||||
#define WORKING_PERIOD 5 // Working period of the SDS Sensor, Takes a reading every X Minutes
|
||||
#endif
|
||||
#ifndef STARTING_OFFSET
|
||||
#define STARTING_OFFSET 30 // NOVA SDS parameter used in settings
|
||||
#endif
|
||||
|
||||
/*********************************************************************************************\
|
||||
* UserConfig related parameters
|
||||
\*********************************************************************************************/
|
||||
|
||||
#ifndef COLOR_TEXT
|
||||
#define COLOR_TEXT "#000" // Global text color - Black
|
||||
#endif
|
||||
#ifndef COLOR_BACKGROUND
|
||||
#define COLOR_BACKGROUND "#fff" // Global background color - White
|
||||
#endif
|
||||
#ifndef COLOR_FORM
|
||||
#define COLOR_FORM "#f2f2f2" // Form background color - Greyish
|
||||
#endif
|
||||
#ifndef COLOR_INPUT_TEXT
|
||||
#define COLOR_INPUT_TEXT "#000" // Input text color - Black
|
||||
#endif
|
||||
#ifndef COLOR_INPUT
|
||||
#define COLOR_INPUT "#fff" // Input background color - White
|
||||
#endif
|
||||
#ifndef COLOR_CONSOLE_TEXT
|
||||
#define COLOR_CONSOLE_TEXT "#000" // Console text color - Black
|
||||
#endif
|
||||
#ifndef COLOR_CONSOLE
|
||||
#define COLOR_CONSOLE "#fff" // Console background color - White
|
||||
#endif
|
||||
#ifndef COLOR_TEXT_WARNING
|
||||
#define COLOR_TEXT_WARNING "#f00" // Warning text color - Red
|
||||
#endif
|
||||
#ifndef COLOR_TEXT_SUCCESS
|
||||
#define COLOR_TEXT_SUCCESS "#008000" // Success text color - Green
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_TEXT
|
||||
#define COLOR_BUTTON_TEXT "#fff" // Button text color - White
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON
|
||||
#define COLOR_BUTTON "#1fa3ec" // Button color - Blueish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_HOVER
|
||||
#define COLOR_BUTTON_HOVER "#0e70a4" // Button color when hovered over - Darker blueish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_RESET
|
||||
#define COLOR_BUTTON_RESET "#d43535" // Restart/Reset/Delete button color - Redish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_RESET_HOVER
|
||||
#define COLOR_BUTTON_RESET_HOVER "#931f1f" // Restart/Reset/Delete button color when hovered over - Darker redish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_SAVE
|
||||
#define COLOR_BUTTON_SAVE "#47c266" // Save button color - Greenish
|
||||
#endif
|
||||
#ifndef COLOR_BUTTON_SAVE_HOVER
|
||||
#define COLOR_BUTTON_SAVE_HOVER "#5aaf6f" // Save button color when hovered over - Darker greenish
|
||||
#endif
|
||||
#ifndef COLOR_TIMER_TAB_TEXT
|
||||
#define COLOR_TIMER_TAB_TEXT "#fff" // Config timer tab text color - White
|
||||
#endif
|
||||
#ifndef COLOR_TIMER_TAB_BACKGROUND
|
||||
#define COLOR_TIMER_TAB_BACKGROUND "#999" // Config timer tab background color - Light grey
|
||||
#endif
|
||||
#ifndef COLOR_TITLE_TEXT
|
||||
#define COLOR_TITLE_TEXT COLOR_TEXT // Title text color defaults to global text color either dark or light
|
||||
#endif
|
||||
|
||||
enum WebColors {
|
||||
COL_TEXT, COL_BACKGROUND, COL_FORM,
|
||||
COL_INPUT_TEXT, COL_INPUT, COL_CONSOLE_TEXT, COL_CONSOLE,
|
||||
COL_TEXT_WARNING, COL_TEXT_SUCCESS,
|
||||
COL_BUTTON_TEXT, COL_BUTTON, COL_BUTTON_HOVER, COL_BUTTON_RESET, COL_BUTTON_RESET_HOVER, COL_BUTTON_SAVE, COL_BUTTON_SAVE_HOVER,
|
||||
COL_TIMER_TAB_TEXT, COL_TIMER_TAB_BACKGROUND, COL_TITLE,
|
||||
COL_LAST };
|
||||
|
||||
const char kWebColors[] PROGMEM =
|
||||
COLOR_TEXT "|" COLOR_BACKGROUND "|" COLOR_FORM "|"
|
||||
COLOR_INPUT_TEXT "|" COLOR_INPUT "|" COLOR_CONSOLE_TEXT "|" COLOR_CONSOLE "|"
|
||||
COLOR_TEXT_WARNING "|" COLOR_TEXT_SUCCESS "|"
|
||||
COLOR_BUTTON_TEXT "|" COLOR_BUTTON "|" COLOR_BUTTON_HOVER "|" COLOR_BUTTON_RESET "|" COLOR_BUTTON_RESET_HOVER "|" COLOR_BUTTON_SAVE "|" COLOR_BUTTON_SAVE_HOVER "|"
|
||||
COLOR_TIMER_TAB_TEXT "|" COLOR_TIMER_TAB_BACKGROUND "|" COLOR_TITLE_TEXT;
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Macros
|
||||
\*********************************************************************************************/
|
||||
|
||||
/*
|
||||
// Removed from esp8266 core since 20171105
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
*/
|
||||
#define tmin(a,b) ((a)<(b)?(a):(b))
|
||||
#define tmax(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
#define STR_HELPER(x) #x
|
||||
#ifndef STR
|
||||
#define STR(x) STR_HELPER(x)
|
||||
#endif
|
||||
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
#define SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, ...) _SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, __VA_ARGS__, 0)
|
||||
#define SendLocalDeviceGroupMessage(REQUEST_TYPE, ...) _SendDeviceGroupMessage(0, REQUEST_TYPE, __VA_ARGS__, 0)
|
||||
#define DEVICE_GROUP_MESSAGE "M-TASMOTA_DGR/"
|
||||
const char kDeviceGroupMessage[] PROGMEM = DEVICE_GROUP_MESSAGE;
|
||||
uint8_t device_group_count = 1;
|
||||
#endif // USE_DEVICE_GROUPS
|
||||
|
||||
#ifdef DEBUG_TASMOTA_CORE
|
||||
#define DEBUG_CORE_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_CORE_LOG(...)
|
||||
#endif
|
||||
#ifdef DEBUG_TASMOTA_DRIVER
|
||||
#define DEBUG_DRIVER_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_DRIVER_LOG(...)
|
||||
#endif
|
||||
#ifdef DEBUG_TASMOTA_SENSOR
|
||||
#define DEBUG_SENSOR_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_SENSOR_LOG(...)
|
||||
#endif
|
||||
#ifdef DEBUG_TASMOTA_TRACE
|
||||
#define DEBUG_TRACE_LOG(...) AddLog_Debug(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_TRACE_LOG(...)
|
||||
#endif
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
#endif // _TASMOTA_GLOBALS_H_
|
Loading…
x
Reference in New Issue
Block a user