mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Change some commands displaying all items
Change commands ``Prefix``, ``Ssid``, ``StateText``, ``NTPServer``, and ``FriendlyName`` displaying all items
This commit is contained in:
parent
e7b061ce5a
commit
0e0d8190fa
@ -55,12 +55,14 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||||||
### Version 8.1.0.3
|
### Version 8.1.0.3
|
||||||
|
|
||||||
- Change Lights: simplified gamma correction and 10 bits internal computation
|
- Change Lights: simplified gamma correction and 10 bits internal computation
|
||||||
|
- Change commands ``Prefix``, ``Ssid``, ``StateText``, ``NTPServer``, and ``FriendlyName`` displaying all items
|
||||||
- Fix Sonoff Bridge, Sc, L1, iFan03 and CSE7766 serial interface to forced speed, config and disable logging
|
- Fix Sonoff Bridge, Sc, L1, iFan03 and CSE7766 serial interface to forced speed, config and disable logging
|
||||||
- Fix commands ``Display`` and ``Counter`` from overruling command processing (#7322)
|
- Fix commands ``Display`` and ``Counter`` from overruling command processing (#7322)
|
||||||
- Fix ``White`` added to light status (#7142)
|
- Fix ``White`` added to light status (#7142)
|
||||||
- Fix Improved fade linearity with gamma correction
|
- Fix Improved fade linearity with gamma correction
|
||||||
- Fix LCD line and column positioning (#7387)
|
- Fix LCD line and column positioning (#7387)
|
||||||
- Fix Display handling of hexadecimal escape characters (#7387)
|
- Fix Display handling of hexadecimal escape characters (#7387)
|
||||||
|
- Fix ``WakeUp <x>`` ignores provided value (#7473)
|
||||||
- Add command ``SetOption79 0/1`` to enable reset of counters at teleperiod time by Andre Thomas (#7355)
|
- Add command ``SetOption79 0/1`` to enable reset of counters at teleperiod time by Andre Thomas (#7355)
|
||||||
- Add command ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380
|
- Add command ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380
|
||||||
- Add command ``ShutterButton <parameters>`` to control shutter(s) by to-scho (#7403)
|
- Add command ``ShutterButton <parameters>`` to control shutter(s) by to-scho (#7403)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
### 8.1.0.3 20200106
|
### 8.1.0.3 20200106
|
||||||
|
|
||||||
|
- Change commands ``Prefix``, ``Ssid``, ``StateText``, ``NTPServer``, and ``FriendlyName`` displaying all items
|
||||||
- Add support for gzipped binaries
|
- Add support for gzipped binaries
|
||||||
- Update IRremoteESP8266 lib updated to v2.7.2
|
- Update IRremoteESP8266 lib updated to v2.7.2
|
||||||
- Fix ``WakeUp <x>`` ignores provided value (#7473)
|
- Fix ``WakeUp <x>`` ignores provided value (#7473)
|
||||||
|
@ -1043,7 +1043,7 @@ void SettingsDefaultSet2(void)
|
|||||||
SettingsUpdateText(SET_NTPSERVER1, NTP_SERVER1);
|
SettingsUpdateText(SET_NTPSERVER1, NTP_SERVER1);
|
||||||
SettingsUpdateText(SET_NTPSERVER2, NTP_SERVER2);
|
SettingsUpdateText(SET_NTPSERVER2, NTP_SERVER2);
|
||||||
SettingsUpdateText(SET_NTPSERVER3, NTP_SERVER3);
|
SettingsUpdateText(SET_NTPSERVER3, NTP_SERVER3);
|
||||||
for (uint32_t i = 0; i < 3; i++) {
|
for (uint32_t i = 0; i < MAX_NTP_SERVERS; i++) {
|
||||||
SettingsUpdateText(SET_NTPSERVER1 +i, ReplaceCommaWithDot(SettingsText(SET_NTPSERVER1 +i)));
|
SettingsUpdateText(SET_NTPSERVER1 +i, ReplaceCommaWithDot(SettingsText(SET_NTPSERVER1 +i)));
|
||||||
}
|
}
|
||||||
Settings.latitude = (int)((double)LATITUDE * 1000000);
|
Settings.latitude = (int)((double)LATITUDE * 1000000);
|
||||||
|
@ -89,6 +89,15 @@ void ResponseCmndIdxChar(const char* value)
|
|||||||
Response_P(S_JSON_COMMAND_INDEX_SVALUE, XdrvMailbox.command, XdrvMailbox.index, value);
|
Response_P(S_JSON_COMMAND_INDEX_SVALUE, XdrvMailbox.command, XdrvMailbox.index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResponseCmndAll(uint32_t text_index, uint32_t count)
|
||||||
|
{
|
||||||
|
mqtt_data[0] = '\0';
|
||||||
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
|
ResponseAppend_P(PSTR("%c\"%s%d\":\"%s\""), (i) ? ',' : '{', XdrvMailbox.command, i +1, SettingsText(text_index +i));
|
||||||
|
}
|
||||||
|
ResponseJsonEnd();
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
void ExecuteCommand(const char *cmnd, uint32_t source)
|
void ExecuteCommand(const char *cmnd, uint32_t source)
|
||||||
@ -1220,16 +1229,20 @@ void CmndIpAddress(void)
|
|||||||
|
|
||||||
void CmndNtpServer(void)
|
void CmndNtpServer(void)
|
||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 3)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_NTP_SERVERS)) {
|
||||||
uint32_t ntp_server = SET_NTPSERVER1 + XdrvMailbox.index -1;
|
if (!XdrvMailbox.usridx) {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
ResponseCmndAll(SET_NTPSERVER1, MAX_NTP_SERVERS);
|
||||||
SettingsUpdateText(ntp_server,
|
} else {
|
||||||
(SC_CLEAR == Shortcut()) ? "" : (SC_DEFAULT == Shortcut()) ? (1 == XdrvMailbox.index) ? NTP_SERVER1 : (2 == XdrvMailbox.index) ? NTP_SERVER2 : NTP_SERVER3 : XdrvMailbox.data);
|
uint32_t ntp_server = SET_NTPSERVER1 + XdrvMailbox.index -1;
|
||||||
SettingsUpdateText(ntp_server, ReplaceCommaWithDot(SettingsText(ntp_server)));
|
if (XdrvMailbox.data_len > 0) {
|
||||||
// restart_flag = 2; // Issue #3890
|
SettingsUpdateText(ntp_server,
|
||||||
ntp_force_sync = true;
|
(SC_CLEAR == Shortcut()) ? "" : (SC_DEFAULT == Shortcut()) ? (1 == XdrvMailbox.index) ? NTP_SERVER1 : (2 == XdrvMailbox.index) ? NTP_SERVER2 : NTP_SERVER3 : XdrvMailbox.data);
|
||||||
|
SettingsUpdateText(ntp_server, ReplaceCommaWithDot(SettingsText(ntp_server)));
|
||||||
|
// restart_flag = 2; // Issue #3890
|
||||||
|
ntp_force_sync = true;
|
||||||
|
}
|
||||||
|
ResponseCmndIdxChar(SettingsText(ntp_server));
|
||||||
}
|
}
|
||||||
ResponseCmndIdxChar(SettingsText(ntp_server));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1251,14 +1264,18 @@ void CmndAp(void)
|
|||||||
|
|
||||||
void CmndSsid(void)
|
void CmndSsid(void)
|
||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 2)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_SSIDS)) {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (!XdrvMailbox.usridx) {
|
||||||
SettingsUpdateText(SET_STASSID1 + XdrvMailbox.index -1,
|
ResponseCmndAll(SET_STASSID1, MAX_SSIDS);
|
||||||
(SC_CLEAR == Shortcut()) ? "" : (SC_DEFAULT == Shortcut()) ? (1 == XdrvMailbox.index) ? STA_SSID1 : STA_SSID2 : XdrvMailbox.data);
|
} else {
|
||||||
Settings.sta_active = XdrvMailbox.index -1;
|
if (XdrvMailbox.data_len > 0) {
|
||||||
restart_flag = 2;
|
SettingsUpdateText(SET_STASSID1 + XdrvMailbox.index -1,
|
||||||
|
(SC_CLEAR == Shortcut()) ? "" : (SC_DEFAULT == Shortcut()) ? (1 == XdrvMailbox.index) ? STA_SSID1 : STA_SSID2 : XdrvMailbox.data);
|
||||||
|
Settings.sta_active = XdrvMailbox.index -1;
|
||||||
|
restart_flag = 2;
|
||||||
|
}
|
||||||
|
ResponseCmndIdxChar(SettingsText(SET_STASSID1 + XdrvMailbox.index -1));
|
||||||
}
|
}
|
||||||
ResponseCmndIdxChar(SettingsText(SET_STASSID1 + XdrvMailbox.index -1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1308,16 +1325,20 @@ void CmndWifiConfig(void)
|
|||||||
void CmndFriendlyname(void)
|
void CmndFriendlyname(void)
|
||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_FRIENDLYNAMES)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_FRIENDLYNAMES)) {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (!XdrvMailbox.usridx) {
|
||||||
char stemp1[TOPSZ];
|
ResponseCmndAll(SET_FRIENDLYNAME1, MAX_FRIENDLYNAMES);
|
||||||
if (1 == XdrvMailbox.index) {
|
} else {
|
||||||
snprintf_P(stemp1, sizeof(stemp1), PSTR(FRIENDLY_NAME));
|
if (XdrvMailbox.data_len > 0) {
|
||||||
} else {
|
char stemp1[TOPSZ];
|
||||||
snprintf_P(stemp1, sizeof(stemp1), PSTR(FRIENDLY_NAME "%d"), XdrvMailbox.index);
|
if (1 == XdrvMailbox.index) {
|
||||||
|
snprintf_P(stemp1, sizeof(stemp1), PSTR(FRIENDLY_NAME));
|
||||||
|
} else {
|
||||||
|
snprintf_P(stemp1, sizeof(stemp1), PSTR(FRIENDLY_NAME "%d"), XdrvMailbox.index);
|
||||||
|
}
|
||||||
|
SettingsUpdateText(SET_FRIENDLYNAME1 + XdrvMailbox.index -1, ('"' == XdrvMailbox.data[0]) ? "" : (SC_DEFAULT == Shortcut()) ? stemp1 : XdrvMailbox.data);
|
||||||
}
|
}
|
||||||
SettingsUpdateText(SET_FRIENDLYNAME1 + XdrvMailbox.index -1, ('"' == XdrvMailbox.data[0]) ? "" : (SC_DEFAULT == Shortcut()) ? stemp1 : XdrvMailbox.data);
|
ResponseCmndIdxChar(SettingsText(SET_FRIENDLYNAME1 + XdrvMailbox.index -1));
|
||||||
}
|
}
|
||||||
ResponseCmndIdxChar(SettingsText(SET_FRIENDLYNAME1 + XdrvMailbox.index -1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ char* GetTopic_P(char *stopic, uint32_t prefix, char *topic, const char* subtopi
|
|||||||
fulltopic += F("/");
|
fulltopic += F("/");
|
||||||
fulltopic += FPSTR(MQTT_TOKEN_PREFIX); // Need prefix for commands to handle mqtt topic loops
|
fulltopic += FPSTR(MQTT_TOKEN_PREFIX); // Need prefix for commands to handle mqtt topic loops
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < 3; i++) {
|
for (uint32_t i = 0; i < MAX_MQTT_PREFIXES; i++) {
|
||||||
if (!strlen(SettingsText(SET_MQTTPREFIX1 + i))) {
|
if (!strlen(SettingsText(SET_MQTTPREFIX1 + i))) {
|
||||||
char temp[TOPSZ];
|
char temp[TOPSZ];
|
||||||
SettingsUpdateText(SET_MQTTPREFIX1 + i, GetTextIndexed(temp, sizeof(temp), i, kPrefixes));
|
SettingsUpdateText(SET_MQTTPREFIX1 + i, GetTextIndexed(temp, sizeof(temp), i, kPrefixes));
|
||||||
@ -144,7 +144,7 @@ char* GetFallbackTopic_P(char *stopic, const char* subtopic)
|
|||||||
|
|
||||||
char* GetStateText(uint32_t state)
|
char* GetStateText(uint32_t state)
|
||||||
{
|
{
|
||||||
if (state > 3) {
|
if (state >= MAX_STATE_TEXT) {
|
||||||
state = 1;
|
state = 1;
|
||||||
}
|
}
|
||||||
return SettingsText(SET_STATE_TXT1 + state);
|
return SettingsText(SET_STATE_TXT1 + state);
|
||||||
|
@ -279,7 +279,7 @@ void WifiBeginAfterScan(void)
|
|||||||
|
|
||||||
bool known = false;
|
bool known = false;
|
||||||
uint32_t j;
|
uint32_t j;
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < MAX_SSIDS; j++) {
|
||||||
if (ssid_scan == SettingsText(SET_STASSID1 + j)) { // SSID match
|
if (ssid_scan == SettingsText(SET_STASSID1 + j)) { // SSID match
|
||||||
known = true;
|
known = true;
|
||||||
if (rssi_scan > best_network_db) { // Best network
|
if (rssi_scan > best_network_db) { // Best network
|
||||||
|
@ -73,6 +73,10 @@ const uint8_t MAX_RULE_SETS = 3; // Max number of rule sets of size 5
|
|||||||
const uint16_t MAX_RULE_SIZE = 512; // Max number of characters in rules
|
const uint16_t MAX_RULE_SIZE = 512; // Max number of characters in rules
|
||||||
|
|
||||||
// Changes to the following MAX_ defines need to be in line with enum SettingsTextIndex
|
// Changes to the following MAX_ defines need to be in line with enum SettingsTextIndex
|
||||||
|
const uint8_t MAX_MQTT_PREFIXES = 3; // Max number of MQTT prefixes (cmnd, stat, tele)
|
||||||
|
const uint8_t MAX_SSIDS = 2; // Max number of SSIDs
|
||||||
|
const uint8_t MAX_STATE_TEXT = 4; // Max number of State names (OFF, ON, TOGGLE, HOLD)
|
||||||
|
const uint8_t MAX_NTP_SERVERS = 3; // Max number of NTP servers
|
||||||
const uint8_t MAX_RULE_MEMS = 16; // Max number of saved vars
|
const uint8_t MAX_RULE_MEMS = 16; // Max number of saved vars
|
||||||
const uint8_t MAX_FRIENDLYNAMES = 8; // Max number of Friendly names
|
const uint8_t MAX_FRIENDLYNAMES = 8; // Max number of Friendly names
|
||||||
const uint8_t MAX_BUTTON_TEXT = 16; // Max number of GUI button labels
|
const uint8_t MAX_BUTTON_TEXT = 16; // Max number of GUI button labels
|
||||||
|
@ -2906,11 +2906,7 @@ void CmndWebButton(void)
|
|||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_BUTTON_TEXT)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_BUTTON_TEXT)) {
|
||||||
if (!XdrvMailbox.usridx) {
|
if (!XdrvMailbox.usridx) {
|
||||||
mqtt_data[0] = '\0';
|
ResponseCmndAll(SET_BUTTON1, MAX_BUTTON_TEXT);
|
||||||
for (uint32_t i = 0; i < MAX_BUTTON_TEXT; i++) {
|
|
||||||
ResponseAppend_P(PSTR("%c\"WebButton%d\":\"%s\""), (i) ? ',' : '{', i +1, SettingsText(SET_BUTTON1 +i));
|
|
||||||
}
|
|
||||||
ResponseJsonEnd();
|
|
||||||
} else {
|
} else {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (XdrvMailbox.data_len > 0) {
|
||||||
SettingsUpdateText(SET_BUTTON1 + XdrvMailbox.index -1, ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data);
|
SettingsUpdateText(SET_BUTTON1 + XdrvMailbox.index -1, ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data);
|
||||||
|
@ -789,14 +789,18 @@ void CmndMqttRetry(void)
|
|||||||
|
|
||||||
void CmndStateText(void)
|
void CmndStateText(void)
|
||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 4)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_STATE_TEXT)) {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (!XdrvMailbox.usridx) {
|
||||||
for (uint32_t i = 0; i <= XdrvMailbox.data_len; i++) {
|
ResponseCmndAll(SET_STATE_TXT1, MAX_STATE_TEXT);
|
||||||
if (XdrvMailbox.data[i] == ' ') XdrvMailbox.data[i] = '_';
|
} else {
|
||||||
|
if (XdrvMailbox.data_len > 0) {
|
||||||
|
for (uint32_t i = 0; i <= XdrvMailbox.data_len; i++) {
|
||||||
|
if (XdrvMailbox.data[i] == ' ') XdrvMailbox.data[i] = '_';
|
||||||
|
}
|
||||||
|
SettingsUpdateText(SET_STATE_TXT1 + XdrvMailbox.index -1, XdrvMailbox.data);
|
||||||
}
|
}
|
||||||
SettingsUpdateText(SET_STATE_TXT1 + XdrvMailbox.index -1, XdrvMailbox.data);
|
ResponseCmndIdxChar(GetStateText(XdrvMailbox.index -1));
|
||||||
}
|
}
|
||||||
ResponseCmndIdxChar(GetStateText(XdrvMailbox.index -1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -828,15 +832,18 @@ void CmndFullTopic(void)
|
|||||||
|
|
||||||
void CmndPrefix(void)
|
void CmndPrefix(void)
|
||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 3)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_MQTT_PREFIXES)) {
|
||||||
|
if (!XdrvMailbox.usridx) {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
ResponseCmndAll(SET_MQTTPREFIX1, MAX_MQTT_PREFIXES);
|
||||||
MakeValidMqtt(0, XdrvMailbox.data);
|
} else {
|
||||||
SettingsUpdateText(SET_MQTTPREFIX1 + XdrvMailbox.index -1,
|
if (XdrvMailbox.data_len > 0) {
|
||||||
(SC_DEFAULT == Shortcut()) ? (1==XdrvMailbox.index) ? SUB_PREFIX : (2==XdrvMailbox.index) ? PUB_PREFIX : PUB_PREFIX2 : XdrvMailbox.data);
|
MakeValidMqtt(0, XdrvMailbox.data);
|
||||||
restart_flag = 2;
|
SettingsUpdateText(SET_MQTTPREFIX1 + XdrvMailbox.index -1,
|
||||||
|
(SC_DEFAULT == Shortcut()) ? (1==XdrvMailbox.index) ? SUB_PREFIX : (2==XdrvMailbox.index) ? PUB_PREFIX : PUB_PREFIX2 : XdrvMailbox.data);
|
||||||
|
restart_flag = 2;
|
||||||
|
}
|
||||||
|
ResponseCmndIdxChar(SettingsText(SET_MQTTPREFIX1 + XdrvMailbox.index -1));
|
||||||
}
|
}
|
||||||
ResponseCmndIdxChar(SettingsText(SET_MQTTPREFIX1 + XdrvMailbox.index -1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1812,11 +1812,7 @@ void CmndMemory(void)
|
|||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_RULE_MEMS)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_RULE_MEMS)) {
|
||||||
if (!XdrvMailbox.usridx) {
|
if (!XdrvMailbox.usridx) {
|
||||||
mqtt_data[0] = '\0';
|
ResponseCmndAll(SET_MEM1, MAX_RULE_MEMS);
|
||||||
for (uint32_t i = 0; i < MAX_RULE_MEMS; i++) {
|
|
||||||
ResponseAppend_P(PSTR("%c\"Mem%d\":\"%s\""), (i) ? ',' : '{', i +1, SettingsText(SET_MEM1 +i));
|
|
||||||
}
|
|
||||||
ResponseJsonEnd();
|
|
||||||
} else {
|
} else {
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (XdrvMailbox.data_len > 0) {
|
||||||
#ifdef USE_EXPRESSION
|
#ifdef USE_EXPRESSION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user