Skip to content

Commit

Permalink
System Load settings from File: Provide Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Feb 29, 2024
1 parent b3ee47a commit 929d43c
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/gui/MItem_menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,17 +402,37 @@ MI_LOAD_SETTINGS::MI_LOAD_SETTINGS()
: WI_LABEL_t(_(label), nullptr, is_enabled_t::yes, is_hidden_t::no) {
}

struct SettingsLoadState {
bool is_network;
bool is_connect;
};

void MI_LOAD_SETTINGS::click(IWindowMenu & /*window_menu*/) {
// FIXME: Some error handling/reporting
// TODO: Loading other things than just network
SettingsLoadState settings_loaded = SettingsLoadState { .is_network = true, .is_connect = true };

if (netdev_load_ini_to_eeprom()) {
notify_reconfigure();
} else {
settings_loaded.is_network = false;
}

// FIXME: Error handling
#if BUDDY_ENABLE_CONNECT()
connect_client::MarlinPrinter::load_cfg_from_ini();
if (!connect_client::MarlinPrinter::load_cfg_from_ini()) {
settings_loaded.is_connect = false;
}
#endif
if (settings_loaded.is_connect & settings_loaded.is_network) {
MsgBoxInfo(_("All settings loaded."), Responses_Ok);
} else {
if (!settings_loaded.is_network) {
MsgBoxInfo(_("Network settings failed."), Responses_Ok);
}
#if BUDDY_ENABLE_CONNECT()
if (!settings_loaded.is_connect) {
MsgBoxInfo(_("Connect settings failed."), Responses_Ok);
}
#endif
}
}

/**********************************************************************************************/
Expand Down

0 comments on commit 929d43c

Please sign in to comment.