tuning min_tout for get into account windows timer discret ~16ms

This commit is contained in:
shrlnm 2023-06-11 09:10:17 +03:00
parent 988f8d9b67
commit e51f2575fb

View File

@ -1662,8 +1662,8 @@ class ELM:
# set elm timeout to minimum among 3 values # set elm timeout to minimum among 3 values
# 1) 300ms constant # 1) 300ms constant
# 2) 2 * self.response_time in ms # 2) 2 * self.response_time in ms
# 3) 4.7s // (number of farmes in cmd) (5s session timeout - 300ms safety gap) # 3) 4.7s // (number of farmes in cmd) (5s session timeout - 300ms safety gap - 16ms windows timer discret)
min_tout = min( 300, 2*self.response_time*1000, 4700.//(len(raw_command)+1)) min_tout = min( 300, 2*self.response_time*1000, 4700.//len(raw_command)-16)
if min_tout<4: if min_tout<4:
min_tout = 4 # not less then 4ms min_tout = 4 # not less then 4ms
self.elmTimeout = hex(int(min_tout//4))[2:].zfill(2) self.elmTimeout = hex(int(min_tout//4))[2:].zfill(2)