Skip to content

Commit

Permalink
bug fix: Issue #14
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahhb committed Feb 11, 2024
1 parent acdbbdf commit 2062e88
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
Binary file not shown.
24 changes: 17 additions & 7 deletions com.f1-tools.mvf1.sdPlugin/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,12 +834,25 @@ const showPlayerTiles = function (device, caller_uuid, payload) {
// save the data for the multi action
multi_action_device_data[device] = new_data;

if (devices[device].size.type == 1) {
// Switch to profile or say that the device type is not supported
if (devices[device].type == 0) {
$SD.switchToProfile(device, 'MVF1 Player Picker');
} else if (devices[device].type == 1) {
$SD.switchToProfile(device, 'MVF1 Player Picker - Mini');
} else if (devices[device].size.type == 2) {
} else if (devices[device].type == 2) {
$SD.switchToProfile(device, 'MVF1 Player Picker - XL');
} else if (devices[device].type == 3) {
$SD.logMessage("Device type not supported: Mobile/" + devices[device].type);
} else if (devices[device].type == 4) {
$SD.logMessage("Device type not supported: Gkeys/" + devices[device].type);
} else if (devices[device].type == 5) {
$SD.logMessage("Device type not supported: Stream Deck Pedals/" + devices[device].type);
} else if (devices[device].type == 6) {
$SD.logMessage("Device type not supported: Voyager/" + devices[device].type);
} else if (devices[device].type == 7) {
$SD.switchToProfile(device, 'MVF1 Player Picker - Plus');
} else {
$SD.switchToProfile(device, 'MVF1 Player Picker');
$SD.logMessage("Device type not supported: " + devices[device].type);
}
updateProfileIcons(device, 0);
});
Expand Down Expand Up @@ -888,12 +901,11 @@ function updateProfileIcons(device, target_page) {
};
}

console.log('new_driver: ' + JSON.stringify(new_driver));
if (new_driver.context !== undefined && new_driver.context !== '' && new_driver.context !== null) {
$SD.setTitle(new_driver.context, new_driver.tla);
$SD.setImage(new_driver.context, new_driver.headshot);
} else {
console.log('Error setting title or image for tile due to no context. TLA: ' + new_driver.tla);
$SD.logMessage('Error setting title or image for tile due to no context. TLA: ' + new_driver.tla);
}
}
}
Expand All @@ -907,8 +919,6 @@ PlayerTile.onWillAppear(({ action, context, device, event, payload }) => {
multi_action_device_data[device].tiles.pages[page_num][coord_string];

// set the tile's context to the driver's id

console.log('setting context for ' + driver.tla + ' to ' + driver.id);
multi_action_device_data[device].tiles.pages[page_num][
coord_string
].context = context;
Expand Down
12 changes: 6 additions & 6 deletions com.f1-tools.mvf1.sdPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
"DeviceType": 0,
"DontAutoSwitchWhenInstalled": false
},
{
"Name": "MVF1 Player Picker",
"ReadOnly": true,
"DeviceType": 3,
"DontAutoSwitchWhenInstalled": false
},
{
"Name": "MVF1 Player Picker - XL",
"ReadOnly": true,
Expand All @@ -47,6 +41,12 @@
"ReadOnly": true,
"DeviceType": 1,
"DontAutoSwitchWhenInstalled": false
},
{
"Name": "MVF1 Player Picker - Plus",
"ReadOnly": true,
"DeviceType": 7,
"DontAutoSwitchWhenInstalled": false
}
],
"Actions": [
Expand Down
15 changes: 12 additions & 3 deletions dev-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@ if [[ "$os" == "Linux" ]]; then
for user in $users; do
if [[ -d "/mnt/c/Users/$user/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState" ]]; then
# found the user
path=$(echo "/mnt/c/Users/$user")
echo "user found: $user"
delpath='C:\Users\'"${user}"'\AppData\Roaming\Elgato\StreamDeck\Plugins\com.f1-tools.mvf1.sdPlugin'
cpath='C:\Users\'"${user}"'\AppData\Roaming\Elgato\StreamDeck\Plugins'
break
else
echo "user not (yet?) found"
fi
done

# kill streamdeck using powershell
powershell.exe -Command "Stop-Process -Name 'StreamDeck'"

# copy plugin
cp -r com.f1-tools.mvf1.sdPlugin "$path/AppData/Roaming/Elgato/StreamDeck/Plugins"
# cp -r com.f1-tools.mvf1.sdPlugin "$path/AppData/Roaming/Elgato/StreamDeck/Plugins"
#remove old plugin first with powershell
powershell.exe -Command "Remove-Item -Path ${delpath} -Recurse -Force"
# copy plugin with powershell
powershell.exe -Command "Copy-Item -Path 'com.f1-tools.mvf1.sdPlugin' -Destination ${cpath} -Recurse"

# start streamdeck using powershell
powershell.exe -Command "Start-Process -FilePath 'C:\Program Files\Elgato\StreamDeck\StreamDeck.exe'"
# open debugger in firefox
powershell.exe -Command "Start-Process 'C:\Program Files\Mozilla Firefox\firefox.exe' -argumentlist '-url http:localhost:23654'"
elif [[ "$os" == "Darwin" ]]; then
# mac
# kill streamdeck
Expand Down

1 comment on commit 2062e88

@jonahhb
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit
Fixes issue #14
Removes support for Stream Deck Mobile (for now)
Adds support for Stream Deck+

Please sign in to comment.