Skip to content

Commit

Permalink
Core - Fix Fast Channel Switch of VRC-64 (#1357)
Browse files Browse the repository at this point in the history
Co-authored-by: jonpas <[email protected]>
  • Loading branch information
mrschick and jonpas authored Dec 13, 2024
1 parent 6da085d commit b023bec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions addons/api/fnc_getRadioChannel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion addons/api/fnc_setRadioChannel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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]
_eventData = [_channelNumber, 0] // ACRE_PRC77 expects an array of [mhzKnob, khzKnob]
};
[_radioId, "setCurrentChannel", _eventData] call EFUNC(sys_data,dataEvent);
} else {
Expand Down
9 changes: 9 additions & 0 deletions addons/sys_core/fnc_switchChannelFast.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
4 changes: 1 addition & 3 deletions addons/sys_prc77/radio/fnc_getCurrentChannel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@ TRACE_1("GET CURRENT CHANNEL",_this);

params ["", "", "", "_radioData", ""];

private _return = 0;

_return
HASH_GET(_radioData,"currentChannel")

0 comments on commit b023bec

Please sign in to comment.