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

Go to the source code of this file.

Classes

struct  selftest_fans_axis_screen_t
 
struct  selftest_fans_axis_data_t
 

Functions

void wizard_init_screen_selftest_fans_axis (int16_t id_body, selftest_fans_axis_screen_t *p_screen, selftest_fans_axis_data_t *p_data)
 
int wizard_selftest_fan0 (int16_t id_body, selftest_fans_axis_screen_t *p_screen, selftest_fans_axis_data_t *p_data)
 
int wizard_selftest_fan1 (int16_t id_body, selftest_fans_axis_screen_t *p_screen, selftest_fans_axis_data_t *p_data)
 
int wizard_selftest_x (int16_t id_body, selftest_fans_axis_screen_t *p_screen, selftest_fans_axis_data_t *p_data)
 
int wizard_selftest_y (int16_t id_body, selftest_fans_axis_screen_t *p_screen, selftest_fans_axis_data_t *p_data)
 
int wizard_selftest_z (int16_t id_body, selftest_fans_axis_screen_t *p_screen, selftest_fans_axis_data_t *p_data)
 

Function Documentation

◆ wizard_init_screen_selftest_fans_axis()

void wizard_init_screen_selftest_fans_axis ( int16_t  id_body,
selftest_fans_axis_screen_t p_screen,
selftest_fans_axis_data_t p_data 
)
15  {
16  int16_t id;
17  window_destroy_children(id_body);
18  window_show(id_body);
19  window_invalidate(id_body);
20 
21  uint16_t y = 40;
22  uint16_t x = WIZARD_MARGIN_LEFT;
23 
24  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 22), &(p_screen->text_fan_test));
25  window_set_text(id, "Fan test");
26 
27  y += 22;
28 
29  id = window_create_ptr(WINDOW_CLS_PROGRESS, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 8), &(p_screen->progress_fan));
30 
31  y += 12;
32 
33  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, 200, 22), &(p_screen->text_extruder_fan));
34  window_set_text(id, "Hotend fan");
35 
36  id = window_create_ptr(WINDOW_CLS_ICON, id_body, rect_ui16(x + 200, y, 22, 22), &(p_screen->icon_extruder_fan));
38 
39  y += 22;
40 
41  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, 200, 22), &(p_screen->text_print_fan));
42  window_set_text(id, "Print fan");
43 
44  id = window_create_ptr(WINDOW_CLS_ICON, id_body, rect_ui16(x + 200, y, 22, 22), &(p_screen->icon_print_fan));
46 
47  y += 44;
48 
49  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 22), &(p_screen->text_checking_axis));
50  window_set_text(id, "Checking axes");
51 
52  y += 22;
53 
54  id = window_create_ptr(WINDOW_CLS_PROGRESS, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 8), &(p_screen->progress_axis));
55 
56  y += 12;
57 
58  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, 200, 22), &(p_screen->text_x_axis));
59  window_set_text(id, "X-axis");
60 
61  id = window_create_ptr(WINDOW_CLS_ICON, id_body, rect_ui16(x + 200, y, 22, 22), &(p_screen->icon_x_axis));
63 
64  y += 22;
65 
66  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, 200, 22), &(p_screen->text_y_axis));
67  window_set_text(id, "Y-axis");
68 
69  id = window_create_ptr(WINDOW_CLS_ICON, id_body, rect_ui16(x + 200, y, 22, 22), &(p_screen->icon_y_axis));
71 
72  y += 22;
73 
74  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, 200, 22), &(p_screen->text_z_axis));
75  window_set_text(id, "Z-axis");
76 
77  id = window_create_ptr(WINDOW_CLS_ICON, id_body, rect_ui16(x + 200, y, 22, 22), &(p_screen->icon_z_axis));
79 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_fan0()

