Prusa MINI Firmware overview
screen_test.c File Reference
#include "gui.h"
#include "config.h"
#include "dbg.h"
#include "stm32f4xx_hal.h"
#include "bsod.h"

Classes

struct  screen_test_data_t
 

Macros

#define pd   ((screen_test_data_t *)screen->pdata)
 

Functions

void screen_test_init (screen_t *screen)
 
void screen_test_done (screen_t *screen)
 
void screen_test_draw (screen_t *screen)
 
int screen_test_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

screen_tpscreen_test_gui
 
screen_tpscreen_test_term
 
screen_tpscreen_test_msgbox
 
screen_tpscreen_test_graph
 
screen_tpscreen_test_temperature
 
screen_tpscreen_test_disp_mem
 
screen_t screen_test
 
const screen_tpscreen_test = &screen_test
 

Macro Definition Documentation

◆ pd

#define pd   ((screen_test_data_t *)screen->pdata)

Function Documentation

◆ screen_test_init()

void screen_test_init ( screen_t screen)
39  {
40  int16_t id;
41 
42  int16_t y = 32;
43 
44  int16_t id0 = window_create_ptr(WINDOW_CLS_FRAME, -1, rect_ui16(0, 0, 0, 0), &(pd->frame));
45 
46  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst));
47  window_set_text(id, (const char *)"TEST");
48  y += 22;
49 
50  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->back));
51  window_set_text(id, (const char *)"back");
52  window_enable(id);
53  window_set_tag(id, 1);
54  y += 22;
55 
56  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst_gui));
57  window_set_text(id, (const char *)"test GUI");
58  window_enable(id);
59  window_set_tag(id, 2);
60  y += 22;
61 
62  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst_term));
63  window_set_text(id, (const char *)"test TERM");
64  window_enable(id);
65  window_set_tag(id, 3);
66  y += 22;
67 
68  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst_msgbox));
69  window_set_text(id, (const char *)"test MSGBOX");
70  window_enable(id);
71  window_set_tag(id, 4);
72  y += 22;
73 
74  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst_graph));
75  window_set_text(id, (const char *)"temp graph");
76  window_enable(id);
77  window_set_tag(id, 5);
78  y += 22;
79 
80  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst_temperature));
81  window_set_text(id, (const char *)"temp - pwm");
82  window_enable(id);
83  window_set_tag(id, 6);
84  y += 22;
85 
86  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst_heat_err));
87  window_set_text(id, (const char *)"HEAT ERROR");
88  window_enable(id);
89  window_set_tag(id, 7);
90  y += 22;
91 
92  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, y, 220, 22), &(pd->tst_disp_memory));
93  window_set_text(id, (const char *)"Disp. R/W");
94  window_enable(id);
95  window_set_tag(id, 8);
96 
97  pd->id_tim = gui_timer_create_oneshot(2000, id0);
98  pd->id_tim1 = gui_timer_create_periodical(4000, id0);
99 }
Here is the call graph for this function:

◆ screen_test_done()

void screen_test_done ( screen_t screen)
101  {
102  window_destroy(pd->frame.win.id);
103 }
Here is the call graph for this function:

◆ screen_test_draw()

void screen_test_draw ( screen_t screen)
105  {
106 }

◆ screen_test_event()

int screen_test_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
108  {
109  if (event == WINDOW_EVENT_CLICK)
110  switch ((int)param) {
111  case 1:
112  screen_close();
113  return 1;
114  case 2:
116  return 1;
117  case 3:
119  return 1;
120  case 4:
122  return 1;
123  case 5:
125  return 1;
126  case 6:
128  return 1;
129  case 7:
130  temp_error("TEST BED ERROR", "Bed", 1.0, 2.0, 3.0, 4.0);
131  return 1;
132  case 8:
134  return 1;
135  }
136  else if (event == WINDOW_EVENT_TIMER) {
137  if ((int)param == pd->id_tim)
138  _dbg("tim0 %lu", HAL_GetTick());
139  else if ((int)param == pd->id_tim1)
140  _dbg("tim1 %lu", HAL_GetTick());
141  return 1;
142  }
143  return 0;
144 }
Here is the call graph for this function:

Variable Documentation

◆ pscreen_test_gui

screen_t* pscreen_test_gui

◆ pscreen_test_term

screen_t* pscreen_test_term

◆ pscreen_test_msgbox

screen_t* pscreen_test_msgbox

◆ pscreen_test_graph

screen_t* pscreen_test_graph

◆ pscreen_test_temperature

screen_t* pscreen_test_temperature

◆ pscreen_test_disp_mem

screen_t* pscreen_test_disp_mem

◆ screen_test

screen_t screen_test

◆ pscreen_test

const screen_t* pscreen_test = &screen_test
screen_test_event
int screen_test_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_test.c:108
pscreen_test_term
screen_t * pscreen_test_term
Definition: screen_test_term.c:78
screen_test_done
void screen_test_done(screen_t *screen)
Definition: screen_test.c:101
rect_ui16
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
window_destroy
void window_destroy(int16_t id)
Definition: window.c:132
screen_open
void screen_open(int16_t screen_id)
Definition: screen.c:62
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
screen_close
void screen_close(void)
Definition: screen.c:80
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
WINDOW_CLS_FRAME
#define WINDOW_CLS_FRAME
Definition: window.h:9
screen_test_data_t
Definition: screen_test.c:19
window_set_tag
void window_set_tag(int16_t id, uint8_t tag)
Definition: window.c:329
_dbg
#define _dbg(...)
Definition: dbg.h:50
screen_test_draw
void screen_test_draw(screen_t *screen)
Definition: screen_test.c:105
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
pscreen_test_graph
screen_t * pscreen_test_graph
Definition: screen_test_graph.c:111
gui_timer_create_periodical
int8_t gui_timer_create_periodical(uint32_t ms, int16_t win_id)
Definition: gui_timer.c:70
gui_timer_create_oneshot
int8_t gui_timer_create_oneshot(uint32_t ms, int16_t win_id)
Definition: gui_timer.c:66
window_create_ptr
int16_t window_create_ptr(int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
Definition: window.c:102
window_enable
void window_enable(int16_t id)
Definition: window.c:517
pscreen_test_msgbox
screen_t * pscreen_test_msgbox
Definition: screen_test_msgbox.c:147
_screen_t::id
int16_t id
Definition: screen.h:19
WINDOW_EVENT_TIMER
#define WINDOW_EVENT_TIMER
Definition: window.h:50
pscreen_test_disp_mem
screen_t * pscreen_test_disp_mem
Definition: screen_test_disp_mem.c:629
pd
#define pd
Definition: screen_test.c:37
temp_error
void temp_error(const char *error, const char *module, float t_noz, float tt_noz, float t_bed, float tt_bed)
Definition: bsod.c:207
pscreen_test_gui
screen_t * pscreen_test_gui
Definition: screen_test_gui.c:131
pscreen_test_temperature
screen_t * pscreen_test_temperature
Definition: screen_test_temperature.cpp:109
screen_test_init
void screen_test_init(screen_t *screen)
Definition: screen_test.c:39