Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P097] Updating code and (later) documentation #5165

Open
wants to merge 15 commits into
base: mega
Choose a base branch
from
21 changes: 13 additions & 8 deletions src/_P097_Esp32Touch.ino
chromoxdor marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,17 @@ boolean Plugin_097(uint8_t function, struct EventStruct *event, String& string)

case PLUGIN_TEN_PER_SECOND:
{
if (P097_SEND_LONG_PRESS_EVENT &&
(p097_touchstart[CONFIG_PIN1] >= 1) &&
(timePassedSince(p097_touchstart[CONFIG_PIN1]) >= P097_LONG_PRESS_TIME)) {
UserVar.setFloat(event->TaskIndex, 1, 10);
eventQueue.add(event->TaskIndex, (getTaskValueName(event->TaskIndex, 1)), 10);
p097_touchstart[CONFIG_PIN1] = 0;
const int START_PIN = HAS_T0_INPUT ? 0 : 1;
const int END_PIN = LAST_TOUCH_INPUT_INDEX - HAS_T0_INPUT;

if ((CONFIG_PIN1 >= START_PIN) && (CONFIG_PIN1 <= END_PIN)) {
if (P097_SEND_LONG_PRESS_EVENT &&
(p097_touchstart[CONFIG_PIN1] >= 1) &&
(timePassedSince(p097_touchstart[CONFIG_PIN1]) >= P097_LONG_PRESS_TIME)) {
chromoxdor marked this conversation as resolved.
Show resolved Hide resolved
UserVar.setFloat(event->TaskIndex, 1, 10);
eventQueue.add(event->TaskIndex, (getTaskValueName(event->TaskIndex, 1)), 10);
p097_touchstart[CONFIG_PIN1] = 0;
}
}

if ((p097_pinTouched != 0) || (p097_pinTouchedPrev != 0)) {
Expand Down Expand Up @@ -203,7 +208,7 @@ boolean Plugin_097(uint8_t function, struct EventStruct *event, String& string)
UserVar.setFloat(event->TaskIndex, 1, 0);
eventQueue.add(event->TaskIndex, (getTaskValueName(event->TaskIndex, 1)), 0);
} else {
// set value back to previous state after long press release
// set only the taskvalue back to previous state after long press release
if (P097_SEND_LONG_PRESS_EVENT) { UserVar.setFloat(event->TaskIndex, 1, p097_togglevalue[CONFIG_PIN1]); }
}

Expand Down Expand Up @@ -254,7 +259,7 @@ boolean Plugin_097(uint8_t function, struct EventStruct *event, String& string)
UserVar.setFloat(event->TaskIndex, 1, 0);
eventQueue.add(event->TaskIndex, (getTaskValueName(event->TaskIndex, 1)), 0);
} else {
// set value back to previous state after long press release
// set only the taskvalue back to previous state after long press release
if (P097_SEND_LONG_PRESS_EVENT) { UserVar.setFloat(event->TaskIndex, 1, p097_togglevalue[CONFIG_PIN1]); }
}

Expand Down
Loading