show dummy vessel

Signed-off-by: Peter Siegmund <peter@rdkr.com>
This commit is contained in:
Peter Siegmund
2024-06-06 22:24:05 +02:00
parent ca68e9786c
commit f520883b8b

View File

@@ -5,6 +5,7 @@
#include <string>
#include "epd_driver.h"
#include "fonts/opensans26b.h"
#include "fonts/opensans6.h"
#include "staticmap.h"
#include "utilities.h"
@@ -25,9 +26,20 @@ void drawString(int32_t x, int32_t y, std::string text, alignment align) {
if (align == CENTER)
x = x - w / 2;
int32_t cursor_y = y + h;
int32_t padding = 4;
epd_fill_rect(x - padding, y - padding, w + 2 * padding, h + 2 * padding, 255,
framebuffer);
write_string(&currentFont, data, &x, &cursor_y, framebuffer);
}
void drawVessel(int32_t x, int32_t y, std::string vesselName) {
currentFont = OpenSans;
int32_t radius = 10;
epd_fill_circle(x, y, radius, 255, framebuffer);
epd_draw_circle(x, y, radius, 0, framebuffer);
drawString(x, y + 2 * radius, vesselName, CENTER);
}
void mapView(void* args) {
framebuffer =
(uint8_t*)heap_caps_malloc(EPD_WIDTH * EPD_HEIGHT / 2, MALLOC_CAP_SPIRAM);
@@ -54,6 +66,9 @@ void mapView(void* args) {
currentFont = OpenSans26B;
drawString(x, y, "Hello, World!", CENTER);
drawVessel(EPD_WIDTH - EPD_WIDTH / 4, EPD_HEIGHT - EPD_HEIGHT / 5,
"DEEPENSCHRIEWER 1");
epd_poweron();
epd_clear();
epd_draw_grayscale_image(epd_full_screen(), framebuffer);