mirror of https://github.com/rusefi/wideband.git
dac: fix overflow (#238)
This commit is contained in:
parent
21202975b9
commit
998d75557d
|
@ -21,7 +21,7 @@ void Dac::SetVoltage(int channel, float voltage) {
|
||||||
voltage = clampF(0, voltage, VCC_VOLTS);
|
voltage = clampF(0, voltage, VCC_VOLTS);
|
||||||
m_voltageFloat[channel] = voltage;
|
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)
|
float Dac::GetLastVoltage(int channel)
|
||||||
|
|
Loading…
Reference in New Issue