├── .gitignore ├── 01_send_parameters ├── .gitignore ├── L050.txt ├── L084.txt ├── L085.txt ├── L085D.txt ├── L086.txt ├── L087.txt ├── L117.txt ├── L120.txt ├── L144.txt ├── notes.md ├── read_grbl_parameters.py ├── send_grbl_parameters.py ├── send_grbl_parameters2.py ├── send_grbl_parameters3.py └── send_grbl_parameters_ack.py ├── 02_console_demo ├── L086.py ├── grbl_utils.py └── screenshot.png ├── 03_lens_tester_gui ├── .gitignore ├── config.json ├── curve_calibrate.py ├── gui.py ├── gui.ui ├── gui_convert.py ├── icon.ico ├── images.qrc ├── images_rc.py ├── import_keypoints.py ├── keypoints.py ├── lenses │ ├── L084.json │ ├── L085.json │ ├── L085D.json │ ├── L086.json │ ├── L117.json │ ├── L120.json │ └── L144.json ├── logs.py ├── main.py ├── motion.py ├── pos_widget.py ├── preset_widget.py ├── requirements.txt ├── restart.png ├── screenshot.png ├── test_pos_widget.py ├── test_pos_widget.ui ├── tool_rdp.py ├── utils.py └── version.py ├── License ├── README.md ├── firmware ├── 1.1f-SCE2.hex ├── 1.1g-SCE2.hex ├── 1.1h-SCE2 (TTL UART).hex └── stlink-utility.png └── images ├── SCE2_controllers.jpg ├── motorized_zoom_lenses.jpg └── zoom.gif /.gitignore: -------------------------------------------------------------------------------- 1 | *.bat 2 | out 3 | __pycache__ 4 | *.pyc 5 | *.log 6 | *.lnk 7 | 03_lens_tester_gui_curves 8 | 03_lens_tester_gui_curves2 9 | -------------------------------------------------------------------------------- /01_send_parameters/.gitignore: -------------------------------------------------------------------------------- 1 | temp.txt 2 | *.bat -------------------------------------------------------------------------------- /01_send_parameters/L050.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=0 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=13 16 | $24=250 17 | $25=1000 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1= 41 | $I=L085,LS8-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L084.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=6 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=10 16 | $24=250 17 | $25=1500 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1=M120 P1 41 | $I=L084,JWF-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L085.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=6 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=13 16 | $24=1000 17 | $25=250 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1= 41 | $I=L085,LS8-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L085D.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=6 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=13 16 | $24=250 17 | $25=1000 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1= 41 | $I=L085D,9JL-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L086.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=1 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=0 16 | $24=250 17 | $25=1000 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1=G90 G1 A0.3 F1 41 | $I=L086,6ZG-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L087.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=6 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=13 16 | $24=250 17 | $25=2000 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1= 41 | $I=L085,LS8-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L117.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=6 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=8 16 | $24=250 17 | $25=1500 18 | $26=50 19 | $27=1.00 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1=M120 P1 41 | $I=L117,EFJ-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L120.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=6 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=13 16 | $24=1000 17 | $25=250 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1= 41 | $I=L120,DFW-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/L144.txt: -------------------------------------------------------------------------------- 1 | $0=6 2 | $1=255 3 | $2=0 4 | $3=1 5 | $4=1 6 | $5=0 7 | $6=0 8 | $10=19 9 | $11=0.010 10 | $12=0.002 11 | $13=0 12 | $20=0 13 | $21=0 14 | $22=1 15 | $23=13 16 | $24=250 17 | $25=2000 18 | $26=50 19 | $27=0.50 20 | $30=1000 21 | $31=0 22 | $32=0 23 | $100=1600.000 24 | $101=1600.000 25 | $102=1600.000 26 | $103=64.000 27 | $110=2000.000 28 | $111=2000.000 29 | $112=2000.000 30 | $113=80.000 31 | $120=100.000 32 | $121=100.000 33 | $122=100.000 34 | $123=10.000 35 | $130=360.000 36 | $131=360.000 37 | $132=360.000 38 | $133=360.000 39 | $N0=G100P9L144N0S0F6R0 40 | $N1= 41 | $I=L120,DFW-DEMO0 42 | -------------------------------------------------------------------------------- /01_send_parameters/notes.md: -------------------------------------------------------------------------------- 1 | # GRBL control keys 2 | 3 | ``` 4 | $$ (view Grbl settings) 5 | $# (view # parameters) 6 | $G (view parser state) 7 | $I (view build info) 8 | $N (view startup blocks) 9 | $x=value (save Grbl setting) 10 | $Nx=line (save startup block) 11 | $C (check gcode mode) 12 | $X (kill alarm lock) 13 | $H (run homing cycle) 14 | ~ (cycle start) 15 | ! (feed hold) 16 | ? (current status) 17 | ctrl-x (reset Grbl) 18 | ``` 19 | 20 | # GRBL configuration parameters 21 | 22 | ``` 23 | $0=10 (step pulse, usec) 24 | $1=25 (step idle delay, msec) 25 | $2=0 (step port invert mask:00000000 none 00000001 X 00000010 Y 00000011 XY, which correspond to values 0, 1, 2, 3 respectively) 26 | $3=6 (dir port invert mask:00000110) 27 | $4=0 (step enable invert, bool) 28 | $5=0 (limit pins invert, bool) 29 | $6=0 (probe pin invert, bool) 30 | $10=3 (status report mask:00000011) 31 | $11=0.020 (junction deviation, mm) 32 | $12=0.002 (arc tolerance, mm) 33 | $13=0 (report inches, bool) 34 | $20=0 (soft limits, bool) 35 | $21=0 (hard limits, bool) 36 | $22=0 (homing cycle, bool) 37 | $23=1 (homing dir invert mask:00000001) 38 | $24=50.000 (homing feed, mm/min) 39 | $25=635.000 (homing seek, mm/min) 40 | $26=250 (homing debounce, msec) 41 | $27=1.000 (homing pull-off, mm) 42 | $100=314.961 (x, step/mm) 43 | $101=314.961 (y, step/mm) 44 | $102=314.961 (z, step/mm) 45 | $110=635.000 (x max rate, mm/min) 46 | $111=635.000 (y max rate, mm/min) 47 | $112=635.000 (z max rate, mm/min) 48 | $120=50.000 (x accel, mm/sec^2) 49 | $121=50.000 (y accel, mm/sec^2) 50 | $122=50.000 (z accel, mm/sec^2) 51 | $130=225.000 (x max travel, mm) 52 | $131=125.000 (y max travel, mm) 53 | $132=170.000 (z max travel, mm) 54 | ``` 55 | -------------------------------------------------------------------------------- /01_send_parameters/read_grbl_parameters.py: -------------------------------------------------------------------------------- 1 | import time 2 | import os 3 | import serial 4 | import argparse 5 | 6 | parser = argparse.ArgumentParser(description='Read parameters from the SCE2 controller', usage='%(prog)s -p COM20 -l L086.txt') 7 | parser.add_argument('-p', '--port', help='COM port', required=True, type=str) 8 | parser.add_argument('-l', '--lens', help='Parameter file for particular lens', required=True, type=str) 9 | parser.add_argument('-d', '--delay', help='Delay to sleep between each sent parameter line', default=0.001, type=float) 10 | args = parser.parse_args() 11 | 12 | ser = serial.Serial() 13 | ser.port = args.port 14 | ser.baudrate = 115200 15 | ser.timeout = 1 16 | ser.open() 17 | ser.flushInput() 18 | ser.flushOutput() 19 | 20 | 21 | ser.write(bytes("$$\r", 'utf8')) 22 | time.sleep(args.delay) 23 | data1 = "" 24 | print("Reading motion parameters...") 25 | while(1): 26 | packet = ser.read(10).decode("utf-8") 27 | if len(packet)==0: 28 | break 29 | data1 += packet 30 | print(data1) 31 | 32 | 33 | ser.write(bytes("$N\r", 'utf8')) 34 | time.sleep(args.delay) 35 | data2 = "" 36 | print("Reading init parameters...") 37 | while(1): 38 | packet = ser.read(10).decode("utf-8") 39 | if len(packet)==0: 40 | break 41 | data2 += packet 42 | print(data2) 43 | 44 | 45 | ser.write(bytes("$I\r", 'utf8')) 46 | time.sleep(args.delay) 47 | data3 = "" 48 | print("Reading SN parameters...") 49 | while(1): 50 | packet = ser.read(10).decode("utf-8") 51 | if len(packet)==0: 52 | break 53 | data3 += packet 54 | print(data3) 55 | 56 | 57 | 58 | 59 | 60 | data_out = [] 61 | 62 | for line in data1.split("\n"): 63 | if line.strip() not in ["ok", ""]: 64 | data_out.append(line) 65 | 66 | for line in data2.split("\n"): 67 | if line.strip() not in ["ok", ""]: 68 | data_out.append(line) 69 | 70 | for line in data3.split("\n"): 71 | if "VER" in line: 72 | temp1 = line.replace("[","").replace("]","").split(":")[-1] 73 | data_out.append("$I="+temp1) 74 | 75 | 76 | 77 | 78 | f = open(args.lens, "w") 79 | for i in data_out: 80 | f.write(i) 81 | -------------------------------------------------------------------------------- /01_send_parameters/send_grbl_parameters.py: -------------------------------------------------------------------------------- 1 | import time 2 | import os 3 | from tqdm import tqdm 4 | import serial 5 | import argparse 6 | 7 | parser = argparse.ArgumentParser(description='Send parameters to SCE2 controller', usage='%(prog)s -p COM20 -l L086.txt') 8 | parser.add_argument('-p', '--port', help='COM port', required=True, type=str) 9 | parser.add_argument('-l', '--lens', help='Parameter file for particular lens', required=True, type=str) 10 | parser.add_argument('-d', '--delay', help='Delay to sleep between each sent parameter line', default=0.001, type=float) 11 | args = parser.parse_args() 12 | 13 | ser = serial.Serial() 14 | ser.port = args.port 15 | ser.baudrate = 115200 16 | ser.timeout = 2 17 | ser.open() 18 | ser.flushInput() 19 | ser.flushOutput() 20 | 21 | f = open(args.lens, "r") 22 | 23 | content = f.read() 24 | for i in tqdm(range(len(content))): 25 | ser.write(bytes(content[i], 'utf8')) 26 | time.sleep(args.delay) 27 | -------------------------------------------------------------------------------- /01_send_parameters/send_grbl_parameters2.py: -------------------------------------------------------------------------------- 1 | import time 2 | import os 3 | from tqdm import tqdm 4 | import serial 5 | import argparse 6 | 7 | parser = argparse.ArgumentParser(description='Send parameters to SCE2 controller', usage='%(prog)s -p COM20 -l L086.txt') 8 | parser.add_argument('-p', '--port', help='COM port', required=True, type=str) 9 | parser.add_argument('-l', '--lens', help='Parameter file for particular lens', required=True, type=str) 10 | parser.add_argument('-d', '--delay', help='Delay to sleep between each sent parameter line', default=0.001, type=float) 11 | parser.add_argument('-s', '--sn', help='Provide serial number', default=0.001, type=str) 12 | args = parser.parse_args() 13 | 14 | ser = serial.Serial() 15 | ser.port = args.port 16 | ser.baudrate = 115200 17 | ser.timeout = 1 18 | ser.open() 19 | ser.flushInput() 20 | ser.flushOutput() 21 | 22 | f = open(args.lens, "r") 23 | 24 | content = f.readlines() 25 | for i in tqdm(content): 26 | #time.sleep(args.delay) 27 | #print(i.strip()) 28 | ser.flushInput() 29 | ser.flushOutput() 30 | ser.write(bytes(i.strip()+"\r", 'utf8')) 31 | packet = ser.read(2).decode("utf-8") 32 | 33 | if args.sn: 34 | ser.flushInput() 35 | ser.flushOutput() 36 | ser.write(bytes("$I="+args.sn.strip()+"\r", 'utf8')) 37 | packet = ser.read(2).decode("utf-8") 38 | -------------------------------------------------------------------------------- /01_send_parameters/send_grbl_parameters3.py: -------------------------------------------------------------------------------- 1 | import time 2 | import os 3 | from tqdm import tqdm 4 | import serial 5 | import argparse 6 | import serial.tools.list_ports 7 | 8 | parser = argparse.ArgumentParser(description='Send parameters to SCE2 controller', usage='%(prog)s -p COM20 -l L086.txt') 9 | parser.add_argument('-p', '--port', help='COM port', type=str) 10 | parser.add_argument('-l', '--lens', help='Parameter file for particular lens', required=True, type=str) 11 | parser.add_argument('-d', '--delay', help='Delay to sleep between each sent parameter line', default=0.001, type=float) 12 | parser.add_argument('-s', '--sn', help='Provide serial number', default=0.001, type=str) 13 | args = parser.parse_args() 14 | 15 | if args.port == None: 16 | port_list = serial.tools.list_ports.comports() 17 | 18 | for port, desc, hwid in port_list: 19 | #print('-', port, desc) 20 | args.port = port 21 | 22 | print(args.port) 23 | 24 | 25 | ser = serial.Serial() 26 | ser.port = args.port 27 | ser.baudrate = 115200 28 | ser.timeout = 1 29 | ser.open() 30 | ser.flushInput() 31 | ser.flushOutput() 32 | 33 | f = open(args.lens, "r") 34 | 35 | content = f.readlines() 36 | for i in tqdm(content): 37 | #time.sleep(args.delay) 38 | #print(i.strip()) 39 | ser.flushInput() 40 | ser.flushOutput() 41 | ser.write(bytes(i.strip()+"\r", 'utf8')) 42 | packet = ser.read(2).decode("utf-8") 43 | 44 | if args.sn: 45 | ser.flushInput() 46 | ser.flushOutput() 47 | ser.write(bytes("$I="+args.sn.strip()+"\r", 'utf8')) 48 | packet = ser.read(2).decode("utf-8") 49 | -------------------------------------------------------------------------------- /01_send_parameters/send_grbl_parameters_ack.py: -------------------------------------------------------------------------------- 1 | import time 2 | import os 3 | from tqdm import tqdm 4 | import serial 5 | import argparse 6 | 7 | parser = argparse.ArgumentParser(description='Send parameters to SCE2 controller', usage='%(prog)s -p COM20 -l L086.txt') 8 | parser.add_argument('-p', '--port', help='COM port', required=True, type=str) 9 | parser.add_argument('-l', '--lens', help='Parameter file for particular lens', required=True, type=str) 10 | parser.add_argument('-d', '--delay', help='Delay to sleep between each sent parameter line', default=0.001, type=float) 11 | args = parser.parse_args() 12 | 13 | ser = serial.Serial() 14 | ser.port = args.port 15 | ser.baudrate = 115200 16 | ser.timeout = 1 17 | ser.open() 18 | ser.flushInput() 19 | ser.flushOutput() 20 | 21 | f = open(args.lens, "r") 22 | 23 | content = f.readlines() 24 | for i in tqdm(content): 25 | #time.sleep(args.delay) 26 | #print(i.strip()) 27 | ser.flushInput() 28 | ser.flushOutput() 29 | ser.write(bytes(i.strip()+"\r", 'utf8')) 30 | packet = ser.read(2).decode("utf-8") 31 | 32 | -------------------------------------------------------------------------------- /02_console_demo/L086.py: -------------------------------------------------------------------------------- 1 | import serial 2 | import time 3 | import grbl_utils 4 | 5 | 6 | ser = serial.Serial() 7 | ser.port = 'COM20' # Controller com port 8 | ser.baudrate = 115200 # Baud rate when connected over CDC USB is not important 9 | ser.timeout = 10 # max timeout to wait for command response 10 | 11 | ser.open() 12 | ser.flushInput() 13 | ser.flushOutput() 14 | 15 | 16 | 17 | 18 | # Read controller version strings 19 | ver = grbl_utils.send_command(ser, "$I", expecting_lines=3) 20 | grbl_utils.parse_version(ver[0]) 21 | grbl_utils.parse_adc(ver[1]) 22 | 23 | # Switch to ABS positionig mode 24 | grbl_utils.send_command(ser, "G90") 25 | 26 | 27 | # Limit sensor LED ON 28 | # In IR mode should be switched off because of beeding light to sensor 29 | grbl_utils.send_command(ser, "M120 P1") 30 | 31 | 32 | # IRIS open 33 | grbl_utils.send_command(ser, "M114 P1") 34 | 35 | 36 | # IR CUT filter 37 | grbl_utils.send_command(ser, "G90 G1 A0.3 F1") # ON (Visible light) 38 | #grbl_utils.send_command(ser, "G90 G1 A0.7 F1") # OFF (Full spectrum) 39 | 40 | 41 | # Move out of home position X axis, move in small steps. 42 | # 1.1f-SCE2.20211130 can't perform precision homing procedure unless motors 43 | # are moved out of home position. Later should be implemented in firmware 44 | # and this step will not be needed 45 | grbl_utils.unhome_motors(ser, "X") 46 | grbl_utils.unhome_motors(ser, "Y") 47 | grbl_utils.unhome_motors(ser, "Z") 48 | 49 | 50 | # home motors 51 | grbl_utils.send_command(ser, "$HX") 52 | grbl_utils.send_command(ser, "$HY") 53 | grbl_utils.send_command(ser, "$HZ") 54 | 55 | 56 | 57 | # Move wide and narrow angles 58 | #grbl_utils.send_command(ser, "G90 G1 X-4 Y-1.3 Z1.1 F1000") 59 | grbl_utils.send_command(ser, "G90 G1 X-8.2 Y-5.1 Z-2.6 F1000") 60 | grbl_utils.wait_for_idle(ser, echo=False) 61 | time.sleep(1) 62 | 63 | grbl_utils.send_command(ser, "G90 G1 X-7.2 Y-5.9 Z-2.98 F1000") 64 | grbl_utils.wait_for_idle(ser, echo=False) 65 | time.sleep(1) 66 | 67 | grbl_utils.send_command(ser, "G90 G1 X-0.5 Y-5.6 Z-0.7 F1000") 68 | grbl_utils.wait_for_idle(ser, echo=False) 69 | time.sleep(1) 70 | 71 | grbl_utils.send_command(ser, "G90 G1 X2.3 Y-5.6 Z0.24 F1000") 72 | grbl_utils.wait_for_idle(ser, echo=False) 73 | time.sleep(1) 74 | 75 | # Read GRBL status 76 | status_txt = grbl_utils.read_status(ser) 77 | status = grbl_utils.parse_status(status_txt, print_debug=True) 78 | -------------------------------------------------------------------------------- /02_console_demo/grbl_utils.py: -------------------------------------------------------------------------------- 1 | import serial 2 | import time 3 | import inspect 4 | 5 | 6 | class Status(): 7 | status = str 8 | 9 | limit_x = bool 10 | limit_y = bool 11 | limit_z = bool 12 | limit_a = bool 13 | 14 | pos_x = float 15 | pos_y = float 16 | pos_z = float 17 | pos_a = float 18 | 19 | block_buffer_avail = int 20 | rx_buffer_avail = int 21 | 22 | 23 | 24 | def send_command(ser, cmd, echo=True, expecting_lines=1, flush=True): 25 | if flush: 26 | ser.flushInput() 27 | 28 | ser.write(bytes(cmd+"\n", 'utf8')) 29 | if echo: 30 | print("") 31 | print("> "+cmd) 32 | 33 | if expecting_lines == 1: 34 | data_in = ser.readline().decode('utf-8').strip() 35 | if echo: 36 | print("< "+data_in) 37 | return data_in 38 | 39 | 40 | if expecting_lines > 1: 41 | ret = [] 42 | for i in range(expecting_lines): 43 | data_in = ser.readline().decode('utf-8').strip() 44 | if echo: 45 | print("< "+data_in) 46 | ret.append(data_in) 47 | return ret 48 | 49 | 50 | def read_status(ser, echo=True): 51 | retry_cnt = 0 52 | ret = "" 53 | backup_timeout = ser.timeout 54 | ser.timeout = 0.5 55 | if echo: 56 | print("") 57 | print("> ?") 58 | 59 | while True: 60 | status = send_command(ser, "?", echo=False) 61 | if len(status) > 10: 62 | if (status[0] == "<") and (status[-1] == ">"): 63 | ret = status 64 | if retry_cnt > 0: 65 | if echo: 66 | print("* Retry count", retry_cnt) 67 | break 68 | retry_cnt+=1 69 | 70 | ser.timeout = backup_timeout 71 | return ret 72 | 73 | 74 | def wait_for_idle(ser, echo=True): 75 | while True: 76 | status = read_status(ser, echo) 77 | ret = parse_status(status, echo) 78 | 79 | if ret.block_buffer_avail >= 35: 80 | if ret.status == "Idle": 81 | break 82 | 83 | 84 | def parse_status(txt, echo=True, print_debug=False): 85 | # Assume string is formed like this (some portions might be missing): 86 | # 87 | txt = txt.replace('<', '').replace('>', '') 88 | txt_list = txt.split("|") 89 | 90 | if echo: 91 | print(txt_list) 92 | 93 | s = Status() 94 | s.status = txt_list[0] # allways first element 95 | 96 | for p in txt_list[1:]: 97 | #print("* ", p) 98 | 99 | if p[0:2] == "Bf": 100 | temp1 = p.split(":")[1] 101 | s.block_buffer_avail = int(temp1.split(",")[0]) 102 | s.rx_buffer_avail = int(temp1.split(",")[1]) 103 | 104 | if p[0:2] == "Pn": 105 | temp1 = p.split(":")[1] 106 | s.limit_x = "X" in temp1 107 | s.limit_y = "Y" in temp1 108 | s.limit_z = "Z" in temp1 109 | 110 | if p[0:4] == "MPos": 111 | temp1 = p.split(":")[1] 112 | s.pos_x = float(temp1.split(",")[0]) 113 | s.pos_y = float(temp1.split(",")[1]) 114 | s.pos_z = float(temp1.split(",")[2]) 115 | s.pos_a = float(temp1.split(",")[3]) 116 | 117 | # print all elements for debug 118 | if print_debug: 119 | for i in inspect.getmembers(s): 120 | if not i[0].startswith('_'): 121 | if not inspect.ismethod(i[1]): 122 | print(i) 123 | 124 | # TODO: print unparsed sub-strings 125 | return s 126 | 127 | 128 | 129 | def parse_version(txt): 130 | # Assume string is formed like this: 131 | # [VER:1.1f-SCE2.20211130:L086,6ZG-BEG19] 132 | txt = txt.replace('[', '').replace(']', '') 133 | 134 | print() 135 | txt_list = txt.split(':') 136 | print("* Firmware version:", txt_list[1]) 137 | 138 | 139 | id_strings = txt_list[2].split(',') 140 | print("* ID strings:", id_strings) 141 | 142 | for i in id_strings: 143 | if i[0:3] == "6ZG": 144 | print(" o L086 lens detected, SN:", i[4:]) 145 | 146 | for i in id_strings: 147 | if i[0:3] == "D2R": 148 | print(" o SCE2-L086 controller detected, SN:", i[4:]) 149 | 150 | 151 | def parse_adc(txt): 152 | # Assume string is formed like this: 153 | # [TLENS:1743] 154 | txt = txt.replace('[', '').replace(']', '') 155 | 156 | print() 157 | txt_list = txt.split(':') 158 | adc = int(txt_list[1].strip()) 159 | print("* 12 Bit ADC (Vref=3.3V):", adc, "/", round(adc/4096*3.3, 3), "V") 160 | 161 | 162 | 163 | def unhome_motors(ser, axis, step=1, speed=1000): 164 | print("* Moving out of home position:", axis) 165 | while True: 166 | status_txt = read_status(ser, echo=False) 167 | status = parse_status(status_txt, echo=False) 168 | 169 | if axis.upper() == "X": 170 | axis_status = status.limit_x 171 | if axis.upper() == "Y": 172 | axis_status = status.limit_y 173 | if axis.upper() == "Z": 174 | axis_status = status.limit_z 175 | if axis.upper() == "A": 176 | axis_status = status.limit_a 177 | 178 | if axis_status: 179 | cmd = "G91 G"+str(step)+" "+axis+"1 F"+str(speed) 180 | send_command(ser, cmd, echo=False) 181 | wait_for_idle(ser, echo=False) 182 | else: 183 | break 184 | 185 | -------------------------------------------------------------------------------- /02_console_demo/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/02_console_demo/screenshot.png -------------------------------------------------------------------------------- /03_lens_tester_gui/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | __pycache__ 3 | dist 4 | build 5 | .idea 6 | out 7 | *.bat 8 | *.spec 9 | *.log 10 | *.log.* 11 | *.bak 12 | *.bak* 13 | *.lnk 14 | keypoints.txt 15 | tests -------------------------------------------------------------------------------- /03_lens_tester_gui/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "boot_count": 1624, 3 | "clean_exit": true, 4 | "com_baud": 115200, 5 | "com_timeout": 5, 6 | "controller_feedback_interval": 50, 7 | "last_lens": "L084", 8 | "logging_level": "DEBUG", 9 | "port": "COM3210", 10 | "remember_last_com_port": true 11 | } -------------------------------------------------------------------------------- /03_lens_tester_gui/curve_calibrate.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import json 3 | import os 4 | from pathlib import Path 5 | from PyQt5 import QtCore, QtGui, QtWidgets 6 | from PyQt5.QtCore import * 7 | from PyQt5.QtGui import * 8 | from PyQt5.QtWidgets import * 9 | import pyqtgraph as pg 10 | import numpy as np 11 | from scipy.interpolate import CubicSpline 12 | from scipy.interpolate import interp1d 13 | 14 | LENSES_DIR = 'lenses' 15 | 16 | class CurveEditor(QtWidgets.QMainWindow): 17 | def __init__(self): 18 | super().__init__() 19 | self.setWindowTitle("Lens Curve Editor") 20 | self.setGeometry(100, 100, 1200, 800) 21 | 22 | # Create central widget and layout 23 | central_widget = QtWidgets.QWidget() 24 | self.setCentralWidget(central_widget) 25 | layout = QtWidgets.QVBoxLayout(central_widget) 26 | 27 | # Create file selection area 28 | file_layout = QtWidgets.QHBoxLayout() 29 | self.file_combo = QtWidgets.QComboBox() 30 | self.file_combo.setMinimumWidth(300) 31 | file_layout.addWidget(QLabel("Select Lens File:")) 32 | file_layout.addWidget(self.file_combo) 33 | file_layout.addStretch() 34 | layout.addLayout(file_layout) 35 | 36 | # Create curve selection area 37 | curve_layout = QtWidgets.QHBoxLayout() 38 | self.curve_combo = QtWidgets.QComboBox() 39 | self.curve_combo.setMinimumWidth(300) 40 | curve_layout.addWidget(QLabel("Select Curve:")) 41 | curve_layout.addWidget(self.curve_combo) 42 | 43 | # Add Fine tune curve button 44 | self.btn_fine_tune = QPushButton("Fine tune curve") 45 | self.btn_fine_tune.setEnabled(False) 46 | curve_layout.addWidget(self.btn_fine_tune) 47 | 48 | # Add Overwrite curve button 49 | self.btn_overwrite = QPushButton("Overwrite curve") 50 | self.btn_overwrite.setEnabled(False) 51 | curve_layout.addWidget(self.btn_overwrite) 52 | 53 | curve_layout.addStretch() 54 | layout.addLayout(curve_layout) 55 | 56 | # Create plot area 57 | self.plot_widget = pg.PlotWidget() 58 | self.plot_widget.setBackground('w') 59 | self.plot_widget.showGrid(True, True, 0.2) 60 | self.plot_widget.setMenuEnabled(False) 61 | self.plot_widget.hideButtons() 62 | self.plot_widget.addLegend() 63 | layout.addWidget(self.plot_widget) 64 | 65 | # Connect signals 66 | self.file_combo.currentTextChanged.connect(self.load_lens_file) 67 | self.curve_combo.currentTextChanged.connect(self.update_plot) 68 | self.curve_combo.currentTextChanged.connect(self.update_fine_tune_button_state) 69 | self.btn_fine_tune.clicked.connect(self.fine_tune_curve) 70 | self.btn_overwrite.clicked.connect(self.overwrite_curve) 71 | 72 | # Initialize variables 73 | self.current_lens_data = None 74 | self.adjusted_curve = None # Store the adjusted curve data 75 | 76 | # Populate file list and trigger first file selection 77 | self.refresh_files() 78 | if self.file_combo.count() > 0: 79 | self.load_lens_file(self.file_combo.currentText()) 80 | self.update_plot() # Show all curves initially 81 | 82 | def refresh_files(self): 83 | self.file_combo.clear() 84 | if os.path.exists(LENSES_DIR): 85 | for file in os.listdir(LENSES_DIR): 86 | if file.endswith('.json'): 87 | self.file_combo.addItem(file) 88 | 89 | def load_lens_file(self, filename): 90 | if not filename: 91 | return 92 | 93 | filepath = os.path.join(LENSES_DIR, filename) 94 | try: 95 | with open(filepath, 'r') as f: 96 | self.current_lens_data = json.load(f) 97 | 98 | # Update curve combo box 99 | self.curve_combo.clear() 100 | if 'motor' in self.current_lens_data and 'curves' in self.current_lens_data['motor']: 101 | for curve_name in self.current_lens_data['motor']['curves'].keys(): 102 | self.curve_combo.addItem(curve_name) 103 | # Clear the plot when loading a new file 104 | self.plot_widget.clear() 105 | self.update_plot() # Show all curves after loading new file 106 | 107 | # Update fine tune button state 108 | self.update_fine_tune_button_state() 109 | 110 | except Exception as e: 111 | QtWidgets.QMessageBox.critical(self, "Error", f"Failed to load file: {str(e)}") 112 | 113 | def update_plot(self): 114 | if not self.current_lens_data: 115 | return 116 | 117 | self.plot_widget.clear() 118 | selected_curve = self.curve_combo.currentText() 119 | 120 | # Plot all curves 121 | for curve_name, curve_data in self.current_lens_data['motor']['curves'].items(): 122 | x = curve_data['x'] 123 | y = curve_data['y'] 124 | color = curve_data.get('color', '#000000') 125 | 126 | # Make selected curve thicker 127 | width = 3 if curve_name == selected_curve else 1 128 | pen = pg.mkPen(color=color, width=width) 129 | self.plot_widget.plot(x, y, name=curve_name, pen=pen) 130 | 131 | # Plot preset points if they exist 132 | if 'debug_keypoints' in self.current_lens_data: 133 | keypoints = self.current_lens_data['debug_keypoints'] 134 | x_points = [] 135 | y_points = [] 136 | for point in keypoints: 137 | if len(point) >= 2: 138 | x_points.append(point[0]) 139 | y_points.append(point[1]) 140 | 141 | if x_points and y_points: 142 | # Get pixel scale for 30px diagonal lines 143 | view_box = self.plot_widget.getViewBox() 144 | screen_coords = view_box.viewPixelSize() 145 | px_size_x = screen_coords[0] # size of one pixel in x-axis units 146 | px_size_y = screen_coords[1] # size of one pixel in y-axis units 147 | 148 | # Calculate 15px offset (half of 30px) in data coordinates 149 | offset_x = px_size_x * 8 150 | offset_y = px_size_y * 8 151 | 152 | # Plot each point as an X with diagonal lines 153 | for x, y in zip(x_points, y_points): 154 | # Draw diagonal line from top-left to bottom-right 155 | self.plot_widget.plot( 156 | [x - offset_x, x + offset_x], 157 | [y - offset_y, y + offset_y], 158 | pen=pg.mkPen('r', width=1) 159 | ) 160 | # Draw diagonal line from top-right to bottom-left 161 | self.plot_widget.plot( 162 | [x - offset_x, x + offset_x], 163 | [y + offset_y, y - offset_y], 164 | pen=pg.mkPen('r', width=1) 165 | ) 166 | 167 | # Set plot limits based on all curves and points 168 | all_x = [] 169 | all_y = [] 170 | for curve_data in self.current_lens_data['motor']['curves'].values(): 171 | all_x.extend(curve_data['x']) 172 | all_y.extend(curve_data['y']) 173 | 174 | # Include preset points in range calculation if they exist 175 | if 'debug_keypoints' in self.current_lens_data: 176 | for point in self.current_lens_data['debug_keypoints']: 177 | if len(point) >= 2: 178 | all_x.append(point[0]) 179 | all_y.append(point[1]) 180 | 181 | if all_x and all_y: 182 | self.plot_widget.setXRange(min(all_x), max(all_x)) 183 | self.plot_widget.setYRange(min(all_y), max(all_y)) 184 | 185 | def update_fine_tune_button_state(self): 186 | can_fine_tune = ( 187 | self.current_lens_data is not None and 188 | 'debug_keypoints' in self.current_lens_data and 189 | len(self.current_lens_data.get('debug_keypoints', [])) > 0 and 190 | bool(self.curve_combo.currentText()) 191 | ) 192 | self.btn_fine_tune.setEnabled(can_fine_tune) 193 | self.btn_overwrite.setEnabled(False) # Reset overwrite button state 194 | self.adjusted_curve = None # Clear any stored adjusted curve 195 | 196 | def fine_tune_curve(self): 197 | if not self.current_lens_data or not self.curve_combo.currentText(): 198 | return 199 | 200 | selected_curve = self.curve_combo.currentText() 201 | curve_data = self.current_lens_data['motor']['curves'][selected_curve] 202 | keypoints = self.current_lens_data['debug_keypoints'] 203 | 204 | # Extract x, y coordinates from curve and keypoints 205 | curve_x = np.array(curve_data['x']) 206 | curve_y = np.array(curve_data['y']) 207 | keypoint_x = np.array([p[0] for p in keypoints]) 208 | keypoint_y = np.array([p[1] for p in keypoints]) 209 | 210 | # Ensure curve is properly ordered (ascending x) 211 | if curve_x[0] > curve_x[-1]: 212 | sort_idx = np.argsort(curve_x) 213 | curve_x = curve_x[sort_idx] 214 | curve_y = curve_y[sort_idx] 215 | 216 | # Sort keypoints by x coordinate and remove duplicates 217 | unique_indices = np.unique(keypoint_x, return_index=True)[1] 218 | keypoint_x = keypoint_x[unique_indices] 219 | keypoint_y = keypoint_y[unique_indices] 220 | 221 | sort_idx = np.argsort(keypoint_x) 222 | keypoint_x = keypoint_x[sort_idx] 223 | keypoint_y = keypoint_y[sort_idx] 224 | 225 | # Ensure keypoints are within curve x range 226 | x_min = min(curve_x[0], curve_x[-1]) 227 | x_max = max(curve_x[0], curve_x[-1]) 228 | margin = 0.001 229 | mask = (keypoint_x >= x_min - margin) & (keypoint_x <= x_max + margin) 230 | keypoint_x = keypoint_x[mask] 231 | keypoint_y = keypoint_y[mask] 232 | 233 | if len(keypoint_x) < 2: 234 | QtWidgets.QMessageBox.warning(self, "Warning", 235 | f"Not enough valid keypoints for adjustment. Found {len(keypoint_x)}, need at least 2.") 236 | return 237 | 238 | try: 239 | # Create interpolator for original curve 240 | original_interp = interp1d(curve_x, curve_y, kind='linear', fill_value='extrapolate') 241 | 242 | # Calculate y values and slopes on original curve at keypoint x positions 243 | dx = 0.01 # Small delta for numerical derivative 244 | original_y_at_keypoints = original_interp(keypoint_x) 245 | original_slopes = [] 246 | for x in keypoint_x: 247 | slope = (original_interp(x + dx) - original_interp(x - dx)) / (2 * dx) 248 | original_slopes.append(slope) 249 | original_slopes = np.array(original_slopes) 250 | 251 | # Calculate the difference between keypoints and original curve 252 | y_differences = keypoint_y - original_y_at_keypoints 253 | 254 | # Add virtual keypoints at endpoints 255 | virtual_dx = (x_max - x_min) * 0.01 # 1% of range for closer control 256 | extended_x = np.concatenate([ 257 | [curve_x[0] - virtual_dx], 258 | keypoint_x, 259 | [curve_x[-1] + virtual_dx] 260 | ]) 261 | 262 | # Calculate virtual y-differences at endpoints 263 | left_diff = y_differences[0] 264 | right_diff = y_differences[-1] 265 | extended_diffs = np.concatenate([[left_diff], y_differences, [right_diff]]) 266 | 267 | # Calculate slopes for the differences at keypoints (maintain original curve slope) 268 | extended_slopes = np.concatenate([[0], np.zeros_like(original_slopes), [0]]) 269 | 270 | # Create cubic spline interpolator for the differences with controlled derivatives 271 | diff_spline = CubicSpline( 272 | extended_x, 273 | extended_diffs, 274 | bc_type='natural', 275 | axis=0 276 | ) 277 | 278 | # Calculate adjustment for each point on the curve 279 | adjustments = diff_spline(curve_x) 280 | 281 | # Apply adjustments to get final curve 282 | adjusted_y = curve_y + adjustments 283 | 284 | # Store the adjusted curve data 285 | self.adjusted_curve = { 286 | 'x': curve_x.tolist(), 287 | 'y': adjusted_y.tolist() 288 | } 289 | 290 | # Enable the overwrite button now that we have an adjusted curve 291 | self.btn_overwrite.setEnabled(True) 292 | 293 | # Plot the adjusted curve 294 | pen = pg.mkPen(color='#FF00FF', width=2) # Magenta color for adjusted curve 295 | self.plot_widget.plot(curve_x, adjusted_y, name=f"{selected_curve}_adjusted", pen=pen) 296 | 297 | # Plot anchor points for visualization 298 | scatter = pg.ScatterPlotItem( 299 | x=keypoint_x, 300 | y=keypoint_y, 301 | symbol='o', 302 | size=8, 303 | pen=pg.mkPen('m', width=1), 304 | brush=pg.mkBrush('m') 305 | ) 306 | self.plot_widget.addItem(scatter) 307 | 308 | except ValueError as e: 309 | QtWidgets.QMessageBox.critical(self, "Error", 310 | f"Failed to create adjustment spline: {str(e)}\nKeypoints: {list(zip(keypoint_x, keypoint_y))}") 311 | return 312 | 313 | def overwrite_curve(self): 314 | if not self.adjusted_curve or not self.current_lens_data: 315 | return 316 | 317 | try: 318 | selected_curve = self.curve_combo.currentText() 319 | current_file = self.file_combo.currentText() 320 | filepath = os.path.join(LENSES_DIR, current_file) 321 | 322 | # Update the curve data in memory 323 | curve_data = self.current_lens_data['motor']['curves'][selected_curve] 324 | curve_data['x'] = self.adjusted_curve['x'] 325 | curve_data['y'] = self.adjusted_curve['y'] 326 | 327 | # Save the updated JSON file 328 | with open(filepath, 'w') as f: 329 | json.dump(self.current_lens_data, f, indent=2) 330 | 331 | # Reload the file to refresh everything 332 | self.load_lens_file(current_file) 333 | 334 | # Show success message 335 | QtWidgets.QMessageBox.information(self, "Success", "Curve has been updated successfully!") 336 | 337 | except Exception as e: 338 | QtWidgets.QMessageBox.critical(self, "Error", f"Failed to save changes: {str(e)}") 339 | return 340 | 341 | def main(): 342 | app = QtWidgets.QApplication(sys.argv) 343 | window = CurveEditor() 344 | window.show() 345 | sys.exit(app.exec_()) 346 | 347 | if __name__ == '__main__': 348 | main() 349 | -------------------------------------------------------------------------------- /03_lens_tester_gui/gui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'gui.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.10 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_MainWindow(object): 15 | def setupUi(self, MainWindow): 16 | MainWindow.setObjectName("MainWindow") 17 | MainWindow.resize(1020, 947) 18 | self.centralwidget = QtWidgets.QWidget(MainWindow) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) 21 | self.gridLayout.setObjectName("gridLayout") 22 | self.horizontalLayout_5 = QtWidgets.QHBoxLayout() 23 | self.horizontalLayout_5.setObjectName("horizontalLayout_5") 24 | self.horizontalLayout_4 = QtWidgets.QHBoxLayout() 25 | self.horizontalLayout_4.setObjectName("horizontalLayout_4") 26 | self.label_61 = QtWidgets.QLabel(self.centralwidget) 27 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) 28 | sizePolicy.setHorizontalStretch(0) 29 | sizePolicy.setVerticalStretch(0) 30 | sizePolicy.setHeightForWidth(self.label_61.sizePolicy().hasHeightForWidth()) 31 | self.label_61.setSizePolicy(sizePolicy) 32 | self.label_61.setObjectName("label_61") 33 | self.horizontalLayout_4.addWidget(self.label_61) 34 | self.label_buffer_count = QtWidgets.QLabel(self.centralwidget) 35 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 36 | sizePolicy.setHorizontalStretch(0) 37 | sizePolicy.setVerticalStretch(0) 38 | sizePolicy.setHeightForWidth(self.label_buffer_count.sizePolicy().hasHeightForWidth()) 39 | self.label_buffer_count.setSizePolicy(sizePolicy) 40 | self.label_buffer_count.setMinimumSize(QtCore.QSize(20, 0)) 41 | self.label_buffer_count.setObjectName("label_buffer_count") 42 | self.horizontalLayout_4.addWidget(self.label_buffer_count) 43 | self.horizontalLayout_5.addLayout(self.horizontalLayout_4) 44 | self.line = QtWidgets.QFrame(self.centralwidget) 45 | self.line.setFrameShadow(QtWidgets.QFrame.Plain) 46 | self.line.setFrameShape(QtWidgets.QFrame.VLine) 47 | self.line.setObjectName("line") 48 | self.horizontalLayout_5.addWidget(self.line) 49 | self.horizontalLayout_6 = QtWidgets.QHBoxLayout() 50 | self.horizontalLayout_6.setObjectName("horizontalLayout_6") 51 | self.label_59 = QtWidgets.QLabel(self.centralwidget) 52 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) 53 | sizePolicy.setHorizontalStretch(0) 54 | sizePolicy.setVerticalStretch(0) 55 | sizePolicy.setHeightForWidth(self.label_59.sizePolicy().hasHeightForWidth()) 56 | self.label_59.setSizePolicy(sizePolicy) 57 | self.label_59.setObjectName("label_59") 58 | self.horizontalLayout_6.addWidget(self.label_59) 59 | self.label_motion_status = QtWidgets.QLabel(self.centralwidget) 60 | self.label_motion_status.setMinimumSize(QtCore.QSize(40, 0)) 61 | self.label_motion_status.setObjectName("label_motion_status") 62 | self.horizontalLayout_6.addWidget(self.label_motion_status) 63 | self.horizontalLayout_5.addLayout(self.horizontalLayout_6) 64 | self.line_2 = QtWidgets.QFrame(self.centralwidget) 65 | self.line_2.setFrameShadow(QtWidgets.QFrame.Plain) 66 | self.line_2.setFrameShape(QtWidgets.QFrame.VLine) 67 | self.line_2.setObjectName("line_2") 68 | self.horizontalLayout_5.addWidget(self.line_2) 69 | self.horizontalLayout_7 = QtWidgets.QHBoxLayout() 70 | self.horizontalLayout_7.setObjectName("horizontalLayout_7") 71 | self.label_60 = QtWidgets.QLabel(self.centralwidget) 72 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) 73 | sizePolicy.setHorizontalStretch(0) 74 | sizePolicy.setVerticalStretch(0) 75 | sizePolicy.setHeightForWidth(self.label_60.sizePolicy().hasHeightForWidth()) 76 | self.label_60.setSizePolicy(sizePolicy) 77 | self.label_60.setObjectName("label_60") 78 | self.horizontalLayout_7.addWidget(self.label_60) 79 | self.s_controller_fw = QtWidgets.QLabel(self.centralwidget) 80 | self.s_controller_fw.setMinimumSize(QtCore.QSize(200, 0)) 81 | self.s_controller_fw.setObjectName("s_controller_fw") 82 | self.horizontalLayout_7.addWidget(self.s_controller_fw) 83 | self.horizontalLayout_5.addLayout(self.horizontalLayout_7) 84 | self.line_8 = QtWidgets.QFrame(self.centralwidget) 85 | self.line_8.setFrameShadow(QtWidgets.QFrame.Plain) 86 | self.line_8.setFrameShape(QtWidgets.QFrame.VLine) 87 | self.line_8.setObjectName("line_8") 88 | self.horizontalLayout_5.addWidget(self.line_8) 89 | self.horizontalLayout_8 = QtWidgets.QHBoxLayout() 90 | self.horizontalLayout_8.setObjectName("horizontalLayout_8") 91 | self.label_62 = QtWidgets.QLabel(self.centralwidget) 92 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) 93 | sizePolicy.setHorizontalStretch(0) 94 | sizePolicy.setVerticalStretch(0) 95 | sizePolicy.setHeightForWidth(self.label_62.sizePolicy().hasHeightForWidth()) 96 | self.label_62.setSizePolicy(sizePolicy) 97 | self.label_62.setObjectName("label_62") 98 | self.horizontalLayout_8.addWidget(self.label_62) 99 | self.s_status = QtWidgets.QLabel(self.centralwidget) 100 | self.s_status.setMinimumSize(QtCore.QSize(50, 0)) 101 | self.s_status.setObjectName("s_status") 102 | self.horizontalLayout_8.addWidget(self.s_status) 103 | self.horizontalLayout_5.addLayout(self.horizontalLayout_8) 104 | self.line_3 = QtWidgets.QFrame(self.centralwidget) 105 | self.line_3.setFrameShadow(QtWidgets.QFrame.Plain) 106 | self.line_3.setFrameShape(QtWidgets.QFrame.VLine) 107 | self.line_3.setObjectName("line_3") 108 | self.horizontalLayout_5.addWidget(self.line_3) 109 | self.horizontalLayout_9 = QtWidgets.QHBoxLayout() 110 | self.horizontalLayout_9.setObjectName("horizontalLayout_9") 111 | self.label_63 = QtWidgets.QLabel(self.centralwidget) 112 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) 113 | sizePolicy.setHorizontalStretch(0) 114 | sizePolicy.setVerticalStretch(0) 115 | sizePolicy.setHeightForWidth(self.label_63.sizePolicy().hasHeightForWidth()) 116 | self.label_63.setSizePolicy(sizePolicy) 117 | self.label_63.setObjectName("label_63") 118 | self.horizontalLayout_9.addWidget(self.label_63) 119 | self.label_response = QtWidgets.QLabel(self.centralwidget) 120 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) 121 | sizePolicy.setHorizontalStretch(0) 122 | sizePolicy.setVerticalStretch(0) 123 | sizePolicy.setHeightForWidth(self.label_response.sizePolicy().hasHeightForWidth()) 124 | self.label_response.setSizePolicy(sizePolicy) 125 | self.label_response.setMinimumSize(QtCore.QSize(300, 0)) 126 | self.label_response.setObjectName("label_response") 127 | self.horizontalLayout_9.addWidget(self.label_response) 128 | self.horizontalLayout_5.addLayout(self.horizontalLayout_9) 129 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 130 | self.horizontalLayout_5.addItem(spacerItem) 131 | self.gridLayout.addLayout(self.horizontalLayout_5, 5, 0, 1, 1) 132 | self.line_9 = QtWidgets.QFrame(self.centralwidget) 133 | self.line_9.setFrameShadow(QtWidgets.QFrame.Plain) 134 | self.line_9.setFrameShape(QtWidgets.QFrame.HLine) 135 | self.line_9.setObjectName("line_9") 136 | self.gridLayout.addWidget(self.line_9, 4, 0, 1, 1) 137 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout() 138 | self.horizontalLayout_3.setObjectName("horizontalLayout_3") 139 | self.verticalLayout = QtWidgets.QVBoxLayout() 140 | self.verticalLayout.setObjectName("verticalLayout") 141 | self.horizontalLayout_22 = QtWidgets.QHBoxLayout() 142 | self.horizontalLayout_22.setObjectName("horizontalLayout_22") 143 | self.group_x_axis = QtWidgets.QGroupBox(self.centralwidget) 144 | self.group_x_axis.setEnabled(True) 145 | self.group_x_axis.setObjectName("group_x_axis") 146 | self.gridLayout_2 = QtWidgets.QGridLayout(self.group_x_axis) 147 | self.gridLayout_2.setObjectName("gridLayout_2") 148 | self.horizontalLayout_22.addWidget(self.group_x_axis) 149 | self.verticalLayout.addLayout(self.horizontalLayout_22) 150 | self.horizontalLayout_3.addLayout(self.verticalLayout) 151 | self.win = GraphicsLayoutWidget(self.centralwidget) 152 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) 153 | sizePolicy.setHorizontalStretch(0) 154 | sizePolicy.setVerticalStretch(0) 155 | sizePolicy.setHeightForWidth(self.win.sizePolicy().hasHeightForWidth()) 156 | self.win.setSizePolicy(sizePolicy) 157 | self.win.setMaximumSize(QtCore.QSize(16777215, 16777215)) 158 | self.win.setObjectName("win") 159 | self.horizontalLayout_3.addWidget(self.win) 160 | self.verticalLayout_19 = QtWidgets.QVBoxLayout() 161 | self.verticalLayout_19.setObjectName("verticalLayout_19") 162 | self.group_filter1 = QtWidgets.QGroupBox(self.centralwidget) 163 | self.group_filter1.setEnabled(True) 164 | self.group_filter1.setObjectName("group_filter1") 165 | self.gridLayout_4 = QtWidgets.QGridLayout(self.group_filter1) 166 | self.gridLayout_4.setObjectName("gridLayout_4") 167 | self.btn_f1_off = QtWidgets.QPushButton(self.group_filter1) 168 | self.btn_f1_off.setObjectName("btn_f1_off") 169 | self.gridLayout_4.addWidget(self.btn_f1_off, 0, 2, 1, 1) 170 | self.btn_f1_on = QtWidgets.QPushButton(self.group_filter1) 171 | self.btn_f1_on.setObjectName("btn_f1_on") 172 | self.gridLayout_4.addWidget(self.btn_f1_on, 0, 1, 1, 1) 173 | self.verticalLayout_19.addWidget(self.group_filter1) 174 | self.group_filter2 = QtWidgets.QGroupBox(self.centralwidget) 175 | self.group_filter2.setEnabled(True) 176 | self.group_filter2.setObjectName("group_filter2") 177 | self.gridLayout_5 = QtWidgets.QGridLayout(self.group_filter2) 178 | self.gridLayout_5.setObjectName("gridLayout_5") 179 | self.btn_f2_on = QtWidgets.QPushButton(self.group_filter2) 180 | self.btn_f2_on.setObjectName("btn_f2_on") 181 | self.gridLayout_5.addWidget(self.btn_f2_on, 0, 1, 1, 1) 182 | self.btn_f2_off = QtWidgets.QPushButton(self.group_filter2) 183 | self.btn_f2_off.setObjectName("btn_f2_off") 184 | self.gridLayout_5.addWidget(self.btn_f2_off, 0, 2, 1, 1) 185 | self.verticalLayout_19.addWidget(self.group_filter2) 186 | self.group_pi = QtWidgets.QGroupBox(self.centralwidget) 187 | self.group_pi.setEnabled(True) 188 | self.group_pi.setObjectName("group_pi") 189 | self.gridLayout_11 = QtWidgets.QGridLayout(self.group_pi) 190 | self.gridLayout_11.setObjectName("gridLayout_11") 191 | self.btn_pi_led_on = QtWidgets.QPushButton(self.group_pi) 192 | self.btn_pi_led_on.setObjectName("btn_pi_led_on") 193 | self.gridLayout_11.addWidget(self.btn_pi_led_on, 0, 0, 1, 1) 194 | self.btn_pi_led_off = QtWidgets.QPushButton(self.group_pi) 195 | self.btn_pi_led_off.setObjectName("btn_pi_led_off") 196 | self.gridLayout_11.addWidget(self.btn_pi_led_off, 0, 1, 1, 1) 197 | self.verticalLayout_19.addWidget(self.group_pi) 198 | self.group_iris = QtWidgets.QGroupBox(self.centralwidget) 199 | self.group_iris.setEnabled(True) 200 | self.group_iris.setObjectName("group_iris") 201 | self.gridLayout_12 = QtWidgets.QGridLayout(self.group_iris) 202 | self.gridLayout_12.setObjectName("gridLayout_12") 203 | self.btn_iris_on = QtWidgets.QPushButton(self.group_iris) 204 | self.btn_iris_on.setObjectName("btn_iris_on") 205 | self.gridLayout_12.addWidget(self.btn_iris_on, 0, 0, 1, 1) 206 | self.btn_iris_off = QtWidgets.QPushButton(self.group_iris) 207 | self.btn_iris_off.setObjectName("btn_iris_off") 208 | self.gridLayout_12.addWidget(self.btn_iris_off, 0, 1, 1, 1) 209 | self.verticalLayout_19.addWidget(self.group_iris) 210 | self.group_guided_zoom1 = QtWidgets.QGroupBox(self.centralwidget) 211 | self.group_guided_zoom1.setEnabled(False) 212 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) 213 | sizePolicy.setHorizontalStretch(0) 214 | sizePolicy.setVerticalStretch(0) 215 | sizePolicy.setHeightForWidth(self.group_guided_zoom1.sizePolicy().hasHeightForWidth()) 216 | self.group_guided_zoom1.setSizePolicy(sizePolicy) 217 | self.group_guided_zoom1.setObjectName("group_guided_zoom1") 218 | self.gridLayout_28 = QtWidgets.QGridLayout(self.group_guided_zoom1) 219 | self.gridLayout_28.setObjectName("gridLayout_28") 220 | self.zoom_slider1 = QtWidgets.QSlider(self.group_guided_zoom1) 221 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) 222 | sizePolicy.setHorizontalStretch(0) 223 | sizePolicy.setVerticalStretch(0) 224 | sizePolicy.setHeightForWidth(self.zoom_slider1.sizePolicy().hasHeightForWidth()) 225 | self.zoom_slider1.setSizePolicy(sizePolicy) 226 | self.zoom_slider1.setPageStep(5) 227 | self.zoom_slider1.setTracking(False) 228 | self.zoom_slider1.setOrientation(QtCore.Qt.Horizontal) 229 | self.zoom_slider1.setTickPosition(QtWidgets.QSlider.TicksBelow) 230 | self.zoom_slider1.setObjectName("zoom_slider1") 231 | self.gridLayout_28.addWidget(self.zoom_slider1, 0, 0, 1, 1) 232 | self.verticalLayout_19.addWidget(self.group_guided_zoom1) 233 | self.group_guided_focus1 = QtWidgets.QGroupBox(self.centralwidget) 234 | self.group_guided_focus1.setEnabled(False) 235 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) 236 | sizePolicy.setHorizontalStretch(0) 237 | sizePolicy.setVerticalStretch(0) 238 | sizePolicy.setHeightForWidth(self.group_guided_focus1.sizePolicy().hasHeightForWidth()) 239 | self.group_guided_focus1.setSizePolicy(sizePolicy) 240 | self.group_guided_focus1.setObjectName("group_guided_focus1") 241 | self.gridLayout_30 = QtWidgets.QGridLayout(self.group_guided_focus1) 242 | self.gridLayout_30.setObjectName("gridLayout_30") 243 | self.focus_slider1 = QtWidgets.QSlider(self.group_guided_focus1) 244 | self.focus_slider1.setEnabled(False) 245 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) 246 | sizePolicy.setHorizontalStretch(0) 247 | sizePolicy.setVerticalStretch(0) 248 | sizePolicy.setHeightForWidth(self.focus_slider1.sizePolicy().hasHeightForWidth()) 249 | self.focus_slider1.setSizePolicy(sizePolicy) 250 | self.focus_slider1.setMaximum(100) 251 | self.focus_slider1.setPageStep(5) 252 | self.focus_slider1.setProperty("value", 0) 253 | self.focus_slider1.setTracking(False) 254 | self.focus_slider1.setOrientation(QtCore.Qt.Horizontal) 255 | self.focus_slider1.setTickPosition(QtWidgets.QSlider.TicksBelow) 256 | self.focus_slider1.setObjectName("focus_slider1") 257 | self.gridLayout_30.addWidget(self.focus_slider1, 0, 0, 1, 1) 258 | self.verticalLayout_19.addWidget(self.group_guided_focus1) 259 | self.group_homing = QtWidgets.QGroupBox(self.centralwidget) 260 | self.group_homing.setEnabled(True) 261 | self.group_homing.setObjectName("group_homing") 262 | self.gridLayout_20 = QtWidgets.QGridLayout(self.group_homing) 263 | self.gridLayout_20.setObjectName("gridLayout_20") 264 | self.verticalLayout_2 = QtWidgets.QVBoxLayout() 265 | self.verticalLayout_2.setObjectName("verticalLayout_2") 266 | self.btn_all_seek = QtWidgets.QPushButton(self.group_homing) 267 | font = QtGui.QFont() 268 | font.setBold(True) 269 | font.setWeight(75) 270 | self.btn_all_seek.setFont(font) 271 | self.btn_all_seek.setObjectName("btn_all_seek") 272 | self.verticalLayout_2.addWidget(self.btn_all_seek) 273 | self.horizontalLayout_10 = QtWidgets.QHBoxLayout() 274 | self.horizontalLayout_10.setObjectName("horizontalLayout_10") 275 | self.btn_x_seek = QtWidgets.QPushButton(self.group_homing) 276 | self.btn_x_seek.setEnabled(True) 277 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 278 | sizePolicy.setHorizontalStretch(0) 279 | sizePolicy.setVerticalStretch(0) 280 | sizePolicy.setHeightForWidth(self.btn_x_seek.sizePolicy().hasHeightForWidth()) 281 | self.btn_x_seek.setSizePolicy(sizePolicy) 282 | font = QtGui.QFont() 283 | font.setBold(False) 284 | font.setWeight(50) 285 | self.btn_x_seek.setFont(font) 286 | self.btn_x_seek.setObjectName("btn_x_seek") 287 | self.horizontalLayout_10.addWidget(self.btn_x_seek) 288 | self.btn_y_seek = QtWidgets.QPushButton(self.group_homing) 289 | self.btn_y_seek.setEnabled(True) 290 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 291 | sizePolicy.setHorizontalStretch(0) 292 | sizePolicy.setVerticalStretch(0) 293 | sizePolicy.setHeightForWidth(self.btn_y_seek.sizePolicy().hasHeightForWidth()) 294 | self.btn_y_seek.setSizePolicy(sizePolicy) 295 | font = QtGui.QFont() 296 | font.setBold(False) 297 | font.setWeight(50) 298 | self.btn_y_seek.setFont(font) 299 | self.btn_y_seek.setObjectName("btn_y_seek") 300 | self.horizontalLayout_10.addWidget(self.btn_y_seek) 301 | self.verticalLayout_2.addLayout(self.horizontalLayout_10) 302 | self.horizontalLayout_11 = QtWidgets.QHBoxLayout() 303 | self.horizontalLayout_11.setObjectName("horizontalLayout_11") 304 | self.btn_z_seek = QtWidgets.QPushButton(self.group_homing) 305 | self.btn_z_seek.setEnabled(True) 306 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 307 | sizePolicy.setHorizontalStretch(0) 308 | sizePolicy.setVerticalStretch(0) 309 | sizePolicy.setHeightForWidth(self.btn_z_seek.sizePolicy().hasHeightForWidth()) 310 | self.btn_z_seek.setSizePolicy(sizePolicy) 311 | font = QtGui.QFont() 312 | font.setBold(False) 313 | font.setWeight(50) 314 | self.btn_z_seek.setFont(font) 315 | self.btn_z_seek.setObjectName("btn_z_seek") 316 | self.horizontalLayout_11.addWidget(self.btn_z_seek) 317 | self.btn_a_seek = QtWidgets.QPushButton(self.group_homing) 318 | self.btn_a_seek.setEnabled(True) 319 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 320 | sizePolicy.setHorizontalStretch(0) 321 | sizePolicy.setVerticalStretch(0) 322 | sizePolicy.setHeightForWidth(self.btn_a_seek.sizePolicy().hasHeightForWidth()) 323 | self.btn_a_seek.setSizePolicy(sizePolicy) 324 | font = QtGui.QFont() 325 | font.setBold(False) 326 | font.setWeight(50) 327 | self.btn_a_seek.setFont(font) 328 | self.btn_a_seek.setObjectName("btn_a_seek") 329 | self.horizontalLayout_11.addWidget(self.btn_a_seek) 330 | self.verticalLayout_2.addLayout(self.horizontalLayout_11) 331 | self.gridLayout_20.addLayout(self.verticalLayout_2, 0, 1, 1, 1) 332 | self.verticalLayout_19.addWidget(self.group_homing) 333 | self.group_keypoints_2 = QtWidgets.QGroupBox(self.centralwidget) 334 | self.group_keypoints_2.setObjectName("group_keypoints_2") 335 | self.gridLayout_21 = QtWidgets.QGridLayout(self.group_keypoints_2) 336 | self.gridLayout_21.setObjectName("gridLayout_21") 337 | self.push_kpt_new = QtWidgets.QPushButton(self.group_keypoints_2) 338 | self.push_kpt_new.setObjectName("push_kpt_new") 339 | self.gridLayout_21.addWidget(self.push_kpt_new, 1, 0, 1, 1) 340 | self.push_kpt_set = QtWidgets.QPushButton(self.group_keypoints_2) 341 | self.push_kpt_set.setObjectName("push_kpt_set") 342 | self.gridLayout_21.addWidget(self.push_kpt_set, 5, 0, 1, 2) 343 | self.push_kpt_delete = QtWidgets.QPushButton(self.group_keypoints_2) 344 | self.push_kpt_delete.setObjectName("push_kpt_delete") 345 | self.gridLayout_21.addWidget(self.push_kpt_delete, 1, 1, 1, 1) 346 | self.push_kpt_go = QtWidgets.QPushButton(self.group_keypoints_2) 347 | self.push_kpt_go.setObjectName("push_kpt_go") 348 | self.gridLayout_21.addWidget(self.push_kpt_go, 2, 0, 1, 2) 349 | self.comboBox_keypoints = QtWidgets.QComboBox(self.group_keypoints_2) 350 | self.comboBox_keypoints.setObjectName("comboBox_keypoints") 351 | self.gridLayout_21.addWidget(self.comboBox_keypoints, 0, 0, 1, 2) 352 | self.horizontalLayout_58 = QtWidgets.QHBoxLayout() 353 | self.horizontalLayout_58.setObjectName("horizontalLayout_58") 354 | self.horizontalLayout_59 = QtWidgets.QHBoxLayout() 355 | self.horizontalLayout_59.setObjectName("horizontalLayout_59") 356 | self.label_36 = QtWidgets.QLabel(self.group_keypoints_2) 357 | self.label_36.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 358 | self.label_36.setObjectName("label_36") 359 | self.horizontalLayout_59.addWidget(self.label_36) 360 | self.label_dk_x = QtWidgets.QLabel(self.group_keypoints_2) 361 | self.label_dk_x.setMinimumSize(QtCore.QSize(40, 0)) 362 | self.label_dk_x.setObjectName("label_dk_x") 363 | self.horizontalLayout_59.addWidget(self.label_dk_x) 364 | self.horizontalLayout_58.addLayout(self.horizontalLayout_59) 365 | self.horizontalLayout_60 = QtWidgets.QHBoxLayout() 366 | self.horizontalLayout_60.setObjectName("horizontalLayout_60") 367 | self.label_52 = QtWidgets.QLabel(self.group_keypoints_2) 368 | self.label_52.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 369 | self.label_52.setObjectName("label_52") 370 | self.horizontalLayout_60.addWidget(self.label_52) 371 | self.label_dk_y = QtWidgets.QLabel(self.group_keypoints_2) 372 | self.label_dk_y.setMinimumSize(QtCore.QSize(40, 0)) 373 | self.label_dk_y.setObjectName("label_dk_y") 374 | self.horizontalLayout_60.addWidget(self.label_dk_y) 375 | self.horizontalLayout_58.addLayout(self.horizontalLayout_60) 376 | self.gridLayout_21.addLayout(self.horizontalLayout_58, 3, 0, 1, 2) 377 | self.horizontalLayout_61 = QtWidgets.QHBoxLayout() 378 | self.horizontalLayout_61.setObjectName("horizontalLayout_61") 379 | self.horizontalLayout_62 = QtWidgets.QHBoxLayout() 380 | self.horizontalLayout_62.setObjectName("horizontalLayout_62") 381 | self.label_53 = QtWidgets.QLabel(self.group_keypoints_2) 382 | self.label_53.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 383 | self.label_53.setObjectName("label_53") 384 | self.horizontalLayout_62.addWidget(self.label_53) 385 | self.label_dk_z = QtWidgets.QLabel(self.group_keypoints_2) 386 | self.label_dk_z.setMinimumSize(QtCore.QSize(40, 0)) 387 | self.label_dk_z.setObjectName("label_dk_z") 388 | self.horizontalLayout_62.addWidget(self.label_dk_z) 389 | self.horizontalLayout_61.addLayout(self.horizontalLayout_62) 390 | self.horizontalLayout_63 = QtWidgets.QHBoxLayout() 391 | self.horizontalLayout_63.setObjectName("horizontalLayout_63") 392 | self.label_54 = QtWidgets.QLabel(self.group_keypoints_2) 393 | self.label_54.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 394 | self.label_54.setObjectName("label_54") 395 | self.horizontalLayout_63.addWidget(self.label_54) 396 | self.label_dk_a = QtWidgets.QLabel(self.group_keypoints_2) 397 | self.label_dk_a.setMinimumSize(QtCore.QSize(40, 0)) 398 | self.label_dk_a.setObjectName("label_dk_a") 399 | self.horizontalLayout_63.addWidget(self.label_dk_a) 400 | self.horizontalLayout_61.addLayout(self.horizontalLayout_63) 401 | self.gridLayout_21.addLayout(self.horizontalLayout_61, 4, 0, 1, 2) 402 | self.verticalLayout_19.addWidget(self.group_keypoints_2) 403 | self.horizontalLayout_3.addLayout(self.verticalLayout_19) 404 | self.gridLayout.addLayout(self.horizontalLayout_3, 1, 0, 1, 1) 405 | spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 406 | self.gridLayout.addItem(spacerItem1, 2, 0, 1, 1) 407 | self.horizontalLayout = QtWidgets.QHBoxLayout() 408 | self.horizontalLayout.setObjectName("horizontalLayout") 409 | self.presetGroup = QtWidgets.QGroupBox(self.centralwidget) 410 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding) 411 | sizePolicy.setHorizontalStretch(0) 412 | sizePolicy.setVerticalStretch(0) 413 | sizePolicy.setHeightForWidth(self.presetGroup.sizePolicy().hasHeightForWidth()) 414 | self.presetGroup.setSizePolicy(sizePolicy) 415 | self.presetGroup.setMinimumSize(QtCore.QSize(0, 0)) 416 | self.presetGroup.setObjectName("presetGroup") 417 | self.horizontalLayout.addWidget(self.presetGroup) 418 | self.gridLayout.addLayout(self.horizontalLayout, 3, 0, 1, 1) 419 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout() 420 | self.horizontalLayout_2.setObjectName("horizontalLayout_2") 421 | self.group_comport = QtWidgets.QGroupBox(self.centralwidget) 422 | self.group_comport.setObjectName("group_comport") 423 | self.gridLayout_8 = QtWidgets.QGridLayout(self.group_comport) 424 | self.gridLayout_8.setObjectName("gridLayout_8") 425 | self.btn_disconnect = QtWidgets.QPushButton(self.group_comport) 426 | self.btn_disconnect.setEnabled(False) 427 | self.btn_disconnect.setObjectName("btn_disconnect") 428 | self.gridLayout_8.addWidget(self.btn_disconnect, 0, 3, 1, 1) 429 | self.combo_ports = QtWidgets.QComboBox(self.group_comport) 430 | self.combo_ports.setObjectName("combo_ports") 431 | self.gridLayout_8.addWidget(self.combo_ports, 0, 0, 1, 1) 432 | self.btn_connect = QtWidgets.QPushButton(self.group_comport) 433 | self.btn_connect.setEnabled(True) 434 | font = QtGui.QFont() 435 | font.setBold(True) 436 | font.setWeight(75) 437 | self.btn_connect.setFont(font) 438 | self.btn_connect.setObjectName("btn_connect") 439 | self.gridLayout_8.addWidget(self.btn_connect, 0, 2, 1, 1) 440 | self.btn_com_refresh = QtWidgets.QPushButton(self.group_comport) 441 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) 442 | sizePolicy.setHorizontalStretch(0) 443 | sizePolicy.setVerticalStretch(0) 444 | sizePolicy.setHeightForWidth(self.btn_com_refresh.sizePolicy().hasHeightForWidth()) 445 | self.btn_com_refresh.setSizePolicy(sizePolicy) 446 | self.btn_com_refresh.setText("") 447 | icon = QtGui.QIcon() 448 | icon.addPixmap(QtGui.QPixmap(":/logo/restart.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 449 | self.btn_com_refresh.setIcon(icon) 450 | self.btn_com_refresh.setObjectName("btn_com_refresh") 451 | self.gridLayout_8.addWidget(self.btn_com_refresh, 0, 1, 1, 1) 452 | self.horizontalLayout_2.addWidget(self.group_comport) 453 | self.group_lens = QtWidgets.QGroupBox(self.centralwidget) 454 | self.group_lens.setEnabled(False) 455 | self.group_lens.setObjectName("group_lens") 456 | self.gridLayout_7 = QtWidgets.QGridLayout(self.group_lens) 457 | self.gridLayout_7.setObjectName("gridLayout_7") 458 | self.label_lens_name = QtWidgets.QLabel(self.group_lens) 459 | self.label_lens_name.setEnabled(False) 460 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) 461 | sizePolicy.setHorizontalStretch(0) 462 | sizePolicy.setVerticalStretch(0) 463 | sizePolicy.setHeightForWidth(self.label_lens_name.sizePolicy().hasHeightForWidth()) 464 | self.label_lens_name.setSizePolicy(sizePolicy) 465 | font = QtGui.QFont() 466 | font.setBold(True) 467 | font.setWeight(75) 468 | self.label_lens_name.setFont(font) 469 | self.label_lens_name.setObjectName("label_lens_name") 470 | self.gridLayout_7.addWidget(self.label_lens_name, 0, 0, 1, 1) 471 | self.btn_reset = QtWidgets.QPushButton(self.group_lens) 472 | self.btn_reset.setEnabled(False) 473 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) 474 | sizePolicy.setHorizontalStretch(0) 475 | sizePolicy.setVerticalStretch(0) 476 | sizePolicy.setHeightForWidth(self.btn_reset.sizePolicy().hasHeightForWidth()) 477 | self.btn_reset.setSizePolicy(sizePolicy) 478 | self.btn_reset.setObjectName("btn_reset") 479 | self.gridLayout_7.addWidget(self.btn_reset, 0, 1, 1, 1) 480 | self.horizontalLayout_2.addWidget(self.group_lens) 481 | self.group_step_size = QtWidgets.QGroupBox(self.centralwidget) 482 | self.group_step_size.setEnabled(True) 483 | self.group_step_size.setObjectName("group_step_size") 484 | self.gridLayout_9 = QtWidgets.QGridLayout(self.group_step_size) 485 | self.gridLayout_9.setObjectName("gridLayout_9") 486 | self.combo_step = QtWidgets.QComboBox(self.group_step_size) 487 | self.combo_step.setEnabled(True) 488 | self.combo_step.setObjectName("combo_step") 489 | self.gridLayout_9.addWidget(self.combo_step, 0, 0, 1, 1) 490 | self.horizontalLayout_2.addWidget(self.group_step_size) 491 | self.group_speed = QtWidgets.QGroupBox(self.centralwidget) 492 | self.group_speed.setEnabled(True) 493 | self.group_speed.setObjectName("group_speed") 494 | self.gridLayout_10 = QtWidgets.QGridLayout(self.group_speed) 495 | self.gridLayout_10.setObjectName("gridLayout_10") 496 | self.combo_speed = QtWidgets.QComboBox(self.group_speed) 497 | self.combo_speed.setObjectName("combo_speed") 498 | self.gridLayout_10.addWidget(self.combo_speed, 0, 0, 1, 1) 499 | self.horizontalLayout_2.addWidget(self.group_speed) 500 | self.group_focal_length = QtWidgets.QGroupBox(self.centralwidget) 501 | self.group_focal_length.setEnabled(True) 502 | self.group_focal_length.setObjectName("group_focal_length") 503 | self.gridLayout_14 = QtWidgets.QGridLayout(self.group_focal_length) 504 | self.gridLayout_14.setObjectName("gridLayout_14") 505 | self.label_focal_length = QtWidgets.QLabel(self.group_focal_length) 506 | font = QtGui.QFont() 507 | font.setBold(True) 508 | font.setWeight(75) 509 | self.label_focal_length.setFont(font) 510 | self.label_focal_length.setObjectName("label_focal_length") 511 | self.gridLayout_14.addWidget(self.label_focal_length, 0, 0, 1, 1) 512 | self.horizontalLayout_2.addWidget(self.group_focal_length) 513 | self.group_mdi = QtWidgets.QGroupBox(self.centralwidget) 514 | self.group_mdi.setEnabled(True) 515 | self.group_mdi.setObjectName("group_mdi") 516 | self.gridLayout_19 = QtWidgets.QGridLayout(self.group_mdi) 517 | self.gridLayout_19.setObjectName("gridLayout_19") 518 | self.btn_mdi_send = QtWidgets.QPushButton(self.group_mdi) 519 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) 520 | sizePolicy.setHorizontalStretch(0) 521 | sizePolicy.setVerticalStretch(0) 522 | sizePolicy.setHeightForWidth(self.btn_mdi_send.sizePolicy().hasHeightForWidth()) 523 | self.btn_mdi_send.setSizePolicy(sizePolicy) 524 | font = QtGui.QFont() 525 | font.setBold(True) 526 | font.setWeight(75) 527 | self.btn_mdi_send.setFont(font) 528 | self.btn_mdi_send.setObjectName("btn_mdi_send") 529 | self.gridLayout_19.addWidget(self.btn_mdi_send, 0, 1, 1, 1) 530 | self.line_mdi = QtWidgets.QLineEdit(self.group_mdi) 531 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) 532 | sizePolicy.setHorizontalStretch(0) 533 | sizePolicy.setVerticalStretch(0) 534 | sizePolicy.setHeightForWidth(self.line_mdi.sizePolicy().hasHeightForWidth()) 535 | self.line_mdi.setSizePolicy(sizePolicy) 536 | self.line_mdi.setMinimumSize(QtCore.QSize(200, 0)) 537 | self.line_mdi.setObjectName("line_mdi") 538 | self.gridLayout_19.addWidget(self.line_mdi, 0, 0, 1, 1) 539 | self.horizontalLayout_2.addWidget(self.group_mdi) 540 | self.gridLayout.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) 541 | MainWindow.setCentralWidget(self.centralwidget) 542 | self.menubar = QtWidgets.QMenuBar(MainWindow) 543 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1020, 21)) 544 | self.menubar.setObjectName("menubar") 545 | MainWindow.setMenuBar(self.menubar) 546 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 547 | self.statusbar.setObjectName("statusbar") 548 | MainWindow.setStatusBar(self.statusbar) 549 | 550 | self.retranslateUi(MainWindow) 551 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 552 | 553 | def retranslateUi(self, MainWindow): 554 | _translate = QtCore.QCoreApplication.translate 555 | MainWindow.setWindowTitle(_translate("MainWindow", "SCE2-Lxxx lens tester")) 556 | self.label_61.setText(_translate("MainWindow", "Buffers:")) 557 | self.label_buffer_count.setText(_translate("MainWindow", "---")) 558 | self.label_59.setText(_translate("MainWindow", "Motion status:")) 559 | self.label_motion_status.setText(_translate("MainWindow", "---")) 560 | self.label_60.setText(_translate("MainWindow", "FW:")) 561 | self.s_controller_fw.setText(_translate("MainWindow", "---")) 562 | self.label_62.setText(_translate("MainWindow", "Status:")) 563 | self.s_status.setText(_translate("MainWindow", "---")) 564 | self.label_63.setText(_translate("MainWindow", "Response:")) 565 | self.label_response.setText(_translate("MainWindow", "---")) 566 | self.group_x_axis.setTitle(_translate("MainWindow", "delete me!")) 567 | self.group_filter1.setTitle(_translate("MainWindow", "Filter1")) 568 | self.btn_f1_off.setText(_translate("MainWindow", "OFF")) 569 | self.btn_f1_on.setText(_translate("MainWindow", "ON")) 570 | self.group_filter2.setTitle(_translate("MainWindow", "Filter2")) 571 | self.btn_f2_on.setText(_translate("MainWindow", "ON")) 572 | self.btn_f2_off.setText(_translate("MainWindow", "OFF")) 573 | self.group_pi.setTitle(_translate("MainWindow", "Optocoupler LED")) 574 | self.btn_pi_led_on.setText(_translate("MainWindow", "ON")) 575 | self.btn_pi_led_off.setText(_translate("MainWindow", "OFF")) 576 | self.group_iris.setTitle(_translate("MainWindow", "Iris")) 577 | self.btn_iris_on.setText(_translate("MainWindow", "OPEN")) 578 | self.btn_iris_off.setText(_translate("MainWindow", "CLOSE")) 579 | self.group_guided_zoom1.setTitle(_translate("MainWindow", "Guided zoom (experimental)")) 580 | self.group_guided_focus1.setTitle(_translate("MainWindow", "Normalized focus (experimental)")) 581 | self.group_homing.setTitle(_translate("MainWindow", "Homing")) 582 | self.btn_all_seek.setText(_translate("MainWindow", "Home ALL")) 583 | self.btn_x_seek.setText(_translate("MainWindow", "X")) 584 | self.btn_y_seek.setText(_translate("MainWindow", "Y")) 585 | self.btn_z_seek.setText(_translate("MainWindow", "Z")) 586 | self.btn_a_seek.setText(_translate("MainWindow", "A")) 587 | self.group_keypoints_2.setTitle(_translate("MainWindow", "Debug keypoints")) 588 | self.push_kpt_new.setText(_translate("MainWindow", "Add new")) 589 | self.push_kpt_set.setText(_translate("MainWindow", "Set")) 590 | self.push_kpt_delete.setText(_translate("MainWindow", "Delete")) 591 | self.push_kpt_go.setText(_translate("MainWindow", "Go")) 592 | self.label_36.setText(_translate("MainWindow", "X:")) 593 | self.label_dk_x.setText(_translate("MainWindow", "--")) 594 | self.label_52.setText(_translate("MainWindow", "Y:")) 595 | self.label_dk_y.setText(_translate("MainWindow", "--")) 596 | self.label_53.setText(_translate("MainWindow", "Z:")) 597 | self.label_dk_z.setText(_translate("MainWindow", "--")) 598 | self.label_54.setText(_translate("MainWindow", "A:")) 599 | self.label_dk_a.setText(_translate("MainWindow", "--")) 600 | self.presetGroup.setTitle(_translate("MainWindow", "delete me!")) 601 | self.group_comport.setTitle(_translate("MainWindow", "COM port")) 602 | self.btn_disconnect.setText(_translate("MainWindow", "Disconnect")) 603 | self.btn_connect.setText(_translate("MainWindow", "Connect")) 604 | self.btn_com_refresh.setToolTip(_translate("MainWindow", "Refresh com port list")) 605 | self.group_lens.setTitle(_translate("MainWindow", "Lens")) 606 | self.label_lens_name.setText(_translate("MainWindow", "---")) 607 | self.btn_reset.setText(_translate("MainWindow", "RST")) 608 | self.group_step_size.setTitle(_translate("MainWindow", "Motion step size")) 609 | self.group_speed.setTitle(_translate("MainWindow", "Motion speed")) 610 | self.group_focal_length.setTitle(_translate("MainWindow", "Focal length")) 611 | self.label_focal_length.setText(_translate("MainWindow", "---")) 612 | self.group_mdi.setTitle(_translate("MainWindow", "Manual Data Entry (MDI)")) 613 | self.btn_mdi_send.setText(_translate("MainWindow", "Send")) 614 | self.line_mdi.setText(_translate("MainWindow", "G90 G1 X0 Y0 Z0 F200")) 615 | from pyqtgraph import GraphicsLayoutWidget 616 | import images_rc 617 | -------------------------------------------------------------------------------- /03_lens_tester_gui/gui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1020 10 | 947 11 | 12 | 13 | 14 | SCE2-Lxxx lens tester 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 0 28 | 29 | 30 | 31 | Buffers: 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 42 | 43 | 44 | 45 | 20 46 | 0 47 | 48 | 49 | 50 | --- 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | QFrame::Plain 60 | 61 | 62 | Qt::Vertical 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 0 73 | 0 74 | 75 | 76 | 77 | Motion status: 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 40 86 | 0 87 | 88 | 89 | 90 | --- 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | QFrame::Plain 100 | 101 | 102 | Qt::Vertical 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 0 113 | 0 114 | 115 | 116 | 117 | FW: 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 200 126 | 0 127 | 128 | 129 | 130 | --- 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | QFrame::Plain 140 | 141 | 142 | Qt::Vertical 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 0 153 | 0 154 | 155 | 156 | 157 | Status: 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 50 166 | 0 167 | 168 | 169 | 170 | --- 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | QFrame::Plain 180 | 181 | 182 | Qt::Vertical 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 0 193 | 0 194 | 195 | 196 | 197 | Response: 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 0 206 | 0 207 | 208 | 209 | 210 | 211 | 300 212 | 0 213 | 214 | 215 | 216 | --- 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | Qt::Horizontal 226 | 227 | 228 | 229 | 40 230 | 20 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | QFrame::Plain 241 | 242 | 243 | Qt::Horizontal 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | true 257 | 258 | 259 | delete me! 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 0 273 | 0 274 | 275 | 276 | 277 | 278 | 16777215 279 | 16777215 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | true 290 | 291 | 292 | Filter1 293 | 294 | 295 | 296 | 297 | 298 | OFF 299 | 300 | 301 | 302 | 303 | 304 | 305 | ON 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | true 316 | 317 | 318 | Filter2 319 | 320 | 321 | 322 | 323 | 324 | ON 325 | 326 | 327 | 328 | 329 | 330 | 331 | OFF 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | true 342 | 343 | 344 | Optocoupler LED 345 | 346 | 347 | 348 | 349 | 350 | ON 351 | 352 | 353 | 354 | 355 | 356 | 357 | OFF 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | true 368 | 369 | 370 | Iris 371 | 372 | 373 | 374 | 375 | 376 | OPEN 377 | 378 | 379 | 380 | 381 | 382 | 383 | CLOSE 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | false 394 | 395 | 396 | 397 | 0 398 | 0 399 | 400 | 401 | 402 | Guided zoom (experimental) 403 | 404 | 405 | 406 | 407 | 408 | 409 | 0 410 | 0 411 | 412 | 413 | 414 | 5 415 | 416 | 417 | false 418 | 419 | 420 | Qt::Horizontal 421 | 422 | 423 | QSlider::TicksBelow 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | false 434 | 435 | 436 | 437 | 0 438 | 0 439 | 440 | 441 | 442 | Normalized focus (experimental) 443 | 444 | 445 | 446 | 447 | 448 | false 449 | 450 | 451 | 452 | 0 453 | 0 454 | 455 | 456 | 457 | 100 458 | 459 | 460 | 5 461 | 462 | 463 | 0 464 | 465 | 466 | false 467 | 468 | 469 | Qt::Horizontal 470 | 471 | 472 | QSlider::TicksBelow 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | true 483 | 484 | 485 | Homing 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 75 495 | true 496 | 497 | 498 | 499 | Home ALL 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | true 509 | 510 | 511 | 512 | 0 513 | 0 514 | 515 | 516 | 517 | 518 | 50 519 | false 520 | 521 | 522 | 523 | X 524 | 525 | 526 | 527 | 528 | 529 | 530 | true 531 | 532 | 533 | 534 | 0 535 | 0 536 | 537 | 538 | 539 | 540 | 50 541 | false 542 | 543 | 544 | 545 | Y 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | true 557 | 558 | 559 | 560 | 0 561 | 0 562 | 563 | 564 | 565 | 566 | 50 567 | false 568 | 569 | 570 | 571 | Z 572 | 573 | 574 | 575 | 576 | 577 | 578 | true 579 | 580 | 581 | 582 | 0 583 | 0 584 | 585 | 586 | 587 | 588 | 50 589 | false 590 | 591 | 592 | 593 | A 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | Debug keypoints 608 | 609 | 610 | 611 | 612 | 613 | Add new 614 | 615 | 616 | 617 | 618 | 619 | 620 | Set 621 | 622 | 623 | 624 | 625 | 626 | 627 | Delete 628 | 629 | 630 | 631 | 632 | 633 | 634 | Go 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | X: 649 | 650 | 651 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 40 660 | 0 661 | 662 | 663 | 664 | -- 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | Y: 676 | 677 | 678 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 40 687 | 0 688 | 689 | 690 | 691 | -- 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | Z: 707 | 708 | 709 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 40 718 | 0 719 | 720 | 721 | 722 | -- 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | A: 734 | 735 | 736 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 40 745 | 0 746 | 747 | 748 | 749 | -- 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | Qt::Vertical 768 | 769 | 770 | QSizePolicy::Expanding 771 | 772 | 773 | 774 | 20 775 | 20 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 0 787 | 0 788 | 789 | 790 | 791 | 792 | 0 793 | 0 794 | 795 | 796 | 797 | delete me! 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | COM port 809 | 810 | 811 | 812 | 813 | 814 | false 815 | 816 | 817 | Disconnect 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | true 828 | 829 | 830 | 831 | 75 832 | true 833 | 834 | 835 | 836 | Connect 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 0 845 | 0 846 | 847 | 848 | 849 | Refresh com port list 850 | 851 | 852 | 853 | 854 | 855 | 856 | :/logo/restart.png:/logo/restart.png 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | false 867 | 868 | 869 | Lens 870 | 871 | 872 | 873 | 874 | 875 | false 876 | 877 | 878 | 879 | 0 880 | 0 881 | 882 | 883 | 884 | 885 | 75 886 | true 887 | 888 | 889 | 890 | --- 891 | 892 | 893 | 894 | 895 | 896 | 897 | false 898 | 899 | 900 | 901 | 0 902 | 0 903 | 904 | 905 | 906 | RST 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | true 917 | 918 | 919 | Motion step size 920 | 921 | 922 | 923 | 924 | 925 | true 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | true 936 | 937 | 938 | Motion speed 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | true 951 | 952 | 953 | Focal length 954 | 955 | 956 | 957 | 958 | 959 | 960 | 75 961 | true 962 | 963 | 964 | 965 | --- 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | true 976 | 977 | 978 | Manual Data Entry (MDI) 979 | 980 | 981 | 982 | 983 | 984 | 985 | 0 986 | 0 987 | 988 | 989 | 990 | 991 | 75 992 | true 993 | 994 | 995 | 996 | Send 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 0 1005 | 0 1006 | 1007 | 1008 | 1009 | 1010 | 200 1011 | 0 1012 | 1013 | 1014 | 1015 | G90 G1 X0 Y0 Z0 F200 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 0 1030 | 0 1031 | 1020 1032 | 21 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | GraphicsLayoutWidget 1041 | QGraphicsView 1042 |
pyqtgraph
1043 |
1044 |
1045 | 1046 | 1047 | 1048 | 1049 |
1050 | -------------------------------------------------------------------------------- /03_lens_tester_gui/gui_convert.py: -------------------------------------------------------------------------------- 1 | from PyQt5 import uic 2 | import glob 3 | 4 | for fname in glob.glob("*.ui"): 5 | fin = open(fname, 'r') 6 | fout = open(fname.replace(".ui", ".py"), 'w') 7 | uic.compileUi(fin, fout, execute=False) 8 | fin.close() 9 | fout.close() 10 | -------------------------------------------------------------------------------- /03_lens_tester_gui/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/03_lens_tester_gui/icon.ico -------------------------------------------------------------------------------- /03_lens_tester_gui/images.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | restart.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /03_lens_tester_gui/import_keypoints.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | 3 | config_file = "config.yaml" 4 | keypoint_file = "keypoints.txt" 5 | curve_name = "focus_inf" 6 | save_correction_curve = True 7 | 8 | 9 | 10 | 11 | 12 | keypoints_data = None 13 | keypoint_x = [] 14 | keypoint_y = [] 15 | keypoint_z = [] 16 | keypoint_a = [] 17 | 18 | 19 | with open(keypoint_file, "r") as f: 20 | #config = yaml.load(f, Loader=yaml.FullLoader) 21 | keypoints_data = f.readlines() 22 | f.close() 23 | 24 | for i in range(len(keypoints_data)): 25 | keypoints_data_line = keypoints_data[i].strip().split(", ") 26 | keypoint_x.append(float(keypoints_data_line[0])) 27 | keypoint_y.append(float(keypoints_data_line[1])) 28 | keypoint_z.append(float(keypoints_data_line[2])) 29 | keypoint_a.append(float(keypoints_data_line[3])) 30 | 31 | config = None 32 | with open(config_file) as f: 33 | config = yaml.load(f, Loader=yaml.FullLoader) 34 | f.close() 35 | 36 | 37 | config["lens"]["L086"]["motor"]["curves"]["focus_inf"]["x"] = keypoint_x 38 | config["lens"]["L086"]["motor"]["curves"]["focus_inf"]["y"] = keypoint_z 39 | 40 | if save_correction_curve: 41 | config["lens"]["L086"]["motor"]["curves"]["zoom_correction"]["x"] = keypoint_x 42 | config["lens"]["L086"]["motor"]["curves"]["zoom_correction"]["y"] = keypoint_y 43 | 44 | 45 | with open(config_file, 'w') as f: 46 | yaml.dump(config, f) 47 | -------------------------------------------------------------------------------- /03_lens_tester_gui/keypoints.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | 3 | 4 | class Keypoints(): 5 | points = [] 6 | 7 | def __init__(self, points): 8 | self.points = points 9 | 10 | def add_point(self, point): 11 | x = point[0] 12 | nr = -1 13 | 14 | for p in self.points: 15 | if p[0] == x: 16 | #raise ValueError("Duplicate x axis not allowed") 17 | return -1 18 | 19 | self.points.append(point) 20 | self.sort() 21 | 22 | for p in range(len(self.points)): 23 | if self.points[p][0] == x: 24 | nr = p 25 | 26 | return nr 27 | 28 | def set_point(self, nr, point): 29 | self.delete_point(nr) 30 | nr = self.add_point(point) 31 | return nr 32 | 33 | def delete_point(self, nr): 34 | del self.points[nr] 35 | return nr-1 36 | 37 | def sort(self): 38 | self.points.sort(key=lambda x: x[0]) 39 | 40 | 41 | 42 | if __name__ == '__main__': 43 | config = {} 44 | with open("config.yaml") as f: 45 | config = yaml.load(f, Loader=yaml.FullLoader) 46 | f.close() 47 | 48 | k = Keypoints(config["lens"]["L117"]["debug_keypoints"]) 49 | #k = Keypoints([]) 50 | 51 | k.add_point([2, 1, 1, 1]) 52 | k.add_point([1.1, 2, 2, 2]) 53 | k.set_point(0, [2.2, 2, 2, 2]) 54 | 55 | print(k.points) 56 | -------------------------------------------------------------------------------- /03_lens_tester_gui/logs.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import atexit 3 | import time 4 | import sys 5 | from logging.handlers import RotatingFileHandler 6 | 7 | # https://docs.python.org/3/howto/logging-cookbook.html 8 | 9 | logger = logging.getLogger() 10 | logger.setLevel(logging.DEBUG) 11 | 12 | #log_handler = logging.handlers.WatchedFileHandler(__file__+'f.log') 13 | #log_handler = logging.handlers.WatchedFileHandler("test.log") 14 | fh = RotatingFileHandler("motion.log", mode='a', maxBytes=5*1024*1024, backupCount=2, encoding=None, delay=0) 15 | fh.setLevel(logging.INFO) 16 | formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s:%(module)s:%(funcName)s:%(lineno)d - %(message)s") 17 | #formatter.converter = time.gmtime # if you want UTC time 18 | fh.setFormatter(formatter) 19 | logger.addHandler(fh) 20 | 21 | ch = logging.StreamHandler() 22 | ch.setLevel(logging.WARNING) 23 | formatter = logging.Formatter("%(levelname)s - %(name)s:%(module)s:%(funcName)s:%(lineno)d - %(message)s") 24 | ch.setFormatter(formatter) 25 | logger.addHandler(ch) 26 | 27 | 28 | def handle_exception(exc_type, exc_value, exc_traceback): 29 | if issubclass(exc_type, KeyboardInterrupt): 30 | sys.__excepthook__(exc_type, exc_value, exc_traceback) 31 | return 32 | logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback)) 33 | 34 | logger.info("") 35 | logger.info("") 36 | logger.info("------------------------- START -------------------------") 37 | 38 | sys.excepthook = handle_exception 39 | 40 | @atexit.register 41 | def goodbye(): 42 | logger.info("-------------------------- END --------------------------") 43 | 44 | #raise RuntimeError("Test unhandled") 45 | #for l in range(100000): 46 | # logger.info("Nr:" + str(l)) 47 | 48 | 49 | 50 | ''' 51 | 52 | #py1 53 | import logging 54 | def fun1(): 55 | LOGGER = logging.getLogger(__name__) 56 | LOGGER.info('fun1 runs') 57 | 58 | #py2 59 | import logging 60 | def fun2(): 61 | LOGGER = logging.getLogger(__name__) 62 | LOGGER.info('fun2 runs') 63 | 64 | #master.py 65 | import py1 66 | import py2 67 | import logging 68 | def main(): 69 | logging.basicConfig(filename='log.log',level=logging.INFO) 70 | LOGGER = logging.getLogger("main") 71 | py1.fun1() 72 | py2.fun2() 73 | LOGGER.info('Master runs') 74 | 75 | if __name__ == "__main__": 76 | main() 77 | 78 | ''' 79 | 80 | 81 | ''' 82 | info 83 | warning 84 | error 85 | critical 86 | log 87 | exception 88 | 89 | CRITICAL 90 | ERROR 91 | WARNING 92 | INFO 93 | DEBUG 94 | NOTSET 95 | ''' 96 | 97 | -------------------------------------------------------------------------------- /03_lens_tester_gui/motion.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot 2 | from PyQt5 import QtCore, QtGui, QtWidgets, uic, QtSvg 3 | 4 | import serial 5 | import time 6 | import queue 7 | import serial.tools.list_ports 8 | 9 | import logging 10 | LOGGER = logging.getLogger(__name__) 11 | LOGGER.info('start') 12 | 13 | 14 | IDLE_TIMEOUT = 0.02 15 | 16 | class SerialComm(QObject): 17 | strStatus = pyqtSignal(str) 18 | strVersion = pyqtSignal(str) 19 | serFeedback = pyqtSignal(str) 20 | serReceive = pyqtSignal(list) 21 | strError = pyqtSignal(str) 22 | current_line_feedback = pyqtSignal(str) 23 | 24 | log_tx = pyqtSignal(str) 25 | log_rx = pyqtSignal(str) 26 | 27 | port = None 28 | commands = queue.Queue() 29 | commands_buffered = queue.Queue() 30 | action_connect = queue.Queue() 31 | action_disconnect = queue.Queue() 32 | action_recipe = queue.Queue() 33 | 34 | 35 | def get_compot_list(self): 36 | ports = [] 37 | for p in serial.tools.list_ports.comports(): 38 | ports.append((p.device, p.description)) 39 | return ports 40 | 41 | def connect(self, port, baudrate, seek_timeout): 42 | self.port = port 43 | self.baudrate = baudrate 44 | self.action_connect.put(True) 45 | self.seek_timeout = seek_timeout 46 | 47 | def disconnect(self): 48 | self.action_disconnect.put(True) 49 | 50 | def send(self, data): 51 | self.commands.put(data) 52 | 53 | def send_buffered(self, data): 54 | self.commands_buffered.put(data) 55 | 56 | def __ser_send(self, ser, data, monitor=True): 57 | ser.flushInput() 58 | ser.write(bytes(data, 'utf8')) 59 | self.current_line_feedback.emit(data.strip()) 60 | LOGGER.info(">>> " + data.strip()) 61 | if monitor: 62 | self.log_tx.emit(data.strip()) 63 | 64 | def __ser_read(self, ser, monitor=True): 65 | data = ser.readline().decode("utf-8").strip() 66 | LOGGER.info("<<< " + str(data)) 67 | if monitor: 68 | self.log_rx.emit(data) 69 | 70 | #if len(data)==0: 71 | # print("read timeout") 72 | 73 | return data 74 | 75 | ''' 76 | def __parse_status(self, status_string): 77 | temp = status_string.split(",") 78 | ret = [] 79 | for t in temp: 80 | ret.append(int(t.strip())) 81 | return ret 82 | ''' 83 | 84 | ''' 85 | def __wait_till_stop(self, ser, initial_status, axis, timeout=5): 86 | elapsed_time = 0 87 | start_time = time.time() 88 | while elapsed_time < timeout: 89 | elapsed_time = time.time() - start_time 90 | status_str = self.__ser_send(ser, "!1") 91 | status = self.__parse_status(status_str) 92 | self.feedback.emit(status) 93 | time.sleep(0.05) 94 | if initial_status != status[axis]: 95 | return elapsed_time 96 | return -1 97 | ''' 98 | 99 | @pyqtSlot() 100 | def serial_worker(self): 101 | 102 | while True: 103 | try: 104 | stay_connected = True 105 | needs_feedback = False 106 | feedback_ts = 0 107 | 108 | self.action_connect.get() # in general - wait until connect button is pressed 109 | 110 | self.strStatus.emit("Connecting...") 111 | ser = serial.Serial() 112 | ser.port = str(self.port) 113 | ser.baudrate = int(self.baudrate) 114 | ser.timeout = 1 115 | 116 | res = ser.open() 117 | ser.flushInput() 118 | ser.flushOutput() 119 | 120 | self.strStatus.emit("Connected") 121 | 122 | while stay_connected: 123 | if not self.action_disconnect.empty(): 124 | self.action_disconnect.get() 125 | #self.action_disconnect.clear() 126 | stay_connected = False 127 | 128 | # read bare command 129 | if not self.commands.empty(): 130 | f = self.commands.get() 131 | 132 | self.__ser_send(ser, f) 133 | # TODO: check command and adjust timeout accordingly 134 | ser.timeout = 10 135 | r = self.__ser_read(ser) 136 | self.serReceive.emit([f.strip(), r.strip()]) 137 | 138 | # this part waits for command to be completed 139 | LOGGER.debug("wait buffer") 140 | while(True): 141 | 142 | ''' 143 | ser.timeout = 0.1 144 | cmd = "?" 145 | self.__ser_send(ser, cmd, monitor=False) 146 | r1 = self.__ser_read(ser, monitor=False) 147 | ''' 148 | 149 | retry_cnt = 0 150 | ret = "" 151 | cmd = "?" 152 | backup_timeout = ser.timeout 153 | ser.timeout = 0.01 154 | r1 = "" 155 | 156 | while True: 157 | self.__ser_send(ser, cmd, monitor=False) 158 | status = self.__ser_read(ser, monitor=False) 159 | if len(status) > 10: 160 | if (status[0] == "<") and (status[-1] == ">"): 161 | r1 = status 162 | #print(r1) 163 | break 164 | 165 | if retry_cnt > 0: 166 | LOGGER.info("* Retry count:"+str(retry_cnt)) 167 | #if retry_cnt > 100: 168 | # LOGGER.info("Forced break - reset controller") 169 | # self.__ser_send(ser, '\x18', monitor=False) 170 | # break 171 | 172 | retry_cnt += 1 173 | 174 | ser.timeout = backup_timeout 175 | 176 | try: 177 | if r1[0] == "<": 178 | # 179 | text = r1[1:-1] 180 | feedback_split = text.split("|") 181 | positions = feedback_split[2].split(":") 182 | positions = positions[1] 183 | positions = positions.split(",") 184 | buffers = int(positions[0]) 185 | status = feedback_split[0] 186 | self.serFeedback.emit(r1) 187 | 188 | # GRBL command buffer = 0 189 | if buffers >= 35: 190 | if status == "Idle": 191 | break 192 | except Exception as e: 193 | print("Parse error", e) 194 | 195 | #LOGGER.debug("ok") 196 | 197 | 198 | ''' 199 | retry_cnt = 0 200 | ret = "" 201 | cmd = "?" 202 | backup_timeout = ser.timeout 203 | ser.timeout = 0.5 204 | 205 | while True: 206 | self.__ser_send(ser, cmd, monitor=False) 207 | status = self.__ser_read(ser, monitor=False) 208 | if len(status) > 10: 209 | if (status[0] == "<") and (status[-1] == ">"): 210 | ret = status 211 | self.serFeedback.emit(ret) 212 | break 213 | 214 | if retry_cnt > 0: 215 | LOGGER.info("* Retry count", retry_cnt) 216 | print("* Retry count", retry_cnt) 217 | 218 | retry_cnt += 1 219 | 220 | ser.timeout = backup_timeout 221 | ''' 222 | 223 | 224 | 225 | # NNNNNNNNNNNNNNNNNNNNNNNNNNNNN 226 | if not self.commands_buffered.empty(): 227 | f = self.commands_buffered.get() 228 | 229 | cmd = "?" 230 | backup_timeout = ser.timeout 231 | ser.timeout = 0.01 232 | r1 = "" 233 | 234 | while(1): 235 | self.__ser_send(ser, cmd, monitor=False) 236 | status = self.__ser_read(ser, monitor=False) 237 | if len(status) > 10: 238 | if (status[0] == "<") and (status[-1] == ">"): 239 | r1 = status 240 | #print(r1) 241 | #break 242 | 243 | try: 244 | if r1[0] == "<": 245 | # 246 | text = r1[1:-1] 247 | feedback_split = text.split("|") 248 | positions = feedback_split[2].split(":") 249 | positions = positions[1] 250 | positions = positions.split(",") 251 | buffers = int(positions[0]) 252 | status = feedback_split[0] 253 | self.serFeedback.emit(r1) 254 | 255 | # GRBL command buffer = 0 256 | if buffers >= 2: 257 | break 258 | except Exception as e: 259 | print("Parse error", e) 260 | 261 | ser.timeout = backup_timeout 262 | self.__ser_send(ser, f) 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | # some commands require certain sequence and testing, these are put into recipes 271 | # process these recipes only when main buffer is consumed 272 | if True: 273 | if not self.action_recipe.empty(): 274 | rec = self.action_recipe.get() 275 | #self.action_recipe.clear() 276 | 277 | # get_params 278 | # home / ser.timeout 279 | # set_param 280 | # emergency stop 281 | # halt 282 | # jog 283 | 284 | if rec == "version": 285 | LOGGER.debug("version") 286 | ser.timeout = 2 287 | cmd = "$I" 288 | self.__ser_send(ser, cmd+'\n') 289 | r1 = self.__ser_read(ser) # [VER:1.1f-SCE2.20200405:] 290 | r2 = self.__ser_read(ser, monitor=False) # [OPT:VMZHL,35,254] 291 | r3 = self.__ser_read(ser, monitor=False) # [VTEMP] 292 | r3 = self.__ser_read(ser, monitor=False) # ok 293 | self.strVersion.emit(r1) 294 | 295 | if rec == "status1": 296 | #self.action_recipe.put("status1") 297 | LOGGER.debug("status") 298 | retry_cnt = 0 299 | ret = "" 300 | cmd = "?" 301 | backup_timeout = ser.timeout 302 | ser.timeout = 0.5 303 | 304 | while True: 305 | self.__ser_send(ser, cmd, monitor=False) 306 | status = self.__ser_read(ser, monitor=False) 307 | if len(status) > 10: 308 | if (status[0] == "<") and (status[-1] == ">"): 309 | ret = status 310 | self.serFeedback.emit(ret) 311 | break 312 | 313 | if retry_cnt > 0: 314 | LOGGER.info("Retry count " + str(retry_cnt)) 315 | 316 | retry_cnt += 1 317 | 318 | ser.timeout = backup_timeout 319 | 320 | 321 | 322 | ''' 323 | LOGGER.debug("status") 324 | ser.timeout = 0.5 325 | cmd = "?" 326 | self.__ser_send(ser, cmd, monitor=False) 327 | r1 = self.__ser_read(ser, monitor=False) 328 | if len(r1) > 5: 329 | self.serFeedback.emit(r1) 330 | ''' 331 | 332 | 333 | 334 | ''' 335 | retry_cnt = 0 336 | ret = "" 337 | backup_timeout = ser.timeout 338 | ser.timeout = 0.02 339 | if echo: 340 | print("") 341 | print("> ?") 342 | 343 | while True: 344 | status = send_command(ser, "?", echo=False) 345 | if len(status) > 10: 346 | if (status[0] == "<") and (status[-1] == ">"): 347 | ret = status 348 | if retry_cnt > 0: 349 | if echo: 350 | print("* Retry count", retry_cnt) 351 | break 352 | retry_cnt+1 353 | 354 | ser.timeout = backup_timeout 355 | return ret 356 | ''' 357 | 358 | 359 | if rec == "get_param_list": 360 | LOGGER.debug("get param list") 361 | temp = ser.timeout 362 | ser.timeout = 0.5 363 | cmd = "$$" 364 | self.__ser_send(ser, cmd + '\n') 365 | while True: 366 | p = self.__ser_read(ser) 367 | if (len(p) >= 2) and (p.find("ok") == 0): 368 | break 369 | ser.timeout = temp 370 | # TODO: return parameters to host 371 | 372 | # count few cycles with no delay 373 | # if delay count > xxx add delay 374 | # if delay count > yyy add put recipe status 375 | 376 | ser.close() 377 | self.strStatus.emit("Disconnected") 378 | 379 | except Exception as e: 380 | self.strError.emit("Error:"+str(e)) 381 | time.sleep(1) 382 | 383 | self.strStatus.emit("Disconnected") 384 | -------------------------------------------------------------------------------- /03_lens_tester_gui/pos_widget.py: -------------------------------------------------------------------------------- 1 | from PyQt5 import QtCore, QtGui, QtWidgets, uic, QtSvg 2 | from PyQt5.QtCore import * 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtWidgets import * 5 | from PyQt5.QtCore import Qt 6 | 7 | 8 | class PosAxis(QWidget): 9 | 10 | moved = pyqtSignal(int, int) 11 | value = None 12 | pi = None 13 | 14 | def __init__(self, name="", nr=0): 15 | self.name = name 16 | self.nr = nr 17 | 18 | QWidget.__init__(self, parent=None) 19 | self.lay = QVBoxLayout(self) 20 | 21 | self.group = QtWidgets.QGroupBox() 22 | self.group.setEnabled(False) 23 | self.group.setGeometry(QtCore.QRect(50, 50, 276, 79)) 24 | self.group.setObjectName("group_x_axis") 25 | self.gridLayout_2 = QtWidgets.QGridLayout(self.group) 26 | self.gridLayout_2.setObjectName("gridLayout_2") 27 | self.horizontalLayout_13 = QtWidgets.QHBoxLayout() 28 | self.horizontalLayout_13.setObjectName("horizontalLayout_13") 29 | self.verticalLayout_15 = QtWidgets.QVBoxLayout() 30 | self.verticalLayout_15.setObjectName("verticalLayout_15") 31 | self.label_x_pos = QtWidgets.QLabel(self.group) 32 | self.label_x_pos.setMinimumSize(QtCore.QSize(90, 0)) 33 | font = QtGui.QFont() 34 | font.setPointSize(14) 35 | font.setBold(True) 36 | font.setWeight(75) 37 | self.label_x_pos.setFont(font) 38 | self.label_x_pos.setObjectName("label_x_pos") 39 | self.verticalLayout_15.addWidget(self.label_x_pos) 40 | self.label_x_pi = QtWidgets.QLabel(self.group) 41 | font = QtGui.QFont() 42 | font.setPointSize(7) 43 | self.label_x_pi.setFont(font) 44 | self.label_x_pi.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 45 | self.label_x_pi.setObjectName("label_x_pi") 46 | self.verticalLayout_15.addWidget(self.label_x_pi) 47 | self.horizontalLayout_13.addLayout(self.verticalLayout_15) 48 | self.gridLayout_2.addLayout(self.horizontalLayout_13, 0, 3, 1, 1) 49 | self.btn_right = QtWidgets.QPushButton(self.group) 50 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 51 | sizePolicy.setHorizontalStretch(0) 52 | sizePolicy.setVerticalStretch(0) 53 | sizePolicy.setHeightForWidth(self.btn_right.sizePolicy().hasHeightForWidth()) 54 | self.btn_right.setSizePolicy(sizePolicy) 55 | self.btn_right.setAutoRepeat(True) 56 | self.btn_right.setAutoRepeatInterval(50) 57 | self.btn_right.setObjectName("btn_x_right") 58 | self.gridLayout_2.addWidget(self.btn_right, 0, 1, 1, 1) 59 | self.btn_left = QtWidgets.QPushButton(self.group) 60 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 61 | sizePolicy.setHorizontalStretch(0) 62 | sizePolicy.setVerticalStretch(0) 63 | sizePolicy.setHeightForWidth(self.btn_left.sizePolicy().hasHeightForWidth()) 64 | self.btn_left.setSizePolicy(sizePolicy) 65 | self.btn_left.setAutoRepeat(True) 66 | self.btn_left.setAutoRepeatInterval(50) 67 | self.btn_left.setObjectName("btn_left") 68 | self.gridLayout_2.addWidget(self.btn_left, 0, 0, 1, 1) 69 | 70 | self.group.setTitle(self.name) 71 | self.label_x_pos.setText("---") 72 | self.label_x_pi.setText("---") 73 | self.btn_right.setText(">") 74 | self.btn_left.setText("<") 75 | self.lay.addWidget(self.group) 76 | 77 | self.btn_right.clicked.connect(self.move_right) 78 | self.btn_left.clicked.connect(self.move_left) 79 | 80 | def set_name(self, name): 81 | self.name = name 82 | self.group.setTitle(self.name) 83 | 84 | def move_right(self): 85 | self.moved.emit(self.nr, 0) 86 | 87 | def move_left(self): 88 | self.moved.emit(self.nr, 1) 89 | 90 | def set_value(self, pos, pi): 91 | self.value = pos 92 | self.pi = pi 93 | self.label_x_pos.setText(str(round(self.value,3))) 94 | 95 | if self.pi: 96 | self.label_x_pi.setText("HIGH") 97 | else: 98 | self.label_x_pi.setText("LOW") 99 | 100 | def setEnabled(self, enabled): 101 | if enabled: 102 | self.group.setEnabled(True) 103 | else: 104 | self.group.setEnabled(False) 105 | 106 | 107 | class Pos(QWidget): 108 | # ch, dir 0=left, 1=right 109 | moved = pyqtSignal(int, int) 110 | axis_names = ["X", "Y", "Z", "A", "B", "C"] 111 | 112 | def __init__(self, parent=None, ch_count=4): 113 | self.ch_count = ch_count 114 | self.pos_list = [None]*ch_count 115 | 116 | QWidget.__init__(self, parent=None) 117 | self.lay = parent 118 | 119 | for i in range(self.ch_count): 120 | self.pos_list[i] = PosAxis(name=self.axis_names[i]+" axis", nr=i) 121 | self.lay.addWidget(self.pos_list[i]) 122 | self.pos_list[i].moved.connect(self.clicked_move) 123 | 124 | #self.pos_list[1].set_name("test") 125 | #self.pos_list[1].set_value(32.2, True) 126 | 127 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 128 | self.lay.addItem(spacerItem) 129 | 130 | def clicked_move(self, nr, direction): 131 | self.moved.emit(nr, direction) 132 | #print("aaa", nr, direction) 133 | 134 | def setEnabled(self, enabled): 135 | for i in range(self.ch_count): 136 | self.pos_list[i].setEnabled(enabled) 137 | 138 | def set_name(self, ch, name): 139 | self.pos_list[ch].set_name(name) 140 | 141 | def set_value(self, ch, pos, pi): 142 | self.pos_list[ch].set_value(pos, pi) 143 | 144 | 145 | -------------------------------------------------------------------------------- /03_lens_tester_gui/preset_widget.py: -------------------------------------------------------------------------------- 1 | from PyQt5 import QtCore, QtGui, QtWidgets, uic, QtSvg 2 | from PyQt5.QtCore import * 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtWidgets import * 5 | from PyQt5.QtCore import Qt 6 | 7 | 8 | class PresetPoint(QWidget): 9 | clicked_go = pyqtSignal(int, list) 10 | clicked_set = pyqtSignal(int) 11 | 12 | def __init__(self, name="", nr=0, ch_count=6): 13 | self.name = name 14 | self.nr = nr 15 | self.ch_count = ch_count 16 | self.values = [0]*ch_count 17 | 18 | QWidget.__init__(self, parent=None) 19 | self.lay = QVBoxLayout(self) 20 | 21 | self.preset_group = QtWidgets.QGroupBox() 22 | self.preset_group.setEnabled(False) 23 | self.preset_group.setGeometry(QtCore.QRect(30, 20, 131, 141)) 24 | self.preset_group.setObjectName("preset_group") 25 | self.gridLayout_6 = QtWidgets.QGridLayout(self.preset_group) 26 | self.gridLayout_6.setObjectName("gridLayout_6") 27 | self.btn_go = QtWidgets.QPushButton(self.preset_group) 28 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) 29 | sizePolicy.setHorizontalStretch(0) 30 | sizePolicy.setVerticalStretch(0) 31 | sizePolicy.setHeightForWidth(self.btn_go.sizePolicy().hasHeightForWidth()) 32 | self.btn_go.setSizePolicy(sizePolicy) 33 | font = QtGui.QFont() 34 | font.setBold(True) 35 | font.setWeight(75) 36 | self.btn_go.setFont(font) 37 | self.btn_go.setObjectName("btn_go") 38 | self.gridLayout_6.addWidget(self.btn_go, 0, 0, 1, 2) 39 | self.horizontalLayout_26 = QtWidgets.QHBoxLayout() 40 | self.horizontalLayout_26.setObjectName("horizontalLayout_26") 41 | self.label_19 = QtWidgets.QLabel(self.preset_group) 42 | self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 43 | self.label_19.setObjectName("label_19") 44 | self.horizontalLayout_26.addWidget(self.label_19) 45 | self.label_x = QtWidgets.QLabel(self.preset_group) 46 | self.label_x.setMinimumSize(QtCore.QSize(40, 0)) 47 | self.label_x.setObjectName("label_x") 48 | self.horizontalLayout_26.addWidget(self.label_x) 49 | self.gridLayout_6.addLayout(self.horizontalLayout_26, 1, 0, 1, 1) 50 | self.horizontalLayout_30 = QtWidgets.QHBoxLayout() 51 | self.horizontalLayout_30.setObjectName("horizontalLayout_30") 52 | self.label_27 = QtWidgets.QLabel(self.preset_group) 53 | self.label_27.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 54 | self.label_27.setObjectName("label_27") 55 | self.horizontalLayout_30.addWidget(self.label_27) 56 | self.label_y = QtWidgets.QLabel(self.preset_group) 57 | self.label_y.setMinimumSize(QtCore.QSize(40, 0)) 58 | self.label_y.setObjectName("label_y") 59 | self.horizontalLayout_30.addWidget(self.label_y) 60 | self.gridLayout_6.addLayout(self.horizontalLayout_30, 1, 1, 1, 1) 61 | self.horizontalLayout_31 = QtWidgets.QHBoxLayout() 62 | self.horizontalLayout_31.setObjectName("horizontalLayout_31") 63 | self.label_29 = QtWidgets.QLabel(self.preset_group) 64 | self.label_29.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 65 | self.label_29.setObjectName("label_29") 66 | self.horizontalLayout_31.addWidget(self.label_29) 67 | self.label_z = QtWidgets.QLabel(self.preset_group) 68 | self.label_z.setMinimumSize(QtCore.QSize(40, 0)) 69 | self.label_z.setObjectName("label_z") 70 | self.horizontalLayout_31.addWidget(self.label_z) 71 | self.gridLayout_6.addLayout(self.horizontalLayout_31, 2, 0, 1, 1) 72 | self.btn_set = QtWidgets.QPushButton(self.preset_group) 73 | self.btn_set.setObjectName("btn_set") 74 | self.gridLayout_6.addWidget(self.btn_set, 5, 0, 1, 2) 75 | self.horizontalLayout_38 = QtWidgets.QHBoxLayout() 76 | self.horizontalLayout_38.setObjectName("horizontalLayout_38") 77 | self.label_30 = QtWidgets.QLabel(self.preset_group) 78 | self.label_30.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 79 | self.label_30.setObjectName("label_30") 80 | self.horizontalLayout_38.addWidget(self.label_30) 81 | self.label_a = QtWidgets.QLabel(self.preset_group) 82 | self.label_a.setMinimumSize(QtCore.QSize(40, 0)) 83 | self.label_a.setObjectName("label_a") 84 | self.horizontalLayout_38.addWidget(self.label_a) 85 | self.gridLayout_6.addLayout(self.horizontalLayout_38, 2, 1, 1, 1) 86 | self.horizontalLayout_33 = QtWidgets.QHBoxLayout() 87 | self.horizontalLayout_33.setObjectName("horizontalLayout_33") 88 | self.label_34 = QtWidgets.QLabel(self.preset_group) 89 | self.label_34.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 90 | self.label_34.setObjectName("label_34") 91 | self.horizontalLayout_33.addWidget(self.label_34) 92 | self.label_b = QtWidgets.QLabel(self.preset_group) 93 | self.label_b.setMinimumSize(QtCore.QSize(40, 0)) 94 | self.label_b.setObjectName("label_b") 95 | self.horizontalLayout_33.addWidget(self.label_b) 96 | self.gridLayout_6.addLayout(self.horizontalLayout_33, 3, 0, 1, 1) 97 | self.horizontalLayout_40 = QtWidgets.QHBoxLayout() 98 | self.horizontalLayout_40.setObjectName("horizontalLayout_40") 99 | self.label_33 = QtWidgets.QLabel(self.preset_group) 100 | self.label_33.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 101 | self.label_33.setObjectName("label_33") 102 | self.horizontalLayout_40.addWidget(self.label_33) 103 | self.label_c = QtWidgets.QLabel(self.preset_group) 104 | self.label_c.setMinimumSize(QtCore.QSize(40, 0)) 105 | self.label_c.setObjectName("label_c") 106 | self.horizontalLayout_40.addWidget(self.label_c) 107 | self.gridLayout_6.addLayout(self.horizontalLayout_40, 3, 1, 1, 1) 108 | 109 | self.preset_group.setTitle(self.name) 110 | self.btn_go.setText("Go") 111 | self.label_19.setText("X:") 112 | self.label_x.setText("--") 113 | self.label_27.setText("Y:") 114 | self.label_y.setText("--") 115 | self.label_29.setText("Z:") 116 | self.label_z.setText("--") 117 | self.btn_set.setText("Set") 118 | self.label_30.setText("A:") 119 | self.label_a.setText("--") 120 | self.label_34.setText("B:") 121 | self.label_b.setText("--") 122 | self.label_33.setText("C:") 123 | self.label_c.setText("--") 124 | 125 | self.lay.addWidget(self.preset_group) 126 | 127 | self.btn_go.clicked.connect(self.btn_go_clicked) 128 | self.btn_set.clicked.connect(self.btn_set_clicked) 129 | 130 | def btn_go_clicked(self): 131 | self.clicked_go.emit(self.nr, self.values) 132 | 133 | def btn_set_clicked(self): 134 | self.clicked_set.emit(self.nr) 135 | 136 | def set_values(self, ch0=None, ch1=None, ch2=None, ch3=None, ch4=None, ch5=None): 137 | if ch0 is not None: 138 | self.values[0] = ch0 139 | self.label_x.setText(str(round(ch0,3))) 140 | 141 | if ch1 is not None: 142 | self.values[1] = ch1 143 | self.label_y.setText(str(round(ch1,3))) 144 | 145 | if ch2 is not None: 146 | self.values[2] = ch2 147 | self.label_z.setText(str(round(ch2,3))) 148 | 149 | if ch3 is not None: 150 | self.values[3] = ch3 151 | self.label_a.setText(str(round(ch3,3))) 152 | 153 | if ch4 is not None: 154 | self.values[4] = ch4 155 | self.label_b.setText(str(round(ch4,3))) 156 | 157 | if ch5 is not None: 158 | self.values[5] = ch5 159 | self.label_c.setText(str(round(ch5,3))) 160 | 161 | 162 | def setEnabled(self, enabled): 163 | if enabled: 164 | self.preset_group.setEnabled(True) 165 | else: 166 | self.preset_group.setEnabled(False) 167 | 168 | 169 | class Preset(QWidget): 170 | clicked_go = pyqtSignal(int, list) 171 | clicked_set = pyqtSignal(int) 172 | 173 | def __init__(self, parent=None, preset_cnt=2, ch_count=6): 174 | self.preset_cnt = preset_cnt 175 | self.parent = parent 176 | self.ch_count = ch_count 177 | self.preset_list = [None]*preset_cnt 178 | 179 | #QWidget.__init__(self, parent=self.parent) 180 | #self.lay = QHBoxLayout(self) 181 | #self.parent.setLayout(self.lay) 182 | 183 | 184 | QWidget.__init__(self, parent=None) 185 | self.lay = parent 186 | #self.parent.setLayout(self.lay) 187 | 188 | for i in range(self.preset_cnt): 189 | self.preset_list[i] = PresetPoint(name="Preset "+str(i), nr=i, ch_count=self.ch_count) 190 | self.lay.addWidget(self.preset_list[i]) 191 | self.preset_list[i].clicked_set.connect(self.widget_set) 192 | self.preset_list[i].clicked_go.connect(self.widget_go) 193 | 194 | # optional add spacer 195 | #spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 196 | #self.lay.addItem(spacerItem) 197 | 198 | def widget_go(self, nr, values): 199 | self.clicked_go.emit(nr, values) 200 | 201 | def widget_set(self, nr): 202 | self.clicked_set.emit(nr) 203 | 204 | def set_values(self, preset, ch0=None, ch1=None, ch2=None, ch3=None, ch4=None, ch5=None): 205 | self.preset_list[preset].set_values(ch0, ch1, ch2, ch3, ch4, ch5) 206 | 207 | def get_values(self, preset): 208 | return self.preset_list[preset].values 209 | 210 | def setEnabled(self, enabled): 211 | for i in range(self.preset_cnt): 212 | self.preset_list[i].setEnabled(enabled) 213 | 214 | 215 | # fill from dict 216 | # save to dict 217 | # hide unused channels 218 | # use list everywhere, define letters/names later 219 | -------------------------------------------------------------------------------- /03_lens_tester_gui/requirements.txt: -------------------------------------------------------------------------------- 1 | tqdm 2 | pyyaml 3 | pyqt5 4 | numpy 5 | pyserial 6 | pyqtgraph 7 | ezdxf 8 | scipy 9 | zmq 10 | -------------------------------------------------------------------------------- /03_lens_tester_gui/restart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/03_lens_tester_gui/restart.png -------------------------------------------------------------------------------- /03_lens_tester_gui/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/03_lens_tester_gui/screenshot.png -------------------------------------------------------------------------------- /03_lens_tester_gui/test_pos_widget.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'test_pos_widget.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.10 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_MainWindow(object): 15 | def setupUi(self, MainWindow): 16 | MainWindow.setObjectName("MainWindow") 17 | MainWindow.resize(800, 600) 18 | self.centralwidget = QtWidgets.QWidget(MainWindow) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.group_x_axis = QtWidgets.QGroupBox(self.centralwidget) 21 | self.group_x_axis.setEnabled(True) 22 | self.group_x_axis.setGeometry(QtCore.QRect(50, 50, 276, 79)) 23 | self.group_x_axis.setObjectName("group_x_axis") 24 | self.gridLayout_2 = QtWidgets.QGridLayout(self.group_x_axis) 25 | self.gridLayout_2.setObjectName("gridLayout_2") 26 | self.horizontalLayout_13 = QtWidgets.QHBoxLayout() 27 | self.horizontalLayout_13.setObjectName("horizontalLayout_13") 28 | self.verticalLayout_15 = QtWidgets.QVBoxLayout() 29 | self.verticalLayout_15.setObjectName("verticalLayout_15") 30 | self.label_x_pos = QtWidgets.QLabel(self.group_x_axis) 31 | self.label_x_pos.setMinimumSize(QtCore.QSize(90, 0)) 32 | font = QtGui.QFont() 33 | font.setPointSize(14) 34 | font.setBold(True) 35 | font.setWeight(75) 36 | self.label_x_pos.setFont(font) 37 | self.label_x_pos.setObjectName("label_x_pos") 38 | self.verticalLayout_15.addWidget(self.label_x_pos) 39 | self.label_x_pi = QtWidgets.QLabel(self.group_x_axis) 40 | font = QtGui.QFont() 41 | font.setPointSize(7) 42 | self.label_x_pi.setFont(font) 43 | self.label_x_pi.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 44 | self.label_x_pi.setObjectName("label_x_pi") 45 | self.verticalLayout_15.addWidget(self.label_x_pi) 46 | self.horizontalLayout_13.addLayout(self.verticalLayout_15) 47 | self.gridLayout_2.addLayout(self.horizontalLayout_13, 0, 3, 1, 1) 48 | self.btn_x_right = QtWidgets.QPushButton(self.group_x_axis) 49 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 50 | sizePolicy.setHorizontalStretch(0) 51 | sizePolicy.setVerticalStretch(0) 52 | sizePolicy.setHeightForWidth(self.btn_x_right.sizePolicy().hasHeightForWidth()) 53 | self.btn_x_right.setSizePolicy(sizePolicy) 54 | self.btn_x_right.setAutoRepeat(True) 55 | self.btn_x_right.setAutoRepeatInterval(50) 56 | self.btn_x_right.setObjectName("btn_x_right") 57 | self.gridLayout_2.addWidget(self.btn_x_right, 0, 1, 1, 1) 58 | self.btn_x_left = QtWidgets.QPushButton(self.group_x_axis) 59 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 60 | sizePolicy.setHorizontalStretch(0) 61 | sizePolicy.setVerticalStretch(0) 62 | sizePolicy.setHeightForWidth(self.btn_x_left.sizePolicy().hasHeightForWidth()) 63 | self.btn_x_left.setSizePolicy(sizePolicy) 64 | self.btn_x_left.setAutoRepeat(True) 65 | self.btn_x_left.setAutoRepeatInterval(50) 66 | self.btn_x_left.setObjectName("btn_x_left") 67 | self.gridLayout_2.addWidget(self.btn_x_left, 0, 0, 1, 1) 68 | MainWindow.setCentralWidget(self.centralwidget) 69 | self.menubar = QtWidgets.QMenuBar(MainWindow) 70 | self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21)) 71 | self.menubar.setObjectName("menubar") 72 | MainWindow.setMenuBar(self.menubar) 73 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 74 | self.statusbar.setObjectName("statusbar") 75 | MainWindow.setStatusBar(self.statusbar) 76 | 77 | self.retranslateUi(MainWindow) 78 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 79 | 80 | def retranslateUi(self, MainWindow): 81 | _translate = QtCore.QCoreApplication.translate 82 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) 83 | self.group_x_axis.setTitle(_translate("MainWindow", "X axis")) 84 | self.label_x_pos.setText(_translate("MainWindow", "---")) 85 | self.label_x_pi.setText(_translate("MainWindow", "---")) 86 | self.btn_x_right.setText(_translate("MainWindow", ">")) 87 | self.btn_x_left.setText(_translate("MainWindow", "<")) 88 | -------------------------------------------------------------------------------- /03_lens_tester_gui/test_pos_widget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 600 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | true 20 | 21 | 22 | 23 | 50 24 | 50 25 | 276 26 | 79 27 | 28 | 29 | 30 | X axis 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 90 42 | 0 43 | 44 | 45 | 46 | 47 | 14 48 | 75 49 | true 50 | 51 | 52 | 53 | --- 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 7 62 | 63 | 64 | 65 | --- 66 | 67 | 68 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 0 81 | 0 82 | 83 | 84 | 85 | > 86 | 87 | 88 | true 89 | 90 | 91 | 50 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 0 100 | 0 101 | 102 | 103 | 104 | < 105 | 106 | 107 | true 108 | 109 | 110 | 50 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 0 121 | 0 122 | 800 123 | 21 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /03_lens_tester_gui/tool_rdp.py: -------------------------------------------------------------------------------- 1 | """ 2 | The Ramer-Douglas-Peucker algorithm roughly ported from the pseudo-code provided 3 | by http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm 4 | """ 5 | from math import sqrt 6 | 7 | 8 | def distance(a, b): 9 | return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) 10 | 11 | 12 | def point_line_distance(point, start, end): 13 | if (start is end): 14 | return distance(point, start) 15 | else: 16 | n = abs( 17 | (end[0] - start[0]) * (start[1] - point[1]) - 18 | (start[0] - point[0]) * (end[1] - start[1]) 19 | ) 20 | d = sqrt( 21 | (end[0] - start[0]) ** 2 + (end[1] - start[1]) ** 2 22 | ) 23 | return n / d 24 | 25 | 26 | def rdp(points, epsilon): 27 | """Reduces a series of points to a simplified version that loses detail, but 28 | maintains the general shape of the series. 29 | """ 30 | dmax = 0.0 31 | index = 0 32 | for i in range(1, len(points) - 1): 33 | d = point_line_distance(points[i], points[0], points[-1]) 34 | if d > dmax: 35 | index = i 36 | dmax = d 37 | 38 | if dmax >= epsilon: 39 | results = rdp(points[:index+1], epsilon)[:-1] + rdp(points[index:], epsilon) 40 | else: 41 | results = [points[0], points[-1]] 42 | 43 | return results 44 | -------------------------------------------------------------------------------- /03_lens_tester_gui/utils.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | def boot_routine(file): 5 | config = {} 6 | 7 | with open(file) as f: 8 | config = json.load(f) 9 | f.close() 10 | 11 | config["clean_exit"] = False 12 | config["boot_count"] += 1 13 | 14 | with open(file, 'w') as f: 15 | json.dump(config, f, indent=2) 16 | 17 | return config 18 | 19 | 20 | def exit_routine(file, config): 21 | config["clean_exit"] = True 22 | with open(file, 'w') as f: 23 | json.dump(config, f, indent=2) 24 | -------------------------------------------------------------------------------- /03_lens_tester_gui/version.py: -------------------------------------------------------------------------------- 1 | __author__ = "Saulius Lukse" 2 | __copyright__ = "Copyright 2015-2021, Kurokesu" 3 | __version__ = "curves/experimental " 4 | 5 | if __name__ == "__main__": 6 | print(__version__) 7 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Recent code for evaluating Kurokesu motorized zoom lenses.** 2 | 3 | Kurokesu SCF2 multi-axis stepper motor controller System On Module (SOM) based motorized zoom lenses. Detailed documentation can be found on [Kurokesu Wiki](https://wiki.kurokesu.com/books/motorized-zoom-lenses), direct ordering on [Kurokesu E-store](https://www.kurokesu.com/shop/motorized_zoom_lenses) 4 | 5 | ![](03_lens_tester_gui/screenshot.png) 6 | -------------------------------------------------------------------------------- /firmware/stlink-utility.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/firmware/stlink-utility.png -------------------------------------------------------------------------------- /images/SCE2_controllers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/images/SCE2_controllers.jpg -------------------------------------------------------------------------------- /images/motorized_zoom_lenses.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/images/motorized_zoom_lenses.jpg -------------------------------------------------------------------------------- /images/zoom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kurokesu/SCE2-SDK/c078b8b15c2f80f60e4d9ae0b6d2ed56a02454bf/images/zoom.gif --------------------------------------------------------------------------------