Skip to content

Commit

Permalink
fix INA228 negative current calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Gusarov committed Nov 21, 2022
1 parent 26895ce commit bcf7f02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/INA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ int32_t INA_Class::getBusMicroAmps(const uint8_t deviceNumber) {
raw = raw >> 4;
} // if-then negative

microAmps = ((int64_t)raw * (int64_t)ina.current_LSB) / 1000ULL;
microAmps = ((int64_t)raw * (int64_t)ina.current_LSB) / 1000LL;
break;
default:
microAmps = (int64_t)readWord(ina.currentRegister, ina.address) * (int64_t)ina.current_LSB /
Expand Down

0 comments on commit bcf7f02

Please sign in to comment.