Removed an illogical comparison from SystemInfo and St7789 driver (#449)

* Removed an illogical comparison
This commit is contained in:
Avamander 2021-06-22 21:31:31 +03:00 committed by GitHub
parent 20a24f8cf5
commit 572be3e857
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View file

@ -141,9 +141,6 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
uptimeSeconds = uptimeSeconds % secondsInAMinute; uptimeSeconds = uptimeSeconds % secondsInAMinute;
// TODO handle more than 100 days of uptime // TODO handle more than 100 days of uptime
if (batteryPercent == -1)
batteryPercent = 0;
// hack to not use the flot functions from printf // hack to not use the flot functions from printf
uint8_t batteryVoltageBytes[2]; uint8_t batteryVoltageBytes[2];
batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers

View file

@ -140,8 +140,9 @@ void St7789::Uninit() {
} }
void St7789::DrawPixel(uint16_t x, uint16_t y, uint32_t color) { void St7789::DrawPixel(uint16_t x, uint16_t y, uint32_t color) {
if ((x < 0) || (x >= Width) || (y < 0) || (y >= Height)) if (x >= Width || y >= Height) {
return; return;
}
SetAddrWindow(x, y, x + 1, y + 1); SetAddrWindow(x, y, x + 1, y + 1);