From: p15692025051 <846603105@qq.com> Date: Wed, 6 Dec 2023 09:57:00 +0000 (+0800) Subject: 产测工具提交 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=b5c0badb0c2f5ea3870f8dd5d293eb51f1befdd4;p=mirrors%2FASR1603_G5.git 产测工具提交 跌倒报警参数修改 --- diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modGsensor_SC7A20.c b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modGsensor_SC7A20.c index 2a119e74..27fd8f48 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modGsensor_SC7A20.c +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modGsensor_SC7A20.c @@ -243,8 +243,8 @@ void Gsensor_CALLBACK_OP(uint8_t state) } } -#define FALL_DETECH_LOW_THRESHOLD 35 -#define FALL_COUNTER_THRESHOLD 7 +#define FALL_DETECH_LOW_THRESHOLD 45 +#define FALL_COUNTER_THRESHOLD 5 static uint16_t fall_counter = 0; uint8_t gsensor_sc7a20_fall_detect(acc_g_data_t * acc) { diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modHsensor_HX3918.c b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modHsensor_HX3918.c index 2ce7d989..d916a6a7 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modHsensor_HX3918.c +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modHsensor_HX3918.c @@ -169,14 +169,14 @@ void HX3918_thread_do(void) // } #if CONFIG_SC7A20 - //if(ir_wear == 1 && cap_wear==1) + if(ir_wear == 1 && cap_wear==1) { SL_SC7A20_PEDO_KCAL_WRIST_SLEEP_SWAY_L_ALGO(); } #endif - Helios_msleep(1000); + Helios_msleep(990); if(HX3918_sleep_flag == 1) { diff --git a/2.sdk/project/D10/merge_bin.py b/2.sdk/project/D10/merge_bin.py index 37e4cee8..ed218943 100644 --- a/2.sdk/project/D10/merge_bin.py +++ b/2.sdk/project/D10/merge_bin.py @@ -12,7 +12,7 @@ output_list = [] # 文件名--》下标 def text_to_hash(filename: str) -> str: output_list.append(filename.split("\\")[-1][:-4]) - EventMesh.debug_log(str(len(output_list)-1) + filename[-4:]) + print(str(len(output_list)-1) + filename[-4:]) return str(len(output_list)-1) + filename[-4:] @@ -30,17 +30,17 @@ def merge_bin(res='res.bin', *args): fileheader = bytes("montage", 'utf-8') + bytes(1) + bytes.fromhex('%08X' % len(file_list))[::-1] filebyte, bytesize, filebody = b'', 0, b'' for i in file_list: - EventMesh.debug_log(i) + print(i) filename_byte = bytes(text_to_hash(i), 'utf-8') filebyte += (filename_byte + bytes(128-len(filename_byte)) + bytes.fromhex('%08X' % (len(file_list)*136 + 12 + bytesize))[::-1] + bytes.fromhex('%08X' % os.path.getsize(i))[::-1]) bytesize += os.path.getsize(i) filebody += open(i, 'rb').read() f.write(fileheader + filebyte + filebody) f.close() - EventMesh.debug_log(output_list) + print(output_list) with open('list.json', 'w') as f: f.write(str(output_list)) - EventMesh.debug_log("----MERGE SUCCESS----") + print("----MERGE SUCCESS----") return output_list output_list = merge_bin("D:\\1.workspace\\3.ASR\\2.G5\\1.Code\\ASR1603_G5\\2.sdk\\project\\D10\\audio.bin", "D:\\1.workspace\\3.ASR\\2.G5\\1.Code\\ASR1603_G5\\2.sdk\\project\\D10\\audio\\") \ No newline at end of file diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/FactoryTool.exe" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/FactoryTool.exe" new file mode 100644 index 00000000..22b643b3 Binary files /dev/null and "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/FactoryTool.exe" differ diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/README.pdf" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/README.pdf" new file mode 100644 index 00000000..94e479e8 Binary files /dev/null and "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/README.pdf" differ diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/config.ini" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/config.ini" new file mode 100644 index 00000000..b93082ac --- /dev/null +++ "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/config.ini" @@ -0,0 +1,15 @@ +[software] +py_file = G:\1.work\3.ASR\2.G5\产测工具\FactoryTool\module_test.py +json_file = sort_setting.json + +[detection] +automated = False +item = RF校准,电源键测试,按键1测试,按键2测试 +restart = False +imei = False + +[version] +ifdetect = True +cmd = import versions\r\nversions.Build_Time +version = 2023-12-06 9:47:51 + diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/en/LC_MESSAGES/English.mo" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/en/LC_MESSAGES/English.mo" new file mode 100644 index 00000000..c206697a Binary files /dev/null and "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/en/LC_MESSAGES/English.mo" differ diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/en/LC_MESSAGES/English.po" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/en/LC_MESSAGES/English.po" new file mode 100644 index 00000000..e4f539e0 --- /dev/null +++ "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/en/LC_MESSAGES/English.po" @@ -0,0 +1,124 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2020-11-04 11:03+0800\n" +"PO-Revision-Date: 2022-05-05 15:33+0800\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: en\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=cp936\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" +"X-Generator: Poedit 3.0.1\n" + +msgid "±à¼­PyÎļþ" +msgstr "Edit Py File" + +msgid "±à¼­ExcelÎļþ" +msgstr "Edit Excel File" + +msgid "±à¼­" +msgstr "Edit" + +msgid "¹¤¾ßÈÕÖ¾" +msgstr "Tool Log" + +msgid "Ä£×éÈÕÖ¾" +msgstr "Module Log" + +msgid "ÈÕÖ¾" +msgstr "Log" + +msgid "Ñ¡Ôñ" +msgstr "Load" + +msgid "È«²¿¿ªÊ¼" +msgstr "Start All" + +msgid "¿ªÊ¼" +msgstr "Start" + +msgid "¹¤³§²âÊÔ" +msgstr "Factory Test" + +msgid "Ñ¡ÔñÅäÖÃÎļþ" +msgstr "Load Config File" + +msgid "Ñ¡Ôñ²âÊԽű¾" +msgstr "Load Test Script" + +msgid "¶Ë¿Ú" +msgstr "Port" + +msgid "IMEI" +msgstr "IMEI" + +msgid "ICCID" +msgstr "ICCID" + +msgid "²âÊÔʱ¼ä" +msgstr "Test Time" + +msgid "²âÊÔ½á¹û" +msgstr "T-Result" + +msgid "²é¿´ÈÕÖ¾" +msgstr "View Log" + + +msgid "py´úÂëÓÐÓï·¨´íÎó" +msgstr "The py code has syntax errors" + +msgid "ÇëÏÈÑ¡Ôñ²âÊÔÎļþ" +msgstr "Please select test file" + +msgid "²âÊÔÈÕÖ¾" +msgstr "Test log" + +msgid "µ±Ç°×´Ì¬: ¾ÍÐ÷..." +msgstr " Current status: ready..." + +msgid "»¶Ó­Ê¹ÓÃQuecPython" +msgstr " Welcome to QuecPython" + +msgid "Ä£¿éÈÕÖ¾" +msgstr "Module Log" + +msgid "²âÏî" +msgstr "Test-Item" + +msgid "²âÊÔ·½Ê½" +msgstr "T-Method" + +msgid "È˹¤¼ì²â" +msgstr "Manual Test" + +msgid "×Ô¶¯¼ì²â" +msgstr "Automated Test" + +msgid "ͨ¹ý" +msgstr "Pass" + +msgid "²»Í¨¹ý" +msgstr "Fail" + +msgid "²âÊÔÖÐ" +msgstr "Testing" + +msgid " µ±Ç°²âÊÔÏîΪ: " +msgstr " The current test item is: " + +msgid "\r\n\r\n ÇëÈ·ÈϸòâÊÔÏî ¡¾ÊÇ·ñͨ¹ý¡¿" +msgstr "\r\n\r\n Please confirm the test result [Passed or Not]" + +msgid "ÊÇ·ñ»Ö¸´ÉÏ´ÎÎļþ" +msgstr "Do you want to restore the last file" + +msgid "Îļþ²»´æÔÚ" +msgstr "File does not exist" + diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/zh_CN/LC_MESSAGES/Chinese.mo" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/zh_CN/LC_MESSAGES/Chinese.mo" new file mode 100644 index 00000000..a90c0659 Binary files /dev/null and "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/zh_CN/LC_MESSAGES/Chinese.mo" differ diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/zh_CN/LC_MESSAGES/Chinese.po" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/zh_CN/LC_MESSAGES/Chinese.po" new file mode 100644 index 00000000..6ad87022 --- /dev/null +++ "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/locale/zh_CN/LC_MESSAGES/Chinese.po" @@ -0,0 +1,17 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2020-11-04 11:03+0800\n" +"PO-Revision-Date: 2020-11-04 20:56+0800\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=cp936\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: en\n" +"X-Generator: Poedit 2.4.1\n" \ No newline at end of file diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/media/quectel.ico" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/media/quectel.ico" new file mode 100644 index 00000000..a9b82f9f Binary files /dev/null and "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/media/quectel.ico" differ diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/module_test.py" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/module_test.py" new file mode 100644 index 00000000..3f40d276 --- /dev/null +++ "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/module_test.py" @@ -0,0 +1,265 @@ +import sim +import net +import uos +import utime +try : + import quecgnss +except Exception as e: + print("quecgnss :{}".format(e)) +import wifiScan +from misc import USB,Power +import modem +import ql_fs +import ujson +from machine import I2C +import audio +from machine import Pin +usb = USB() +gsensor = None + +try : + from Gsensor import SC7A20 + gsensor = SC7A20() + gsensor.activate() + gsensor.init() +except Exception as e: + print("gsensor:{}".format(e)) + +hsensor = None +try : + from Hsensor import HX3918 + hsensor = HX3918() + hsensor.activate() + hsensor.init() +except Exception as e: + print("Hsensor none HX3918:{}".format(e)) + + +class TestBase(object): + + @staticmethod + def Wifi_test(): + wifiScan.control(1) + Wifi_s = wifiScan.start() + if Wifi_s != -1: + wifiScan.control(0) + return True + else: + wifiScan.control(0) + return False + + @staticmethod + def usb_callback(): + status = usb.getStatus() + if status != -1: + return True + else: + return False + + @staticmethod + def modem_imei(): + imei_value = modem.getDevImei() + if imei_value != 864430010001091: + return True + else: + if imei_value == 864430010001091: + return False + + + @staticmethod + def write_test(): + if ql_fs.path_exists("/ext") == False: + ldev = uos.VfsLfs1(32, 32, 32, "ext_fs", 0, 3) + uos.mount(ldev, '/ext') + write_data = {"aaa": "aba"} + with open("/ext/tmp.json", "w", encoding="utf-8") as fd: + ujson.dump(write_data, fd) + read_data = [] + with open("/ext/tmp.json", "r") as fd: + read_data = ujson.load(fd) + if len(write_data) == len(read_data): + return True + else: + return False + + @staticmethod + def gsensor_test(): + + if gsensor == None: + print("gsensor == None") + return False + i = 10 + while 1: + gsensor.poll() + XYZ = gsensor.get_x_y_z() + stepX = XYZ[0] + stepY = XYZ[1] + stepZ = XYZ[2] + #print("gstate i:",i) + if stepX != 0 and stepY != 0 and stepZ != 0: + break + i-=1 + if i <= 0: + break + utime.sleep(1) + XYZ = gsensor.get_x_y_z() + stepX = XYZ[0] + stepY = XYZ[1] + stepZ = XYZ[2] + + if stepX == 0 and stepY == 0 and stepZ == 0: + return False + else: + return True + + @staticmethod + def gps_test(): + quecgnss.init() + #quecgnss.gnssEnable(1) + data=[] + i = 10 + while 1: + utime.sleep(1) + data = quecgnss.read(500) + if data[0] > 0: + break + i-=1 + if i <= 0: + break + print("GPS:data:",data) + if data[0] > 0: + quecgnss.gnssEnable(0) + return True + quecgnss.gnssEnable(0) + return False + + @staticmethod + def sim_test(): + if sim.getIccid() == -1: + return False + return True + + @staticmethod + def signal_test(): + signal = net.csqQueryPoll() + + if signal > 20 and signal<31: + return True + print("signal_test:测试失败! 信号不在20-31范围signal:{}".format(signal)) + return False + + @staticmethod + def camera_test(): + return True + + @staticmethod + def hsensor_test(): + i = 5 + while 1: + hsensor.open_test(6) + utime.sleep(4) + c_data = hsensor.get_test_data() + print("hsensor_test:{} {}".format(c_data[11] , c_data[13])) + print("hsensor_test:漏光数据:",c_data[0],c_data[1],c_data[2]) + 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: + return True + + i-=1 + if i <= 0: + break + return False + + @staticmethod + def temp_test(): + i2c0 = I2C(I2C.I2C0, I2C.FAST_MODE) + WHO_AM_I = bytearray([0x01, 0]) + I2C_SLAVE_ADDR = 0x49 + data = bytearray([0x61A0, 0]) + i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2) + i = 5 + while 1: + WHO_AM_I = bytearray([0x00, 0]) + I2C_SLAVE_ADDR = 0x49 + r_data = bytearray(2) + i2c0.read(I2C_SLAVE_ADDR, WHO_AM_I, 1, r_data, 2, 0) + temp_s = ((r_data[0]<<8) | (r_data[1]))>>4 + temp_data = temp_s * 0.0625 + + + print("temp_test:temp:",temp_data) + if temp_data > 10 : + return True + i-=1 + if i <= 0: + break + utime.sleep(1) + return False + + @staticmethod + def microphone_test(): + record_test = audio.Record() + record_test.gain(4,12) + aud = audio.Audio(0) + i = 7 + + while 1: + record_test.start("/usr/1.amr".format(1),1) + utime.sleep(1) + aud.play(1, 1, '/usr/1.amr') + utime.sleep(1) + i-=1 + if i <= 0: + break + uos.remove("/usr/1.amr") + + @staticmethod + def power_key_test(): + key26 = Pin(Pin.GPIO26, Pin.IN, Pin.PULL_PU, 0) + i = 1000 + print("power_key_test:",key26.read()) + while 1: + if key26.read() == 0: + return True + utime.sleep_ms(20) + i-=1 + if i <= 0: + break + @staticmethod + def key1_test(): + 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()) + while 1: + if key20.read() == 0: + return True + utime.sleep_ms(20) + i-=1 + if i <= 0: + break + + @staticmethod + def key2_test(): + 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()) + while 1: + if key22.read() == 0: + return True + utime.sleep_ms(20) + i-=1 + if i <= 0: + break + + def det_changedir_end(): + #uos.rename('usr/main_1.py','usr/main.py') + + Power.powerRestart() + + return True + + diff --git "a/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/sort_setting.json" "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/sort_setting.json" new file mode 100644 index 00000000..a5b03341 --- /dev/null +++ "b/\344\272\247\346\265\213\345\267\245\345\205\267/FactoryTool/sort_setting.json" @@ -0,0 +1,39 @@ +{ + "info": [ + ["WiFi测试", "Wifi_test()", 0,0], + ["充电测试", "usb_callback()", 0,0], + ["RF校准", "modem_imei()", 0,0], + ["flash读写", "write_test()", 0,0], + ["重力传感器", "gsensor_test()", 0,0], + ["卫星定位","gps_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] + + ], + "tips": { + "WiFi测试": "正在测试WIFI...", + "充电测试":"正在测试充电...", + "RF校准":"正在确认RF参数是否已写入...", + "flash读写":"正在外部flash读写测试...", + "重力传感器": "正在测试三轴传感器...", + "卫星定位":"正在测试卫星定位...", + "SIM卡测试":"需插卡测试!!!正在读取Iccid...", + "4G信号测试":"需插卡测试!!!正在读取信号强度...", + "摄像头测试":"请观察屏幕成像,手动点确认...", + "心率血氧测试":"需校准完活体后测试,请将手表背面对空!!!", + "温度测试":"正在测试温度传感器...", + "麦克风喇叭测试":"点击确认后,请对着麦克风说话,并留意喇叭是否有声音输出!!!!", + "电源键测试":"点击确认后,请在20秒内按下电源按键", + "按键1测试":"点击确认后,请在20秒内按下按键1", + "按键2测试":"点击确认后,请在20秒内按下按键2" + + + } +} \ No newline at end of file