Prusa MINI Firmware overview
screen_menu_move.c File Reference
#include "gui.h"
#include "screen_menu.h"
#include "marlin_client.h"
#include "menu_vars.h"

Enumerations

enum  MI_t {
  MI_RETURN, MI_RETURN, MI_WIZARD, MI_Z_OFFSET,
  MI_AUTO_HOME, MI_MESH_BED, MI_SELFTEST, MI_CALIB_FIRST,
  MI_RETURN, MI_LOAD, MI_UNLOAD, MI_CHANGE,
  MI_PURGE, MI_RETURN, MI_ALWAYS, MI_ON_RESTART,
  MI_COUNT, MI_RETURN, MI_SYS_INFO, MI_VERSIONS,
  MI_RETURN, MI_MOVE_X, MI_MOVE_Y, MI_MOVE_Z,
  MI_MOVE_E, MI_RETURN, MI_SYS_RESET, MI_CLR_EEPROM,
  MI_WDG_TEST, MI_PLL, MI_SSCG, MI_SSCG_FREQ,
  MI_SSCG_DEPTH, MI_SPI_PRESC, MI_MESH, MI_BSOD,
  MI_BSOD_HARD_FAULT, MI_COUNT, MI_RETURN, MI_TEMPERATURE,
  MI_MOVE_AXIS, MI_DISABLE_STEP, MI_FACTORY_DEFAULTS, MI_FW_UPDATE,
  MI_FILAMENT_SENSOR, MI_TIMEOUT, MI_LAN_SETTINGS, MI_RETURN,
  MI_NOZZLE, MI_HEATBED, MI_PRINTFAN, MI_COOLDOWN,
  MI_RETURN, MI_NOZZLE, MI_HEAT_PWM_PERIOD, MI_HEATBED,
  MI_FAN_PWM_PERIOD, MI_PRINTFAN, MI_COOLDOWN, MI_COUNT
}
 

Functions

void screen_menu_move_init (screen_t *screen)
 
int screen_menu_move_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

const menu_item_t _menu_move_items []
 
screen_t screen_menu_move
 
const screen_tpscreen_menu_move = &screen_menu_move
 

Enumeration Type Documentation

◆ MI_t

enum MI_t
Enumerator
MI_RETURN 
MI_RETURN 
MI_WIZARD 
MI_Z_OFFSET 
MI_AUTO_HOME 
MI_MESH_BED 
MI_SELFTEST 
MI_CALIB_FIRST 
MI_RETURN 
MI_LOAD 
MI_UNLOAD 
MI_CHANGE 
MI_PURGE 
MI_RETURN 
MI_ALWAYS 
MI_ON_RESTART 
MI_COUNT 
MI_RETURN 
MI_SYS_INFO 
MI_VERSIONS 
MI_RETURN 
MI_MOVE_X 
MI_MOVE_Y 
MI_MOVE_Z 
MI_MOVE_E 
MI_RETURN 
MI_SYS_RESET 
MI_CLR_EEPROM 
MI_WDG_TEST 
MI_PLL 
MI_SSCG 
MI_SSCG_FREQ 
MI_SSCG_DEPTH 
MI_SPI_PRESC 
MI_MESH 
MI_BSOD 
MI_BSOD_HARD_FAULT 
MI_COUNT 
MI_RETURN 
MI_TEMPERATURE 
MI_MOVE_AXIS 
MI_DISABLE_STEP 
MI_FACTORY_DEFAULTS 
MI_FW_UPDATE 
MI_FILAMENT_SENSOR 
MI_TIMEOUT 
MI_LAN_SETTINGS 
MI_RETURN 
MI_NOZZLE 
MI_HEATBED 
MI_PRINTFAN 
MI_COOLDOWN 
MI_RETURN 
MI_NOZZLE 
MI_HEAT_PWM_PERIOD 
MI_HEATBED 
MI_FAN_PWM_PERIOD 
MI_PRINTFAN 
MI_COOLDOWN 
MI_COUNT 
9  {
10  MI_RETURN,
11  MI_MOVE_X,
12  MI_MOVE_Y,
13  MI_MOVE_Z,
14  MI_MOVE_E,
15 } MI_t;

Function Documentation

◆ screen_menu_move_init()

void screen_menu_move_init ( screen_t screen)
24  {
25  marlin_vars_t *vars;
26  int count = sizeof(_menu_move_items) / sizeof(menu_item_t);
27  screen_menu_init(screen, "MOVE AXIS", count + 1, 1, 0);
28  psmd->items[0] = menu_item_return;
29  memcpy(psmd->items + 1, _menu_move_items, count * sizeof(menu_item_t));
30 
32  psmd->items[MI_MOVE_X].item.wi_spin.value = (int32_t)(vars->pos[0] * 1000);
33  psmd->items[MI_MOVE_Y].item.wi_spin.value = (int32_t)(vars->pos[1] * 1000);
34  psmd->items[MI_MOVE_Z].item.wi_spin.value = (int32_t)(vars->pos[2] * 1000);
35  if (vars->temp_nozzle < extrude_min_temp)
36  psmd->items[MI_MOVE_E].item.type |= WI_DISABLED;
38 }
Here is the call graph for this function:

◆ screen_menu_move_event()

