mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 21:26:33 +00:00
6.5.0.11 Add command SetOption64 0/1 to switch between "-" or "_" as sensor index separator
6.5.0.11 20190517 * Add command SetOption64 0/1 to switch between "-" or "_" as sensor index separator impacting DS18X20, DHT, BMP and SHT3X sensor names (#5689)
This commit is contained in:
parent
6177787744
commit
a777bb6cdf
@ -1,4 +1,7 @@
|
||||
/* 6.5.0.10 20190513
|
||||
/* 6.5.0.11 20190517
|
||||
* Add command SetOption64 0/1 to switch between "-" or "_" as sensor index separator impacting DS18X20, DHT, BMP and SHT3X sensor names (#5689)
|
||||
*
|
||||
* 6.5.0.10 20190513
|
||||
* Enable ADC0 by default in my_user_config.h (#5671)
|
||||
* Add user configurable ADC0 to Module and Template configuration compatible with current FLAG options (#5671)
|
||||
* Add support for Shelly 1PM Template {"NAME":"Shelly 1PM","GPIO":[56,0,0,0,82,134,0,0,0,0,0,21,0],"FLAG":2,"BASE":18} (#5716)
|
||||
|
@ -77,7 +77,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
||||
uint32_t button_switch_force_local : 1;// bit 11 (v6.3.0.16) - SetOption61 - Force local operation when button/switch topic is set
|
||||
uint32_t no_hold_retain : 1; // bit 12 (v6.4.1.19) - SetOption62 - Don't use retain flag on HOLD messages
|
||||
uint32_t no_power_feedback : 1; // bit 13 (v6.5.0.9) - SetOption63 - Don't scan relay power state at restart
|
||||
uint32_t spare14 : 1;
|
||||
uint32_t use_underscore : 1; // bit 14 (v6.5.0.12) - SetOption64 - Enable "_" instead of "-" as sensor index separator
|
||||
uint32_t spare15 : 1;
|
||||
uint32_t spare16 : 1;
|
||||
uint32_t spare17 : 1;
|
||||
|
@ -20,6 +20,6 @@
|
||||
#ifndef _SONOFF_VERSION_H_
|
||||
#define _SONOFF_VERSION_H_
|
||||
|
||||
const uint32_t VERSION = 0x0605000A;
|
||||
const uint32_t VERSION = 0x0605000B;
|
||||
|
||||
#endif // _SONOFF_VERSION_H_
|
||||
|
@ -437,6 +437,21 @@ char* NoAlNumToUnderscore(char* dest, const char* source)
|
||||
return dest;
|
||||
}
|
||||
|
||||
char IndexSeparator()
|
||||
{
|
||||
/*
|
||||
// 20 bytes more costly !?!
|
||||
const char separators[] = { "-_" };
|
||||
|
||||
return separators[Settings.flag3.use_underscore];
|
||||
*/
|
||||
if (Settings.flag3.use_underscore) {
|
||||
return '_';
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
|
||||
void SetShortcut(char* str, uint8_t action)
|
||||
{
|
||||
if ('\0' != str[0]) { // There must be at least one character in the buffer
|
||||
|
@ -380,7 +380,7 @@ void Ds18x20Name(uint8_t sensor)
|
||||
}
|
||||
GetTextIndexed(ds18x20_types, sizeof(ds18x20_types), index, kDs18x20Types);
|
||||
if (ds18x20_sensors > 1) {
|
||||
snprintf_P(ds18x20_types, sizeof(ds18x20_types), PSTR("%s-%d"), ds18x20_types, sensor +1);
|
||||
snprintf_P(ds18x20_types, sizeof(ds18x20_types), PSTR("%s%c%d"), ds18x20_types, IndexSeparator(), sensor +1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ void Ds18x20Show(bool json)
|
||||
#endif // USE_KNX
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
snprintf_P(stemp, sizeof(stemp), PSTR("%s-%d"), ds18x20_types, i +1);
|
||||
snprintf_P(stemp, sizeof(stemp), PSTR("%s%c%d"), ds18x20_types, IndexSeparator(), i +1);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, stemp, temperature, TempUnit());
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void DhtInit(void)
|
||||
Dht[i].lastresult = 0;
|
||||
GetTextIndexed(Dht[i].stype, sizeof(Dht[i].stype), Dht[i].type, kSensorNames);
|
||||
if (dht_sensors > 1) {
|
||||
snprintf_P(Dht[i].stype, sizeof(Dht[i].stype), PSTR("%s-%02d"), Dht[i].stype, Dht[i].pin);
|
||||
snprintf_P(Dht[i].stype, sizeof(Dht[i].stype), PSTR("%s%c%02d"), Dht[i].stype, IndexSeparator(), Dht[i].pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ void BmpShow(bool json)
|
||||
char name[10];
|
||||
strlcpy(name, bmp_sensors[bmp_idx].bmp_name, sizeof(name));
|
||||
if (bmp_count > 1) {
|
||||
snprintf_P(name, sizeof(name), PSTR("%s-%02X"), name, bmp_sensors[bmp_idx].bmp_address); // BMXXXX-XX
|
||||
snprintf_P(name, sizeof(name), PSTR("%s%c%02X"), name, IndexSeparator(), bmp_sensors[bmp_idx].bmp_address); // BMXXXX-XX
|
||||
}
|
||||
|
||||
char temperature[33];
|
||||
|
@ -104,7 +104,7 @@ void Sht3xShow(bool json)
|
||||
dtostrfd(t, Settings.flag2.temperature_resolution, temperature);
|
||||
char humidity[33];
|
||||
dtostrfd(h, Settings.flag2.humidity_resolution, humidity);
|
||||
snprintf_P(types, sizeof(types), PSTR("%s-0x%02X"), sht3x_sensors[i].types, sht3x_sensors[i].address); // "SHT3X-0xXX"
|
||||
snprintf_P(types, sizeof(types), PSTR("%s%c0x%02X"), sht3x_sensors[i].types, IndexSeparator(), sht3x_sensors[i].address); // "SHT3X-0xXX"
|
||||
|
||||
if (json) {
|
||||
ResponseAppend_P(JSON_SNS_TEMPHUM, types, temperature, humidity);
|
||||
|
Loading…
x
Reference in New Issue
Block a user