add Speed2 ! to cancel pending one-shot speed setting

This commit is contained in:
David Gwynne 2022-07-09 20:57:06 +10:00
parent 554a49e520
commit bc6d65c725

View File

@ -3130,6 +3130,14 @@ void CmndFade(void)
void CmndSpeed(void) void CmndSpeed(void)
{ {
if (2 == XdrvMailbox.index) { if (2 == XdrvMailbox.index) {
// Speed2 ! cancels use of Speed2 in the future
if ((1 == XdrvMailbox.data_len) && ('!' == XdrvMailbox.data[0])) {
Light.fade_once_enabled = false;
Light.speed_once_enabled = false;
ResponseCmndDone();
return;
}
// Speed2 setting will be used only once, then revert to fade/speed // Speed2 setting will be used only once, then revert to fade/speed
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 40)) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 40)) {
Light.fade_once_enabled = true; Light.fade_once_enabled = true;