mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-04-06 23:15:15 +00:00
add display stuff
This commit is contained in:
parent
8b2e8f3c14
commit
db5b11caa4
15 changed files with 3783 additions and 199 deletions
46
lib/Display/Display.cpp
Normal file
46
lib/Display/Display.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include <logger.h>
|
||||
#include "Display.h"
|
||||
|
||||
Display::Display()
|
||||
{
|
||||
}
|
||||
|
||||
void Display::setup(std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
_disp = std::shared_ptr<OLEDDisplay>(new SSD1306Wire(boardConfig->OledAddr, boardConfig->OledSda, boardConfig->OledScl));
|
||||
_ui = std::shared_ptr<OLEDDisplayUi>(new OLEDDisplayUi(_disp.get()));
|
||||
|
||||
static std::array<FrameCallback, 2> frames;
|
||||
frames[0] = drawStatusPage;
|
||||
frames[1] = drawStatusPage;
|
||||
_ui->setFrames(frames.data(), frames.size());
|
||||
|
||||
_ui->setTargetFPS(15);
|
||||
_ui->setFrameAnimation(SLIDE_LEFT);
|
||||
_ui->init();
|
||||
_disp->flipScreenVertically();
|
||||
}
|
||||
|
||||
void Display::setTaskStatus(const String & task, const String & status)
|
||||
{
|
||||
_taskStatus.insert(std::pair<String, String>(task, status));
|
||||
}
|
||||
|
||||
void Display::update()
|
||||
{
|
||||
_ui->update();
|
||||
}
|
||||
|
||||
void Display::drawStatusPage(OLEDDisplay * display, OLEDDisplayUiState * state, int16_t x, int16_t y)
|
||||
{
|
||||
//logPrintlnD("blib");
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(ArialMT_Plain_10);
|
||||
display->drawString(0 + x, 10 + y, "Arial 10");
|
||||
|
||||
display->setFont(ArialMT_Plain_16);
|
||||
display->drawString(0 + x, 20 + y, "Arial 16");
|
||||
|
||||
display->setFont(ArialMT_Plain_24);
|
||||
display->drawString(0 + x, 34 + y, "Arial 24");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue