mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Bump version to 7.1.2.6
- Change some more Settings locations freeing up space for future single char allowing variable length text - Add Zigbee support for Xiaomi Aqara Vibration Sensor and Presence Sensor by Stefan Hadinger - Add Shutter functions ramp up/down and MQTT reporting by Stefan Bode
This commit is contained in:
parent
e548e74256
commit
3d59de5d1d
@ -47,7 +47,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
||||
|
||||
## Changelog
|
||||
|
||||
### Version 7.1.2.5
|
||||
### Version 7.1.2.6
|
||||
|
||||
- Change Exception reporting removing exception details from ``Status 1`` and consolidated in ``Status 12`` if available
|
||||
- Change HTTP CORS from command ``SetOption73 0/1`` to ``Cors <cors_domain>`` allowing user control of specific CORS domain by Shantur Rathore (#7066)
|
||||
@ -69,3 +69,5 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
||||
- Add Wifi Signal Strength in dBm in addition to RSSI Wifi Experience by Andreas Schultz (#7145)
|
||||
- Add Yaw, Pitch and Roll support for MPU6050 by Philip Barclay (#7058)
|
||||
- Add reporting of raw weight to JSON from HX711 to overcome auto-tare functionality by @tobox (#7171)
|
||||
- Add Zigbee support for Xiaomi Aqara Vibration Sensor and Presence Sensor by Stefan Hadinger
|
||||
- Add Shutter functions ramp up/down and MQTT reporting by Stefan Bode
|
||||
|
@ -1,9 +1,14 @@
|
||||
## Unreleased (development)
|
||||
|
||||
### 7.1.2.6 20191214
|
||||
|
||||
- Change some more Settings locations freeing up space for future single char allowing variable length text
|
||||
|
||||
### 7.1.2.5 20191213
|
||||
|
||||
- Change some Settings locations freeing up space for future single char allowing variable length text
|
||||
- Add Zigbee support for Xiaomi Aqara Vibration Sensor and Presence Sensor
|
||||
- Add Zigbee support for Xiaomi Aqara Vibration Sensor and Presence Sensor by Stefan Hadinger
|
||||
- Add Shutter functions ramp up/down and MQTT reporting by Stefan Bode
|
||||
|
||||
### 7.1.2.4 20191209
|
||||
|
||||
|
@ -249,7 +249,7 @@ struct SYSCFG {
|
||||
int16_t save_data; // 014
|
||||
int8_t timezone; // 016
|
||||
|
||||
// Start of single char array
|
||||
// Start of single char array Settings.text
|
||||
|
||||
char ota_url[101]; // 017
|
||||
char mqtt_prefix[3][11]; // 07C
|
||||
@ -272,18 +272,21 @@ struct SYSCFG {
|
||||
uint8_t ex_mqtt_fingerprint[2][20]; // 1AD
|
||||
uint8_t ex_adc_param_type; // 1D5
|
||||
|
||||
uint8_t free_1d6[10]; // 1D6
|
||||
uint8_t ex_free_1d6[10]; // 1D6
|
||||
|
||||
// End of single char array of 446 chars max (phase 3)
|
||||
// End of single char array of 456 chars max (phase 3)
|
||||
|
||||
SysBitfield4 ex_flag4; // 1E0
|
||||
uint8_t ex_serial_config; // 1E4
|
||||
uint8_t ex_wifi_output_power; // 1E5
|
||||
uint8_t ex_shutter_accuracy; // 1E6
|
||||
uint8_t ex_mqttlog_level; // 1E7
|
||||
uint8_t ex_sps30_inuse_hours; // 1E8
|
||||
|
||||
SysBitfield4 flag4; // 1E0
|
||||
uint8_t serial_config; // 1E4
|
||||
uint8_t wifi_output_power; // 1E5
|
||||
uint8_t shutter_accuracy; // 1E6
|
||||
uint8_t mqttlog_level; // 1E7
|
||||
uint8_t sps30_inuse_hours; // 1E8
|
||||
char mqtt_host[33]; // 1E9 - Keep together with below as being copied as one chunck with reset 6
|
||||
uint16_t mqtt_port; // 20A - Keep together
|
||||
|
||||
uint16_t ex_mqtt_port; // 20A - Keep together
|
||||
|
||||
char mqtt_client[33]; // 20C - Keep together
|
||||
char mqtt_user[33]; // 22D - Keep together
|
||||
char mqtt_pwd[33]; // 24E - Keep together
|
||||
@ -459,8 +462,15 @@ struct SYSCFG {
|
||||
uint8_t weblog_level; // ECE
|
||||
uint8_t mqtt_fingerprint[2][20]; // ECF
|
||||
uint8_t adc_param_type; // EF7
|
||||
SysBitfield4 flag4; // EF8
|
||||
uint16_t mqtt_port; // EFC
|
||||
uint8_t serial_config; // EFE
|
||||
uint8_t wifi_output_power; // EFF
|
||||
uint8_t shutter_accuracy; // F00
|
||||
uint8_t mqttlog_level; // F01
|
||||
uint8_t sps30_inuse_hours; // F02
|
||||
|
||||
uint8_t free_ef8[244]; // EF8
|
||||
uint8_t free_f03[233]; // F03
|
||||
|
||||
uint32_t i2c_drivers[3]; // FEC I2cDriver
|
||||
uint32_t cfg_timestamp; // FF8
|
||||
|
@ -443,132 +443,66 @@ void UpdateQuickPowerCycle(bool update)
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Config single char array support
|
||||
* Config Settings.text char array support
|
||||
\*********************************************************************************************/
|
||||
|
||||
enum CharsIndex { SET_OTAURL,
|
||||
SET_MQTTPREFIX1, SET_MQTTPREFIX2, SET_MQTTPREFIX3,
|
||||
// SET_STASSID1, SET_STASSID2,
|
||||
// SET_STAPWD1, SET_STAPWD2, SET_WEBPWD,
|
||||
// SET_HOSTNAME, SET_SYSLOG_HOST,
|
||||
// SET_MQTT_HOST, SET_MQTT_CLIENT,
|
||||
// SET_MQTT_USER, SET_MQTT_PWD,
|
||||
// SET_MQTT_FULLTOPIC, SET_MQTT_TOPIC,
|
||||
// SET_MQTT_BUTTON_TOPIC, SET_MQTT_SWITCH_TOPIC, SET_MQTT_GRP_TOPIC,
|
||||
// SET_STATE_TXT1, SET_STATE_TXT2, SET_STATE_TXT3, SET_STATE_TXT4,
|
||||
// SET_FRIENDLYNAME1, SET_FRIENDLYNAME2, SET_FRIENDLYNAME3, SET_FRIENDLYNAME4,
|
||||
const uint32_t settings_text_size = 457; // Settings.flag4 (1E0) - Settings.ota_url (017)
|
||||
|
||||
// SET_FRIENDLYNAME5, SET_FRIENDLYNAME6, SET_FRIENDLYNAME7, SET_FRIENDLYNAME8, // Future extension
|
||||
|
||||
// SET_NTPSERVER1, SET_NTPSERVER2, SET_NTPSERVER3,
|
||||
// SET_MEM1, SET_MEM2, SET_MEM3, SET_MEM4, SET_MEM5,
|
||||
// SET_CORS,
|
||||
|
||||
// SET_BUTTON1, SET_BUTTON2, SET_BUTTON3, SET_BUTTON4, // Future extension
|
||||
// SET_BUTTON5, SET_BUTTON6, SET_BUTTON7, SET_BUTTON8, // Future extension
|
||||
// SET_BUTTON9, SET_BUTTON10, SET_BUTTON11, SET_BUTTON12, // Future extension
|
||||
// SET_BUTTON13, SET_BUTTON14, SET_BUTTON15, SET_BUTTON16, // Future extension
|
||||
|
||||
SET_MAX };
|
||||
|
||||
const uint32_t settings_loc_num = 1; // First phase only ota_url and mqtt_prefix
|
||||
const uint32_t settings_max_size = 134;
|
||||
|
||||
char settings_fullstr[settings_max_size] = { 0 };
|
||||
|
||||
struct LOCATIONS {
|
||||
char* address;
|
||||
uint32_t size = 0;
|
||||
} Location[settings_loc_num];
|
||||
|
||||
void SettingsInitText(void)
|
||||
uint32_t GetSettingsTextLen(void)
|
||||
{
|
||||
for (uint32_t i = 0; i < settings_loc_num; i++) {
|
||||
if (0 == i) {
|
||||
Location[i].address = Settings.ota_url;
|
||||
Location[i].size = sizeof(Settings.ota_url) + (3 * sizeof(Settings.mqtt_prefix[0]));
|
||||
// Location[i].address = Settings.char_chunk1;
|
||||
// Location[i].size = sizeof(Settings.char_chunk1); // 134
|
||||
}
|
||||
else if (1 == i) {
|
||||
Location[i].address = Settings.sta_ssid[0];
|
||||
Location[i].size = (2 * sizeof(Settings.sta_ssid[0])) + (2 * sizeof(Settings.sta_pwd[0])) + sizeof(Settings.hostname) + sizeof(Settings.syslog_host);
|
||||
// Location[i].address = Settings.char_chunk2;
|
||||
// Location[i].size = sizeof(Settings.char_chunk2); // 262
|
||||
}
|
||||
else if (2 == i) {
|
||||
// Need to move Settings.mqtt_port first!
|
||||
Location[i].address = Settings.mqtt_host;
|
||||
Location[i].size = sizeof(Settings.mqtt_host) + 2 + sizeof(Settings.mqtt_client) + sizeof(Settings.mqtt_user) + sizeof(Settings.mqtt_pwd) + sizeof(Settings.mqtt_topic) + sizeof(Settings.button_topic) + sizeof(Settings.mqtt_grptopic);
|
||||
// Location[i].address = Settings.char_chunk3;
|
||||
// Location[i].size = sizeof(Settings.char_chunk3); // 233
|
||||
}
|
||||
char* position = Settings.ota_url;
|
||||
for (uint32_t size = 0; size < SET_MAX; size++) {
|
||||
while (*position++ != '\0') { }
|
||||
}
|
||||
|
||||
SettingsCopyText(0); // Load
|
||||
return position - Settings.ota_url;
|
||||
}
|
||||
|
||||
void SettingsCopyText(uint32_t direction)
|
||||
{
|
||||
char* fullstr = settings_fullstr;
|
||||
uint32_t size = 0;
|
||||
for (uint32_t i = 0; i < settings_loc_num; i++) {
|
||||
size = Location[i].size;
|
||||
if (1 == direction) {
|
||||
memcpy(Location[i].address, fullstr, size); // Save to Settings
|
||||
} else {
|
||||
memcpy(fullstr, Location[i].address, size); // Load from Settings
|
||||
}
|
||||
fullstr += size;
|
||||
}
|
||||
}
|
||||
|
||||
bool SettingsUpdateText(uint32_t index, char* replace)
|
||||
bool SettingsUpdateText(uint32_t index, char* replace_me)
|
||||
{
|
||||
if (index >= SET_MAX) {
|
||||
return false; // Setting not supported - internal error
|
||||
}
|
||||
|
||||
// SettingsCopyText(0); // Load
|
||||
// Make a copy first in case we use source from Settings.text
|
||||
uint32_t replace_len = strlen(replace_me);
|
||||
char replace[replace_len +1];
|
||||
memcpy(replace, replace_me, sizeof(replace));
|
||||
|
||||
uint32_t start_pos = 0;
|
||||
uint32_t end_pos = 0;
|
||||
char* position = settings_fullstr;
|
||||
char* position = Settings.ota_url;
|
||||
for (uint32_t size = 0; size < SET_MAX; size++) {
|
||||
while (*position++ != '\0') { }
|
||||
if (1 == index) {
|
||||
start_pos = position - settings_fullstr;
|
||||
start_pos = position - Settings.ota_url;
|
||||
}
|
||||
else if (0 == index) {
|
||||
end_pos = position - settings_fullstr -1;
|
||||
end_pos = position - Settings.ota_url -1;
|
||||
}
|
||||
index--;
|
||||
}
|
||||
uint32_t len_pos = position - settings_fullstr;
|
||||
uint32_t char_len = position - Settings.ota_url;
|
||||
|
||||
uint32_t current_len = end_pos - start_pos;
|
||||
uint32_t replace_len = strlen(replace);
|
||||
int diff = replace_len - current_len;
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TST: start %d, end %d, len %d, current %d, replace %d, diff %d"),
|
||||
// start_pos, end_pos, len_pos, current_len, replace_len, diff);
|
||||
// start_pos, end_pos, char_len, current_len, replace_len, diff);
|
||||
|
||||
int too_long = (len_pos + diff) - sizeof(settings_fullstr);
|
||||
int too_long = (char_len + diff) - settings_text_size;
|
||||
if (too_long > 0) {
|
||||
// AddLog_P2(LOG_LEVEL_INFO, PSTR("CFG: Text too long by %d char(s)"), too_long);
|
||||
return false; // Replace text too long
|
||||
}
|
||||
|
||||
if (diff != 0) {
|
||||
// Shift full text string up or down
|
||||
memmove_P(settings_fullstr + start_pos + replace_len, settings_fullstr + end_pos, len_pos - end_pos);
|
||||
// Shift Settings.text up or down
|
||||
memmove_P(Settings.ota_url + start_pos + replace_len, Settings.ota_url + end_pos, char_len - end_pos);
|
||||
}
|
||||
// Replace text
|
||||
memmove_P(settings_fullstr + start_pos, replace, replace_len);
|
||||
memmove_P(Settings.ota_url + start_pos, replace, replace_len);
|
||||
// Fill for future use
|
||||
memset(settings_fullstr + len_pos + diff, 0x00, settings_max_size - len_pos - diff);
|
||||
|
||||
// SettingsCopyText(1); // Save - Hold of for now
|
||||
memset(Settings.ota_url + char_len + diff, 0x00, settings_text_size - char_len - diff);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -579,9 +513,7 @@ char* SettingsGetText(uint32_t index)
|
||||
return nullptr; // Setting not supported - internal error
|
||||
}
|
||||
|
||||
// SettingsCopyText(0); // Load
|
||||
|
||||
char* position = settings_fullstr;
|
||||
char* position = Settings.ota_url;
|
||||
for (;index > 0; index--) {
|
||||
while (*position++ != '\0') { }
|
||||
}
|
||||
@ -707,8 +639,6 @@ void SettingsLoad(void)
|
||||
settings_crc32 = GetSettingsCrc32();
|
||||
#endif // FIRMWARE_MINIMAL
|
||||
|
||||
SettingsInitText();
|
||||
|
||||
RtcSettingsLoad();
|
||||
}
|
||||
|
||||
@ -1342,6 +1272,11 @@ void SettingsDelta(void)
|
||||
Settings.sta_active = Settings.ex_sta_active; // 0A0 -> EC8
|
||||
memcpy((char*)&Settings.rule_stop, (char*)&Settings.ex_rule_stop, 47); // 1A7 -> EC9
|
||||
}
|
||||
if (Settings.version < 0x07010206) {
|
||||
Settings.flag4 = Settings.ex_flag4; // 1E0 -> EF8
|
||||
Settings.mqtt_port = Settings.ex_mqtt_port; // 20A -> EFC
|
||||
memcpy((char*)&Settings.serial_config, (char*)&Settings.ex_serial_config, 5); // 1E4 -> EFE
|
||||
}
|
||||
|
||||
Settings.version = VERSION;
|
||||
SettingsSave(1);
|
||||
|
@ -905,12 +905,15 @@ void Every250mSeconds(void)
|
||||
if ((214 == restart_flag) || (215 == restart_flag) || (216 == restart_flag)) {
|
||||
char storage_wifi[sizeof(Settings.sta_ssid) +
|
||||
sizeof(Settings.sta_pwd)];
|
||||
|
||||
char storage_mqtt[sizeof(Settings.mqtt_host) +
|
||||
sizeof(Settings.mqtt_port) +
|
||||
sizeof(Settings.mqtt_client) +
|
||||
sizeof(Settings.mqtt_user) +
|
||||
sizeof(Settings.mqtt_pwd) +
|
||||
sizeof(Settings.mqtt_topic)];
|
||||
uint16_t mqtt_port = Settings.mqtt_port; // Workaround 7.1.2.6 Settings shuffle
|
||||
|
||||
memcpy(storage_wifi, Settings.sta_ssid, sizeof(storage_wifi)); // Backup current SSIDs and Passwords
|
||||
if (216 == restart_flag) {
|
||||
memcpy(storage_mqtt, Settings.mqtt_host, sizeof(storage_mqtt)); // Backup mqtt host, port, client, username and password
|
||||
@ -923,6 +926,7 @@ void Every250mSeconds(void)
|
||||
if (216 == restart_flag) {
|
||||
memcpy(Settings.mqtt_host, storage_mqtt, sizeof(storage_mqtt)); // Restore the mqtt host, port, client, username and password
|
||||
strlcpy(Settings.mqtt_client, MQTT_CLIENT_ID, sizeof(Settings.mqtt_client)); // Set client to default
|
||||
Settings.mqtt_port = mqtt_port; // Workaround 7.1.2.6 Settings shuffle
|
||||
}
|
||||
restart_flag = 2;
|
||||
}
|
||||
|
@ -272,6 +272,30 @@ enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_PIN_STATE, FUNC_MODULE_INIT, FU
|
||||
|
||||
enum AddressConfigSteps { ADDR_IDLE, ADDR_RECEIVE, ADDR_SEND };
|
||||
|
||||
enum SettingsTextIndex { SET_OTAURL,
|
||||
SET_MQTTPREFIX1, SET_MQTTPREFIX2, SET_MQTTPREFIX3,
|
||||
SET_STASSID1, SET_STASSID2,
|
||||
SET_STAPWD1, SET_STAPWD2,
|
||||
SET_HOSTNAME, SET_SYSLOG_HOST,
|
||||
SET_WEBPWD,
|
||||
SET_MQTT_HOST, SET_MQTT_CLIENT,
|
||||
SET_MQTT_USER, SET_MQTT_PWD,
|
||||
SET_MQTT_FULLTOPIC, SET_MQTT_TOPIC,
|
||||
SET_MQTT_BUTTON_TOPIC, SET_MQTT_SWITCH_TOPIC, SET_MQTT_GRP_TOPIC,
|
||||
SET_STATE_TXT1, SET_STATE_TXT2, SET_STATE_TXT3, SET_STATE_TXT4,
|
||||
SET_NTPSERVER1, SET_NTPSERVER2, SET_NTPSERVER3,
|
||||
SET_MEM1, SET_MEM2, SET_MEM3, SET_MEM4, SET_MEM5,
|
||||
SET_CORS,
|
||||
SET_FRIENDLYNAME1, SET_FRIENDLYNAME2, SET_FRIENDLYNAME3, SET_FRIENDLYNAME4,
|
||||
|
||||
// SET_FRIENDLYNAME5, SET_FRIENDLYNAME6, SET_FRIENDLYNAME7, SET_FRIENDLYNAME8, // Future extension
|
||||
// SET_BUTTON1, SET_BUTTON2, SET_BUTTON3, SET_BUTTON4, // Future extension
|
||||
// SET_BUTTON5, SET_BUTTON6, SET_BUTTON7, SET_BUTTON8, // Future extension
|
||||
// SET_BUTTON9, SET_BUTTON10, SET_BUTTON11, SET_BUTTON12, // Future extension
|
||||
// SET_BUTTON13, SET_BUTTON14, SET_BUTTON15, SET_BUTTON16, // Future extension
|
||||
|
||||
SET_MAX };
|
||||
|
||||
enum CommandSource { SRC_IGNORE, SRC_MQTT, SRC_RESTART, SRC_BUTTON, SRC_SWITCH, SRC_BACKLOG, SRC_SERIAL, SRC_WEBGUI, SRC_WEBCOMMAND, SRC_WEBCONSOLE, SRC_PULSETIMER,
|
||||
SRC_TIMER, SRC_RULE, SRC_MAXPOWER, SRC_MAXENERGY, SRC_OVERTEMP, SRC_LIGHT, SRC_KNX, SRC_DISPLAY, SRC_WEMO, SRC_HUE, SRC_RETRY, SRC_REMOTE, SRC_SHUTTER,
|
||||
SRC_MAX };
|
||||
|
@ -20,6 +20,6 @@
|
||||
#ifndef _TASMOTA_VERSION_H_
|
||||
#define _TASMOTA_VERSION_H_
|
||||
|
||||
const uint32_t VERSION = 0x07010205;
|
||||
const uint32_t VERSION = 0x07010206;
|
||||
|
||||
#endif // _TASMOTA_VERSION_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user