Skip to content

fix to read sub mA values #7

@savejeff

Description

@savejeff

There is an accidental rounding in the getCurrent function.

to fix this you can use this code to get values between full mA



float Sensor_INA3221_Class::getCurrent(ina3221_ch_t channel) {
	int32_t shunt_uV = 0;
	float current_A = 0;

	shunt_uV = getShuntVoltage(channel);
	current_A = ((float) shunt_uV) / ((int32_t)_shuntRes[channel]) / 1000.0f; // <- here previously the value was rounded needlessly
	return current_A;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions