-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbefehle_gui_support.py
140 lines (117 loc) · 3.48 KB
/
befehle_gui_support.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Support module generated by PAGE version 4.26
# in conjunction with Tcl version 8.6
# Jul 05, 2020 12:03:42 PM CEST platform: Windows NT
# Jul 05, 2020 12:15:56 PM CEST platform: Windows NT
# Jul 05, 2020 05:33:07 PM CEST platform: Windows NT
import sys
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
def set_Tk_var():
global kd
kd = tk.DoubleVar()
global kp
kp = tk.DoubleVar()
global ki
ki = tk.DoubleVar()
global PoM
PoM = tk.BooleanVar()
global nullpunkt_offset
nullpunkt_offset = tk.IntVar()
global overwrite0
overwrite0 = tk.IntVar()
global overwrite1
overwrite1 = tk.IntVar()
global overwrite2
overwrite2 = tk.IntVar()
global overwrite3
overwrite3 = tk.IntVar()
global overwrite_gnd
overwrite_gnd = tk.IntVar()
global sollwert
sollwert = tk.IntVar()
global bias
bias = tk.DoubleVar()
global sweep_delay
sweep_delay = tk.DoubleVar()
global sweep_dec
sweep_dec = tk.DoubleVar()
global sweep_start
sweep_start = tk.DoubleVar()
def btn_send_sollwert():
message = "00"+ "%6.0f" % (sollwert.get()) + "%";
s.sendSerialData(message)
print('befehle_gui_support.btn_send_sollwert')
sys.stdout.flush()
def btn_send_fullon():
message = "07" + "%";
s.sendSerialData(message)
print('befehle_gui_support.btn_send_fullon')
sys.stdout.flush()
def btn_send_nullpunkt_offset():
message = "01" + "%6.2f" % (nullpunkt_offset.get()) + "%";
s.sendSerialData(message)
sys.stdout.flush()
def btn_send_off():
message = "05" + "%";
s.sendSerialData(message)
print('befehle_gui_support.btn_send_off')
sys.stdout.flush()
def btn_send_offsweep():
message = "06" + "%";
s.sendSerialData(message)
print('befehle_gui_support.btn_send_offsweep')
sys.stdout.flush()
def btn_send_overwrite():
message = "03" + "%6.0f%6.0f%6.0f%6.0f%6.0f" % (overwrite0.get(),overwrite1.get(),overwrite2.get(),overwrite3.get(),overwrite_gnd.get()) + "%"
s.sendSerialData(message)
print(message)
print('befehle_gui_support.btn_send_overwrite')
sys.stdout.flush()
def btn_send_pid_values():
message = "02" + "%8.2f%8.2f%8.2f%8.0f" % (kp.get(), ki.get(), kd.get(), not PoM.get()) +"%"
s.sendSerialData(message)
print(message)
print('befehle_gui_support.btn_send_pid_values')
sys.stdout.flush()
def btn_set_automatic():
message = "04" + "%";
s.sendSerialData(message)
print('befehle_gui_support.btn_set_automatic')
sys.stdout.flush()
def btn_send_bias():
message = "09" + "%8.2f" % (bias.get()) + "%"
s.sendSerialData(message)
print(message)
print('befehle_gui_support.btn_send_bias')
sys.stdout.flush()
def btn_send_sweep_values():
message = "08" + "%8.2f%8.2f%8.2f" % (sweep_delay.get(), sweep_dec.get(), sweep_start.get()) + "%"
s.sendSerialData(message)
print(message)
print('befehle_gui_support.btn_send_sweep_values')
sys.stdout.flush()
def init(top, gui,SerialReference, *args, **kwargs):
global w, top_level, root, s
s = SerialReference
w = gui
top_level = top
root = top
def destroy_window():
# Function which closes the window.
global top_level
top_level.destroy()
top_level = None
if __name__ == '__main__':
import befehle_gui
befehle_gui.vp_start_gui()