Prusa MINI Firmware overview
screen_test_gui.c File Reference
#include "gui.h"
#include "config.h"
#include "window_logo.h"
#include "stm32f4xx_hal.h"

Classes

struct  screen_test_gui_data_t
 

Macros

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

Functions

void screen_test_gui_init (screen_t *screen)
 
void screen_test_gui_done (screen_t *screen)
 
void screen_test_gui_draw (screen_t *screen)
 
int screen_test_gui_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

screen_t screen_test_gui
 
const screen_tpscreen_test_gui = &screen_test_gui
 

Macro Definition Documentation

◆ pd

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

Function Documentation

◆ screen_test_gui_init()

void screen_test_gui_init ( screen_t screen)
34  {
35  int16_t id;
36 
37  int16_t id0 = window_create_ptr(WINDOW_CLS_FRAME, -1, rect_ui16(0, 0, 0, 0), &(pd->frame));
38 
39  id = window_create_ptr(WINDOW_CLS_LOGO, id0, rect_ui16(10, 0, 0, 0), &(pd->logo_prusa_mini));
40  window_enable(id);
41  window_set_tag(id, 10);
42 
43  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(10, 70, 60, 22), &(pd->text0));
44  pd->text0.font = resource_font(IDR_FNT_BIG);
45  window_set_text(id, (const char *)"Big");
46 
47  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(80, 70, 60, 22), &(pd->text1));
48  pd->text1.font = resource_font(IDR_FNT_NORMAL); // ignore GUI_DEF_FONT
49  window_set_text(id, (const char *)"Normal");
50 
51  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(150, 70, 60, 22), &(pd->text2));
52  pd->text2.font = resource_font(IDR_FNT_SMALL);
53  window_set_text(id, (const char *)"Small");
54 
55  id = window_create_ptr(WINDOW_CLS_NUMB, id0, rect_ui16(10, 100, 60, 22), &(pd->numb0));
56  window_set_format(id, (const char *)"%.0f");
57  window_set_value(id, 100.0F);
58 
59  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(80, 100, 60, 22), &(pd->spin0));
60  window_set_format(id, "%1.0f");
61  window_set_min_max_step(id, 0.0F, 270.0F, 1.0F);
62  window_set_value(id, 100.0F);
63 
64  id = window_create_ptr(WINDOW_CLS_SPIN, id0, rect_ui16(150, 100, 60, 22), &(pd->spin1));
65  window_set_format(id, "%.3f");
66  window_set_min_max_step(id, 0.0F, 1.0F, 0.001F);
67  window_set_value(id, 1.000F);
68 
69  id = window_create_ptr(WINDOW_CLS_LIST, id0, rect_ui16(10, 130, 220, 66), &(pd->list));
70  window_set_item_index(id, 2);
71 
72  id = window_create_ptr(WINDOW_CLS_ICON, id0, rect_ui16(10, 234, 64, 64), &(pd->icon0));
74  window_enable(id);
75  window_set_tag(id, 1);
76 
77  id = window_create_ptr(WINDOW_CLS_ICON, id0, rect_ui16(80, 234, 64, 64), &(pd->icon1));
79  window_enable(id);
80  window_set_tag(id, 2);
81 
82  id = window_create_ptr(WINDOW_CLS_ICON, id0, rect_ui16(150, 234, 64, 64), &(pd->icon2));
84  window_enable(id);
85  window_set_tag(id, 3);
86 
87  id = window_create_ptr(WINDOW_CLS_PROGRESS, id0, rect_ui16(0, 200, 240, 30), &(pd->progress));
88  //window_set_icon_id(id, IDR_PNG_menu_icon_spool);
89  //window_enable(id);
90  //window_set_tag(id, 3);
91 
92  id = window_create_ptr(WINDOW_CLS_TEXT, id0, rect_ui16(0, 298, 240, 22), &(pd->text_terminal));
93  pd->text_terminal.font = resource_font(IDR_FNT_TERMINAL);
94  window_set_text(id, (const char *)"Terminal Font IBM ISO9");
95 }
Here is the call graph for this function:

