5.5.2 20170808
* Extent max number of WS2812 pixels from 256 to 512 (#667)
* Add OTA handling if server responds with no update available (#695)
* Removed undocumented command FlashMode (#696)
* Fix compile time error message due to increased message buffer size
(#703)
This commit is contained in:
arendst 2017-08-08 16:31:43 +02:00
parent 1e78eae300
commit c0b1ceba8b
6 changed files with 31 additions and 43 deletions

View File

@ -1,7 +1,7 @@
## Sonoff-Tasmota ## 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. 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.5.1** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information. Current version is **5.5.2** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.
### ATTENTION All versions ### ATTENTION All versions

View File

@ -1,4 +1,10 @@
/* 5.5.1 20170805 /* 5.5.2 20170808
* Extent max number of WS2812 pixels from 256 to 512 (#667)
* Add OTA handling if server responds with no update available (#695)
* Removed undocumented command FlashMode (#696)
* Fix compile time error message due to increased message buffer size (#703)
*
* 5.5.1 20170805
* Fix Sonoff Rf Bridge issues * Fix Sonoff Rf Bridge issues
* Add Sonoff RF Bridge MQTT messages on received and learned RF signal * Add Sonoff RF Bridge MQTT messages on received and learned RF signal
* Add command VoltRes 0|1 to select voltage resolution to 0.1 V (#654) * Add command VoltRes 0|1 to select voltage resolution to 0.1 V (#654)

View File

@ -141,33 +141,23 @@ uint32_t _cfgLocation = CFG_LOCATION;
/* /*
* Based on cores/esp8266/Updater.cpp * Based on cores/esp8266/Updater.cpp
*/ */
void setFlashMode(byte option, byte mode) void setFlashModeDout()
{ {
char log[LOGSZ];
uint8_t *_buffer; uint8_t *_buffer;
uint32_t address; uint32_t address;
// option 0 - Use absolute address 0
// option 1 - Use OTA/Upgrade relative address
if (option) {
eboot_command ebcmd; eboot_command ebcmd;
eboot_command_read(&ebcmd); eboot_command_read(&ebcmd);
address = ebcmd.args[0]; address = ebcmd.args[0];
} else {
address = 0;
}
_buffer = new uint8_t[FLASH_SECTOR_SIZE]; _buffer = new uint8_t[FLASH_SECTOR_SIZE];
if (SPI_FLASH_RESULT_OK == spi_flash_read(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE)) { if (SPI_FLASH_RESULT_OK == spi_flash_read(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE)) {
if (_buffer[2] != mode) { if (_buffer[2] != 3) { // DOUT
_buffer[2] = mode &3; _buffer[2] = 3;
noInterrupts(); noInterrupts();
if (SPI_FLASH_RESULT_OK == spi_flash_erase_sector(address / FLASH_SECTOR_SIZE)) { if (SPI_FLASH_RESULT_OK == spi_flash_erase_sector(address / FLASH_SECTOR_SIZE)) {
spi_flash_write(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE); spi_flash_write(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE);
} }
interrupts(); interrupts();
snprintf_P(log, sizeof(log), PSTR("FLSH: Set Flash Mode to %d"), (option) ? mode : ESP.getFlashChipMode());
addLog(LOG_LEVEL_DEBUG, log);
} }
} }
delete[] _buffer; delete[] _buffer;

View File

@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)" - Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/ ====================================================*/
#define VERSION 0x05050100 // 5.5.1 #define VERSION 0x05050200 // 5.5.2
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL}; 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}; enum week_t {Last, First, Second, Third, Fourth};
@ -119,7 +119,7 @@ enum emul_t {EMUL_NONE, EMUL_WEMO, EMUL_HUE, EMUL_MAX};
#define APP_POWER 0 // Default saved power state Off #define APP_POWER 0 // Default saved power state Off
#define MAX_COUNTERS 4 // Max number of counter sensors #define MAX_COUNTERS 4 // Max number of counter sensors
#define MAX_PULSETIMERS 4 // Max number of supported pulse timers #define MAX_PULSETIMERS 4 // Max number of supported pulse timers
#define WS2812_MAX_LEDS 256 // Max number of LEDs #define WS2812_MAX_LEDS 512 // Max number of LEDs
#define PWM_RANGE 1023 // 255..1023 needs to be devisible by 256 #define PWM_RANGE 1023 // 255..1023 needs to be devisible by 256
//#define PWM_FREQ 1000 // 100..1000 Hz led refresh //#define PWM_FREQ 1000 // 100..1000 Hz led refresh
@ -1282,14 +1282,6 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
} }
snprintf_P(svalue, sizeof(svalue), PSTR("{\"Sleep\":\"%d%s (%d%s)\"}"), sleep, (sysCfg.flag.value_units) ? " mS" : "", sysCfg.sleep, (sysCfg.flag.value_units) ? " mS" : ""); snprintf_P(svalue, sizeof(svalue), PSTR("{\"Sleep\":\"%d%s (%d%s)\"}"), sleep, (sysCfg.flag.value_units) ? " mS" : "", sysCfg.sleep, (sysCfg.flag.value_units) ? " mS" : "");
} }
else if (!strcmp_P(type,PSTR("FLASHMODE"))) { // 0 = QIO, 1 = QOUT, 2 = DIO, 3 = DOUT
if ((payload >= 0) && (payload <= 3)) {
if (ESP.getFlashChipMode() != payload) {
setFlashMode(0, payload &3);
}
}
snprintf_P(svalue, sizeof(svalue), PSTR("{\"FlashMode\":%d}"), ESP.getFlashChipMode());
}
else if (!strcmp_P(type,PSTR("UPGRADE")) || !strcmp_P(type,PSTR("UPLOAD"))) { else if (!strcmp_P(type,PSTR("UPGRADE")) || !strcmp_P(type,PSTR("UPLOAD"))) {
// Check if the payload is numerically 1, and had no trailing chars. // Check if the payload is numerically 1, and had no trailing chars.
// e.g. "1foo" or "1.2.3" could fool us. // e.g. "1foo" or "1.2.3" could fool us.
@ -2388,7 +2380,7 @@ void stateloop()
if (otaretry) { if (otaretry) {
// snprintf_P(log, sizeof(log), PSTR("OTA: Attempt %d"), OTA_ATTEMPTS - otaretry); // snprintf_P(log, sizeof(log), PSTR("OTA: Attempt %d"), OTA_ATTEMPTS - otaretry);
// addLog(LOG_LEVEL_INFO, log); // addLog(LOG_LEVEL_INFO, log);
otaok = (HTTP_UPDATE_OK == ESPhttpUpdate.update(sysCfg.otaUrl)); otaok = (HTTP_UPDATE_FAILED != ESPhttpUpdate.update(sysCfg.otaUrl));
if (!otaok) { if (!otaok) {
otaflag = 2; otaflag = 2;
} }
@ -2397,7 +2389,7 @@ void stateloop()
if (90 == otaflag) { // Allow MQTT to reconnect if (90 == otaflag) { // Allow MQTT to reconnect
otaflag = 0; otaflag = 0;
if (otaok) { if (otaok) {
setFlashMode(1, 3); // DOUT for both ESP8266 and ESP8285 setFlashModeDout(); // Force DOUT for both ESP8266 and ESP8285
snprintf_P(svalue, sizeof(svalue), PSTR("Successful. Restarting")); snprintf_P(svalue, sizeof(svalue), PSTR("Successful. Restarting"));
} else { } else {
snprintf_P(svalue, sizeof(svalue), PSTR("Failed %s"), ESPhttpUpdate.getLastErrorString().c_str()); snprintf_P(svalue, sizeof(svalue), PSTR("Failed %s"), ESPhttpUpdate.getLastErrorString().c_str());

View File

@ -259,18 +259,18 @@ void ws2812_clock()
ws2812_stripShow(); ws2812_stripShow();
} }
void ws2812_gradientColor(struct wsColor* mColor, uint8_t range, uint8_t gradRange, uint8_t i) void ws2812_gradientColor(struct wsColor* mColor, uint16_t range, uint16_t gradRange, uint16_t i)
{ {
/* /*
* Compute the color of a pixel at position i using a gradient of the color scheme. * Compute the color of a pixel at position i using a gradient of the color scheme.
* This function is used internally by the gradient function. * This function is used internally by the gradient function.
*/ */
ColorScheme scheme = schemes[sysCfg.ws_scheme -3]; ColorScheme scheme = schemes[sysCfg.ws_scheme -3];
uint8_t curRange = i / range; uint16_t curRange = i / range;
uint8_t rangeIndex = i % range; uint16_t rangeIndex = i % range;
uint8_t colorIndex = rangeIndex / gradRange; uint16_t colorIndex = rangeIndex / gradRange;
uint8_t start = colorIndex; uint16_t start = colorIndex;
uint8_t end = colorIndex +1; uint16_t end = colorIndex +1;
if (curRange % 2 != 0) { if (curRange % 2 != 0) {
start = (scheme.count -1) - start; start = (scheme.count -1) - start;
end = (scheme.count -1) - end; end = (scheme.count -1) - end;
@ -299,9 +299,9 @@ void ws2812_gradient()
} }
uint8_t repeat = repeatValues[sysCfg.ws_width]; // number of scheme.count per ledcount uint8_t repeat = repeatValues[sysCfg.ws_width]; // number of scheme.count per ledcount
uint8_t range = (uint8_t)ceil((float)sysCfg.ws_pixels / (float)repeat); uint16_t range = (uint16_t)ceil((float)sysCfg.ws_pixels / (float)repeat);
uint8_t gradRange = (uint8_t)ceil((float)range / (float)(scheme.count - 1)); uint16_t gradRange = (uint16_t)ceil((float)range / (float)(scheme.count - 1));
uint8_t offset = speedValues[sysCfg.ws_speed] > 0 ? stripTimerCntr / speedValues[sysCfg.ws_speed] : 0; uint16_t offset = speedValues[sysCfg.ws_speed] > 0 ? stripTimerCntr / speedValues[sysCfg.ws_speed] : 0;
wsColor oldColor, currentColor; wsColor oldColor, currentColor;
ws2812_gradientColor(&oldColor, range, gradRange, offset); ws2812_gradientColor(&oldColor, range, gradRange, offset);
@ -340,7 +340,7 @@ void ws2812_bars()
ColorScheme scheme = schemes[sysCfg.ws_scheme -3]; ColorScheme scheme = schemes[sysCfg.ws_scheme -3];
uint8_t maxSize = sysCfg.ws_pixels / scheme.count; uint16_t maxSize = sysCfg.ws_pixels / scheme.count;
if (widthValues[sysCfg.ws_width] > maxSize) { if (widthValues[sysCfg.ws_width] > maxSize) {
maxSize = 0; maxSize = 0;
} }