@@ -552,7 +552,7 @@ ACS37800ERR ACS37800::readRMS(float *vRMS, float *iRMS)
552
552
volts /= 1000 ; // Convert to Volts
553
553
// Correct for the voltage divider: (RISO1 + RISO2 + RSENSE) / RSENSE
554
554
// Or: (RISO1 + RISO2 + RISO3 + RISO4 + RSENSE) / RSENSE
555
- float resistorMultiplier = ((( float ) _dividerResistance) + (( float ) _senseResistance)) / (( float ) _senseResistance) ;
555
+ float resistorMultiplier = (_dividerResistance + _senseResistance) / _senseResistance;
556
556
volts *= resistorMultiplier;
557
557
if (_printDebug == true )
558
558
{
@@ -631,7 +631,7 @@ ACS37800ERR ACS37800::readInstantaneous(float *vInst, float *iInst, float *pInst
631
631
volts /= 1000 ; // Convert to Volts
632
632
// Correct for the voltage divider: (RISO1 + RISO2 + RSENSE) / RSENSE
633
633
// Or: (RISO1 + RISO2 + RISO3 + RISO4 + RSENSE) / RSENSE
634
- float resistorMultiplier = ((( float ) _dividerResistance) + (( float ) _senseResistance)) / (( float ) _senseResistance) ;
634
+ float resistorMultiplier = (_dividerResistance + _senseResistance) / _senseResistance;
635
635
volts *= resistorMultiplier;
636
636
if (_printDebug == true )
637
637
{
@@ -686,7 +686,7 @@ ACS37800ERR ACS37800::readInstantaneous(float *vInst, float *iInst, float *pInst
686
686
}
687
687
// Datasheet says: 3.08 LSB/mW for the 30A version and 1.03 LSB/mW for the 90A version
688
688
float LSBpermW = 3.08 ; // LSB per mW
689
- LSBpermW *= 30.0 / (( float ) _currentSensingRange) ; // Correct for sensor version
689
+ LSBpermW *= 30.0 / _currentSensingRange; // Correct for sensor version
690
690
power /= LSBpermW; // Convert from codes to mW
691
691
// Correct for the voltage divider: (RISO1 + RISO2 + RSENSE) / RSENSE
692
692
// Or: (RISO1 + RISO2 + RISO3 + RISO4 + RSENSE) / RSENSE
@@ -720,21 +720,21 @@ ACS37800ERR ACS37800::readErrorFlags(ACS37800_REGISTER_2D_t *errorFlags)
720
720
}
721
721
722
722
// Change the value of the sense resistor (Ohms)
723
- void ACS37800::setSenseRes (int newRes)
723
+ void ACS37800::setSenseRes (float newRes)
724
724
{
725
725
_senseResistance = newRes;
726
726
}
727
727
728
728
// Change the value of the voltage divider resistance (Ohms)
729
- void ACS37800::setDividerRes (int newRes)
729
+ void ACS37800::setDividerRes (float newRes)
730
730
{
731
731
_dividerResistance = newRes;
732
732
}
733
733
734
734
// Change the current-sensing range (Amps)
735
735
// ACS37800KMACTR-030B3-I2C is a 30.0 Amp part - as used on the SparkFun Qwiic Power Meter
736
736
// ACS37800KMACTR-090B3-I2C is a 90.0 Amp part
737
- void ACS37800::setCurrentRange (int newCurrent)
737
+ void ACS37800::setCurrentRange (float newCurrent)
738
738
{
739
739
_currentSensingRange = newCurrent;
740
740
}
0 commit comments