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

add options for INA3221 driver #21310

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions tasmota/my_user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,9 @@ An online tool to calculate TLS fingerprints is available here at:\n\
// // 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
Expand Down
4 changes: 3 additions & 1 deletion tasmota/tasmota_xsns_sensor/xsns_100_ina3221.ino
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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++ ) {
Expand Down