Skip to content

Commit

Permalink
convert flag/float to int
Browse files Browse the repository at this point in the history
comment unreachable code
  • Loading branch information
Furtif committed Jun 11, 2023
1 parent ab5ae49 commit f0c0ad9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dataeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def init(self, req):
item_name.setFlags(item_name.flags() ^ core.Qt.ItemIsEditable)
item_bc.setFlags(item_bc.flags() ^ core.Qt.ItemIsEditable)

item_bc.setTextAlignment(core.Qt.AlignHCenter | core.Qt.AlignVCenter)
item_bc.setTextAlignment(int(core.Qt.AlignHCenter) | int(core.Qt.AlignVCenter))

item_sb.valueChanged.connect(lambda state,
di=dataitem, slf=item_sb: self.start_byte_changed(di, slf))
Expand Down
15 changes: 7 additions & 8 deletions elm.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ def expect_carriage_return(self, time_out=1):
if (tc - tb) > time_out:
return self.buff + b"TIMEOUT"

self.close()
self.connectionStatus = False
return ''
# self.close()
# self.connectionStatus = False
# return ''

def expect(self, pattern, time_out=1):
tb = time.time() # start time
Expand All @@ -479,9 +479,9 @@ def expect(self, pattern, time_out=1):
if (tc - tb) > time_out:
return self.buff + _("TIMEOUT")

self.close()
self.connectionStatus = False
return ''
# self.close()
# self.connectionStatus = False
# return ''

def check_elm(self):

Expand Down Expand Up @@ -1054,7 +1054,7 @@ def send_can_cfc0(self, command):
# receiving consecutive frames
while len(responses) < nframes:
# now we should send ff
sBS = hex(min(nframes - len(responses), 0xf))[2:]
sBS = hex(min(int(nframes) - len(responses), 0xf))[2:]
frsp = self.send_raw('300' + sBS + '00' + sBS)

# analyse response
Expand Down Expand Up @@ -1122,7 +1122,6 @@ def send_raw(self, command, expect='>'):
self.buff = self.port.expect(expect, self.portTimeout)
if not self.port.connectionStatus:
break
return ''
tc = time.time()
if (tc - tb) > self.portTimeout and "TIMEOUT" not in self.buff:
self.buff += " TIMEOUT"
Expand Down

0 comments on commit f0c0ad9

Please sign in to comment.