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

Go to the source code of this file.

Classes

struct  selftest_temp_screen_t
 
struct  selftest_temp_data_t
 

Functions

void wizard_init_screen_selftest_temp (int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
 
int wizard_selftest_temp_nozzle (int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
 
int wizard_selftest_temp_bed (int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
 
int wizard_selftest_temp (int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
 

Function Documentation

◆ wizard_init_screen_selftest_temp()

void wizard_init_screen_selftest_temp ( int16_t  id_body,
selftest_temp_screen_t p_screen,
selftest_temp_data_t p_data 
)
22  {
24  int16_t id;
25  // point_ui16_t pt,pt2;
26  window_destroy_children(id_body);
27  window_show(id_body);
28  window_invalidate(id_body);
29 
30  uint16_t y = 40;
31  uint16_t x = WIZARD_MARGIN_LEFT;
32  uint16_t row_h = 22;
33 
34  id = window_create_ptr(WINDOW_CLS_TEXT, id_body, rect_ui16(x, y, WIZARD_X_SPACE, row_h * 2), &(p_screen->text_checking_temp));
35  window_set_text(id,
36  "Checking hotend and\n"
37  "heatbed heaters");
39 
40  y += row_h * 2;
41  id = window_create_ptr(WINDOW_CLS_PROGRESS, id_body, rect_ui16(x, y, WIZARD_X_SPACE, 8), &(p_screen->progress));
42 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_temp_nozzle()

int wizard_selftest_temp_nozzle ( int16_t  id_body,
selftest_temp_screen_t p_screen,
selftest_temp_data_t p_data 
)
97  {
98  if (_is_test_done(p_data->state_temp_nozzle))
99  return 100;
100  int progress = wizard_timer(&p_screen->timer_noz, _HEAT_TIME_MS_NOZ, &(p_data->state_temp_nozzle), _WIZ_TIMER);
101  if (progress >= 99) {
102  if ((p_data->temp_noz >= _PASS_MIN_TEMP_NOZ) && (p_data->temp_noz <= _PASS_MAX_TEMP_NOZ)) {
104  } else {
106  }
107 
108  marlin_gcode("M104 S0"); // nozzle temp 0
109  progress = 100;
110  }
111  return progress;
112 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_temp_bed()

int wizard_selftest_temp_bed ( int16_t  id_body,
selftest_temp_screen_t p_screen,
selftest_temp_data_t p_data 
)
114  {
115  if (_is_test_done(p_data->state_temp_bed))
116  return 100;
117  int progress = wizard_timer(&p_screen->timer_bed, _HEAT_TIME_MS_BED, &(p_data->state_temp_bed), _WIZ_TIMER);
118  if (progress >= 99) {
119  if ((p_data->temp_bed >= _PASS_MIN_TEMP_BED) && (p_data->temp_bed <= _PASS_MAX_TEMP_BED)) {
120  p_data->state_temp_bed = _TEST_PASSED;
121  } else {
122  p_data->state_temp_bed = _TEST_FAILED;
123  }
124 
125  marlin_gcode("M140 S0"); // bed temp 0
126  progress = 100;
127  }
128  return progress;
129 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_selftest_temp()

int wizard_selftest_temp ( int16_t  id_body,
selftest_temp_screen_t p_screen,
selftest_temp_data_t p_data 
)
131  {
132  int progress_preheat_noz = 0;
133  int progress_preheat_bed = 0;
134  int progress_noz = 0;
135  int progress_bed = 0;
136 
138 
139  if ((p_data->state_preheat_nozzle == _TEST_START) && (p_data->state_preheat_bed == _TEST_START)) {
140  p_data->temp_noz = 0;
141  p_data->temp_bed = 0;
142  //turn heaters on
143  // i should not reach those temeratures
144  marlin_gcode_printf("M104 S%d", _MAX_TEMP_NOZ); // nozzle temp
145  marlin_gcode_printf("M140 S%d", _MAX_TEMP_BED); // bed temp
146  wizard_init_screen_selftest_temp(id_body, p_screen, p_data);
147  }
148 
149  if (!_is_test_done(p_data->state_preheat_nozzle)) {
150  progress_preheat_noz = wizard_selftest_preheat_nozzle(id_body, p_screen, p_data);
151  } else {
152  progress_preheat_noz = 100;
153  }
154 
155  if (!_is_test_done(p_data->state_preheat_bed)) {
156  progress_preheat_bed = wizard_selftest_preheat_bed(id_body, p_screen, p_data);
157  } else {
158  progress_preheat_bed = 100;
159  }
160 
161  if (p_data->state_preheat_nozzle == _TEST_PASSED) {
162  progress_noz = wizard_selftest_temp_nozzle(id_body, p_screen, p_data);
163  }
164  if (p_data->state_preheat_bed == _TEST_PASSED) {
165  progress_bed = wizard_selftest_temp_bed(id_body, p_screen, p_data);
166  }
167 
168  int progress = (progress_preheat_noz * _MAX_PREHEAT_TIME_MS_NOZ + progress_preheat_bed * _MAX_PREHEAT_TIME_MS_BED + progress_bed * _HEAT_TIME_MS_BED + progress_noz * _HEAT_TIME_MS_NOZ) / (_MAX_PREHEAT_TIME_MS_NOZ + _MAX_PREHEAT_TIME_MS_BED + _HEAT_TIME_MS_BED + _HEAT_TIME_MS_NOZ);
169 
170  if (p_data->state_preheat_nozzle == _TEST_FAILED)
171  progress = 100;
172  if (p_data->state_preheat_bed == _TEST_FAILED)
173  progress = 100;
174  if (p_data->state_temp_nozzle == _TEST_FAILED)
175  progress = 100;
176  if (p_data->state_temp_bed == _TEST_FAILED)
177  progress = 100;
178 
179  window_set_value(p_screen->progress.win.id, (float)progress);
180  if (progress == 100) {
181  //turn heaters off
182  marlin_gcode("M104 S0"); //nozzle temp 0
183  marlin_gcode("M140 S0"); //bed temp 0
184  }
185 
186  return progress;
187 }
Here is the call graph for this function:
Here is the caller graph for this function:
window_set_alignment
void window_set_alignment(int16_t id, uint8_t alignment)
Definition: window.c:561
selftest_temp_data_t::temp_noz
float temp_noz
Definition: selftest_temp.h:33
_HEAT_TIME_MS_BED
#define _HEAT_TIME_MS_BED
Definition: wizard_config.h:55
selftest_temp_screen_t::text_checking_temp
window_text_t text_checking_temp
Definition: selftest_temp.h:18
wizard_selftest_temp_bed
int wizard_selftest_temp_bed(int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
Definition: selftest_temp.c:114
wizard_init_screen_selftest_temp
void wizard_init_screen_selftest_temp(int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
Definition: selftest_temp.c:22
_PASS_MIN_TEMP_BED
#define _PASS_MIN_TEMP_BED
Definition: wizard_config.h:52
wizard_selftest_preheat_bed
int wizard_selftest_preheat_bed(int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
Definition: selftest_temp.c:82
_TEST_FAILED
Definition: wizard_types.h:88
window_destroy_children
void window_destroy_children(int16_t id)
Definition: window.c:157
_PASS_MAX_TEMP_BED
#define _PASS_MAX_TEMP_BED
Definition: wizard_config.h:50
ALIGN_CENTER
#define ALIGN_CENTER
Definition: guitypes.h:19
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
selftest_temp_data_t::state_preheat_nozzle
_TEST_STATE_t state_preheat_nozzle
Definition: selftest_temp.h:29
_is_test_done
static int _is_test_done(int result)
Definition: wizard_types.h:91
window_show
void window_show(int16_t id)
Definition: window.c:529
selftest_temp_data_t::state_preheat_bed
_TEST_STATE_t state_preheat_bed
Definition: selftest_temp.h:30
_window_t::id
int16_t id
Definition: window.h:79
selftest_temp_screen_t::timer_bed
uint32_t timer_bed
Definition: selftest_temp.h:22
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
WINDOW_CLS_PROGRESS
#define WINDOW_CLS_PROGRESS
Definition: window.h:20
wizard_selftest_preheat_nozzle
int wizard_selftest_preheat_nozzle(int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
Definition: selftest_temp.c:67
_MAX_TEMP_NOZ
#define _MAX_TEMP_NOZ
Definition: wizard_config.h:49
_wizard_temp_actualize_temperatures
void _wizard_temp_actualize_temperatures(selftest_temp_data_t *p_data)
Definition: selftest_temp.c:44
window_set_value
void window_set_value(int16_t id, float value)
Definition: window.c:363
selftest_temp_screen_t::progress
window_progress_t progress
Definition: selftest_temp.h:19
_HEAT_TIME_MS_NOZ
#define _HEAT_TIME_MS_NOZ
Definition: wizard_config.h:56
marlin_gcode
void marlin_gcode(const char *gcode)
Definition: marlin_client.c:195
_MAX_PREHEAT_TIME_MS_BED
#define _MAX_PREHEAT_TIME_MS_BED
Definition: wizard_config.h:57
_PASS_MAX_TEMP_NOZ
#define _PASS_MAX_TEMP_NOZ
Definition: wizard_config.h:51
_MAX_TEMP_BED
#define _MAX_TEMP_BED
Definition: wizard_config.h:48
_PASS_MIN_TEMP_NOZ
#define _PASS_MIN_TEMP_NOZ
Definition: wizard_config.h:53
selftest_temp_data_t::temp_bed
float temp_bed
Definition: selftest_temp.h:34
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
selftest_temp_data_t::state_temp_bed
_TEST_STATE_t state_temp_bed
Definition: selftest_temp.h:32
wizard_selftest_temp_nozzle
int wizard_selftest_temp_nozzle(int16_t id_body, selftest_temp_screen_t *p_screen, selftest_temp_data_t *p_data)
Definition: selftest_temp.c:97
_window_progress_t::win
window_t win
Definition: window_progress.h:16
marlin_gcode_printf
int marlin_gcode_printf(const char *format,...)
Definition: marlin_client.c:206
_WIZ_TIMER
Definition: wizard_ui.h:19
_TEST_PASSED
Definition: wizard_types.h:87
selftest_temp_data_t::state_temp_nozzle
_TEST_STATE_t state_temp_nozzle
Definition: selftest_temp.h:31
_MAX_PREHEAT_TIME_MS_NOZ
#define _MAX_PREHEAT_TIME_MS_NOZ
Definition: wizard_config.h:58
selftest_temp_screen_t::timer_noz
uint32_t timer_noz
Definition: selftest_temp.h:21