Merge branch 'arendst/development' into development

This commit is contained in:
reloxx13 2018-07-15 22:37:50 +02:00
commit 74828ceee0
13 changed files with 1515 additions and 1454 deletions

View File

@ -15,7 +15,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
### Development
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)
Current version is **6.1.0a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
Current version is **6.1.1b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for release information and [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for change information.
### Disclaimer
:warning: **DANGER OF ELECTROCUTION** :warning:
@ -157,9 +157,9 @@ Different firmware images are released based on Features and Sensors selection g
| ESP/Arduino library version | sonoff | classic | minimal | knx | allsensors |
|-----------------------------|--------|---------|---------|------|------------|
| ESP/Arduino lib v2.3.0 | 538k | 490k | 399k | 548k | 562k |
| ESP/Arduino lib v2.4.0 | 543k | 498k | 406k | 553k | 565k |
| ESP/Arduino lib v2.4.1 | 544k | 500k | 408k | 555k | 567k |
| ESP/Arduino lib v2.3.0 | 538k | 490k | 407k | 548k | 562k |
| ESP/Arduino lib v2.4.0 | 543k | 498k | 414k | 553k | 565k |
| ESP/Arduino lib v2.4.1 | 544k | 500k | 416k | 555k | 567k |
See [Tasmota ESP/Arduino library version related issues](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips#20180523---relation-tasmota-and-esp8266arduino-core-version) for more information.

1388
sonoff/_changelog.ino Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -215,6 +215,7 @@
#define D_WCFG_3_WPSCONFIG "WPSConfig"
#define D_WCFG_4_RETRY "Retry"
#define D_WCFG_5_WAIT "Wait"
#define D_WCFG_6_SERIAL "Serial"
#define D_CMND_FRIENDLYNAME "FriendlyName"
#define D_CMND_SWITCHMODE "SwitchMode"
#define D_CMND_TELEPERIOD "TelePeriod"
@ -499,7 +500,8 @@ const char kWifiConfig[MAX_WIFI_OPTION][WCFG_MAX_STRING_LENGTH] PROGMEM = {
D_WCFG_2_WIFIMANAGER,
D_WCFG_3_WPSCONFIG,
D_WCFG_4_RETRY,
D_WCFG_5_WAIT };
D_WCFG_5_WAIT,
D_WCFG_6_SERIAL };
const char kPrefixes[3][PRFX_MAX_STRING_LENGTH] PROGMEM = {
D_CMND,
D_STAT,

View File

@ -111,11 +111,15 @@ typedef unsigned long power_t; // Power (Relay) type
#define SERIAL_POLLING 100 // Serial receive polling in ms
#define MAX_STATUS 11 // Max number of status lines
#define NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions)
/*
// 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
#define STR(x) STR_HELPER(x)
@ -169,7 +173,7 @@ enum GetDateAndTimeOptions { DT_LOCAL, DT_UTC, DT_RESTART, DT_UPTIME };
enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
enum WifiConfigOptions {WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT, MAX_WIFI_OPTION};
enum WifiConfigOptions {WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT, WIFI_SERIAL, MAX_WIFI_OPTION};
enum SwitchModeOptions {TOGGLE, FOLLOW, FOLLOW_INV, PUSHBUTTON, PUSHBUTTON_INV, PUSHBUTTONHOLD, PUSHBUTTONHOLD_INV, PUSHBUTTON_TOGGLE, MAX_SWITCH_OPTION};

View File

@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/
#define VERSION 0x06010001 // 6.1.0a
#define VERSION 0x06010102 // 6.1.1b
// Location specific includes
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
@ -75,12 +75,6 @@
// Structs
#include "settings.h"
#ifdef BE_MINIMAL
enum TasmotaCommands {
CMND_POWER, CMND_FANSPEED, CMND_STATUS, CMND_STATE, CMND_SLEEP, CMND_UPGRADE, CMND_UPLOAD, CMND_OTAURL, CMND_SERIALLOG, CMND_RESTART };
const char kTasmotaCommands[] PROGMEM =
D_CMND_POWER "|" D_CMND_FANSPEED "|" D_CMND_STATUS "|" D_CMND_STATE "|" D_CMND_SLEEP "|" D_CMND_UPGRADE "|" D_CMND_UPLOAD "|" D_CMND_OTAURL "|" D_CMND_SERIALLOG "|" D_CMND_RESTART;
#else
enum TasmotaCommands {
CMND_BACKLOG, CMND_DELAY, CMND_POWER, CMND_FANSPEED, CMND_STATUS, CMND_STATE, CMND_POWERONSTATE, CMND_PULSETIME,
CMND_BLINKTIME, CMND_BLINKCOUNT, CMND_SENSOR, CMND_SAVEDATA, CMND_SETOPTION, CMND_TEMPERATURE_RESOLUTION, CMND_HUMIDITY_RESOLUTION,
@ -101,7 +95,6 @@ const char kTasmotaCommands[] PROGMEM =
D_CMND_WIFICONFIG "|" D_CMND_FRIENDLYNAME "|" D_CMND_SWITCHMODE "|"
D_CMND_TELEPERIOD "|" D_CMND_RESTART "|" D_CMND_RESET "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|" D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|"
D_CMND_I2CSCAN "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALDELIMITER;
#endif
const uint8_t kIFan02Speed[4][3] = {{6,6,6}, {7,6,6}, {7,7,6}, {7,6,7}};
@ -489,7 +482,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
type = NULL; // Unknown command
}
}
#ifndef BE_MINIMAL
else if (CMND_BACKLOG == command_code) {
if (data_len) {
uint8_t bl_pointer = (!backlog_pointer) ? MAX_BACKLOG -1 : backlog_pointer;
@ -523,7 +515,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
if ((payload >= MIN_BACKLOG_DELAY) && (payload <= 3600)) backlog_delay = payload;
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, backlog_delay);
}
#endif // Not BE_MINIMAL
else if ((CMND_POWER == command_code) && (index > 0) && (index <= devices_present)) {
if ((payload < 0) || (payload > 4)) payload = 9;
// Settings.flag.device_index_enable = user_append_index;
@ -598,7 +589,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESTART);
}
}
#ifndef BE_MINIMAL
else if ((CMND_POWERONSTATE == command_code) && (Settings.module != MOTOR)) {
/* 0 = Keep relays off after power on
* 1 = Turn relays on after power on, if PulseTime set wait for PulseTime seconds, and turn relays off
@ -1002,7 +992,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
}
else if ((CMND_SSID == command_code) && (index > 0) && (index <= 2)) {
if ((data_len > 0) && (data_len < sizeof(Settings.sta_ssid[0]))) {
strlcpy(Settings.sta_ssid[index -1], (1 == payload) ? (1 == index) ? STA_SSID1 : STA_SSID2 : dataBuf, sizeof(Settings.sta_ssid[0]));
strlcpy(Settings.sta_ssid[index -1], (!strcmp(dataBuf,"0")) ? "" : (1 == payload) ? (1 == index) ? STA_SSID1 : STA_SSID2 : dataBuf, sizeof(Settings.sta_ssid[0]));
Settings.sta_active = index -1;
restart_flag = 2;
}
@ -1010,7 +1000,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
}
else if ((CMND_PASSWORD == command_code) && (index > 0) && (index <= 2)) {
if ((data_len > 0) && (data_len < sizeof(Settings.sta_pwd[0]))) {
strlcpy(Settings.sta_pwd[index -1], (1 == payload) ? (1 == index) ? STA_PASS1 : STA_PASS2 : dataBuf, sizeof(Settings.sta_pwd[0]));
strlcpy(Settings.sta_pwd[index -1], (!strcmp(dataBuf,"0")) ? "" : (1 == payload) ? (1 == index) ? STA_PASS1 : STA_PASS2 : dataBuf, sizeof(Settings.sta_pwd[0]));
Settings.sta_active = index -1;
restart_flag = 2;
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_pwd[index -1]);
@ -1159,7 +1149,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
I2cScan(mqtt_data, sizeof(mqtt_data));
}
#endif // USE_I2C
#endif // Not BE_MINIMAL
else type = NULL; // Unknown command
}
if (type == NULL) {

View File

@ -167,6 +167,8 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#undef USE_ENERGY_SENSOR // Disable energy sensors
#undef USE_ARDUINO_OTA // Disable support for Arduino OTA
#undef USE_WPS // Disable support for WPS as initial wifi configuration tool
#undef USE_SMARTCONFIG // Disable support for Wifi SmartConfig as initial wifi configuration tool
#undef USE_DOMOTICZ // Disable Domoticz
#undef USE_HOME_ASSISTANT // Disable Home Assistant
#undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set
@ -207,6 +209,10 @@ void KNX_CB_Action(message_t const &msg, void *arg);
* Mandatory defines satisfying possible disabled defines
\*********************************************************************************************/
#ifndef USE_WPS // 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)
#endif
#ifndef SWITCH_MODE
#define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state)
#endif

View File

@ -735,6 +735,12 @@ void GetFeatures()
#ifdef USE_KNX
feature_drv1 |= 0x10000000; // xdrv_11_knx.ino
#endif
#ifdef USE_WPS
feature_drv1 |= 0x20000000; // support.ino
#endif
#ifdef USE_SMARTCONFIG
feature_drv1 |= 0x40000000; // support.ino
#endif
/*********************************************************************************************/
@ -954,42 +960,49 @@ boolean WifiWpsConfigDone(void)
boolean WifiWpsConfigBegin(void)
{
wps_result = 99;
if (!wifi_wps_disable()) {
return false;
}
if (!wifi_wps_enable(WPS_TYPE_PBC)) {
return false; // so far only WPS_TYPE_PBC is supported (SDK 2.0.0)
}
if (!wifi_set_wps_cb((wps_st_cb_t) &WifiWpsStatusCallback)) {
return false;
}
if (!wifi_wps_start()) {
return false;
}
if (!wifi_wps_disable()) { return false; }
if (!wifi_wps_enable(WPS_TYPE_PBC)) { return false; } // so far only WPS_TYPE_PBC is supported (SDK 2.0.0)
if (!wifi_set_wps_cb((wps_st_cb_t) &WifiWpsStatusCallback)) { return false; }
if (!wifi_wps_start()) { return false; }
return true;
}
void WifiConfig(uint8_t type)
{
if (!wifi_config_type) {
if (type >= WIFI_RETRY) { // WIFI_RETRY and WIFI_WAIT
return;
}
if ((WIFI_RETRY == type) || (WIFI_WAIT == type)) { return; }
#if defined(USE_WEBSERVER) && defined(USE_EMULATION)
UdpDisconnect();
#endif // USE_EMULATION
WiFi.disconnect(); // Solve possible Wifi hangs
WiFi.disconnect(); // Solve possible Wifi hangs
wifi_config_type = type;
#ifndef USE_WPS
if (WIFI_WPSCONFIG == wifi_config_type) { wifi_config_type = WIFI_MANAGER; }
#endif // USE_WPS
#ifndef USE_WEBSERVER
if (WIFI_MANAGER == wifi_config_type) { wifi_config_type = WIFI_SMARTCONFIG; }
#endif // USE_WEBSERVER
#ifndef USE_SMARTCONFIG
if (WIFI_SMARTCONFIG == wifi_config_type) { wifi_config_type = WIFI_SERIAL; }
#endif // USE_SMARTCONFIG
wifi_config_counter = WIFI_CONFIG_SEC; // Allow up to WIFI_CONFIG_SECS seconds for phone to provide ssid/pswd
wifi_counter = wifi_config_counter +5;
blinks = 1999;
if (WIFI_RESTART == wifi_config_type) {
restart_flag = 2;
}
else if (WIFI_SERIAL == wifi_config_type) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_6_SERIAL " " D_ACTIVE_FOR_3_MINUTES));
}
#ifdef USE_SMARTCONFIG
else if (WIFI_SMARTCONFIG == wifi_config_type) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_1_SMARTCONFIG " " D_ACTIVE_FOR_3_MINUTES));
WiFi.beginSmartConfig();
}
#endif // USE_SMARTCONFIG
#ifdef USE_WPS
else if (WIFI_WPSCONFIG == wifi_config_type) {
if (WifiWpsConfigBegin()) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG " " D_ACTIVE_FOR_3_MINUTES));
@ -998,6 +1011,7 @@ void WifiConfig(uint8_t type)
wifi_config_counter = 3;
}
}
#endif // USE_WPS
#ifdef USE_WEBSERVER
else if (WIFI_MANAGER == wifi_config_type) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES));
@ -1023,17 +1037,11 @@ void WifiBegin(uint8_t flag)
WiFi.disconnect(true); // Delete SDK wifi config
delay(200);
WiFi.mode(WIFI_STA); // Disable AP mode
if (Settings.sleep) {
#ifndef ARDUINO_ESP8266_RELEASE_2_4_1 // See https://github.com/arendst/Sonoff-Tasmota/issues/2559
WiFi.setSleepMode(WIFI_LIGHT_SLEEP); // Allow light sleep during idle times
#ifndef ARDUINO_ESP8266_RELEASE_2_4_1 // See https://github.com/arendst/Sonoff-Tasmota/issues/2559 - Sleep bug
if (Settings.sleep) { WiFi.setSleepMode(WIFI_LIGHT_SLEEP); } // Allow light sleep during idle times
#endif
}
// if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) {
// WiFi.setPhyMode(WIFI_PHY_MODE_11N);
// }
if (!WiFi.getAutoConnect()) {
WiFi.setAutoConnect(true);
}
// if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) { WiFi.setPhyMode(WIFI_PHY_MODE_11N); }
if (!WiFi.getAutoConnect()) { WiFi.setAutoConnect(true); }
// WiFi.setAutoReconnect(true);
switch (flag) {
case 0: // AP1
@ -1043,9 +1051,7 @@ void WifiBegin(uint8_t flag)
case 2: // Toggle
Settings.sta_active ^= 1;
} // 3: Current AP
if (0 == strlen(Settings.sta_ssid[1])) {
Settings.sta_active = 0;
}
if ('\0' == Settings.sta_ssid[Settings.sta_active][0]) { Settings.sta_active ^= 1; } // Skip empty SSID
if (Settings.ip_address[0]) {
WiFi.config(Settings.ip_address[0], Settings.ip_address[1], Settings.ip_address[2], Settings.ip_address[3]); // Set static IP
}
@ -1072,6 +1078,7 @@ void WifiCheckIp()
wifi_status = WL_CONNECTED;
} else {
global_state.wifi_down = 1;
uint8_t wifi_config_tool = Settings.sta_config;
wifi_status = WiFi.status();
switch (wifi_status) {
case WL_CONNECTED:
@ -1105,7 +1112,12 @@ void WifiCheckIp()
if (!wifi_retry || ((wifi_retry_init / 2) == wifi_retry)) {
AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_TIMEOUT));
} else {
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, PSTR(D_ATTEMPTING_CONNECTION));
if (('\0' == Settings.sta_ssid[0][0]) && ('\0' == Settings.sta_ssid[1][0])) {
wifi_config_tool = WIFI_CONFIG_NO_SSID; // Skip empty SSIDs and start Wifi config tool
wifi_retry = 0;
} else {
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, PSTR(D_ATTEMPTING_CONNECTION));
}
}
}
if (wifi_retry) {
@ -1118,7 +1130,7 @@ void WifiCheckIp()
wifi_counter = 1;
wifi_retry--;
} else {
WifiConfig(Settings.sta_config);
WifiConfig(wifi_config_tool);
wifi_counter = 1;
wifi_retry = wifi_retry_init;
}
@ -1129,6 +1141,7 @@ void WifiCheck(uint8_t param)
{
wifi_counter--;
switch (param) {
case WIFI_SERIAL:
case WIFI_SMARTCONFIG:
case WIFI_MANAGER:
case WIFI_WPSCONFIG:
@ -1139,12 +1152,16 @@ void WifiCheck(uint8_t param)
wifi_config_counter--;
wifi_counter = wifi_config_counter +5;
if (wifi_config_counter) {
#ifdef USE_SMARTCONFIG
if ((WIFI_SMARTCONFIG == wifi_config_type) && WiFi.smartConfigDone()) {
wifi_config_counter = 0;
}
#endif // USE_SMARTCONFIG
#ifdef USE_WPS
if ((WIFI_WPSCONFIG == wifi_config_type) && WifiWpsConfigDone()) {
wifi_config_counter = 0;
}
#endif // USE_WPS
if (!wifi_config_counter) {
if (strlen(WiFi.SSID().c_str())) {
strlcpy(Settings.sta_ssid[0], WiFi.SSID().c_str(), sizeof(Settings.sta_ssid[0]));
@ -1158,10 +1175,10 @@ void WifiCheck(uint8_t param)
}
}
if (!wifi_config_counter) {
if (WIFI_SMARTCONFIG == wifi_config_type) {
WiFi.stopSmartConfig();
}
SettingsSdkErase();
#ifdef USE_SMARTCONFIG
if (WIFI_SMARTCONFIG == wifi_config_type) { WiFi.stopSmartConfig(); }
#endif // USE_SMARTCONFIG
// SettingsSdkErase(); // Disabled v6.1.0b due to possible bad wifi connects
restart_flag = 2;
}
} else {
@ -1197,9 +1214,7 @@ void WifiCheck(uint8_t param)
StopWebserver();
}
#ifdef USE_EMULATION
if (Settings.flag2.emulation) {
UdpConnect();
}
if (Settings.flag2.emulation) { UdpConnect(); }
#endif // USE_EMULATION
#endif // USE_WEBSERVER
#ifdef USE_KNX
@ -1229,9 +1244,7 @@ int WifiState()
if ((WL_CONNECTED == WiFi.status()) && (static_cast<uint32_t>(WiFi.localIP()) != 0)) {
state = WIFI_RESTART;
}
if (wifi_config_type) {
state = wifi_config_type;
}
if (wifi_config_type) { state = wifi_config_type; }
return state;
}
@ -1244,6 +1257,8 @@ void WifiConnect()
wifi_counter = 1;
}
/*
// Enable from 6.0.0a until 6.1.0a - disabled due to possible cause of bad wifi connect on core 2.3.0
void WifiDisconnect()
{
// Courtesy of EspEasy
@ -1256,10 +1271,17 @@ void WifiDisconnect()
void EspRestart()
{
delay(100); // Allow time for message xfer
// This results in exception 3 on restarts
delay(100); // Allow time for message xfer - disabled v6.1.0b
WifiDisconnect();
ESP.restart();
}
*/
void EspRestart()
{
ESP.restart();
}
#ifdef USE_DISCOVERY
/*********************************************************************************************\

View File

@ -63,8 +63,13 @@
#define STA_PASS1 "" // [Password1] Wifi password
#define STA_SSID2 "" // [Ssid2] Optional alternate AP Wifi SSID
#define STA_PASS2 "" // [Password2] Optional alternate AP Wifi password
#define WIFI_CONFIG_TOOL WIFI_WPSCONFIG // [WifiConfig] Default tool if wifi fails to connect
// (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT)
#define WIFI_CONFIG_TOOL WIFI_WAIT // [WifiConfig] Default tool if wifi fails to connect
// (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT, WIFI_SERIAL)
#define WIFI_CONFIG_NO_SSID WIFI_WPSCONFIG // Default tool if wifi fails to connect and no SSID is configured
// (WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_SERIAL)
// *** NOTE: When WPS is disabled by USE_WPS below, WIFI_WPSCONFIG will execute WIFI_MANAGER ***
// *** NOTE: When WIFI_MANAGER is disabled by USE_WEBSERVER below, WIFI_MANAGER will execute WIFI_SMARTCONFIG ***
// *** NOTE: When WIFI_SMARTCONFIG is disabled by USE_SMARTCONFIG below, WIFI_SMARTCONFIG will execute WIFI_SERIAL ***
// -- Syslog --------------------------------------
#define SYS_LOG_HOST "" // [LogHost] (Linux) syslog host
@ -178,8 +183,6 @@
* - Disable a feature by preceding it with //
\*********************************************************************************************/
//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code)
// -- Localization --------------------------------
// If non selected the default en-GB will be used
//#define MY_LANGUAGE bg-BG // Bulgarian in Bulgaria
@ -200,6 +203,13 @@
//#define MY_LANGUAGE zh-CN // Chinese (Simplified) in China
//#define MY_LANGUAGE zh-TW // Chinese (Traditional) in Taiwan
// -- Wifi Config tools ---------------------------
//#define USE_WPS // Add support for WPS as initial wifi configuration tool (+33k code, 1k mem (5k mem with core v2.4.2+))
//#define USE_SMARTCONFIG // Add support for Wifi SmartConfig as initial wifi configuration tool (+23k code, +0.6k mem)
// -- OTA -----------------------------------------
//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code)
/*-------------------------------------------------------------------------------------------*\
* Select ONE of possible three MQTT library types below
\*-------------------------------------------------------------------------------------------*/
@ -230,7 +240,7 @@
//#define USE_KNX // Enable KNX IP Protocol Support (+23k code, +3k3 mem)
// -- HTTP ----------------------------------------
#define USE_WEBSERVER // Enable web server and wifi manager (+66k code, +8k mem)
#define USE_WEBSERVER // Enable web server and Wifi Manager (+66k code, +8k mem)
#define WEB_PORT 80 // Web server Port for User and Admin mode
#define WEB_USERNAME "admin" // Web server Admin mode user name
#define USE_EMULATION // Enable Belkin WeMo and Hue Bridge emulation for Alexa (+16k code, +2k mem)
@ -312,9 +322,9 @@
#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
//#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)
#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)
#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB
#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code)
/*********************************************************************************************\
* Debug features are only supported in development branch

View File

@ -126,7 +126,6 @@ int mod(int a, int b)
return ret;
}
#define cmin(a,b) ((a)<(b)?(a):(b))
void Ws2812UpdatePixelColor(int position, struct WsColor hand_color, float offset)
{
@ -140,9 +139,9 @@ void Ws2812UpdatePixelColor(int position, struct WsColor hand_color, float offse
color = strip->GetPixelColor(mod_position);
float dimmer = 100 / (float)Settings.light_dimmer;
color.R = cmin(color.R + ((hand_color.red / dimmer) * offset), 255);
color.G = cmin(color.G + ((hand_color.green / dimmer) * offset), 255);
color.B = cmin(color.B + ((hand_color.blue / dimmer) * offset), 255);
color.R = tmin(color.R + ((hand_color.red / dimmer) * offset), 255);
color.G = tmin(color.G + ((hand_color.green / dimmer) * offset), 255);
color.B = tmin(color.B + ((hand_color.blue / dimmer) * offset), 255);
strip->SetPixelColor(mod_position, color);
}

View File

@ -25,8 +25,6 @@
* References:
* - https://www.dfrobot.com/wiki/index.php/Weather-proof_Ultrasonic_Sensor_SKU_:_SEN0207
\*********************************************************************************************/
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
uint8_t sr04_echo_pin = 0;
uint8_t sr04_trig_pin = 0;
@ -42,7 +40,7 @@ uint8_t sr04_trig_pin = 0;
#define PING_OVERHEAD 5
// Conversion from uS to distance (round result to nearest cm or inch).
#define EchoConvert(echoTime, conversionFactor) (max(((unsigned int)echoTime + conversionFactor / 2) / conversionFactor, (echoTime ? 1 : 0)))
#define EchoConvert(echoTime, conversionFactor) (tmax(((unsigned int)echoTime + conversionFactor / 2) / conversionFactor, (echoTime ? 1 : 0)))
/********************************************************************************************/
@ -74,7 +72,7 @@ uint16_t Sr04Ping(uint16_t max_cm_distance)
uint16_t duration = 0;
uint16_t maxEchoTime;
maxEchoTime = min(max_cm_distance + 1, (uint16_t) MAX_SENSOR_DISTANCE + 1) * US_ROUNDTRIP_CM;
maxEchoTime = tmin(max_cm_distance + 1, (uint16_t) MAX_SENSOR_DISTANCE + 1) * US_ROUNDTRIP_CM;
/* The following trigPin/echoPin cycle is used to determine the
distance of the nearest object by bouncing soundwaves off of it. */

