fixed X font drawing skew

This commit is contained in:
Jelmer
2023-01-30 17:14:00 +01:00
parent 0f0c86d5f8
commit 30abbcaa14
2 changed files with 13 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
#include "epd.h"
#include <stdbool.h>
#include <string.h>
#include "asmUtil.h"
#include "board.h"
#include "cpu.h"
@@ -282,8 +284,8 @@ void setWindowY(uint16_t start, uint16_t end) {
commandBegin(CMD_WINDOW_Y_SIZE);
epdSend((start)&0xff);
epdSend((start) >> 8);
epdSend((end)&0xff); // was end-1
epdSend((end) >> 8); // was end-1
epdSend((end-1)&0xff);
epdSend((end-1) >> 8);
commandEnd();
}
void setPosXY(uint16_t x, uint16_t y) {
@@ -379,7 +381,7 @@ void loadRawBitmap(uint8_t* bmp, uint16_t x, uint16_t y, bool color) {
uint16_t xsize = bmp[0] / 8;
if (bmp[0] % 8) xsize++;
uint16_t size = xsize * bmp[1];
setWindowX(x, x+(xsize*8));
setWindowX(x, x + (xsize * 8));
setWindowY(y, bmp[1] + y);
setPosXY(x, y);
shortCommand1(CMD_DATA_ENTRY_MODE, 3);
@@ -395,7 +397,6 @@ void loadRawBitmap(uint8_t* bmp, uint16_t x, uint16_t y, bool color) {
commandEnd();
}
// stuff for printing text
static void pushXFontBytesToEPD(uint8_t byte1, uint8_t byte2) {
if (epdCharSize == 1) {
@@ -543,7 +544,7 @@ void epdPrintBegin(uint16_t x, uint16_t y, bool direction, bool fontsize, bool c
rbuffer[1] = 0;
}
setWindowY(y, 0);
setWindowY(y, 1);
if (epdCharSize == 2) {
setWindowX(x, x + 32 + extra);
setPosXY(x, y);

View File

@@ -27,6 +27,7 @@ void showSplashScreen() {
loadRawBitmap(solum, 0, 32, EPD_COLOR_BLACK);
loadRawBitmap(hacked, 16, 44, EPD_COLOR_RED);
epdPrintBegin(0, 0, EPD_DIRECTION_X, EPD_SIZE_DOUBLE, EPD_COLOR_BLACK);
pr("Starting!");
@@ -83,6 +84,12 @@ void showSplashScreen() {
pr(":%02X:%02X", mSelfMac[1], mSelfMac[0]);
epdPrintEnd();
loadRawBitmap(solum, 256, 10, EPD_COLOR_BLACK);
loadRawBitmap(hacked, 264, 22, EPD_COLOR_RED);
loadRawBitmap(solum,253, 72, EPD_COLOR_BLACK);
loadRawBitmap(hacked, 261, 82, EPD_COLOR_RED);
draw();
timerDelay(1333000);
#endif