Compare commits
	
		
			2 Commits
		
	
	
		
			v1.42
			...
			69cb07f721
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 69cb07f721 | |||
| 5fafe9a538 | 
@@ -52,14 +52,14 @@ function sendRequest(submit, server) {
 | 
			
		||||
 | 
			
		||||
function saveSetting(submit) {
 | 
			
		||||
    server = "/setting?ssid=" + getValue('ssid') + "&password=" + encodeURIComponent(getValue('password'))
 | 
			
		||||
        + "&host=" + getValue('mqttHostName') + "&port=" + getValue('mqttHostPort')
 | 
			
		||||
        + "&login=" + getValue('mqttUserLogin') + "&pass=" + encodeURIComponent(getValue('mqttUserPassword'))
 | 
			
		||||
        + "&prefix=" + getValue('topicPrefix')
 | 
			
		||||
        + "&name=" + getValue('deviceName')
 | 
			
		||||
        + "&net=" + getValue('espnowNetName')
 | 
			
		||||
        + "&mode=" + getSelectValue('workModeSelect')
 | 
			
		||||
        + "&ntp=" + getValue('ntpHostName')
 | 
			
		||||
        + "&zone=" + getValue('gmtOffset');
 | 
			
		||||
        + "&mqttHostName=" + getValue('mqttHostName') + "&mqttHostPort=" + getValue('mqttHostPort')
 | 
			
		||||
        + "&mqttUserLogin=" + getValue('mqttUserLogin') + "&mqttUserPassword=" + encodeURIComponent(getValue('mqttUserPassword'))
 | 
			
		||||
        + "&topicPrefix=" + getValue('topicPrefix')
 | 
			
		||||
        + "&deviceName=" + getValue('deviceName')
 | 
			
		||||
        + "&espnowNetName=" + getValue('espnowNetName')
 | 
			
		||||
        + "&workMode=" + getSelectValue('workModeSelect')
 | 
			
		||||
        + "&ntpHostName=" + getValue('ntpHostName')
 | 
			
		||||
        + "&gmtOffset=" + getValue('gmtOffset');
 | 
			
		||||
    sendRequest(submit, server);
 | 
			
		||||
    alert("Please restart device for changes apply.");
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								src/main.cpp
									
									
									
									
									
								
							@@ -15,13 +15,6 @@
 | 
			
		||||
#include "ESP32SSDP.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef enum : uint8_t
 | 
			
		||||
{
 | 
			
		||||
    ESP_NOW,
 | 
			
		||||
    ESP_NOW_WIFI,
 | 
			
		||||
    ESP_NOW_LAN
 | 
			
		||||
} work_mode_t;
 | 
			
		||||
 | 
			
		||||
void onEspnowMessage(const char *data, const uint8_t *sender);
 | 
			
		||||
 | 
			
		||||
void onMqttMessage(char *topic, byte *payload, unsigned int length);
 | 
			
		||||
@@ -42,6 +35,13 @@ void checkMqttAvailability(void);
 | 
			
		||||
 | 
			
		||||
void mqttPublish(const char *topic, const char *payload, bool retained);
 | 
			
		||||
 | 
			
		||||
typedef enum : uint8_t
 | 
			
		||||
{
 | 
			
		||||
    ESP_NOW,
 | 
			
		||||
    ESP_NOW_WIFI,
 | 
			
		||||
    ESP_NOW_LAN
 | 
			
		||||
} work_mode_t;
 | 
			
		||||
 | 
			
		||||
const String firmware{"1.42"};
 | 
			
		||||
 | 
			
		||||
String espnowNetName{"DEFAULT"};
 | 
			
		||||
@@ -628,16 +628,16 @@ void setupWebServer()
 | 
			
		||||
                 {
 | 
			
		||||
        ssid = request->getParam("ssid")->value();
 | 
			
		||||
        password = request->getParam("password")->value();
 | 
			
		||||
        mqttHostName = request->getParam("host")->value();
 | 
			
		||||
        mqttHostPort = request->getParam("port")->value().toInt();
 | 
			
		||||
        mqttUserLogin = request->getParam("login")->value();
 | 
			
		||||
        mqttUserPassword = request->getParam("pass")->value();
 | 
			
		||||
        topicPrefix = request->getParam("prefix")->value();
 | 
			
		||||
        deviceName = request->getParam("name")->value();
 | 
			
		||||
        espnowNetName = request->getParam("net")->value();
 | 
			
		||||
        workMode = request->getParam("mode")->value().toInt();
 | 
			
		||||
        ntpHostName = request->getParam("ntp")->value();
 | 
			
		||||
        gmtOffset = request->getParam("zone")->value().toInt();
 | 
			
		||||
        mqttHostName = request->getParam("mqttHostName")->value();
 | 
			
		||||
        mqttHostPort = request->getParam("mqttHostPor")->value().toInt();
 | 
			
		||||
        mqttUserLogin = request->getParam("mqttUserLogin")->value();
 | 
			
		||||
        mqttUserPassword = request->getParam("mqttUserPassword")->value();
 | 
			
		||||
        topicPrefix = request->getParam("topicPrefix")->value();
 | 
			
		||||
        deviceName = request->getParam("deviceName")->value();
 | 
			
		||||
        espnowNetName = request->getParam("espnowNetName")->value();
 | 
			
		||||
        workMode = request->getParam("workMode")->value().toInt();
 | 
			
		||||
        ntpHostName = request->getParam("ntpHostName")->value();
 | 
			
		||||
        gmtOffset = request->getParam("gmtOffset")->value().toInt();
 | 
			
		||||
        request->send(200);
 | 
			
		||||
        saveConfig(); });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user