Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

Commit

Permalink
invert readings from power button
Browse files Browse the repository at this point in the history
more: issue #1
  • Loading branch information
HyperDX committed Dec 22, 2022
1 parent fc44898 commit b1b98f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions TEF-ESP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,13 @@ void setup() {
}
}

if (digitalRead(PWRBUTTON) == LOW) {
if (digitalRead(PWRBUTTON) == HIGH) {
analogWrite(SMETERPIN, 511);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE);
tft.drawCentreString("Calibrate analog meter", 150, 70, 4);
tft.drawCentreString("Release button when ready", 150, 100, 4);
while (digitalRead(PWRBUTTON) == LOW) {
while (digitalRead(PWRBUTTON) == HIGH) {
delay(50);
}
analogWrite(SMETERPIN, 0);
Expand Down Expand Up @@ -547,7 +547,7 @@ void setup() {
}

void loop() {
if (digitalRead(PWRBUTTON) == LOW && USBstatus == false) {
if (digitalRead(PWRBUTTON) == HIGH && USBstatus == false) {
PWRButtonPress();
}

Expand Down Expand Up @@ -836,7 +836,7 @@ void PWRButtonPress() {
if (menu == false) {
unsigned long counterold = millis();
unsigned long counter = millis();
while (digitalRead(PWRBUTTON) == LOW && counter - counterold <= 1000) {
while (digitalRead(PWRBUTTON) == HIGH && counter - counterold <= 1000) {
counter = millis();
}
if (counter - counterold < 1000) {
Expand Down Expand Up @@ -864,7 +864,7 @@ void PWRButtonPress() {
radio.power(1);
}
}
while (digitalRead(PWRBUTTON) == LOW) {
while (digitalRead(PWRBUTTON) == HIGH) {
delay(50);
}
delay(100);
Expand Down

0 comments on commit b1b98f8

Please sign in to comment.