add lcd data print
This commit is contained in:
@@ -19,13 +19,20 @@ QR_Flag = False
|
||||
#--------------LCD 滚动字符显示 START-----------------
|
||||
|
||||
LCD_Current_Y = 0
|
||||
LCD_Text_Array = []
|
||||
|
||||
def LCDDrawText(str_data):
|
||||
def LCDDrawText(str_data,_image):
|
||||
global LCD_Current_Y
|
||||
global LCD_Text_Array
|
||||
if _image is not None:
|
||||
lcd.display(_image)
|
||||
LCD_Text_Array.append(str_data)
|
||||
for text in LCD_Text_Array:
|
||||
lcd.draw_string(0, LCD_Current_Y, str_data, lcd.GREEN, lcd.BLACK)
|
||||
LCD_Current_Y += 15
|
||||
if LCD_Current_Y >= 200:
|
||||
LCD_Current_Y = 0
|
||||
del LCD_Text_Array[0]
|
||||
|
||||
|
||||
def LCDDrawTrackInfo(down_center,state_crossing,deflection_angle,_image):
|
||||
@@ -103,7 +110,7 @@ def data_format_wrapper(down_center, state_crossing, deflection_angle):
|
||||
return bytes(send_data)
|
||||
|
||||
|
||||
def UsartSend(str_data):
|
||||
def UsartSend(str_data, _img):
|
||||
'''
|
||||
串口发送函数
|
||||
'''
|
||||
@@ -301,9 +308,9 @@ def QR_Check():
|
||||
#---------------------MAIN-----------------------
|
||||
last_cx = 0
|
||||
last_cy = 0
|
||||
#Flag_track = False
|
||||
Flag_track = False
|
||||
#调试,使设备始终处于巡线模式
|
||||
Flag_track = True
|
||||
#Flag_track = True
|
||||
#将蓝灯引脚IO12配置到GPIO0,K210引脚支持任意配置
|
||||
fm.register(12, fm.fpioa.GPIO0)
|
||||
LED_B = GPIO(GPIO.GPIO0, GPIO.OUT) #构建LED对象
|
||||
@@ -313,12 +320,14 @@ btn_debug = GPIO(GPIO.GPIO1, GPIO.IN)
|
||||
x_num = 0
|
||||
while True:
|
||||
LED_B.value(0) #点亮LED
|
||||
# 拍摄图片
|
||||
img = sensor.snapshot()
|
||||
# 串口数据接收处理
|
||||
data = uart.read(8)
|
||||
if data is not None:
|
||||
print(data)
|
||||
print(len(data))
|
||||
print(binascii.hexlify(data).decode('utf_8'))
|
||||
#LCDDrawText(data, img)
|
||||
#LCDDrawText(str(len(data)), img)
|
||||
LCDDrawText(binascii.hexlify(data).decode('utf_8'), img)
|
||||
if(len(data) >= 8):
|
||||
if((data[1] == 0x02)&(data[7] == 0xBB)):
|
||||
# 巡线与控制舵机
|
||||
@@ -363,8 +372,6 @@ while True:
|
||||
QR_Flag = False
|
||||
|
||||
|
||||
# 拍摄图片
|
||||
img = sensor.snapshot()
|
||||
# 去除图像畸变
|
||||
#img.lens_corr(DISTORTION_FACTOR)
|
||||
# 二维码识别
|
||||
@@ -378,6 +385,7 @@ while True:
|
||||
UsartSend(data_format_wrapper(down_center, state_crossing, deflection_angle))
|
||||
time.sleep_ms(10)
|
||||
is_need_send_data = False
|
||||
|
||||
# 在LCD上显示
|
||||
#lcd.display(img)
|
||||
#按键KEY按下。开启或关闭调试,并退出所有任务。
|
||||
|
||||
Reference in New Issue
Block a user