Merge pull request #206 from nscooling/Hrs3300_SetGain_remove_warnings

Eliminated warnings in Hrs3300
This commit is contained in:
JF002 2021-02-14 14:27:14 +01:00 committed by GitHub
commit 3a1ccdb43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
++hgain;
}
WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2);
}
void Hrs3300::SetDrive(uint8_t drive) {