From d0124c876611df4e18175c62375caaa3501149e7 Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Sun, 28 Jan 2024 14:36:06 +0000 Subject: [PATCH 1/3] fix: camera control float encoding --- src/commands/CameraControlCommand.ts | 35 +++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/commands/CameraControlCommand.ts b/src/commands/CameraControlCommand.ts index aa080ee03..5246c4014 100644 --- a/src/commands/CameraControlCommand.ts +++ b/src/commands/CameraControlCommand.ts @@ -133,11 +133,23 @@ export class CameraControlCommand extends BasicWritableCommand> 11) + decimal + + if (invert) real = -real + + props.numberData.push(real) offset += 2 } break From 1fc093aa4e38396f8dfe78f7678193368445c0ab Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Sun, 28 Jan 2024 15:50:53 +0000 Subject: [PATCH 2/3] chore: update tests --- src/commands/__tests__/index.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/commands/__tests__/index.spec.ts b/src/commands/__tests__/index.spec.ts index acbbab28e..59a2e2d7e 100644 --- a/src/commands/__tests__/index.spec.ts +++ b/src/commands/__tests__/index.spec.ts @@ -211,6 +211,8 @@ describe('Commands vs LibAtem', () => { case 'KeFS': // TODO - TMP! case '_MvC': // Not all properties parsed case 'FTSU': // Unkown props getting overwritten by generator: https://github.com/LibAtem/LibAtem/blob/master/LibAtem/Commands/DataTransfer/DataTransferDownloadRequestCommand.cs + case 'CCmd': // LibAtem is incorrect + case 'CCdP': // LibAtem is incorrect continue } From 255ecf20065af873a4d6740967664015f70aa5b2 Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Wed, 7 Feb 2024 23:41:23 +0000 Subject: [PATCH 3/3] wip: simplify --- src/commands/CameraControlCommand.ts | 35 +++++----------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/src/commands/CameraControlCommand.ts b/src/commands/CameraControlCommand.ts index 5246c4014..091266ac5 100644 --- a/src/commands/CameraControlCommand.ts +++ b/src/commands/CameraControlCommand.ts @@ -134,22 +134,9 @@ export class CameraControlCommand extends BasicWritableCommand> 11) + decimal - - if (invert) real = -real + const decodedValue = rawCommand.readInt16BE(offset) - props.numberData.push(real) + // Values are encoded as 5.11 fixed point floats + props.numberData.push(decodedValue / 2048) offset += 2 } break