Prusa MINI Firmware overview
|
#include <inttypes.h>
#include <stdlib.h>
#include "cmsis_os.h"
#include "dbg.h"
#include "gui.h"
#include "resource.h"
|
void | test_display_random_dots (uint16_t cnt) |
|
void | test_display_random_lines (uint16_t cnt) |
|
void | test_display_random_rects (uint16_t cnt) |
|
void | test_display_random_filled_rects (uint16_t cnt) |
|
void | test_display_random_chars_small (uint16_t cnt) |
|
void | test_display_random_chars_normal (uint16_t cnt) |
|
void | test_display_random_chars_big (uint16_t cnt) |
|
void | test_display_random_chars_terminal (uint16_t cnt) |
|
void | test_display_fade (uint16_t cnt) |
|
void | test_display_rgbcolors (uint16_t cnt) |
|
void | test_display_spectrum (uint16_t cnt) |
|
void | do_test (test_display_t *func, int cnt, char *name, char *unit) |
|
void | test_display (void) |
|
void | test_display_random_chars (uint16_t cnt, font_t *font) |
|
void | spectral_color (float l, float *pr, float *pg, float *pb) |
|
void | display_fill_rect_sub_rect (rect_ui16_t rc, rect_ui16_t rc1, color_t clr) |
|
void | test_display_random_png_64x64 (uint16_t count) |
|
int | __read (struct _reent *_r, void *pv, char *pc, int n) |
|
int | __write (struct _reent *_r, void *pv, const char *pc, int n) |
|
void | test_display2 (void) |
|
◆ test_display_t
typedef void() test_display_t(uint16_t cnt) |
◆ test_display_random_dots()
void test_display_random_dots |
( |
uint16_t |
cnt | ) |
|
65 for (n = 0; n < cnt; n++) {
66 x =
display->
w * ((float)rand() / RAND_MAX);
67 y =
display->
h * ((float)rand() / RAND_MAX);
68 r = 0xff * ((float)rand() / RAND_MAX);
69 g = 0xff * ((float)rand() / RAND_MAX);
70 b = 0xff * ((float)rand() / RAND_MAX);
◆ test_display_random_lines()
void test_display_random_lines |
( |
uint16_t |
cnt | ) |
|
86 for (n = 0; n < cnt; n++) {
87 x =
display->
w * ((float)rand() / RAND_MAX);
88 y =
display->
h * ((float)rand() / RAND_MAX);
89 x1 =
display->
w * ((float)rand() / RAND_MAX);
90 y1 =
display->
h * ((float)rand() / RAND_MAX);
91 r = 0xff * ((float)rand() / RAND_MAX);
92 g = 0xff * ((float)rand() / RAND_MAX);
93 b = 0xff * ((float)rand() / RAND_MAX);
◆ test_display_random_rects()
void test_display_random_rects |
( |
uint16_t |
cnt | ) |
|
109 for (n = 0; n < cnt; n++) {
110 x =
display->
w * ((float)rand() / RAND_MAX);
111 y =
display->
h * ((float)rand() / RAND_MAX);
112 w = (
display->
w - x) * ((
float)rand() / RAND_MAX);
113 h = (
display->
h - y) * ((
float)rand() / RAND_MAX);
114 r = 0xff * ((float)rand() / RAND_MAX);
115 g = 0xff * ((float)rand() / RAND_MAX);
116 b = 0xff * ((float)rand() / RAND_MAX);
◆ test_display_random_filled_rects()
void test_display_random_filled_rects |
( |
uint16_t |
cnt | ) |
|
132 for (n = 0; n < cnt; n++) {
133 x =
display->
w * ((float)rand() / RAND_MAX);
134 y =
display->
h * ((float)rand() / RAND_MAX);
135 w = (
display->
w - x) * ((
float)rand() / RAND_MAX);
136 h = (
display->
h - y) * ((
float)rand() / RAND_MAX);
137 r = 0xff * ((float)rand() / RAND_MAX);
138 g = 0xff * ((float)rand() / RAND_MAX);
139 b = 0xff * ((float)rand() / RAND_MAX);
◆ test_display_random_chars_small()
void test_display_random_chars_small |
( |
uint16_t |
cnt | ) |
|
◆ test_display_random_chars_normal()
void test_display_random_chars_normal |
( |
uint16_t |
cnt | ) |
|
◆ test_display_random_chars_big()
void test_display_random_chars_big |
( |
uint16_t |
cnt | ) |
|
◆ test_display_random_chars_terminal()
void test_display_random_chars_terminal |
( |
uint16_t |
cnt | ) |
|
◆ test_display_fade()
void test_display_fade |
( |
uint16_t |
cnt | ) |
|
244 for (
i = 0;
i < cnt;
i++) {
245 b = 255 *
i / (cnt - 1);
◆ test_display_rgbcolors()
void test_display_rgbcolors |
( |
uint16_t |
cnt | ) |
|
274 "RED",
"LIME",
"BLUE",
275 "YELLOW",
"CYAN",
"MAGENTA",
277 "MAROON",
"OLIVE",
"GREEN",
278 "PURPLE",
"TEAL",
"NAVY"
280 int count =
sizeof(colors) /
sizeof(
color_t);
282 int item_height = 20;
285 for (n = 0; n < cnt; n++)
286 for (
i = 0;
i < count;
i++) {
287 int chars = strlen(names[
i]);
288 int text_w = chars * font->
w;
289 int text_h = font->
h;
◆ test_display_spectrum()
void test_display_spectrum |
( |
uint16_t |
cnt | ) |
|
307 for (n = 0; n < cnt; n++)
309 l = 400.0F + (3.0F * y / 3.2F);
◆ do_test()
33 float spd = (float)cnt * 1000000 / tim;
34 _dbg3(
" %-20.20s %5u %5.5ss/sec %5uus/%-5.5s",
name, (uint32_t)spd,
unit, tim / cnt,
unit);
◆ test_display()
41 _dbg3(
"test_display start");
53 _dbg3(
"test_display end\n");
◆ test_display_random_chars()
void test_display_random_chars |
( |
uint16_t |
cnt, |
|
|
font_t * |
font |
|
) |
| |
155 for (n = 0; n < cnt; n++) {
156 x = (
display->
w - font->
w) * ((
float)rand() / RAND_MAX);
157 y = (
display->
h - font->
h) * ((
float)rand() / RAND_MAX);
160 r = 0xff * ((float)rand() / RAND_MAX);
161 g = 0xff * ((float)rand() / RAND_MAX);
162 b = 0xff * ((float)rand() / RAND_MAX);
164 r = 0xff * ((float)rand() / RAND_MAX);
165 g = 0xff * ((float)rand() / RAND_MAX);
166 b = 0xff * ((float)rand() / RAND_MAX);
◆ spectral_color()
void spectral_color |
( |
float |
l, |
|
|
float * |
pr, |
|
|
float * |
pg, |
|
|
float * |
pb |
|
) |
| |
199 if ((l >= 400.0
F) && (l < 410.0
F)) {
200 t = (l - 400.0F) / (410.0
F - 400.0
F);
201 r = +(0.33F * t) - (0.20
F * t * t);
202 }
else if ((l >= 410.0
F) && (l < 475.0F)) {
203 t = (l - 410.0F) / (475.0
F - 410.0
F);
204 r = 0.14F - (0.13F * t * t);
205 }
else if ((l >= 545.0
F) && (l < 595.0F)) {
206 t = (l - 545.0F) / (595.0
F - 545.0
F);
207 r = +(1.98F * t) - (t * t);
208 }
else if ((l >= 595.0
F) && (l < 650.0F)) {
209 t = (l - 595.0F) / (650.0
F - 595.0
F);
210 r = 0.98F + (0.06F * t) - (0.40
F * t * t);
211 }
else if ((l >= 650.0
F) && (l < 700.0F)) {
212 t = (l - 650.0F) / (700.0
F - 650.0
F);
213 r = 0.65F - (0.84F * t) + (0.20
F * t * t);
215 if ((l >= 415.0
F) && (l < 475.0F)) {
216 t = (l - 415.0F) / (475.0
F - 415.0
F);
217 g = +(0.80F * t * t);
218 }
else if ((l >= 475.0
F) && (l < 590.0F)) {
219 t = (l - 475.0F) / (590.0
F - 475.0
F);
220 g = 0.80F + (0.76F * t) - (0.80
F * t * t);
221 }
else if ((l >= 585.0
F) && (l < 639.0F)) {
222 t = (l - 585.0F) / (639.0
F - 585.0
F);
223 g = 0.84F - (0.84F * t);
225 if ((l >= 400.0
F) && (l < 475.0F)) {
226 t = (l - 400.0F) / (475.0
F - 400.0
F);
227 b = +(2.20F * t) - (1.50
F * t * t);
228 }
else if ((l >= 475.0
F) && (l < 560.0F)) {
229 t = (l - 475.0F) / (560.0
F - 475.0
F);
230 b = 0.70F - (t) + (0.30
F * t * t);
◆ display_fill_rect_sub_rect()
◆ test_display_random_png_64x64()
void test_display_random_png_64x64 |
( |
uint16_t |
count | ) |
|
334 for (n = 0; n < count; n++) {
335 x = (
display->
w - 64) * ((
float)rand() / RAND_MAX);
336 y = (
display->
h - 64) * ((
float)rand() / RAND_MAX);
◆ __read()
int __read |
( |
struct _reent * |
_r, |
|
|
void * |
pv, |
|
|
char * |
pc, |
|
|
int |
n |
|
) |
| |
◆ __write()
int __write |
( |
struct _reent * |
_r, |
|
|
void * |
pv, |
|
|
const char * |
pc, |
|
|
int |
n |
|
) |
| |
◆ test_display2()
386 _dbg3(
"display_clear %u", tim);
394 spd = 100 * 1000000 / tim;
395 _dbg3(
"test_random_png_64x64 %u (%u icons/sec)", tim, spd);
◆ png_icon_64x64_noise
◆ png_icon_64x64_noise_size
const uint16_t png_icon_64x64_noise_size |
#define COLOR_MAROON
Definition: guitypes.h:51
uint16_t y
Definition: guitypes.h:71
uint8_t h
Definition: guitypes.h:78
uint16_t h
Definition: display.h:26
uint16_t w
Definition: guitypes.h:72
Definition: guitypes.h:76
#define COLOR_NAVY
Definition: guitypes.h:56
display_draw_char_t * draw_char
Definition: display.h:34
#define COLOR_WHITE
Definition: guitypes.h:41
#define COLOR_TEAL
Definition: guitypes.h:55
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define COLOR_RED
Definition: guitypes.h:42
#define COLOR_MAGENTA
Definition: guitypes.h:48
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
#define IDR_FNT_NORMAL
Definition: resource.h:10
uint8_t i
Definition: screen_test_graph.c:72
uint32_t _microseconds(void)
Definition: dbg.c:113
#define _dbg3(...)
Definition: dbg.h:15
#define COLOR_LIME
Definition: guitypes.h:44
display_draw_text_t * draw_text
Definition: display.h:35
#define F(str)
Definition: UHS_macros.h:164
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
Definition: cmsis_os.c:365
display_fill_rect_t * fill_rect
Definition: display.h:33
void test_display_random_dots(uint16_t cnt)
Definition: test_display.c:57
#define COLOR_GRAY
Definition: guitypes.h:50
#define COLOR_YELLOW
Definition: guitypes.h:46
#define IDR_FNT_TERMINAL
Definition: resource.h:12
void test_display_random_chars_big(uint16_t cnt)
Definition: test_display.c:182
#define COLOR_GREEN
Definition: guitypes.h:53
void test_display_random_chars_normal(uint16_t cnt)
Definition: test_display.c:177
char asc_max
Definition: guitypes.h:83
const uint8_t png_icon_64x64_noise[]
Definition: png_icon_64x64_noise.c:4
#define COLOR_PURPLE
Definition: guitypes.h:54
void test_display_random_filled_rects(uint16_t cnt)
Definition: test_display.c:122
uint8_t w
Definition: guitypes.h:77
char name[2]
Definition: netif.h:307
display_draw_png_t * draw_png
Definition: display.h:37
const uint16_t png_icon_64x64_noise_size
Definition: png_icon_64x64_noise.c:5101
void do_test(test_display_t *func, int cnt, char *name, char *unit)
Definition: test_display.c:24
void test_display_random_chars_small(uint16_t cnt)
Definition: test_display.c:172
display_set_pixel_t * set_pixel
Definition: display.h:30
display_clear_t * clear
Definition: display.h:29
void test_display_random_png_64x64(uint16_t count)
Definition: test_display.c:325
Definition: guitypes.h:69
const uint8_t[]
Definition: 404_html.c:3
#define IDR_FNT_BIG
Definition: resource.h:11
display_t * display
Definition: display.c:6
uint16_t h
Definition: guitypes.h:73
#define COLOR_BLUE
Definition: guitypes.h:45
display_draw_rect_t * draw_rect
Definition: display.h:32
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
#define COLOR_CYAN
Definition: guitypes.h:47
#define IDR_FNT_SMALL
Definition: resource.h:9
#define COLOR_BLACK
Definition: guitypes.h:40
uint16_t x
Definition: guitypes.h:70
uint16_t w
Definition: display.h:25
static color_t color_rgb(uint8_t r, uint8_t g, uint8_t b)
Definition: guitypes.h:128
uint32_t color_t
Definition: guitypes.h:62
#define COLOR_SILVER
Definition: guitypes.h:49
#define COLOR_OLIVE
Definition: guitypes.h:52
void display_fill_rect_sub_rect(rect_ui16_t rc, rect_ui16_t rc1, color_t clr)
Definition: test_display.c:251
char asc_min
Definition: guitypes.h:82
void test_display_random_chars(uint16_t cnt, font_t *font)
Definition: test_display.c:145
void test_display_fade(uint16_t cnt)
Definition: test_display.c:240
void test_display_random_rects(uint16_t cnt)
Definition: test_display.c:99
void test_display_random_chars_terminal(uint16_t cnt)
Definition: test_display.c:187
void test_display_random_lines(uint16_t cnt)
Definition: test_display.c:76
void spectral_color(float l, float *pr, float *pg, float *pb)
Definition: test_display.c:194
list b
Definition: createSpeedLookupTable.py:30
void test_display_spectrum(uint16_t cnt)
Definition: test_display.c:298
display_draw_line_t * draw_line
Definition: display.h:31
void test_display_rgbcolors(uint16_t cnt)
Definition: test_display.c:263
static point_ui16_t point_ui16(uint16_t x, uint16_t y)
Definition: guitypes.h:154