Prusa MINI Firmware overview
screen_menu_tune.cpp File Reference
#include "gui.h"
#include "screen_menu.h"
#include "marlin_client.h"
#include "filament.h"
#include "menu_vars.h"

Enumerations

enum  {
  MI_RETURN, MI_SPEED, MI_NOZZLE, MI_HEATBED,
  MI_PRINTFAN, MI_FLOWFACT, MI_BABYSTEP, MI_FILAMENT,
  MI_INFO, MI_MESSAGES
}
 

Functions

void screen_menu_tune_timer (screen_t *screen, uint32_t mseconds)
 
void screen_menu_tune_chanege_filament (screen_t *screen)
 
void screen_menu_tune_init (screen_t *screen)
 
int screen_menu_tune_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

screen_t screen_menu_info
 
screen_t screen_messages
 
const menu_item_t _menu_tune_items []
 
screen_t screen_menu_tune
 
const screen_tpscreen_menu_tune = &screen_menu_tune
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MI_RETURN 
MI_SPEED 
MI_NOZZLE 
MI_HEATBED 
MI_PRINTFAN 
MI_FLOWFACT 
MI_BABYSTEP 
MI_FILAMENT 
MI_INFO 
MI_MESSAGES 
15  {
16  MI_RETURN,
17  MI_SPEED,
18  MI_NOZZLE,
19  MI_HEATBED,
24  MI_INFO,
25 #ifdef _DEBUG
26  MI_TEST,
27 #endif //_DEBUG
29 };

Function Documentation

◆ screen_menu_tune_timer()

void screen_menu_tune_timer ( screen_t screen,
uint32_t  mseconds 
)
160  {
161  static uint32_t last_timer_repaint = 0;
162  // if (psmd->pfooter->last_timer == mseconds) return; // WTF is footer timer doing here?
163  //if (mseconds % 500 == 0) // is this really necessary? That's why the tune menu behaves like a Ferrari off-road (i.e. sitting stuck :) )
164  if ((mseconds - last_timer_repaint) >= 500) {
165  marlin_vars_t *vars = marlin_vars();
166  bool editing = psmd->menu.mode > 0;
167  int index = psmd->menu.index;
168  if (!editing || index != MI_SPEED) {
169  psmd->items[MI_SPEED].item.wi_spin.value = vars->print_speed * 1000;
170  psmd->menu.win.flg |= WINDOW_FLG_INVALID;
171  }
172  if (!editing || index != MI_NOZZLE) {
173  psmd->items[MI_NOZZLE].item.wi_spin.value = vars->target_nozzle * 1000;
174  psmd->menu.win.flg |= WINDOW_FLG_INVALID;
175  }
176  if (!editing || index != MI_HEATBED) {
177  psmd->items[MI_HEATBED].item.wi_spin.value = vars->target_bed * 1000;
178  psmd->menu.win.flg |= WINDOW_FLG_INVALID;
179  }
180  if (!editing || index != MI_PRINTFAN) {
181  psmd->items[MI_PRINTFAN].item.wi_spin.value = vars->fan_speed * 1000;
182  psmd->menu.win.flg |= WINDOW_FLG_INVALID;
183  }
184  if (!editing || index != MI_FLOWFACT) {
185  psmd->items[MI_FLOWFACT].item.wi_spin.value = vars->flow_factor * 1000;
186  psmd->menu.win.flg |= WINDOW_FLG_INVALID;
187  }
188  last_timer_repaint = mseconds;
189  }
190 }
Here is the call graph for this function:

◆ screen_menu_tune_chanege_filament()

void screen_menu_tune_chanege_filament ( screen_t screen)

◆ screen_menu_tune_init()

