Fix min/max for stepSize
This commit is contained in:
parent
4101dfb617
commit
63068c6db7
@ -161,7 +161,7 @@ QUuid AvrConnection::setChannel(const QByteArray &channel)
|
||||
return sendCommand(cmd);
|
||||
}
|
||||
|
||||
QUuid AvrConnection::setVolume(int volume)
|
||||
QUuid AvrConnection::setVolume(uint volume)
|
||||
{
|
||||
qCDebug(dcDenon) << "Set volume" << volume;
|
||||
QByteArray cmd = "MV" + QByteArray::number(volume) + "\r";
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
QUuid getPlayBackInfo();
|
||||
|
||||
QUuid setChannel(const QByteArray &channel);
|
||||
QUuid setVolume(int volume);
|
||||
QUuid setVolume(uint volume);
|
||||
QUuid setMute(bool mute);
|
||||
QUuid setPower(bool power);
|
||||
QUuid setSurroundMode(const QByteArray &surroundMode);
|
||||
|
||||
@ -337,13 +337,13 @@ void IntegrationPluginDenon::executeAction(ThingActionInfo *info)
|
||||
} else if (action.actionTypeId() == AVRX1000IncreaseVolumeActionTypeId) {
|
||||
uint step = action.paramValue(AVRX1000IncreaseVolumeActionStepParamTypeId).toUInt();
|
||||
uint currentVolume = thing->stateValue(AVRX1000VolumeStateTypeId).toUInt();
|
||||
QUuid commandId = avrConnection->setVolume(currentVolume+step);
|
||||
QUuid commandId = avrConnection->setVolume(qMin<uint>(100, currentVolume + step));
|
||||
connect(info, &ThingActionInfo::aborted, [this, commandId] {m_avrPendingActions.remove(commandId);});
|
||||
m_avrPendingActions.insert(commandId, info);
|
||||
} else if (action.actionTypeId() == AVRX1000DecreaseVolumeActionTypeId) {
|
||||
uint step = action.paramValue(AVRX1000DecreaseVolumeActionStepParamTypeId).toUInt();
|
||||
uint currentVolume = thing->stateValue(AVRX1000VolumeStateTypeId).toUInt();
|
||||
QUuid commandId = avrConnection->setVolume(currentVolume-step);
|
||||
QUuid commandId = avrConnection->setVolume(qMax<uint>(0, currentVolume - step));
|
||||
connect(info, &ThingActionInfo::aborted, [this, commandId] {m_avrPendingActions.remove(commandId);});
|
||||
m_avrPendingActions.insert(commandId, info);
|
||||
} else if (action.actionTypeId() == AVRX1000SurroundModeActionTypeId) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user