Add profile info to drivers

Update release notes and add profile info to some drivers
This commit is contained in:
Theo Arends 2018-07-12 12:19:08 +02:00
parent 29ed5c1a27
commit a489b4a44a
10 changed files with 126 additions and 62 deletions

View File

@ -24,16 +24,42 @@
* Fix KNX bug when doing reply of sensors values
* Fix rules induced LWT message
* Fix possible wifi connection problem (#1366)
* Fix some Pow R2 and S31 checksum errors (#1907)
* Fix display selection of un-available GPIO options in Module Configuration webpage (#2718)
* Fix timer re-trigger within one minute after restart (#2744)
* Fix IRSend not accepting data value of 0 by David Conran (#2751)
* Fix vars on rules by Adrian Scillato (#2769)
* Fix bug in KNX menu by Adrian Scillato (#2770)
* Fix anomalies in rules (#2778)
* Fix HUE bridge V1 software version by Heiko Krupp (#2788)
* Fix Hardware Watchdog restart when using event command (#2853)
* Add Ukrainian language file
* Add KNX support for DS18S20 Temperature sensor
* Add CRC to Settings making future upgrades more fail-safe
* Add feature information to Status 4
* Add tools folder with python script decode-status.py for decoding some status fields like SetOption and Features
* Add Slots on the KNX Web Menu to select Group Addess to receive data to trigger rules
* Add two rule sets of 511 characters using commands rule1, rule2 and rule3
* Add Console Commands to send KNX Commands and KNX Values
* Add Slots on the KNX Web Menu to select Group Addess to send data from console commands
* Add Events to trigger rules when a command or read requests is received from KNX
* Add command SetOption30 to enforce Hass discovery as light group (#1784)
* Add support for BlitzWolf BW-SHP2 (and Homecube, Gosund SP1) Energy Monitoring Smart Socket (#2223)
* Add time in minutes to rule Time#Initialized, Time#set and Time#Minute (#2669)
* Add Eastron SDM630 energy meter by Gennaro Tortone (#2735)
* Add KNX communication enhancement by Adrian Scillato (#2742)
* Add KNX energy data by Adrian Scillato (#2750)
* Add rule support for IrReceive and RfReceive (#2758)
* Add python script fw-server.py in tools folder to create a simple OTA server by Gennaro Tortone (#2759)
* Add rule variables %time% for minutes since midnight, %uptime%, %sunrise% and %sunset% giving time in minutes (#2669)
* Add rules %mem1% to %mem5% variable names storing data in flash (#2780)
* Add rules test on %varx% or %memx% (#2780)
* Add optional token %id% substituting the unique MAC address to fulltopic by Michael Graf (#2794)
* Add support for Sonoff S26 Smart Socket (#2808)
* Add command WebSend [<host>(:<port>,<user>:<password>)] <command> (#2821)
* Add increment and decrement value to command Counter (#2838)
* Add support for Sonoff iFan02 as module 44 introducing command FanSpeed 0..3 (#2839)
* Add source information to command execution to be shown with logging option 3 (#2843)
* Add support for uploading Sonoff Bridge firmware found in tools/fw_efm8bb1 folder build by Portisch using Web Gui File Upload (#2886)
* Add command RfRaw to control Portisch firmware features
* Add support for I2C temperature sensor LM75AD (#2909)
@ -44,52 +70,6 @@
* Add decimal values support for commands ADD, SUB, MULT and SCALE (#3083, #3089)
* Add support for bitflags SetOption50 .. SetOption81 (#3118)
*
* 5.14.0b
* Add Console Commands to send KNX Commands
usage: KnxTx_Cmnd[slot] command
where [slot] is any of the 5 slots on the KNX Menu and command is 0 or 1
example: KnxTx_Cmnd1 0
* Add Console Commands to send KNX Values
usage: KnxTx_Val[slot] value
where [slot] is any of the 5 slots on the KNX Menu and value is a number
example: KnxTx_Val1 35
* Add Slots on the KNX Web Menu to select Group Addess to send data from console commands
* Add Events to trigger rules when a command is received from KNX
usage on rules as: event#KnxRx_Cmnd[slot]
where [slot] is any of the 5 slots on the KNX Menu
example: rule on event#KnxRx_Cmnd1 do VAR1 %value% endon
(where %value% can be 0 or 1)
* Add Events to trigger rules when received read requests from KNX
usage on rules as: event#KnxRx_Req[slot]
where [slot] is any of the 5 slots on the KNX Menu
example: rule on event#KnxRx_Req1 do KnxTx_Val1 35 endon
* Add Slots on the KNX Web Menu to select Group Addess to receive data to trigger rules
* Add two rule sets of 511 characters using commands rule1, rule2 and rule3
* Add Ukranian language file
* Add rule support for IrReceive and RfReceive (#2758)
* Add command WebSend [<host>(:<port>,<user>:<password>)] <command> (#2821)
* Add source information to command execution to be shown with logging option 3 (#2843)
* Fix some Pow R2 and S31 checksum errors (#1907)
* Fix Hardware Watchdog restart when using event command (#2853)
*
* 5.14.0a
* Add feature information to Status 4
* Add tools folder with python script decode-status.py for decoding some status fields like SetOption and Features
* Add Eastron SDM630 energy meter by Gennaro Tortone (#2735)
* Add KNX communication enhancement by Adrian Scillato (#2742)
* Add KNX energy data by Adrian Scillato (#2750)
* Add python script fw-server.py in tools folder to create a simple OTA server by Gennaro Tortone (#2759)
* Add rules %mem1% to %mem5% variable names storing data in flash (#2780)
* Add rules test on %varx% or %memx% (#2780)
* Add optional token %id% substituting the unique MAC address to fulltopic by Michael Graf (#2794)
* Fix display selection of un-available GPIO options in Module Configuration webpage (#2718)
* Fix timer re-trigger within one minute after restart (#2744)
* Fix IRSend not accepting data value of 0 by David Conran (#2751)
* Fix vars on rules by Adrian Scillato (#2769)
* Fix bug in KNX menu by Adrian Scillato (#2770)
* Fix anomalies in rules (#2778)
* Fix HUE bridge V1 software version by Heiko Krupp (#2788)
*
* 5.14.0 20180515
* Update language files
* Update TasmotaSerial to 2.0.0 allowing Hardware Serial Fallback when correct connections are configured

View File

@ -175,8 +175,10 @@ void Ds18b20EverySecond()
{
ds18x20_pin = pin[GPIO_DSB];
if (uptime &1) {
// 2mS
Ds18b20Convert(); // Start conversion, takes up to one second
} else {
// 12mS
if (!Ds18b20Read()) { // Read temperature
AddLogMissed(ds18b20_types, ds18b20_valid);
}

View File

@ -21,6 +21,7 @@
/*********************************************************************************************\
* DS18B20 - Temperature - Multiple sensors
\*********************************************************************************************/
//#define USE_DS18x20_RECONFIGURE // When sensor is lost keep retrying or re-configure
#define DS18S20_CHIPID 0x10 // +/-0.5C 9-bit
#define DS1822_CHIPID 0x22 // +/-2C 12-bit
@ -251,6 +252,7 @@ void Ds18x20Init()
uint64_t ids[DS18X20_MAX_SENSORS];
ds18x20_pin = pin[GPIO_DSB];
OneWireResetSearch();
for (ds18x20_sensors = 0; ds18x20_sensors < DS18X20_MAX_SENSORS; ds18x20_sensors) {
if (!OneWireSearch(ds18x20_sensor[ds18x20_sensors].address)) {
@ -373,12 +375,20 @@ void Ds18x20Name(uint8_t sensor)
void Ds18x20EverySecond()
{
if (uptime &1) {
// 2mS
Ds18x20Convert(); // Start conversion, takes up to one second
} else {
for (uint8_t i = 0; i < ds18x20_sensors; i++) {
// 12mS per device
if (!Ds18x20Read(i)) { // Read temperature
Ds18x20Name(i);
AddLogMissed(ds18x20_types, ds18x20_sensor[ds18x20_sensor[i].index].valid);
#ifdef USE_DS18x20_RECONFIGURE
if (!ds18x20_sensor[ds18x20_sensor[i].index].valid) {
memset(&ds18x20_sensor, 0, sizeof(ds18x20_sensor));
Ds18x20Init(); // Re-configure
}
#endif // USE_DS18x20_RECONFIGURE
}
}
}

View File

@ -193,9 +193,11 @@ void DhtInit()
void DhtEverySecond()
{
if (uptime &1) {
// <1mS
DhtReadPrep();
} else {
for (byte i = 0; i < dht_sensors; i++) {
// DHT11 and AM2301 25mS per sensor, SI7021 5mS per sensor
DhtReadTempHum(i);
}
}

View File

@ -172,7 +172,8 @@ void ShtDetect()
void ShtEverySecond()
{
if (sht_type && !(uptime %3)) { // Update every 3 seconds
if (sht_type && !(uptime %4)) { // Update every 4 seconds
// 344mS
if (!ShtRead()) {
AddLogMissed(sht_types, sht_valid);
// if (!sht_valid) { sht_type = 0; }

View File

@ -228,9 +228,11 @@ void HtuDetect()
void HtuEverySecond()
{
if (92 == (uptime %100)) {
// 1mS
HtuDetect();
}
else if (uptime &1) {
// HTU21: 68mS, SI70xx: 37mS
if (htu_type) {
if (!HtuRead()) {
AddLogMissed(htu_types, htu_valid);

View File

@ -464,9 +464,11 @@ void BmpRead()
void BmpEverySecond()
{
if (91 == (uptime %100)) {
// 1mS
BmpDetect();
}
else if (uptime &1) {
else {
// 2mS
BmpRead();
}
}

View File

@ -73,9 +73,11 @@ void Bh1750Detect()
void Bh1750EverySecond()
{
if (90 == (uptime %100)) {
// 1mS
Bh1750Detect();
}
else if (uptime &1) {
else {
// 1mS
if (bh1750_type) {
if (!Bh1750Read()) {
AddLogMissed(bh1750_types, bh1750_valid);

View File

@ -93,6 +93,11 @@ uint32_t ina219_cal_value = 0;
// The following multiplier is used to convert raw current values to mA, taking into account the current config settings
uint32_t ina219_current_divider_ma = 0;
uint8_t ina219_valid = 0;
float ina219_voltage = 0;
float ina219_current = 0;
char ina219_types[] = "INA219";
bool Ina219SetCalibration(uint8_t mode)
{
uint16_t config = 0;
@ -155,8 +160,20 @@ float Ina219GetCurrent_mA()
return value;
}
bool Ina219Read()
{
ina219_voltage = Ina219GetBusVoltage_V() + (Ina219GetShuntVoltage_mV() / 1000);
ina219_current = Ina219GetCurrent_mA() / 1000;
ina219_valid = SENSOR_MAX_MISS;
return true;
}
/*********************************************************************************************\
* Command Sensor13
*
* 0 - Max 32V 2A range
* 1 - Max 32V 1A range
* 2 - Max 16V 0.4A range
\*********************************************************************************************/
bool Ina219CommandSensor()
@ -176,21 +193,36 @@ bool Ina219CommandSensor()
void Ina219Detect()
{
if (ina219_type) {
return;
}
if (ina219_type) { return; }
for (byte i = 0; i < sizeof(ina219_addresses); i++) {
ina219_address = ina219_addresses[i];
if (Ina219SetCalibration(Settings.ina219_mode)) {
ina219_type = 1;
snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "INA219", ina219_address);
snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, ina219_types, ina219_address);
AddLog(LOG_LEVEL_DEBUG);
break;
}
}
}
void Ina219EverySecond()
{
if (87 == (uptime %100)) {
// 2mS
Ina219Detect();
}
else {
// 3mS
if (ina219_type) {
if (!Ina219Read()) {
AddLogMissed(ina219_types, ina219_valid);
// if (!ina219_valid) { ina219_type = 0; }
}
}
}
}
#ifdef USE_WEBSERVER
const char HTTP_SNS_INA219_DATA[] PROGMEM = "%s"
"{s}INA219 " D_VOLTAGE "{m}%s " D_UNIT_VOLT "{e}"
@ -200,21 +232,19 @@ const char HTTP_SNS_INA219_DATA[] PROGMEM = "%s"
void Ina219Show(boolean json)
{
if (ina219_type) {
if (ina219_valid) {
char voltage[10];
char current[10];
char power[10];
float fvoltage = Ina219GetBusVoltage_V() + (Ina219GetShuntVoltage_mV() / 1000);
float fcurrent = Ina219GetCurrent_mA() / 1000;
float fpower = fvoltage * fcurrent;
dtostrfd(fvoltage, Settings.flag2.voltage_resolution, voltage);
float fpower = ina219_voltage * ina219_current;
dtostrfd(ina219_voltage, Settings.flag2.voltage_resolution, voltage);
dtostrfd(fpower, Settings.flag2.wattage_resolution, power);
dtostrfd(fcurrent, Settings.flag2.current_resolution, current);
dtostrfd(ina219_current, Settings.flag2.current_resolution, current);
if (json) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"INA219\":{\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"),
mqtt_data, voltage, current, power);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"),
mqtt_data, ina219_types, voltage, current, power);
#ifdef USE_DOMOTICZ
if (0 == tele_period) {
DomoticzSensor(DZ_VOLTAGE, voltage);
@ -244,9 +274,12 @@ boolean Xsns13(byte function)
result = Ina219CommandSensor();
}
break;
case FUNC_PREP_BEFORE_TELEPERIOD:
case FUNC_INIT:
Ina219Detect();
break;
case FUNC_EVERY_SECOND:
Ina219EverySecond();
break;
case FUNC_JSON_APPEND:
Ina219Show(1);
break;

View File

@ -249,10 +249,40 @@ boolean XsnsCall(byte Function)
{
boolean result = false;
#ifdef PROFILE_XSNS_EVERY_SECOND
uint32_t profile_start_millis = millis();
#endif // PROFILE_XSNS_EVERY_SECOND
for (byte x = 0; x < xsns_present; x++) {
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND
uint32_t profile_start_millis = millis();
#endif // PROFILE_XSNS_SENSOR_EVERY_SECOND
result = xsns_func_ptr[x](Function);
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND
uint32_t profile_millis = millis() - profile_start_millis;
if (profile_millis) {
if (FUNC_EVERY_SECOND == Function) {
snprintf_P(log_data, sizeof(log_data), PSTR("PRF: At %08u XsnsCall %d to Sensor %d took %u mS"), uptime, Function, x, profile_millis);
AddLog(LOG_LEVEL_DEBUG);
}
}
#endif // PROFILE_XSNS_SENSOR_EVERY_SECOND
if (result) break;
}
#ifdef PROFILE_XSNS_EVERY_SECOND
uint32_t profile_millis = millis() - profile_start_millis;
if (profile_millis) {
if (FUNC_EVERY_SECOND == Function) {
snprintf_P(log_data, sizeof(log_data), PSTR("PRF: At %08u XsnsCall %d took %u mS"), uptime, Function, profile_millis);
AddLog(LOG_LEVEL_DEBUG);
}
}
#endif // PROFILE_XSNS_EVERY_SECOND
return result;
}