Prusa MINI Firmware overview
screen_menu_fw_update.c File Reference
#include "screen_menu_fw_update.h"
#include "sys.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_fw_update_init (screen_t *screen)
 
int screen_menu_fw_update_event (screen_t *screen, window_t *window, uint8_t event, void *param)
 

Variables

const char * opt_on_off [] = { "On", "Off", NULL }
 
screen_t screen_menu_fw_update
 
screen_t *const pscreen_menu_fw_update = &screen_menu_fw_update
 

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 
13  {
14  MI_RETURN,
15  MI_ALWAYS,
17  MI_COUNT,
18 } MI_t;

Function Documentation

◆ screen_menu_fw_update_init()

void screen_menu_fw_update_init ( screen_t screen)
20  {
21  screen_menu_init(screen, "FW UPDATE", MI_COUNT, 1, 1);
23  psmd->items[MI_ALWAYS] = (menu_item_t) { { "Always", 0, WI_SWITCH, .wi_switch_select = { 0, opt_on_off } }, SCREEN_MENU_NO_SCREEN };
24  psmd->items[MI_ON_RESTART] = (menu_item_t) { { "On restart", 0, WI_SWITCH, .wi_switch_select = { 0, opt_on_off } }, SCREEN_MENU_NO_SCREEN };
26  psmd->items[MI_ALWAYS].item.wi_switch_select.index = 0;
27  psmd->items[MI_ON_RESTART].item.wi_switch_select.index = 0;
28  psmd->items[MI_ON_RESTART].item.type |= WI_DISABLED;
29  } else {
30  psmd->items[MI_ALWAYS].item.wi_switch_select.index = 1;
31  psmd->items[MI_ON_RESTART].item.wi_switch_select.index = sys_fw_update_on_restart_is_enabled() ? 0 : 1;
32  }
33  psmd->phelp[0].font = resource_font(IDR_FNT_SPECIAL);
34  window_set_text(psmd->phelp[0].win.id, "Select when you want\nto automatically flash\nupdated firmware\nfrom USB flash disk.");
35 }
Here is the call graph for this function:

◆ screen_menu_fw_update_event()

int screen_menu_fw_update_event ( screen_t screen,
window_t window,
uint8_t  event,
void param 
)
37  {
38  if (screen_menu_event(screen, window, event, param))
39  return 1;
40 
41  if (event == WINDOW_EVENT_CLICK) {
42  switch ((int)param) {
43  case MI_ALWAYS:
46  psmd->items[MI_ON_RESTART].item.wi_switch_select.index = sys_fw_update_on_restart_is_enabled() ? 0 : 1;
47  psmd->items[MI_ON_RESTART].item.type &= ~WI_DISABLED;
48  } else {
50  psmd->items[MI_ON_RESTART].item.type |= WI_DISABLED;
51  psmd->items[MI_ON_RESTART].item.wi_switch_select.index = 0;
52  }
53  break;
54  case MI_ON_RESTART:
55  if (!(psmd->items[MI_ON_RESTART].item.type & WI_DISABLED)) {
57  }
58  break;
59  }
60  }
61  return 0;
62 }
Here is the call graph for this function:

Variable Documentation

◆ opt_on_off

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

◆ screen_menu_fw_update

◆ pscreen_menu_fw_update

screen_t* const pscreen_menu_fw_update = &screen_menu_fw_update
screen_menu_draw
void screen_menu_draw(screen_t *screen)
Definition: screen_menu.c:90
opt_on_off
const char * opt_on_off[]
Definition: screen_menu_fw_update.c:11
screen_menu_fw_update_event
int screen_menu_fw_update_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu_fw_update.c:37
MI_ON_RESTART
Definition: screen_menu_fw_update.c:16
screen_menu_event
int screen_menu_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_menu.c:92
MI_RETURN
Definition: screen_menu_fw_update.c:14
sys_fw_update_on_restart_enable
void sys_fw_update_on_restart_enable(void)
Definition: sys.cpp:257
MI_ALWAYS
Definition: screen_menu_fw_update.c:15
MI_COUNT
Definition: screen_menu_fw_update.c:17
screen_menu_done
void screen_menu_done(screen_t *screen)
Definition: screen_menu.c:78
sys_fw_update_on_restart_is_enabled
int sys_fw_update_on_restart_is_enabled(void)
Definition: sys.cpp:253
IDR_FNT_SPECIAL
#define IDR_FNT_SPECIAL
Definition: resource.h:13
SCREEN_MENU_NO_SCREEN
#define SCREEN_MENU_NO_SCREEN
Definition: screen_menu.h:39
sys_fw_update_on_restart_disable
void sys_fw_update_on_restart_disable(void)
Definition: sys.cpp:261
screen_menu_fw_update_init
void screen_menu_fw_update_init(screen_t *screen)
Definition: screen_menu_fw_update.c:20
menu_item_t
struct _menu_item_t menu_item_t
MI_t
MI_t
Definition: screen_menu_fw_update.c:13
sys_fw_update_disable
void sys_fw_update_disable(void)
Definition: sys.cpp:249
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
WI_DISABLED
Definition: window_menu.h:20
WI_SWITCH
Definition: window_menu.h:16
psmd
#define psmd
Definition: screen_menu.h:40
sys_fw_update_enable
void sys_fw_update_enable(void)
Definition: sys.cpp:245
menu_item_return
const menu_item_t menu_item_return
Definition: screen_menu.c:14
sys_fw_update_is_enabled
int sys_fw_update_is_enabled(void)
Definition: sys.cpp:241
resource_font
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
WINDOW_EVENT_CLICK
#define WINDOW_EVENT_CLICK
Definition: window.h:46
screen_menu_data_t
Definition: screen_menu.h:24