InfiniTime.git

ref: 0.12.0

src/displayapp/screens/BatteryIcon.cpp


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "BatteryIcon.h"
#include "Symbols.h"

using namespace Pinetime::Applications::Screens;

const char* BatteryIcon::GetBatteryIcon(int batteryPercent) {
  if(batteryPercent > 90) return Symbols::batteryFull;
  if(batteryPercent > 75) return Symbols::batteryThreeQuarter;
  if(batteryPercent > 50) return Symbols::batteryHalf;
  if(batteryPercent > 25) return Symbols::batteryOneQuarter;
  return Symbols::batteryEmpty;
}

const char* BatteryIcon::GetUnknownIcon() {
  return Symbols::batteryEmpty;
}

const char *BatteryIcon::GetPlugIcon(bool isCharging) {
  if(isCharging)
    return Symbols::plug;
  else return "";
}