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

Go to the source code of this file.

Classes

struct  selftest_home_screen_t
 
struct  selftest_home_data_t
 

Functions

void wizard_init_screen_selftest_home (int16_t id_body, selftest_home_screen_t *p_screen, selftest_home_data_t *p_data)
 
int wizard_selftest_home (int16_t id_body, selftest_home_screen_t *p_screen, selftest_home_data_t *p_data)
 

Function Documentation

◆ wizard_init_screen_selftest_home()

void wizard_init_screen_selftest_home ( int16_t  id_body,
selftest_home_screen_t p_screen,
selftest_home_data_t p_data 
)
8  {
9  int16_t id;
10  window_destroy_children(id_body);
11  window_show(id_body);
12  window_invalidate(id_body);
13 
14  uint16_t y = 40;
15  uint16_t x = WIZARD_MARGIN_LEFT;
16 
17  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 22), &(p_screen->text_calib_home));
18  window_set_text(id, "Calibrating home");
19 
20  y += 22;
21 
22  id = window_create_ptr(WINDOW_CLS_PROGRESS, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 8), &(p_screen->progress));
23 
24  id = window_create_ptr(WINDOW_CLS_ICON, id_body, rect_ui16(100, 140, 40, 40), &(p_screen->icon_hourglass));
26 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_home()

int wizard_selftest_home ( int16_t  id_body,
selftest_home_screen_t p_screen,
selftest_home_data_t p_data 
)
28  {
29  static uint8_t phase = 0;
30  if (p_data->state_home == _TEST_START) {
31  wizard_init_screen_selftest_home(id_body, p_screen, p_data);
32  marlin_gcode("M121");
33  phase = 1;
34  } else
35  switch (phase) {
36  case 1:
37  marlin_gcode("G28 X");
38  marlin_wait_motion(100);
39  phase++;
40  break;
41  case 2:
42  if ((marlin_busy() || marlin_motion()))
43  break;
44  phase++;
45  break;
46  case 3:
47  marlin_gcode("G28 Y");
48  marlin_wait_motion(100);
49  phase++;
50  break;
51  case 4:
52  if ((marlin_busy() || marlin_motion()))
53  break;
54  phase++;
55  break;
56  case 5:
57  p_data->state_home = _TEST_PASSED;
58  break;
59  }
60  int progress = wizard_timer(&p_screen->timer, 10000, &(p_data->state_home), _WIZ_TIMER);
61  window_set_value(p_screen->progress.win.id, (float)progress);
62  return progress;
63 }
Here is the call graph for this function:
Here is the caller graph for this function:
marlin_wait_motion
int marlin_wait_motion(uint32_t timeout)
Definition: marlin_client.c:187
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
selftest_home_screen_t::text_calib_home
window_text_t text_calib_home
Definition: selftest_home.h:19
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
window_show
void window_show(int16_t id)
Definition: window.c:529
_window_t::id
int16_t id
Definition: window.h:79
selftest_home_screen_t::progress
window_progress_t progress
Definition: selftest_home.h:18
WIZARD_X_SPACE
#define WIZARD_X_SPACE
Definition: wizard_ui.h:10
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
selftest_home_data_t::state_home
_TEST_STATE_t state_home
Definition: selftest_home.h:27
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
marlin_gcode
void marlin_gcode(const char *gcode)
Definition: marlin_client.c:195
uint8_t
const uint8_t[]
Definition: 404_html.c:3
WINDOW_CLS_ICON
#define WINDOW_CLS_ICON
Definition: window.h:12
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
wizard_init_screen_selftest_home
void wizard_init_screen_selftest_home(int16_t id_body, selftest_home_screen_t *p_screen, selftest_home_data_t *p_data)
Definition: selftest_home.c:8
_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
selftest_home_screen_t::timer
uint32_t timer
Definition: selftest_home.h:21
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
selftest_home_screen_t::icon_hourglass
window_icon_t icon_hourglass
Definition: selftest_home.h:20
_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
_TEST_PASSED
Definition: wizard_types.h:87