Prusa MINI Firmware overview
screen_menu_settings.c File Reference
#include "gui.h"
#include "app.h"
#include "marlin_client.h"
#include "screen_menu.h"
#include "cmsis_os.h"
#include "sys.h"
#include "eeprom.h"
#include "screen_lan_settings.h"
#include "screen_menu_fw_update.h"
#include "filament_sensor.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_settings_init (screen_t *screen)
 
int screen_menu_settings_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

screen_t screen_menu_temperature
 
screen_t screen_menu_move
 
osThreadId webServerTaskHandle
 
const char * settings_opt_enable_disable [] = { "Off", "On", NULL }
 
const menu_item_t _menu_settings_items []
 
screen_t screen_menu_settings
 
const screen_tpscreen_menu_settings = &screen_menu_settings
 

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 
24  {
25  MI_RETURN,
30 #ifdef _DEBUG
31  MI_SERVICE,
32  MI_TEST,
33 #endif //_DEBUG
36  MI_TIMEOUT,
38 } MI_t;

Function Documentation

◆ screen_menu_settings_init()

void screen_menu_settings_init ( screen_t screen)
55  {
56  int count = sizeof(_menu_settings_items) / sizeof(menu_item_t);
57  screen_menu_init(screen, "SETTINGS", count + 1, 1, 0);
59  memcpy(psmd->items + 1, _menu_settings_items, count * sizeof(menu_item_t));
60 
62  if (fs == FS_NOT_CONNECTED) {
63  fs_disable();
64  fs = FS_DISABLED;
65  }
66  psmd->items[MI_FILAMENT_SENSOR].item.wi_switch_select.index = (fs != FS_DISABLED);
67  psmd->items[MI_TIMEOUT].item.wi_switch_select.index = menu_timeout_enabled; //st25dv64k_user_read(MENU_TIMEOUT_FLAG_ADDRESS)
68 }
Here is the call graph for this function:

◆ screen_menu_settings_event()

int screen_menu_settings_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
70  {
71  if (screen_menu_event(screen, window, event, param))
72  return 1;
73  if (event == WINDOW_EVENT_CLICK) {
74  switch ((int)param) {
75  case MI_DISABLE_STEP:
76  marlin_gcode("M18");
77  break;
79  if (gui_msgbox("This operation can't be undone, current configuration will be lost! Are you really sure to reset printer to factory defaults?", MSGBOX_BTN_YESNO | MSGBOX_ICO_WARNING | MSGBOX_DEF_BUTTON1) == MSGBOX_RES_YES) {
81  marlin_gcode("M502");
83  gui_loop();
84  }
86  marlin_gcode("M500");
88  gui_loop();
89  }
91  gui_msgbox("Factory defaults loaded. The system will now restart.", MSGBOX_BTN_OK | MSGBOX_ICO_INFO);
92  sys_reset();
93  }
94  break;
95  case MI_TIMEOUT:
96  if (menu_timeout_enabled == 1) {
99  //st25dv64k_user_write((uint16_t)MENU_TIMEOUT_FLAG_ADDRESS, (uint8_t)0);
100  } else {
102  //st25dv64k_user_write((uint16_t)MENU_TIMEOUT_FLAG_ADDRESS, (uint8_t)1);
103  }
104  break;
105  case MI_FILAMENT_SENSOR: {
106  fsensor_t fs = fs_get_state();
107  fs == FS_DISABLED ? fs_enable() : fs_disable();
108  fs = fs_wait_inicialized();
109  if (fs == FS_NOT_CONNECTED) //tried to enable but there is no sensor
110  {
111  fs_disable();
112  psmd->items[MI_FILAMENT_SENSOR].item.wi_switch_select.index = 0;
113  //todo need to invalidate that stupid item, but I cannot grrrr
114  gui_msgbox("No filament sensor detected. Verify that the sensor is connected and try again.", MSGBOX_ICO_QUESTION);
115  }
116  } break;
117  }
118  }
119  return 0;
120 }
Here is the call graph for this function:

Variable Documentation

◆ screen_menu_temperature

screen_t screen_menu_temperature

◆ screen_menu_move

screen_t screen_menu_move

◆ webServerTaskHandle

osThreadId webServerTaskHandle

◆ settings_opt_enable_disable

const char* settings_opt_enable_disable[] = { "Off", "On", NULL }

◆ _menu_settings_items

const menu_item_t _menu_settings_items[]
Initial value:
= {
{ { "Temperature", 0, WI_LABEL }, &screen_menu_temperature },
{ { "Move Axis", 0, WI_LABEL }, &screen_menu_move },
{ { "Disable Steppers", 0, WI_LABEL }, SCREEN_MENU_NO_SCREEN },
{ { "Factory Reset", 0, WI_LABEL }, SCREEN_MENU_NO_SCREEN },
{ { "FW Update", 0, WI_LABEL }, &screen_menu_fw_update },
{ { "Fil. sens.", 0, WI_SWITCH, .wi_switch_select = { 0, settings_opt_enable_disable } }, SCREEN_MENU_NO_SCREEN },
{ { "Timeout", 0, WI_SWITCH, .wi_switch_select = { 0, settings_opt_enable_disable } }, SCREEN_MENU_NO_SCREEN },
{ { "LAN Settings", 0, WI_LABEL }, &screen_lan_settings },
}

