mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-22 13:57:16 +00:00

5.11.0 20180107 * Minor webpage HTML optimizations (#1358) * Updated German translation (#1438) * Change Sonoff Pow Energy MQTT data message and consolidate Status 8 into Status 10 * Change ADS1115 default voltage range from +/-2V to +/-6V (#1289) * Change text to Active for 3 minutes (#1364) * Change Wemo SetBinaryState to distinguish from GetBinaryState (#1357) * Change output of HTTP command to valid JSON and Array only (#1363) * Removed all MQTT, JSON and Command language defines from locale files and set fixed to English (#1473) * Renamed commands Color2,3,4 to Color3,4,5 * Fix BME280 calculation (#1051) * Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End of Transmission) flag (#1095, #1294) * Fix PWM initialization in Dimmer/Color mode (#1321) * Fix Wemo Emulation (#1357) * Fix display of build date and time in non-english locale (#1465) * Fix Wemo and Hue emulation by adding M-Search response delay (#1486) * Add libraries Adafruit_BME680-1.0.5, Adafruit_Sensor-1.0.2.02, TasmotaSerial-1.0.0 and TSL2561-Arduino-Library * Add command Color2 to set color while keeping same dimmer value * Add device function pointers * Add support for SenseAir S8 CO2 sensor * Add color led signal to Carbon Dioxide (CO2) sensors using defines CO2_LOW and CO2_HIGH in user_config.h * Add support for Domoticz Air Quality sensor to be used by MH-Z19(B) and SenseAir sensors * Add support for PZEM004T energy sensor * Add support for iTead SI7021 temperature and humidity sensor by consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (#735) * Add support for BME680 using adafruit libraries (#1212) * Add support for MH-Z19(B) CO2 sensor (#561, #1248) * Add multipress support and more user configurable GPIO to Sonoff Dual R2 (#1291) * Add support for TSL2561 using adafruit library (#661, #1311) * Add support for SHT3x (#1314) * Add support for Arilux LC06 (#1414) * Add Italian language file (#1449) * Add 2nd Gen Alexa support to Wemo emulation discovery (#1357, #1450) * Add define for additional number of WS2812 schemes (#1463)
120 lines
2.8 KiB
C++
120 lines
2.8 KiB
C++
/*
|
|
xdrv_interface.ino - Driver interface support for Sonoff-Tasmota
|
|
|
|
Copyright (C) 2018 Theo Arends inspired by ESPEasy
|
|
|
|
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/>.
|
|
*/
|
|
|
|
void XDrvInit()
|
|
{
|
|
for (byte i = 0; i < XDRV_MAX; i++) {
|
|
xdrv_func_ptr[i] = NULL;
|
|
}
|
|
xdrv_present = 0;
|
|
|
|
#ifdef XDRV_01
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv01;
|
|
#endif
|
|
|
|
#ifdef XDRV_02
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv02;
|
|
#endif
|
|
|
|
#ifdef XDRV_03
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv03;
|
|
#endif
|
|
|
|
#ifdef XDRV_04
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv04;
|
|
#endif
|
|
|
|
#ifdef XDRV_05
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv05;
|
|
#endif
|
|
|
|
#ifdef XDRV_06
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv06;
|
|
#endif
|
|
|
|
#ifdef XDRV_07
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv07;
|
|
#endif
|
|
|
|
#ifdef XDRV_08
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv08;
|
|
#endif
|
|
|
|
#ifdef XDRV_09
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv09;
|
|
#endif
|
|
|
|
#ifdef XDRV_10
|
|
xdrv_func_ptr[xdrv_present++] = &Xdrv10;
|
|
#endif
|
|
|
|
// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "Drivers %d"), xdrv_present);
|
|
// AddLog(LOG_LEVEL_DEBUG);
|
|
|
|
XdrvCall(FUNC_INIT);
|
|
}
|
|
|
|
boolean XdrvCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_len, int16_t payload)
|
|
{
|
|
// XdrvMailbox.valid = 1;
|
|
XdrvMailbox.index = index;
|
|
XdrvMailbox.data_len = data_len;
|
|
XdrvMailbox.payload = payload;
|
|
XdrvMailbox.topic = type;
|
|
XdrvMailbox.data = dataBuf;
|
|
|
|
return XdrvCall(FUNC_COMMAND);
|
|
}
|
|
|
|
void XdrvSetPower(uint8_t mpower)
|
|
{
|
|
// XdrvMailbox.valid = 1;
|
|
XdrvMailbox.index = mpower;
|
|
|
|
XdrvCall(FUNC_SET_POWER);
|
|
}
|
|
|
|
boolean XdrvMqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uint16_t sdataBuf)
|
|
{
|
|
XdrvMailbox.index = stopicBuf;
|
|
XdrvMailbox.data_len = sdataBuf;
|
|
XdrvMailbox.topic = topicBuf;
|
|
XdrvMailbox.data = dataBuf;
|
|
|
|
return XdrvCall(FUNC_MQTT_DATA);
|
|
}
|
|
|
|
/*********************************************************************************************\
|
|
* Function call to all xdrv
|
|
\*********************************************************************************************/
|
|
|
|
boolean XdrvCall(byte Function)
|
|
{
|
|
boolean result = false;
|
|
|
|
for (byte x = 0; x < xdrv_present; x++) {
|
|
result = xdrv_func_ptr[x](Function);
|
|
if (result) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|