int screen_menu_move_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
40  {
41  marlin_vars_t *vars;
42  if (screen_menu_event(screen, window, event, param))
43  return 1;
44  if (event == WINDOW_EVENT_CHANGING) {
45  char axis[4] = { 'X', 'Y', 'Z', 'E' };
46  marlin_gcode_printf("G0 %c%.4f F%d", axis[(int)param - 1], psmd->items[(int)param].item.wi_spin.value / 1000.0, manual_feedrate[(int)param - 1]);
47  } else if ((event == WINDOW_EVENT_CHANGE) && ((int)param == MI_MOVE_E)) {
48  // marlin_gcode("G92 E0"); // Reset position after change - not necessary
49  } else if (event == WINDOW_EVENT_CLICK) {
50  marlin_gcode("G90"); // Set to Absolute Positioning
51  if ((int)param == MI_MOVE_E) {
52  marlin_gcode("M82"); // Set extruder to absolute mode
53  marlin_gcode("G92 E0"); // Reset position before change
54  }
55  psmd->items[MI_MOVE_E].item.wi_spin.value = 0; // Reset spin before change
56  psmd->menu.win.flg &= ~WINDOW_FLG_INVALID;
57  } else if (event == WINDOW_EVENT_TIMER) {
58  vars = marlin_vars();
59  if (vars->target_nozzle > extrude_min_temp) {
60  if (psmd->items[MI_MOVE_E].item.type & WI_DISABLED) {
61  psmd->items[MI_MOVE_E].item.type ^= WI_DISABLED;
62  psmd->menu.win.flg &= ~WINDOW_FLG_INVALID;
63  }
64  } else {
65  if (!(psmd->items[MI_MOVE_E].item.type & WI_DISABLED)) {
66  psmd->items[MI_MOVE_E].item.type ^= WI_DISABLED;
67  psmd->menu.win.flg &= ~WINDOW_FLG_INVALID;
68  }
69  }
70  }
71  return 0;
72 }
Here is the call graph for this function:

Variable Documentation

◆ _menu_move_items

const menu_item_t _menu_move_items[]
Initial value:
= {
{ { "Move X", 0, WI_SPIN, .wi_spin = { 0, move_x } }, SCREEN_MENU_NO_SCREEN },
{ { "Move Y", 0, WI_SPIN, .wi_spin = { 0, move_y } }, SCREEN_MENU_NO_SCREEN },
{ { "Move Z", 0, WI_SPIN, .wi_spin = { 0, move_z } }, SCREEN_MENU_NO_SCREEN },
{ { "Extruder", 0, WI_SPIN, .wi_spin = { 0, move_e } }, SCREEN_MENU_NO_SCREEN },
}

◆ screen_menu_move

screen_t screen_menu_move

◆ pscreen_menu_move

const screen_t* pscreen_menu_move = &screen_menu_move
_menu_item_t
Definition: screen_menu.h:19
manual_feedrate
const int32_t manual_feedrate[4]
Definition: menu_vars.cpp:41
screen_menu_event
int screen_menu_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu.c:92
screen_menu_done
void screen_menu_done(screen_t *screen)
Definition: screen_menu.c:78
move_z
const int32_t move_z[3]
Definition: menu_vars.cpp:39
move_x
const int32_t move_x[3]
Definition: menu_vars.cpp:37
SCREEN_MENU_NO_SCREEN
#define SCREEN_MENU_NO_SCREEN
Definition: screen_menu.h:39
WI_SPIN
Definition: window_menu.h:15
WINDOW_EVENT_CHANGE
#define WINDOW_EVENT_CHANGE
Definition: window.h:47
MI_t
MI_t
Definition: screen_menu_move.c:9
_marlin_vars_t::temp_nozzle
float temp_nozzle
Definition: marlin_vars.h:83
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
WI_DISABLED
Definition: window_menu.h:20
MARLIN_VAR_TEMP_NOZ
#define MARLIN_VAR_TEMP_NOZ
Definition: marlin_vars.h:19
_menu_move_items
const menu_item_t _menu_move_items[]
Definition: screen_menu_move.c:17
marlin_vars
marlin_vars_t * marlin_vars(void)
Definition: marlin_client.c:361
_marlin_vars_t::target_nozzle
float target_nozzle
Definition: marlin_vars.h:85
psmd
#define psmd
Definition: screen_menu.h:40
MI_MOVE_Y
Definition: screen_menu_move.c:12
marlin_gcode
void marlin_gcode(const char *gcode)
Definition: marlin_client.c:195
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
MARLIN_VAR_MSK
#define MARLIN_VAR_MSK(v_id)
Definition: marlin_vars.h:35
move_e
const int32_t move_e[3]
Definition: menu_vars.cpp:40
menu_item_return
const menu_item_t menu_item_return
Definition: screen_menu.c:14
extrude_min_temp
const int32_t extrude_min_temp
Definition: menu_vars.cpp:43
screen_menu_move_init
void screen_menu_move_init(screen_t *screen)
Definition: screen_menu_move.c:24
screen_menu_move_event
int screen_menu_move_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu_move.c:40
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
gui_timer_create_periodical
int8_t gui_timer_create_periodical(uint32_t ms, int16_t win_id)
Definition: gui_timer.c:70
screen_menu_data_t
Definition: screen_menu.h:24
MARLIN_VAR_MSK_POS_XYZE
#define MARLIN_VAR_MSK_POS_XYZE
Definition: marlin_vars.h:40
_marlin_vars_t
Definition: marlin_vars.h:77
MI_RETURN
Definition: screen_menu_move.c:10
MI_MOVE_E
Definition: screen_menu_move.c:14
_marlin_vars_t::pos
float pos[4]
Definition: marlin_vars.h:82
WINDOW_EVENT_TIMER
#define WINDOW_EVENT_TIMER
Definition: window.h:50
move_y
const int32_t move_y[3]
Definition: menu_vars.cpp:38
marlin_gcode_printf
int marlin_gcode_printf(const char *format,...)
Definition: marlin_client.c:206
MI_MOVE_Z
Definition: screen_menu_move.c:13
WINDOW_FLG_INVALID
#define WINDOW_FLG_INVALID
Definition: window.h:26
MI_MOVE_X
Definition: screen_menu_move.c:11