Open JohannesAppel opened 4 years ago
@JohannesAppel
maybe the threading can speed it up?
Threading does not speed up it only allows to run multiple Thread quasi parallel. All Thread are running using one CPU, and using Python only one Thread is running at any timeslice. In general you can say, threading is slower as the CPU power are shared between the Threads.
...displays it in neat columns.
You havn't implemented to use your `"%s\t%s\n" %(frame.id, text(frame.data)) yet.
@WK-GiHu
Threading does not speed up it only allows to run multiple Thread quasi parallel.
So the threading won't improve anything?
Can we at least try to implement some of the code in the all-ready threaded DataLogger
? Seeing that it works with unknown number of datalines? It's just a thought. Isn't part of the reason were using threads and two modules to get the data real time?
You havn't implemented to use your `"%s\t%s\n" %(frame.id, text(frame.data)) yet.
Are you referring to LogData
or our DataLogger
?
@JohannesAppel
It's just a thought. Isn't part of the reason were using threads and two modules to get the data real time?
The initial decision was the slow/flickering display in the tkinter window.
The assumption was, canlib.read()
blocks the tkinter.mainloop()
, therefore it needs to run in a own Thread
.
You havn't implemented to use your `"%s\t%s\n" %(frame.id, text(frame.data)) yet. Are you referring to LogData or our DataLogger?
The implemented https://github.com/JohannesAppel/johannesappel-/blob/aa135992bcce6237f6a6c0151da9183c6fce5647/DataLogger/src/main.py#L22 does not use text(...
it inserts the raw Frame object.
Make https://github.com/JohannesAppel/johannesappel-/blob/0b6832fd40a0bc7757494809f35f34baa983fc09/DataLogger/src/canbus.py#L96
a CanBus
class method bei identing and change def text(t):
to def text(self, t):
super().insert(tk.END, "{:<4} {}".format(frame.id, self.cbus.text(frame.data)))
@WK-GiHu Received the following error?
Using channel: Kvaser Leaf Professional HS (channel 0), EAN: 73-30130-00404-7
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Hex\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\Hex\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 749, in callit
func(*args)
File "C:\Users\Hex\eclipse-workspace\DataLogger\src\main.py", line 49, in display
self.frame_listbox.insert("{:<5} {}".format(frame.id, frame.data))
File "C:\Users\Hex\eclipse-workspace\DataLogger\src\main.py", line 22, in insert
super().insert(tk.END, "{:<4} {}".format(frame.id, self.cbus.text(frame.data)))
AttributeError: 'str' object has no attribute 'id'
CanBus.stop()
Trashed frames:91
EXIT, none_count:0
@JohannesAppel
AttributeError: 'str' object has no attribute 'id'
Wrong codeline, revert Line 22 https://github.com/JohannesAppel/johannesappel-/blob/aa135992bcce6237f6a6c0151da9183c6fce5647/DataLogger/src/main.py#L22
and change Line 49
@WK-GiHu I've been working on a different module with the same purpose just to familiarize myself with Python a bit more and try to solve the project at hand without threading, since I don't understand it (and Python) well yet.
I figured it out and the program is able to run, receive and display data from the bike. It shows up on
tkinter
and displays it in neat columns. It also works around the "unknown data lines" problem we currently have.The code is under the
LogData
folder. Is it possible that we can maybe split that into threading? It works fast, but still not fast enough and maybe the threading can speed it up?