View File

@ -155,7 +155,7 @@ void TmInit()
digitalWrite(tm1638_clock_pin, HIGH);
Tm16XXSendCommand(0x40);
Tm16XXSendCommand(0x80 | (tm1638_active_display ? 8 : 0) | min(7, tm1638_intensity));
Tm16XXSendCommand(0x80 | (tm1638_active_display ? 8 : 0) | tmin(7, tm1638_intensity));
digitalWrite(tm1638_strobe_pin, LOW);
Tm16XXSend(0xC0);

View File

@ -79,7 +79,8 @@ a_setoption = [
"KNX enhancement",
"RF receive decimal",
"IR receive decimal",
"Enforce HASS light group",""]
"Enforce HASS light group",
"Do not show Wifi and Mqtt state using Led"]
a_features = [[
"","","USE_I2C","USE_SPI",
@ -89,7 +90,7 @@ a_features = [[
"USE_WS2812_DMA","USE_IR_REMOTE","USE_IR_HVAC","USE_IR_RECEIVE",
"USE_DOMOTICZ","USE_DISPLAY","USE_HOME_ASSISTANT","USE_SERIAL_BRIDGE",
"USE_TIMERS","USE_SUNRISE","USE_TIMERS_WEB","USE_RULES",
"USE_KNX","","",""
"USE_KNX","USE_WPS","USE_SMARTCONFIG",""
],[
"USE_CONFIG_OVERRIDE","BE_MINIMAL","USE_ALL_SENSORS","USE_CLASSIC",
"USE_KNX_NO_EMULATION","","","",