@@ -5,6 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "epd_driver.h"
|
#include "epd_driver.h"
|
||||||
#include "fonts/opensans26b.h"
|
#include "fonts/opensans26b.h"
|
||||||
|
#include "fonts/opensans6.h"
|
||||||
#include "staticmap.h"
|
#include "staticmap.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
@@ -25,9 +26,20 @@ void drawString(int32_t x, int32_t y, std::string text, alignment align) {
|
|||||||
if (align == CENTER)
|
if (align == CENTER)
|
||||||
x = x - w / 2;
|
x = x - w / 2;
|
||||||
int32_t cursor_y = y + h;
|
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(¤tFont, data, &x, &cursor_y, framebuffer);
|
write_string(¤tFont, 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) {
|
void mapView(void* args) {
|
||||||
framebuffer =
|
framebuffer =
|
||||||
(uint8_t*)heap_caps_malloc(EPD_WIDTH * EPD_HEIGHT / 2, MALLOC_CAP_SPIRAM);
|
(uint8_t*)heap_caps_malloc(EPD_WIDTH * EPD_HEIGHT / 2, MALLOC_CAP_SPIRAM);
|
||||||
@@ -54,6 +66,9 @@ void mapView(void* args) {
|
|||||||
currentFont = OpenSans26B;
|
currentFont = OpenSans26B;
|
||||||
drawString(x, y, "Hello, World!", CENTER);
|
drawString(x, y, "Hello, World!", CENTER);
|
||||||
|
|
||||||
|
drawVessel(EPD_WIDTH - EPD_WIDTH / 4, EPD_HEIGHT - EPD_HEIGHT / 5,
|
||||||
|
"DEEPENSCHRIEWER 1");
|
||||||
|
|
||||||
epd_poweron();
|
epd_poweron();
|
||||||
epd_clear();
|
epd_clear();
|
||||||
epd_draw_grayscale_image(epd_full_screen(), framebuffer);
|
epd_draw_grayscale_image(epd_full_screen(), framebuffer);
|
||||||
|
Reference in New Issue
Block a user