◆ screen_menu_settings

◆ pscreen_menu_settings

const screen_t* pscreen_menu_settings = &screen_menu_settings
fs_enable
void fs_enable()
Definition: filament_sensor.c:90
MI_t
MI_t
Definition: screen_menu_settings.c:24
screen_menu_temperature
screen_t screen_menu_temperature
Definition: screen_menu_temperature.c:65
MI_LAN_SETTINGS
Definition: screen_menu_settings.c:37
_menu_item_t
Definition: screen_menu.h:19
screen_menu_draw
void screen_menu_draw(screen_t *screen)
Definition: screen_menu.c:90
MI_RETURN
Definition: screen_menu_settings.c:25
sys_reset
void sys_reset(void)
Definition: sys.cpp:20
MI_FW_UPDATE
Definition: screen_menu_settings.c:34
FS_DISABLED
Definition: filament_sensor.h:22
screen_menu_event
int screen_menu_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu.c:92
settings_opt_enable_disable
const char * settings_opt_enable_disable[]
Definition: screen_menu_settings.c:22
screen_menu_done
void screen_menu_done(screen_t *screen)
Definition: screen_menu.c:78
MSGBOX_ICO_QUESTION
#define MSGBOX_ICO_QUESTION
Definition: window_msgbox.h:34
MSGBOX_ICO_WARNING
#define MSGBOX_ICO_WARNING
Definition: window_msgbox.h:35
SCREEN_MENU_NO_SCREEN
#define SCREEN_MENU_NO_SCREEN
Definition: screen_menu.h:39
_menu_settings_items
const menu_item_t _menu_settings_items[]
Definition: screen_menu_settings.c:40
MSGBOX_DEF_BUTTON1
#define MSGBOX_DEF_BUTTON1
Definition: window_msgbox.h:55
MSGBOX_ICO_INFO
#define MSGBOX_ICO_INFO
Definition: window_msgbox.h:36
MSGBOX_BTN_OK
#define MSGBOX_BTN_OK
Definition: window_msgbox.h:20
screen_lan_settings
screen_t screen_lan_settings
Definition: screen_lan_settings.c:283
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_EVT_StoreSettings
#define MARLIN_EVT_StoreSettings
Definition: marlin_events.h:23
MI_MOVE_AXIS
Definition: screen_menu_settings.c:27
MSGBOX_RES_YES
#define MSGBOX_RES_YES
Definition: window_msgbox.h:44
WI_SWITCH
Definition: window_menu.h:16
MI_FACTORY_DEFAULTS
Definition: screen_menu_settings.c:29
fs_get_state
fsensor_t fs_get_state()
Definition: filament_sensor.c:67
eeprom_defaults
void eeprom_defaults(void)
Definition: eeprom.c:69
psmd
#define psmd
Definition: screen_menu.h:40
marlin_gcode
void marlin_gcode(const char *gcode)
Definition: marlin_client.c:195
screen_menu_settings_init
void screen_menu_settings_init(screen_t *screen)
Definition: screen_menu_settings.c:55
WI_LABEL
Definition: window_menu.h:14
screen_menu_fw_update
screen_t screen_menu_fw_update
Definition: screen_menu_fw_update.c:64
menu_item_return
const menu_item_t menu_item_return
Definition: screen_menu.c:14
screen_menu_move
screen_t screen_menu_move
Definition: screen_menu_move.c:74
MARLIN_EVT_FactoryReset
#define MARLIN_EVT_FactoryReset
Definition: marlin_events.h:21
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
gui_get_menu_timeout_id
int8_t gui_get_menu_timeout_id(void)
Definition: gui_timer.c:147
MSGBOX_BTN_YESNO
#define MSGBOX_BTN_YESNO
Definition: window_msgbox.h:24
MI_TIMEOUT
Definition: screen_menu_settings.c:36
MI_DISABLE_STEP
Definition: screen_menu_settings.c:28
MI_FILAMENT_SENSOR
Definition: screen_menu_settings.c:35
screen_menu_data_t
Definition: screen_menu.h:24
FS_NOT_CONNECTED
Definition: filament_sensor.h:21
fs_wait_inicialized
fsensor_t fs_wait_inicialized()
Definition: filament_sensor.c:104
fsensor_t
fsensor_t
Definition: filament_sensor.h:17
fs_disable
void fs_disable()
Definition: filament_sensor.c:97
MI_TEMPERATURE
Definition: screen_menu_settings.c:26
screen_menu_settings_event
int screen_menu_settings_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu_settings.c:70
menu_timeout_enabled
int8_t menu_timeout_enabled
Definition: guimain.c:103
gui_timer_delete
void gui_timer_delete(int8_t id)
Definition: gui_timer.c:79
marlin_event_clr
int marlin_event_clr(uint8_t evt_id)
Definition: marlin_client.c:252