diff options
author | JF002 <JF002@users.noreply.github.com> | 2021-02-14 14:27:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-14 14:27:14 +0100 |
commit | 3a1ccdb43ed832460608fb9082ea7c4ce214b005 (patch) | |
tree | 6883f02d33cc22f539c73728bcd732cd5254c8c7 | |
parent | 97a1c4b3d7be04ddb24fea096add41b44629a5f9 (diff) | |
parent | 0ad10a381772f97cb227fba9e1121a833c5bd026 (diff) |
Merge pull request #206 from nscooling/Hrs3300_SetGain_remove_warnings
Eliminated warnings in Hrs3300
-rw-r--r-- | src/drivers/Hrs3300.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp index a16c8e4e..dc9f9cd8 100644 --- a/src/drivers/Hrs3300.cpp +++ b/src/drivers/Hrs3300.cpp @@ -70,13 +70,14 @@ uint16_t Hrs3300::ReadAls() { } void Hrs3300::SetGain(uint8_t gain) { - static constexpr uint8_t maxGain = 64; + constexpr uint8_t maxGain = 64U; gain = std::min(gain, maxGain); uint8_t hgain = 0; - while((1 << hgain) < gain) { - hgain++; - WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2); + while((1 << hgain) < gain){ + ++hgain; } + + WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2); } void Hrs3300::SetDrive(uint8_t drive) { |