Merge pull request #6903 from hwstar/development

Fix INA226 JSON in ID field
This commit is contained in:
Theo Arends 2019-11-11 08:48:32 +01:00 committed by GitHub
commit f4fee210ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -31,6 +31,10 @@
* b. Sensor54 12 [full scale current in amperes] e.g. Sensor54 12 3.0 * b. Sensor54 12 [full scale current in amperes] e.g. Sensor54 12 3.0
* c. Sensor54 2 saves the settings and restarts Tasmota. The device should show up after the system boots again. * c. Sensor54 2 saves the settings and restarts Tasmota. The device should show up after the system boots again.
* *
*
* This driver will not probe I2C bus for INA226 devices unless the full scale current is set for a device number.
* It will map device numbers as follows:
*
* Device number to I2C slave address mapping * Device number to I2C slave address mapping
* *
* 1 - 0x40 * 1 - 0x40
@ -38,9 +42,6 @@
* 3 - 0x44 * 3 - 0x44
* 4 - 0x45 * 4 - 0x45
* *
* This driver will not probe I2C bus for INA226 devices unless the full scale current is set for a device number.
* It will map device numbers as follows:
*
* To set shunt resistance and full scale current, use the Sensor54 command interface as follows: * To set shunt resistance and full scale current, use the Sensor54 command interface as follows:
* *
* Sensor54 10 Return channel 1 shunt resistance and full scale current * Sensor54 10 Return channel 1 shunt resistance and full scale current
@ -124,7 +125,7 @@ static void _debug_fval(const char *str, float fval, uint8_t prec = 4 )
{ {
char fstr[32]; char fstr[32];
dtostrfd(fval, prec, fstr); dtostrfd(fval, prec, fstr);
AddLog_P2( LOG_LEVEL_NONE, PSTR("%s: %s"), str, fstr ); AddLog_P2( LOG_LEVEL_DEBUG, PSTR("%s: %s"), str, fstr );
} }
@ -512,7 +513,7 @@ void Ina226Show(bool json)
if (json) { if (json) {
ResponseAppend_P(PSTR(",\"%s\":{\"Id\":%02x,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"), ResponseAppend_P(PSTR(",\"%s\":{\"Id\":%d,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"),
name, i, voltage, current, power); name, i, voltage, current, power);
#ifdef USE_DOMOTICZ #ifdef USE_DOMOTICZ
if (0 == tele_period) { if (0 == tele_period) {