[software]
-py_file = G:\1.work\3.ASR\2.G5\产测工具\FactoryTool\module_test.py
+py_file = H:\1.work\3.ASR\2.G5\产测工具\FactoryTool\module_test.py
json_file = sort_setting.json
[detection]
automated = False
-item = RF校准,电源键测试,按键1测试,按键2测试
+item = 屏幕测试
restart = False
imei = False
[version]
-ifdetect = True
+ifdetect = False
cmd = import versions\r\nversions.Build_Time
-version = 2023-12-06 9:47:51
+version = 2023-12-08
import ujson
from machine import I2C
import audio
-from machine import Pin
+from machine import Pin
+from machine import ExtInt
usb = USB()
gsensor = None
except Exception as e:
print("Hsensor none HX3918:{}".format(e))
+is_LCD = 0
+try :
+ lcd_ctrl = Pin(Pin.GPIO18, Pin.OUT, Pin.PULL_DISABLE, 1)
+ lcd_ctrl.write(0)
+ utime.sleep_ms(20)
+ lcd_ctrl.write(1)
+ import lcd
+ is_LCD = 1
+ lcd.lcd.lcd_clear(0xf800)
+ print("lcd:{}".format("lcd_clear"))
+except Exception as e:
+ print("lcd:{}".format(e))
+def extint_cb(args):
+ pass
class TestBase(object):
@staticmethod
quecgnss.gnssEnable(0)
return False
+ @staticmethod
+ def gps_gsv_test():
+ quecgnss.init()
+ quecgnss.gnssEnable(2)
+ gsv_data=[]
+ GSV_dict = {}
+ tmp_very_ok_count = 0
+ GSV_sig_very_ok_count = 0
+ i = 50
+ while 1:
+ utime.sleep(1)
+ gsv_data = quecgnss.get_gsv()
+ #print("tmp_very_ok_count:{}gsv_data:{}".format(tmp_very_ok_count,gsv_data))
+ tmp_very_ok_count = 0
+ for j in range(len(gsv_data)) :
+ if j % 2 == 0:
+ if j+1 >= len(gsv_data) :
+ #print("gsv_data num error!!")
+ break
+ if (gsv_data[j+1])>=30:
+ tmp_very_ok_count +=1
+ GSV_dict[gsv_data[j]] = gsv_data[j+1]
+ if(tmp_very_ok_count > GSV_sig_very_ok_count ):
+ GSV_sig_very_ok_count = tmp_very_ok_count
+ i-=1
+ if i <= 0:
+ break
+ if GSV_sig_very_ok_count > 3 and i < 20:
+ break
+ GNSS_str_data = ""
+ count = 0
+ for j in range(200):
+ for key in GSV_dict :
+
+ if(key != j):
+ continue
+ if GSV_dict[key] >= 1 :
+ GNSS_str_data+=" {:<3}:[{:<3}] ".format(key,GSV_dict[key])#:<3
+ count+=1
+ if count % 2 == 0:
+ GNSS_str_data+="\n"
+ #print("GSV_dict:\n{} ".format(GSV_dict))
+ print("GPS:tmp_very_ok_count:{}\ndata:\n{} ".format(GSV_sig_very_ok_count,GNSS_str_data))
+ if GSV_sig_very_ok_count > 3:
+ quecgnss.gnssEnable(0)
+ return True
+ quecgnss.gnssEnable(0)
+ return False
+
@staticmethod
def sim_test():
if sim.getIccid() == -1:
def camera_test():
return True
+ @staticmethod
+ def camera_read_test():
+ try :
+
+ import camera
+ dec = camera.camCapture(0,240,320,1,128,128)
+ state = dec.open()
+ if state == 0:
+ return True
+ else :
+ return False
+ except Exception as e:
+ print("camera_read_test :{}".format(e))
+ return False
+
@staticmethod
def hsensor_test():
i = 5
if c_data[11] == 0 and c_data[13] == 0: #没校准
print("hsensor_test:校准数据:",c_data[11],c_data[13])
return False
- if c_data[0] < 3000 and c_data[0] != 0 and c_data[1]<3000 and c_data[1]!=0 and c_data[2]<3000 and c_data[2]!=0:
+ if c_data[0] < 3000 and c_data[0] != 0 and c_data[1]<4000 and c_data[1]!=0 and c_data[2]<3000 and c_data[2]!=0:
return True
i-=1
if i <= 0:
break
uos.remove("/usr/1.amr")
-
+
@staticmethod
def power_key_test():
+ extint = ExtInt(ExtInt.GPIO26, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_DISABLE, extint_cb)
+ extint.disable()
key26 = Pin(Pin.GPIO26, Pin.IN, Pin.PULL_PU, 0)
i = 1000
- print("power_key_test:",key26.read())
+ key_v = key26.read()
+ print("power_key_test:",key_v)
while 1:
- if key26.read() == 0:
+ if key26.read() != key_v:
return True
utime.sleep_ms(20)
i-=1
if i <= 0:
break
+ return False
+
@staticmethod
def key1_test():
+ extint = ExtInt(ExtInt.GPIO20, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_DISABLE, extint_cb)
+ extint.disable()
key19 = Pin(Pin.GPIO19, Pin.OUT, Pin.PULL_PU, 0)
key20 = Pin(Pin.GPIO20, Pin.IN, Pin.PULL_PU, 0)
i = 1000
- print("key1_test:",key20.read())
+ key_v = key20.read()
+ print("key1_test1:",key_v)
while 1:
- if key20.read() == 0:
+ print("key1_test:",key20.read())
+ if key20.read() != key_v:
return True
utime.sleep_ms(20)
i-=1
if i <= 0:
break
-
+ return False
+
@staticmethod
def key2_test():
+ extint = ExtInt(ExtInt.GPIO22, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_DISABLE, extint_cb)
+ extint.disable()
key19 = Pin(Pin.GPIO19, Pin.OUT, Pin.PULL_PU, 0)
key22 = Pin(Pin.GPIO22, Pin.IN, Pin.PULL_PU, 0)
i = 1000
- print("key2_test:",key22.read())
+ key_v = key22.read()
+ print("key2_test:",key_v)
while 1:
- if key22.read() == 0:
+ if key22.read() != key_v:
return True
utime.sleep_ms(20)
i-=1
if i <= 0:
- break
-
+ break
+ return False
+ @staticmethod
+ def lcd_test():
+ if is_LCD != 1:
+ return False
+ i = 20
+ colour = 0xf00
+ print("lcd_test:colour:0x%X"%(colour))
+ lcd.lcd.lcd_clear(0xf00)
+ while 1:
+
+ if colour >= 0xffff:
+ colour = 0
+ lcd.lcd.lcd_clear(colour) #
+ print("colour:0x%X"%(colour))
+ colour = colour + 0xF00
+ utime.sleep_ms(1000)
+ i-=1
+ if i <= 0:
+ break
+ def motor_test():
+ motor_pin = Pin(Pin.GPIO20, Pin.OUT, Pin.PULL_PD, 0)
+ motor_pin.write(1)
+ utime.sleep_ms(3000)
+ motor_pin.write(0)
+ return True
def det_changedir_end():
- #uos.rename('usr/main_1.py','usr/main.py')
-
+ #uos.remove("/usr/test.py")
Power.powerRestart()
return True
["flash读写", "write_test()", 0,0],
["重力传感器", "gsensor_test()", 0,0],
["卫星定位","gps_test()",0,0],
+ ["卫星定位信号测试","gps_gsv_test()",0,0],
["SIM卡测试","sim_test()",0,0],
["4G信号测试","signal_test()",0,0],
- ["摄像头测试","camera_test()",0,1],
["心率血氧测试","hsensor_test()",0,0],
["温度测试","temp_test()",0,0],
- ["麦克风喇叭测试","microphone_test()",0,1],
["电源键测试","power_key_test()",0,2],
["按键1测试","key1_test()",0,2],
- ["按键2测试","key2_test()",0,2]
+ ["按键2测试","key2_test()",0,2],
+ ["屏幕测试","lcd_test()",0,1],
+ ["摄像头成像测试","camera_test()",0,1],
+ ["摄像头读取测试","camera_read_test()",0,0],
+ ["麦克风喇叭测试","microphone_test()",0,1],
+ ["震动马达测试","motor_test()",0,1],
+ ["测试结束","det_changedir_end()",0,2]
+
+
+
],
"tips": {
"flash读写":"正在外部flash读写测试...",
"重力传感器": "正在测试三轴传感器...",
"卫星定位":"正在测试卫星定位...",
+ "卫星定位信号测试":"正在搜索卫星定位...",
"SIM卡测试":"需插卡测试!!!正在读取Iccid...",
"4G信号测试":"需插卡测试!!!正在读取信号强度...",
- "摄像头测试":"请观察屏幕成像,手动点确认...",
+ "摄像头成像测试":"请观察屏幕成像,手动点确认...",
+ "摄像头读取测试":"...",
"心率血氧测试":"需校准完活体后测试,请将手表背面对空!!!",
"温度测试":"正在测试温度传感器...",
"麦克风喇叭测试":"点击确认后,请对着麦克风说话,并留意喇叭是否有声音输出!!!!",
"电源键测试":"点击确认后,请在20秒内按下电源按键",
"按键1测试":"点击确认后,请在20秒内按下按键1",
- "按键2测试":"点击确认后,请在20秒内按下按键2"
+ "按键2测试":"点击确认后,请在20秒内按下按键2",
+ "屏幕测试":"点击确认后,观察屏幕是否有黑线或斑块",
+ "震动马达测试":"震动马达测试...",
+ "测试结束":"测试完毕,将自动重启,请留意测试结果"
+
}