Skip to content

Instantly share code, notes, and snippets.

@jezinka

jezinka/Sensor.java Secret

Created Aug 12, 2018
Embed
What would you like to do?
public int getBatteryColor() {
if (this.vbat > GOOD_BATTERY_VOLTAGE) {
return Color.parseColor(GREEN);
}
if (this.vbat > CRITICAL_BATTERY_VOLTAGE + VOLTAGE_BUFFOR) {
return Color.YELLOW;
}
return Color.RED;
}
public boolean batteryNeedRecharge() {
return this.vbat <= CRITICAL_BATTERY_VOLTAGE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment