Skip to content

Commit

Permalink
code formating
Browse files Browse the repository at this point in the history
  • Loading branch information
drunsinn committed Apr 15, 2023
1 parent 3b74d5d commit 15ea3bb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions pyLSV2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,6 @@ def read_plc_memory(
plc_values = []

if mem_type is lc.MemoryType.STRING:

for i in range(number_of_elements):
address = (
start_address + first_element * mem_byte_count + i * mem_byte_count
Expand Down Expand Up @@ -1381,7 +1380,6 @@ def read_plc_memory(
)
return []
else:

max_elements_per_transfer = math.floor(255 / mem_byte_count)
num_groups = math.ceil(number_of_elements / max_elements_per_transfer)
logging.debug(
Expand Down
4 changes: 2 additions & 2 deletions pyLSV2/misc_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ def decode_scope_reading(
unit=signal.unit,
)

#header = data_set[sig_data_start : sig_data_start + 6]
#if header != bytearray(b"\x00\x20\xff\xff\xff\xff"):
# header = data_set[sig_data_start : sig_data_start + 6]
# if header != bytearray(b"\x00\x20\xff\xff\xff\xff"):
# raise LSV2DataException("unknown signal header format")

unpack_string = "!32l"
Expand Down
1 change: 0 additions & 1 deletion scripts/lsv2_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
print("Connecting to {}".format(args.address))

with pyLSV2.LSV2(args.address, port=19000, timeout=5) as con:

con = pyLSV2.LSV2(args.address, port=19000, timeout=5, safe_mode=False)
con.connect()

Expand Down
18 changes: 10 additions & 8 deletions scripts/real_time_readings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
with open("data.txt", "w") as fp:
readings_counter = 0
count_high_freq = 0

for package in con.real_time_readings(selected_signals, duration, interval):
signal_readings = package.get_data()
readings_per_signal = len(signal_readings[0].data)
Expand All @@ -50,8 +50,8 @@
# for signal in signal_readings:
# value = (signal.data[i] * signal.factor) + signal.offset
# print(value, signal.unit)
if count_high_freq % 5 == 0 :
# This condition is only for signals of low frequency
if count_high_freq % 5 == 0:
# This condition is only for signals of low frequency
position_X = round(
signal_readings[0].data[i] * signal_readings[0].factor
+ signal_readings[0].offset,
Expand All @@ -68,12 +68,14 @@
3,
)
I_nominal_X = round(
signal_readings[3].data[i] * signal_readings[3].factor
+ signal_readings[3].offset,
3,
)
signal_readings[3].data[i] * signal_readings[3].factor
+ signal_readings[3].offset,
3,
)

print(f"Position X = {position_X} mm , Position Y = {position_Y} , Position Z = {position_Z}, I nominal X = {I_nominal_X} ")
print(
f"Position X = {position_X} mm , Position Y = {position_Y} , Position Z = {position_Z}, I nominal X = {I_nominal_X} "
)
fp.write(
"Position X = %f mm , Position Y = %f , Position Z = %f , I nominal X = %f\n"
% (position_X, position_Y, position_Z, I_nominal_X)
Expand Down
1 change: 0 additions & 1 deletion scripts/scope2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
scope_signals.append(new_signal)

with open(args.output, "w", encoding="utf8") as csv_fp:

csv = csv.writer(csv_fp, dialect="excel", lineterminator="\n")
csv.writerow(list(map(lambda x: x.normalized_name(), scope_signals)))
readings_counter = 0
Expand Down

0 comments on commit 15ea3bb

Please sign in to comment.