f1-tools / MVF1-Streamdeck

A Streamdeck plugin for using Multiviewer for Formula 1
MIT License
12 stars 1 forks source link

MacOS: Pressing buttons on profile has no effect, buttons off-profile prompt to install custom profile. #13

Open trevor-coleman opened 1 year ago

trevor-coleman commented 1 year ago

Using a Streamdeck XL. I tried installing the plugin from the store (1.0.0) and from the releases page (1.0.1) and both were the same. Watching FP1 at silverstone.

Summary

The plugin connects to multiviewer and loads the driver pictures, but none of the buttons work. Seems to be an issue with the context object.

System Info

General

StreamDeck

Multiviewer

Custom profile:

Errors

When I first switch to the custom profile I get this is the console:

Setting context for Next Page to 
(6x) app.js:911 Uncaught TypeError: Cannot read properties of undefined (reading 'tla')
    at app.js:911:49
    at action.js:72:57
    at events.js:33:49
    at Set.forEach (<anonymous>)
    at Object.pub (events.js:33:35)
    at ELGSDStreamDeck.emit (events.js:18:75)
    at websocket.onmessage (api.js:232:48)
(anonymous) @ app.js:911
(anonymous) @ action.js:72
(anonymous) @ events.js:33
pub @ events.js:33
emit @ events.js:18
websocket.onmessage @ api.js:232
app.js:911 setting context for HUL to 
app.js:911 setting context for MAG to 
app.js:911 setting context for BOT to 
app.js:911 setting context for SAR to 
app.js:911 setting context for ZHO to 
app.js:911 setting context for DEV to 
app.js:911 setting context for STR to 
app.js:911 setting context for ALB to 
app.js:911 setting context for PIA to 
app.js:911 setting context for RUS to 5
app.js:911 setting context for SAI to 4
app.js:911 setting context for HAM to 8
app.js:911 setting context for OCO to 14
app.js:911 setting context for TSU to 15
app.js:911 setting context for LEC to 12
app.js:911 setting context for ALO to 11
app.js:911 Uncaught TypeError: Cannot read properties of undefined (reading 'tla')
    at app.js:911:49
    at action.js:72:57
    at events.js:33:49
    at Set.forEach (<anonymous>)
    at Object.pub (events.js:33:35)
    at ELGSDStreamDeck.emit (events.js:18:75)
    at websocket.onmessage (api.js:232:48)
(anonymous) @ app.js:911
(anonymous) @ action.js:72
(anonymous) @ events.js:33
pub @ events.js:33
emit @ events.js:18
websocket.onmessage @ api.js:232
app.js:911 setting context for PER to 10
app.js:911 setting context for GAS to 7
app.js:911 setting context for NOR to 9
app.js:911 setting context for VER to 6
app.js:911 setting context for INTERNATIONAL to 
app.js:911 setting context for DATA to 13
app.js:911 setting context for TRACKER to 3
app.js:911 setting context for F1 LIVE to 2

Then when I press a driver button:

Uncaught TypeError: Cannot read properties of undefined (reading 'pages')
    at app.js:948:56
    at action.js:46:54
    at events.js:33:49
    at Set.forEach (<anonymous>)
    at Object.pub (events.js:33:35)
    at ELGSDStreamDeck.emit (events.js:18:75)
    at websocket.onmessage (api.js:232:48)

Actions in default profile

CleanShot 2023-07-07 at 11 37 42@2x

Errors

new_driver: {"number":"27","tla":"HUL","firstName":"Nico","lastName":"Hulkenberg","teamName":"Haas F1 Team","headshot":" [...omitted base64 string]","place":19,"id":"","type":"OBC","context":""}
app.js:896 Error setting title or image for tile due to no context. TLA: HUL

and then

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'context')
    at updateProfileIcons (app.js:887:23)
    at app.js:844:9
updateProfileIcons @ app.js:887
(anonymous) @ app.js:844
Promise.then (async)
showPlayerTiles @ app.js:702
(anonymous) @ app.js:992
(anonymous) @ action.js:59
(anonymous) @ events.js:33
pub @ events.js:33
emit @ events.js:18
websocket.onmessage @ api.js:232
trevor-coleman commented 1 year ago

Ah looks like this might be part of it -- most of the actions have "Show player tiles" as the action. Which is why it's prompting to change to the player tiles.

Speedometer.onKeyUp(({ action, context, device, event, payload }) => {
    showPlayerTiles(device, action, payload);
});
trevor-coleman commented 1 year ago

I noticed a couple places you are comparing to empty objects and arrays like this:

if (x === {} || x === []) 

both of those conditions will always be false -- javascript === compares objects and arrays by reference -- so you are comparing to a new empty object and a new empty array each time.

jonahhb commented 7 months ago

Release 1.0.3 (coming soon) might fix some if not all of this as it had a significant overlap with #14.

trevor-coleman commented 7 months ago

Awesome sauce! Thanks for the update!