int wizard_selftest_fan0 ( int16_t  id_body,
selftest_fans_axis_screen_t p_screen,
selftest_fans_axis_data_t p_data 
)
81  {
82  if (p_data->state_fan0 == _TEST_START) {
83  wizard_init_screen_selftest_fans_axis(id_body, p_screen, p_data);
85  hwio_fan_set_pwm(0, 255);
86  Tacho_FAN0 = 0;
87  }
88  int progress = wizard_timer(&p_screen->timer0, _SELFTEST_FAN0_TIME, &(p_data->state_fan0), _WIZ_TIMER_AUTOPASS);
89  if (progress == 100) {
91  p_data->state_fan0 = _TEST_FAILED;
92  hwio_fan_set_pwm(0, 0);
93  }
94  window_set_value(p_screen->progress_fan.win.id, (float)progress / 2);
96  return progress;
97 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_fan1()

int wizard_selftest_fan1 ( int16_t  id_body,
selftest_fans_axis_screen_t p_screen,
selftest_fans_axis_data_t p_data 
)
99  {
100  if (p_data->state_fan1 == _TEST_START) {
101  wizard_init_screen_selftest_fans_axis(id_body, p_screen, p_data);
103  hwio_fan_set_pwm(1, 255);
104  Tacho_FAN1 = 0;
105  }
106  int progress = wizard_timer(&p_screen->timer0, _SELFTEST_FAN1_TIME, &(p_data->state_fan1), _WIZ_TIMER_AUTOPASS);
107  if (progress == 100) {
109  p_data->state_fan1 = _TEST_FAILED;
110  hwio_fan_set_pwm(1, 0);
111  }
112  window_set_value(p_screen->progress_fan.win.id, 50.0F + (float)progress / 2);
114  return progress;
115 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_x()

int wizard_selftest_x ( int16_t  id_body,
selftest_fans_axis_screen_t p_screen,
selftest_fans_axis_data_t p_data 
)
356  {
357  if (p_data->state_x == _TEST_START)
358  wizard_init_screen_selftest_fans_axis(id_body, p_screen, p_data);
359  wizard_selftest_axis(&axisX, p_data, &(p_data->state_x), 0,
361  int progress = wizard_timer(&p_screen->timer0, _SELFTEST_X_TIME, &(p_data->state_x), _WIZ_TIMER);
362  window_set_value(p_screen->progress_axis.win.id, (float)progress / 3);
363  wizard_update_test_icon(p_screen->icon_x_axis.win.id, p_data->state_x);
364  return progress;
365 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_y()

int wizard_selftest_y ( int16_t  id_body,
selftest_fans_axis_screen_t p_screen,
selftest_fans_axis_data_t p_data 
)
367  {
368  if (p_data->state_y == _TEST_START)
369  wizard_init_screen_selftest_fans_axis(id_body, p_screen, p_data);
370  wizard_selftest_axis(&axisY, p_data, &(p_data->state_y), 1,
372  int progress = wizard_timer(&p_screen->timer0, _SELFTEST_Y_TIME, &(p_data->state_y), _WIZ_TIMER);
373  window_set_value(p_screen->progress_axis.win.id, 33.3F + (float)progress / 3);
374  wizard_update_test_icon(p_screen->icon_y_axis.win.id, p_data->state_y);
375  return progress;
376 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_z()

int wizard_selftest_z ( int16_t  id_body,
selftest_fans_axis_screen_t p_screen,
selftest_fans_axis_data_t p_data 
)
378  {
379  if (p_data->state_z == _TEST_START)
380  wizard_init_screen_selftest_fans_axis(id_body, p_screen, p_data);
381  wizard_selftest_axis(&axisZ, p_data, &(p_data->state_z), 2,
383  int progress = wizard_timer(&p_screen->timer0, _SELFTEST_Z_TIME, &(p_data->state_z), _WIZ_TIMER);
384  window_set_value(p_screen->progress_axis.win.id, 66.6F + (float)progress / 3);
385  wizard_update_test_icon(p_screen->icon_z_axis.win.id, p_data->state_z);
386  return progress;
387 }
Here is the call graph for this function:
Here is the caller graph for this function:
_SELFTEST_Z_TIME
#define _SELFTEST_Z_TIME
Definition: wizard_config.h:31
selftest_fans_axis_data_t::state_y
_TEST_STATE_t state_y
Definition: selftest_fans_axis.h:42
selftest_fans_axis_data_t::state_z
_TEST_STATE_t state_z
Definition: selftest_fans_axis.h:43
_SELFTEST_Z_MAX
#define _SELFTEST_Z_MAX
Definition: wizard_config.h:29
_SELFTEST_Y_MIN
#define _SELFTEST_Y_MIN
Definition: wizard_config.h:23
selftest_fans_axis_screen_t::text_x_axis
window_text_t text_x_axis
Definition: selftest_fans_axis.h:24
_TEST_FAILED
Definition: wizard_types.h:88
window_destroy_children
void window_destroy_children(int16_t id)
Definition: window.c:157
selftest_fans_axis_screen_t::icon_print_fan
window_icon_t icon_print_fan
Definition: selftest_fans_axis.h:28
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
axisY
static const _cl_st_ax axisY
Definition: selftest_fans_axis.c:306
selftest_fans_axis_screen_t::text_print_fan
window_text_t text_print_fan
Definition: selftest_fans_axis.h:22
_SELFTEST_FAN1_MAX
#define _SELFTEST_FAN1_MAX
Definition: wizard_config.h:16
marlin_stop_processing
void marlin_stop_processing(void)
Definition: marlin_client.c:166
window_set_icon_id
void window_set_icon_id(int16_t id, uint16_t id_res)
Definition: window.c:659
selftest_fans_axis_screen_t::text_z_axis
window_text_t text_z_axis
Definition: selftest_fans_axis.h:26
_SELFTEST_X_MIN
#define _SELFTEST_X_MIN
Definition: wizard_config.h:18
window_show
void window_show(int16_t id)
Definition: window.c:529
_SELFTEST_Y_TIME
#define _SELFTEST_Y_TIME
Definition: wizard_config.h:26
selftest_fans_axis_screen_t::progress_fan
window_progress_t progress_fan
Definition: selftest_fans_axis.h:18
Tacho_FAN1
uint32_t Tacho_FAN1
Definition: main.c:153
_SELFTEST_X_TIME
#define _SELFTEST_X_TIME
Definition: wizard_config.h:21
_window_t::id
int16_t id
Definition: window.h:79
_SELFTEST_X_MAX
#define _SELFTEST_X_MAX
Definition: wizard_config.h:19
selftest_fans_axis_data_t::state_x
_TEST_STATE_t state_x
Definition: selftest_fans_axis.h:41
_window_icon_t::win
window_t win
Definition: window_icon.h:12
WIZARD_X_SPACE
#define WIZARD_X_SPACE
Definition: wizard_ui.h:10
wizard_selftest_axis
void wizard_selftest_axis(const _cl_st_ax *_ths, selftest_fans_axis_data_t *p_data, uint8_t *state, int axis, int fr, int min, int max, int dir)
Definition: selftest_fans_axis.c:339
axisX
static const _cl_st_ax axisX
Definition: selftest_fans_axis.c:285
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
_SELFTEST_FAN0_MAX
#define _SELFTEST_FAN0_MAX
Definition: wizard_config.h:12
WINDOW_CLS_PROGRESS
#define WINDOW_CLS_PROGRESS
Definition: window.h:20
_SELFTEST_Z_MIN
#define _SELFTEST_Z_MIN
Definition: wizard_config.h:28
selftest_fans_axis_screen_t::text_extruder_fan
window_text_t text_extruder_fan
Definition: selftest_fans_axis.h:21
_SELFTEST_Z_FR
#define _SELFTEST_Z_FR
Definition: wizard_config.h:30
_SELFTEST_Y_FR
#define _SELFTEST_Y_FR
Definition: wizard_config.h:25
window_set_value
void window_set_value(int16_t id, float value)
Definition: window.c:363
selftest_fans_axis_screen_t::progress_axis
window_progress_t progress_axis
Definition: selftest_fans_axis.h:19
_SELFTEST_FAN1_MIN
#define _SELFTEST_FAN1_MIN
Definition: wizard_config.h:15
selftest_fans_axis_screen_t::text_fan_test
window_text_t text_fan_test
Definition: selftest_fans_axis.h:20
selftest_fans_axis_screen_t::timer0
uint32_t timer0
Definition: selftest_fans_axis.h:32
selftest_fans_axis_screen_t::text_y_axis
window_text_t text_y_axis
Definition: selftest_fans_axis.h:25
hwio_fan_set_pwm
void hwio_fan_set_pwm(int i_fan, int val)
Definition: hwio_a3ides_2209_02.c:447
selftest_fans_axis_screen_t::icon_x_axis
window_icon_t icon_x_axis
Definition: selftest_fans_axis.h:29
_SELFTEST_FAN1_TIME
#define _SELFTEST_FAN1_TIME
Definition: wizard_config.h:14
selftest_fans_axis_screen_t::icon_z_axis
window_icon_t icon_z_axis
Definition: selftest_fans_axis.h:31
_SELFTEST_Y_MAX
#define _SELFTEST_Y_MAX
Definition: wizard_config.h:24
WINDOW_CLS_ICON
#define WINDOW_CLS_ICON
Definition: window.h:12
_WIZ_TIMER_AUTOPASS
Definition: wizard_ui.h:20
selftest_fans_axis_data_t::state_fan0
_TEST_STATE_t state_fan0
Definition: selftest_fans_axis.h:39
axisZ
static const _cl_st_ax axisZ
Definition: selftest_fans_axis.c:335
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
selftest_fans_axis_data_t::state_fan1
_TEST_STATE_t state_fan1
Definition: selftest_fans_axis.h:40
selftest_fans_axis_screen_t::icon_y_axis
window_icon_t icon_y_axis
Definition: selftest_fans_axis.h:30
wizard_get_test_icon_resource
uint16_t wizard_get_test_icon_resource(uint8_t state)
Definition: wizard_ui.c:10
selftest_fans_axis_screen_t::icon_extruder_fan
window_icon_t icon_extruder_fan
Definition: selftest_fans_axis.h:27
_SELFTEST_X_FR
#define _SELFTEST_X_FR
Definition: wizard_config.h:20
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_fans_axis_screen_t::text_checking_axis
window_text_t text_checking_axis
Definition: selftest_fans_axis.h:23
_SELFTEST_FAN0_MIN
#define _SELFTEST_FAN0_MIN
Definition: wizard_config.h:11
_window_progress_t::win
window_t win
Definition: window_progress.h:16
Tacho_FAN0
uint32_t Tacho_FAN0
Definition: main.c:152
wizard_update_test_icon
void wizard_update_test_icon(int16_t win_id, uint8_t state)
Definition: wizard_ui.c:24
_WIZ_TIMER
Definition: wizard_ui.h:19
_SELFTEST_FAN0_TIME
#define _SELFTEST_FAN0_TIME
Definition: wizard_config.h:10
wizard_init_screen_selftest_fans_axis
void wizard_init_screen_selftest_fans_axis(int16_t id_body, selftest_fans_axis_screen_t *p_screen, selftest_fans_axis_data_t *p_data)
Definition: selftest_fans_axis.c:14