Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve display separation #20495

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tasmota/tasmota.ino
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ struct TasmotaGlobal_t {
#ifdef USE_BERRY
bool berry_fast_loop_enabled = false; // is Berry fast loop enabled, i.e. control is passed at each loop iteration
#endif // USE_BERRY

bool NeedSeparatorLine = false; // Determine if a separator line should be send to WebUI after sensor/driver output
} TasmotaGlobal;

TSettings* Settings = nullptr;
Expand Down
3 changes: 3 additions & 0 deletions tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,8 @@ void _WSContentSendBuffer(bool decimal, const char * formatP, va_list arg) {
int len = strlen(content);
if (0 == len) { return; } // No content

TasmotaGlobal.NeedSeparatorLine = true;

if (decimal && (D_DECIMAL_SEPARATOR[0] != '.')) {
for (uint32_t i = 0; i < len; i++) {
if ('.' == content[i]) {
Expand Down Expand Up @@ -1470,6 +1472,7 @@ bool HandleRootStatusRefresh(void)
WSContentSend_P(PSTR("{t}"));
if (Settings->web_time_end) {
WSContentSend_P(PSTR("{s}" D_TIMER_TIME "{m}%s{e}"), GetDateAndTime(DT_LOCAL).substring(Settings->web_time_start, Settings->web_time_end).c_str());
WSContentSend_P("<tr><td colspan=2><hr>{e}");
}
XsnsXdrvCall(FUNC_WEB_SENSOR);

Expand Down
4 changes: 2 additions & 2 deletions tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ void EnergyShow(bool json) {
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><td>{e}
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><td>{e}
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><th>Head4</th><th></th><td>{e}
WSContentSend_P(PSTR("</table><hr/>{t}{s}</th><th></th>")); // First column is empty ({t} = <table style='width:100%'>, {s} = <tr><th>)
WSContentSend_P(PSTR("</table>{t}{s}</th><th></th>")); // First column is empty ({t} = <table style='width:100%'>, {s} = <tr><th>)
bool label_o = voltage_common;
bool no_label = (1 == Energy->phase_count);
char number[4];
Expand Down Expand Up @@ -1448,7 +1448,7 @@ void EnergyShow(bool json) {
WSContentSend_PD(HTTP_SNS_EXPORT_ACTIVE, WebEnergyFmt(Energy->export_active, Settings->flag2.energy_resolution, single));
}
XnrgCall(FUNC_WEB_COL_SENSOR);
WSContentSend_P(PSTR("</table><hr/>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
WSContentSend_P(PSTR("</table>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
XnrgCall(FUNC_WEB_SENSOR);
#endif // USE_WEBSERVER
}
Expand Down
1 change: 1 addition & 0 deletions tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ void ShutterToggle(bool dir)
void ShutterShow(){
for (uint32_t i = 0; i < TasmotaGlobal.shutters_present; i++) {
WSContentSend_P(HTTP_MSG_SLIDER_SHUTTER, (Settings->shutter_options[i] & 1) ? D_OPEN : D_CLOSE,(Settings->shutter_options[i] & 1) ? D_CLOSE : D_OPEN, (Settings->shutter_options[i] & 1) ? (100 - ShutterRealToPercentPosition(-9999, i)) : ShutterRealToPercentPosition(-9999, i), i+1);
TasmotaGlobal.NeedSeparatorLine = false; // Do not diplay sensor separation
}
}

Expand Down
4 changes: 2 additions & 2 deletions tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@ const char HTTP_THERMOSTAT_DUTY_CYCLE[] PROGMEM = "{s}" D_THERMOSTAT_DUTY_CY
const char HTTP_THERMOSTAT_CYCLE_TIME[] PROGMEM = "{s}" D_THERMOSTAT_CYCLE_TIME "{m}%d " D_UNIT_MINUTE "{e}";
const char HTTP_THERMOSTAT_CONTROL_METHOD[] PROGMEM = "{s}" D_THERMOSTAT_CONTROL_METHOD "{m}%s{e}";
const char HTTP_THERMOSTAT_PI_AUTOTUNE[] PROGMEM = "{s}" D_THERMOSTAT_PI_AUTOTUNE "{m}%s{e}";
const char HTTP_THERMOSTAT_HL[] PROGMEM = "{s}<hr>{m}<hr>{e}";
const char HTTP_THERMOSTAT_HL_THIN[] PROGMEM = "{s}<hr size=1>{m}<hr size=1>{e}";

#endif // USE_WEBSERVER

Expand All @@ -2078,7 +2078,7 @@ void ThermostatShow(uint8_t ctr_output, bool json)
}
#ifdef USE_WEBSERVER

WSContentSend_P(HTTP_THERMOSTAT_HL);
if (ctr_output) WSContentSend_P(HTTP_THERMOSTAT_HL_THIN);

if (Thermostat[ctr_output].status.thermostat_mode == THERMOSTAT_OFF) {
WSContentSend_P(HTTP_THERMOSTAT_INFO, ctr_output + 1, D_DISABLED );
Expand Down
6 changes: 4 additions & 2 deletions tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ int EQ3SendResult(char *requested, const char *result){
}

#ifdef USE_WEBSERVER
const char HTTP_EQ3_HL[] PROGMEM = "{s}<hr>{m}<hr>{e}";
const char HTTP_EQ3_HL_THIN[] PROGMEM = "{s}<hr size=1>{m}<hr size=1>{e}";
const char HTTP_EQ3_ALIAS[] PROGMEM = "{s}EQ3 %d Alias{m}%s{e}";
const char HTTP_EQ3_MAC[] PROGMEM = "{s}EQ3 %d " D_MAC_ADDRESS "{m}%s{e}";
const char HTTP_EQ3_RSSI[] PROGMEM = "{s}EQ3 %d " D_RSSI "{m}%d dBm{e}";
Expand All @@ -1000,10 +1000,12 @@ const char HTTP_EQ3_BATTERY[] PROGMEM = "{s}EQ3 %d " D_BATTERY "{m}%s{e}";
void EQ3Show(void)
{
char c_unit = D_UNIT_CELSIUS[0]; // ToDo: Check if fahrenheit is possible -> temp_format==TEMP_CELSIUS ? D_UNIT_CELSIUS[0] : D_UNIT_FAHRENHEIT[0];
bool FirstSensorShown = false;

for (int i = 0; i < EQ3_NUM_DEVICESLOTS; i++) {
if (EQ3Devices[i].timeoutTime) {
WSContentSend_P(HTTP_EQ3_HL);
if (FirstSensorShown) WSContentSend_P(HTTP_EQ3_HL_THIN);
FirstSensorShown = true;
const char *alias = BLE_ESP32::getAlias(EQ3Devices[i].addr);
if (alias && *alias){
WSContentSend_PD(HTTP_EQ3_ALIAS, i + 1, alias);
Expand Down
39 changes: 20 additions & 19 deletions tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2723,34 +2723,35 @@ void CmndMi32Keys(void){
* Presentation
\*********************************************************************************************/

const char HTTP_MI32_HL[] PROGMEM = "<tr><td colspan=2><hr>{e}";
const char HTTP_MI32_HL_THIN[] PROGMEM = "{s}<hr size=1>{m}<hr size=1>{e}";
const char HTTP_MI32[] PROGMEM = "{s}MI ESP32 " MI32_VERSION "{m}%u%s / %u{e}";
const char HTTP_MI32_ALIAS[] PROGMEM = "{s}%s Alias{m}%s{e}";
const char HTTP_MI32_MAC[] PROGMEM = "{s}%s %s{m}%s{e}";
const char HTTP_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d dBm{e}";
const char HTTP_BATTERY[] PROGMEM = "{s}%s " D_BATTERY "{m}%u %%{e}";
const char HTTP_LASTBUTTON[] PROGMEM = "{s}%s Last Button{m}%u {e}";
const char HTTP_EVENTS[] PROGMEM = "{s}%s Events{m}%u {e}";
const char HTTP_NMT[] PROGMEM = "{s}%s No motion{m}> %u seconds{e}";
const char HTTP_MI32_FLORA_DATA[] PROGMEM = "{s}%s Fertility{m}%u us/cm{e}";
const char HTTP_MI32_HL[] PROGMEM = "{s}<hr>{m}<hr>{e}";
const char HTTP_MI32_MAC[] PROGMEM = "{s}%s " D_MAC_ADDRESS "{m}%s{e}";
const char HTTP_MI32_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d dBm{e}";
const char HTTP_MI32_BATTERY[] PROGMEM = "{s}%s " D_BATTERY "{m}%u %%{e}";
const char HTTP_MI32_LASTBUTTON[] PROGMEM = "{s}%s Last Button{m}%u{e}";
const char HTTP_MI32_EVENTS[] PROGMEM = "{s}%s Events{m}%u{e}";
const char HTTP_MI32_NMT[] PROGMEM = "{s}%s No motion{m}> %u " D_SECONDS "{e}";
const char HTTP_MI32_FLORA_DATA[] PROGMEM = "{s}%s Fertility{m}%u " D_UNIT_MICROSIEMENS_PER_CM "{e}";
const char HTTP_MI32_LIGHT[] PROGMEM = "{s}%s " D_LIGHT "{m}%d{e}";
const char HTTP_MISCALE_WEIGHT[] PROGMEM = "{s}%s " D_WEIGHT "{m}%*_f %s{e}";
const char HTTP_MISCALE_WEIGHT_REMOVED[] PROGMEM = "{s}%s Weight removed{m}%s{e}";
const char HTTP_MISCALE_WEIGHT_STABILIZED[] PROGMEM = "{s}%s Weight stabilized{m}%s{e}";
const char HTTP_MISCALE_IMPEDANCE[] PROGMEM = "{s}%s Impedance{m}%u{e}";
const char HTTP_MISCALE_IMPEDANCE_STABILIZED[] PROGMEM = "{s}%s Impedance stabilized{m}%s{e}";
const char HTTP_SJWS01LM_FLOODING[] PROGMEM = "{s}%s Flooding{m}%u {e}";
const char HTTP_SJWS01LM_FLOODING[] PROGMEM = "{s}%s Flooding{m}%u{e}";

//const char HTTP_NEEDKEY[] PROGMEM = "{s}%s <a target=\"_blank\" href=\""
// "https://atc1441.github.io/TelinkFlasher.html?mac=%s&cb=http%%3A%%2F%%2F%s%%2Fmikey"
// "\">%s</a>{m} {e}";
// "\">%s</a>{m}{e}";

//const char HTTP_NEEDKEY[] PROGMEM = "{s}%s <a target=\"_blank\" href=\""
// "http://127.0.0.1:8887/keys/TelinkFlasher.html?mac=%s&cb=http%%3A%%2F%%2F%s%%2Fmikey"
// "\">%s</a>{m} {e}";
// "\">%s</a>{m}{e}";
const char HTTP_NEEDKEY[] PROGMEM = "{s}%s <a target=\"_blank\" href=\""
"https://tasmota.github.io/ble_key_extractor?mac=%s&cb=http%%3A%%2F%%2F%s%%2Fmikey"
"\">%s</a>{m} {e}";
"\">%s</a>{m}{e}";


const char HTTP_PAIRING[] PROGMEM = "{s}%s Pair Button Pressed{m} {e}";
Expand Down Expand Up @@ -3521,7 +3522,7 @@ void MI32Show(bool json)

WSContentSend_P(HTTP_MI32, i + 1, stemp, numsensors);
for (i; i<j; i++) {
WSContentSend_P(HTTP_MI32_HL);
WSContentSend_P(HTTP_MI32_HL_THIN);
mi_sensor_t *p;
p = &MIBLEsensors[i];

Expand All @@ -3532,8 +3533,8 @@ void MI32Show(bool json)
}
char _MAC[18];
ToHex_P(p->MAC,6,_MAC,18);//,':');
WSContentSend_P(HTTP_MI32_MAC, typeName, D_MAC_ADDRESS, _MAC);
WSContentSend_PD(HTTP_RSSI, typeName, p->RSSI);
WSContentSend_P(HTTP_MI32_MAC, typeName, _MAC);
WSContentSend_PD(HTTP_MI32_RSSI, typeName, p->RSSI);

// for some reason, display flora differently
switch(p->type){
Expand Down Expand Up @@ -3597,11 +3598,11 @@ void MI32Show(bool json)
#endif //USE_MI_DECRYPTION

if (p->feature.events){
WSContentSend_PD(HTTP_EVENTS, typeName, p->events);
WSContentSend_PD(HTTP_MI32_EVENTS, typeName, p->events);
}
if (p->feature.NMT){
// no motion time
if(p->NMT>0) WSContentSend_PD(HTTP_NMT, typeName, p->NMT);
if(p->NMT>0) WSContentSend_PD(HTTP_MI32_NMT, typeName, p->NMT);
}

if (p->feature.lux){
Expand All @@ -3626,10 +3627,10 @@ void MI32Show(bool json)
}
}
if(p->bat!=0x00){
WSContentSend_PD(HTTP_BATTERY, typeName, p->bat);
WSContentSend_PD(HTTP_MI32_BATTERY, typeName, p->bat);
}
if (p->feature.Btn){
WSContentSend_PD(HTTP_LASTBUTTON, typeName, p->Btn);
WSContentSend_PD(HTTP_MI32_LASTBUTTON, typeName, p->Btn);
}
if (p->feature.flooding)
{
Expand Down
8 changes: 5 additions & 3 deletions tasmota/tasmota_xx2c_global/xdrv_interface.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ bool XdrvCall(uint32_t function) {
#endif // USE_PROFILE_FUNCTION

for (uint32_t x = 0; x < xdrv_present; x++) {
TasmotaGlobal.NeedSeparatorLine = false;

#ifdef USE_PROFILE_FUNCTION
uint32_t profile_function_start = millis();
Expand All @@ -1159,9 +1160,10 @@ bool XdrvCall(uint32_t function) {
if (FUNC_ACTIVE == function) {
bitWrite(Xdrv_active[x / 32], x % 32, result);
}
if (result && (function > FUNC_return_result)) {
break;
}

if (result && (function > FUNC_return_result)) break;

if (FUNC_WEB_SENSOR == function && TasmotaGlobal.NeedSeparatorLine) WSContentSend_P("<tr><td colspan=2><hr>{e}");
}

PROFILE_DRIVER("drv", function, profile_driver_start);
Expand Down
7 changes: 4 additions & 3 deletions tasmota/tasmota_xx2c_global/xsns_interface.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,7 @@ bool XsnsCall(uint32_t function) {
for (uint32_t x = 0; x < xsns_present; x++) {
if (XsnsEnabled(0, x)) { // Skip disabled sensor
if ((FUNC_WEB_SENSOR == function) && !XsnsEnabled(1, x)) { continue; } // Skip web info for disabled sensors
TasmotaGlobal.NeedSeparatorLine = false;

#ifdef USE_PROFILE_FUNCTION
uint32_t profile_function_start = millis();
Expand All @@ -1139,9 +1140,9 @@ bool XsnsCall(uint32_t function) {
PROFILE_FUNCTION("sns", index, function, profile_function_start);
#endif // USE_PROFILE_FUNCTION

if (result && (function > FUNC_return_result)) {
break;
}
if (result && (function > FUNC_return_result)) break;

if (FUNC_WEB_SENSOR == function && TasmotaGlobal.NeedSeparatorLine) WSContentSend_P("<tr><td colspan=2><hr>{e}");

}
}
Expand Down