The garbled text appeared

This commit is contained in:
Stanislav N Mikhailov
2025-01-01 15:48:41 +03:00
parent a7f3d94c1b
commit 7b87f90ae8
8 changed files with 75 additions and 265 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ from PIL import Image
def convert_bmp_to_linear_image(bmp_path, img_width, img_height, char_width, char_height, output_c_path, header_path):
# Открываем BMP файл и конвертируем его в монохромное изображение
image = Image.open(bmp_path).convert("1")
image = Image.open(bmp_path)
width, height = image.size
if width != img_width or height != img_height:
@@ -57,8 +57,8 @@ def convert_bmp_to_linear_image(bmp_path, img_width, img_height, char_width, cha
# Пример вызова функции
bmp_path = "Font/font_grid_with_cyrillic.bmp" # Замените на ваш путь
img_width = 704 # Укажите ширину изображения
img_height = 242 # Укажите высоту изображения
img_width = 7744 # Укажите ширину изображения
img_height = 22 # Укажите высоту изображения
char_width = 22 # Укажите ширину символа
char_height = 22 # Укажите высоту символа
output_c_path = "font_data_dirt.c"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

+1 -1
View File
@@ -2,7 +2,7 @@ from PIL import Image, ImageDraw, ImageFont
# Настройки
font_size = 20 # Размер шрифта
chars_per_row = 32 # Количество символов в строке
chars_per_row = 352 # Количество символов в строке
grid_size = font_size + 2 # Размер ячейки (с отступами)
font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSerifCondensed.ttf" # Путь к шрифту
+1 -1
View File
@@ -65,7 +65,7 @@ void st7789_init() {
sleep_ms(150);
st7789_send_command(0x36); // Memory data access control 215
st7789_send_data(0b00110000); // RGB
st7789_send_data(0b10100000); // RGB
//st7789_send_data(0b00101000); // BGR
st7789_send_command(0x3A); // Interface pixel format
+47 -260
View File
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
// Изображение, сгенерированное из Font/font_grid_with_cyrillic.bmp
#include <stdint.h>
const uint16_t image_linear_width = 7744;
const uint8_t char_width = 22;
const uint8_t char_height = 22;
const uint16_t total_chars = 352;
+12
View File
@@ -0,0 +1,12 @@
#ifndef IMAGE_DATA_H
#define IMAGE_DATA_H
#include <stdint.h>
extern const uint16_t image_linear_width;
extern const uint8_t char_width;
extern const uint8_t char_height;
extern const uint16_t total_chars;
extern const uint8_t image_data[];
#endif // IMAGE_DATA_H
+3
View File
@@ -42,6 +42,9 @@ int main() {
minmax=true;}
else freq+=0.005;
}
set_pixel(0,0,reverse(0b1111100000000000));
//sleep_ms(20);
}