Skip to content

Commit

Permalink
v5.1.5
Browse files Browse the repository at this point in the history
5.1.5 20170604
* Shrink code in preparation to ESP8266-Arduino 2.4.0-rc1
* Add effect parameter to HUE Device (#464)
  • Loading branch information
arendst committed Jun 4, 2017
1 parent 9e2159c commit 0f103db
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Sonoff-Tasmota
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.

Current version is **5.1.4** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.
Current version is **5.1.5** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.

### **** ATTENTION Version 5.x.x specific information ****

Expand Down
8 changes: 6 additions & 2 deletions sonoff/_releasenotes.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* 5.1.4 20170601
/* 5.1.5 20170604
* Shrink code in preparation to ESP8266-Arduino 2.4.0-rc1
* Add effect parameter to HUE Device (#464)
*
* 5.1.4 20170601
* Removed pre-compiled versions from repository as they are available within the release
* Changed HUE Device type to color supporting version (#464)
* Fix compile error when BE_MINIMAL is selected (#467, #476)
* Add multiple compiled versions to release using updated Travis script and platformio.ini (#467)
*
*
* 5.1.3 20170520
* Add Domoticz Counter
*
Expand Down
3 changes: 2 additions & 1 deletion sonoff/sonoff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- Select IDE Tools - Flash size: "1M (no SPIFFS)"
====================================================*/

#define VERSION 0x05010400 // 5.1.4
#define VERSION 0x05010500 // 5.1.5

enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
enum week_t {Last, First, Second, Third, Fourth};
Expand Down Expand Up @@ -165,6 +165,7 @@ enum butt_t {PRESSED, NOT_PRESSED};
#include <ESP8266WiFi.h> // MQTT, Ota, WifiManager
#include <ESP8266HTTPClient.h> // MQTT, Ota
#include <ESP8266httpUpdate.h> // Ota
#include <StreamString.h> // Webserver, Updater
#include <ArduinoJson.h> // WemoHue, IRremote, Domoticz
#ifdef USE_WEBSERVER
#include <ESP8266WebServer.h> // WifiManager, Webserver
Expand Down
68 changes: 25 additions & 43 deletions sonoff/webserver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const char HTTP_HEAD[] PROGMEM =
"td{padding:0px;}"
"button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;-webkit-transition-duration:0.4s;transition-duration:0.4s;}"
"button:hover{background-color:#006cba;}"
".q{float:right;width:200px;text-align:right;}"
"</style>"

"</head>"
Expand Down Expand Up @@ -131,12 +132,6 @@ const char HTTP_SCRIPT_MODULE[] PROGMEM =
"}"
"function sl(){"
"var o0=\"";
const char HTTP_LNK_STYLE[] PROGMEM =
".q{float:right;width:64px;text-align:right;}"
".l{background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAALVBMVEX///8EBwfBwsLw8PAzNjaCg4NTVVUjJiZDRUUUFxdiZGSho6O"
"Sk5Pg4eFydHTCjaf3AAAAZElEQVQ4je2NSw7AIAhEBamKn97/uMXEGBvozkWb9C2Zx4xzWykBhFAeYp9gkLyZE0zIMno9n4g19hmdY39scwqVkOXaxph0ZCXQcqxSpgQpONa59wkRDOL93eA"
"XvimwlbPbwwVAegLS1HGfZAAAAABJRU5ErkJggg==') no-repeat left center;background-size:1em;}"
"</style>";
const char HTTP_MSG_RSTRT[] PROGMEM =
"<br/><div style='text-align:center;'>Device will restart in a few seconds</div><br/>";
const char HTTP_BTN_MENU1[] PROGMEM =
Expand Down Expand Up @@ -170,7 +165,7 @@ const char HTTP_FORM_MODULE[] PROGMEM =
"<input id='w' name='w' value='6' hidden><input id='r' name='r' value='1' hidden>"
"<br/><b>Module type</b> ({mt})<br/><select id='mt' name='mt'>";
const char HTTP_LNK_ITEM[] PROGMEM =
"<div><a href='#p' onclick='c(this)'>{v}</a>&nbsp;<span class='q {i}'>{r}%</span></div>";
"<div><a href='#p' onclick='c(this)'>{v}</a>&nbsp;<span class='q'>{i} {r}%</span></div>";
const char HTTP_LNK_SCAN[] PROGMEM =
"<div><a href='/w1'>Scan for wifi networks</a></div><br/>";
const char HTTP_FORM_WIFI[] PROGMEM =
Expand Down Expand Up @@ -214,11 +209,10 @@ const char HTTP_FORM_OTHER[] PROGMEM =
const char HTTP_FORM_OTHER2[] PROGMEM =
"<br/><b>Friendly Name {1</b> ({2)<br/><input id='a{1' name='a{1' length=32 placeholder='{2' value='{3'><br/>";
#ifdef USE_EMULATION
const char HTTP_FORM_OTHER3[] PROGMEM =
"<br/><fieldset><legend><b>&nbsp;Emulation&nbsp;</b></legend>"
"<br/><input style='width:10%;float:left' id='b2' name='b2' type='radio' value='0'{r2}><b>None</b>"
"<br/><input style='width:10%;float:left' id='b2' name='b2' type='radio' value='1'{r3}><b>Belkin WeMo</b> single device"
"<br/><input style='width:10%;float:left' id='b2' name='b2' type='radio' value='2'{r4}><b>Hue Bridge</b> multi devices<br/>";
const char HTTP_FORM_OTHER3a[] PROGMEM =
"<br/><fieldset><legend><b>&nbsp;Emulation&nbsp;</b></legend>";
const char HTTP_FORM_OTHER3b[] PROGMEM =
"<br/><input style='width:10%;float:left' id='b2' name='b2' type='radio' value='{1'{2><b>{3</b>{4";
#endif // USE_EMULATION
const char HTTP_FORM_END[] PROGMEM =
"<br/><button type='submit'>Save</button></form></fieldset>";
Expand Down Expand Up @@ -668,7 +662,6 @@ void handleWifi(boolean scan)

String page = FPSTR(HTTP_HEAD);
page.replace(F("{v}"), F("Configure Wifi"));
page.replace(F("</style>"), FPSTR(HTTP_LNK_STYLE));

if (scan) {
#ifdef USE_EMULATION
Expand Down Expand Up @@ -729,11 +722,8 @@ void handleWifi(boolean scan)
rssiQ += quality;
item.replace(F("{v}"), WiFi.SSID(indices[i]));
item.replace(F("{r}"), rssiQ);
if (WiFi.encryptionType(indices[i]) != ENC_TYPE_NONE) {
item.replace(F("{i}"), F("l"));
} else {
item.replace(F("{i}"), "");
}
uint8_t auth = WiFi.encryptionType(indices[i]);
item.replace(F("{i}"), (ENC_TYPE_WEP == auth) ? F("WEP") : (ENC_TYPE_TKIP == auth) ? F("WPA PSK") : (ENC_TYPE_CCMP == auth) ? F("WPA2 PSK") : (ENC_TYPE_AUTO == auth) ? F("AUTO") : F(""));
page += item;
delay(0);
} else {
Expand Down Expand Up @@ -853,10 +843,15 @@ void handleOther()
page.replace(F("{2"), FRIENDLY_NAME);
page.replace(F("{3"), sysCfg.friendlyname[0]);
#ifdef USE_EMULATION
page += FPSTR(HTTP_FORM_OTHER3);
page.replace(F("{r2}"), (EMUL_NONE == sysCfg.flag.emulation) ? F(" checked") : F(""));
page.replace(F("{r3}"), (EMUL_WEMO == sysCfg.flag.emulation) ? F(" checked") : F(""));
page.replace(F("{r4}"), (EMUL_HUE == sysCfg.flag.emulation) ? F(" checked") : F(""));
page += FPSTR(HTTP_FORM_OTHER3a);
for (byte i = 0; i < EMUL_MAX; i++) {
page += FPSTR(HTTP_FORM_OTHER3b);
page.replace(F("{1"), String(i));
page.replace(F("{2"), (i == sysCfg.flag.emulation) ? F(" checked") : F(""));
page.replace(F("{3"), (i == EMUL_NONE) ? F("None") : (i == EMUL_WEMO) ? F("Belkin WeMo") : F("Hue Bridge"));
page.replace(F("{4"), (i == EMUL_NONE) ? F("") : (i == EMUL_WEMO) ? F(" single device") : F(" multi devices"));
}
page += F("<br/>");
for (int i = 1; i < Maxdevice; i++) {
page += FPSTR(HTTP_FORM_OTHER2);
page.replace(F("{1"), String(i +1));
Expand Down Expand Up @@ -1131,25 +1126,21 @@ void handleUploadDone()
page += F("<div style='text-align:center;'><b>Upload ");
if (_uploaderror) {
page += F("<font color='red'>failed</font></b><br/><br/>");
if (!_uploadfiletype && Update.hasError()) {
StreamString str;
Update.printError(str);
snprintf_P(error, sizeof(error), str.c_str());
} else {
snprintf_P(error, sizeof(error), PSTR("Upload error code %d"), _uploaderror);
}
switch (_uploaderror) {
case 1: strcpy_P(error, PSTR("No file selected")); break;
case 2: strcpy_P(error, PSTR("File size is larger than available free space")); break;
case 3: strcpy_P(error, PSTR("File magic header does not start with 0xE9")); break;
case 4: strcpy_P(error, PSTR("File flash size is larger than device flash size")); break;
case 5: strcpy_P(error, PSTR("File upload buffer miscompare")); break;
case 6: strcpy_P(error, PSTR("Upload failed. Enable logging option 3 for more information")); break;
case 7: strcpy_P(error, PSTR("Upload aborted")); break;
case 8: strcpy_P(error, PSTR("Invalid configuration file")); break;
case 9: strcpy_P(error, PSTR("Configuration file too large")); break;
default:
snprintf_P(error, sizeof(error), PSTR("Upload error code %d"), _uploaderror);
}
page += error;
if (!_uploadfiletype && Update.hasError()) {
page += F("<br/><br/>Update error code (see Updater.cpp) ");
page += String(Update.getError());
}
snprintf_P(log, sizeof(log), PSTR("Upload: Error - %s"), error);
snprintf_P(log, sizeof(log), PSTR("Upload: %s"), error);
addLog(LOG_LEVEL_DEBUG, log);
} else {
page += F("<font color='green'>successful</font></b><br/><br/>Device will restart in a few seconds");
Expand Down Expand Up @@ -1196,9 +1187,6 @@ void handleUploadLoop()
}
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
if (!Update.begin(maxSketchSpace)) { //start with max available size
if (_serialoutput) {
Update.printError(Serial);
}
_uploaderror = 2;
return;
}
Expand Down Expand Up @@ -1244,9 +1232,6 @@ void handleUploadLoop()
}
} else { // firmware
if (!_uploaderror && (Update.write(upload.buf, upload.currentSize) != upload.currentSize)) {
if (_serialoutput) {
Update.printError(Serial);
}
_uploaderror = 5;
return;
}
Expand All @@ -1264,9 +1249,6 @@ void handleUploadLoop()
}
if (!_uploadfiletype) {
if (!Update.end(true)) { // true to set the size to the current progress
if (_serialoutput) {
Update.printError(Serial);
}
_uploaderror = 6;
return;
}
Expand Down
1 change: 1 addition & 0 deletions sonoff/xdrv_wemohue.ino
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ const char HUE_LIGHT_STATUS_JSON[] PROGMEM =
"\"ct\":500,"
"\"xy\":[0.5, 0.5],"
"\"alert\":\"none\","
"\"effect\":\"none\","
"\"colormode\":\"hs\","
"\"reachable\":true"
"},"
Expand Down

0 comments on commit 0f103db

Please sign in to comment.