Add command ``SetOption141 1``

- Add command ``SetOption141 1`` to disable display of module name in GUI header
- Prep SO146-177
This commit is contained in:
Theo Arends 2022-05-29 15:49:57 +02:00
parent d9490b3278
commit 65a87fd747
7 changed files with 139 additions and 19 deletions

View File

@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- Support for Sonoff SPM v1.2.0
- Support for Sonoff Zigbee Bridge Pro by Stephan Hadinger (#15701)
- Command ``SspmDisplay 2`` to display Sonoff SPM energy data in GUI for user tab-selected relay modules (#13447)
- Command ``SetOption141 1`` to disable display of module name in GUI header
### Changed

View File

@ -108,6 +108,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
### Added
- Command ``SetOption139 0/1`` to switch between pressure unit "mmHg" (0) or "inHg" (1) when ``SO24 1`` [#15350](https://github.com/arendst/Tasmota/issues/15350)
- Command ``SetOption140 0/1`` to switch between MQTT Clean Session (0) or Persistent Session (1) [#15530](https://github.com/arendst/Tasmota/issues/15530)
- Command ``SetOption141 1`` to disable display of module name in GUI header
- Command ``EnergyExportActive<phase>`` to (p)reset energy export active for supported devices. Currently ADE7880 only [#13515](https://github.com/arendst/Tasmota/issues/13515)
- Command ``IfxRp ""|<policy>`` adds optional InfluxDb Retention Policy [#15513](https://github.com/arendst/Tasmota/issues/15513)
- Command ``SspmDisplay 2`` to display Sonoff SPM energy data in GUI for user tab-selected relay modules [#13447](https://github.com/arendst/Tasmota/issues/13447)

View File

@ -170,7 +170,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t gui_table_align : 1; // bit 24 (v11.0.0.7) - SetOption138 - (GUI) Align (energy) table values left (0) or right (1)
uint32_t mm_vs_inch : 1; // bit 25 (v11.1.0.1) - SetOption139 - (Pressure) Switch between mmHg (0) or inHg (1) when SO24 1
uint32_t mqtt_persistent : 1; // bit 26 (v11.1.0.1) - SetOption140 - (MQTT) MQTT clean session (0 = default) or persistent session (1)
uint32_t spare27 : 1; // bit 27
uint32_t gui_module_name : 1; // bit 27 (v11.1.0.3) - SetOption141 - (GUI) Disable display of GUI module name (1)
uint32_t spare28 : 1; // bit 28
uint32_t spare29 : 1; // bit 29
uint32_t spare30 : 1; // bit 30
@ -178,6 +178,44 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
};
} SOBitfield5;
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
uint32_t data; // Allow bit manipulation using SetOption
struct { // SetOption146 .. SetOption177
uint32_t spare00 : 1; // bit 0
uint32_t spare01 : 1; // bit 1
uint32_t spare02 : 1; // bit 2
uint32_t spare03 : 1; // bit 3
uint32_t spare04 : 1; // bit 4
uint32_t spare05 : 1; // bit 5
uint32_t spare06 : 1; // bit 6
uint32_t spare07 : 1; // bit 7
uint32_t spare08 : 1; // bit 8
uint32_t spare09 : 1; // bit 9
uint32_t spare10 : 1; // bit 10
uint32_t spare11 : 1; // bit 11
uint32_t spare12 : 1; // bit 12
uint32_t spare13 : 1; // bit 13
uint32_t spare14 : 1; // bit 14
uint32_t spare15 : 1; // bit 15
uint32_t spare16 : 1; // bit 16
uint32_t spare17 : 1; // bit 17
uint32_t spare18 : 1; // bit 18
uint32_t spare19 : 1; // bit 19
uint32_t spare20 : 1; // bit 20
uint32_t spare21 : 1; // bit 21
uint32_t spare22 : 1; // bit 22
uint32_t spare23 : 1; // bit 23
uint32_t spare24 : 1; // bit 24
uint32_t spare25 : 1; // bit 25
uint32_t spare26 : 1; // bit 26
uint32_t spare27 : 1; // bit 27
uint32_t spare28 : 1; // bit 28
uint32_t spare29 : 1; // bit 29
uint32_t spare30 : 1; // bit 30
uint32_t spare31 : 1; // bit 31
};
} SOBitfield6;
// Bitfield to be used for persistent multi bit
typedef union {
uint32_t data; // Allow bit manipulation
@ -798,9 +836,10 @@ typedef struct {
uint8_t tcp_config; // F5F
uint8_t light_step_pixels; // F60
uint8_t free_f61[23]; // F61 - Decrement if adding new Setting variables just above and below
uint8_t free_f61[19]; // F61 - Decrement if adding new Setting variables just above and below
// Only 32 bit boundary variables below
SOBitfield6 flag6; // F74
uint16_t flowratemeter_calibration[2];// F78
int32_t energy_kWhexport_ph[3]; // F7C
uint32_t eth_ipv4_address[5]; // F88

View File

@ -605,11 +605,11 @@ void CmndStatus(void)
if ((0 == payload) || (3 == payload)) {
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS3_LOGGING "\":{\"" D_CMND_SERIALLOG "\":%d,\"" D_CMND_WEBLOG "\":%d,\"" D_CMND_MQTTLOG "\":%d,\"" D_CMND_SYSLOG "\":%d,\""
D_CMND_LOGHOST "\":\"%s\",\"" D_CMND_LOGPORT "\":%d,\"" D_CMND_SSID "\":[\"%s\",\"%s\"],\"" D_CMND_TELEPERIOD "\":%d,\""
D_JSON_RESOLUTION "\":\"%08X\",\"" D_CMND_SETOPTION "\":[\"%08X\",\"%s\",\"%08X\",\"%08X\",\"%08X\"]}}"),
D_JSON_RESOLUTION "\":\"%08X\",\"" D_CMND_SETOPTION "\":[\"%08X\",\"%s\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]}}"),
Settings->seriallog_level, Settings->weblog_level, Settings->mqttlog_level, Settings->syslog_level,
SettingsText(SET_SYSLOG_HOST), Settings->syslog_port, EscapeJSONString(SettingsText(SET_STASSID1)).c_str(), EscapeJSONString(SettingsText(SET_STASSID2)).c_str(), Settings->tele_period,
Settings->flag2.data, Settings->flag.data, ToHex_P((unsigned char*)Settings->param, PARAM8_SIZE, stemp2, sizeof(stemp2)),
Settings->flag3.data, Settings->flag4.data, Settings->flag5.data);
Settings->flag3.data, Settings->flag4.data, Settings->flag5.data, Settings->flag6.data);
CmndStatusResponse(3);
}
@ -1025,28 +1025,32 @@ void CmndSetoption(void) {
CmndSetoptionBase(1);
}
// Code called by SetOption and by Berrt
// Code called by SetOption and by Berry
bool SetoptionDecode(uint32_t index, uint32_t *ptype, uint32_t *pindex) {
if (index < 146) {
if (index < 178) {
if (index <= 31) { // SetOption0 .. 31 = Settings->flag
*ptype = 2;
*pindex = index; // 0 .. 31
*pindex = index; // 0 .. 31
}
else if (index <= 49) { // SetOption32 .. 49 = Settings->param
*ptype = 1;
*pindex = index -32; // 0 .. 17 (= PARAM8_SIZE -1)
*pindex = index -32; // 0 .. 17 (= PARAM8_SIZE -1)
}
else if (index <= 81) { // SetOption50 .. 81 = Settings->flag3
*ptype = 3;
*pindex = index -50; // 0 .. 31
*pindex = index -50; // 0 .. 31
}
else if (index <= 113) { // SetOption82 .. 113 = Settings->flag4
else if (index <= 113) { // SetOption82 .. 113 = Settings->flag4
*ptype = 4;
*pindex = index -82; // 0 .. 31
*pindex = index -82; // 0 .. 31
}
else { // SetOption114 .. 145 = Settings->flag5
else if (index <= 145) { // SetOption114 .. 145 = Settings->flag5
*ptype = 5;
*pindex = index -114; // 0 .. 31
*pindex = index -114; // 0 .. 31
}
else { // SetOption146 .. 177 = Settings->flag6
*ptype = 6;
*pindex = index -146; // 0 .. 31
}
return true;
}
@ -1070,6 +1074,9 @@ uint32_t GetOption(uint32_t index) {
else if (5 == ptype) {
flag = Settings->flag5.data;
}
else if (6 == ptype) {
flag = Settings->flag6.data;
}
return bitRead(flag, pindex);
}
} else {
@ -1208,6 +1215,9 @@ void CmndSetoptionBase(bool indexed) {
break;
}
}
else if (6 == ptype) { // SetOption146 .. 177
bitWrite(Settings->flag6.data, pindex, XdrvMailbox.payload);
}
} else {
ptype = 99; // Command Error
}
@ -1232,6 +1242,9 @@ void CmndSetoptionBase(bool indexed) {
else if (5 == ptype) {
flag = Settings->flag5.data;
}
else if (6 == ptype) {
flag = Settings->flag6.data;
}
if (indexed) {
ResponseCmndIdxChar(GetStateText(bitRead(flag, pindex)));
} else {

View File

@ -816,8 +816,51 @@ void ResponseAppendFeatures(void)
// feature8 |= 0x80000000;
}
static uint32_t feature9 = 0x00000000;
if (!feature9) { // Only fill this once
// feature9 |= 0x00000001;
// feature9 |= 0x00000002;
// feature9 |= 0x00000004;
// feature9 |= 0x00000008;
// feature9 |= 0x00000010;
// feature9 |= 0x00000020;
// feature9 |= 0x00000040;
// feature9 |= 0x00000080;
// feature9 |= 0x00000100;
// feature9 |= 0x00000200;
// feature9 |= 0x00000400;
// feature9 |= 0x00000800;
// feature9 |= 0x00001000;
// feature9 |= 0x00002000;
// feature9 |= 0x00004000;
// feature9 |= 0x00008000;
// feature9 |= 0x00010000;
// feature9 |= 0x00020000;
// feature9 |= 0x00040000;
// feature9 |= 0x00080000;
// feature9 |= 0x00100000;
// feature9 |= 0x00200000;
// feature9 |= 0x00400000;
// feature9 |= 0x00800000;
// feature9 |= 0x01000000;
// feature9 |= 0x02000000;
// feature9 |= 0x04000000;
// feature9 |= 0x08000000;
// feature9 |= 0x10000000;
// feature9 |= 0x20000000;
// feature9 |= 0x40000000;
// feature9 |= 0x80000000;
}
/*********************************************************************************************/
ResponseAppend_P(PSTR(",\"" D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]"),
LANGUAGE_LCID, feature1, feature2, feature3, feature4, feature5, feature6, feature7, feature8);
ResponseAppend_P(PSTR(",\"" D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]"),
LANGUAGE_LCID, feature1, feature2, feature3, feature4, feature5, feature6, feature7, feature8, feature9);
}

View File

@ -893,7 +893,7 @@ void WSContentSendStyle_P(const char* formatP, ...) {
WebColor(COL_TEXT_WARNING),
#endif
WebColor(COL_TITLE),
(Web.initial_config) ? "" : ModuleName().c_str(), SettingsText(SET_DEVICENAME));
(Web.initial_config) ? "" : (Settings->flag5.gui_module_name) ? "" : ModuleName().c_str(), SettingsText(SET_DEVICENAME));
// SetOption53 - Show hostname and IP address in GUI main menu
#if (RESTART_AFTER_INITIAL_WIFI_CONFIG)

View File

@ -195,7 +195,16 @@ a_setoption = [[
"(GUI) Align (energy) table values left (0) or right (1)",
"(Pressure) Switch between mmHg (0) or inHg (1) when SO24 1",
"(MQTT) MQTT clean session (0 = default) or persistent session (1)",
"",
"(GUI) Disable display of GUI module name (1)",
"","","",""
],[
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","",""
]]
@ -271,6 +280,15 @@ a_features = [[
"USE_SDM230","USE_CM110x","USE_BL6523","USE_ADE7880",
"USE_PCF85363","USE_DS3502","USE_IMPROV","USE_FLOWRATEMETER",
"","","",""
],[
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","",""
]]
usage = "usage: decode-status {-d | -f} arg"
@ -298,7 +316,7 @@ else:
obj = json.load(fp)
def StartDecode():
print ("\n*** decode-status.py v11.1.0.1 by Theo Arends and Jacek Ziolkowski ***")
print ("\n*** decode-status.py v11.1.0.3 by Theo Arends and Jacek Ziolkowski ***")
# print("Decoding\n{}".format(obj))
@ -334,13 +352,18 @@ def StartDecode():
options.append(str("{0:3d} ({1:3d}) {2}".format(i, split_register[opt_idx], option)))
i += 1
if r in (0, 2, 3, 4): #registers 1 and 4 hold binary values
if r in (0, 2, 3, 4, 5): # register 1 holds binary values
for opt_idx, option in enumerate(opt_group):
if len(option) == 0:
continue # Skip empty line
i_register = int(register,16)
state = (i_register >> opt_idx) & 1
options.append(str("{0:3d} ({1}) {2}".format(i, a_on_off[state], option)))
i += 1
if r >= len(obj["StatusLOG"]["SetOption"]) -1:
break # Versions before 11.1.0.3 hold SO until 145
print("\nOptions")
for o in options:
print(" {}".format(o))