dac: fix overflow (#238)

This commit is contained in:
Andrey G 2023-04-27 00:01:14 +03:00 committed by GitHub
parent 21202975b9
commit 998d75557d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ void Dac::SetVoltage(int channel, float voltage) {
voltage = clampF(0, voltage, VCC_VOLTS);
m_voltageFloat[channel] = voltage;
dacPutChannelX(m_driver, channel, voltage / VCC_VOLTS * (1 << 12));
dacPutChannelX(m_driver, channel, voltage / VCC_VOLTS * ((1 << 12) - 1));
}
float Dac::GetLastVoltage(int channel)