Prusa MINI Firmware overview
screen_menu_preheat.cpp File Reference
#include <stdio.h>
#include "gui.h"
#include "screen_menu.h"
#include "filament.h"
#include "marlin_client.h"

Functions

void screen_menu_preheat_init (screen_t *screen)
 
void screen_menu_preheat_done (screen_t *screen)
 
int screen_menu_preheat_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

uint8_t menu_preheat_type = 0
 
screen_t screen_menu_preheat
 
const screen_tpscreen_menu_preheat = &screen_menu_preheat
 

Function Documentation

◆ screen_menu_preheat_init()

void screen_menu_preheat_init ( screen_t screen)
16  {
17  switch (menu_preheat_type) {
18  case 0:
19  screen_menu_init(screen, "PREHEAT", FILAMENTS_END + 1, 1, 0);
20  break;
21  case 1:
22  screen_menu_init(screen, "LOAD FILAMENT", FILAMENTS_END, 1, 1);
23  window_set_text(psmd->phelp->win.id,
24  "The nozzle must be\npreheated before\ninserting the filament.\n"
25  "Please, select the type\nof material");
26  break;
27  }
28 
29  psmd->items[0] = menu_item_return;
30 
31  for (size_t i = 1; i < FILAMENTS_END; i++) {
32  memset((char *)psmd->items[i].item.label, ' ', sizeof(char) * 15);
33  strncpy((char *)psmd->items[i].item.label, filaments[i].name,
34  strlen(filaments[i].name));
35  sprintf((char *)psmd->items[i].item.label + 9, "%d/%d",
37  }
38 
39  if (!menu_preheat_type) {
40  psmd->items[FILAMENTS_END] = (menu_item_t) { { "Cooldown", 0, WI_LABEL }, SCREEN_MENU_NO_SCREEN };
41  }
42 
43  window_set_item_index(psmd->menu.win.id, get_filament());
44 }
Here is the call graph for this function:

◆ screen_menu_preheat_done()

void screen_menu_preheat_done ( screen_t screen)
46  {
47  screen_menu_done(screen);
48 }
Here is the call graph for this function:

◆ screen_menu_preheat_event()

int screen_menu_preheat_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
51  {
52  if (screen_menu_event(screen, window, event, param)) {
53  return 1; // Screen return return here ...
54  }
55  if (event != WINDOW_EVENT_CLICK) {
56  return 0;
57  }
58 
59  filament_t filament;
60  FILAMENT_t fil_id;
61 
62  if ((uint32_t)param < (uint32_t)FILAMENTS_END) {
63  fil_id = (FILAMENT_t)(uint32_t)param;
64  } else {
65  fil_id = FILAMENT_NONE;
66  }
67 
68  filament = filaments[fil_id];
69 
70  marlin_gcode("M86 S1800"); // enable safety timer
71  marlin_gcode_printf("M104 S%d", (int)filament.nozzle);
72  marlin_gcode_printf("M140 S%d", (int)filament.heatbed);
73 
74  screen_close(); // skip this screen averytime
75 
76  if (menu_preheat_type == 1) {
77  set_filament(fil_id); // store the filamen to eeprom
78  }
79  return 1;
80 }
Here is the call graph for this function:

Variable Documentation

◆ menu_preheat_type

uint8_t menu_preheat_type = 0

◆ screen_menu_preheat

◆ pscreen_menu_preheat

const screen_t* pscreen_menu_preheat = &screen_menu_preheat
FILAMENTS_END
Definition: filament.h:31
screen_menu_draw
void screen_menu_draw(screen_t *screen)
Definition: screen_menu.c:90
set_filament
void set_filament(FILAMENT_t filament)
Definition: filament.cpp:32
FILAMENT_NONE
Definition: filament.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
screen_menu_done
void screen_menu_done(screen_t *screen)
Definition: screen_menu.c:78
i
uint8_t i
Definition: screen_test_graph.c:72
SCREEN_MENU_NO_SCREEN
#define SCREEN_MENU_NO_SCREEN
Definition: screen_menu.h:39
filaments
const filament_t filaments[FILAMENTS_END]
Definition: filament.cpp:20
menu_item_t
struct _menu_item_t menu_item_t
screen_close
void screen_close(void)
Definition: screen.c:80
filament_t::name
const char * name
Definition: filament.h:17
screen_menu_preheat_event
int screen_menu_preheat_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu_preheat.cpp:50
window_set_text
void window_set_text(int16_t id, const char *text)
Definition: window.c:340
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
menu_preheat_type
uint8_t menu_preheat_type
Definition: screen_menu_preheat.cpp:14
screen_menu_preheat_init
void screen_menu_preheat_init(screen_t *screen)
Definition: screen_menu_preheat.cpp:16
get_filament
FILAMENT_t get_filament()
Definition: filament.cpp:41
filament_t::nozzle
uint16_t nozzle
Definition: filament.h:19
netif::name
char name[2]
Definition: netif.h:307
psmd
#define psmd
Definition: screen_menu.h:40
marlin_gcode
void marlin_gcode(const char *gcode)
Definition: marlin_client.c:195
WI_LABEL
Definition: window_menu.h:14
menu_item_return
const menu_item_t menu_item_return
Definition: screen_menu.c:14
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
screen_menu_data_t
Definition: screen_menu.h:24
screen_menu_preheat_done
void screen_menu_preheat_done(screen_t *screen)
Definition: screen_menu_preheat.cpp:46
filament_t::heatbed
uint16_t heatbed
Definition: filament.h:20
FILAMENT_t
FILAMENT_t
Definition: filament.h:25
filament_t
Definition: filament.h:16
window_set_item_index
void window_set_item_index(int16_t id, int index)
Definition: window.c:598
marlin_gcode_printf
int marlin_gcode_printf(const char *format,...)
Definition: marlin_client.c:206