Skip to content

Commit

Permalink
remove feature: websocket timestamp debug
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Jan 27, 2025
1 parent e0669b1 commit 593d38c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 50 deletions.
14 changes: 0 additions & 14 deletions src/components/PixelGraph/PixelGraphBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useEffect, useState } from 'react'
import useStore from '../../store/useStore'
import { useShallow } from 'zustand/shallow'
import hexColor from '../../pages/Devices/EditVirtuals/EditMatrix/Actions/hexColor'
import ws from '../../utils/Websocket'

const PixelGraphBase = ({
virtId,
Expand Down Expand Up @@ -34,7 +33,6 @@ const PixelGraphBase = ({
const showWarning = useStore((state) => state.uiPersist.warnings.lessPixels)
const round = useStore((state) => state.uiPersist.pixelGraphSettings?.round)
const space = useStore((state) => state.uiPersist.pixelGraphSettings?.space)
const features = useStore((state) => state.features)
const stretch = useStore(
(state) => state.uiPersist.pixelGraphSettings?.stretch
)
Expand Down Expand Up @@ -67,18 +65,6 @@ const PixelGraphBase = ({
setPixels(e.detail.pixels)
if (e.detail.shape[0] !== shape[0] && e.detail.shape[1] !== shape[1])
setShape(e.detail.shape)
if (features.websocket_debug) {
if (ws && typeof ws !== 'string' && e.detail.timestamp) {
const request = {
type: 'event',
event_type: 'visualisation_updated',
id: e.detail.rid,
vis_id: virtId,
timestamp: e.detail.timestamp
}
ws.send(JSON.stringify(request))
}
}
}
}
document.addEventListener('visualisation_update', handleWebsockets)
Expand Down
28 changes: 2 additions & 26 deletions src/components/PixelGraph/PixelGraphCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useEffect, useRef } from 'react'
import useStore from '../../store/useStore'
import { useShallow } from 'zustand/shallow'
import hexColor from '../../pages/Devices/EditVirtuals/EditMatrix/Actions/hexColor'
import ws from '../../utils/Websocket'

const PixelGraphCanvas = ({
virtId,
Expand Down Expand Up @@ -35,7 +34,6 @@ const PixelGraphCanvas = ({
config: state.config
}))
)
const features = useStore((state) => state.features)
const smoothing = useStore(
(state) => state.uiPersist.pixelGraphSettings?.smoothing
)
Expand Down Expand Up @@ -88,36 +86,14 @@ const PixelGraphCanvas = ({
imageData.data[index + 3] = 255 // Alpha channel
}
ctx.putImageData(imageData, 0, 0)

if (features.websocket_debug) {
if (ws && typeof ws !== 'string' && e.detail.timestamp) {
const request = {
type: 'event',
event_type: 'visualisation_updated',
id: e.detail.rid,
vis_id: virtId,
timestamp: e.detail.timestamp
}
ws.send(JSON.stringify(request))
}
}
}
}

document.addEventListener('visualisation_update', handleWebsockets)
return () => {
document.removeEventListener('visualisation_update', handleWebsockets)
}
}, [
virtId,
virtuals,
pixelGraphs,
devices,
graphs,
config,
showMatrix,
features.websocket_debug
])
}, [virtId, virtuals, pixelGraphs, devices, graphs, config, showMatrix])

const render =
(virtuals[virtId].active && virtuals[virtId].effect?.name) ||
Expand All @@ -136,7 +112,7 @@ const PixelGraphCanvas = ({
className={`${className} ${active ? 'active' : ''}`}
style={{
maxWidth: fullScreen ? '100vw' : '520px',
maxHeight: fullScreen ? '100vh' : 'unset',
maxHeight: fullScreen ? '100vh' : '380px',
height:
!render || virtuals[virtId]?.config?.rows < 2 || !showMatrix
? '20px'
Expand Down
7 changes: 0 additions & 7 deletions src/pages/Settings/BetaFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ const BetaFeatures = () => {
checked={features.wakelock}
onChange={() => setFeatures('wakelock', !features.wakelock)}
/>
<SettingsRow
title="Websocket debug"
checked={features.websocket_debug}
onChange={() =>
setFeatures('websocket_debug', !features.websocket_debug)
}
/>
{showFeatures.integrations ? (
<SettingsRow
title="Integrations"
Expand Down
3 changes: 0 additions & 3 deletions src/store/ui/storeFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export type IFeatures =
| 'gamepad'
| 'wakelock'
| 'melbankGraph'
| 'websocket_debug'
| 'sceneMostUsed'
| 'scenePlaylist'
| 'sceneRecent'
Expand Down Expand Up @@ -68,7 +67,6 @@ const storeFeatures = (set: any) => ({
matrix_cam: false,
wakelock: false,
melbankGraph: false,
websocket_debug: false,
sceneMostUsed: false,
scenePlaylist: false,
sceneRecent: false,
Expand Down Expand Up @@ -104,7 +102,6 @@ const storeFeatures = (set: any) => ({
matrix_cam: false,
wakelock: false,
melbankGraph: false,
websocket_debug: false,
sceneMostUsed: false,
scenePlaylist: false,
sceneRecent: false,
Expand Down

0 comments on commit 593d38c

Please sign in to comment.