I am developing a part for a router which receives data and sends it wireless. Someone already made a huge part, but it doesn't work at all after I debugged by logging steps.
Code:
class TimerEvent(threading.Thread):
def __init__(self):
super(TimerEvent, self).__init__()
self.daemon = True
self.event = threading.Event()
def run(self):
while True:
time.sleep(0.2)
self.event.set()
self.timerevent = TimerEvent()
self.timerevent.start()
functions = {
0x01: self.msg_0x01,
0x02: self.msg_0x02
}
while True:
if self.timerevent.event.isSet():
split_data = can.split()
if all(k in self.msg for k in (0x01, 0x02)):
if self.status:
"other code"
So the issue here is:
if self.timerevent.event.isSet():
This doesn't work
if all(k in self.msg for k in (0x01, 0x02)):
this neither. here, it actually "skips" the if statement while it shouldn't skip it.
Aucun commentaire:
Enregistrer un commentaire