mirror of https://github.com/arendst/Tasmota.git
parent
db3681ef12
commit
6d98864a04
|
@ -1,6 +1,7 @@
|
|||
/* 6.1.1.7
|
||||
* Add initial display support for Lcd, Oled, Matrix, Tft and e-paper - Need more docs
|
||||
* Fix SDM120 reporting wrong negative values to Domoticz (#3521)
|
||||
* Fix iFan02 power on state (#3412, #3530)
|
||||
*
|
||||
* 6.1.1.6
|
||||
* Add modulo option to rules like rule1 on Time#Minute|5 do backlog power on;delay 200;power off endon (#3466)
|
||||
|
|
|
@ -201,8 +201,8 @@ enum XsnsFunctions {FUNC_PRE_INIT, FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND,
|
|||
const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 };
|
||||
|
||||
enum CommandSource { SRC_IGNORE, SRC_MQTT, SRC_RESTART, SRC_BUTTON, SRC_SWITCH, SRC_BACKLOG, SRC_SERIAL, SRC_WEBGUI, SRC_WEBCOMMAND, SRC_WEBCONSOLE, SRC_PULSETIMER,
|
||||
SRC_TIMER, SRC_RULE, SRC_MAXPOWER, SRC_MAXENERGY, SRC_LIGHT, SRC_KNX, SRC_DISPLAY, SRC_WEMO, SRC_HUE, SRC_MAX };
|
||||
const char kCommandSource[] PROGMEM = "I|MQTT|Restart|Button|Switch|Backlog|Serial|WebGui|WebCommand|WebConsole|PulseTimer|Timer|Rule|MaxPower|MaxEnergy|Light|Knx|Display|Wemo|Hue";
|
||||
SRC_TIMER, SRC_RULE, SRC_MAXPOWER, SRC_MAXENERGY, SRC_LIGHT, SRC_KNX, SRC_DISPLAY, SRC_WEMO, SRC_HUE, SRC_RETRY, SRC_MAX };
|
||||
const char kCommandSource[] PROGMEM = "I|MQTT|Restart|Button|Switch|Backlog|Serial|WebGui|WebCommand|WebConsole|PulseTimer|Timer|Rule|MaxPower|MaxEnergy|Light|Knx|Display|Wemo|Hue|Retry";
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Extern global variables
|
||||
|
|
|
@ -383,6 +383,15 @@ uint8_t GetFanspeed()
|
|||
return fanspeed;
|
||||
}
|
||||
|
||||
void SetFanspeed(uint8_t fanspeed)
|
||||
{
|
||||
for (byte i = 0; i < 3; i++) {
|
||||
uint8_t state = kIFan02Speed[fanspeed][i];
|
||||
// uint8_t state = pgm_read_byte(kIFan02Speed +(speed *3) +i);
|
||||
ExecuteCommandPower(i +2, state, SRC_IGNORE); // Use relay 2, 3 and 4
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
||||
|
@ -537,11 +546,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
|||
}
|
||||
}
|
||||
if ((payload >= 0) && (payload <= 3) && (payload != GetFanspeed())) {
|
||||
for (byte i = 0; i < 3; i++) {
|
||||
uint8_t state = kIFan02Speed[payload][i];
|
||||
// uint8_t state = pgm_read_byte(kIFan02Speed +(payload *3) +i);
|
||||
ExecuteCommandPower(i +2, state, SRC_IGNORE); // Use relay 2, 3 and 4
|
||||
}
|
||||
SetFanspeed(payload);
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, GetFanspeed());
|
||||
}
|
||||
|
@ -1522,6 +1527,11 @@ void PerformEverySecond()
|
|||
{
|
||||
uptime++;
|
||||
|
||||
if ((4 == uptime) && (SONOFF_IFAN02 == Settings.module)) { // Microcontroller needs 3 seconds before accepting commands
|
||||
SetDevicePower(1, SRC_RETRY); // Sync with default power on state microcontroller being Light ON and Fan OFF
|
||||
SetDevicePower(power, SRC_RETRY); // Set required power on state
|
||||
}
|
||||
|
||||
if (blockgpio0) blockgpio0--;
|
||||
|
||||
for (byte i = 0; i < MAX_PULSETIMERS; i++) {
|
||||
|
|
Loading…
Reference in New Issue