修正x,y顺序错误的情况
This commit is contained in:
+22
-8
@@ -125,14 +125,19 @@ class Decoder(srd.Decoder):
|
|||||||
self.put(ss, es, self.out_ann,[1, [str(bit)]])
|
self.put(ss, es, self.out_ann,[1, [str(bit)]])
|
||||||
#下面处理每个字段
|
#下面处理每个字段
|
||||||
if self.state == 'HEADER':
|
if self.state == 'HEADER':
|
||||||
self.header_str += str(bit)
|
if(self.head_cnt == 0 and bit == 0):# 如果是第一个数据位且为0,则认为是y坐标数据
|
||||||
self.head_cnt = self.head_cnt+1
|
self.header2_str += str(bit)
|
||||||
if self.head_cnt == 6:
|
self.head2_cnt = self.head2_cnt+1
|
||||||
self.put(self.header_first, es, self.out_ann,[2, ['HEADER_x:' + self.header_str]])
|
self.state = 'HEADER3'
|
||||||
self.state = 'xpos'
|
else:
|
||||||
self.xpos_first = es
|
self.header_str += str(bit)
|
||||||
self.xpos_cnt = 0 #当前坐标 位数归零,准备累积
|
self.head_cnt = self.head_cnt+1
|
||||||
self.data = 0 #当前坐标值归零,准备开始累积
|
if self.head_cnt == 6:
|
||||||
|
self.put(self.header_first, es, self.out_ann,[2, ['HEADER_x:' + self.header_str]])
|
||||||
|
self.state = 'xpos'
|
||||||
|
self.xpos_first = es
|
||||||
|
self.xpos_cnt = 0 #当前坐标 位数归零,准备累积
|
||||||
|
self.data = 0 #当前坐标值归零,准备开始累积
|
||||||
elif self.state == 'xpos':
|
elif self.state == 'xpos':
|
||||||
if self.xpos_cnt == 19:
|
if self.xpos_cnt == 19:
|
||||||
self.data = ((not bit) << self.xpos_cnt) | self.data
|
self.data = ((not bit) << self.xpos_cnt) | self.data
|
||||||
@@ -165,6 +170,15 @@ class Decoder(srd.Decoder):
|
|||||||
self.ypos_first = es
|
self.ypos_first = es
|
||||||
self.ypos_cnt = 0 #当前坐标 位数归零,准备累积
|
self.ypos_cnt = 0 #当前坐标 位数归零,准备累积
|
||||||
self.data = 0 #当前坐标值归零,准备开始累积
|
self.data = 0 #当前坐标值归零,准备开始累积
|
||||||
|
elif self.state == 'HEADER3':
|
||||||
|
self.header2_str += str(bit)
|
||||||
|
self.head2_cnt = self.head2_cnt+1
|
||||||
|
if self.head2_cnt == 6:
|
||||||
|
self.put(self.header2_first, es, self.out_ann,[6, ['HEADER_y:' + self.header2_str]])
|
||||||
|
self.state = 'ypos'
|
||||||
|
self.ypos_first = es
|
||||||
|
self.ypos_cnt = 0 #当前坐标 位数归零,准备累积
|
||||||
|
self.data = 0 #当前坐标值归零,准备开始累积
|
||||||
elif self.state == 'ypos':
|
elif self.state == 'ypos':
|
||||||
if self.ypos_cnt == 19:
|
if self.ypos_cnt == 19:
|
||||||
self.data = ((not bit) << self.ypos_cnt) | self.data
|
self.data = ((not bit) << self.ypos_cnt) | self.data
|
||||||
|
|||||||
Reference in New Issue
Block a user