void screen_menu_tune_init ( screen_t screen)
51  {
52  marlin_vars_t *vars;
53  int count = sizeof(_menu_tune_items) / sizeof(menu_item_t);
54  screen_menu_init(screen, "TUNE", count + 1, 1, 0);
56  memcpy(psmd->items + 1, _menu_tune_items, count * sizeof(menu_item_t));
57 
58  vars = marlin_update_vars(
60 
61  psmd->items[MI_SPEED].item.wi_spin.value = (int32_t)(vars->print_speed * 1000);
62  psmd->items[MI_SPEED].item.wi_spin.range = feedrate_range;
63 
64  psmd->items[MI_NOZZLE].item.wi_spin.value = (int32_t)(vars->target_nozzle * 1000);
65  psmd->items[MI_NOZZLE].item.wi_spin.range = nozzle_range;
66 
67  psmd->items[MI_HEATBED].item.wi_spin.value = (int32_t)(vars->target_bed * 1000);
68  psmd->items[MI_HEATBED].item.wi_spin.range = heatbed_range;
69 
70  psmd->items[MI_PRINTFAN].item.wi_spin.value = (int32_t)(vars->fan_speed * 1000);
71  psmd->items[MI_PRINTFAN].item.wi_spin.range = printfan_range;
72 
73  psmd->items[MI_FLOWFACT].item.wi_spin.value = (int32_t)(vars->flow_factor * 1000);
74  psmd->items[MI_FLOWFACT].item.wi_spin.range = flowfact_range;
75 
76  psmd->items[MI_BABYSTEP].item.wi_spin_fl.value = vars->z_offset;
77  psmd->items[MI_BABYSTEP].item.wi_spin_fl.range = zoffset_fl_range;
78  psmd->items[MI_BABYSTEP].item.wi_spin_fl.prt_format = zoffset_fl_format;
79 }
Here is the call graph for this function:

◆ screen_menu_tune_event()

int screen_menu_tune_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
82  {
83  static float z_offs = 0;
84 
85  if (
87  psmd->items[MI_FILAMENT].item.type &= ~WI_DISABLED;
88  } else {
89  psmd->items[MI_FILAMENT].item.type |= WI_DISABLED;
90  }
91 
92  if (screen_menu_event(screen, window, event, param))
93  return 1;
94 
95  if (event == WINDOW_EVENT_CHANGING) {
96  switch ((int)param) {
97  /*case MI_SPEED:
98  marlin_set_print_speed((uint8_t)(psmd->items[MI_SPEED].item.value / 1000));
99  break;
100  case MI_NOZZLE:
101  marlin_set_target_nozzle((float)(psmd->items[MI_NOZZLE].item.value) / 1000);
102  break;
103  case MI_HEATBED:
104  marlin_set_target_bed((float)(psmd->items[MI_HEATBED].item.value) / 1000);
105  break;
106  case MI_PRINTFAN:
107  marlin_set_fan_speed((uint8_t)(psmd->items[MI_PRINTFAN].item.value / 1000));
108  break;
109  case MI_FLOWFACT:
110  marlin_set_flow_factor((uint16_t)(psmd->items[MI_FLOWFACT].item.value / 1000));
111  break;*/
112  case MI_BABYSTEP:
113  marlin_do_babysteps_Z(psmd->items[MI_BABYSTEP].item.wi_spin_fl.value - z_offs);
114  z_offs = psmd->items[MI_BABYSTEP].item.wi_spin_fl.value;
115  break;
116  }
117  } else if (event == WINDOW_EVENT_CHANGE) {
118  switch ((int)param) {
119  case MI_SPEED:
120  marlin_set_print_speed((uint16_t)(psmd->items[MI_SPEED].item.wi_spin.value / 1000));
121  break;
122  case MI_NOZZLE:
123  marlin_set_target_nozzle((float)(psmd->items[MI_NOZZLE].item.wi_spin.value) / 1000);
124  break;
125  case MI_HEATBED:
126  marlin_set_target_bed((float)(psmd->items[MI_HEATBED].item.wi_spin.value) / 1000);
127  break;
128  case MI_PRINTFAN:
129  marlin_set_fan_speed((uint8_t)(psmd->items[MI_PRINTFAN].item.wi_spin.value / 1000));
130  break;
131  case MI_FLOWFACT:
132  marlin_set_flow_factor((uint16_t)(psmd->items[MI_FLOWFACT].item.wi_spin.value / 1000));
133  break;
134  case MI_BABYSTEP:
135  marlin_set_z_offset(psmd->items[MI_BABYSTEP].item.wi_spin_fl.value);
137  break;
138  }
139  } else if (event == WINDOW_EVENT_CLICK) {
140  switch ((int)param) {
141  case MI_FILAMENT:
142  //screen_menu_tune_chanege_filament(screen);
143  //todo this should not be here
144  if (!(psmd->items[MI_FILAMENT].item.type & WI_DISABLED)) {
145  marlin_gcode_push_front("M600");
146  }
147  break;
148  case MI_BABYSTEP:
149  z_offs = psmd->items[MI_BABYSTEP].item.wi_spin_fl.value;
150  break;
151  case MI_MESSAGES:
152  screen_open(psmd->items[(int)param].screen->id);
153  break;
154  }
155  }
156 
157  return 0;
158 }
Here is the call graph for this function:

Variable Documentation

◆ screen_menu_info

screen_t screen_menu_info

◆ screen_messages

◆ _menu_tune_items

const menu_item_t _menu_tune_items[]
Initial value:
= {
{ { "Speed", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN },
{ { "Nozzle", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN },
{ { "HeatBed", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN },
{ { "Fan Speed", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN },
{ { "Flow Factor", 0, WI_SPIN }, SCREEN_MENU_NO_SCREEN },
{ { "Live Adjust Z", 0, WI_SPIN_FL }, SCREEN_MENU_NO_SCREEN },
{ { "Change Filament", 0, WI_LABEL }, SCREEN_MENU_NO_SCREEN },
{ { "Info", 0, WI_LABEL | WI_DISABLED }, &screen_menu_info },
{ { "Messages", 0, WI_LABEL }, &screen_messages },
}

◆ screen_menu_tune

◆ pscreen_menu_tune

const screen_t* pscreen_menu_tune = &screen_menu_tune
MI_MESSAGES
Definition: screen_menu_tune.cpp:28
MI_FLOWFACT
Definition: screen_menu_tune.cpp:21
printfan_range
const int32_t printfan_range[3]
Definition: menu_vars.cpp:33
_menu_item_t
Definition: screen_menu.h:19
marlin_set_target_nozzle
float marlin_set_target_nozzle(float val)
Definition: marlin_client.c:401
screen_menu_draw
void screen_menu_draw(screen_t *screen)
Definition: screen_menu.c:90
MI_BABYSTEP
Definition: screen_menu_tune.cpp:22
marlin_set_target_bed
float marlin_set_target_bed(float val)
Definition: marlin_client.c:405
MARLIN_VAR_FLOWFACT
#define MARLIN_VAR_FLOWFACT
Definition: marlin_vars.h:26
screen_menu_event
int screen_menu_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu.c:92
_marlin_vars_t::z_offset
float z_offset
Definition: marlin_vars.h:87
MARLIN_VAR_FANSPEED
#define MARLIN_VAR_FANSPEED
Definition: marlin_vars.h:24
screen_menu_done
void screen_menu_done(screen_t *screen)
Definition: screen_menu.c:78
marlin_gcode_push_front
void marlin_gcode_push_front(const char *gcode)
Definition: marlin_client.c:222
MI_NOZZLE
Definition: screen_menu_tune.cpp:18
SCREEN_MENU_NO_SCREEN
#define SCREEN_MENU_NO_SCREEN
Definition: screen_menu.h:39
marlin_do_babysteps_Z
void marlin_do_babysteps_Z(float offs)
Definition: marlin_client.c:433
WI_SPIN
Definition: window_menu.h:15
screen_open
void screen_open(int16_t screen_id)
Definition: screen.c:62
WINDOW_EVENT_CHANGE
#define WINDOW_EVENT_CHANGE
Definition: window.h:47
screen_menu_info
screen_t screen_menu_info
Definition: screen_menu_info.c:55
flowfact_range
const int32_t flowfact_range[3]
Definition: menu_vars.cpp:34
MARLIN_CMD_G29
#define MARLIN_CMD_G29
Definition: marlin_events.h:54
screen_menu_init
void screen_menu_init(screen_t *screen, const char *label, int count, uint8_t footer, uint8_t help)
Definition: screen_menu.c:25
marlin_set_flow_factor
uint16_t marlin_set_flow_factor(uint16_t val)
Definition: marlin_client.c:421
WI_DISABLED
Definition: window_menu.h:20
marlin_vars
marlin_vars_t * marlin_vars(void)
Definition: marlin_client.c:361
screen_messages_done
void screen_messages_done(screen_t *screen)
Definition: screen_messages.c:106
MARLIN_VAR_MSK_TEMP_TARG
#define MARLIN_VAR_MSK_TEMP_TARG
Definition: marlin_vars.h:46
marlin_all_axes_known
int marlin_all_axes_known(void)
Definition: marlin_server.cpp:377
_marlin_vars_t::target_nozzle
float target_nozzle
Definition: marlin_vars.h:85
MARLIN_CMD_M190
#define MARLIN_CMD_M190
Definition: marlin_events.h:56
MI_FILAMENT
Definition: screen_menu_tune.cpp:23
screen_messages_data_t
struct _screen_messages_data_t screen_messages_data_t
psmd
#define psmd
Definition: screen_menu.h:40
screen_messages_init
void screen_messages_init(screen_t *screen)
Definition: screen_messages.c:55
WI_SPIN_FL
Definition: window_menu.h:18
WINDOW_EVENT_CHANGING
#define WINDOW_EVENT_CHANGING
Definition: window.h:48
marlin_update_vars
marlin_vars_t * marlin_update_vars(uint64_t msk)
Definition: marlin_client.c:368
_menu_tune_items
const menu_item_t _menu_tune_items[]
Definition: screen_menu_tune.cpp:33
WI_LABEL
Definition: window_menu.h:14
uint8_t
const uint8_t[]
Definition: 404_html.c:3
MARLIN_VAR_MSK
#define MARLIN_VAR_MSK(v_id)
Definition: marlin_vars.h:35
menu_item_return
const menu_item_t menu_item_return
Definition: screen_menu.c:14
marlin_all_axes_homed
int marlin_all_axes_homed(void)
Definition: marlin_server.cpp:373
MARLIN_VAR_PRNSPEED
#define MARLIN_VAR_PRNSPEED
Definition: marlin_vars.h:25
screen_menu_tune_init
void screen_menu_tune_init(screen_t *screen)
Definition: screen_menu_tune.cpp:51
MI_HEATBED
Definition: screen_menu_tune.cpp:19
marlin_command
uint32_t marlin_command(void)
Definition: marlin_client.c:159
_marlin_vars_t::print_speed
uint16_t print_speed
Definition: marlin_vars.h:89
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
feedrate_range
const int32_t feedrate_range[3]
Definition: menu_vars.cpp:35
zoffset_fl_format
const char * zoffset_fl_format
Definition: menu_vars.cpp:30
zoffset_fl_range
const float zoffset_fl_range[3]
Definition: menu_vars.cpp:29
screen_menu_data_t
Definition: screen_menu.h:24
MARLIN_CMD_M109
#define MARLIN_CMD_M109
Definition: marlin_events.h:55
_marlin_vars_t::flow_factor
uint16_t flow_factor
Definition: marlin_vars.h:90
screen_menu_tune_event
int screen_menu_tune_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu_tune.cpp:81
MI_RETURN
Definition: screen_menu_tune.cpp:16
screen_messages_event
int screen_messages_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_messages.c:81
MI_INFO
Definition: screen_menu_tune.cpp:24
_marlin_vars_t
Definition: marlin_vars.h:77
marlin_set_z_offset
float marlin_set_z_offset(float val)
Definition: marlin_client.c:409
marlin_settings_save
void marlin_settings_save(void)
Definition: marlin_client.c:443
marlin_set_fan_speed
uint8_t marlin_set_fan_speed(uint8_t val)
Definition: marlin_client.c:413
screen_messages_draw
void screen_messages_draw(screen_t *screen)
Definition: screen_messages.c:78
MI_PRINTFAN
Definition: screen_menu_tune.cpp:20
nozzle_range
const int32_t nozzle_range[3]
Definition: menu_vars.cpp:31
marlin_set_print_speed
uint16_t marlin_set_print_speed(uint16_t val)
Definition: marlin_client.c:417
MARLIN_CMD_G28
#define MARLIN_CMD_G28
Definition: marlin_events.h:53
_marlin_vars_t::target_bed
float target_bed
Definition: marlin_vars.h:86
screen_messages
screen_t screen_messages
Definition: screen_messages.c:111
WINDOW_FLG_INVALID
#define WINDOW_FLG_INVALID
Definition: window.h:26
MARLIN_VAR_Z_OFFSET
#define MARLIN_VAR_Z_OFFSET
Definition: marlin_vars.h:23
MI_SPEED
Definition: screen_menu_tune.cpp:17
heatbed_range
const int32_t heatbed_range[3]
Definition: menu_vars.cpp:32
_marlin_vars_t::fan_speed
uint8_t fan_speed
Definition: marlin_vars.h:88