mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
TOGGLE input re-intrrable issue fixed double toggling
This commit is contained in:
@@ -435,13 +435,15 @@ void Input::contactPoll() {
|
|||||||
if (inType & IN_PUSH_TOGGLE) {
|
if (inType & IN_PUSH_TOGGLE) {
|
||||||
if (currentInputState) { //react on leading edge only (change from 0 to 1)
|
if (currentInputState) { //react on leading edge only (change from 0 to 1)
|
||||||
store->logicState = !store->logicState;
|
store->logicState = !store->logicState;
|
||||||
|
store->currentValue = currentInputState;
|
||||||
onContactChanged(store->logicState);
|
onContactChanged(store->logicState);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
store->logicState = currentInputState;
|
store->logicState = currentInputState;
|
||||||
|
store->currentValue = currentInputState;
|
||||||
onContactChanged(currentInputState);
|
onContactChanged(currentInputState);
|
||||||
}
|
}
|
||||||
store->currentValue = currentInputState;
|
// store->currentValue = currentInputState;
|
||||||
}
|
}
|
||||||
} else // no change
|
} else // no change
|
||||||
store->bounce = SAME_STATE_ATTEMPTS;
|
store->bounce = SAME_STATE_ATTEMPTS;
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ e-mail anklimov@gmail.com
|
|||||||
#ifndef MODBUS_DISABLE
|
#ifndef MODBUS_DISABLE
|
||||||
#include <ModbusMaster.h>
|
#include <ModbusMaster.h>
|
||||||
#endif
|
#endif
|
||||||
#include <PubSubClient.h>
|
|
||||||
|
|
||||||
|
#include <PubSubClient.h>
|
||||||
#include "modules/out_spiled.h"
|
#include "modules/out_spiled.h"
|
||||||
|
|
||||||
|
//Commands
|
||||||
const char ON_P[] PROGMEM = "ON";
|
const char ON_P[] PROGMEM = "ON";
|
||||||
const char OFF_P[] PROGMEM = "OFF";
|
const char OFF_P[] PROGMEM = "OFF";
|
||||||
const char REST_P[] PROGMEM = "REST";
|
const char REST_P[] PROGMEM = "REST";
|
||||||
@@ -50,12 +51,14 @@ const char FALSE_P[] PROGMEM = "FALSE";
|
|||||||
const char HEAT_P[] PROGMEM = "HEAT";
|
const char HEAT_P[] PROGMEM = "HEAT";
|
||||||
const char COOL_P[] PROGMEM = "COOL";
|
const char COOL_P[] PROGMEM = "COOL";
|
||||||
const char AUTO_P[] PROGMEM = "AUTO";
|
const char AUTO_P[] PROGMEM = "AUTO";
|
||||||
const char FAN_P[] PROGMEM = "FAN_ONLY";
|
const char FAN_ONLY_P[] PROGMEM = "FAN_ONLY";
|
||||||
const char DRY_P[] PROGMEM = "DRY";
|
const char DRY_P[] PROGMEM = "DRY";
|
||||||
|
|
||||||
|
// SubTopics
|
||||||
const char SET_P[] PROGMEM = "set";
|
const char SET_P[] PROGMEM = "set";
|
||||||
const char CMD_P[] PROGMEM = "cmd";
|
const char CMD_P[] PROGMEM = "cmd";
|
||||||
const char MODE_P[] PROGMEM = "mode";
|
const char MODE_P[] PROGMEM = "mode";
|
||||||
|
const char FAN_P[] PROGMEM = "fan";
|
||||||
/*
|
/*
|
||||||
const char TEMP_P[] PROGMEM = "temp";
|
const char TEMP_P[] PROGMEM = "temp";
|
||||||
const char SETPOINT_P[] PROGMEM = "setpoint";
|
const char SETPOINT_P[] PROGMEM = "setpoint";
|
||||||
@@ -65,9 +68,10 @@ const char HEAT_P[] PROGMEM = "heat";
|
|||||||
*/
|
*/
|
||||||
const char HSV_P[] PROGMEM = "hsv";
|
const char HSV_P[] PROGMEM = "hsv";
|
||||||
const char RGB_P[] PROGMEM = "rgb";
|
const char RGB_P[] PROGMEM = "rgb";
|
||||||
|
/*
|
||||||
const char RPM_P[] PROGMEM = "rpm";
|
const char RPM_P[] PROGMEM = "rpm";
|
||||||
const char STATE_P[] PROGMEM = "state";
|
const char STATE_P[] PROGMEM = "state";
|
||||||
|
*/
|
||||||
short modbusBusy = 0;
|
short modbusBusy = 0;
|
||||||
extern aJsonObject *pollingItem;
|
extern aJsonObject *pollingItem;
|
||||||
extern PubSubClient mqttClient;
|
extern PubSubClient mqttClient;
|
||||||
@@ -91,7 +95,7 @@ int txt2cmd(char *payload) {
|
|||||||
else if (strcmp_P(payload, HEAT_P) == 0) cmd = CMD_HEAT;
|
else if (strcmp_P(payload, HEAT_P) == 0) cmd = CMD_HEAT;
|
||||||
else if (strcmp_P(payload, COOL_P) == 0) cmd = CMD_COOL;
|
else if (strcmp_P(payload, COOL_P) == 0) cmd = CMD_COOL;
|
||||||
else if (strcmp_P(payload, AUTO_P) == 0) cmd = CMD_AUTO;
|
else if (strcmp_P(payload, AUTO_P) == 0) cmd = CMD_AUTO;
|
||||||
else if (strcmp_P(payload, FAN_P) == 0) cmd = CMD_FAN;
|
else if (strcmp_P(payload, FAN_ONLY_P) == 0) cmd = CMD_FAN;
|
||||||
else if (strcmp_P(payload, DRY_P) == 0) cmd = CMD_DRY;
|
else if (strcmp_P(payload, DRY_P) == 0) cmd = CMD_DRY;
|
||||||
else if (strcmp_P(payload, TRUE_P) == 0) cmd = CMD_ON;
|
else if (strcmp_P(payload, TRUE_P) == 0) cmd = CMD_ON;
|
||||||
else if (strcmp_P(payload, FALSE_P) == 0) cmd = CMD_OFF;
|
else if (strcmp_P(payload, FALSE_P) == 0) cmd = CMD_OFF;
|
||||||
@@ -111,9 +115,10 @@ int txt2subItem(char *payload) {
|
|||||||
// Check for command
|
// Check for command
|
||||||
if (strcmp_P(payload, SET_P) == 0) cmd = S_SET;
|
if (strcmp_P(payload, SET_P) == 0) cmd = S_SET;
|
||||||
else if (strcmp_P(payload, CMD_P) == 0) cmd = S_CMD;
|
else if (strcmp_P(payload, CMD_P) == 0) cmd = S_CMD;
|
||||||
else if (strcmp_P(payload, MODE_P) == 0) cmd = S_MODE;
|
// else if (strcmp_P(payload, MODE_P) == 0) cmd = S_MODE;
|
||||||
else if (strcmp_P(payload, HSV_P) == 0) cmd = S_HSV;
|
else if (strcmp_P(payload, HSV_P) == 0) cmd = S_HSV;
|
||||||
else if (strcmp_P(payload, RGB_P) == 0) cmd = S_RGB;
|
else if (strcmp_P(payload, RGB_P) == 0) cmd = S_RGB;
|
||||||
|
else if (strcmp_P(payload, FAN_P) == 0) cmd = S_FAN;
|
||||||
/* UnUsed now
|
/* UnUsed now
|
||||||
else if (strcmp_P(payload, SETPOINT_P) == 0) cmd = S_SETPOINT;
|
else if (strcmp_P(payload, SETPOINT_P) == 0) cmd = S_SETPOINT;
|
||||||
else if (strcmp_P(payload, TEMP_P) == 0) cmd = S_TEMP;
|
else if (strcmp_P(payload, TEMP_P) == 0) cmd = S_TEMP;
|
||||||
|
|||||||
@@ -24,16 +24,18 @@ e-mail anklimov@gmail.com
|
|||||||
#define S_SETnCMD 0
|
#define S_SETnCMD 0
|
||||||
#define S_CMD 1
|
#define S_CMD 1
|
||||||
#define S_SET 2
|
#define S_SET 2
|
||||||
#define S_TEMP 3
|
#define S_HSV 3
|
||||||
|
#define S_RGB 4
|
||||||
|
#define S_FAN 5
|
||||||
|
/*
|
||||||
#define S_MODE 4
|
#define S_MODE 4
|
||||||
|
#define S_RPM 11
|
||||||
|
#define S_TEMP 3
|
||||||
#define S_SETPOINT 5
|
#define S_SETPOINT 5
|
||||||
#define S_POWER 6
|
#define S_POWER 6
|
||||||
#define S_VOL 7
|
#define S_VOL 7
|
||||||
#define S_HEAT 8
|
#define S_HEAT 8
|
||||||
#define S_HSV 9
|
*/
|
||||||
#define S_RGB 10
|
|
||||||
#define S_RPM 11
|
|
||||||
|
|
||||||
#define CH_DIMMER 0 //DMX 1 ch
|
#define CH_DIMMER 0 //DMX 1 ch
|
||||||
#define CH_RGBW 1 //DMX 4 ch
|
#define CH_RGBW 1 //DMX 4 ch
|
||||||
#define CH_RGB 2 //DMX 3 ch
|
#define CH_RGB 2 //DMX 3 ch
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ debugSerial<<from<<F("-")<<to<<F(" cmd=")<<cmd<<endl;
|
|||||||
switch (suffixCode)
|
switch (suffixCode)
|
||||||
{
|
{
|
||||||
|
|
||||||
case S_POWER:
|
// case S_POWER:
|
||||||
case S_VOL:
|
// case S_VOL:
|
||||||
//leds[n].setBrightness(Parameters[0]);
|
//leds[n].setBrightness(Parameters[0]);
|
||||||
break;
|
// break;
|
||||||
case S_SET:
|
case S_SET:
|
||||||
case S_HSV:
|
case S_HSV:
|
||||||
debugSerial<<F("HSV: ")<<i<<F(" :")<<Parameters[0]<<Parameters[1]<<Parameters[2]<<endl;
|
debugSerial<<F("HSV: ")<<i<<F(" :")<<Parameters[0]<<Parameters[1]<<Parameters[2]<<endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user