ajustement première seconde de décompte,
reprise au temps en cours, temps par défaut à l'allumage 12 sec
This commit is contained in:
parent
ffa4c5b006
commit
ecf8711e54
20
src/main.cpp
20
src/main.cpp
@ -63,6 +63,7 @@ void setup() {
|
||||
for(;;); // Don't proceed, loop forever
|
||||
}
|
||||
|
||||
encoder.setPosition(count);
|
||||
// Clear the buffer
|
||||
display.clearDisplay();
|
||||
|
||||
@ -80,8 +81,9 @@ void loop() {
|
||||
display.setTextSize(6);
|
||||
display.setTextColor(SSD1306_WHITE); // Draw white text
|
||||
unsigned long currentMillis = millis();
|
||||
int newPos;
|
||||
|
||||
if (statutDecompte) {
|
||||
if (statutDecompte) { // on est en mode de compte à rebours
|
||||
if (count > 0) {
|
||||
if (currentMillis - LastUpdateTimer >= 1000) {
|
||||
LastUpdateTimer = currentMillis;
|
||||
@ -95,13 +97,19 @@ void loop() {
|
||||
}
|
||||
else {
|
||||
statutDecompte = 0;
|
||||
count = encoder.getPosition();
|
||||
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 20);
|
||||
display.println(count);
|
||||
display.display();
|
||||
}
|
||||
}
|
||||
else {
|
||||
else { // on est en mode réglage / pause
|
||||
static int pos = 0;
|
||||
encoder.tick();
|
||||
|
||||
int newPos = encoder.getPosition();
|
||||
newPos = encoder.getPosition();
|
||||
if (pos != newPos) {
|
||||
if (newPos < 0) {
|
||||
newPos = 0;
|
||||
@ -119,6 +127,12 @@ void loop() {
|
||||
if (digitalRead(ENCROT_BP) && (currentMillis - LastReadBP > 250)){
|
||||
LastReadBP = currentMillis;
|
||||
statutDecompte = !statutDecompte;
|
||||
if (statutDecompte) {
|
||||
LastUpdateTimer = currentMillis;
|
||||
}
|
||||
else {
|
||||
encoder.setPosition(count);
|
||||
}
|
||||
}
|
||||
|
||||
digitalWrite(SORTIE_RELAIS, statutDecompte);
|
||||
|
Loading…
x
Reference in New Issue
Block a user