mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 02:42:36 +02:00
Split out ENABLE_WIFI and ENABLE_BLUETOOTH configs.
This commit is contained in:
@@ -70,28 +70,9 @@ const int BAUD_RATE = 115200;
|
|||||||
//#define CONNECT_TO_SSID "your SSID"
|
//#define CONNECT_TO_SSID "your SSID"
|
||||||
//#define SSID_PASSWORD "your SSID password"
|
//#define SSID_PASSWORD "your SSID password"
|
||||||
//CONFIGURE_EYECATCH_BEGIN (DO NOT MODIFY THIS LINE)
|
//CONFIGURE_EYECATCH_BEGIN (DO NOT MODIFY THIS LINE)
|
||||||
#define ENABLE_BLUETOOTH // enable bluetooth
|
|
||||||
|
|
||||||
#define ENABLE_WIFI //enable wifi
|
// #define ENABLE_BLUETOOTH // enable bluetooth -- platformio: pio run -e bt
|
||||||
|
// #define ENABLE_WIFI // enable wifi -- platformio: pio run -e wifi
|
||||||
#define WIFI_OR_BLUETOOTH
|
|
||||||
|
|
||||||
#define ENABLE_HTTP //enable HTTP and all related services
|
|
||||||
#define ENABLE_OTA //enable OTA
|
|
||||||
#define ENABLE_TELNET //enable telnet
|
|
||||||
#define ENABLE_TELNET_WELCOME_MSG //display welcome string when connect to telnet
|
|
||||||
#define ENABLE_MDNS //enable mDNS discovery
|
|
||||||
#define ENABLE_SSDP //enable UPNP discovery
|
|
||||||
#define ENABLE_NOTIFICATIONS //enable notifications
|
|
||||||
|
|
||||||
#define ENABLE_SERIAL2SOCKET_IN
|
|
||||||
#define ENABLE_SERIAL2SOCKET_OUT
|
|
||||||
|
|
||||||
// Captive portal is used when WiFi is in access point mode. It lets the
|
|
||||||
// WebUI come up automatically in the browser, instead of requiring the user
|
|
||||||
// to browse manually to a default URL. It works like airport and hotel
|
|
||||||
// WiFi that takes you a special page as soon as you connect to that AP.
|
|
||||||
#define ENABLE_CAPTIVE_PORTAL
|
|
||||||
|
|
||||||
// Warning! The current authentication implementation is too weak to provide
|
// Warning! The current authentication implementation is too weak to provide
|
||||||
// security against an attacker, since passwords are stored and transmitted
|
// security against an attacker, since passwords are stored and transmitted
|
||||||
@@ -99,7 +80,7 @@ const int BAUD_RATE = 115200;
|
|||||||
// "friendly suggestion" to prevent unwitting dangerous actions, rather than
|
// "friendly suggestion" to prevent unwitting dangerous actions, rather than
|
||||||
// as effective security against malice.
|
// as effective security against malice.
|
||||||
// #define ENABLE_AUTHENTICATION
|
// #define ENABLE_AUTHENTICATION
|
||||||
//CONFIGURE_EYECATCH_END (DO NOT MODIFY THIS LINE)
|
// CONFIGURE_EYECATCH_END (DO NOT MODIFY THIS LINE)
|
||||||
|
|
||||||
#ifdef ENABLE_AUTHENTICATION
|
#ifdef ENABLE_AUTHENTICATION
|
||||||
const char* const DEFAULT_ADMIN_PWD = "admin";
|
const char* const DEFAULT_ADMIN_PWD = "admin";
|
||||||
@@ -122,7 +103,6 @@ const int DEFAULT_RADIO_MODE = ESP_WIFI_STA;
|
|||||||
const int DEFAULT_RADIO_MODE = ESP_WIFI_AP;
|
const int DEFAULT_RADIO_MODE = ESP_WIFI_AP;
|
||||||
# endif //CONNECT_TO_SSID
|
# endif //CONNECT_TO_SSID
|
||||||
#else
|
#else
|
||||||
# undef ENABLE_NOTIFICATIONS
|
|
||||||
|
|
||||||
// TODO FIXME!
|
// TODO FIXME!
|
||||||
# ifdef ENABLE_BLUETOOTH
|
# ifdef ENABLE_BLUETOOTH
|
||||||
|
@@ -103,12 +103,13 @@ void grbl_init() {
|
|||||||
info_serial("Initializing WiFi...");
|
info_serial("Initializing WiFi...");
|
||||||
WebUI::wifi_config.begin();
|
WebUI::wifi_config.begin();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
info_serial("Initializing Bluetooth...");
|
info_serial("Initializing Bluetooth...");
|
||||||
|
|
||||||
config->_comms->_bluetoothConfig->begin();
|
config->_comms->_bluetoothConfig->begin();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
WebUI::inputBuffer.begin();
|
WebUI::inputBuffer.begin();
|
||||||
} catch (const AssertionFailed& ex) {
|
} catch (const AssertionFailed& ex) {
|
||||||
// This means something is terribly broken:
|
// This means something is terribly broken:
|
||||||
|
@@ -72,15 +72,9 @@ const char* const GRBL_VERSION_BUILD = "20210326";
|
|||||||
|
|
||||||
#ifdef ENABLE_WIFI
|
#ifdef ENABLE_WIFI
|
||||||
# include "WebUI/WifiConfig.h"
|
# include "WebUI/WifiConfig.h"
|
||||||
# ifdef ENABLE_HTTP
|
# include "WebUI/Serial2Socket.h"
|
||||||
# include "WebUI/Serial2Socket.h"
|
# include "WebUI/TelnetServer.h"
|
||||||
# endif
|
# include "WebUI/NotificationsService.h"
|
||||||
# ifdef ENABLE_TELNET
|
|
||||||
# include "WebUI/TelnetServer.h"
|
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_NOTIFICATIONS
|
|
||||||
# include "WebUI/NotificationsService.h"
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "I2SOut.h"
|
#include "I2SOut.h"
|
||||||
|
@@ -464,15 +464,20 @@ void MachineConfig::afterParse() {
|
|||||||
|
|
||||||
if (_comms == nullptr) {
|
if (_comms == nullptr) {
|
||||||
log_info("Comms config missing; building default comms");
|
log_info("Comms config missing; building default comms");
|
||||||
_comms = new Communications();
|
_comms = new Communications();
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
_comms->_apConfig = new WifiAPConfig();
|
_comms->_apConfig = new WifiAPConfig();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
// This is very helpful for testing YAML config files. If things
|
// This is very helpful for testing YAML config files. If things
|
||||||
// screw up, you can still connect and upload a new config.yaml
|
// screw up, you can still connect and upload a new config.yaml
|
||||||
// TODO - Consider whether we want this for the long term
|
// TODO - Consider whether we want this for the long term
|
||||||
if (!_comms->_apConfig) {
|
if (!_comms->_apConfig) {
|
||||||
_comms->_apConfig = new WifiAPConfig();
|
_comms->_apConfig = new WifiAPConfig();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MachineConfig::readFile(const char* filename, char*& buffer) {
|
size_t MachineConfig::readFile(const char* filename, char*& buffer) {
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "EnumItem.h"
|
#include "EnumItem.h"
|
||||||
#include "Stepper.h"
|
#include "Stepper.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
// TODO FIXME: Split this file up into several files, perhaps put it in some folder and namespace Machine?
|
// TODO FIXME: Split this file up into several files, perhaps put it in some folder and namespace Machine?
|
||||||
|
|
||||||
@@ -291,14 +292,19 @@ public:
|
|||||||
|
|
||||||
String _hostname = "grblesp";
|
String _hostname = "grblesp";
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
WebUI::BTConfig* _bluetoothConfig = nullptr;
|
WebUI::BTConfig* _bluetoothConfig = nullptr;
|
||||||
WifiAPConfig* _apConfig = nullptr;
|
#endif
|
||||||
WifiSTAConfig* _staConfig = nullptr;
|
#ifdef ENABLE_WIFI
|
||||||
|
WifiAPConfig* _apConfig = nullptr;
|
||||||
|
WifiSTAConfig* _staConfig = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
void group(Configuration::HandlerBase& handler) override {
|
void group(Configuration::HandlerBase& handler) override {
|
||||||
// handler.item("user_password", _userPassword);
|
// handler.item("user_password", _userPassword);
|
||||||
// handler.item("admin_password", _adminPassword);
|
// handler.item("admin_password", _adminPassword);
|
||||||
|
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
handler.item("telnet_enable", _telnetEnable);
|
handler.item("telnet_enable", _telnetEnable);
|
||||||
handler.item("telnet_port", _telnetPort);
|
handler.item("telnet_port", _telnetPort);
|
||||||
|
|
||||||
@@ -306,16 +312,25 @@ public:
|
|||||||
handler.item("http_port", _httpPort);
|
handler.item("http_port", _httpPort);
|
||||||
|
|
||||||
handler.item("hostname", _hostname);
|
handler.item("hostname", _hostname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
handler.section("bluetooth", _bluetoothConfig);
|
handler.section("bluetooth", _bluetoothConfig);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
handler.section("wifi_ap", _apConfig);
|
handler.section("wifi_ap", _apConfig);
|
||||||
handler.section("wifi_sta", _staConfig);
|
handler.section("wifi_sta", _staConfig);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~Communications() {
|
~Communications() {
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
delete _bluetoothConfig;
|
delete _bluetoothConfig;
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
delete _apConfig;
|
delete _apConfig;
|
||||||
delete _staConfig;
|
delete _staConfig;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -369,8 +384,16 @@ public:
|
|||||||
extern MachineConfig* config;
|
extern MachineConfig* config;
|
||||||
|
|
||||||
inline bool hasWiFi() {
|
inline bool hasWiFi() {
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
return config && config->_comms && (config->_comms->_staConfig != nullptr || config->_comms->_apConfig != nullptr);
|
return config && config->_comms && (config->_comms->_staConfig != nullptr || config->_comms->_apConfig != nullptr);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
inline bool hasBluetooth() {
|
inline bool hasBluetooth() {
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
return !hasWiFi() && (config && config->_comms && config->_comms->_bluetoothConfig != nullptr);
|
return !hasWiFi() && (config && config->_comms && config->_comms->_bluetoothConfig != nullptr);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -39,13 +39,12 @@ void show_setting(const char* name, const char* value, const char* description,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void settings_restore(uint8_t restore_flag) {
|
void settings_restore(uint8_t restore_flag) {
|
||||||
#ifdef WIFI_OR_BLUETOOTH
|
#ifdef ENABLE_WIFI
|
||||||
if (restore_flag & SettingsRestore::Wifi) {
|
if (restore_flag & SettingsRestore::Wifi) {
|
||||||
# ifdef ENABLE_WIFI
|
|
||||||
WebUI::wifi_config.reset_settings();
|
WebUI::wifi_config.reset_settings();
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (restore_flag & SettingsRestore::Defaults) {
|
if (restore_flag & SettingsRestore::Defaults) {
|
||||||
bool restore_startup = restore_flag & SettingsRestore::StartupLines;
|
bool restore_startup = restore_flag & SettingsRestore::StartupLines;
|
||||||
for (Setting* s = Setting::List; s; s = s->next()) {
|
for (Setting* s = Setting::List; s; s = s->next()) {
|
||||||
|
@@ -149,7 +149,7 @@ void error_serial(const char* format, ...) {
|
|||||||
|
|
||||||
//function to notify
|
//function to notify
|
||||||
void grbl_notify(const char* title, const char* msg) {
|
void grbl_notify(const char* title, const char* msg) {
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
#ifdef ENABLE_WIFI
|
||||||
WebUI::notificationsservice.sendMSG(title, msg);
|
WebUI::notificationsservice.sendMSG(title, msg);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -554,7 +554,7 @@ void report_build_info(const char* line, uint8_t client) {
|
|||||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||||
grbl_send(client, "R");
|
grbl_send(client, "R");
|
||||||
#endif
|
#endif
|
||||||
#if defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
grbl_send(client, "W");
|
grbl_send(client, "W");
|
||||||
#endif
|
#endif
|
||||||
#ifndef ENABLE_RESTORE_WIPE_ALL // NOTE: Shown when disabled.
|
#ifndef ENABLE_RESTORE_WIPE_ALL // NOTE: Shown when disabled.
|
||||||
@@ -576,12 +576,14 @@ void report_build_info(const char* line, uint8_t client) {
|
|||||||
// These will likely have a comma delimiter to separate them.
|
// These will likely have a comma delimiter to separate them.
|
||||||
grbl_send(client, "]\r\n");
|
grbl_send(client, "]\r\n");
|
||||||
report_machine_type(client);
|
report_machine_type(client);
|
||||||
#if defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
grbl_send(client, (char*)WebUI::wifi_config.info());
|
grbl_send(client, (char*)WebUI::wifi_config.info());
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
grbl_send(client, config->_comms->_bluetoothConfig->info().c_str());
|
grbl_send(client, config->_comms->_bluetoothConfig->info().c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints the character string line Grbl has received from the user, which has been pre-parsed,
|
// Prints the character string line Grbl has received from the user, which has been pre-parsed,
|
||||||
@@ -627,15 +629,17 @@ void report_realtime_status(uint8_t client) {
|
|||||||
// Returns planner and serial read buffer states.
|
// Returns planner and serial read buffer states.
|
||||||
if (bit_istrue(status_mask->get(), RtStatus::Buffer)) {
|
if (bit_istrue(status_mask->get(), RtStatus::Buffer)) {
|
||||||
int bufsize = DEFAULTBUFFERSIZE;
|
int bufsize = DEFAULTBUFFERSIZE;
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_TELNET)
|
#ifdef ENABLE_WIFI
|
||||||
if (client == CLIENT_TELNET) {
|
if (client == CLIENT_TELNET) {
|
||||||
bufsize = WebUI::telnet_server.get_rx_buffer_available();
|
bufsize = WebUI::telnet_server.get_rx_buffer_available();
|
||||||
}
|
}
|
||||||
#endif //ENABLE_WIFI && ENABLE_TELNET
|
#endif
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
if (hasBluetooth() && client == CLIENT_BT) {
|
if (hasBluetooth() && client == CLIENT_BT) {
|
||||||
//TODO FIXME
|
//TODO FIXME
|
||||||
bufsize = 512 - WebUI::SerialBT.available();
|
bufsize = 512 - WebUI::SerialBT.available();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (client == CLIENT_SERIAL) {
|
if (client == CLIENT_SERIAL) {
|
||||||
bufsize = client_get_rx_buffer_available(CLIENT_SERIAL);
|
bufsize = client_get_rx_buffer_available(CLIENT_SERIAL);
|
||||||
}
|
}
|
||||||
|
@@ -124,6 +124,8 @@ static uint8_t getClientChar(uint8_t* data) {
|
|||||||
*data = WebUI::inputBuffer.read();
|
*data = WebUI::inputBuffer.read();
|
||||||
return CLIENT_INPUT;
|
return CLIENT_INPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
//currently is wifi or BT but better to prepare both can be live
|
//currently is wifi or BT but better to prepare both can be live
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
if (WebUI::SerialBT.hasClient()) {
|
if (WebUI::SerialBT.hasClient()) {
|
||||||
@@ -133,13 +135,12 @@ static uint8_t getClientChar(uint8_t* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_HTTP) && defined(ENABLE_SERIAL2SOCKET_IN)
|
#endif
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
if (WebUI::Serial2Socket.available()) {
|
if (WebUI::Serial2Socket.available()) {
|
||||||
*data = WebUI::Serial2Socket.read();
|
*data = WebUI::Serial2Socket.read();
|
||||||
return CLIENT_WEBUI;
|
return CLIENT_WEBUI;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_TELNET)
|
|
||||||
if (WebUI::telnet_server.available()) {
|
if (WebUI::telnet_server.available()) {
|
||||||
*data = WebUI::telnet_server.read();
|
*data = WebUI::telnet_server.read();
|
||||||
return CLIENT_TELNET;
|
return CLIENT_TELNET;
|
||||||
@@ -174,15 +175,17 @@ void clientCheckTask(void* pvParameters) {
|
|||||||
}
|
}
|
||||||
} // if something available
|
} // if something available
|
||||||
WebUI::COMMANDS::handle();
|
WebUI::COMMANDS::handle();
|
||||||
#ifdef ENABLE_WIFI
|
|
||||||
WebUI::wifi_config.handle();
|
#ifdef ENABLE_BLUETOOTH
|
||||||
#endif
|
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
config->_comms->_bluetoothConfig->handle();
|
config->_comms->_bluetoothConfig->handle();
|
||||||
}
|
}
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_HTTP) && defined(ENABLE_SERIAL2SOCKET_IN)
|
#endif
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
|
WebUI::wifi_config.handle();
|
||||||
WebUI::Serial2Socket.handle_flush();
|
WebUI::Serial2Socket.handle_flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vTaskDelay(1 / portTICK_RATE_MS); // Yield to other tasks
|
vTaskDelay(1 / portTICK_RATE_MS); // Yield to other tasks
|
||||||
|
|
||||||
#ifdef DEBUG_TASK_STACK
|
#ifdef DEBUG_TASK_STACK
|
||||||
@@ -328,6 +331,8 @@ void client_write(uint8_t client, const char* text) {
|
|||||||
if (client == CLIENT_INPUT) {
|
if (client == CLIENT_INPUT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
if (WebUI::SerialBT.hasClient() && (client == CLIENT_BT || client == CLIENT_ALL)) {
|
if (WebUI::SerialBT.hasClient() && (client == CLIENT_BT || client == CLIENT_ALL)) {
|
||||||
// TODO: This can be .print() for consistency with other clients,
|
// TODO: This can be .print() for consistency with other clients,
|
||||||
@@ -337,16 +342,16 @@ void client_write(uint8_t client, const char* text) {
|
|||||||
//delay(10); // possible fix for dropped characters
|
//delay(10); // possible fix for dropped characters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_HTTP) && defined(ENABLE_SERIAL2SOCKET_OUT)
|
#endif
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
if (client == CLIENT_WEBUI || client == CLIENT_ALL) {
|
if (client == CLIENT_WEBUI || client == CLIENT_ALL) {
|
||||||
WebUI::Serial2Socket.write((const uint8_t*)text, strlen(text));
|
WebUI::Serial2Socket.write((const uint8_t*)text, strlen(text));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_TELNET)
|
|
||||||
if (client == CLIENT_TELNET || client == CLIENT_ALL) {
|
if (client == CLIENT_TELNET || client == CLIENT_ALL) {
|
||||||
WebUI::telnet_server.write((const uint8_t*)text, strlen(text));
|
WebUI::telnet_server.write((const uint8_t*)text, strlen(text));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (client == CLIENT_SERIAL || client == CLIENT_ALL) {
|
if (client == CLIENT_SERIAL || client == CLIENT_ALL) {
|
||||||
#ifdef REVERT_TO_ARDUINO_SERIAL
|
#ifdef REVERT_TO_ARDUINO_SERIAL
|
||||||
Serial.write(text);
|
Serial.write(text);
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
#include "../Grbl.h"
|
#include "../Grbl.h"
|
||||||
#include "../MachineConfig.h"
|
#include "../MachineConfig.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
|
|
||||||
#include "BTConfig.h"
|
#include "BTConfig.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -158,3 +160,5 @@ namespace WebUI {
|
|||||||
|
|
||||||
BTConfig::~BTConfig() { end(); }
|
BTConfig::~BTConfig() { end(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -22,9 +22,12 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <BluetoothSerial.h>
|
|
||||||
#include "../Configuration/Configurable.h"
|
#include "../Configuration/Configurable.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
|
|
||||||
|
# include <BluetoothSerial.h>
|
||||||
|
|
||||||
namespace WebUI {
|
namespace WebUI {
|
||||||
extern BluetoothSerial SerialBT;
|
extern BluetoothSerial SerialBT;
|
||||||
|
|
||||||
@@ -68,3 +71,5 @@ namespace WebUI {
|
|||||||
~BTConfig();
|
~BTConfig();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -19,13 +19,14 @@
|
|||||||
*/
|
*/
|
||||||
#include "../Grbl.h"
|
#include "../Grbl.h"
|
||||||
#include "ESPResponse.h"
|
#include "ESPResponse.h"
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
# include "WebServer.h"
|
# include "WebServer.h"
|
||||||
# include <WebServer.h>
|
# include <WebServer.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace WebUI {
|
namespace WebUI {
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
ESPResponseStream::ESPResponseStream(WebServer* webserver) {
|
ESPResponseStream::ESPResponseStream(WebServer* webserver) {
|
||||||
_header_sent = false;
|
_header_sent = false;
|
||||||
_webserver = webserver;
|
_webserver = webserver;
|
||||||
@@ -35,7 +36,7 @@ namespace WebUI {
|
|||||||
|
|
||||||
ESPResponseStream::ESPResponseStream() {
|
ESPResponseStream::ESPResponseStream() {
|
||||||
_client = CLIENT_INPUT;
|
_client = CLIENT_INPUT;
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
_header_sent = false;
|
_header_sent = false;
|
||||||
_webserver = NULL;
|
_webserver = NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -44,7 +45,7 @@ namespace WebUI {
|
|||||||
ESPResponseStream::ESPResponseStream(uint8_t client, bool byid) {
|
ESPResponseStream::ESPResponseStream(uint8_t client, bool byid) {
|
||||||
(void)byid; //fake parameter to avoid confusion with pointer one (NULL == 0)
|
(void)byid; //fake parameter to avoid confusion with pointer one (NULL == 0)
|
||||||
_client = client;
|
_client = client;
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
_header_sent = false;
|
_header_sent = false;
|
||||||
_webserver = NULL;
|
_webserver = NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -76,7 +77,7 @@ namespace WebUI {
|
|||||||
if (_client == CLIENT_INPUT) {
|
if (_client == CLIENT_INPUT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
if (_webserver) {
|
if (_webserver) {
|
||||||
if (!_header_sent) {
|
if (!_header_sent) {
|
||||||
_webserver->setContentLength(CONTENT_LENGTH_UNKNOWN);
|
_webserver->setContentLength(CONTENT_LENGTH_UNKNOWN);
|
||||||
@@ -107,7 +108,7 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ESPResponseStream::flush() {
|
void ESPResponseStream::flush() {
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
if (_webserver) {
|
if (_webserver) {
|
||||||
if (_header_sent) {
|
if (_header_sent) {
|
||||||
//send data
|
//send data
|
||||||
|
@@ -20,16 +20,17 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
class WebServer;
|
class WebServer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace WebUI {
|
namespace WebUI {
|
||||||
class ESPResponseStream {
|
class ESPResponseStream {
|
||||||
public:
|
public:
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
ESPResponseStream(WebServer* webserver);
|
ESPResponseStream(WebServer* webserver);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESPResponseStream(uint8_t client, bool byid = true);
|
ESPResponseStream(uint8_t client, bool byid = true);
|
||||||
ESPResponseStream();
|
ESPResponseStream();
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ namespace WebUI {
|
|||||||
uint8_t _client;
|
uint8_t _client;
|
||||||
bool _header_sent;
|
bool _header_sent;
|
||||||
|
|
||||||
#if defined(ENABLE_HTTP) && defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
WebServer* _webserver;
|
WebServer* _webserver;
|
||||||
String _buffer;
|
String _buffer;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -31,7 +31,8 @@
|
|||||||
#include "../Grbl.h"
|
#include "../Grbl.h"
|
||||||
#include "../MachineConfig.h"
|
#include "../MachineConfig.h"
|
||||||
|
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
# include "NotificationsService.h"
|
# include "NotificationsService.h"
|
||||||
# include <WiFiClientSecure.h>
|
# include <WiFiClientSecure.h>
|
||||||
# include <base64.h>
|
# include <base64.h>
|
||||||
@@ -370,4 +371,4 @@ namespace WebUI {
|
|||||||
|
|
||||||
NotificationsService::~NotificationsService() { end(); }
|
NotificationsService::~NotificationsService() { end(); }
|
||||||
}
|
}
|
||||||
#endif //ENABLE_NOTIFICATIONS
|
#endif
|
||||||
|
@@ -20,6 +20,11 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
|
# include <WString.h>
|
||||||
|
# include <cstdint>
|
||||||
|
|
||||||
namespace WebUI {
|
namespace WebUI {
|
||||||
class NotificationsService {
|
class NotificationsService {
|
||||||
public:
|
public:
|
||||||
@@ -53,3 +58,5 @@ namespace WebUI {
|
|||||||
|
|
||||||
extern NotificationsService notificationsservice;
|
extern NotificationsService notificationsservice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "../Grbl.h"
|
#include "../Grbl.h"
|
||||||
|
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_HTTP)
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
# include "Serial2Socket.h"
|
# include "Serial2Socket.h"
|
||||||
# include "WebServer.h"
|
# include "WebServer.h"
|
||||||
@@ -88,7 +88,6 @@ namespace WebUI {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(ENABLE_SERIAL2SOCKET_OUT)
|
|
||||||
if (_TXbufferSize == 0) {
|
if (_TXbufferSize == 0) {
|
||||||
_lastflush = millis();
|
_lastflush = millis();
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,6 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
log_i("[SOCKET]buffer size %d", _TXbufferSize);
|
log_i("[SOCKET]buffer size %d", _TXbufferSize);
|
||||||
handle_flush();
|
handle_flush();
|
||||||
# endif
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +116,6 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Serial_2_Socket::push(const char* data) {
|
bool Serial_2_Socket::push(const char* data) {
|
||||||
# if defined(ENABLE_SERIAL2SOCKET_IN)
|
|
||||||
int data_size = strlen(data);
|
int data_size = strlen(data);
|
||||||
if ((data_size + _RXbufferSize) <= RXBUFFERSIZE) {
|
if ((data_size + _RXbufferSize) <= RXBUFFERSIZE) {
|
||||||
int current = _RXbufferpos + _RXbufferSize;
|
int current = _RXbufferpos + _RXbufferSize;
|
||||||
@@ -138,9 +135,6 @@ namespace WebUI {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
# else
|
|
||||||
return true;
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Serial_2_Socket::read(void) {
|
int Serial_2_Socket::read(void) {
|
||||||
@@ -186,4 +180,5 @@ namespace WebUI {
|
|||||||
_RXbufferpos = 0;
|
_RXbufferpos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WIFI
|
|
||||||
|
#endif
|
||||||
|
@@ -20,8 +20,11 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
#include <Print.h>
|
#include <Print.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
class WebSocketsServer;
|
class WebSocketsServer;
|
||||||
|
|
||||||
@@ -73,3 +76,5 @@ namespace WebUI {
|
|||||||
|
|
||||||
extern Serial_2_Socket Serial2Socket;
|
extern Serial_2_Socket Serial2Socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#include "../Grbl.h"
|
#include "../Grbl.h"
|
||||||
#include "../MachineConfig.h"
|
#include "../MachineConfig.h"
|
||||||
|
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_TELNET)
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
# include "WifiServices.h"
|
# include "WifiServices.h"
|
||||||
|
|
||||||
@@ -36,9 +36,7 @@ namespace WebUI {
|
|||||||
WiFiServer* Telnet_Server::_telnetserver = NULL;
|
WiFiServer* Telnet_Server::_telnetserver = NULL;
|
||||||
WiFiClient Telnet_Server::_telnetClients[MAX_TLNT_CLIENTS];
|
WiFiClient Telnet_Server::_telnetClients[MAX_TLNT_CLIENTS];
|
||||||
|
|
||||||
# ifdef ENABLE_TELNET_WELCOME_MSG
|
|
||||||
IPAddress Telnet_Server::_telnetClientsIP[MAX_TLNT_CLIENTS];
|
IPAddress Telnet_Server::_telnetClientsIP[MAX_TLNT_CLIENTS];
|
||||||
# endif
|
|
||||||
|
|
||||||
Telnet_Server::Telnet_Server() {
|
Telnet_Server::Telnet_Server() {
|
||||||
_RXbufferSize = 0;
|
_RXbufferSize = 0;
|
||||||
@@ -84,9 +82,7 @@ namespace WebUI {
|
|||||||
for (i = 0; i < MAX_TLNT_CLIENTS; i++) {
|
for (i = 0; i < MAX_TLNT_CLIENTS; i++) {
|
||||||
//find free/disconnected spot
|
//find free/disconnected spot
|
||||||
if (!_telnetClients[i] || !_telnetClients[i].connected()) {
|
if (!_telnetClients[i] || !_telnetClients[i].connected()) {
|
||||||
# ifdef ENABLE_TELNET_WELCOME_MSG
|
|
||||||
_telnetClientsIP[i] = IPAddress(0, 0, 0, 0);
|
_telnetClientsIP[i] = IPAddress(0, 0, 0, 0);
|
||||||
# endif
|
|
||||||
if (_telnetClients[i]) {
|
if (_telnetClients[i]) {
|
||||||
_telnetClients[i].stop();
|
_telnetClients[i].stop();
|
||||||
}
|
}
|
||||||
@@ -133,12 +129,10 @@ namespace WebUI {
|
|||||||
//uint8_t c;
|
//uint8_t c;
|
||||||
for (uint8_t i = 0; i < MAX_TLNT_CLIENTS; i++) {
|
for (uint8_t i = 0; i < MAX_TLNT_CLIENTS; i++) {
|
||||||
if (_telnetClients[i] && _telnetClients[i].connected()) {
|
if (_telnetClients[i] && _telnetClients[i].connected()) {
|
||||||
# ifdef ENABLE_TELNET_WELCOME_MSG
|
|
||||||
if (_telnetClientsIP[i] != _telnetClients[i].remoteIP()) {
|
if (_telnetClientsIP[i] != _telnetClients[i].remoteIP()) {
|
||||||
report_init_message(CLIENT_TELNET);
|
report_init_message(CLIENT_TELNET);
|
||||||
_telnetClientsIP[i] = _telnetClients[i].remoteIP();
|
_telnetClientsIP[i] = _telnetClients[i].remoteIP();
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
if (_telnetClients[i].available()) {
|
if (_telnetClients[i].available()) {
|
||||||
uint8_t buf[1024];
|
uint8_t buf[1024];
|
||||||
COMMANDS::wait(0);
|
COMMANDS::wait(0);
|
||||||
@@ -158,9 +152,7 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_telnetClients[i]) {
|
if (_telnetClients[i]) {
|
||||||
# ifdef ENABLE_TELNET_WELCOME_MSG
|
|
||||||
_telnetClientsIP[i] = IPAddress(0, 0, 0, 0);
|
_telnetClientsIP[i] = IPAddress(0, 0, 0, 0);
|
||||||
# endif
|
|
||||||
_telnetClients[i].stop();
|
_telnetClients[i].stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,4 +232,4 @@ namespace WebUI {
|
|||||||
|
|
||||||
Telnet_Server::~Telnet_Server() { end(); }
|
Telnet_Server::~Telnet_Server() { end(); }
|
||||||
}
|
}
|
||||||
#endif // Enable TELNET && ENABLE_WIFI
|
#endif
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "../Config.h"
|
#include "../Config.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
class WiFiServer;
|
class WiFiServer;
|
||||||
class WiFiClient;
|
class WiFiClient;
|
||||||
|
|
||||||
@@ -55,9 +57,7 @@ namespace WebUI {
|
|||||||
static bool _setupdone;
|
static bool _setupdone;
|
||||||
static WiFiServer* _telnetserver;
|
static WiFiServer* _telnetserver;
|
||||||
static WiFiClient _telnetClients[MAX_TLNT_CLIENTS];
|
static WiFiClient _telnetClients[MAX_TLNT_CLIENTS];
|
||||||
#ifdef ENABLE_TELNET_WELCOME_MSG
|
|
||||||
static IPAddress _telnetClientsIP[MAX_TLNT_CLIENTS];
|
static IPAddress _telnetClientsIP[MAX_TLNT_CLIENTS];
|
||||||
#endif
|
|
||||||
static uint16_t _port;
|
static uint16_t _port;
|
||||||
|
|
||||||
void clearClients();
|
void clearClients();
|
||||||
@@ -70,3 +70,5 @@ namespace WebUI {
|
|||||||
|
|
||||||
extern Telnet_Server telnet_server;
|
extern Telnet_Server telnet_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#include "../Grbl.h"
|
#include "../Grbl.h"
|
||||||
#include "../MachineConfig.h"
|
#include "../MachineConfig.h"
|
||||||
|
|
||||||
#if defined(ENABLE_WIFI) && defined(ENABLE_HTTP)
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
# include "WifiServices.h"
|
# include "WifiServices.h"
|
||||||
|
|
||||||
@@ -39,21 +39,15 @@
|
|||||||
# include <StreamString.h>
|
# include <StreamString.h>
|
||||||
# include <Update.h>
|
# include <Update.h>
|
||||||
# include <esp_wifi_types.h>
|
# include <esp_wifi_types.h>
|
||||||
# ifdef ENABLE_MDNS
|
# include <ESPmDNS.h>
|
||||||
# include <ESPmDNS.h>
|
# include <ESP32SSDP.h>
|
||||||
# endif
|
# include <DNSServer.h>
|
||||||
# ifdef ENABLE_SSDP
|
|
||||||
# include <ESP32SSDP.h>
|
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_CAPTIVE_PORTAL
|
|
||||||
# include <DNSServer.h>
|
|
||||||
|
|
||||||
namespace WebUI {
|
namespace WebUI {
|
||||||
const byte DNS_PORT = 53;
|
const byte DNS_PORT = 53;
|
||||||
DNSServer dnsServer;
|
DNSServer dnsServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif
|
|
||||||
# include <esp_ota_ops.h>
|
# include <esp_ota_ops.h>
|
||||||
|
|
||||||
//embedded response file if no files on SPIFFS
|
//embedded response file if no files on SPIFFS
|
||||||
@@ -159,7 +153,6 @@ namespace WebUI {
|
|||||||
_webserver->on("/upload", HTTP_ANY, handle_direct_SDFileList, SDFile_direct_upload);
|
_webserver->on("/upload", HTTP_ANY, handle_direct_SDFileList, SDFile_direct_upload);
|
||||||
//_webserver->on("/SD", HTTP_ANY, handle_SDCARD);
|
//_webserver->on("/SD", HTTP_ANY, handle_SDCARD);
|
||||||
|
|
||||||
# ifdef ENABLE_CAPTIVE_PORTAL
|
|
||||||
if (WiFi.getMode() == WIFI_AP) {
|
if (WiFi.getMode() == WIFI_AP) {
|
||||||
// if DNSServer is started with "*" for domain name, it will reply with
|
// if DNSServer is started with "*" for domain name, it will reply with
|
||||||
// provided IP to all DNS request
|
// provided IP to all DNS request
|
||||||
@@ -170,9 +163,7 @@ namespace WebUI {
|
|||||||
//do not forget the / at the end
|
//do not forget the / at the end
|
||||||
_webserver->on("/fwlink/", HTTP_ANY, handle_root);
|
_webserver->on("/fwlink/", HTTP_ANY, handle_root);
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef ENABLE_SSDP
|
|
||||||
//SSDP service presentation
|
//SSDP service presentation
|
||||||
if (WiFi.getMode() == WIFI_STA) {
|
if (WiFi.getMode() == WIFI_STA) {
|
||||||
_webserver->on("/description.xml", HTTP_GET, handle_SSDP);
|
_webserver->on("/description.xml", HTTP_GET, handle_SSDP);
|
||||||
@@ -194,29 +185,28 @@ namespace WebUI {
|
|||||||
info_all("SSDP Started");
|
info_all("SSDP Started");
|
||||||
SSDP.begin();
|
SSDP.begin();
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
info_all("HTTP Started");
|
info_all("HTTP Started");
|
||||||
//start webserver
|
//start webserver
|
||||||
_webserver->begin();
|
_webserver->begin();
|
||||||
# ifdef ENABLE_MDNS
|
|
||||||
//add mDNS
|
//add mDNS
|
||||||
if (WiFi.getMode() == WIFI_STA) {
|
if (WiFi.getMode() == WIFI_STA) {
|
||||||
MDNS.addService("http", "tcp", _port);
|
MDNS.addService("http", "tcp", _port);
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
_setupdone = true;
|
_setupdone = true;
|
||||||
return no_error;
|
return no_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Web_Server::end() {
|
void Web_Server::end() {
|
||||||
_setupdone = false;
|
_setupdone = false;
|
||||||
# ifdef ENABLE_SSDP
|
|
||||||
SSDP.end();
|
SSDP.end();
|
||||||
# endif //ENABLE_SSDP
|
|
||||||
# ifdef ENABLE_MDNS
|
|
||||||
//remove mDNS
|
//remove mDNS
|
||||||
mdns_service_remove("_http", "_tcp");
|
mdns_service_remove("_http", "_tcp");
|
||||||
# endif
|
|
||||||
if (_socket_server) {
|
if (_socket_server) {
|
||||||
delete _socket_server;
|
delete _socket_server;
|
||||||
_socket_server = NULL;
|
_socket_server = NULL;
|
||||||
@@ -325,8 +315,7 @@ namespace WebUI {
|
|||||||
content += path;
|
content += path;
|
||||||
_webserver->send(404, "text/plain", content);
|
_webserver->send(404, "text/plain", content);
|
||||||
return;
|
return;
|
||||||
} else
|
} else if (SPIFFS.exists(pathWithGz) || SPIFFS.exists(path)) {
|
||||||
if (SPIFFS.exists(pathWithGz) || SPIFFS.exists(path)) {
|
|
||||||
if (SPIFFS.exists(pathWithGz)) {
|
if (SPIFFS.exists(pathWithGz)) {
|
||||||
path = pathWithGz;
|
path = pathWithGz;
|
||||||
}
|
}
|
||||||
@@ -339,7 +328,6 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (page_not_found) {
|
if (page_not_found) {
|
||||||
# ifdef ENABLE_CAPTIVE_PORTAL
|
|
||||||
if (WiFi.getMode() == WIFI_AP) {
|
if (WiFi.getMode() == WIFI_AP) {
|
||||||
String contentType = PAGE_CAPTIVE;
|
String contentType = PAGE_CAPTIVE;
|
||||||
String stmp = WiFi.softAPIP().toString();
|
String stmp = WiFi.softAPIP().toString();
|
||||||
@@ -358,7 +346,7 @@ namespace WebUI {
|
|||||||
//_webserver->client().stop();
|
//_webserver->client().stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
path = "/404.htm";
|
path = "/404.htm";
|
||||||
contentType = getContentType(path);
|
contentType = getContentType(path);
|
||||||
pathWithGz = path + ".gz";
|
pathWithGz = path + ".gz";
|
||||||
@@ -393,7 +381,6 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef ENABLE_SSDP
|
|
||||||
//http SSDP xml presentation
|
//http SSDP xml presentation
|
||||||
void Web_Server::handle_SSDP() {
|
void Web_Server::handle_SSDP() {
|
||||||
StreamString sschema;
|
StreamString sschema;
|
||||||
@@ -434,7 +421,6 @@ namespace WebUI {
|
|||||||
_webserver->send(500);
|
_webserver->send(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
void Web_Server::_handle_web_command(bool silent) {
|
void Web_Server::_handle_web_command(bool silent) {
|
||||||
//to save time if already disconnected
|
//to save time if already disconnected
|
||||||
@@ -1547,11 +1533,9 @@ namespace WebUI {
|
|||||||
void Web_Server::handle() {
|
void Web_Server::handle() {
|
||||||
static uint32_t timeout = millis();
|
static uint32_t timeout = millis();
|
||||||
COMMANDS::wait(0);
|
COMMANDS::wait(0);
|
||||||
# ifdef ENABLE_CAPTIVE_PORTAL
|
|
||||||
if (WiFi.getMode() == WIFI_AP) {
|
if (WiFi.getMode() == WIFI_AP) {
|
||||||
dnsServer.processNextRequest();
|
dnsServer.processNextRequest();
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
if (_webserver) {
|
if (_webserver) {
|
||||||
_webserver->handleClient();
|
_webserver->handleClient();
|
||||||
}
|
}
|
||||||
@@ -1799,4 +1783,4 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif // Enable HTTP && ENABLE_WIFI
|
#endif
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../Config.h"
|
#include "../Config.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
|
|
||||||
#include "Commands.h"
|
#include "Commands.h"
|
||||||
|
|
||||||
class WebSocketsServer;
|
class WebSocketsServer;
|
||||||
@@ -73,9 +76,7 @@ namespace WebUI {
|
|||||||
static AuthenticationIP* GetAuth(IPAddress ip, const char* sessionID);
|
static AuthenticationIP* GetAuth(IPAddress ip, const char* sessionID);
|
||||||
static AuthenticationLevel ResetAuthIP(IPAddress ip, const char* sessionID);
|
static AuthenticationLevel ResetAuthIP(IPAddress ip, const char* sessionID);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_SSDP
|
|
||||||
static void handle_SSDP();
|
static void handle_SSDP();
|
||||||
#endif
|
|
||||||
static void handle_root();
|
static void handle_root();
|
||||||
static void handle_login();
|
static void handle_login();
|
||||||
static void handle_not_found();
|
static void handle_not_found();
|
||||||
@@ -96,3 +97,5 @@ namespace WebUI {
|
|||||||
|
|
||||||
extern Web_Server web_server;
|
extern Web_Server web_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -44,7 +44,7 @@ namespace WebUI {
|
|||||||
StringSetting* wifi_ap_password;
|
StringSetting* wifi_ap_password;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
#ifdef ENABLE_WIFI
|
||||||
enum_opt_t notificationOptions = {
|
enum_opt_t notificationOptions = {
|
||||||
{ "NONE", 0 },
|
{ "NONE", 0 },
|
||||||
{ "LINE", 3 },
|
{ "LINE", 3 },
|
||||||
@@ -204,8 +204,7 @@ namespace WebUI {
|
|||||||
#else
|
#else
|
||||||
webPrint("no");
|
webPrint("no");
|
||||||
#endif
|
#endif
|
||||||
#if defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
# if defined(ENABLE_HTTP)
|
|
||||||
webPrint(" # webcommunication: Sync: ", String(web_server.port() + 1));
|
webPrint(" # webcommunication: Sync: ", String(web_server.port() + 1));
|
||||||
webPrint(":");
|
webPrint(":");
|
||||||
switch (WiFi.getMode()) {
|
switch (WiFi.getMode()) {
|
||||||
@@ -222,7 +221,6 @@ namespace WebUI {
|
|||||||
webPrint("0.0.0.0");
|
webPrint("0.0.0.0");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
webPrint(" # hostname:", wifi_config.Hostname());
|
webPrint(" # hostname:", wifi_config.Hostname());
|
||||||
if (WiFi.getMode() == WIFI_AP) {
|
if (WiFi.getMode() == WIFI_AP) {
|
||||||
webPrint("(AP mode)");
|
webPrint("(AP mode)");
|
||||||
@@ -315,7 +313,7 @@ namespace WebUI {
|
|||||||
return Error::Ok;
|
return Error::Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
#ifdef ENABLE_WIFI
|
||||||
static Error showSetNotification(char* parameter, AuthenticationLevel auth_level) { // ESP610
|
static Error showSetNotification(char* parameter, AuthenticationLevel auth_level) { // ESP610
|
||||||
if (*parameter == '\0') {
|
if (*parameter == '\0') {
|
||||||
webPrint("", notification_type->getStringValue());
|
webPrint("", notification_type->getStringValue());
|
||||||
@@ -406,12 +404,8 @@ namespace WebUI {
|
|||||||
webPrintln("Available Size for update: ", ESPResponseStream::formatBytes(flashsize));
|
webPrintln("Available Size for update: ", ESPResponseStream::formatBytes(flashsize));
|
||||||
webPrintln("Available Size for SPIFFS: ", ESPResponseStream::formatBytes(SPIFFS.totalBytes()));
|
webPrintln("Available Size for SPIFFS: ", ESPResponseStream::formatBytes(SPIFFS.totalBytes()));
|
||||||
|
|
||||||
# if defined(ENABLE_HTTP)
|
|
||||||
webPrintln("Web port: ", String(web_server.port()));
|
webPrintln("Web port: ", String(web_server.port()));
|
||||||
# endif
|
|
||||||
# if defined(ENABLE_TELNET)
|
|
||||||
webPrintln("Data port: ", String(telnet_server.port()));
|
webPrintln("Data port: ", String(telnet_server.port()));
|
||||||
# endif
|
|
||||||
webPrintln("Hostname: ", wifi_config.Hostname());
|
webPrintln("Hostname: ", wifi_config.Hostname());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,7 +514,18 @@ namespace WebUI {
|
|||||||
webPrintln("Off");
|
webPrintln("Off");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WIFI
|
|
||||||
|
webPrint("Notifications: ");
|
||||||
|
webPrint(notificationsservice.started() ? "Enabled" : "Disabled");
|
||||||
|
if (notificationsservice.started()) {
|
||||||
|
webPrint("(");
|
||||||
|
webPrint(notificationsservice.getTypeString());
|
||||||
|
webPrint(")");
|
||||||
|
}
|
||||||
|
webPrintln("");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
auto bt_config = config->_comms->_bluetoothConfig;
|
auto bt_config = config->_comms->_bluetoothConfig;
|
||||||
webPrint("Current BT Mode: ");
|
webPrint("Current BT Mode: ");
|
||||||
@@ -543,15 +548,6 @@ namespace WebUI {
|
|||||||
webPrintln("Off");
|
webPrintln("Off");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
|
||||||
webPrint("Notifications: ");
|
|
||||||
webPrint(notificationsservice.started() ? "Enabled" : "Disabled");
|
|
||||||
if (notificationsservice.started()) {
|
|
||||||
webPrint("(");
|
|
||||||
webPrint(notificationsservice.getTypeString());
|
|
||||||
webPrint(")");
|
|
||||||
}
|
|
||||||
webPrintln("");
|
|
||||||
#endif
|
#endif
|
||||||
webPrint("FW version: ");
|
webPrint("FW version: ");
|
||||||
webPrint(GRBL_VERSION);
|
webPrint(GRBL_VERSION);
|
||||||
@@ -869,15 +865,17 @@ namespace WebUI {
|
|||||||
if (*parameter == '\0') {
|
if (*parameter == '\0') {
|
||||||
// Display the radio state
|
// Display the radio state
|
||||||
bool on = false;
|
bool on = false;
|
||||||
#if defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
if (WiFi.getMode() != WIFI_MODE_NULL) {
|
if (WiFi.getMode() != WIFI_MODE_NULL) {
|
||||||
on = true;
|
on = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
if (hasBluetooth() && config->_comms->_bluetoothConfig->Is_BT_on()) {
|
if (hasBluetooth() && config->_comms->_bluetoothConfig->Is_BT_on()) {
|
||||||
on = true;
|
on = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
webPrintln(on ? "ON" : "OFF");
|
webPrintln(on ? "ON" : "OFF");
|
||||||
return Error::Ok;
|
return Error::Ok;
|
||||||
@@ -894,16 +892,18 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Stop everything
|
//Stop everything
|
||||||
#if defined(ENABLE_WIFI)
|
#ifdef ENABLE_WIFI
|
||||||
if (WiFi.getMode() != WIFI_MODE_NULL) {
|
if (WiFi.getMode() != WIFI_MODE_NULL) {
|
||||||
wifi_config.StopWiFi();
|
wifi_config.StopWiFi();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
if (config->_comms->_bluetoothConfig->Is_BT_on()) {
|
if (config->_comms->_bluetoothConfig->Is_BT_on()) {
|
||||||
config->_comms->_bluetoothConfig->end();
|
config->_comms->_bluetoothConfig->end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//if On start proper service
|
//if On start proper service
|
||||||
if (!on) {
|
if (!on) {
|
||||||
@@ -912,17 +912,15 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//On
|
//On
|
||||||
#ifdef WIFI_OR_BLUETOOTH
|
#ifdef ENABLE_WIFI
|
||||||
if (hasWiFi()) {
|
if (hasWiFi()) {
|
||||||
# if !defined(ENABLE_WIFI)
|
|
||||||
webPrintln("WiFi is not enabled!");
|
|
||||||
return Error::WifiFailBegin;
|
|
||||||
|
|
||||||
# else
|
|
||||||
wifi_config.begin();
|
wifi_config.begin();
|
||||||
return Error::Ok;
|
return Error::Ok;
|
||||||
# endif
|
}
|
||||||
} else if (hasBluetooth()) {
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_BLUETOOTH
|
||||||
|
if (hasBluetooth()) {
|
||||||
if (hasBluetooth()) {
|
if (hasBluetooth()) {
|
||||||
webPrintln("Bluetooth is not enabled!");
|
webPrintln("Bluetooth is not enabled!");
|
||||||
return Error::BtFailBegin;
|
return Error::BtFailBegin;
|
||||||
@@ -930,11 +928,10 @@ namespace WebUI {
|
|||||||
config->_comms->_bluetoothConfig->begin();
|
config->_comms->_bluetoothConfig->begin();
|
||||||
return Error::Ok;
|
return Error::Ok;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
webPrintln("[MSG: Radio is Off]");
|
|
||||||
return Error::Ok;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
webPrintln("[MSG: Radio is Off]");
|
||||||
return Error::Ok;
|
return Error::Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1038,7 +1035,7 @@ namespace WebUI {
|
|||||||
new WebCommand("path", WEBCMD, WU, NULL, "LocalFS/ListJSON", listLocalFilesJSON);
|
new WebCommand("path", WEBCMD, WU, NULL, "LocalFS/ListJSON", listLocalFilesJSON);
|
||||||
new WebCommand("path", WEBCMD, WU, NULL, "LocalFS/Delete", deleteLocalFile);
|
new WebCommand("path", WEBCMD, WU, NULL, "LocalFS/Delete", deleteLocalFile);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
#ifdef ENABLE_WIFI
|
||||||
new WebCommand(
|
new WebCommand(
|
||||||
"TYPE=NONE|PUSHOVER|EMAIL|LINE T1=token1 T2=token2 TS=settings", WEBCMD, WA, "ESP610", "Notification/Setup", showSetNotification);
|
"TYPE=NONE|PUSHOVER|EMAIL|LINE T1=token1 T2=token2 TS=settings", WEBCMD, WA, "ESP610", "Notification/Setup", showSetNotification);
|
||||||
new WebCommand("message", WEBCMD, WU, "ESP600", "Notification/Send", sendMessage);
|
new WebCommand("message", WEBCMD, WU, "ESP600", "Notification/Send", sendMessage);
|
||||||
@@ -1075,7 +1072,7 @@ namespace WebUI {
|
|||||||
#endif
|
#endif
|
||||||
// WebUI Settings
|
// WebUI Settings
|
||||||
// Standard WEBUI authentication is user+ to get, admin to set unless otherwise specified
|
// Standard WEBUI authentication is user+ to get, admin to set unless otherwise specified
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
#ifdef ENABLE_WIFI
|
||||||
notification_ts = new StringSetting(
|
notification_ts = new StringSetting(
|
||||||
"Notification Settings", WEBSET, WA, NULL, "Notification/TS", DEFAULT_TOKEN, 0, MAX_NOTIFICATION_SETTING_LENGTH, NULL);
|
"Notification Settings", WEBSET, WA, NULL, "Notification/TS", DEFAULT_TOKEN, 0, MAX_NOTIFICATION_SETTING_LENGTH, NULL);
|
||||||
notification_t2 = new StringSetting("Notification Token 2",
|
notification_t2 = new StringSetting("Notification Token 2",
|
||||||
@@ -1119,7 +1116,7 @@ namespace WebUI {
|
|||||||
MAX_LOCAL_PASSWORD_LENGTH,
|
MAX_LOCAL_PASSWORD_LENGTH,
|
||||||
&COMMANDS::isLocalPasswordValid);
|
&COMMANDS::isLocalPasswordValid);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_WIFI
|
||||||
// no get, admin to set
|
// no get, admin to set
|
||||||
wifi_ap_password = new StringSetting("AP Password",
|
wifi_ap_password = new StringSetting("AP Password",
|
||||||
WEBSET,
|
WEBSET,
|
||||||
@@ -1140,5 +1137,6 @@ namespace WebUI {
|
|||||||
MIN_PASSWORD_LENGTH,
|
MIN_PASSWORD_LENGTH,
|
||||||
MAX_PASSWORD_LENGTH,
|
MAX_PASSWORD_LENGTH,
|
||||||
(bool (*)(char*))WiFiConfig::isPasswordValid);
|
(bool (*)(char*))WiFiConfig::isPasswordValid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ namespace WebUI {
|
|||||||
extern StringSetting* admin_password;
|
extern StringSetting* admin_password;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NOTIFICATIONS
|
#ifdef ENABLE_WIFI
|
||||||
extern EnumSetting* notification_type;
|
extern EnumSetting* notification_type;
|
||||||
extern StringSetting* notification_t1;
|
extern StringSetting* notification_t1;
|
||||||
extern StringSetting* notification_t2;
|
extern StringSetting* notification_t2;
|
||||||
|
@@ -467,4 +467,4 @@ namespace WebUI {
|
|||||||
|
|
||||||
WiFiConfig::~WiFiConfig() { end(); }
|
WiFiConfig::~WiFiConfig() { end(); }
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WIFI
|
#endif
|
||||||
|
@@ -40,14 +40,9 @@ namespace WebUI {
|
|||||||
static const int ESP_APPLY_NOW = 1;
|
static const int ESP_APPLY_NOW = 1;
|
||||||
|
|
||||||
//defaults values
|
//defaults values
|
||||||
static const char* DEFAULT_HOSTNAME = "grblesp";
|
static const char* DEFAULT_HOSTNAME = "grblesp";
|
||||||
#ifdef CONNECT_TO_SSID
|
static const char* DEFAULT_STA_SSID = "GRBL_ESP";
|
||||||
static const char* DEFAULT_STA_SSID = CONNECT_TO_SSID;
|
static const char* DEFAULT_STA_PWD = "12345678";
|
||||||
static const char* DEFAULT_STA_PWD = SSID_PASSWORD;
|
|
||||||
#else //!CONNECT_TO_SSID
|
|
||||||
static const char* DEFAULT_STA_SSID = "GRBL_ESP";
|
|
||||||
static const char* DEFAULT_STA_PWD = "12345678";
|
|
||||||
#endif //CONNECT_TO_SSID
|
|
||||||
static const char* DEFAULT_STA_IP = "0.0.0.0";
|
static const char* DEFAULT_STA_IP = "0.0.0.0";
|
||||||
static const char* DEFAULT_STA_GW = "0.0.0.0";
|
static const char* DEFAULT_STA_GW = "0.0.0.0";
|
||||||
static const char* DEFAULT_STA_MK = "0.0.0.0";
|
static const char* DEFAULT_STA_MK = "0.0.0.0";
|
||||||
|
@@ -27,21 +27,11 @@
|
|||||||
# include <FS.h>
|
# include <FS.h>
|
||||||
# include <SPIFFS.h>
|
# include <SPIFFS.h>
|
||||||
# include "WifiServices.h"
|
# include "WifiServices.h"
|
||||||
# ifdef ENABLE_MDNS
|
# include <ESPmDNS.h>
|
||||||
# include <ESPmDNS.h>
|
# include <ArduinoOTA.h>
|
||||||
# endif
|
# include "WebServer.h"
|
||||||
# ifdef ENABLE_OTA
|
# include "TelnetServer.h"
|
||||||
# include <ArduinoOTA.h>
|
# include "NotificationsService.h"
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_HTTP
|
|
||||||
# include "WebServer.h"
|
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_TELNET
|
|
||||||
# include "TelnetServer.h"
|
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_NOTIFICATIONS
|
|
||||||
# include "NotificationsService.h"
|
|
||||||
# endif
|
|
||||||
# include "Commands.h"
|
# include "Commands.h"
|
||||||
|
|
||||||
namespace WebUI {
|
namespace WebUI {
|
||||||
@@ -59,7 +49,6 @@ namespace WebUI {
|
|||||||
|
|
||||||
String& h = config->_comms->_hostname;
|
String& h = config->_comms->_hostname;
|
||||||
|
|
||||||
# ifdef ENABLE_OTA
|
|
||||||
ArduinoOTA
|
ArduinoOTA
|
||||||
.onStart([]() {
|
.onStart([]() {
|
||||||
String type;
|
String type;
|
||||||
@@ -95,8 +84,6 @@ namespace WebUI {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
ArduinoOTA.begin();
|
ArduinoOTA.begin();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_MDNS
|
|
||||||
//no need in AP mode
|
//no need in AP mode
|
||||||
if (WiFi.getMode() == WIFI_STA) {
|
if (WiFi.getMode() == WIFI_STA) {
|
||||||
//start mDns
|
//start mDns
|
||||||
@@ -107,38 +94,24 @@ namespace WebUI {
|
|||||||
info_all("Start mDNS with hostname:http://%s.local/", h.c_str());
|
info_all("Start mDNS with hostname:http://%s.local/", h.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_HTTP
|
|
||||||
web_server.begin();
|
web_server.begin();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_TELNET
|
|
||||||
telnet_server.begin();
|
telnet_server.begin();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_NOTIFICATIONS
|
|
||||||
notificationsservice.begin();
|
notificationsservice.begin();
|
||||||
# endif
|
|
||||||
//be sure we are not is mixed mode in setup
|
//be sure we are not is mixed mode in setup
|
||||||
WiFi.scanNetworks(true);
|
WiFi.scanNetworks(true);
|
||||||
return no_error;
|
return no_error;
|
||||||
}
|
}
|
||||||
void WiFiServices::end() {
|
void WiFiServices::end() {
|
||||||
# ifdef ENABLE_NOTIFICATIONS
|
|
||||||
notificationsservice.end();
|
notificationsservice.end();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_TELNET
|
|
||||||
telnet_server.end();
|
telnet_server.end();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_HTTP
|
|
||||||
web_server.end();
|
web_server.end();
|
||||||
# endif
|
|
||||||
//stop OTA
|
//stop OTA
|
||||||
# ifdef ENABLE_OTA
|
|
||||||
ArduinoOTA.end();
|
ArduinoOTA.end();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_MDNS
|
|
||||||
//Stop mDNS
|
//Stop mDNS
|
||||||
MDNS.end();
|
MDNS.end();
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiFiServices::handle() {
|
void WiFiServices::handle() {
|
||||||
@@ -152,15 +125,9 @@ namespace WebUI {
|
|||||||
WiFi.enableSTA(false);
|
WiFi.enableSTA(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# ifdef ENABLE_OTA
|
|
||||||
ArduinoOTA.handle();
|
ArduinoOTA.handle();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_HTTP
|
|
||||||
web_server.handle();
|
web_server.handle();
|
||||||
# endif
|
|
||||||
# ifdef ENABLE_TELNET
|
|
||||||
telnet_server.handle();
|
telnet_server.handle();
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WIFI
|
#endif
|
||||||
|
@@ -18,20 +18,12 @@ default_envs = release
|
|||||||
|
|
||||||
[common_env_data]
|
[common_env_data]
|
||||||
lib_deps_builtin =
|
lib_deps_builtin =
|
||||||
ArduinoOTA
|
|
||||||
BluetoothSerial
|
|
||||||
DNSServer
|
|
||||||
EEPROM
|
EEPROM
|
||||||
ESPmDNS
|
|
||||||
FS
|
FS
|
||||||
Preferences
|
Preferences
|
||||||
SD
|
SD
|
||||||
SPI
|
SPI
|
||||||
SPIFFS
|
SPIFFS
|
||||||
Update
|
|
||||||
WebServer
|
|
||||||
WiFi
|
|
||||||
WiFiClientSecure
|
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
build_flags =
|
build_flags =
|
||||||
@@ -72,3 +64,25 @@ build_type = debug
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
TMCStepper@>=0.7.0,<1.0.0
|
TMCStepper@>=0.7.0,<1.0.0
|
||||||
ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
|
ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
|
||||||
|
|
||||||
|
[env:wifi]
|
||||||
|
lib_deps =
|
||||||
|
TMCStepper@>=0.7.0,<1.0.0
|
||||||
|
ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
|
||||||
|
ArduinoOTA
|
||||||
|
DNSServer
|
||||||
|
ESPmDNS
|
||||||
|
Update
|
||||||
|
WebServer
|
||||||
|
WiFi
|
||||||
|
WiFiClientSecure
|
||||||
|
|
||||||
|
build_flags = ${common.build_flags} -DENABLE_WIFI
|
||||||
|
|
||||||
|
[env:bt]
|
||||||
|
lib_deps =
|
||||||
|
TMCStepper@>=0.7.0,<1.0.0
|
||||||
|
ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
|
||||||
|
BluetoothSerial
|
||||||
|
|
||||||
|
build_flags = ${common.build_flags} -DENABLE_BLUETOOTH
|
||||||
|
Reference in New Issue
Block a user