Prusa MINI Firmware overview
xyzcalib.h File Reference
#include <inttypes.h>
#include "gui.h"
#include "wizard_types.h"

Go to the source code of this file.

Classes

struct  xyzcalib_screen_t
 
struct  xyzcalib_data_t
 

Functions

void wizard_init_screen_xyzcalib (int16_t id_body, xyzcalib_screen_t *p_screen, xyzcalib_data_t *p_data)
 
int xyzcalib_home (int16_t id_body, xyzcalib_screen_t *p_screen, xyzcalib_data_t *p_data)
 
int xyzcalib_z (int16_t id_body, xyzcalib_screen_t *p_screen, xyzcalib_data_t *p_data)
 
int xyzcalib_xy_search (int16_t id_body, xyzcalib_screen_t *p_screen, xyzcalib_data_t *p_data)
 
int xyzcalib_xy_measure (int16_t id_body, xyzcalib_screen_t *p_screen, xyzcalib_data_t *p_data)
 
int xyzcalib_is_ok (int16_t id_body, xyzcalib_screen_t *p_screen, xyzcalib_data_t *p_data)
 

Function Documentation

◆ wizard_init_screen_xyzcalib()

void wizard_init_screen_xyzcalib ( int16_t  id_body,
xyzcalib_screen_t p_screen,
xyzcalib_data_t p_data 
)
13  {
14  int16_t id;
15  window_destroy_children(id_body);
16  window_show(id_body);
17  window_invalidate(id_body);
18 
19  uint16_t y = 40;
20  uint16_t x = WIZARD_MARGIN_LEFT;
21 
22  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 22), &(p_screen->text_state));
23  window_set_text(id, "Auto home");
24 
25  y += 22;
26 
27  id = window_create_ptr(WINDOW_CLS_PROGRESS, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 8), &(p_screen->progress));
28 
29  y += 12;
30 
31  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 66), &(p_screen->text_search));
32  window_set_text(id, "");
33 
34  y += 66;
35 
36  id = window_create_ptr(WINDOW_CLS_ICON, id_body, rect_ui16((240 - 100) / 2, y, 100, 100), &(p_screen->icon));
37 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xyzcalib_home()

