First version of the external temperature/humidity sensor
parent
b0c88946b4
commit
e99a5b6afa
|
|
@ -13,6 +13,7 @@
|
||||||
- ArduinoJson - MIT - 7.1.0 - https://github.com/bblanchon/ArduinoJson
|
- ArduinoJson - MIT - 7.1.0 - https://github.com/bblanchon/ArduinoJson
|
||||||
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
|
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
|
||||||
- arduino-esp32 - LGPL 2.1 - 3.0.2 - https://github.com/espressif/arduino-esp32
|
- arduino-esp32 - LGPL 2.1 - 3.0.2 - https://github.com/espressif/arduino-esp32
|
||||||
|
- DHTnew - MIT - 0.4.20 - https://github.com/RobTillaart/DHTNew
|
||||||
|
|
||||||
Arduino IDE configuration for the MCU are stored in the module_XXX.h file.
|
Arduino IDE configuration for the MCU are stored in the module_XXX.h file.
|
||||||
|
|
||||||
|
|
@ -95,6 +96,9 @@ void setup() {
|
||||||
/* init class for communication with PrusaConnect */
|
/* init class for communication with PrusaConnect */
|
||||||
Connect.Init();
|
Connect.Init();
|
||||||
|
|
||||||
|
/* init external temperature sensor */
|
||||||
|
ExternalTemperatureSensor.Init();
|
||||||
|
|
||||||
/* init wdg */
|
/* init wdg */
|
||||||
SystemLog.AddEvent(LogLevel_Info, F("Init WDG"));
|
SystemLog.AddEvent(LogLevel_Info, F("Init WDG"));
|
||||||
esp_task_wdt_config_t twdt_config;
|
esp_task_wdt_config_t twdt_config;
|
||||||
|
|
@ -121,8 +125,8 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 2600, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 2600, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SerialCfg));
|
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SerialCfg));
|
||||||
xTaskCreatePinnedToCore(System_TaskStreamTelemetry, "PrintStreamTelemetry", 2200, NULL, 6, &Task_StreamTelemetry, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSystemTelemetry, "PrintSystemTelemetry", 2200, NULL, 6, &Task_SystemTelemetry, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
ESP_ERROR_CHECK(esp_task_wdt_add(Task_StreamTelemetry));
|
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SystemTelemetry));
|
||||||
xTaskCreatePinnedToCore(System_TaskSysLed, "SystemLed", 2100, NULL, 7, &Task_SysLed, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSysLed, "SystemLed", 2100, NULL, 7, &Task_SysLed, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SysLed));
|
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SysLed));
|
||||||
xTaskCreatePinnedToCore(System_TaskWiFiWatchdog, "WiFiWatchdog", 2200, NULL, 8, &Task_WiFiWatchdog, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskWiFiWatchdog, "WiFiWatchdog", 2200, NULL, 8, &Task_WiFiWatchdog, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,150 @@
|
||||||
|
/**
|
||||||
|
@file ExternalTemperatureSensor.cpp
|
||||||
|
|
||||||
|
@brief Library for external temperature sensor control
|
||||||
|
|
||||||
|
@author Miroslav Pivovarsky
|
||||||
|
Contact: miroslav.pivovarsky@gmail.com
|
||||||
|
|
||||||
|
@bug: no know bug
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ExternalTemperatureSensor.h"
|
||||||
|
|
||||||
|
ExternalSensor ExternalTemperatureSensor(DHT_SENSOR_PIN, DHT_SENSOR_ENABLE, &SystemLog, &SystemConfig);
|
||||||
|
|
||||||
|
ExternalSensor::ExternalSensor(uint8_t i_pin, bool i_enable, Logs *i_log, Configuration *i_cfg) : DhtSensor(i_pin) {
|
||||||
|
Pin = i_pin;
|
||||||
|
SystemEnable = i_enable;
|
||||||
|
log = i_log;
|
||||||
|
config = i_cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExternalSensor::Init() {
|
||||||
|
log->AddEvent(LogLevel_Info, F("Init external temperature sensor"));
|
||||||
|
Unit = (TemperatureSensorUnit_enum) config->LoadExternalTemperatureSensorUnit();
|
||||||
|
UserEnable = config->LoadExternalTemperatureSensorEnable();
|
||||||
|
//DhtSensor.setHumOffset(10);
|
||||||
|
//DhtSensor.setTempOffset(-3.5);
|
||||||
|
|
||||||
|
ReadSensorData();
|
||||||
|
}
|
||||||
|
|
||||||
|
String ExternalSensor::GetSensorStatus() {
|
||||||
|
String status = "";
|
||||||
|
|
||||||
|
if (false == SystemEnable) {
|
||||||
|
status = "Unsupport sensor";
|
||||||
|
} else if (false == UserEnable) {
|
||||||
|
status = "Sensor disabled";
|
||||||
|
} else {
|
||||||
|
status = "Detected: ";
|
||||||
|
SensorType = DhtSensor.getType();
|
||||||
|
switch (SensorType) {
|
||||||
|
case 0:
|
||||||
|
status += "not defined";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
status += "DHT11";
|
||||||
|
break;
|
||||||
|
case 22:
|
||||||
|
status += "DHT22";
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
status += "DHT22";
|
||||||
|
break;
|
||||||
|
case 70:
|
||||||
|
status += "Sonoff Si7021";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
status += "Unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExternalSensor::EnableSensor(bool i_enable) {
|
||||||
|
if (true == SystemEnable) {
|
||||||
|
UserEnable = i_enable;
|
||||||
|
config->SaveExternalTemperatureSensorEnable(UserEnable);
|
||||||
|
} else {
|
||||||
|
UserEnable = false;
|
||||||
|
config->SaveExternalTemperatureSensorEnable(UserEnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExternalSensor::ReadSensorData() {
|
||||||
|
if ((true == SystemEnable) && (true == UserEnable)) {
|
||||||
|
DhtSensor.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExternalSensor::SetUnit(TemperatureSensorUnit_enum i_unit) {
|
||||||
|
Unit = i_unit;
|
||||||
|
config->SaveExternalTemperatureSensorUnit(Unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
float ExternalSensor::GetTemperature() {
|
||||||
|
float temp = 0.0;
|
||||||
|
if ((true == SystemEnable) && (true == UserEnable)) {
|
||||||
|
if (Unit == TEMPERATURE_UNIT_CELSIUS) {
|
||||||
|
temp = DhtSensor.getTemperature();
|
||||||
|
} else if (Unit == TEMPERATURE_UNIT_FAHRENHEIT) {
|
||||||
|
temp = DhtSensor.getTemperature() * 9.0 / 5.0 + 32.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ExternalSensor::GetHumidity() {
|
||||||
|
if ((true == SystemEnable) && (true == UserEnable)) {
|
||||||
|
return DhtSensor.getHumidity();
|
||||||
|
} else {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String ExternalSensor::GetTemperatureString() {
|
||||||
|
String temp = "";
|
||||||
|
|
||||||
|
if (false == SystemEnable) {
|
||||||
|
temp = "Unsupport";
|
||||||
|
} else if ((false == UserEnable) || (false == SystemEnable)) {
|
||||||
|
temp = "Disabled";
|
||||||
|
} else {
|
||||||
|
if (Unit == TEMPERATURE_UNIT_CELSIUS) {
|
||||||
|
temp = String(GetTemperature(), 1) + " °C";
|
||||||
|
} else if (Unit == TEMPERATURE_UNIT_FAHRENHEIT) {
|
||||||
|
temp = String(GetTemperature(), 1) + " °F";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
String ExternalSensor::GetHumidityString() {
|
||||||
|
String hum = "";
|
||||||
|
|
||||||
|
if (false == SystemEnable) {
|
||||||
|
hum = "Unsupport";
|
||||||
|
} else if ((false == UserEnable) || (false == SystemEnable)) {
|
||||||
|
hum = "Disabled";
|
||||||
|
} else {
|
||||||
|
hum = String(GetHumidity(), 1) + " %";
|
||||||
|
}
|
||||||
|
|
||||||
|
return hum;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExternalSensor::GetUserEnableSensor() {
|
||||||
|
return UserEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
TemperatureSensorUnit_enum ExternalSensor::GetTemperatureUnit() {
|
||||||
|
return Unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/**
|
||||||
|
@file ExternalTemperatureSensor.h
|
||||||
|
|
||||||
|
@brief Library for external temperature sensor control
|
||||||
|
|
||||||
|
@author Miroslav Pivovarsky
|
||||||
|
Contact: miroslav.pivovarsky@gmail.com
|
||||||
|
|
||||||
|
@bug: no know bug
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include "log.h"
|
||||||
|
#include "mcu_cfg.h"
|
||||||
|
#include "module_templates.h"
|
||||||
|
#include <dhtnew.h>
|
||||||
|
#include "cfg.h"
|
||||||
|
#include "ExternalTemperatureSensorTypes.h"
|
||||||
|
|
||||||
|
class Logs;
|
||||||
|
class Configuration;
|
||||||
|
|
||||||
|
class ExternalSensor {
|
||||||
|
private:
|
||||||
|
TemperatureSensorUnit_enum Unit; ///< unit number
|
||||||
|
DHTNEW DhtSensor; ///< DHT sensor object
|
||||||
|
uint8_t Pin; ///< pin number
|
||||||
|
bool SystemEnable; ///< system enable flag
|
||||||
|
bool UserEnable; ///< user enable flag
|
||||||
|
uint8_t SensorType; ///< sensor type
|
||||||
|
|
||||||
|
Logs *log;
|
||||||
|
Configuration *config;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ExternalSensor(uint8_t, bool, Logs *, Configuration *);
|
||||||
|
~ExternalSensor(){};
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
String GetSensorStatus();
|
||||||
|
|
||||||
|
void EnableSensor(bool);
|
||||||
|
void ReadSensorData();
|
||||||
|
void SetUnit(TemperatureSensorUnit_enum);
|
||||||
|
|
||||||
|
float GetTemperature();
|
||||||
|
float GetHumidity();
|
||||||
|
String GetTemperatureString();
|
||||||
|
String GetHumidityString();
|
||||||
|
|
||||||
|
bool GetUserEnableSensor();
|
||||||
|
TemperatureSensorUnit_enum GetTemperatureUnit();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern ExternalSensor ExternalTemperatureSensor;
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**
|
||||||
|
@file connect_types.h
|
||||||
|
|
||||||
|
@brief Here are defined types for communication with prusa connect backend
|
||||||
|
|
||||||
|
@author Miroslav Pivovarsky
|
||||||
|
Contact: miroslav.pivovarsky@gmail.com
|
||||||
|
|
||||||
|
@bug: no know bug
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum TemperatureSensorUnit_enum {
|
||||||
|
TEMPERATURE_UNIT_CELSIUS = 0, ///< Celsius
|
||||||
|
TEMPERATURE_UNIT_FAHRENHEIT = 1 ///< Fahrenheit
|
||||||
|
};
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
@ -82,6 +82,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
<li><a href="page_wifi.html">Wi-Fi</a></li>
|
<li><a href="page_wifi.html">Wi-Fi</a></li>
|
||||||
<li><a href="page_auth.html">Authentication</a></li>
|
<li><a href="page_auth.html">Authentication</a></li>
|
||||||
<li><a href="page_system.html">System</a></li>
|
<li><a href="page_system.html">System</a></li>
|
||||||
|
<li><a href="page_temperature.html">Temperature</a></li>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -364,6 +365,35 @@ const char page_system_html[] PROGMEM = R"rawliteral(
|
||||||
</script>
|
</script>
|
||||||
)rawliteral";
|
)rawliteral";
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------------------------------ */
|
||||||
|
const char page_temperature_html[] PROGMEM = R"rawliteral(
|
||||||
|
<style>@import url("styles.css");</style>
|
||||||
|
<script src="jquery-3.7.0.min.js"></script>
|
||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<table>
|
||||||
|
<tr><td class=pa3>External temperature sensor DHT22/DHT11</td><td></td></tr>
|
||||||
|
<tr><td class=pa1 align="right">Enable sensors</td><td><label class="switch"><input type="checkbox" name="extsens_en" id="extsetsid" onchange="changeValue(this.checked, 'set_bool?extsens_enable=', 'temp')"><span class="checkbox_slider round"></span></label></label> <span class=pa1 id="status_extsens"></span></td></tr>
|
||||||
|
<tr><td class="ps1">Sensor status: </td><td class="pa2" id="extsens_stat"></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td class="pa1">Temperature Unit</td><td><label for="temp_unit"></label>
|
||||||
|
<select class="select" id="temp_unitid" name="temp_unit" onchange="changeValue(this.value, 'set_int?temp_unit=', 'temp')">
|
||||||
|
<option value="0">Celsius</option>
|
||||||
|
<option value="1">Fahrenheit</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td class="pa1">Temperature</td><td class="pa2" id="ext_temp"></td></tr>
|
||||||
|
<tr><td class="pa1">Humidity</td><td class="pa2" id="ext_hum"></td></tr>
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
</body>
|
||||||
|
<script src="scripts.js"></script>
|
||||||
|
<script>
|
||||||
|
get_data("temp");
|
||||||
|
</script>
|
||||||
|
)rawliteral";
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------------------------------ */
|
||||||
const char styles_css[] PROGMEM = R"rawliteral(
|
const char styles_css[] PROGMEM = R"rawliteral(
|
||||||
body {
|
body {
|
||||||
|
|
@ -995,6 +1025,14 @@ function get_data(val) {
|
||||||
document.getElementById('mdnsid').value = obj.mdns;
|
document.getElementById('mdnsid').value = obj.mdns;
|
||||||
document.getElementById('loglevelid').value = obj.log_level;
|
document.getElementById('loglevelid').value = obj.log_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (val == "temp") {
|
||||||
|
$("#extsens_stat").text(obj.extsens_stat);
|
||||||
|
document.getElementById('extsetsid').checked = obj.extsen_en;
|
||||||
|
document.getElementById('temp_unitid').value = obj.exttemp_unit;
|
||||||
|
$("#ext_temp").text(obj.ext_temp);
|
||||||
|
$("#ext_hum").text(obj.ext_hum);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(html) {
|
error: function(html) {
|
||||||
console.log("json Timeout or error");
|
console.log("json Timeout or error");
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ void Server_InitWebServer() {
|
||||||
SystemCamera.SetPhotoSending(true);
|
SystemCamera.SetPhotoSending(true);
|
||||||
|
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, "Photo size: " + String(SystemCamera.GetPhotoFb()->len) + " bytes");
|
SystemLog.AddEvent(LogLevel_Verbose, "Photo size: " + String(SystemCamera.GetPhotoFb()->len) + " bytes");
|
||||||
|
|
||||||
if (SystemCamera.GetPhotoExifData()->header != NULL) {
|
if (SystemCamera.GetPhotoExifData()->header != NULL) {
|
||||||
/* send photo with exif data */
|
/* send photo with exif data */
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("Send photo with EXIF data"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("Send photo with EXIF data"));
|
||||||
|
|
@ -150,7 +150,7 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get index.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get index.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", index_html);
|
Server_handleCacheRequest(request, "text/html", index_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_config.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_config.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", page_config_html);
|
Server_handleCacheRequest(request, "text/html", page_config_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_wifi.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_wifi.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", page_wifi_html);
|
Server_handleCacheRequest(request, "text/html", page_wifi_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -195,7 +195,7 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_auth.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_auth.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", page_auth_html);
|
Server_handleCacheRequest(request, "text/html", page_auth_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -204,16 +204,25 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_system.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_system.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", page_system_html);
|
Server_handleCacheRequest(request, "text/html", page_system_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* route for temperature web page */
|
||||||
|
server.on("/page_temperature.html", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get page_temperature.html"));
|
||||||
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Server_handleCacheRequest(request, "text/html", page_temperature_html);
|
||||||
|
});
|
||||||
|
|
||||||
/* route to license page */
|
/* route to license page */
|
||||||
server.on("/license.html", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/license.html", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get license.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get license.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", license_html);
|
Server_handleCacheRequest(request, "text/html", license_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -222,7 +231,7 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get gtac.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get gtac.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", gtac_html);
|
Server_handleCacheRequest(request, "text/html", gtac_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -231,7 +240,7 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get privacypolicy.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get privacypolicy.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", privacypolicy_html);
|
Server_handleCacheRequest(request, "text/html", privacypolicy_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -240,7 +249,7 @@ void Server_InitWebServer_WebPages() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get cookie.html"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get cookie.html"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "text/html", cookies_html);
|
Server_handleCacheRequest(request, "text/html", cookies_html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -257,6 +266,24 @@ void Server_InitWebServer_WebPages() {
|
||||||
request->send(404, "text/plain", "Micro SD card not found with FAT32 partition!");
|
request->send(404, "text/plain", "Micro SD card not found with FAT32 partition!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* route to get temperature */
|
||||||
|
server.on("/get_temp", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get get_temp"));
|
||||||
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
request->send(200, "text/plain", String(ExternalTemperatureSensor.GetTemperature()));
|
||||||
|
});
|
||||||
|
|
||||||
|
/* route to get humidity */
|
||||||
|
server.on("/get_hum", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get get_hum"));
|
||||||
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
request->send(200, "text/plain", String(ExternalTemperatureSensor.GetHumidity()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -270,7 +297,7 @@ void Server_InitWebServer_Icons() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get esp32_cam.svg"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get esp32_cam.svg"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "image/svg+xml", esp32_cam_logo_svg);
|
Server_handleCacheRequest(request, "image/svg+xml", esp32_cam_logo_svg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -279,7 +306,7 @@ void Server_InitWebServer_Icons() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get github-icon.svg"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get github-icon.svg"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "image/svg+xml", github_icon_svg);
|
Server_handleCacheRequest(request, "image/svg+xml", github_icon_svg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -297,7 +324,7 @@ void Server_InitWebServer_Icons() {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get light-icon.svg"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: Get light-icon.svg"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Server_handleCacheRequest(request, "image/svg+xml", light_icon_off_svg);
|
Server_handleCacheRequest(request, "image/svg+xml", light_icon_off_svg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -468,7 +495,7 @@ void Server_InitWebServer_Actions() {
|
||||||
SystemCamera.SetCameraFlashEnable(false);
|
SystemCamera.SetCameraFlashEnable(false);
|
||||||
SystemCamera.SetFlashStatus(false);
|
SystemCamera.SetFlashStatus(false);
|
||||||
request->send(200, "text/plain", "Flash OFF");
|
request->send(200, "text/plain", "Flash OFF");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
request->send(400, "text/plain", "Invalid request");
|
request->send(400, "text/plain", "Invalid request");
|
||||||
}
|
}
|
||||||
|
|
@ -484,7 +511,7 @@ void Server_InitWebServer_Actions() {
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
});
|
});
|
||||||
|
|
||||||
/* route for change LED status */
|
/* route for change LED status */
|
||||||
server.on("/action_sderase", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/action_sderase", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_sderase remove files from SD card"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_sderase remove files from SD card"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
|
@ -636,6 +663,14 @@ void Server_InitWebServer_Sets() {
|
||||||
response = true;
|
response = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set saturation */
|
||||||
|
if (request->hasParam("temp_unit")) {
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, F("Set temp_unit"));
|
||||||
|
ExternalTemperatureSensor.SetUnit((TemperatureSensorUnit_enum) request->getParam("temp_unit")->value().toInt());
|
||||||
|
response_msg = MSG_SAVE_OK;
|
||||||
|
response = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (true == response) {
|
if (true == response) {
|
||||||
request->send(200, F("text/html"), response_msg.c_str());
|
request->send(200, F("text/html"), response_msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -734,27 +769,36 @@ void Server_InitWebServer_Sets() {
|
||||||
response = true;
|
response = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set service AP */
|
||||||
if (request->hasParam("serviceap_enable")) {
|
if (request->hasParam("serviceap_enable")) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("Set service AP enable"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("Set service AP enable"));
|
||||||
SystemWifiMngt.SetEnableServiceAp(Server_TransfeStringToBool(request->getParam("serviceap_enable")->value()));
|
SystemWifiMngt.SetEnableServiceAp(Server_TransfeStringToBool(request->getParam("serviceap_enable")->value()));
|
||||||
response = true;
|
response = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set timelaps enable */
|
||||||
if (request->hasParam("timelaps_enable")) {
|
if (request->hasParam("timelaps_enable")) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("Set timelaps enable"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("Set timelaps enable"));
|
||||||
#if (ENABLE_SD_CARD == true)
|
#if (ENABLE_SD_CARD == true)
|
||||||
bool val = Server_TransfeStringToBool(request->getParam("timelaps_enable")->value());
|
bool val = Server_TransfeStringToBool(request->getParam("timelaps_enable")->value());
|
||||||
if ((true == val ) && (SystemLog.GetCardDetectedStatus() == true)) {
|
if ((true == val) && (SystemLog.GetCardDetectedStatus() == true)) {
|
||||||
Connect.SetTimeLapsPhotoSaveStatus(val);
|
Connect.SetTimeLapsPhotoSaveStatus(val);
|
||||||
} else {
|
} else {
|
||||||
Connect.SetTimeLapsPhotoSaveStatus(false);
|
Connect.SetTimeLapsPhotoSaveStatus(false);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Connect.SetTimeLapsPhotoSaveStatus(false);
|
Connect.SetTimeLapsPhotoSaveStatus(false);
|
||||||
#endif
|
#endif
|
||||||
response = true;
|
response = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set external temperature sensor enable */
|
||||||
|
if (request->hasParam("extsens_enable")) {
|
||||||
|
SystemLog.AddEvent(LogLevel_Verbose, F("Set enable ext temperature"));
|
||||||
|
ExternalTemperatureSensor.EnableSensor(Server_TransfeStringToBool(request->getParam("extsens_enable")->value()));
|
||||||
|
response = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (true == response) {
|
if (true == response) {
|
||||||
request->send(200, F("text/html"), MSG_SAVE_OK);
|
request->send(200, F("text/html"), MSG_SAVE_OK);
|
||||||
}
|
}
|
||||||
|
|
@ -808,7 +852,7 @@ void Server_InitWebServer_Sets() {
|
||||||
request->send(200, F("text/html"), MSG_SAVE_OK_WIFI);
|
request->send(200, F("text/html"), MSG_SAVE_OK_WIFI);
|
||||||
|
|
||||||
/* save ssid and password */
|
/* save ssid and password */
|
||||||
SystemWifiMngt.SetStaCredentials(TmpSsid,TmpPassword);
|
SystemWifiMngt.SetStaCredentials(TmpSsid, TmpPassword);
|
||||||
SystemWifiMngt.WiFiStaConnect();
|
SystemWifiMngt.WiFiStaConnect();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -816,7 +860,7 @@ void Server_InitWebServer_Sets() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* route for set WI-FI static IP address */
|
/* route for set WI-FI static IP address */
|
||||||
server.on("/wifi_net_cfg", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/wifi_net_cfg", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: set WI-FI static IP address"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: set WI-FI static IP address"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
|
@ -848,10 +892,8 @@ void Server_InitWebServer_Sets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check min and max length network parameters */
|
/* check min and max length network parameters */
|
||||||
if (((tmpIp.length() > 0) && (tmpMask.length() > 0) && (tmpGw.length() > 0) && (tmpDns.length() > 0)) &&
|
if (((tmpIp.length() > 0) && (tmpMask.length() > 0) && (tmpGw.length() > 0) && (tmpDns.length() > 0)) && ((tmpIp.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpMask.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpGw.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpDns.length() <= IPV4_ADDR_MAX_LENGTH))) {
|
||||||
((tmpIp.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpMask.length() <= IPV4_ADDR_MAX_LENGTH) &&
|
|
||||||
(tmpGw.length() <= IPV4_ADDR_MAX_LENGTH) && (tmpDns.length() <= IPV4_ADDR_MAX_LENGTH))) {
|
|
||||||
|
|
||||||
/* save ssid and password */
|
/* save ssid and password */
|
||||||
SystemWifiMngt.SetNetworkConfig(tmpIp, tmpMask, tmpGw, tmpDns);
|
SystemWifiMngt.SetNetworkConfig(tmpIp, tmpMask, tmpGw, tmpDns);
|
||||||
|
|
||||||
|
|
@ -911,7 +953,7 @@ void Server_InitWebServer_Sets() {
|
||||||
/* send OK response */
|
/* send OK response */
|
||||||
if (true == ret) {
|
if (true == ret) {
|
||||||
request->send(200, F("text/html"), MSG_SAVE_OK);
|
request->send(200, F("text/html"), MSG_SAVE_OK);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String msg = MSG_SAVE_NOTOK;
|
String msg = MSG_SAVE_NOTOK;
|
||||||
msg += " " + ret_msg;
|
msg += " " + ret_msg;
|
||||||
|
|
@ -1010,8 +1052,7 @@ void Server_InitWebServer_Update() {
|
||||||
SystemLog.AddEvent(LogLevel_Error, String(SYSTEM_MSG_UPDATE_FAIL));
|
SystemLog.AddEvent(LogLevel_Error, String(SYSTEM_MSG_UPDATE_FAIL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
/* route for start web OTA update from server */
|
/* route for start web OTA update from server */
|
||||||
server.on("/web_ota_update", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/web_ota_update", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
|
|
@ -1079,8 +1120,8 @@ void Server_resume() {
|
||||||
* @param const char* - content type
|
* @param const char* - content type
|
||||||
* @param const char* - data
|
* @param const char* - data
|
||||||
*/
|
*/
|
||||||
void Server_handleCacheRequest(AsyncWebServerRequest* request, const char *contentType, const char *data) {
|
void Server_handleCacheRequest(AsyncWebServerRequest* request, const char* contentType, const char* data) {
|
||||||
AsyncWebServerResponse *response = request->beginResponse(200, contentType, data);
|
AsyncWebServerResponse* response = request->beginResponse(200, contentType, data);
|
||||||
response->addHeader("Cache-Control", "public, max-age=" + String(WEB_CACHE_INTERVAL));
|
response->addHeader("Cache-Control", "public, max-age=" + String(WEB_CACHE_INTERVAL));
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
|
@ -1174,6 +1215,11 @@ String Server_GetJsonData() {
|
||||||
doc_json["sw_build"] = SW_BUILD;
|
doc_json["sw_build"] = SW_BUILD;
|
||||||
doc_json["sw_ver"] = SW_VERSION;
|
doc_json["sw_ver"] = SW_VERSION;
|
||||||
doc_json["sw_new_ver"] = FirmwareUpdate.NewVersionFw;
|
doc_json["sw_new_ver"] = FirmwareUpdate.NewVersionFw;
|
||||||
|
doc_json["extsens_stat"] = ExternalTemperatureSensor.GetSensorStatus();
|
||||||
|
doc_json["extsen_en"] = ExternalTemperatureSensor.GetUserEnableSensor();
|
||||||
|
doc_json["ext_temp"] = ExternalTemperatureSensor.GetTemperatureString();
|
||||||
|
doc_json["ext_hum"] = ExternalTemperatureSensor.GetHumidityString();
|
||||||
|
doc_json["exttemp_unit"] = ExternalTemperatureSensor.GetTemperatureUnit();
|
||||||
|
|
||||||
serializeJson(doc_json, string_json);
|
serializeJson(doc_json, string_json);
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, string_json);
|
SystemLog.AddEvent(LogLevel_Verbose, string_json);
|
||||||
|
|
@ -1200,8 +1246,8 @@ bool Server_CheckBasicAuth(AsyncWebServerRequest* request) {
|
||||||
@param AsyncWebServerRequest - request
|
@param AsyncWebServerRequest - request
|
||||||
@return void
|
@return void
|
||||||
*/
|
*/
|
||||||
void Server_streamJpg(AsyncWebServerRequest *request) {
|
void Server_streamJpg(AsyncWebServerRequest* request) {
|
||||||
AsyncJpegStreamResponse *response = new AsyncJpegStreamResponse(&SystemCamera, &SystemLog);
|
AsyncJpegStreamResponse* response = new AsyncJpegStreamResponse(&SystemCamera, &SystemLog);
|
||||||
if (!response) {
|
if (!response) {
|
||||||
request->send(501);
|
request->send(501);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
#include "wifi_mngt.h"
|
#include "wifi_mngt.h"
|
||||||
#include "WebStream.h"
|
#include "WebStream.h"
|
||||||
|
#include "ExternalTemperatureSensor.h"
|
||||||
|
|
||||||
extern AsyncWebServer server; ///< global variable for web server
|
extern AsyncWebServer server; ///< global variable for web server
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -852,6 +852,26 @@ void Configuration::SaveTimeLapseFunctionStatus(bool i_data) {
|
||||||
SaveBool(EEPROM_ADDR_TIMELAPS_ENABLE_START, i_data);
|
SaveBool(EEPROM_ADDR_TIMELAPS_ENABLE_START, i_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@info Save external temperature sensor enable
|
||||||
|
@param bool - value
|
||||||
|
@return none
|
||||||
|
*/
|
||||||
|
void Configuration::SaveExternalTemperatureSensorEnable(bool i_data) {
|
||||||
|
Log->AddEvent(LogLevel_Verbose, F("Save external temperature sensor enable: "), String(i_data));
|
||||||
|
SaveBool(EEPROM_ADDR_EXT_SENS_ENABLE_START, i_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@info Save external temperature sensor unit
|
||||||
|
@param uint8_t - value
|
||||||
|
@return none
|
||||||
|
*/
|
||||||
|
void Configuration::SaveExternalTemperatureSensorUnit(uint8_t i_data) {
|
||||||
|
Log->AddEvent(LogLevel_Verbose, F("Save external temperature sensor unit: "), String(i_data));
|
||||||
|
SaveUint8(EEPROM_ADDR_EXT_SENS_UNIT_START, i_data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@info load refresh interval from eeprom
|
@info load refresh interval from eeprom
|
||||||
@param none
|
@param none
|
||||||
|
|
@ -1363,4 +1383,27 @@ bool Configuration::LoadTimeLapseFunctionStatus() {
|
||||||
return (bool) ret;
|
return (bool) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Configuration::LoadExternalTemperatureSensorEnable() {
|
||||||
|
uint8_t ret = EEPROM.read(EEPROM_ADDR_EXT_SENS_ENABLE_START);
|
||||||
|
Log->AddEvent(LogLevel_Info, F("External temperature sensor enable: "), String(ret));
|
||||||
|
|
||||||
|
if (ret == 255) {
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (bool) ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Configuration::LoadExternalTemperatureSensorUnit() {
|
||||||
|
uint8_t ret = EEPROM.read(EEPROM_ADDR_EXT_SENS_UNIT_START);
|
||||||
|
Log->AddEvent(LogLevel_Info, F("External temperature sensor unit: "), String(ret));
|
||||||
|
|
||||||
|
if (ret == 255) {
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
@ -74,6 +74,8 @@ public:
|
||||||
void SaveNetworkDns(String);
|
void SaveNetworkDns(String);
|
||||||
void SaveCameraImageExifRotation(uint8_t);
|
void SaveCameraImageExifRotation(uint8_t);
|
||||||
void SaveTimeLapseFunctionStatus(bool);
|
void SaveTimeLapseFunctionStatus(bool);
|
||||||
|
void SaveExternalTemperatureSensorEnable(bool);
|
||||||
|
void SaveExternalTemperatureSensorUnit(uint8_t);
|
||||||
|
|
||||||
uint8_t LoadRefreshInterval();
|
uint8_t LoadRefreshInterval();
|
||||||
String LoadToken();
|
String LoadToken();
|
||||||
|
|
@ -116,6 +118,8 @@ public:
|
||||||
String LoadNetworkDns();
|
String LoadNetworkDns();
|
||||||
uint8_t LoadCameraImageExifRotation();
|
uint8_t LoadCameraImageExifRotation();
|
||||||
bool LoadTimeLapseFunctionStatus();
|
bool LoadTimeLapseFunctionStatus();
|
||||||
|
bool LoadExternalTemperatureSensorEnable();
|
||||||
|
uint8_t LoadExternalTemperatureSensorUnit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Logs *Log; ///< Pointer to Logs object
|
Logs *Log; ///< Pointer to Logs object
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,15 @@
|
||||||
#define _MCU_CFG_H_
|
#define _MCU_CFG_H_
|
||||||
|
|
||||||
/* ----------------- CAMERA TYPE ---------------*/
|
/* ----------------- CAMERA TYPE ---------------*/
|
||||||
#define AI_THINKER_ESP32_CAM true
|
#define AI_THINKER_ESP32_CAM true
|
||||||
#define ESP32_WROVER_DEV false
|
#define ESP32_WROVER_DEV false
|
||||||
#define CAMERA_MODEL_ESP32_S3_DEV_CAM false
|
#define CAMERA_MODEL_ESP32_S3_DEV_CAM false
|
||||||
#define CAMERA_MODEL_ESP32_S3_EYE_2_2 false
|
#define CAMERA_MODEL_ESP32_S3_EYE_2_2 false
|
||||||
#define CAMERA_MODEL_XIAO_ESP32_S3_CAM false
|
#define CAMERA_MODEL_XIAO_ESP32_S3_CAM false
|
||||||
#define CAMERA_MODEL_ESP32_S3_CAM false
|
#define CAMERA_MODEL_ESP32_S3_CAM false
|
||||||
|
|
||||||
/* ---------------- BASIC MCU CFG --------------*/
|
/* ---------------- BASIC MCU CFG --------------*/
|
||||||
#define SW_VERSION "1.1.0-rc1" ///< SW version
|
#define SW_VERSION "1.1.0-rc2" ///< SW version
|
||||||
#define SW_BUILD __DATE__ " " __TIME__ ///< build number
|
#define SW_BUILD __DATE__ " " __TIME__ ///< build number
|
||||||
#define CONSOLE_VERBOSE_DEBUG false ///< enable/disable verbose debug log level for console
|
#define CONSOLE_VERBOSE_DEBUG false ///< enable/disable verbose debug log level for console
|
||||||
#define DEVICE_HOSTNAME "Prusa-ESP32cam" ///< device hostname
|
#define DEVICE_HOSTNAME "Prusa-ESP32cam" ///< device hostname
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
#define TASK_SDCARD 25000 ///< sd card task interval [ms]
|
#define TASK_SDCARD 25000 ///< sd card task interval [ms]
|
||||||
#define TASK_WIFI 28000 ///< wifi reconnect interval. Checking when is signal lost [ms]
|
#define TASK_WIFI 28000 ///< wifi reconnect interval. Checking when is signal lost [ms]
|
||||||
#define TASK_SERIAL_CFG 1000 ///< serial cfg task interval [ms]
|
#define TASK_SERIAL_CFG 1000 ///< serial cfg task interval [ms]
|
||||||
#define TASK_STREAM_TELEMETRY 30000 ///< stream telemetry task interval [ms]
|
#define TASK_SYSTEM_TELEMETRY 30000 ///< stream telemetry task interval [ms]
|
||||||
#define TASK_WIFI_WATCHDOG 20000 ///< wifi watchdog task interval [ms]
|
#define TASK_WIFI_WATCHDOG 20000 ///< wifi watchdog task interval [ms]
|
||||||
#define TASK_PHOTO_SEND 1000 ///< photo send task interval [ms]
|
#define TASK_PHOTO_SEND 1000 ///< photo send task interval [ms]
|
||||||
#define TASK_SDCARD_FILE_REMOVE 30000 ///< sd card file remove task interval [ms]
|
#define TASK_SDCARD_FILE_REMOVE 30000 ///< sd card file remove task interval [ms]
|
||||||
|
|
@ -283,6 +283,12 @@
|
||||||
#define EEPROM_ADDR_TIMELAPS_ENABLE_START (EEPROM_ADDR_IMAGE_ROTATION_START + EEPROM_ADDR_IMAGE_ROTATION_LENGTH)
|
#define EEPROM_ADDR_TIMELAPS_ENABLE_START (EEPROM_ADDR_IMAGE_ROTATION_START + EEPROM_ADDR_IMAGE_ROTATION_LENGTH)
|
||||||
#define EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH 1
|
#define EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH 1
|
||||||
|
|
||||||
|
#define EEPROM_ADDR_EXT_SENS_ENABLE_START (EEPROM_ADDR_TIMELAPS_ENABLE_START + EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH)
|
||||||
|
#define EEPROM_ADDR_EXT_SENS_ENABLE_LENGTH 1
|
||||||
|
|
||||||
|
#define EEPROM_ADDR_EXT_SENS_UNIT_START (EEPROM_ADDR_EXT_SENS_ENABLE_START + EEPROM_ADDR_EXT_SENS_ENABLE_LENGTH)
|
||||||
|
#define EEPROM_ADDR_EXT_SENS_UNIT_LENGTH 1
|
||||||
|
|
||||||
#define EEPROM_SIZE (EEPROM_ADDR_REFRESH_INTERVAL_LENGTH + EEPROM_ADDR_FINGERPRINT_LENGTH + EEPROM_ADDR_TOKEN_LENGTH + \
|
#define EEPROM_SIZE (EEPROM_ADDR_REFRESH_INTERVAL_LENGTH + EEPROM_ADDR_FINGERPRINT_LENGTH + EEPROM_ADDR_TOKEN_LENGTH + \
|
||||||
EEPROM_ADDR_FRAMESIZE_LENGTH + EEPROM_ADDR_BRIGHTNESS_LENGTH + EEPROM_ADDR_CONTRAST_LENGTH + \
|
EEPROM_ADDR_FRAMESIZE_LENGTH + EEPROM_ADDR_BRIGHTNESS_LENGTH + EEPROM_ADDR_CONTRAST_LENGTH + \
|
||||||
EEPROM_ADDR_SATURATION_LENGTH + EEPROM_ADDR_HMIRROR_LENGTH + EEPROM_ADDR_VFLIP_LENGTH + \
|
EEPROM_ADDR_SATURATION_LENGTH + EEPROM_ADDR_HMIRROR_LENGTH + EEPROM_ADDR_VFLIP_LENGTH + \
|
||||||
|
|
@ -297,7 +303,8 @@
|
||||||
EEPROM_ADDR_AEC_VALUE_LENGTH + EEPROM_ADDR_GAIN_CTRL_LENGTH + EEPROM_ADDR_AGC_GAIN_LENGTH + EEPROM_ADDR_LOG_LEVEL_LENGTH + \
|
EEPROM_ADDR_AEC_VALUE_LENGTH + EEPROM_ADDR_GAIN_CTRL_LENGTH + EEPROM_ADDR_AGC_GAIN_LENGTH + EEPROM_ADDR_LOG_LEVEL_LENGTH + \
|
||||||
EEPROM_ADDR_HOSTNAME_LENGTH + EEPROM_ADDR_SERVICE_AP_ENABLE_LENGTH + EEPROM_ADDR_NETWORK_IP_METHOD_LENGTH +\
|
EEPROM_ADDR_HOSTNAME_LENGTH + EEPROM_ADDR_SERVICE_AP_ENABLE_LENGTH + EEPROM_ADDR_NETWORK_IP_METHOD_LENGTH +\
|
||||||
EEPROM_ADDR_NETWORK_STATIC_IP_LENGTH + EEPROM_ADDR_NETWORK_STATIC_MASK_LENGTH + EEPROM_ADDR_NETWORK_STATIC_GATEWAY_LENGTH + \
|
EEPROM_ADDR_NETWORK_STATIC_IP_LENGTH + EEPROM_ADDR_NETWORK_STATIC_MASK_LENGTH + EEPROM_ADDR_NETWORK_STATIC_GATEWAY_LENGTH + \
|
||||||
EEPROM_ADDR_NETWORK_STATIC_DNS_LENGTH + EEPROM_ADDR_IMAGE_ROTATION_LENGTH + EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH) ///< how many bits do we need for eeprom memory
|
EEPROM_ADDR_NETWORK_STATIC_DNS_LENGTH + EEPROM_ADDR_IMAGE_ROTATION_LENGTH + EEPROM_ADDR_TIMELAPS_ENABLE_LENGTH + \
|
||||||
|
EEPROM_ADDR_EXT_SENS_ENABLE_LENGTH + EEPROM_ADDR_EXT_SENS_UNIT_LENGTH) ///< how many bits do we need for eeprom memory
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
#define SD_PIN_DATA0 2 ///< GPIO pin for SD card data 0
|
#define SD_PIN_DATA0 2 ///< GPIO pin for SD card data 0
|
||||||
|
|
||||||
/* ---------- RESET CFG CONFIGURATION ----------*/
|
/* ---------- RESET CFG CONFIGURATION ----------*/
|
||||||
#define CFG_RESET_PIN 12 ///< GPIO 16 is for reset CFG to default
|
#define CFG_RESET_PIN 12 ///< GPIO 12 is for reset CFG to default
|
||||||
#define CFG_RESET_LED_PIN 4 ///< GPIO for indication of reset CFG
|
#define CFG_RESET_LED_PIN 4 ///< GPIO for indication of reset CFG
|
||||||
#define CFG_RESET_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
|
#define CFG_RESET_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON
|
||||||
|
|
||||||
|
|
@ -82,5 +82,9 @@
|
||||||
#define STATUS_LED_GPIO_NUM 33 ///< GPIO pin for status LED
|
#define STATUS_LED_GPIO_NUM 33 ///< GPIO pin for status LED
|
||||||
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
|
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
|
||||||
|
|
||||||
|
/* -------------- DHT SENSOR CFG ----------------*/
|
||||||
|
#define DHT_SENSOR_ENABLE true ///< enable/disable DHT sensor
|
||||||
|
#define DHT_SENSOR_PIN 13 ///< GPIO pin for DHT sensor
|
||||||
|
|
||||||
#endif // AI_THINKER_ESP32_CAM
|
#endif // AI_THINKER_ESP32_CAM
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
@author Miroslav Pivovarsky
|
@author Miroslav Pivovarsky
|
||||||
Contact: miroslav.pivovarsky@gmail.com
|
Contact: miroslav.pivovarsky@gmail.com
|
||||||
|
|
||||||
https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html
|
https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html
|
||||||
https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/
|
https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/
|
||||||
|
https://github.com/limengdu/SeeedStudio-XIAO-ESP32S3-Sense-camera
|
||||||
|
https://github.com/Seeed-Studio/XIAO_Series
|
||||||
|
|
||||||
@bug: Currently SW don't work with this DEV board. WiFi and MicroSD is not working
|
@bug: Currently SW don't work with this DEV board. WiFi and MicroSD is not working
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,23 +18,23 @@
|
||||||
class Logs;
|
class Logs;
|
||||||
|
|
||||||
class sys_led {
|
class sys_led {
|
||||||
private:
|
private:
|
||||||
uint8_t pin; ///< pin number for system LED
|
uint8_t pin; ///< pin number for system LED
|
||||||
uint32_t time; ///< speed blinking time system LED
|
uint32_t time; ///< speed blinking time system LED
|
||||||
uint32_t ledOnDuration; ///< duration of LED on
|
uint32_t ledOnDuration; ///< duration of LED on
|
||||||
Logs *log; ///< pointer to log class
|
Logs *log; ///< pointer to log class
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sys_led(uint8_t, uint32_t);
|
sys_led(uint8_t, uint32_t);
|
||||||
sys_led(uint8_t, uint32_t, Logs *);
|
sys_led(uint8_t, uint32_t, Logs *);
|
||||||
~sys_led(){};
|
~sys_led(){};
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void toggle();
|
void toggle();
|
||||||
void set(bool);
|
void set(bool);
|
||||||
bool get();
|
bool get();
|
||||||
void setTimer(uint32_t);
|
void setTimer(uint32_t);
|
||||||
uint32_t getTimer();
|
uint32_t getTimer();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern sys_led system_led;
|
extern sys_led system_led;
|
||||||
|
|
|
||||||
|
|
@ -459,9 +459,6 @@ void System_TaskWifiManagement(void *pvParameters) {
|
||||||
|
|
||||||
/* wifi reconnect after signal lost */
|
/* wifi reconnect after signal lost */
|
||||||
SystemWifiMngt.WiFiReconnect();
|
SystemWifiMngt.WiFiReconnect();
|
||||||
SystemLog.AddEvent(LogLevel_Info, "Free RAM: " + String(ESP.getFreeHeap()) + " B" + ", Min: " + String(ESP.getMinFreeHeap()));
|
|
||||||
SystemLog.AddEvent(LogLevel_Info, "Free PSRAM: " + String(ESP.getFreePsram()) + " B" + ", Min: " + String(ESP.getMinFreePsram()));
|
|
||||||
SystemLog.AddEvent(LogLevel_Info, "Temperature: " + String(McuTemperature.TemperatureCelsius) + " *C");
|
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WiFiManagement task. Stack free size: "), String(uxTaskGetStackHighWaterMark(NULL)) + "B");
|
SystemLog.AddEvent(LogLevel_Verbose, F("WiFiManagement task. Stack free size: "), String(uxTaskGetStackHighWaterMark(NULL)) + "B");
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WiFi status: "), String(WiFi.status()));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WiFi status: "), String(WiFi.status()));
|
||||||
|
|
||||||
|
|
@ -615,30 +612,36 @@ void System_TaskSerialCfg(void *pvParameters) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function for stream telemetry task
|
* @brief Function for system telemetry task
|
||||||
*
|
*
|
||||||
* @param void *pvParameters
|
* @param void *pvParameters
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
void System_TaskStreamTelemetry(void *pvParameters) {
|
void System_TaskSystemTelemetry(void *pvParameters) {
|
||||||
SystemLog.AddEvent(LogLevel_Info, F("StreamTelemetry task. core: "), String(xPortGetCoreID()));
|
SystemLog.AddEvent(LogLevel_Info, F("SystemTelemetry task. core: "), String(xPortGetCoreID()));
|
||||||
TickType_t xLastWakeTime = xTaskGetTickCount();
|
TickType_t xLastWakeTime = xTaskGetTickCount();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("StreamTelemetry task. Stack free size: "), String(uxTaskGetStackHighWaterMark(NULL)) + "B");
|
SystemLog.AddEvent(LogLevel_Verbose, F("SystemTelemetry task. Stack free size: "), String(uxTaskGetStackHighWaterMark(NULL)) + "B");
|
||||||
if (SystemCamera.GetStreamStatus()) {
|
if (SystemCamera.GetStreamStatus()) {
|
||||||
char buf[80] = { '\0' };
|
char buf[80] = { '\0' };
|
||||||
sprintf(buf, "Stream, average data in %dsec. FPS: %.1f, Size: %uKB", (TASK_STREAM_TELEMETRY / SECOND_TO_MILISECOND), SystemCamera.StreamGetFrameAverageFps(), SystemCamera.StreamGetFrameAverageSize());
|
sprintf(buf, "Stream, average data in %dsec. FPS: %.1f, Size: %uKB", (TASK_SYSTEM_TELEMETRY / SECOND_TO_MILISECOND), SystemCamera.StreamGetFrameAverageFps(), SystemCamera.StreamGetFrameAverageSize());
|
||||||
SystemLog.AddEvent(LogLevel_Info, buf);
|
SystemLog.AddEvent(LogLevel_Info, buf);
|
||||||
SystemCamera.StreamClearFrameData();
|
SystemCamera.StreamClearFrameData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemLog.AddEvent(LogLevel_Info, "Free RAM: " + String(ESP.getFreeHeap()) + " B" + ", Min: " + String(ESP.getMinFreeHeap()));
|
||||||
|
SystemLog.AddEvent(LogLevel_Info, "Free PSRAM: " + String(ESP.getFreePsram()) + " B" + ", Min: " + String(ESP.getMinFreePsram()));
|
||||||
|
SystemLog.AddEvent(LogLevel_Info, "MCU Temperature: " + String(McuTemperature.TemperatureCelsius) + " *C");
|
||||||
|
|
||||||
|
ExternalTemperatureSensor.ReadSensorData();
|
||||||
|
|
||||||
/* reset wdg */
|
/* reset wdg */
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
|
|
||||||
/* next start task */
|
/* next start task */
|
||||||
vTaskDelayUntil(&xLastWakeTime, TASK_STREAM_TELEMETRY / portTICK_PERIOD_MS);
|
vTaskDelayUntil(&xLastWakeTime, TASK_SYSTEM_TELEMETRY / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
#include "serial_cfg.h"
|
#include "serial_cfg.h"
|
||||||
#include "sys_led.h"
|
#include "sys_led.h"
|
||||||
|
#include "ExternalTemperatureSensor.h"
|
||||||
|
|
||||||
#define SYSTEM_MSG_UPDATE_DONE F("FW update successfully done! Please reboot the MCU.")
|
#define SYSTEM_MSG_UPDATE_DONE F("FW update successfully done! Please reboot the MCU.")
|
||||||
#define SYSTEM_MSG_UPDATE_FAIL F("FW update failed! Please reboot MCU, and try again.")
|
#define SYSTEM_MSG_UPDATE_FAIL F("FW update failed! Please reboot MCU, and try again.")
|
||||||
|
|
@ -66,7 +67,7 @@ void System_TaskMain(void *);
|
||||||
void System_TaskCaptureAndSendPhoto(void *);
|
void System_TaskCaptureAndSendPhoto(void *);
|
||||||
void System_TaskSdCardCheck(void *);
|
void System_TaskSdCardCheck(void *);
|
||||||
void System_TaskSerialCfg(void *);
|
void System_TaskSerialCfg(void *);
|
||||||
void System_TaskStreamTelemetry(void *);
|
void System_TaskSystemTelemetry(void *);
|
||||||
void System_TaskSysLed(void *);
|
void System_TaskSysLed(void *);
|
||||||
void System_TaskWiFiWatchdog(void *);
|
void System_TaskWiFiWatchdog(void *);
|
||||||
void System_TaskSdCardRemove(void *);
|
void System_TaskSdCardRemove(void *);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ TaskHandle_t Task_WiFiManagement;
|
||||||
TaskHandle_t Task_SystemMain;
|
TaskHandle_t Task_SystemMain;
|
||||||
TaskHandle_t Task_SdCardCheck;
|
TaskHandle_t Task_SdCardCheck;
|
||||||
TaskHandle_t Task_SerialCfg;
|
TaskHandle_t Task_SerialCfg;
|
||||||
TaskHandle_t Task_StreamTelemetry;
|
TaskHandle_t Task_SystemTelemetry;
|
||||||
TaskHandle_t Task_SysLed;
|
TaskHandle_t Task_SysLed;
|
||||||
TaskHandle_t Task_WiFiWatchdog;
|
TaskHandle_t Task_WiFiWatchdog;
|
||||||
//TaskHandle_t Task_SdCardFileRemove;
|
//TaskHandle_t Task_SdCardFileRemove;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ extern TaskHandle_t Task_WiFiManagement; ///< task handle for wifi m
|
||||||
extern TaskHandle_t Task_SystemMain; ///< task handle for system main
|
extern TaskHandle_t Task_SystemMain; ///< task handle for system main
|
||||||
extern TaskHandle_t Task_SdCardCheck; ///< task handle for sd card check
|
extern TaskHandle_t Task_SdCardCheck; ///< task handle for sd card check
|
||||||
extern TaskHandle_t Task_SerialCfg; ///< task handle for serial configuration
|
extern TaskHandle_t Task_SerialCfg; ///< task handle for serial configuration
|
||||||
extern TaskHandle_t Task_StreamTelemetry; ///< task handle for stream telemetry
|
extern TaskHandle_t Task_SystemTelemetry; ///< task handle for system telemetry
|
||||||
extern TaskHandle_t Task_SysLed; ///< task handle for system led
|
extern TaskHandle_t Task_SysLed; ///< task handle for system led
|
||||||
extern TaskHandle_t Task_WiFiWatchdog; ///< task handle for wifi watchdog
|
extern TaskHandle_t Task_WiFiWatchdog; ///< task handle for wifi watchdog
|
||||||
//extern TaskHandle_t Task_SdCardFileRemove; ///< task handle for remove file from sd card
|
//extern TaskHandle_t Task_SdCardFileRemove; ///< task handle for remove file from sd card
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@
|
||||||
<li><a href="page_wifi.html">Wi-Fi</a></li>
|
<li><a href="page_wifi.html">Wi-Fi</a></li>
|
||||||
<li><a href="page_auth.html">Authentication</a></li>
|
<li><a href="page_auth.html">Authentication</a></li>
|
||||||
<li><a href="page_system.html">System</a></li>
|
<li><a href="page_system.html">System</a></li>
|
||||||
|
<li><a href="page_temperature.html">Temperature</a></li>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<style>@import url("styles.css");</style>
|
||||||
|
<script src="jquery-3.7.0.min.js"></script>
|
||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<table>
|
||||||
|
<tr><td class=pa3>External temperature sensor DHT22/DHT11</td><td></td></tr>
|
||||||
|
<tr><td class=pa1 align="right">Enable sensors</td><td><label class="switch"><input type="checkbox" name="extsens_en" id="extsetsid" onchange="changeValue(this.checked, 'set_bool?extsens_enable=', 'temp')"><span class="checkbox_slider round"></span></label></label> <span class=pa1 id="status_extsens"></span></td></tr>
|
||||||
|
<tr><td class="ps1">Sensor status: </td><td class="pa2" id="extsens_stat"></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td class="pa1">Temperature Unit</td><td><label for="temp_unit"></label>
|
||||||
|
<select class="select" id="temp_unitid" name="temp_unit" onchange="changeValue(this.value, 'set_int?temp_unit=', 'temp')">
|
||||||
|
<option value="0">Celsius</option>
|
||||||
|
<option value="1">Fahrenheit</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td class="pa1">Temperature</td><td class="pa2" id="ext_temp"></td></tr>
|
||||||
|
<tr><td class="pa1">Humidity</td><td class="pa2" id="ext_hum"></td></tr>
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
</body>
|
||||||
|
<script src="scripts.js"></script>
|
||||||
|
<script>
|
||||||
|
get_data("temp");
|
||||||
|
</script>
|
||||||
|
|
@ -120,6 +120,14 @@ function get_data(val) {
|
||||||
document.getElementById('mdnsid').value = obj.mdns;
|
document.getElementById('mdnsid').value = obj.mdns;
|
||||||
document.getElementById('loglevelid').value = obj.log_level;
|
document.getElementById('loglevelid').value = obj.log_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (val == "temp") {
|
||||||
|
$("#extsens_stat").text(obj.extsens_stat);
|
||||||
|
document.getElementById('extsetsid').checked = obj.extsen_en;
|
||||||
|
document.getElementById('temp_unitid').value = obj.exttemp_unit;
|
||||||
|
$("#ext_temp").text(obj.ext_temp);
|
||||||
|
$("#ext_hum").text(obj.ext_hum);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(html) {
|
error: function(html) {
|
||||||
console.log("json Timeout or error");
|
console.log("json Timeout or error");
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ echo "Generating page_system.html"
|
||||||
html_content=$(cat page_system.html | awk '{printf "%s\\n", $0}')
|
html_content=$(cat page_system.html | awk '{printf "%s\\n", $0}')
|
||||||
awk -v var="$html_content" '/^const char page_system_html\[\] PROGMEM = R"rawliteral\(/,/rawliteral";/ { if (/^const char page_system_html\[\] PROGMEM = R"rawliteral\(/) { print "const char page_system_html[] PROGMEM = R\"rawliteral(\n" var ")rawliteral\";"; next } { next } } 1' WebPage.h > temp && mv temp WebPage.h
|
awk -v var="$html_content" '/^const char page_system_html\[\] PROGMEM = R"rawliteral\(/,/rawliteral";/ { if (/^const char page_system_html\[\] PROGMEM = R"rawliteral\(/) { print "const char page_system_html[] PROGMEM = R\"rawliteral(\n" var ")rawliteral\";"; next } { next } } 1' WebPage.h > temp && mv temp WebPage.h
|
||||||
|
|
||||||
|
# Read the page_system.html file and generate the WebPage.h file
|
||||||
|
echo "Generating page_temperature.html"
|
||||||
|
html_content=$(cat page_temperature.html | awk '{printf "%s\\n", $0}')
|
||||||
|
awk -v var="$html_content" '/^const char page_temperature_html\[\] PROGMEM = R"rawliteral\(/,/rawliteral";/ { if (/^const char page_temperature_html\[\] PROGMEM = R"rawliteral\(/) { print "const char page_temperature_html[] PROGMEM = R\"rawliteral(\n" var ")rawliteral\";"; next } { next } } 1' WebPage.h > temp && mv temp WebPage.h
|
||||||
|
|
||||||
# Read the syles.css file and generate the WebPage.h file
|
# Read the syles.css file and generate the WebPage.h file
|
||||||
echo "Generating styles.css"
|
echo "Generating styles.css"
|
||||||
html_content=$(cat styles.css | awk '{printf "%s\\n", $0}')
|
html_content=$(cat styles.css | awk '{printf "%s\\n", $0}')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue