From 8b779e78985d54a74fdfebb961deb65df26519d1 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sat, 30 Nov 2024 00:44:17 +0100 Subject: [PATCH 1/3] Fix VRC-64 Fast Channel Switch --- addons/api/fnc_getRadioChannel.sqf | 5 +++++ addons/api/fnc_setRadioChannel.sqf | 7 ++++--- addons/sys_core/fnc_switchChannelFast.sqf | 9 +++++++++ addons/sys_prc77/radio/fnc_getCurrentChannel.sqf | 4 +--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/addons/api/fnc_getRadioChannel.sqf b/addons/api/fnc_getRadioChannel.sqf index c82ae95ba..fa484beed 100644 --- a/addons/api/fnc_getRadioChannel.sqf +++ b/addons/api/fnc_getRadioChannel.sqf @@ -24,4 +24,9 @@ if !(_radioId isEqualType "") exitWith { -1 }; private _channelNumber = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent); if (isNil "_channelNumber") exitWith { -1 }; + +private _radioType = [_radioId] call EFUNC(sys_radio,getRadioBaseClassname); + +if (_radioType == "ACRE_PRC77") exitWith { _channelNumber }; + _channelNumber + 1 diff --git a/addons/api/fnc_setRadioChannel.sqf b/addons/api/fnc_setRadioChannel.sqf index b39ef60fe..7e98c6d25 100644 --- a/addons/api/fnc_setRadioChannel.sqf +++ b/addons/api/fnc_setRadioChannel.sqf @@ -24,9 +24,10 @@ params [ if !(_radioId isEqualType "") exitWith { false }; if (_channelNumber isEqualType 0) then { - private _eventData = _channelNumber - 1; - if (([_radioId] call FUNC(getBaseRadio)) == "ACRE_PRC77") then { - _eventData = [_eventData, 0]; // ACRE_PRC77 expects an array of [mhzKnob, khzKnob] + private _eventData = if (([_radioId] call FUNC(getBaseRadio)) == "ACRE_PRC77") then { + [_channelNumber, 0] // ACRE_PRC77 expects an array of [mhzKnob, khzKnob] + } else { + _channelNumber - 1 }; [_radioId, "setCurrentChannel", _eventData] call EFUNC(sys_data,dataEvent); } else { diff --git a/addons/sys_core/fnc_switchChannelFast.sqf b/addons/sys_core/fnc_switchChannelFast.sqf index aeb941add..6794db9ac 100644 --- a/addons/sys_core/fnc_switchChannelFast.sqf +++ b/addons/sys_core/fnc_switchChannelFast.sqf @@ -37,6 +37,15 @@ if (_isManpack == 0 || {_isRackRadio}) then { case "ACRE_PRC152": { _channel = (_channel + _dir) min 5; }; + case "ACRE_PRC77": { + _channel = (_channel select 0) + _dir; + if (_channel > 22) then { + _channel = 0; + }; + if (_channel < 0) then { + _channel = 22; + }; + }; default { _channel = _channel + _dir; }; diff --git a/addons/sys_prc77/radio/fnc_getCurrentChannel.sqf b/addons/sys_prc77/radio/fnc_getCurrentChannel.sqf index acd0162a7..03b796c93 100644 --- a/addons/sys_prc77/radio/fnc_getCurrentChannel.sqf +++ b/addons/sys_prc77/radio/fnc_getCurrentChannel.sqf @@ -23,6 +23,4 @@ TRACE_1("GET CURRENT CHANNEL",_this); params ["", "", "", "_radioData", ""]; -private _return = 0; - -_return +HASH_GET(_radioData,"currentChannel") From 805cdf2a573f155c679b11f52374002542a3c06a Mon Sep 17 00:00:00 2001 From: Fabio Schick <58027418+mrschick@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:29:40 +0100 Subject: [PATCH 2/3] Suggestion to revert Co-authored-by: jonpas --- addons/api/fnc_setRadioChannel.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/api/fnc_setRadioChannel.sqf b/addons/api/fnc_setRadioChannel.sqf index 7e98c6d25..dea096611 100644 --- a/addons/api/fnc_setRadioChannel.sqf +++ b/addons/api/fnc_setRadioChannel.sqf @@ -24,10 +24,10 @@ params [ if !(_radioId isEqualType "") exitWith { false }; if (_channelNumber isEqualType 0) then { - private _eventData = if (([_radioId] call FUNC(getBaseRadio)) == "ACRE_PRC77") then { + private _eventData = _channelNumber - 1; + if (([_radioId] call FUNC(getBaseRadio)) == "ACRE_PRC77") then { [_channelNumber, 0] // ACRE_PRC77 expects an array of [mhzKnob, khzKnob] - } else { - _channelNumber - 1 + } }; [_radioId, "setCurrentChannel", _eventData] call EFUNC(sys_data,dataEvent); } else { From 7c1c5807828ceabad1aac52046f7444f845d02d7 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:45:36 +0100 Subject: [PATCH 3/3] fixup Co-Authored-By: jonpas --- addons/api/fnc_setRadioChannel.sqf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/api/fnc_setRadioChannel.sqf b/addons/api/fnc_setRadioChannel.sqf index dea096611..6a8229b84 100644 --- a/addons/api/fnc_setRadioChannel.sqf +++ b/addons/api/fnc_setRadioChannel.sqf @@ -26,8 +26,7 @@ if !(_radioId isEqualType "") exitWith { false }; if (_channelNumber isEqualType 0) then { private _eventData = _channelNumber - 1; if (([_radioId] call FUNC(getBaseRadio)) == "ACRE_PRC77") then { - [_channelNumber, 0] // ACRE_PRC77 expects an array of [mhzKnob, khzKnob] - } + _eventData = [_channelNumber, 0] // ACRE_PRC77 expects an array of [mhzKnob, khzKnob] }; [_radioId, "setCurrentChannel", _eventData] call EFUNC(sys_data,dataEvent); } else {