This commit is contained in:
ST-TEN-1 2022-06-20 09:08:34 +02:00
parent 9496e78584
commit c7f2bf8764
2 changed files with 38 additions and 0 deletions

26
init.sh
View File

@ -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"

12
src/test/tecna.py Normal file
View File

@ -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")