Skip to content

Commit

Permalink
v5.1.6
Browse files Browse the repository at this point in the history
5.1.6 20170606
* Shrink code
* Removed online configuration of Domoticz In and Domoticz Out MQTT
strings
* Removed commands DomoticzInTopic and DomoticzOutTopic
* Add define KEY_HOLD_TIME to configure button hold threshold before
sending MQTT Hold message
* Add command StateText4 to configure button MQTT Hold text (=
MQTT_CMND_HOLD)
* Add command SetOption11 0|1 to swap pushbutton single and double press
functionality (#200)
* Add command SwitchMode<x> 5 (PUSHBUTTONHOLD) and 6
(PUSHBUTTONHOLD_INV) (#489)
  • Loading branch information
arendst committed Jun 6, 2017
1 parent 0f103db commit 98d06e8
Show file tree
Hide file tree
Showing 10 changed files with 251 additions and 207 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.5** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.
Current version is **5.1.6** - 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
13 changes: 11 additions & 2 deletions sonoff/_releasenotes.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/* 5.1.5 20170604
/* 5.1.6 20170606
* Shrink code
* Removed online configuration of Domoticz In and Domoticz Out MQTT strings
* Removed commands DomoticzInTopic and DomoticzOutTopic
* Add define KEY_HOLD_TIME to configure button hold threshold before sending MQTT Hold message
* Add command StateText4 to configure button MQTT Hold text (= MQTT_CMND_HOLD)
* Add command SetOption11 0|1 to swap pushbutton single and double press functionality (#200)
* Add command SwitchMode<x> 5 (PUSHBUTTONHOLD) and 6 (PUSHBUTTONHOLD_INV) (#489)
*
* 5.1.5 20170604
* Shrink code in preparation to ESP8266-Arduino 2.4.0-rc1
* Add effect parameter to HUE Device (#464)
*
Expand All @@ -14,7 +23,7 @@
* 5.1.2 20170519
* Fix Counter/Timer JSON message and update Counter/Timer on webpage
* Fix WS2812 Domoticz related regression issues
*
*
* 5.1.1 20170517
* Allow command FullTopic in group mode
* Prepare for more use of RTC memory
Expand Down
49 changes: 25 additions & 24 deletions sonoff/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
uint32_t data; // Allow bit manipulation using SetOption
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
uint32_t data; // Allow bit manipulation using SetOption
struct {
uint32_t savestate : 1; // bit 0
uint32_t button_restrict : 1; // bit 1
uint32_t value_units : 1; // bit 2
uint32_t savestate : 1; // bit 0
uint32_t button_restrict : 1; // bit 1
uint32_t value_units : 1; // bit 2
uint32_t mqtt_enabled : 1;
uint32_t mqtt_response : 1; // bit 4
uint32_t mqtt_response : 1; // bit 4
uint32_t mqtt_power_retain : 1;
uint32_t mqtt_button_retain : 1;
uint32_t mqtt_switch_retain : 1;
uint32_t temperature_conversion : 1; // bit 8
uint32_t temperature_conversion : 1; // bit 8
uint32_t mqtt_sensor_retain : 1;
uint32_t mqtt_offline : 1; // bit 10
uint32_t spare11 : 1;
uint32_t mqtt_offline : 1; // bit 10
uint32_t button_swap : 1; // bit 11 (v5.1.6)
uint32_t spare12 : 1;
uint32_t spare13 : 1;
uint32_t spare14 : 1;
Expand All @@ -54,15 +54,15 @@ struct SYSCFG {
unsigned long saveFlag;
unsigned long version;
unsigned long bootcount;
sysBitfield flag; // Add flag since 5.0.2
sysBitfield flag; // Add flag since 5.0.2
int16_t savedata;

int8_t timezone;
char otaUrl[101];

char mqtt_prefix[3][11]; // was ex_friendlyname[33] until 3.2.5
char mqtt_prefix[3][11]; // was ex_friendlyname[33] until 3.2.5

byte serial_enable; // Not used (ever)
byte serial_enable; // Not used (ever)
byte seriallog_level;
uint8_t sta_config;
byte sta_active;
Expand All @@ -84,19 +84,20 @@ struct SYSCFG {
char mqtt_topic[33];
char button_topic[33];
char mqtt_grptopic[33];
char state_text[3][11]; // was ex_mqtt_subtopic[33] until 4.1.1
byte ex_mqtt_button_retain; // Not used since 5.0.2
byte ex_mqtt_power_retain; // Not used since 5.0.2
byte ex_value_units; // Not used since 5.0.2
byte ex_button_restrict; // Not used since 5.0.2
char ex_state_text[3][11]; // was state_text until 5.1.6, was ex_mqtt_subtopic[33] until 4.1.1
byte ex_mqtt_button_retain; // Not used since 5.0.2
byte ex_mqtt_power_retain; // Not used since 5.0.2
byte ex_value_units; // Not used since 5.0.2
byte ex_button_restrict; // Not used since 5.0.2
uint16_t tele_period;

uint8_t power;
uint8_t ledstate;
uint8_t ex_switchmode; // Not used since 3.9.21
uint8_t ex_switchmode; // Not used since 3.9.21

char domoticz_in_topic[33];
char domoticz_out_topic[33];
char ex_domoticz_in_topic[22]; // Not used since 5.1.6
char state_text[4][11]; // was domoticz_out_topic until 5.1.6

uint16_t domoticz_update_timer;
unsigned long domoticz_relay_idx[4];
unsigned long domoticz_key_idx[4];
Expand All @@ -123,7 +124,7 @@ struct SYSCFG {
uint16_t hlw_mkwhs; // MaxEnergyStart

// 3.0.6
uint16_t mqtt_retry; // was ex_pulsetime until 4.0.4
uint16_t mqtt_retry; // was ex_pulsetime until 4.0.4

// 3.1.1
uint8_t poweronstate;
Expand All @@ -150,8 +151,8 @@ struct SYSCFG {

// 3.2.8
char switch_topic[33];
byte ex_mqtt_switch_retain; // Not used since 5.0.2
uint8_t ex_mqtt_enabled; // Not used since 5.0.2
byte ex_mqtt_switch_retain; // Not used since 5.0.2
uint8_t ex_mqtt_enabled; // Not used since 5.0.2

// 3.2.12
uint8_t sleep;
Expand All @@ -172,7 +173,7 @@ struct SYSCFG {
uint16_t led_wakeup;

// 3.9.7
uint8_t ex_emulation; // Not used since 5.0.2
uint8_t ex_emulation; // Not used since 5.0.2

// 3.9.20
char web_password[33];
Expand Down
10 changes: 7 additions & 3 deletions sonoff/settings.ino
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ void CFG_DefaultSet2()
sysCfg.blinkcount = APP_BLINKCOUNT;
sysCfg.sleep = APP_SLEEP;

strlcpy(sysCfg.domoticz_in_topic, DOMOTICZ_IN_TOPIC, sizeof(sysCfg.domoticz_in_topic));
strlcpy(sysCfg.domoticz_out_topic, DOMOTICZ_OUT_TOPIC, sizeof(sysCfg.domoticz_out_topic));
sysCfg.domoticz_update_timer = DOMOTICZ_UPDATE_TIMER;
for (byte i = 0; i < 4; i++) {
sysCfg.switchmode[i] = SWITCH_MODE;
Expand Down Expand Up @@ -443,7 +441,7 @@ void CFG_DefaultSet2()
// 4.0.9
CFG_DefaultSet_4_0_9();

// 4.1.1
// 4.1.1 + 5.1.6
CFG_DefaultSet_4_1_1();

// 5.0.2
Expand Down Expand Up @@ -540,6 +538,7 @@ void CFG_DefaultSet_4_1_1()
strlcpy(sysCfg.state_text[0], MQTT_STATUS_OFF, sizeof(sysCfg.state_text[0]));
strlcpy(sysCfg.state_text[1], MQTT_STATUS_ON, sizeof(sysCfg.state_text[1]));
strlcpy(sysCfg.state_text[2], MQTT_CMND_TOGGLE, sizeof(sysCfg.state_text[2]));
strlcpy(sysCfg.state_text[3], MQTT_CMND_HOLD, sizeof(sysCfg.state_text[3])); // v5.1.6
}

void CFG_DefaultSet_5_0_2()
Expand Down Expand Up @@ -647,6 +646,11 @@ void CFG_Delta()
rtcMem.pCounter[i] = 0;
}
}
if (sysCfg.version < 0x05010600) {
memcpy(sysCfg.state_text, sysCfg.ex_state_text, 33);
strlcpy(sysCfg.state_text[3], MQTT_CMND_HOLD, sizeof(sysCfg.state_text[3]));
}

sysCfg.version = VERSION;
}
}
Expand Down
Loading

0 comments on commit 98d06e8

Please sign in to comment.