add options for INA3221 driver (#21310)

* Add files via upload

* Add files via upload

* Add files via upload

* Delete tasmota/xsns_100_ina3221.ino

---------

Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
This commit is contained in:
fb-pilot 2024-05-06 11:42:31 +02:00 committed by GitHub
parent d469f2a565
commit 0d6baa00e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -737,6 +737,9 @@ https://rya.nc/tasmota-fingerprint.html"
// // Both settings together allow to limit searching for INA3221 to only a subset of addresses
// #define INA3221_CALC_CHARGE_AH // calculate charge in Ah
// #define INA3221_CALC_ENERGY_WH // calculate energy in Wh
// #define INA3221_SUPPLY_SIDE 0x7777 // the driver adds the measured Shunt Voltage to the Bus Voltage
// for the cannel with a negativ shunt (shunt <0) thus showing the values of the supply side (IN+)
// additionaly the bits set (bit 0,1,2) enable the scanning of the voltage in the according channel
// #define USE_PMSA003I // [I2cDriver78] Enable PMSA003I Air Quality Sensor (I2C address 0x12) (+1k8 code)
// #define USE_GDK101 // [I2cDriver79] Enable GDK101 sensor (I2C addresses 0x18 - 0x1B) (+1k2 code)
// #define GDK101_SHOW_FW_VERSION

View File

@ -1,7 +1,7 @@
/*
xsns_100_ina3221.ino - INA3221 3-channels Current Sensor support for Tasmota
Copyright (C) 2021 Barbudor and Theo Arends + fb-pilot 2024-4-4, 2024-4-20
Copyright (C) 2021 Barbudor and Theo Arends + fb-pilot
Based on Barbudor's CircuitPython_INA3221
This program is free software: you can redistribute it and/or modify
@ -472,12 +472,14 @@ bool Ina3221CmndSensor(void)
float shunt = CharToFloat(ArgV(argument,2+channel));
Ina3221SetShunt(device, channel, shunt);
}
#ifdef INA3221_SUPPLY_SIDE
if (!Ina3221WriteConfig(device)){
#ifdef DEBUG_TASMOTA_SENSOR
DEBUG_SENSOR_LOG(D_INA3221 "error write configuration %d", device+1);
#endif
return false;
}
#endif
}
Response_P(INA3221_SENSORCMND_START, XSNS_100, device +1, Ina3221Data[device].i2caddr);
for (int channel = 0 ; channel < INA3221_NB_CHAN ; channel++ ) {