Prusa MINI Firmware overview
wizard_ui.c File Reference
#include "wizard_ui.h"
#include "wizard_types.h"
#include "resource.h"
#include "stm32f4xx_hal.h"
#include "marlin_client.h"
#include "marlin_server.h"

Functions

uint16_t wizard_get_test_icon_resource (uint8_t state)
 
void wizard_update_test_icon (int16_t win_id, uint8_t state)
 
int wizard_msgbox_ex (const char *text, uint16_t flags, uint16_t id_icon, rect_ui16_t rc)
 
int wizard_msgbox (const char *text, uint16_t flags, uint16_t id_icon)
 
int wizard_msgbox1 (const char *text, uint16_t flags, uint16_t id_icon)
 
int wizard_msgbox_btns (const char *text, uint16_t flags, uint16_t id_icon, const char **buttons)
 
int wizard_timer (uint32_t *p_timer, uint32_t delay_ms, _TEST_STATE_t *pstate, _WIZ_TIMER_t type)
 
static void _wizard_init_test ()
 
static void _disable_PID ()
 
void wizard_init (float t_noz, float t_bed)
 
void wizard_init_disable_PID (float t_noz, float t_bed)
 

Function Documentation

◆ wizard_get_test_icon_resource()

uint16_t wizard_get_test_icon_resource ( uint8_t  state)
10  {
11  switch (state) {
12  case _TEST_START:
14  case _TEST_RUN:
16  case _TEST_PASSED:
18  case _TEST_FAILED:
20  }
21  return 0;
22 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_update_test_icon()

void wizard_update_test_icon ( int16_t  win_id,
uint8_t  state 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_msgbox_ex()

int wizard_msgbox_ex ( const char *  text,
uint16_t  flags,
uint16_t  id_icon,
rect_ui16_t  rc 
)
29  {
30  const char *custom_btn = 0;
32  custom_btn = "NEXT";
33  else if ((flags & MSGBOX_MSK_BTN) == MSGBOX_BTN_DONE)
34  custom_btn = "DONE";
35  if (custom_btn) {
37  return gui_msgbox_ex(0, text, flags | MSGBOX_ICO_CUSTOM, rc, id_icon, &custom_btn);
38  }
39  return gui_msgbox_ex(0, text, flags | MSGBOX_ICO_CUSTOM, rc, id_icon, 0);
40 }
Here is the caller graph for this function:

◆ wizard_msgbox()

int wizard_msgbox ( const char *  text,
uint16_t  flags,
uint16_t  id_icon 
)
42  {
43  return wizard_msgbox_ex(text, flags, id_icon,
44  rect_ui16(0, 32, 240, 320 - 96));
45 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_msgbox1()

int wizard_msgbox1 ( const char *  text,
uint16_t  flags,
uint16_t  id_icon 
)
47  {
48  return wizard_msgbox_ex(text, flags, id_icon,
49  rect_ui16(0, 76, 240, 320 - 140));
50 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_msgbox_btns()

int wizard_msgbox_btns ( const char *  text,
uint16_t  flags,
uint16_t  id_icon,
const char **  buttons 
)
52  {
53  return gui_msgbox_ex(0, text, flags | MSGBOX_ICO_CUSTOM,
54  rect_ui16(0, 32, 240, 320 - 96),
55  id_icon, buttons);
56 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_timer()

int wizard_timer ( uint32_t *  p_timer,
uint32_t  delay_ms,
_TEST_STATE_t pstate,
_WIZ_TIMER_t  type 
)
58  {
59  int progress = 0;
60  switch (*pstate) {
61  case _TEST_START:
62  *p_timer = HAL_GetTick();
63  *pstate = _TEST_RUN;
64  break;
65  case _TEST_RUN:
66  progress = 100 * (HAL_GetTick() - *p_timer) / delay_ms;
67  if (progress >= 100) {
68  switch (type) {
69  case _WIZ_TIMER:
70  progress = 99;
71  break;
73  progress = 100;
74  *pstate = _TEST_PASSED;
75  break;
77  progress = 100;
78  *pstate = _TEST_FAILED;
79  break;
80  }
81  }
82  break;
83  case _TEST_PASSED:
84  case _TEST_FAILED:
85  progress = 100;
86  break;
87  }
88  return progress;
89 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _wizard_init_test()

static void _wizard_init_test ( )
static
91  {
92  if (!marlin_processing())
96  marlin_gcode("M501"); //restore settings
98  !marlin_event_clr(MARLIN_EVT_FactoryReset)) //wait for M501 done
99  gui_loop();
100 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _disable_PID()

static void _disable_PID ( )
static
102  {
103  //M301 - Set Hotend PID
104  //M301 [C<value>] [D<value>] [E<index>] [I<value>] [L<value>] [P<value>]
105  marlin_gcode_printf("M301 D0 I0 1000000");
106  //M304 - Set Bed PID
107  //M304 [D<value>] [I<value>] [P<value>]
108  marlin_gcode_printf("M304 D0 I0 1000000");
109 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_init()

void wizard_init ( float  t_noz,
float  t_bed 
)
111  {
112  /*window_hide(footer_id);*/
114 
115  //Set Hotend Temperature
116  marlin_gcode_printf("M104 S%d", (int)t_noz);
117 
118  //Set Bed Temperature
119  marlin_gcode_printf("M140 S%d", (int)t_bed);
120 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wizard_init_disable_PID()

void wizard_init_disable_PID ( float  t_noz,
float  t_bed 
)
135  {
136  /*window_hide(footer_id);*/
138  _disable_PID();
139 
140  //Set Hotend Temperature
141  marlin_gcode_printf("M104 S%d", (int)t_noz);
142 
143  //Set Bed Temperature
144  marlin_gcode_printf("M140 S%d", (int)t_bed);
145 }
Here is the call graph for this function:
Here is the caller graph for this function:
MSGBOX_MSK_BTN
#define MSGBOX_MSK_BTN
Definition: window_msgbox.h:9
_wizard_init_test
static void _wizard_init_test()
Definition: wizard_ui.c:91
MARLIN_EVT_LoadSettings
#define MARLIN_EVT_LoadSettings
Definition: marlin_events.h:22
IDR_PNG_wizard_icon_ip1
#define IDR_PNG_wizard_icon_ip1
Definition: resource.h:55
_TEST_FAILED
Definition: wizard_types.h:88
IDR_PNG_wizard_icon_ng
#define IDR_PNG_wizard_icon_ng
Definition: resource.h:53
type
uint8_t type
Definition: UsbCore.h:184
rect_ui16
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
marlin_processing
int marlin_processing(void)
Definition: marlin_client.c:145
state
static volatile fsensor_t state
Definition: filament_sensor.c:23
window_set_icon_id
void window_set_icon_id(int16_t id, uint16_t id_res)
Definition: window.c:659
netif::flags
u8_t flags
Definition: netif.h:305
MSGBOX_ICO_CUSTOM
#define MSGBOX_ICO_CUSTOM
Definition: window_msgbox.h:32
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
MSGBOX_BTN_DONE
#define MSGBOX_BTN_DONE
Definition: wizard_ui.h:13
_TEST_RUN
Definition: wizard_types.h:86
IDR_PNG_wizard_icon_ip0
#define IDR_PNG_wizard_icon_ip0
Definition: resource.h:54
_WIZ_TIMER_AUTOFAIL
Definition: wizard_ui.h:21
MSGBOX_BTN_CUSTOM1
#define MSGBOX_BTN_CUSTOM1
Definition: window_msgbox.h:26
marlin_gcode
void marlin_gcode(const char *gcode)
Definition: marlin_client.c:195
IDR_PNG_wizard_icon_na
#define IDR_PNG_wizard_icon_na
Definition: resource.h:51
_WIZ_TIMER_AUTOPASS
Definition: wizard_ui.h:20
MARLIN_EVT_FactoryReset
#define MARLIN_EVT_FactoryReset
Definition: marlin_events.h:21
_TEST_START
Definition: wizard_types.h:85
wizard_get_test_icon_resource
uint16_t wizard_get_test_icon_resource(uint8_t state)
Definition: wizard_ui.c:10
marlin_start_processing
void marlin_start_processing(void)
Definition: marlin_client.c:174
wizard_msgbox_ex
int wizard_msgbox_ex(const char *text, uint16_t flags, uint16_t id_icon, rect_ui16_t rc)
Definition: wizard_ui.c:29
_disable_PID
static void _disable_PID()
Definition: wizard_ui.c:102
IDR_PNG_wizard_icon_ok
#define IDR_PNG_wizard_icon_ok
Definition: resource.h:52
marlin_gcode_printf
int marlin_gcode_printf(const char *format,...)
Definition: marlin_client.c:206
MSGBOX_BTN_NEXT
#define MSGBOX_BTN_NEXT
Definition: wizard_ui.h:12
_WIZ_TIMER
Definition: wizard_ui.h:19
_TEST_PASSED
Definition: wizard_types.h:87
marlin_event_clr
int marlin_event_clr(uint8_t evt_id)
Definition: marlin_client.c:252