mirror of
https://github.com/zzzzDev4/IAS-Better-Tea.git
synced 2025-04-21 07:31:20 +02:00
feedback timeout bugfix and aborting now via both button pressed
This commit is contained in:
parent
308381cfb2
commit
541536fe1a
1 changed files with 10 additions and 11 deletions
21
src/main.cpp
21
src/main.cpp
|
@ -42,11 +42,11 @@ String shuttleServer = "https://ias-tea-axum.shuttleapp.rs";
|
|||
TeaData currentTea(-1, "Teafault", "c0derfid", "", -1, 30);
|
||||
|
||||
// config
|
||||
long feedbackTimeout = 15;
|
||||
unsigned long feedbackTimeoutSeconds = 15;
|
||||
int defaultSteepingTime = 120;
|
||||
|
||||
// timeout
|
||||
unsigned long timeoutTime;
|
||||
unsigned long timeoutTimeMillis;
|
||||
|
||||
// macros
|
||||
#define CATCH_NET_FAILURE(netResult, msg) \
|
||||
|
@ -109,7 +109,7 @@ void setup()
|
|||
else
|
||||
{
|
||||
defaultSteepingTime = result["default_steeping_time"];
|
||||
feedbackTimeout = result["feedback_timeout"];
|
||||
feedbackTimeoutSeconds = result["feedback_timeout"];
|
||||
}
|
||||
|
||||
smartDisplay.playTeaAnimation();
|
||||
|
@ -250,14 +250,14 @@ void loop()
|
|||
if (teaTimer.isSteeping())
|
||||
{
|
||||
// abort if red button pressed
|
||||
if (buttonLeft.isJustPressed())
|
||||
if (buttonLeft.isJustPressed() && buttonRight.isJustPressed())
|
||||
{
|
||||
teaTimer.endSteeping();
|
||||
smartDisplay.printMsg("Ready!");
|
||||
smartStrip.animateBottomToTop(0, 1, 0);
|
||||
smartDisplay.printMsg("Aborting...");
|
||||
smartStrip.animateBottomToTop(1, 0, 0);
|
||||
delay(1000);
|
||||
state = State::REQUEST_FEEDBACK;
|
||||
timeoutTime = millis() + (feedbackTimeout * 1000 * 60);
|
||||
smartStrip.reset();
|
||||
state = State::WAIT_FOR_RFID_SCAN;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ void loop()
|
|||
smartDisplay.printMsg("Ready!");
|
||||
smartStrip.animateBottomToTop(0, 1, 0);
|
||||
state = State::REQUEST_FEEDBACK;
|
||||
timeoutTime = millis() + (feedbackTimeout * 1000 * 60);
|
||||
timeoutTimeMillis = millis() + (feedbackTimeoutSeconds * 1000);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void loop()
|
|||
{
|
||||
|
||||
// timeout
|
||||
if (millis() >= timeoutTime)
|
||||
if (millis() >= timeoutTimeMillis)
|
||||
{
|
||||
// we still want to save the last configuration (treated as perfect, no steeping time change)
|
||||
String steeepingTimePayload = teaNet.bundleSteepingTimeLogEntry(currentTea.m_steepingSeconds);
|
||||
|
@ -349,7 +349,6 @@ void loop()
|
|||
JSONVar steepingLog = teaNet.httpsGETRequest(shuttleServer + "/brewing-events/" + currentTea.m_id);
|
||||
CATCH_NET_FAILURE(steepingLog, "TRY AGAIN")
|
||||
|
||||
|
||||
String steeepingTimePayload = teaNet.bundleSteepingTimeLogEntry(currentTea.m_steepingSeconds);
|
||||
Serial.println(steeepingTimePayload);
|
||||
// log old steeping time
|
||||
|
|
Loading…
Add table
Reference in a new issue