From b87fad5ed4c8401d23c965f5c9a7443b106a3986 Mon Sep 17 00:00:00 2001 From: linuswck Date: Fri, 20 Dec 2024 15:40:54 +0800 Subject: [PATCH] Add hardware specific patch to linien - Correct MHz and Voltage Scaling - Hide Analog Out related GUI Elements - Change default amplitude and frequency values --- ...-common-fast-servo-hardware-specific.patch | 15 ++ ...ien-gui-fast-servo-hardware-specific.patch | 227 ++++++++++++++++++ ...-server-fast-servo-hardware-specific.patch | 22 ++ flake.nix | 3 + 4 files changed, 267 insertions(+) create mode 100644 fast-servo/linien-common-fast-servo-hardware-specific.patch create mode 100644 fast-servo/linien-gui-fast-servo-hardware-specific.patch create mode 100644 fast-servo/linien-server-fast-servo-hardware-specific.patch diff --git a/fast-servo/linien-common-fast-servo-hardware-specific.patch b/fast-servo/linien-common-fast-servo-hardware-specific.patch new file mode 100644 index 0000000..00d03ea --- /dev/null +++ b/fast-servo/linien-common-fast-servo-hardware-specific.patch @@ -0,0 +1,15 @@ +diff --git a/linien-common/linien_common/common.py b/linien-common/linien_common/common.py +index 854d776..a310dbe 100644 +--- a/linien-common/linien_common/common.py ++++ b/linien-common/linien_common/common.py +@@ -25,8 +25,8 @@ from typing import Dict, Iterable, List, Tuple, Union + import numpy as np + from scipy.signal import correlate, resample + +-MHz = 0x10000000 / 8 +-Vpp = ((1 << 14) - 1) / 4 ++MHz = 0x10000000 / 8 * 125 / 100 ++Vpp = (1 << 14) * 0.5 / 0.425 - 1 + # conversion of bits to V + ANALOG_OUT_V = 1.8 / ((2**15) - 1) + diff --git a/fast-servo/linien-gui-fast-servo-hardware-specific.patch b/fast-servo/linien-gui-fast-servo-hardware-specific.patch new file mode 100644 index 0000000..90d7a5d --- /dev/null +++ b/fast-servo/linien-gui-fast-servo-hardware-specific.patch @@ -0,0 +1,227 @@ +diff --git a/linien-gui/linien_gui/ui/general_panel.ui b/linien_gui/ui/general_panel.ui +index 7cf74a7..6c2bd45 100644 +--- a/linien-gui/linien_gui/ui/general_panel.ui ++++ b/linien_gui/ui/general_panel.ui +@@ -128,11 +128,6 @@ + FAST OUT 2 + + +- +- +- ANALOG OUT 0 +- +- + + + +@@ -213,11 +208,6 @@ + FAST OUT 2 + + +- +- +- ANALOG OUT 0 +- +- + + + disabled +@@ -389,6 +379,9 @@ + + ANALOG OUT 0 + ++ ++ false ++ + + + +@@ -399,6 +392,9 @@ + 0 + + ++ ++ false ++ + + + positive +@@ -619,6 +615,9 @@ + + Slow Analog Outputs (0-1.8V) + ++ ++ false ++ + + + +diff --git a/linien-gui/linien_gui/ui/main_window.ui b/linien_gui/ui/main_window.ui +index 3d8b8bf..72f6159 100644 +--- a/linien-gui/linien_gui/ui/main_window.ui ++++ b/linien_gui/ui/main_window.ui +@@ -145,10 +145,10 @@ p, li { white-space: pre-wrap; } + 3 + + +- -1.000000000000000 ++ -0.500000000000000 + + +- 1.000000000000000 ++ 0.500000000000000 + + + 0.100000000000000 +@@ -199,13 +199,13 @@ p, li { white-space: pre-wrap; }lin + 0.000000000000000 + + +- 1.000000000000000 ++ 0.500000000000000 + + + 0.100000000000000 + + +- 1.000000000000000 ++ 0.500000000000000 + + + +@@ -242,7 +242,6 @@ p, li { white-space: pre-wrap; } + + + +- 75 + true + + +@@ -278,7 +277,6 @@ p, li { white-space: pre-wrap; } + + + +- 75 + true + + +@@ -366,7 +364,6 @@ p, li { white-space: pre-wrap; } + + + +- 75 + true + + +diff --git a/linien-gui/linien_gui/ui/modulation_sweep_panel.ui b/linien_gui/ui/modulation_sweep_panel.ui +index 6d8af14..29c8a63 100644 +--- a/linien-gui/linien_gui/ui/modulation_sweep_panel.ui ++++ b/linien_gui/ui/modulation_sweep_panel.ui +@@ -68,7 +68,7 @@ + 3 + + +- 2.000000000000000 ++ 0.500000000000000 + + + 0.100000000000000 +@@ -105,82 +105,82 @@ + + + +- 3.8 kHz ++ 3.04 kHz + + + + +- 1.9 kHz ++ 1.52 kHz + + + + +- 954 Hz ++ 763 Hz + + + + +- 477 Hz ++ 382 Hz + + + + +- 238 Hz ++ 190 Hz + + + + +- 119 Hz ++ 95 Hz + + + + +- 59 Hz ++ 47 Hz + + + + +- 30 Hz ++ 24 Hz + + + + +- 15 Hz ++ 12 Hz + + + + +- 7.5 Hz ++ 6 Hz + + + + +- 3.7 Hz ++ 2.96 Hz + + + + +- 1.9 Hz ++ 1.52 Hz + + + + +- 0.93 Hz ++ 0.74 Hz + + + + +- 0.47 Hz ++ 0.38 Hz + + + + +- 0.23 Hz ++ 0.18 Hz + + + + +- 0.12 Hz ++ 0.10 Hz + + + diff --git a/fast-servo/linien-server-fast-servo-hardware-specific.patch b/fast-servo/linien-server-fast-servo-hardware-specific.patch new file mode 100644 index 0000000..e8eedfa --- /dev/null +++ b/fast-servo/linien-server-fast-servo-hardware-specific.patch @@ -0,0 +1,22 @@ +diff --git a/linien-server/linien_server/parameters.py b/linien-server/linien_server/parameters.py +index 12f16ed..287f304 100644 +--- a/linien-server/linien_server/parameters.py ++++ b/linien-server/linien_server/parameters.py +@@ -311,7 +311,7 @@ class Parameters: + # ------------------- MODULATION PARAMETERS ------------------------------------ + + self.modulation_amplitude = Parameter( +- min_=0, max_=(1 << 14) - 1, start=1 * Vpp, restorable=True, loggable=True ++ min_=0, max_=(1 << 14) - 1, start=0.1 * Vpp, restorable=True, loggable=True + ) + """ + The amplitude of the modulation in internal units. Use Vpp for conversion to +@@ -320,7 +320,7 @@ class Parameters: + """ + + self.modulation_frequency = Parameter( +- min_=0, max_=0xFFFFFFFF, start=15 * MHz, restorable=True, loggable=True ++ min_=0, max_=0xFFFFFFFF, start=1 * MHz, restorable=True, loggable=True + ) + """ + Frequency of the modulation in internal units. Use MHz for conversion to diff --git a/flake.nix b/flake.nix index 3a57b89..aa669d5 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,9 @@ cp -r ${./fast-servo/linien-gateware}/. fast_servo/gateware ''; patches = [ + ./fast-servo/linien-common-fast-servo-hardware-specific.patch + ./fast-servo/linien-server-fast-servo-hardware-specific.patch + ./fast-servo/linien-gui-fast-servo-hardware-specific.patch ./fast-servo/linien-client-ssh-port-change.patch ./fast-servo/linien-server-fast-servo.patch ./fast-servo/linien-gateware-fast-servo.patch