int xyzcalib_home ( int16_t  id_body,
xyzcalib_screen_t p_screen,
xyzcalib_data_t p_data 
)
39  {
40  if (p_data->state_home == _TEST_START) {
41  wizard_init_screen_xyzcalib(id_body, p_screen, p_data);
43  marlin_gcode("G28");
44  while (!(marlin_busy() || marlin_motion()))
45  osDelay(10);
46  } else if (!(marlin_busy() || marlin_motion()))
47  p_data->state_home = _TEST_PASSED;
48  int progress = wizard_timer(&p_screen->timer0, 5000, &(p_data->state_home), _WIZ_TIMER);
49  window_set_value(p_screen->progress.win.id, (float)progress);
50  return progress;
51 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xyzcalib_z()

int xyzcalib_z ( int16_t  id_body,
xyzcalib_screen_t p_screen,
xyzcalib_data_t p_data 
)
53  {
54  if (p_data->state_z == _TEST_START) {
55  window_set_text(p_screen->text_state.win.id, "Calibrating Z");
57  }
58  int progress = wizard_timer(&p_screen->timer0, 5000, &(p_data->state_z), _WIZ_TIMER_AUTOPASS);
59  window_set_value(p_screen->progress.win.id, (float)progress);
60  return progress;
61 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xyzcalib_xy_search()

int xyzcalib_xy_search ( int16_t  id_body,
xyzcalib_screen_t p_screen,
xyzcalib_data_t p_data 
)
63  {
64  if (p_data->state_xy_search == _TEST_START) {
66  "Searching bed\n"
67  "calibration points");
69  }
70  int progress = wizard_timer(&p_screen->timer0, 5000, &(p_data->state_xy_search), _WIZ_TIMER_AUTOPASS);
71  window_set_value(p_screen->progress.win.id, (float)progress);
72  return progress;
73 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xyzcalib_xy_measure()

int xyzcalib_xy_measure ( int16_t  id_body,
xyzcalib_screen_t p_screen,
xyzcalib_data_t p_data 
)
75  {
76  if (p_data->state_xy_measure == _TEST_START) {
78  "Measuring reference\n"
79  "height of calib.\n"
80  "points");
82  marlin_gcode("G29");
83  while (!(marlin_busy() || marlin_motion()))
84  osDelay(10);
85  } else if (!(marlin_busy() || marlin_motion()))
87  int progress = wizard_timer(&p_screen->timer0, 5000, &(p_data->state_xy_measure), _WIZ_TIMER);
88  window_set_value(p_screen->progress.win.id, (float)progress);
89  return progress;
90 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xyzcalib_is_ok()

int xyzcalib_is_ok ( int16_t  id_body,
xyzcalib_screen_t p_screen,
xyzcalib_data_t p_data 
)
92  {
93  int ok = 1;
94  ok &= (p_data->state_home == _TEST_PASSED);
95  ok &= (p_data->state_z == _TEST_PASSED);
96  ok &= (p_data->state_xy_search == _TEST_PASSED);
97  ok &= (p_data->state_xy_measure == _TEST_PASSED);
98  return ok;
99 }
Here is the caller graph for this function:
IDR_PNG_wizard_icon_measure
#define IDR_PNG_wizard_icon_measure
Definition: resource.h:59
xyzcalib_screen_t::timer0
uint32_t timer0
Definition: xyzcalib.h:18
xyzcalib_screen_t::text_search
window_text_t text_search
Definition: xyzcalib.h:16
window_destroy_children
void window_destroy_children(int16_t id)
Definition: window.c:157
window_invalidate
void window_invalidate(int16_t id)
Definition: window.c:304
rect_ui16
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
WIZARD_MARGIN_LEFT
#define WIZARD_MARGIN_LEFT
Definition: wizard_ui.h:8
window_set_icon_id
void window_set_icon_id(int16_t id, uint16_t id_res)
Definition: window.c:659
xyzcalib_data_t::state_home
_TEST_STATE_t state_home
Definition: xyzcalib.h:24
window_show
void window_show(int16_t id)
Definition: window.c:529
osDelay
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
Definition: cmsis_os.c:365
_window_t::id
int16_t id
Definition: window.h:79
_window_icon_t::win
window_t win
Definition: window_icon.h:12
WIZARD_X_SPACE
#define WIZARD_X_SPACE
Definition: wizard_ui.h:10
xyzcalib_data_t::state_z
_TEST_STATE_t state_z
Definition: xyzcalib.h:25
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
marlin_motion
int marlin_motion(void)
Definition: marlin_client.c:182
WINDOW_CLS_PROGRESS
#define WINDOW_CLS_PROGRESS
Definition: window.h:20
xyzcalib_data_t::state_xy_measure
_TEST_STATE_t state_xy_measure
Definition: xyzcalib.h:28
xyzcalib_screen_t::text_state
window_text_t text_state
Definition: xyzcalib.h:15
xyzcalib_screen_t::progress
window_progress_t progress
Definition: xyzcalib.h:14
window_set_value
void window_set_value(int16_t id, float value)
Definition: window.c:363
marlin_busy
int marlin_busy(void)
Definition: marlin_client.c:152
IDR_PNG_wizard_icon_autohome
#define IDR_PNG_wizard_icon_autohome
Definition: resource.h:57
marlin_gcode
void marlin_gcode(const char *gcode)
Definition: marlin_client.c:195
WINDOW_CLS_ICON
#define WINDOW_CLS_ICON
Definition: window.h:12
_WIZ_TIMER_AUTOPASS
Definition: wizard_ui.h:20
xyzcalib_data_t::state_xy_search
_TEST_STATE_t state_xy_search
Definition: xyzcalib.h:27
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
_TEST_START
Definition: wizard_types.h:85
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
wizard_timer
int wizard_timer(uint32_t *p_timer, uint32_t delay_ms, _TEST_STATE_t *pstate, _WIZ_TIMER_t type)
Definition: wizard_ui.c:58
wizard_init_screen_xyzcalib
void wizard_init_screen_xyzcalib(int16_t id_body, xyzcalib_screen_t *p_screen, xyzcalib_data_t *p_data)
Definition: xyzcalib.c:13
IDR_PNG_wizard_icon_search
#define IDR_PNG_wizard_icon_search
Definition: resource.h:58
xyzcalib_screen_t::icon
window_icon_t icon
Definition: xyzcalib.h:17
_window_progress_t::win
window_t win
Definition: window_progress.h:16
IDR_PNG_wizard_icon_hourglass
#define IDR_PNG_wizard_icon_hourglass
Definition: resource.h:56
_WIZ_TIMER
Definition: wizard_ui.h:19
_window_text_t::win
window_t win
Definition: window_text.h:16
_TEST_PASSED
Definition: wizard_types.h:87