mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 02:42:36 +02:00
No more LATERs
This commit is contained in:
@@ -132,8 +132,7 @@ namespace Configuration {
|
||||
grbl_sendf(out_->client(), "$%s=%s\r\n", setting_, value.toString().c_str());
|
||||
} else {
|
||||
IPAddress ip;
|
||||
auto str = String(newValue_);
|
||||
if (!ip.fromString(str)) {
|
||||
if (!ip.fromString(newValue_)) {
|
||||
Assert(false, "Expected an IP address like 192.168.0.100");
|
||||
}
|
||||
value = ip;
|
||||
|
@@ -147,13 +147,15 @@ namespace WebUI {
|
||||
void BTConfig::end() { SerialBT.end(); }
|
||||
|
||||
/**
|
||||
* Reset ESP
|
||||
* Reset Bluetooth settings
|
||||
* XXX this is not called from anywhere
|
||||
*/
|
||||
void BTConfig::reset_settings() {
|
||||
# ifdef LATER
|
||||
// Implement this in YAML land
|
||||
// was wifi_radio_mode->setDefault();
|
||||
# endif
|
||||
auto bt = config->_comms->_bluetoothConfig;
|
||||
if (bt) {
|
||||
delete bt;
|
||||
config->_comms->_bluetoothConfig = nullptr;
|
||||
}
|
||||
info_all("BT reset done");
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "../Settings.h"
|
||||
#include "../Machine/MachineConfig.h"
|
||||
#include "../Machine/WifiSTAConfig.h"
|
||||
#include "../Configuration/JsonGenerator.h"
|
||||
#include "../Grbl.h" //GRBL_VERSION
|
||||
#include "../Serial.h" // CLIENT_ALL
|
||||
@@ -939,19 +940,29 @@ namespace WebUI {
|
||||
char* netmask = get_param("MSK", false);
|
||||
char* ip = get_param("IP", false);
|
||||
|
||||
# ifdef LATER
|
||||
// Needs to be converted to YAML land
|
||||
Error err = wifi_sta_ip->setStringValue(ip);
|
||||
if (err == Error::Ok) {
|
||||
err = wifi_sta_netmask->setStringValue(netmask);
|
||||
auto sta = config->_comms->_staConfig;
|
||||
if (!sta) {
|
||||
sta = config->_comms->_staConfig = new Machine::WifiSTAConfig();
|
||||
}
|
||||
if (err == Error::Ok) {
|
||||
err = wifi_sta_gateway->setStringValue(gateway);
|
||||
|
||||
IPAddress ipv;
|
||||
|
||||
if (!ipv.fromString(ip)) {
|
||||
return Error::InvalidValue;
|
||||
}
|
||||
# else
|
||||
Error err = Error::SettingDisabled;
|
||||
# endif
|
||||
return err;
|
||||
sta->_ipAddress = ipv;
|
||||
|
||||
if (!ipv.fromString(netmask)) {
|
||||
return Error::InvalidValue;
|
||||
}
|
||||
sta->_netmask = ipv;
|
||||
|
||||
if (!ipv.fromString(gateway)) {
|
||||
return Error::InvalidValue;
|
||||
}
|
||||
sta->_gateway = ipv;
|
||||
|
||||
return Error::Ok;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -443,6 +443,8 @@ namespace WebUI {
|
||||
*/
|
||||
void WiFiConfig::reset_settings() {
|
||||
bool error = false;
|
||||
// XXX this is probably wrong for YAML land.
|
||||
// We might want this function to go away.
|
||||
for (Setting* s = Setting::List; s; s = s->next()) {
|
||||
if (s->getDescription()) {
|
||||
s->setDefault();
|
||||
|
Reference in New Issue
Block a user