diff --git a/tasmota/html_compressed/HTTP_GV_PAGE.h b/tasmota/html_compressed/HTTP_GV_PAGE.h
new file mode 100644
index 000000000..8c0574ecb
--- /dev/null
+++ b/tasmota/html_compressed/HTTP_GV_PAGE.h
@@ -0,0 +1,31 @@
+/////////////////////////////////////////////////////////////////////
+// compressed by tools/unishox/compress-html-uncompressed.py
+/////////////////////////////////////////////////////////////////////
+
+const size_t HTTP_GV_PAGE_SIZE = 806;
+const char HTTP_GV_PAGE_COMPRESSED[] PROGMEM = "\x3D\x0F\xE1\x10\x98\x1D\x19\x0C\x64\x88\x51\x51\x0D\x20\x8F\xC3\xD0\x55\x0D\x08"
+ "\xFC\x3D\x05\x3B\x10\xFC\x3D\x2B\x68\x26\x7E\x1F\x5E\x47\x5A\x21\xE2\x18\x5A\x58"
+ "\x88\xCF\x58\xFB\xF9\xE8\x76\x02\x0D\x43\xD0\x75\xF9\xA1\x5F\x66\x0F\x87\xD9\xF5"
+ "\xE3\xEC\xFC\x3D\x02\xDE\x34\x5A\x21\xF0\xFB\x11\x98\xB1\x61\x51\x7A\x8C\x82\x65"
+ "\xE1\x4D\xD1\xF6\xBE\xC2\x3E\x1F\x7E\xA3\x20\x9F\x81\x06\x68\x20\xE2\x80\x8F\x89"
+ "\x0E\xCB\xF8\x80\xC1\xB1\x0F\xB0\x8F\x87\xDE\x87\x9C\x08\x75\x4C\x59\x9E\x87\x9C"
+ "\x74\xD0\xF0\xFB\x54\x64\x31\x9F\x0F\xBD\x1B\x63\xCC\xEC\x36\x1D\x7A\x1E\x71\xF6"
+ "\x7E\x1E\x9E\x0F\xFA\x32\x97\xBE\x19\xF0\xFB\x04\x19\x07\x60\xFB\x1C\x5E\xC0\xCD"
+ "\x1D\x1D\x0D\x7E\x3E\xCF\xC3\xD0\xEC\x04\x1A\x60\xA1\x83\x82\x0E\xFA\x3F\xB4\x18"
+ "\xA7\xF0\x50\xC2\xCF\xC3\x3B\xFA\xF3\xF9\x9B\xF9\x0C\xCF\xD1\xF0\xFA\x10\xF0\x67"
+ "\x7F\x5A\x30\xF8\x7D\x9F\x5E\x3E\xCF\x06\x77\xF5\xEC\x17\xF0\xD9\xF3\x98\xFA\x26"
+ "\x66\xFA\x8B\xD8\x2F\xE1\xB3\xBA\x7D\x8A\xAA\x18\x79\x9D\x87\x61\xF5\xE3\xCC\xFA"
+ "\x10\xEC\x66\x6F\xAB\xC7\xD9\xDE\x04\x1C\x3A\xC6\x8C\x0B\x78\x78\xFD\xEF\x53\xF9"
+ "\x9D\x84\x7C\x3E\xCF\xA1\x01\x07\x29\x19\xEF\xD8\xD2\xF6\x9B\x59\xF0\xFB\x3E\x84"
+ "\x44\x68\x43\x81\x06\x91\x8F\xB6\x5E\x34\x74\x18\xA2\xF0\xCB\x0C\x11\x6C\x02\x2F"
+ "\x01\x47\x60\x20\xF2\x78\x3B\x04\x32\x3F\x0F\x41\x34\xCD\x06\x15\xFB\xC7\xC3\xEC"
+ "\x7B\xFA\x21\xD6\x1E\x75\x5E\xF3\xF9\xF6\x08\x36\x34\x43\xE1\xF6\x35\xFB\xD6\x3C"
+ "\xC8\x76\x1B\x0F\xB0\x43\xC2\x01\x0A\x79\xD6\x3B\x0D\x88\x56\x88\x23\xE3\xEC\xFC"
+ "\x3D\x0E\xC1\x34\xCC\x10\x79\x9A\x7F\x04\x3C\x14\x10\x65\x1F\x60\x85\xA9\x3F\x82"
+ "\x46\x9D\xA3\x6C\x79\x82\x86\x9F\xA3\x6C\x79\x90\xFF\xEC\x60\xC7\xF0\x44\xD4\x41"
+ "\x07\x0B\x1F\x04\x2A\x2B\x47\xE1\xE9\xA3\x47\x81\x17\x99\x82\xD1\xB6\x3C\xCF\xB0"
+ "\x41\xE4\x3C\xFB\x56\x15\x1F\x0F\xB2\x1D\x97\xF1\x10\x20\xD5\x04\x6C\xDF\x84\xD0"
+ "\xEE\xB3\xFE\x04\x4E\x03\xC1\x06\x10\x23\xC8\x3B\x01\x07\x87\xA3\xB0\x55\x0D\x08"
+ "\xFC";
+
+#define HTTP_GV_PAGE Decompress(HTTP_GV_PAGE_COMPRESSED,HTTP_GV_PAGE_SIZE).c_str()
\ No newline at end of file
diff --git a/tasmota/html_uncompressed/HTTP_GV_PAGE.h b/tasmota/html_uncompressed/HTTP_GV_PAGE.h
new file mode 100644
index 000000000..4b95ab8bb
--- /dev/null
+++ b/tasmota/html_uncompressed/HTTP_GV_PAGE.h
@@ -0,0 +1,33 @@
+const char HTTP_GV_PAGE[] PROGMEM =
+ ""
+ ""
+ "
"
+ "%s - GPIO Viewer" // SettingsTextEscaped(SET_DEVICENAME).c_str()
+ "" // GV_BASE_URL
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ "
"
+ ""
+ "
"
+ "
"
+ "
"
+ "
"
+ "
"
+ "
"
+ "
"
+ ""
+ "";
\ No newline at end of file
diff --git a/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino b/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino
index 2685acfe9..1ea345d95 100644
--- a/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino
+++ b/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino
@@ -29,57 +29,27 @@
//#define GV_BASE_URL "https://thelastoutpostworkshop.github.io/microcontroller_devkit/gpio_viewer/assets/"
#ifdef ESP8266
#ifndef GV_BASE_URL
-#undef GV_BASE_URL // Fix compiler warning
+#undef GV_BASE_URL // Fix compiler warning
#define GV_BASE_URL "https://ota.tasmota.com/tasmota/gpio_viewer/assets/"
#endif
#endif // ESP8266
#ifdef ESP32
#ifndef GV_BASE_URL
-#undef GV_BASE_URL // Fix compiler warning
+#undef GV_BASE_URL // Fix compiler warning
#define GV_BASE_URL "https://ota.tasmota.com/tasmota32/gpio_viewer/assets/"
#endif
#endif // ESP32
const char *GVRelease = "1.0.7";
-const char HTTP_GV_PAGE[] PROGMEM =
- ""
- ""
- ""
- "%s - GPIO Viewer"
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- "
"
- ""
- // Image
- "
"
- "
"
- "
"
- "
"
- "
"
- "
"
- "
"
- ""
- "";
+#ifdef USE_UNISHOX_COMPRESSION
+ #include "./html_compressed/HTTP_GV_PAGE.h"
+#else
+ #include "./html_uncompressed/HTTP_GV_PAGE.h"
+#endif
const char HTTP_GV_EVENT[] PROGMEM =
+ // Set CORS headers for global responses
"HTTP/1.1 200 OK\n"
"Content-Type: text/event-stream;\n"
"Connection: keep-alive\n"
@@ -121,9 +91,9 @@ void GVBegin(void) {
GV.WebServer = new ESP8266WebServer(GV_PORT);
// Set CORS headers for global responses
- GV.WebServer->sendHeader("Access-Control-Allow-Origin", "*");
- GV.WebServer->sendHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
- GV.WebServer->sendHeader("Access-Control-Allow-Headers", "Content-Type");
+// GV.WebServer->sendHeader(F("Access-Control-Allow-Origin"), F("*"));
+// GV.WebServer->sendHeader(F("Access-Control-Allow-Methods"), F("GET, POST, OPTIONS"));
+// GV.WebServer->sendHeader(F("Access-Control-Allow-Headers"), F("Content-Type"));
GV.WebServer->on("/", GVHandleRoot);
GV.WebServer->on("/release", GVHandleRelease);
GV.WebServer->on("/free_psram", GVHandleFreePSRam);
@@ -138,11 +108,15 @@ void GVHandleRoot(void) {
char* content = ext_snprintf_malloc_P(HTTP_GV_PAGE,
SettingsTextEscaped(SET_DEVICENAME).c_str(),
+ GV_BASE_URL,
+ GV_PORT,
WiFi.localIP().toString().c_str(),
- WiFi.localIP().toString().c_str(),
+ WiFi.localIP().toString().c_str(), GV_PORT,
GV.sampling,
#ifdef ESP32
ESP.getPsramSize() / 1024,
+#else
+ 0,
#endif // ESP32
ESP_getFreeSketchSpace() / 1024);
if (content == nullptr) { return; } // Avoid crash
@@ -185,12 +159,12 @@ void GVEventDisconnected(void) {
if (GV.sse_ready) {
AddLog(LOG_LEVEL_DEBUG, PSTR("IOV: Disconnected"));
}
- GV.sse_ready = false; // This just stops the event to be restarted by opening root page again
+ GV.sse_ready = false; // This just stops the event to be restarted by opening root page again
GV.ticker.detach();
}
void GVCloseEvent(void) {
- GVEventSend("{}", "close", millis()); // Closes window
+ GVEventSend("{}", "close", millis()); // Closes web page
GVEventDisconnected();
}
@@ -229,7 +203,7 @@ void GVMonitorTask(void) {
if (pwm_resolution > 0) {
pintype = GV_PWMPin;
originalValue = ledcRead2(pin);
- currentState = changeUIntScale(originalValue, 0, pwm_resolution, 0, 255); // bring back to 0..255
+ currentState = changeUIntScale(originalValue, 0, pwm_resolution, 0, 255); // Bring back to 0..255
}
#endif // ESP32
@@ -239,7 +213,7 @@ void GVMonitorTask(void) {
if (pwm_value > -1) {
pintype = GV_PWMPin;
originalValue = pwm_value;
- currentState = changeUIntScale(originalValue, 0, Settings->pwm_range, 0, 255); // bring back to 0..255
+ currentState = changeUIntScale(originalValue, 0, Settings->pwm_range, 0, 255); // Bring back to 0..255
}
#endif // ESP8266
@@ -251,12 +225,12 @@ void GVMonitorTask(void) {
originalValue = AdcRead(pin, 2);
#endif // ESP32
#ifdef ESP8266
- // Fix exception 9 if using ticker - GV.sampling != 100 (CallChain: (phy)pm_wakeup_init, (adc)test_tout, ets_timer_arm_new, delay, AdcRead, String6concat, MonitorTask)
+ // Fix exception 9 if using ticker - GV.sampling != 100 caused by delay(1) in AdcRead() (CallChain: (phy)pm_wakeup_init, (adc)test_tout, ets_timer_arm_new, delay, AdcRead, String6concat, MonitorTask)
originalValue = (GV.sampling != 100) ? analogRead(pin) : AdcRead(pin, 1);
#endif // ESP8266
*/
originalValue = AdcRead1(pin);
- currentState = changeUIntScale(originalValue, 0, AdcRange(), 0, 255); // bring back to 0..255
+ currentState = changeUIntScale(originalValue, 0, AdcRange(), 0, 255); // Bring back to 0..255
}
else {
// Read digital GPIO
@@ -284,6 +258,7 @@ void GVMonitorTask(void) {
uint32_t heap = ESP_getFreeHeap();
if (heap != GV.freeHeap) {
+ // Send freeHeap
GV.freeHeap = heap;
char temp[20];
snprintf_P(temp, sizeof(temp), PSTR("%d KB"), heap / 1024);
@@ -293,6 +268,7 @@ void GVMonitorTask(void) {
#ifdef ESP32
if (UsePSRAM()) {
+ // Send freePsram
uint32_t psram = ESP.getFreePsram();
if (psram != GV.freePSRAM) {
GV.freePSRAM = psram;
@@ -305,6 +281,7 @@ void GVMonitorTask(void) {
#endif // ESP32
if (!hasChanges) {
+ // Send freeHeap as keepAlive
uint32_t last_sent = millis() - GV.lastSentWithNoActivity;
if (last_sent > GV_KEEP_ALIVE) {
// No activity, resending for pulse
diff --git a/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino b/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino
index 7c4d4c75e..c60b4e885 100644
--- a/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino
+++ b/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino
@@ -356,10 +356,17 @@ uint16_t AdcRead(uint32_t pin, uint32_t factor) {
uint32_t samples = 1 << factor;
uint32_t analog = 0;
for (uint32_t i = 0; i < samples; i++) {
- analog += AdcRead1(pin);
+#ifdef ESP32
+ analog += analogReadMilliVolts(pin); // get the value corrected by calibrated values from the eFuses
+#else
+ analog += analogRead(pin);
+#endif
delay(1);
}
analog >>= factor;
+#ifdef ESP32
+ analog = analog/(ANALOG_V33*1000) * ANALOG_RANGE; // go back from mV to ADC
+#endif
return analog;
}