Skip to content

Commit

Permalink
add sleepmode handler
Browse files Browse the repository at this point in the history
  • Loading branch information
dj1an committed Dec 30, 2021
1 parent ecbf1e2 commit d469cac
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/LoRa_APRS_Tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ void loop() {
Serial.println("Check your GPS - No GPS Data");
}
Radio.IrqProcess( );

if (sleepMode){
lowPowerHandler();
}
}


Expand Down Expand Up @@ -872,7 +876,8 @@ uint8_t getBattStatus()
//float_t batteryLevelPct;
detachInterrupt(USER_KEY); // reading battery voltage is messing up with the pin and driving it down, which simulates a long press for our interrupt handler

//get Battery Level 1-254 Returned by BoardGetBatteryLevel
//get Battery Level 1-254 Returned by BoardGetBatteryLevel
//!!In Practice 0 is never returned? No Battery = 254 !!
/* 0: USB,
* 1: Min level,
* x: level
Expand All @@ -881,7 +886,7 @@ uint8_t getBattStatus()
*/
batteryLevel = BoardGetBatteryLevel();
//batteryLevelPct = ((float_t)batteryLevel - BAT_LEVEL_EMPTY) * 100 / (BAT_LEVEL_FULL - BAT_LEVEL_EMPTY);

attachInterrupt(USER_KEY, userKey, FALLING); // Attach again after voltage reading is done
return batteryLevel;
}
Expand All @@ -891,7 +896,6 @@ void switchScrenOffMode()
screenOffMode = true;
//displayLogoAndMsg("Scren off....", 2000);
VextOFF();
//display.stop();
stop_display();
isDispayOn = 0;
}
Expand Down

0 comments on commit d469cac

Please sign in to comment.