summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/Hrs3300.cpp9
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) {