mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Add increment and decrement counter
6.0.0a * Add increment and decrement value to command Counter (#2838)
This commit is contained in:
parent
6a9a996e98
commit
54ef429fdc
@ -1,4 +1,5 @@
|
||||
/* 6.0.0a
|
||||
* Add increment and decrement value to command Counter (#2838)
|
||||
* Add option 0 to command Timers disarming all timers (#2962)
|
||||
* Add time in minutes to rule Time#Initialized, Time#set and Time#Minute (#2669)
|
||||
* Add rule variables %time% for minutes since midnight, %uptime%, %sunrise% and %sunset% giving time in minutes (#2669)
|
||||
|
@ -797,8 +797,13 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
||||
}
|
||||
else if ((CMND_COUNTER == command_code) && (index > 0) && (index <= MAX_COUNTERS)) {
|
||||
if ((data_len > 0) && (pin[GPIO_CNTR1 + index -1] < 99)) {
|
||||
RtcSettings.pulse_counter[index -1] = payload16;
|
||||
Settings.pulse_counter[index -1] = payload16;
|
||||
if ((dataBuf[0] == '-') || (dataBuf[0] == '+')) {
|
||||
RtcSettings.pulse_counter[index -1] += payload32;
|
||||
Settings.pulse_counter[index -1] += payload32;
|
||||
} else {
|
||||
RtcSettings.pulse_counter[index -1] = payload32;
|
||||
Settings.pulse_counter[index -1] = payload32;
|
||||
}
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_LVALUE, command, index, RtcSettings.pulse_counter[index -1]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user