Prusa MINI Firmware overview
|
#include "screen_lan_settings.h"
#include "lwip/dhcp.h"
#include "lwip/netifapi.h"
#include "lwip.h"
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
|
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
} |
|
◆ MAC_ADDR_START
#define MAC_ADDR_START 0x1FFF781A |
◆ MAC_ADDR_SIZE
◆ MAX_INI_SIZE
◆ IP4_ADDR_STR_SIZE
#define IP4_ADDR_STR_SIZE 16 |
◆ 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 | |
29 #ifdef STATIC_SAVE_LOAD_CONFIG
32 #endif //STATIC_SAVE_LOAD_CONFIG
◆ _screen_lan_settings_item()
52 *ppitem = &(
plsd->items[index].item);
◆ _get_ip4_addrs()
57 if (dhcp_supplied_address(&
eth0)) {
58 config.lan_ip4_addr.addr = netif_ip4_addr(&
eth0)->addr;
59 config.lan_ip4_msk.addr = netif_ip4_netmask(&
eth0)->addr;
60 config.lan_ip4_gw.addr = netif_ip4_gw(&
eth0)->addr;
◆ _addrs_to_str()
static void _addrs_to_str |
( |
char * |
param_str, |
|
|
uint8_t |
flg |
|
) |
| |
|
static |
77 snprintf(param_str,
MAX_INI_SIZE,
"[lan_ip4]\naddress=%s\nmask=%s\ngateway=%s", ip4_addr_str, ip4_msk_str, ip4_gw_str);
79 snprintf(
plan_str, 150,
"IPv4 Address:\n %s\nIPv4 Netmask:\n %s\nIPv4 Gateway:\n %s\nMAC Address:\n %s",
80 ip4_addr_str, ip4_msk_str, ip4_gw_str, param_str);
◆ _parse_MAC_addr()
static void _parse_MAC_addr |
( |
char * |
mac_addr_str | ) |
|
|
static |
84 volatile uint8_t mac_addr[] = { 0, 0, 0, 0, 0, 0 };
88 sprintf(mac_addr_str,
"%x:%x:%x:%x:%x:%x", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
◆ screen_lan_settings_init()
111 plsd->menu.count = count + 1;
113 plsd->menu.data = (
void *)screen;
122 #ifdef STATIC_SAVE_LOAD_CONFIG
124 #endif //STATIC_SAVE_LOAD_CONFIG
135 sprintf(
plan_str,
"IPv4 Address:\n 0.0.0.0\nIPv4 Netmask:\n 0.0.0.0\nIPv4 Gateway:\n 0.0.0.0\nMAC Address:\n %s",
◆ screen_lan_settings_event()
222 switch ((
int)param) {
226 #ifdef STATIC_SAVE_LOAD_CONFIG
229 if (gui_msgbox(
"Please insert USB flash disk and try again.",
234 if (_save_ini_file()) {
235 if (gui_msgbox(
"Settings saved in the \"lan_settings.ini\" file.",
240 if (gui_msgbox(
"File \"lan_settings.ini\" did not saved properly.",
249 if (gui_msgbox(
"Please insert USB flash disk and try again.",
254 if (_load_ini_file()) {
261 if (gui_msgbox(
"File \"lan_settings.ini\" not found in the root directory of the USB flash disk.",
268 #endif //STATIC_SAVE_LOAD_CONFIG
◆ screen_lan_settings_draw()
◆ screen_lan_settings_done()
◆ plan_str
◆ config
◆ _menu_lan_items
◆ screen_lan_settings
◆ pscreen_lan_settings
void gui_free(void *ptr)
Definition: gui.c:39
static uint8_t _get_ip4_addrs(void)
Definition: screen_lan_settings.c:55
#define plsd
Definition: screen_lan_settings.h:16
static int screen_lan_settings_event(screen_t *screen, window_t *window, uint8_t event, void *param)
Definition: screen_lan_settings.c:213
static rect_ui16_t rect_ui16(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Definition: guitypes.h:159
void * gui_malloc(unsigned int size)
Definition: gui.c:35
static void screen_lan_settings_done(screen_t *screen)
Definition: screen_lan_settings.c:276
uint8_t data[8]
Definition: masstorage.h:49
void window_destroy(int16_t id)
Definition: window.c:132
static padding_ui8_t padding_ui8(uint8_t l, uint8_t t, uint8_t r, uint8_t b)
Definition: guitypes.h:164
uint8_t i
Definition: screen_test_graph.c:72
bool media_is_inserted()
Definition: Marlin_CardReader.cpp:17
#define IDR_FNT_SPECIAL
Definition: resource.h:13
const menu_item_t _menu_lan_items[]
Definition: screen_lan_settings.c:42
#define MSGBOX_ICO_INFO
Definition: window_msgbox.h:36
#define MSGBOX_BTN_OK
Definition: window_msgbox.h:20
void screen_close(void)
Definition: screen.c:80
void window_disable(int16_t id)
Definition: window.c:523
Definition: screen_lan_settings.h:19
Definition: screen_lan_settings.c:28
#define WINDOW_CLS_FRAME
Definition: window.h:9
#define MAC_ADDR_SIZE
Definition: screen_lan_settings.c:23
MI_t
Definition: screen_lan_settings.c:27
#define WINDOW_CLS_MENU
Definition: window.h:18
void window_set_focus(int16_t id)
Definition: window.c:480
#define MAX_INI_SIZE
Definition: screen_lan_settings.c:24
static char * plan_str
Definition: screen_lan_settings.c:35
#define MAC_ADDR_START
Definition: screen_lan_settings.c:22
static void screen_lan_settings_draw(screen_t *screen)
Definition: screen_lan_settings.c:273
Definition: guitypes.h:69
const uint8_t[]
Definition: 404_html.c:3
static void _screen_lan_settings_item(window_menu_t *pwindow_menu, uint16_t index, window_menu_item_t **ppitem, void *data)
Definition: screen_lan_settings.c:49
#define MSGBOX_RES_OK
Definition: window_msgbox.h:46
static void _parse_MAC_addr(char *mac_addr_str)
Definition: screen_lan_settings.c:83
#define WINDOW_CLS_TEXT
Definition: window.h:10
static void screen_lan_settings_init(screen_t *screen)
Definition: screen_lan_settings.c:91
font_t * resource_font(uint16_t id)
Definition: guitypes.c:186
#define WINDOW_EVENT_CLICK
Definition: window.h:46
int16_t window_create_ptr(int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
Definition: window.c:102
#define IP4_ADDR_STR_SIZE
Definition: screen_lan_settings.c:25
#define MSGBOX_ICO_ERROR
Definition: window_msgbox.h:33
Definition: deflate.c:120
static void _addrs_to_str(char *param_str, uint8_t flg)
Definition: screen_lan_settings.c:70
struct netif eth0
Definition: lwip.c:72
#define WINDOW_FLG_INVALID
Definition: window.h:26
#define netif_is_up(netif)
Definition: netif.h:401