mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Merge pull request #7465 from to-scho/hotfix/shutterbuttons_short_command
Add MQTT field to short shutterButton command syntax
This commit is contained in:
commit
a52c059cdc
@ -809,7 +809,7 @@ void CmndShutterButton(void)
|
|||||||
// (setting>> 0)&(0x03) : shutter_index
|
// (setting>> 0)&(0x03) : shutter_index
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (XdrvMailbox.data_len > 0) {
|
||||||
uint32_t i = 0, button_index = 0;
|
uint32_t i = 0, button_index = 0;
|
||||||
bool done = false;
|
bool done = false, isShortCommand = false;
|
||||||
char *str_ptr;
|
char *str_ptr;
|
||||||
char* version_dup = strdup(XdrvMailbox.data); // Duplicate the version_str as strtok_r will modify it.
|
char* version_dup = strdup(XdrvMailbox.data); // Duplicate the version_str as strtok_r will modify it.
|
||||||
// Loop through the version string, splitting on ' ' seperators.
|
// Loop through the version string, splitting on ' ' seperators.
|
||||||
@ -830,19 +830,26 @@ void CmndShutterButton(void)
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!strcmp_P(str, PSTR("up"))) {
|
if (!strcmp_P(str, PSTR("up"))) {
|
||||||
setting |= (((100>>1)+1)<<2) | (((50>>1)+1)<<8) | (((75>>1)+1)<<14) | (((100>>1)+1)<<20) | (0x18<<26);
|
setting |= (((100>>1)+1)<<2) | (((50>>1)+1)<<8) | (((75>>1)+1)<<14) | (((100>>1)+1)<<20);
|
||||||
done = true;
|
isShortCommand = true;
|
||||||
break;
|
break;
|
||||||
} else if (!strcmp_P(str, PSTR("down"))) {
|
} else if (!strcmp_P(str, PSTR("down"))) {
|
||||||
setting |= (((0>>1)+1)<<2) | (((50>>1)+1)<<8) | (((25>>1)+1)<<14) | (((0>>1)+1)<<20) | (0x18<<26);
|
setting |= (((0>>1)+1)<<2) | (((50>>1)+1)<<8) | (((25>>1)+1)<<14) | (((0>>1)+1)<<20);
|
||||||
done = true;
|
isShortCommand = true;
|
||||||
break;
|
break;
|
||||||
} else if (!strcmp_P(str, PSTR("updown"))) {
|
} else if (!strcmp_P(str, PSTR("updown"))) {
|
||||||
setting |= (((100>>1)+1)<<2) | (((0>>1)+1)<<8) | (((50>>1)+1)<<14);
|
setting |= (((100>>1)+1)<<2) | (((0>>1)+1)<<8) | (((50>>1)+1)<<14);
|
||||||
done = true;
|
isShortCommand = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
|
if (isShortCommand) {
|
||||||
|
if ((field==1) && (setting & (0x3F<<(2+6*3))))
|
||||||
|
// if short command up or down then also enable MQTT broadcast
|
||||||
|
setting |= (0x3<<29);
|
||||||
|
done = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
if ((field >= -1) && (field<=100))
|
if ((field >= -1) && (field<=100))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user