diff --git a/protocol/esta/analog/receiver.h b/protocol/esta/analog/receiver.h index 24b0db0..b7ba3c7 100644 --- a/protocol/esta/analog/receiver.h +++ b/protocol/esta/analog/receiver.h @@ -45,16 +45,15 @@ struct Receiver /** * @brief Convert millivolts to an 8-bit level. * @param mV - * @return + * @return \cite ANALOG 5.4 Scale: control is intended to be linear */ uint8_t level(const int16_t mV) const { if (mV <= zero) return 0; - else if ( mV >= full) + if ( mV >= full) return UINT8_MAX; - else - return (mV - zero) / (full - zero); + return UINT8_MAX * ((mV - zero) / (full - zero)); } /**