Skip to content

Commit

Permalink
resistance must be positive
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Aug 5, 2024
1 parent 2f35a1e commit 2badd57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/MycilaJSY.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ namespace Mycila {
float getPower2() const { return _power2; }
float getPowerFactor1() const { return _powerFactor1; }
float getPowerFactor2() const { return _powerFactor2; }
float getResistance1() const { return _current1 == 0 ? 0 : _power1 / (_current1 * _current1); }
float getResistance2() const { return _current2 == 0 ? 0 : _power2 / (_current2 * _current2); }
float getResistance1() const { return _current1 == 0 ? 0 : abs(_power1 / (_current1 * _current1)); }
float getResistance2() const { return _current2 == 0 ? 0 : abs(_power2 / (_current2 * _current2)); }
float getVoltage1() const { return _voltage1; }
float getVoltage2() const { return _voltage2; }
float getDimmedVoltage1() const { return _current1 == 0 || _power1 < 0 ? 0 : _power1 / _current1; }
Expand Down

0 comments on commit 2badd57

Please sign in to comment.