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);
|
TeaData currentTea(-1, "Teafault", "c0derfid", "", -1, 30);
|
||||||
|
|
||||||
// config
|
// config
|
||||||
long feedbackTimeout = 15;
|
unsigned long feedbackTimeoutSeconds = 15;
|
||||||
int defaultSteepingTime = 120;
|
int defaultSteepingTime = 120;
|
||||||
|
|
||||||
// timeout
|
// timeout
|
||||||
unsigned long timeoutTime;
|
unsigned long timeoutTimeMillis;
|
||||||
|
|
||||||
// macros
|
// macros
|
||||||
#define CATCH_NET_FAILURE(netResult, msg) \
|
#define CATCH_NET_FAILURE(netResult, msg) \
|
||||||
|
@ -109,7 +109,7 @@ void setup()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
defaultSteepingTime = result["default_steeping_time"];
|
defaultSteepingTime = result["default_steeping_time"];
|
||||||
feedbackTimeout = result["feedback_timeout"];
|
feedbackTimeoutSeconds = result["feedback_timeout"];
|
||||||
}
|
}
|
||||||
|
|
||||||
smartDisplay.playTeaAnimation();
|
smartDisplay.playTeaAnimation();
|
||||||
|
@ -250,14 +250,14 @@ void loop()
|
||||||
if (teaTimer.isSteeping())
|
if (teaTimer.isSteeping())
|
||||||
{
|
{
|
||||||
// abort if red button pressed
|
// abort if red button pressed
|
||||||
if (buttonLeft.isJustPressed())
|
if (buttonLeft.isJustPressed() && buttonRight.isJustPressed())
|
||||||
{
|
{
|
||||||
teaTimer.endSteeping();
|
teaTimer.endSteeping();
|
||||||
smartDisplay.printMsg("Ready!");
|
smartDisplay.printMsg("Aborting...");
|
||||||
smartStrip.animateBottomToTop(0, 1, 0);
|
smartStrip.animateBottomToTop(1, 0, 0);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
state = State::REQUEST_FEEDBACK;
|
smartStrip.reset();
|
||||||
timeoutTime = millis() + (feedbackTimeout * 1000 * 60);
|
state = State::WAIT_FOR_RFID_SCAN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void loop()
|
||||||
smartDisplay.printMsg("Ready!");
|
smartDisplay.printMsg("Ready!");
|
||||||
smartStrip.animateBottomToTop(0, 1, 0);
|
smartStrip.animateBottomToTop(0, 1, 0);
|
||||||
state = State::REQUEST_FEEDBACK;
|
state = State::REQUEST_FEEDBACK;
|
||||||
timeoutTime = millis() + (feedbackTimeout * 1000 * 60);
|
timeoutTimeMillis = millis() + (feedbackTimeoutSeconds * 1000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ void loop()
|
||||||
{
|
{
|
||||||
|
|
||||||
// timeout
|
// timeout
|
||||||
if (millis() >= timeoutTime)
|
if (millis() >= timeoutTimeMillis)
|
||||||
{
|
{
|
||||||
// we still want to save the last configuration (treated as perfect, no steeping time change)
|
// we still want to save the last configuration (treated as perfect, no steeping time change)
|
||||||
String steeepingTimePayload = teaNet.bundleSteepingTimeLogEntry(currentTea.m_steepingSeconds);
|
String steeepingTimePayload = teaNet.bundleSteepingTimeLogEntry(currentTea.m_steepingSeconds);
|
||||||
|
@ -349,7 +349,6 @@ void loop()
|
||||||
JSONVar steepingLog = teaNet.httpsGETRequest(shuttleServer + "/brewing-events/" + currentTea.m_id);
|
JSONVar steepingLog = teaNet.httpsGETRequest(shuttleServer + "/brewing-events/" + currentTea.m_id);
|
||||||
CATCH_NET_FAILURE(steepingLog, "TRY AGAIN")
|
CATCH_NET_FAILURE(steepingLog, "TRY AGAIN")
|
||||||
|
|
||||||
|
|
||||||
String steeepingTimePayload = teaNet.bundleSteepingTimeLogEntry(currentTea.m_steepingSeconds);
|
String steeepingTimePayload = teaNet.bundleSteepingTimeLogEntry(currentTea.m_steepingSeconds);
|
||||||
Serial.println(steeepingTimePayload);
|
Serial.println(steeepingTimePayload);
|
||||||
// log old steeping time
|
// log old steeping time
|
||||||
|
|
Loading…
Add table
Reference in a new issue