fixes for ina226 driver (#23197)

adjust current/voltage timing to be consistent
fix missing comma in json

Co-authored-by: Anthony Sepa <protectivedad@gmail.com>
This commit is contained in:
protectivedad 2025-03-31 06:45:59 -03:00 committed by GitHub
parent 2f7793ddcf
commit b43d360d37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,7 +78,11 @@
#define INA226_REG_CONFIG (0x00) // Config register
#define INA226_RES_CONFIG (0x4127) // Config register at reset
#define INA226_DEF_CONFIG (0x42FF) // Our default configuration
// 0x4B27 = 0100 101 (256 - averages) 100 (1.1 ms - vbusct) 100 (1.1 ms - vshct) 111 (continuous - mode)
// driver will sample 256 * (1.1 ms + 1.1 ms) = 563.2 ms of data per second
#ifndef INA226_DEF_CONFIG
#define INA226_DEF_CONFIG (0x4B27) // Our default configuration
#endif
#define INA226_CONFIG_RESET (0x8000) // Config register reset bit
#define INA226_REG_SHUNTVOLTAGE (0x01)
@ -460,7 +464,7 @@ bool Ina226CommandSensor()
// Full scale vbus is volatile (saved in RAM)
dtostrfd((Ina226Info[device].vbus_lsb*32768.0), 2, fs_vbus_str);
// Send json response
Response_P(PSTR("{\"Sensor54-device-settings-%d\":{\"SHUNT_R\":%s,\"FS_I\":%s\"FS_V\":%s}}"),
Response_P(PSTR("{\"Sensor54-device-settings-%d\":{\"SHUNT_R\":%s,\"FS_I\":%s,\"FS_V\":%s}}"),
device + 1, shunt_r_str, fs_i_str, fs_vbus_str);
}