diff options
Diffstat (limited to 'ucs2-vol/src/device_value.cpp')
-rw-r--r-- | ucs2-vol/src/device_value.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ucs2-vol/src/device_value.cpp b/ucs2-vol/src/device_value.cpp index 5a1ad5c..95ea256 100644 --- a/ucs2-vol/src/device_value.cpp +++ b/ucs2-vol/src/device_value.cpp @@ -35,31 +35,31 @@ #define CONTROL_CH_1 0x08U #define CONTROL_CH_2 0x09U -CDeviceValue::CDeviceValue(uint16_t address, DeviceValueType type, uint16_t key) +CDeviceValue::CDeviceValue(uint16_t address, DeviceValueType type, uint16_t key) { this->_is_initial = true; this->_address = address; this->_target_value = 0x01u; this->_actual_value = 0x01u; - + this->_type = type; this->_key = key; - + _tx_payload[0] = CONTROL_MASTER;// 7: master, 8: channel 1, 9: Channel 2 _tx_payload[1] = MUTE_VALUE_HB; //HB:Volume _tx_payload[2] = MUTE_VALUE_LB; //LB:Volume _tx_payload_sz = 3u; } -CDeviceValue::~CDeviceValue() +CDeviceValue::~CDeviceValue() { } void CDeviceValue::ApplyMostValue(uint8_t value, DeviceValueType type, uint8_t tx_payload[]) { uint16_t tmp = MUTE_VALUE; - - switch (type) + + switch (type) { case DEVICE_VAL_LEFT: tmp = 0x80U + 0x37FU - (0x37FU * ((int32_t)value) / (0xFFU)); @@ -80,19 +80,19 @@ void CDeviceValue::ApplyMostValue(uint8_t value, DeviceValueType type, uint8_t t tx_payload[0] = CONTROL_MASTER; break; } - + tx_payload[1] = (uint8_t)((tmp >> 8U) & (uint16_t)0xFFU); //HB:Volume tx_payload[2] = (uint8_t)(tmp & (uint16_t)0xFFU); //LB:Volume } // returns true if target is not actual value -bool CDeviceValue::RequiresUpdate() +bool CDeviceValue::RequiresUpdate() { - if (this->_target_value != this->_actual_value) + if (this->_target_value != this->_actual_value) { return true; } - + return false; } |