The font is now fixed width.
HUGE performance improvement of the display driver.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <libraries/log/nrf_log.h>
|
||||
#include <boards.h>
|
||||
#include <nrf_font.h>
|
||||
#include <hal/nrf_rtc.h>
|
||||
#include "Components/Gfx/Gfx.h"
|
||||
|
||||
using namespace Pinetime::Applications;
|
||||
@@ -21,6 +22,9 @@ void DisplayApp::Process(void *instance) {
|
||||
|
||||
while (1) {
|
||||
NRF_LOG_INFO("BlinkApp task running!");
|
||||
|
||||
app->Refresh();
|
||||
|
||||
vTaskDelay(1000);
|
||||
}
|
||||
}
|
||||
@@ -48,17 +52,57 @@ void DisplayApp::InitHw() {
|
||||
gfx->ClearScreen();
|
||||
|
||||
uint8_t x = 7;
|
||||
gfx->DrawChar(&largeFont , '0', &x, 78, 0x0);
|
||||
gfx->DrawChar(&largeFont , '0', &x, 78, 0xffff);
|
||||
|
||||
x = 61;
|
||||
gfx->DrawChar(&largeFont, '1', &x, 78, 0x0);
|
||||
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
|
||||
|
||||
x = 115;
|
||||
gfx->DrawChar(&largeFont, ':', &x, 78, 0x0);
|
||||
x = 94;
|
||||
gfx->DrawChar(&largeFont, ':', &x, 78, 0xffff);
|
||||
|
||||
x = 127;
|
||||
gfx->DrawChar(&largeFont, '2', &x, 78, 0x0);
|
||||
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
|
||||
|
||||
x = 181;
|
||||
gfx->DrawChar(&largeFont, '3', &x, 78, 0x0);
|
||||
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
|
||||
}
|
||||
|
||||
void DisplayApp::Refresh() {
|
||||
uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG);
|
||||
auto raw = systick_counter / 1000;
|
||||
|
||||
// TODO make this better!
|
||||
minutes = raw / 60;
|
||||
seconds = raw - (minutes*60);
|
||||
|
||||
char secondChar[3];
|
||||
sprintf(secondChar, "%02d", seconds);
|
||||
|
||||
char minutesChar[3];
|
||||
sprintf(minutesChar, "%02d", minutes);
|
||||
|
||||
uint8_t x = 7;
|
||||
if(minutesChar[0] != currentChar[0]) {
|
||||
gfx->DrawChar(&largeFont, minutesChar[0], &x, 78, 0xffff);
|
||||
currentChar[0] = minutesChar[0];
|
||||
}
|
||||
|
||||
x = 61;
|
||||
if(minutesChar[1] != currentChar[1]) {
|
||||
gfx->DrawChar(&largeFont, minutesChar[1], &x, 78, 0xffff);
|
||||
currentChar[1] = minutesChar[1];
|
||||
}
|
||||
|
||||
x = 127;
|
||||
if(secondChar[0] != currentChar[2]) {
|
||||
gfx->DrawChar(&largeFont, secondChar[0], &x, 78, 0xffff);
|
||||
currentChar[2] = secondChar[0];
|
||||
}
|
||||
|
||||
x = 181;
|
||||
if(secondChar[1] != currentChar[3]) {
|
||||
gfx->DrawChar(&largeFont, secondChar[1], &x, 78, 0xffff);
|
||||
currentChar[3] = secondChar[1];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,6 +22,12 @@ namespace Pinetime {
|
||||
std::unique_ptr<Drivers::St7789> lcd;
|
||||
std::unique_ptr<Components::Gfx> gfx;
|
||||
const FONT_INFO largeFont {lCD_70ptFontInfo.height, lCD_70ptFontInfo.startChar, lCD_70ptFontInfo.endChar, lCD_70ptFontInfo.spacePixels, lCD_70ptFontInfo.charInfo, lCD_70ptFontInfo.data};
|
||||
void Refresh();
|
||||
|
||||
uint8_t seconds = 0;
|
||||
uint8_t minutes = 0;
|
||||
uint8_t hours = 0;
|
||||
char currentChar[4];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user