◆ screen_test_gui_done()

void screen_test_gui_done ( screen_t screen)
97  {
98  window_destroy(pd->frame.win.id);
99 }
Here is the call graph for this function:

◆ screen_test_gui_draw()

void screen_test_gui_draw ( screen_t screen)
101  {
102 }

◆ screen_test_gui_event()

int screen_test_gui_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
104  {
105  if (event == WINDOW_EVENT_CLICK)
106  switch ((int)param) {
107  case 10:
108  screen_close();
109  return 1;
110  }
111  /* if (event == WINDOW_EVENT_LOOP)
112  {
113  float temp = window_get_value(screen->pd->spin0.window.win.id);
114  int val = sim_heater_temp2val(temp);
115  window_set_value(screen->pd->numb0.win.id, val);
116  }*/
117  return 0;
118 }
Here is the call graph for this function:

Variable Documentation

◆ screen_test_gui

◆ pscreen_test_gui

const screen_t* pscreen_test_gui = &screen_test_gui
IDR_PNG_menu_icon_spool
#define IDR_PNG_menu_icon_spool
Definition: resource.h:30
WINDOW_CLS_NUMB
#define WINDOW_CLS_NUMB
Definition: window.h:11
window_set_format
void window_set_format(int16_t id, const char *format)
Definition: window.c:403
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
IDR_FNT_NORMAL
#define IDR_FNT_NORMAL
Definition: resource.h:10
window_set_icon_id
void window_set_icon_id(int16_t id, uint16_t id_res)
Definition: window.c:659
IDR_PNG_menu_icon_preheat
#define IDR_PNG_menu_icon_preheat
Definition: resource.h:29
F
#define F(str)
Definition: UHS_macros.h:164
WINDOW_CLS_LOGO
int16_t WINDOW_CLS_LOGO
Definition: window_logo.c:11
screen_close
void screen_close(void)
Definition: screen.c:80
WINDOW_CLS_LIST
#define WINDOW_CLS_LIST
Definition: window.h:13
IDR_FNT_TERMINAL
#define IDR_FNT_TERMINAL
Definition: resource.h:12
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
WINDOW_CLS_SPIN
#define WINDOW_CLS_SPIN
Definition: window.h:15
WINDOW_CLS_PROGRESS
#define WINDOW_CLS_PROGRESS
Definition: window.h:20
WINDOW_CLS_FRAME
#define WINDOW_CLS_FRAME
Definition: window.h:9
window_set_value
void window_set_value(int16_t id, float value)
Definition: window.c:363
screen_test_gui_done
void screen_test_gui_done(screen_t *screen)
Definition: screen_test_gui.c:97
screen_test_gui_draw
void screen_test_gui_draw(screen_t *screen)
Definition: screen_test_gui.c:101
window_set_tag
void window_set_tag(int16_t id, uint8_t tag)
Definition: window.c:329
pd
#define pd
Definition: screen_test_gui.c:32
IDR_FNT_BIG
#define IDR_FNT_BIG
Definition: resource.h:11
screen_test_gui_data_t
Definition: screen_test_gui.c:11
WINDOW_CLS_ICON
#define WINDOW_CLS_ICON
Definition: window.h:12
screen_test_gui_event
int screen_test_gui_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_test_gui.c:104
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
resource_font
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
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
IDR_FNT_SMALL
#define IDR_FNT_SMALL
Definition: resource.h:9
window_set_min_max_step
void window_set_min_max_step(int16_t id, float min, float max, float step)
Definition: window.c:767
IDR_PNG_menu_icon_print
#define IDR_PNG_menu_icon_print
Definition: resource.h:28
screen_test_gui_init
void screen_test_gui_init(screen_t *screen)
Definition: screen_test_gui.c:34
window_set_item_index
void window_set_item_index(int16_t id, int index)
Definition: window.c:598