Skip to content

Commit

Permalink
fixed uint into int
Browse files Browse the repository at this point in the history
  • Loading branch information
ol2764RIT committed Feb 24, 2024
1 parent f3fb9f5 commit aacfbd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dev/RedundantADC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ RedundantADC::Status RedundantADC::readVoltage(uint32_t& val1, uint32_t& val2, u
return RedundantADC::Status::OFF_BY_ONE_ERROR;
} else {
// Calculate percentage difference
uint32_t margin0 = (diff01 * 100) / ((adc0ValueUint + adc1ValueUint) / 2);
uint32_t margin1 = (diff02 * 100) / ((adc0ValueUint + adc2ValueUint) / 2);
uint32_t margin2 = (diff12 * 100) / ((adc1ValueUint + adc2ValueUint) / 2);
int32_t margin0 = (diff01 * 100) / ((adc0ValueUint + adc1ValueUint) / 2);
int32_t margin1 = (diff02 * 100) / ((adc0ValueUint + adc2ValueUint) / 2);
int32_t margin2 = (diff12 * 100) / ((adc1ValueUint + adc2ValueUint) / 2);

if (margin0 < MARGIN && margin1 < MARGIN && margin2 < MARGIN) {
return RedundantADC::Status::MARGIN_ERROR;
Expand Down

0 comments on commit aacfbd3

Please sign in to comment.