From c7f2bf8764a6a10a8b5ef4a007a6076303258431 Mon Sep 17 00:00:00 2001 From: ST-TEN-1 Date: Mon, 20 Jun 2022 09:08:34 +0200 Subject: [PATCH] dev --- init.sh | 26 ++++++++++++++++++++++++++ src/test/tecna.py | 12 ++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/test/tecna.py diff --git a/init.sh b/init.sh index dfecb4a..135defb 100755 --- a/init.sh +++ b/init.sh @@ -2,6 +2,17 @@ set -x here="$(realpath "$(dirname "$0")")" cd "$here" +python="python3.10" + +echo "---------- Create support directories ----------" +mkdir -p "tmp" +mkdir -p "test_images" +mkdir -p "neural_networks" +mkdir -p "data/database" +echo "---------- install APT packages ----------" +sudo apt-get install -y "${python}-venv" "${python}-dev" "python3-pip" "python3-setuptools" "p7zip" "p7zip-full" "p7zip-rar" +sudo apt-get install -y "libxcb-xinerama0" + echo "---------- initialize venv ----------" lsof "./venv/bin/python" | awk 'NR > 1 {print $2}' | xargs kill || : @@ -12,4 +23,19 @@ source "./venv/bin/activate" || source "./venv/Scripts/activate" || : python -m pip install --upgrade pip python -m pip install --upgrade -r "src/requirements.txt" +cd "$here/tmp" +wget --continue --timestamping "http://downloads.get-cameras.com/Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.2.2107.9261.tar.gz" +7z x -y "Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.2.2107.9261.tar.gz" +7z x -y "Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.2.2107.9261.tar" +cd "Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.2.2107.9261" +chmod +x "Galaxy_camera.run" +echo -en "\nY\nY\nEn\nY\n" | ./Galaxy_camera.run +cd "$here/tmp" +wget --continue --timestamping "http://downloads.get-cameras.com/Galaxy_Linux_Python_2.0.2106.9041.tar.gz" +7z x -y "Galaxy_Linux_Python_2.0.2106.9041.tar.gz" +7z x -y "Galaxy_Linux_Python_2.0.2106.9041.tar" +cd "Galaxy_Linux_Python_2.0.2106.9041/api" +"${python}" setup.py build +"${python}" setup.py install + cd "$here" diff --git a/src/test/tecna.py b/src/test/tecna.py new file mode 100644 index 0000000..c9653ae --- /dev/null +++ b/src/test/tecna.py @@ -0,0 +1,12 @@ +import pymodbus.exceptions +from pymodbus.client.sync import ModbusSerialClient as ModbusClient +import serial +client = ModbusClient(method="rtu", port="COM3", stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, baudrate=115200, timeout=1, strict=False) +status = client.connect() +read_data = client.read_holding_registers(1, count=1) +if type(read_data) is not pymodbus.exceptions.ModbusIOException: + for i,v in enumerate(read_data): + print(f"READ DATA at {i}:{v}") + pass +else: + print("READ ERROR") \ No newline at end of file