From: dxy15521469561 <1731678236@qq.com> Date: Wed, 12 Jun 2024 10:35:30 +0000 (+0800) Subject: AI界面优化 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=46205d6ac86c5c7244bdfd6105c38283a81a0cc5;p=mirrors%2FASR1603_G5.git AI界面优化 --- diff --git "a/1.doc/font/W8_C06S/\344\275\277\347\224\250\345\255\227\344\275\223\346\226\207\344\273\266ttf/HarmonyOS_Sans_SC_Regular.ttf" "b/1.doc/font/W8_C06S/\344\275\277\347\224\250\345\255\227\344\275\223\346\226\207\344\273\266ttf/HarmonyOS_Sans_SC_Regular.ttf" new file mode 100644 index 00000000..aff150a1 Binary files /dev/null and "b/1.doc/font/W8_C06S/\344\275\277\347\224\250\345\255\227\344\275\223\346\226\207\344\273\266ttf/HarmonyOS_Sans_SC_Regular.ttf" differ diff --git "a/1.doc/font/W8_C06S/\346\226\207\345\255\227\345\206\205\345\256\271_60\345\217\267.txt" "b/1.doc/font/W8_C06S/\346\226\207\345\255\227\345\206\205\345\256\271_60\345\217\267.txt" new file mode 100644 index 00000000..6a833363 --- /dev/null +++ "b/1.doc/font/W8_C06S/\346\226\207\345\255\227\345\206\205\345\256\271_60\345\217\267.txt" @@ -0,0 +1 @@ +设置工具箱健康测量微聊AI助手短信联系人拨号盘相册相机视频通话支付宝 diff --git a/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c b/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c index 76429833..9b1000bc 100644 --- a/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c +++ b/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c @@ -336,27 +336,27 @@ bool hx3918_prox_reg_init(void) #ifdef INDEPENDDENT_CH // -#ifdef PROJECT_NAME_G3_C06S - write_ok &= hx3918_write_reg(0x55,0x30); //CS1->CH0 - write_ok &= hx3918_write_reg(0x57,0x0c); //CS0->CH1 -#else - write_ok &= hx3918_write_reg(0x55,0x0C); //CS1->CH0 - write_ok &= hx3918_write_reg(0x57,0x03); //CS0->CH1 -#endif + #if (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) + write_ok &= hx3918_write_reg(0x55,0x30); //CS1->CH0 + write_ok &= hx3918_write_reg(0x57,0x0c); //CS0->CH1 + #else + write_ok &= hx3918_write_reg(0x55,0x0C); //CS1->CH0 + write_ok &= hx3918_write_reg(0x57,0x03); //CS0->CH1 + #endif // write_ok &= hx3918_write_reg(0x57,0x30); //CS2->CH1 // write_ok &= hx3918_write_reg(0x57,0x03); //CS0->CH1 //write_ok &= hx3918_write_reg(0x57,0x0c); //CS1->CH1 #elif defined(DIFFERENCE_CH) //?????????????¨, ???????·?? -#ifdef PROJECT_NAME_G3_C06S - write_ok &= hx3918_write_reg(0x55,0x30); //CS1->CH0 - write_ok &= hx3918_write_reg(0x57,0x0c); //CS0->CH1 -#else - write_ok &= hx3918_write_reg(0x55,0x30); //CS0->CH0[P],CS1->CH0[N] - write_ok &= hx3918_write_reg(0x57,0x2c); //CS1->CH1 + #if (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) + write_ok &= hx3918_write_reg(0x55,0x30); //CS1->CH0 + write_ok &= hx3918_write_reg(0x57,0x0c); //CS0->CH1 + #else + write_ok &= hx3918_write_reg(0x55,0x30); //CS0->CH0[P],CS1->CH0[N] + write_ok &= hx3918_write_reg(0x57,0x2c); //CS1->CH1 + #endif #endif -#endif - write_ok &= hx3918_write_reg(0x59,0x0c); //CH2 CS1 + write_ok &= hx3918_write_reg(0x59,0x0c); //CH2 CS1 #ifdef FULL25PF diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font.h b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font.h index f3faea81..99e10a71 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font.h +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font.h @@ -240,7 +240,7 @@ LV_FONT_DECLARE(lv_font_unscii_8) LV_FONT_DECLARE(lv_font_unscii_16) #endif -#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S +#if PROJECT_NAME_G5_K5 || (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) LV_FONT_DECLARE(lv_font_70_bold) LV_FONT_DECLARE(lv_font_28_dial) LV_FONT_DECLARE(lv_font_60_main_menu) diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_28_dial.c b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_28_dial.c index 2a61f365..97dcf7e1 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_28_dial.c +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_28_dial.c @@ -14,7 +14,7 @@ #define LV_FONT_28_DIAL 1 #endif #include "autoconf.h" -#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S +#if PROJECT_NAME_G5_K5 || (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) /*----------------- * BITMAPS diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_60_main_menu.c b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_60_main_menu.c index 4b9586af..59012e0d 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_60_main_menu.c +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_60_main_menu.c @@ -14,7 +14,7 @@ #define LV_FONT_60_MAIN_MENU 1 #endif -#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S +#if PROJECT_NAME_G5_K5 || (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) /*----------------- * BITMAPS @@ -22,6 +22,74 @@ /*Store the image of the glyphs*/ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { + /* U+0041 "A" */ + 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0xf4, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xbf, 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0xff, 0xfc, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x1, 0xff, 0xfe, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0xff, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, + 0xff, 0xff, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xb, 0xfe, 0xff, 0xc0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0xf, 0xfc, 0xff, 0xc0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f, 0xf4, 0xbf, + 0xe0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2f, + 0xf0, 0x7f, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x3f, 0xe0, 0x3f, 0xf4, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0xbf, 0xd0, 0x2f, 0xfc, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xc0, 0xf, + 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff, + 0x80, 0xf, 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x2, 0xff, 0x0, 0x7, 0xff, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x3, 0xff, 0x0, 0x3, 0xff, 0x40, + 0x0, 0x0, 0x0, 0x0, 0x7, 0xfd, 0x0, 0x2, + 0xff, 0xc0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xfc, + 0x0, 0x0, 0xff, 0xc0, 0x0, 0x0, 0x0, 0x0, + 0xf, 0xf8, 0x0, 0x0, 0xff, 0xe0, 0x0, 0x0, + 0x0, 0x0, 0x2f, 0xf4, 0x0, 0x0, 0x7f, 0xf0, + 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, + 0x3f, 0xf4, 0x0, 0x0, 0x0, 0x0, 0x7f, 0xe0, + 0x0, 0x0, 0x2f, 0xfc, 0x0, 0x0, 0x0, 0x0, + 0xbf, 0xc0, 0x0, 0x0, 0x1f, 0xfc, 0x0, 0x0, + 0x0, 0x0, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xfe, + 0x0, 0x0, 0x0, 0x1, 0xff, 0x40, 0x0, 0x0, + 0x7, 0xff, 0x0, 0x0, 0x0, 0x3, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x40, 0x0, 0x0, 0x7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x0, + 0x0, 0xb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x0, 0x0, 0xf, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0, 0x0, 0x3f, + 0xf4, 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf4, 0x0, + 0x0, 0x3f, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x3f, + 0xfc, 0x0, 0x0, 0xbf, 0xe0, 0x0, 0x0, 0x0, + 0x0, 0x1f, 0xfc, 0x0, 0x0, 0xff, 0xc0, 0x0, + 0x0, 0x0, 0x0, 0xf, 0xfe, 0x0, 0x1, 0xff, + 0xc0, 0x0, 0x0, 0x0, 0x0, 0xb, 0xff, 0x0, + 0x2, 0xff, 0x40, 0x0, 0x0, 0x0, 0x0, 0x7, + 0xff, 0x40, 0x3, 0xff, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x3, 0xff, 0xc0, 0x7, 0xff, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x2, 0xff, 0xc0, 0xf, 0xfd, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xe0, + 0xf, 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xff, 0xf0, 0x2f, 0xf8, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x7f, 0xf4, 0x3f, 0xf4, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x7f, 0xf0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2f, 0xfc, + + /* U+0049 "I" */ + 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, + 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, + 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, + 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, + 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, + 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, + 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, + 0xfe, 0xff, 0xef, 0xfe, 0xff, 0xef, 0xfe, 0xff, + 0xef, 0xfe, + /* U+4EBA "人" */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xaa, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -613,6 +681,103 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+52A9 "助" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x1, 0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0xd0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7, 0xfd, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x7f, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x1a, + 0xaa, 0xaa, 0xaa, 0xaa, 0x80, 0x0, 0x7, 0xfc, + 0x0, 0x0, 0x0, 0x0, 0x2, 0xff, 0xff, 0xff, + 0xff, 0xfc, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0x0, + 0x0, 0x0, 0x2f, 0xff, 0xff, 0xff, 0xff, 0xc0, + 0x0, 0x7, 0xfc, 0x0, 0x0, 0x0, 0x0, 0x2, + 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x7f, + 0xc0, 0x0, 0x0, 0x0, 0x0, 0x2f, 0xff, 0xff, + 0xff, 0xff, 0xc0, 0x0, 0x7, 0xfc, 0x0, 0x0, + 0x0, 0x0, 0x2, 0xff, 0x0, 0x0, 0x7, 0xfc, + 0x0, 0x0, 0xbf, 0xc0, 0x0, 0x0, 0x0, 0x0, + 0x2f, 0xf0, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0xb, + 0xfc, 0x0, 0x0, 0x0, 0x0, 0x2, 0xff, 0x0, + 0x0, 0x7, 0xfc, 0x6, 0xaa, 0xff, 0xea, 0xaa, + 0xaa, 0xa8, 0x0, 0x2f, 0xf0, 0x0, 0x0, 0x7f, + 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, + 0x2, 0xff, 0x0, 0x0, 0x7, 0xfc, 0xf, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x2f, 0xf0, + 0x0, 0x0, 0x7f, 0xc0, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xc0, 0x2, 0xff, 0x0, 0x0, 0x7, + 0xfc, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0x0, 0x2f, 0xf0, 0x0, 0x0, 0x7f, 0xc0, 0x0, + 0xb, 0xfc, 0x0, 0x0, 0xbf, 0xc0, 0x2, 0xff, + 0xaa, 0xaa, 0xab, 0xfc, 0x0, 0x0, 0xbf, 0xc0, + 0x0, 0xb, 0xfc, 0x0, 0x2f, 0xff, 0xff, 0xff, + 0xff, 0xc0, 0x0, 0xb, 0xfc, 0x0, 0x0, 0xbf, + 0xc0, 0x2, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, + 0x0, 0xbf, 0xc0, 0x0, 0xb, 0xfc, 0x0, 0x2f, + 0xff, 0xff, 0xff, 0xff, 0xc0, 0x0, 0xb, 0xfc, + 0x0, 0x0, 0xbf, 0xc0, 0x2, 0xff, 0xff, 0xff, + 0xff, 0xfc, 0x0, 0x0, 0xbf, 0xc0, 0x0, 0xb, + 0xfc, 0x0, 0x2f, 0xf0, 0x0, 0x0, 0x7f, 0xc0, + 0x0, 0xb, 0xf8, 0x0, 0x0, 0xbf, 0xc0, 0x2, + 0xff, 0x0, 0x0, 0x7, 0xfc, 0x0, 0x0, 0xff, + 0x80, 0x0, 0xb, 0xfc, 0x0, 0x2f, 0xf0, 0x0, + 0x0, 0x7f, 0xc0, 0x0, 0xf, 0xf8, 0x0, 0x0, + 0xbf, 0xc0, 0x2, 0xff, 0x0, 0x0, 0x7, 0xfc, + 0x0, 0x0, 0xff, 0x80, 0x0, 0xb, 0xfc, 0x0, + 0x2f, 0xf0, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0xf, + 0xf4, 0x0, 0x0, 0xbf, 0xc0, 0x2, 0xff, 0x0, + 0x0, 0x7, 0xfc, 0x0, 0x0, 0xff, 0x40, 0x0, + 0xb, 0xfc, 0x0, 0x2f, 0xf0, 0x0, 0x0, 0x7f, + 0xc0, 0x0, 0xf, 0xf4, 0x0, 0x0, 0xff, 0xc0, + 0x2, 0xff, 0x0, 0x0, 0x7, 0xfc, 0x0, 0x0, + 0xff, 0x0, 0x0, 0xf, 0xfc, 0x0, 0x2f, 0xff, + 0xff, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xf0, 0x0, + 0x0, 0xff, 0xc0, 0x2, 0xff, 0xff, 0xff, 0xff, + 0xfc, 0x0, 0x1, 0xff, 0x0, 0x0, 0xf, 0xf8, + 0x0, 0x2f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x0, + 0x2f, 0xf0, 0x0, 0x0, 0xff, 0x80, 0x2, 0xff, + 0xff, 0xff, 0xff, 0xfc, 0x0, 0x2, 0xff, 0x0, + 0x0, 0xf, 0xf8, 0x0, 0x2f, 0xf5, 0x55, 0x55, + 0xbf, 0xc0, 0x0, 0x3f, 0xe0, 0x0, 0x0, 0xff, + 0x80, 0x2, 0xff, 0x0, 0x0, 0x7, 0xfc, 0x0, + 0x3, 0xfd, 0x0, 0x0, 0xf, 0xf8, 0x0, 0x2f, + 0xf0, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0x7f, 0xd0, + 0x0, 0x0, 0xff, 0x80, 0x2, 0xff, 0x0, 0x0, + 0x7, 0xfc, 0x0, 0xb, 0xfc, 0x0, 0x0, 0xf, + 0xf4, 0x0, 0x2f, 0xf0, 0x0, 0x0, 0x7f, 0xc0, + 0x0, 0xff, 0xc0, 0x0, 0x0, 0xff, 0x40, 0x2, + 0xff, 0x0, 0x0, 0x7, 0xfc, 0x0, 0xf, 0xf8, + 0x0, 0x0, 0xf, 0xf4, 0x0, 0x2f, 0xf0, 0x0, + 0x0, 0x7f, 0xc0, 0x2, 0xff, 0x0, 0x0, 0x1, + 0xff, 0x40, 0x2, 0xff, 0x0, 0x0, 0x7, 0xfe, + 0xa0, 0x3f, 0xf0, 0x0, 0x0, 0x1f, 0xf4, 0x0, + 0x2f, 0xf0, 0x0, 0x6, 0xff, 0xfe, 0x7, 0xfe, + 0x0, 0x0, 0x1, 0xff, 0x0, 0x2, 0xff, 0x5, + 0xbf, 0xff, 0xff, 0xe0, 0xff, 0xc0, 0x0, 0x0, + 0x2f, 0xf0, 0x0, 0x2f, 0xff, 0xff, 0xff, 0xff, + 0xfe, 0x2f, 0xf8, 0x0, 0x0, 0x2, 0xff, 0x1, + 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, + 0x40, 0x0, 0x0, 0x2f, 0xf0, 0x7f, 0xff, 0xff, + 0xff, 0xff, 0xfe, 0x90, 0xff, 0xe0, 0x0, 0x0, + 0x3, 0xff, 0x3, 0xff, 0xff, 0xff, 0xfe, 0x50, + 0x0, 0x2f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xf0, + 0x3f, 0xff, 0xfe, 0x50, 0x0, 0x0, 0x7, 0xff, + 0x80, 0x0, 0x0, 0xb, 0xfe, 0x3, 0xfe, 0x50, + 0x0, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x1, 0x0, + 0x6, 0xff, 0xd0, 0x10, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x3f, 0xfc, 0x0, 0x3f, 0xff, 0xff, 0xfc, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, + 0x40, 0x3, 0xff, 0xff, 0xff, 0x80, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xff, 0xe0, 0x0, 0x2f, + 0xff, 0xff, 0xe0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x3, 0xfc, 0x0, 0x2, 0xff, 0xff, 0xe4, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, + 0x0, 0x0, 0x0, 0x15, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, + /* U+53F7 "号" */ 0x0, 0x0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x0, 0x0, @@ -1083,6 +1248,98 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+624B "手" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5a, + 0xbf, 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x15, 0x6a, 0xff, 0xff, 0xff, 0xff, 0xd0, + 0x0, 0x0, 0x1, 0x55, 0xaa, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0, 0x2, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xa4, + 0x0, 0x1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfa, 0x95, 0x0, 0x0, 0x0, 0x0, 0x1f, + 0xff, 0xff, 0xff, 0xea, 0xa7, 0xff, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x55, 0x50, 0x0, + 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, + 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x3, 0xff, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x3f, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x3, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0xaa, + 0xaa, 0xaa, 0xaa, 0xab, 0xff, 0xaa, 0xaa, 0xaa, + 0xaa, 0xa9, 0x0, 0x0, 0xbf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, + 0x0, 0xb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0, 0x0, 0xbf, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xe0, 0x0, 0xb, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, + 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, + 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x3, 0xff, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x3f, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x6, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xab, 0xff, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x3, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, + 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, + 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x3, 0xff, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x3f, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xf, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7, 0xff, 0xab, 0xff, 0xf0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x3f, 0xff, 0xff, 0xfe, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x2f, 0xff, 0xff, 0xf4, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x1, 0xab, 0xff, 0xf8, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, + /* U+62E8 "拨" */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -2853,35 +3110,39 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 960, .box_w = 54, .box_h = 55, .ofs_x = 3, .ofs_y = -5}, - {.bitmap_index = 743, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 1541, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 2339, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 3137, .adv_w = 960, .box_w = 56, .box_h = 53, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 3879, .adv_w = 960, .box_w = 56, .box_h = 53, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 4621, .adv_w = 960, .box_w = 56, .box_h = 52, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 5349, .adv_w = 960, .box_w = 52, .box_h = 54, .ofs_x = 4, .ofs_y = -3}, - {.bitmap_index = 6051, .adv_w = 960, .box_w = 54, .box_h = 49, .ofs_x = 3, .ofs_y = -3}, - {.bitmap_index = 6713, .adv_w = 960, .box_w = 56, .box_h = 56, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 7497, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 8295, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 9093, .adv_w = 960, .box_w = 55, .box_h = 56, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 9863, .adv_w = 960, .box_w = 57, .box_h = 57, .ofs_x = 1, .ofs_y = -6}, - {.bitmap_index = 10676, .adv_w = 960, .box_w = 53, .box_h = 54, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 11392, .adv_w = 960, .box_w = 56, .box_h = 54, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 12148, .adv_w = 960, .box_w = 54, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 12904, .adv_w = 960, .box_w = 55, .box_h = 55, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 13661, .adv_w = 960, .box_w = 55, .box_h = 57, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 14445, .adv_w = 960, .box_w = 56, .box_h = 54, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 15201, .adv_w = 960, .box_w = 56, .box_h = 51, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 15915, .adv_w = 960, .box_w = 54, .box_h = 55, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 16658, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 17456, .adv_w = 960, .box_w = 56, .box_h = 56, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 18240, .adv_w = 960, .box_w = 55, .box_h = 55, .ofs_x = 3, .ofs_y = -5}, - {.bitmap_index = 18997, .adv_w = 960, .box_w = 56, .box_h = 55, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 19767, .adv_w = 960, .box_w = 56, .box_h = 54, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 20523, .adv_w = 960, .box_w = 56, .box_h = 52, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 21251, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 2, .ofs_y = -5} + {.bitmap_index = 0, .adv_w = 637, .box_w = 40, .box_h = 44, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 440, .adv_w = 252, .box_w = 6, .box_h = 44, .ofs_x = 5, .ofs_y = 0}, + {.bitmap_index = 506, .adv_w = 960, .box_w = 54, .box_h = 55, .ofs_x = 3, .ofs_y = -5}, + {.bitmap_index = 1249, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 2047, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 2845, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 3643, .adv_w = 960, .box_w = 56, .box_h = 53, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 4385, .adv_w = 960, .box_w = 56, .box_h = 53, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 5127, .adv_w = 960, .box_w = 54, .box_h = 56, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 5883, .adv_w = 960, .box_w = 56, .box_h = 52, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 6611, .adv_w = 960, .box_w = 52, .box_h = 54, .ofs_x = 4, .ofs_y = -3}, + {.bitmap_index = 7313, .adv_w = 960, .box_w = 54, .box_h = 49, .ofs_x = 3, .ofs_y = -3}, + {.bitmap_index = 7975, .adv_w = 960, .box_w = 56, .box_h = 56, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 8759, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 9557, .adv_w = 960, .box_w = 54, .box_h = 53, .ofs_x = 3, .ofs_y = -4}, + {.bitmap_index = 10273, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 11071, .adv_w = 960, .box_w = 55, .box_h = 56, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 11841, .adv_w = 960, .box_w = 57, .box_h = 57, .ofs_x = 1, .ofs_y = -6}, + {.bitmap_index = 12654, .adv_w = 960, .box_w = 53, .box_h = 54, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 13370, .adv_w = 960, .box_w = 56, .box_h = 54, .ofs_x = 2, .ofs_y = -3}, + {.bitmap_index = 14126, .adv_w = 960, .box_w = 54, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 14882, .adv_w = 960, .box_w = 55, .box_h = 55, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 15639, .adv_w = 960, .box_w = 55, .box_h = 57, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 16423, .adv_w = 960, .box_w = 56, .box_h = 54, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 17179, .adv_w = 960, .box_w = 56, .box_h = 51, .ofs_x = 2, .ofs_y = -3}, + {.bitmap_index = 17893, .adv_w = 960, .box_w = 54, .box_h = 55, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 18636, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 19434, .adv_w = 960, .box_w = 56, .box_h = 56, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 20218, .adv_w = 960, .box_w = 55, .box_h = 55, .ofs_x = 3, .ofs_y = -5}, + {.bitmap_index = 20975, .adv_w = 960, .box_w = 56, .box_h = 55, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 21745, .adv_w = 960, .box_w = 56, .box_h = 54, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 22501, .adv_w = 960, .box_w = 56, .box_h = 52, .ofs_x = 2, .ofs_y = -3}, + {.bitmap_index = 23229, .adv_w = 960, .box_w = 57, .box_h = 56, .ofs_x = 2, .ofs_y = -5} }; /*--------------------- @@ -2889,18 +3150,19 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { *--------------------*/ static const uint16_t unicode_list_0[] = { - 0x0, 0x1e, 0x127, 0x1ab, 0x2bd, 0x2d2, 0x53d, 0xce3, - 0xf2b, 0xffd, 0x10f4, 0x142e, 0x1675, 0x1880, 0x1e91, 0x281e, - 0x283e, 0x2933, 0x2cf7, 0x2e41, 0x30b4, 0x3190, 0x319a, 0x3b0c, - 0x3d04, 0x3d23, 0x4160, 0x4315, 0x49d7 + 0x0, 0x8, 0x4e79, 0x4e97, 0x4fa0, 0x5024, 0x5136, 0x514b, + 0x5268, 0x53b6, 0x5b5c, 0x5da4, 0x5e76, 0x5f6d, 0x620a, 0x62a7, + 0x64ee, 0x66f9, 0x6d0a, 0x7697, 0x76b7, 0x77ac, 0x7b70, 0x7cba, + 0x7f2d, 0x8009, 0x8013, 0x8985, 0x8b7d, 0x8b9c, 0x8fd9, 0x918e, + 0x9850 }; /*Collect the unicode lists and glyph_id offsets*/ static const lv_font_fmt_txt_cmap_t cmaps[] = { { - .range_start = 20154, .range_length = 18904, .glyph_id_start = 1, - .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 29, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .range_start = 65, .range_length = 38993, .glyph_id_start = 1, + .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 33, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -2965,5 +3227,6 @@ lv_font_t lv_font_60_main_menu = { }; + #endif /*#if LV_FONT_60_MAIN_MENU*/ diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_70_bold.c b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_70_bold.c index c5ff3ca9..9c6ed035 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_70_bold.c +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/font/lv_font_70_bold.c @@ -14,7 +14,7 @@ /*----------------- * BITMAPS *----------------*/ -#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S +#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S ||PROJECT_NAME_C3_W8 /*Store the image of the glyphs*/ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { /* U+0020 " " */ diff --git a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h index 1601d9c2..afd1dc46 100644 --- a/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h +++ b/2.sdk/Helios_SDK/services/microPython/lib/lvgl/src/hal/lv_hal_indev.h @@ -37,7 +37,7 @@ extern "C" { #define LV_INDEV_DEF_X_SLIDING_SPEED 50 #endif -#if PROJECT_NAME_G3_C06S +#if (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) #define LV_INDEV_DEF_X_SLIDING_SPEED 100 #endif diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modlvgl.c b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modlvgl.c index d7b3915e..4c458595 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modlvgl.c +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modlvgl.c @@ -27180,7 +27180,7 @@ extern int Helios_Flash_Read(uint32_t addr, void *buffer, size_t size); #define FONT_BUFFER_SIZE (256) #define FONT_BUFFER_NUMBER (64) #endif -#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S +#if PROJECT_NAME_G5_K5 || (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) STATIC const mp_lv_struct_t mp_lv_font_70_bold = { { &mp_lv_font_t_type }, (lv_font_t*)&lv_font_70_bold @@ -32997,7 +32997,7 @@ STATIC MP_DEFINE_CONST_LV_FUN_OBJ_VAR(mp_lv_gif_set_src_obj, 2, mp_lv_gif_set_sr */ STATIC const mp_rom_map_elem_t lvgl_globals_table[] = { -#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S +#if PROJECT_NAME_G5_K5 || (PROJECT_NAME_G3_C06S || PROJECT_NAME_C3_W8) { MP_ROM_QSTR(MP_QSTR_font_70_bold), MP_ROM_PTR(&mp_lv_font_70_bold) }, { MP_ROM_QSTR(MP_QSTR_font_28_dial), MP_ROM_PTR(&mp_lv_font_28_dial) }, { MP_ROM_QSTR(MP_QSTR_font_60_main_menu), MP_ROM_PTR(&mp_lv_font_60_main_menu) }, diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF001.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF001.png new file mode 100644 index 00000000..f57b0ca2 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF001.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF0017.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF0017.png new file mode 100644 index 00000000..8d16df41 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF0017.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF002.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF002.png new file mode 100644 index 00000000..ccf1d8fa Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF002.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF003.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF003.png new file mode 100644 index 00000000..3a7c4a0a Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF003.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF004.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF004.png new file mode 100644 index 00000000..126dfa9f Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF004.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF005.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF005.png new file mode 100644 index 00000000..c277827a Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF005.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF006.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF006.png new file mode 100644 index 00000000..ad496bbe Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF006.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF007.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF007.png new file mode 100644 index 00000000..0857b61e Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF007.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF008.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF008.png new file mode 100644 index 00000000..fb4f9af1 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF008.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF009.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF009.png new file mode 100644 index 00000000..a0cfcb5b Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF009.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF010.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF010.png new file mode 100644 index 00000000..77d7c018 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF010.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF011.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF011.png new file mode 100644 index 00000000..88064915 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF011.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF012.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF012.png new file mode 100644 index 00000000..f1c1dab9 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF012.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF013.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF013.png new file mode 100644 index 00000000..68d6b035 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF013.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF014.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF014.png new file mode 100644 index 00000000..a3a12b9f Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF014.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF015.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF015.png new file mode 100644 index 00000000..65c8b5c5 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF015.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF016.png b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF016.png new file mode 100644 index 00000000..18e29b71 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_LISTEN_GIF016.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK001.png b/2.sdk/project/W8/ext/static/AI/AI_THINK001.png new file mode 100644 index 00000000..1c1c40c6 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK001.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK002.png b/2.sdk/project/W8/ext/static/AI/AI_THINK002.png new file mode 100644 index 00000000..ebde5798 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK002.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK003.png b/2.sdk/project/W8/ext/static/AI/AI_THINK003.png new file mode 100644 index 00000000..662efecb Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK003.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK004.png b/2.sdk/project/W8/ext/static/AI/AI_THINK004.png new file mode 100644 index 00000000..8a55790e Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK004.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK005.png b/2.sdk/project/W8/ext/static/AI/AI_THINK005.png new file mode 100644 index 00000000..a1264737 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK005.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK006.png b/2.sdk/project/W8/ext/static/AI/AI_THINK006.png new file mode 100644 index 00000000..58795a9c Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK006.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK007.png b/2.sdk/project/W8/ext/static/AI/AI_THINK007.png new file mode 100644 index 00000000..e1fa0262 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK007.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK008.png b/2.sdk/project/W8/ext/static/AI/AI_THINK008.png new file mode 100644 index 00000000..15a79702 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK008.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK009.png b/2.sdk/project/W8/ext/static/AI/AI_THINK009.png new file mode 100644 index 00000000..2a2c3d7c Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK009.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK010.png b/2.sdk/project/W8/ext/static/AI/AI_THINK010.png new file mode 100644 index 00000000..186c889d Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK010.png differ diff --git a/2.sdk/project/W8/ext/static/AI/AI_THINK011.png b/2.sdk/project/W8/ext/static/AI/AI_THINK011.png new file mode 100644 index 00000000..bdc78dc1 Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/AI_THINK011.png differ diff --git a/2.sdk/project/W8/ext/static/ai_confirm_bt.png b/2.sdk/project/W8/ext/static/AI/ai_confirm_bt.png similarity index 100% rename from 2.sdk/project/W8/ext/static/ai_confirm_bt.png rename to 2.sdk/project/W8/ext/static/AI/ai_confirm_bt.png diff --git a/2.sdk/project/W8/ext/static/AI/ai_result_bt.png b/2.sdk/project/W8/ext/static/AI/ai_result_bt.png new file mode 100644 index 00000000..72a2f6bb Binary files /dev/null and b/2.sdk/project/W8/ext/static/AI/ai_result_bt.png differ diff --git a/2.sdk/project/W8/ext/static/ai_result_can_bt.png b/2.sdk/project/W8/ext/static/AI/ai_result_can_bt.png similarity index 100% rename from 2.sdk/project/W8/ext/static/ai_result_can_bt.png rename to 2.sdk/project/W8/ext/static/AI/ai_result_can_bt.png diff --git a/2.sdk/project/W8/ext/static/ai_talk_bt.png b/2.sdk/project/W8/ext/static/AI/ai_talk_bt.png similarity index 100% rename from 2.sdk/project/W8/ext/static/ai_talk_bt.png rename to 2.sdk/project/W8/ext/static/AI/ai_talk_bt.png diff --git a/2.sdk/project/W8/ext/static/ai_warning.png b/2.sdk/project/W8/ext/static/AI/ai_warning.png similarity index 100% rename from 2.sdk/project/W8/ext/static/ai_warning.png rename to 2.sdk/project/W8/ext/static/AI/ai_warning.png diff --git a/2.sdk/project/W8/ext/static/ai_listen.png b/2.sdk/project/W8/ext/static/ai_listen.png deleted file mode 100644 index 2ecf59bf..00000000 Binary files a/2.sdk/project/W8/ext/static/ai_listen.png and /dev/null differ diff --git a/2.sdk/project/W8/ext/static/ai_listen_gif.png b/2.sdk/project/W8/ext/static/ai_listen_gif.png deleted file mode 100644 index b5d28b80..00000000 Binary files a/2.sdk/project/W8/ext/static/ai_listen_gif.png and /dev/null differ diff --git a/2.sdk/project/W8/ext/static/ai_result_bt.png b/2.sdk/project/W8/ext/static/ai_result_bt.png deleted file mode 100644 index ddfe3dcd..00000000 Binary files a/2.sdk/project/W8/ext/static/ai_result_bt.png and /dev/null differ diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/Makefile b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/Makefile index f6841330..25c736d6 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/Makefile +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/Makefile @@ -973,6 +973,7 @@ frozen_mpy_list = $(BUILD)/_boot.mpy \ $(BUILD)/versions.mpy \ $(BUILD)/appAlipay.mpy \ $(BUILD)/ui_video.mpy \ + $(BUILD)/ai.mpy \ diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ai.py b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ai.py index d9c9b19a..39f028c9 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ai.py +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ai.py @@ -10,14 +10,42 @@ import EventMesh import constants import ujson import lvgl as lv +import urandom +import uhashlib +import ubinascii from ui import style_font_youyuan_20,style_screen,Screen,style_img,LCD_SIZE_H,LCD_SIZE_W style_font_youyuan_ai_20 = lv.style_t() style_font_youyuan_ai_20.init() style_font_youyuan_ai_20.set_text_color(lv.color_make(253, 82, 19)) style_font_youyuan_ai_20.set_text_font_v2("font_28.bin",28,0) - - - +#length长度内,返回string句号或逗号的分割字符串 +def split_string(string,start,end): + count = string.find(',',start,end) + if count != -1: + return string[:count] + count = string.find('.',start,end) + if count != -1: + return string[:count] + count = string.find('!',start,end) + if count != -1: + return string[:count] + count = string.find('?',start,end) + if count != -1: + return string[:count] + + count = string.find(',',start,end) + if count != -1: + return string[:count+len(',')] + count = string.find('。',start,end) + if count != -1: + return string[:count+len('。')] + count = string.find('!',start,end) + if count != -1: + return string[:count+len('!')] + count = string.find('?',start,end) + if count != -1: + return string[:count+len('?')] + return '' def sub_utf8_String(string,length): if length >= len(string): return string @@ -87,51 +115,360 @@ print("AI_screen") AI_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) AI_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) -AI_screen_list_screen = lv.obj(AI_screen) +AI_talk_end_screen = lv.obj(AI_screen) +AI_talk_end_screen.set_pos(0, 0) +AI_talk_end_screen.set_size(LCD_SIZE_W,LCD_SIZE_H) +print("AI_talk_end_screen") +AI_talk_end_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +AI_talk_end_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) # + +AI_screen_list_screen = lv.obj(AI_talk_end_screen) AI_screen_list_screen.set_pos(0, 0) AI_screen_list_screen.set_size(LCD_SIZE_W, LCD_SIZE_H-60) AI_screen_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) AI_screen_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) -al_success_title1 = lv.label(AI_screen) +al_success_title1 = lv.label(AI_talk_end_screen) al_success_title1.set_pos(0, 10) al_success_title1.set_size(LCD_SIZE_W, 40) al_success_title1.set_text("AI智能助手") al_success_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) al_success_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -AI_press_btn = lv.btn(AI_screen) -AI_press_btn.set_pos(10, (LCD_SIZE_H-60)+4) -AI_press_btn.set_size(LCD_SIZE_W-20, 56) -AI_press_btn.add_style(style_AI_btn, lv.PART.MAIN | lv.STATE.DEFAULT) -AI_press_btn.add_style(style_common_bg_rect_btn_pressed, lv.PART.MAIN | lv.STATE.PRESSED) -AI_press_btn.set_style_radius(30,0) - -AI_press_label = lv.label(AI_screen) -AI_press_label.set_text("单击说话") -AI_press_label.set_size(LCD_SIZE_W, 38) -AI_press_label.set_pos(0,(LCD_SIZE_H-60)+22) +# AI_press_btn = lv.btn(AI_talk_end_screen) +# AI_press_btn.set_pos(10, (LCD_SIZE_H-60)+4) +# AI_press_btn.set_size(LCD_SIZE_W-20, 56) +# AI_press_btn.add_style(style_AI_btn, lv.PART.MAIN | lv.STATE.DEFAULT) +# AI_press_btn.add_style(style_common_bg_rect_btn_pressed, lv.PART.MAIN | lv.STATE.PRESSED) +# AI_press_btn.set_style_radius(30,0) + +al_talk_end_screen_icon1 = lv.img(AI_talk_end_screen) +al_talk_end_screen_icon1.set_size(50,50) +al_talk_end_screen_icon1.set_pos(10,220) +al_talk_end_screen_icon1.add_flag(lv.obj.FLAG.CLICKABLE) +al_talk_end_screen_icon1.set_src("E:/static/AI/ai_result_can_bt.png") +al_talk_end_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_talk_end_screen_icon2 = lv.img(AI_talk_end_screen) +al_talk_end_screen_icon2.set_size(150,50) +al_talk_end_screen_icon2.set_pos(80,220) +al_talk_end_screen_icon2.add_flag(lv.obj.FLAG.CLICKABLE) +al_talk_end_screen_icon2.set_src("E:/static/AI/ai_result_bt.png") +al_talk_end_screen_icon2.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +AI_press_label = lv.label(al_talk_end_screen_icon2) +AI_press_label.set_text("继续对话") +AI_press_label.set_size(240-108, 50) +AI_press_label.set_pos(0,13) AI_press_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) AI_press_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -AI_press_label_countdown = lv.label(AI_screen_list_screen) -AI_press_label_countdown.set_pos(30, 40) -AI_press_label_countdown.set_size(LCD_SIZE_W-30, 66) -AI_press_label_countdown.set_text(" ") -AI_press_label_countdown.set_long_mode(lv.label.LONG.WRAP) -AI_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) -AI_press_label_countdown.add_style(style_font_20_ai_green, lv.PART.MAIN | lv.STATE.DEFAULT) - -AI_label = lv.label(AI_screen_list_screen) -AI_label.set_pos(0, 135) -AI_label.set_size(LCD_SIZE_W-30, 80) -AI_label.set_text(" ") +AI_listen_text = lv.label(AI_screen_list_screen) +AI_listen_text.set_pos(30, 40) +AI_listen_text.set_size(LCD_SIZE_W-30, 66) +AI_listen_text.set_text(" ") +AI_listen_text.set_long_mode(lv.label.LONG.WRAP) +AI_listen_text.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) +AI_listen_text.add_style(style_font_20_ai_green, lv.PART.MAIN | lv.STATE.DEFAULT) + +style_white_screen = lv.style_t() +style_white_screen.init() +style_white_screen.set_radius(0) +style_white_screen.set_bg_color(lv.color_make(0xff, 0xff, 0xff)) +style_white_screen.set_bg_opa(255) +style_white_screen.set_border_width(0) +style_white_screen.set_pad_left(0) +style_white_screen.set_pad_right(0) +style_white_screen.set_pad_top(0) +style_white_screen.set_pad_bottom(0) + +#灰色背景黑色字 +style_font_28_black_bg_gray = lv.style_t() +style_font_28_black_bg_gray.init() +style_font_28_black_bg_gray.set_text_color(lv.color_make(0x00, 0x00, 0x00)) +style_font_28_black_bg_gray.set_text_font_v2("font_28.bin",28,0) +style_font_28_black_bg_gray.set_bg_color(lv.color_make(0xe1,0xdb,0xdb)) + +msg_detail_cont_obj = lv.obj(AI_talk_end_screen) +msg_detail_cont_obj.set_pos(0, 120) +msg_detail_cont_obj.set_size(LCD_SIZE_W, 86) +msg_detail_cont_obj.add_style(style_white_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_label = lv.label(msg_detail_cont_obj) +AI_label.set_pos(0, 5) +AI_label.set_size(LCD_SIZE_W, lv.SIZE.CONTENT) AI_label.set_long_mode(lv.label.LONG.WRAP) AI_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) -AI_label.add_style(style_font_20_ai_white, lv.PART.MAIN | lv.STATE.DEFAULT) - - +AI_label.add_style(style_font_28_black_bg_gray, lv.PART.MAIN | lv.STATE.DEFAULT) + + + +#开始对话 +AI_talk_screen = lv.obj(AI_screen) +print("AI_talk_screen") +AI_talk_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +AI_talk_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_talk_screen.set_pos(0, 0) +AI_talk_screen.set_size(LCD_SIZE_W, LCD_SIZE_H) + + +al_talk_screen_title1 = lv.label(AI_talk_screen) +al_talk_screen_title1.set_pos(0, 20) +al_talk_screen_title1.set_size(LCD_SIZE_W, 40) +al_talk_screen_title1.set_text("AI智能助手") +al_talk_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_talk_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_talk_screen_icon1 = lv.img(AI_talk_screen) +al_talk_screen_icon1.set_size(140,45) +al_talk_screen_icon1.set_pos((240-140)//2,110-13) +al_talk_screen_icon1.set_src("E:/static/AI/AI_LISTEN_GIF001.png") +al_talk_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_talk_screen_icon = lv.img(AI_talk_screen) +al_talk_screen_icon.set_size(230,58) +al_talk_screen_icon.set_pos((240-230)//2,210) +al_talk_screen_icon.set_src("E:/static/AI/ai_talk_bt.png") +al_talk_screen_icon.add_flag(lv.obj.FLAG.CLICKABLE) +al_talk_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_talk_screen_title4 = lv.label(al_talk_screen_icon) +al_talk_screen_title4.set_pos(0, 18) +al_talk_screen_title4.set_size(230, 58) +al_talk_screen_title4.set_text("开始对话") +al_talk_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_talk_screen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +#没有网络数据 +AI_no_net_screen = lv.obj(AI_screen) +print("AI_no_net_screen") +AI_no_net_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +AI_no_net_screen.set_pos(0, 0) +AI_no_net_screen.set_size(LCD_SIZE_W, LCD_SIZE_H) +AI_no_net_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + +al_no_sim_popup_screen_title1 = lv.label(AI_no_net_screen) +al_no_sim_popup_screen_title1.set_pos(0, 20) +al_no_sim_popup_screen_title1.set_size(LCD_SIZE_W, 40) +al_no_sim_popup_screen_title1.set_text("AI智能助手") +al_no_sim_popup_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_no_sim_popup_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_no_sim_popup_screen_icon = lv.img(AI_no_net_screen) +al_no_sim_popup_screen_icon.set_size(42,42) +al_no_sim_popup_screen_icon.set_pos((240-42)//2,60) +al_no_sim_popup_screen_icon.set_src("E:/static/AI/ai_warning.png") +al_no_sim_popup_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_no_sim_popup_screen_title2 = lv.label(AI_no_net_screen) +al_no_sim_popup_screen_title2.set_pos(0, 125) +al_no_sim_popup_screen_title2.set_size(LCD_SIZE_W, 40) +al_no_sim_popup_screen_title2.set_text("启动失败") +al_no_sim_popup_screen_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_no_sim_popup_screen_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_no_sim_popup_screen_title3 = lv.label(AI_no_net_screen) +al_no_sim_popup_screen_title3.set_pos(0, 165) +al_no_sim_popup_screen_title3.set_size(LCD_SIZE_W, 40) +al_no_sim_popup_screen_title3.set_text("请先开启移动数据") +al_no_sim_popup_screen_title3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_no_sim_popup_screen_title3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_no_sim_popup_screen_icon1 = lv.img(AI_no_net_screen) +al_no_sim_popup_screen_icon1.set_size(230,58) +al_no_sim_popup_screen_icon1.set_pos((240-230)//2,210) +al_no_sim_popup_screen_icon1.set_src("E:/static/AI/ai_confirm_bt.png") +al_no_sim_popup_screen_icon1.add_flag(lv.obj.FLAG.CLICKABLE) +al_no_sim_popup_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_no_sim_popup_screen_title4 = lv.label(al_no_sim_popup_screen_icon1) +al_no_sim_popup_screen_title4.set_pos(0, 18) +al_no_sim_popup_screen_title4.set_size(230, 58) +al_no_sim_popup_screen_title4.set_text("确定") +al_no_sim_popup_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_no_sim_popup_screen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +#正在聆听 +AI_listen_screen = lv.obj(AI_screen) +print("AI_listen_screen") +AI_listen_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +AI_listen_screen.set_pos(0, 0) +AI_listen_screen.set_size(LCD_SIZE_W, LCD_SIZE_H) +AI_listen_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + +al_listen_screen_title1 = lv.label(AI_listen_screen) +al_listen_screen_title1.set_pos(0, 20) +al_listen_screen_title1.set_size(LCD_SIZE_W, 40) +al_listen_screen_title1.set_text("正在聆听...") +al_listen_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_listen_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_listen_screen_icon1 = lv.img(AI_listen_screen) +al_listen_screen_icon1.set_size(140,45) +al_listen_screen_icon1.set_pos((240-140)//2,110-13) +al_listen_screen_icon1.set_src("E:/static/AI/AI_LISTEN_GIF001.png") +al_listen_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_listen_screen_icon = lv.img(AI_listen_screen) +al_listen_screen_icon.set_size(230,58) +al_listen_screen_icon.set_pos((240-230)//2,210) +al_listen_screen_icon.set_src("E:/static/AI/ai_confirm_bt.png") +al_listen_screen_icon.add_flag(lv.obj.FLAG.CLICKABLE) +al_listen_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_listen_screen_title4 = lv.label(al_listen_screen_icon) +al_listen_screen_title4.set_pos(0, 18) +al_listen_screen_title4.set_size(230, 58) +al_listen_screen_title4.set_text("说话完成") +al_listen_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_listen_screen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +#正在思考 +AI_think_screen = lv.obj(AI_screen) +print("AI_think_screen") +AI_think_screen.set_pos(0, 0) +AI_think_screen.set_size(LCD_SIZE_W, LCD_SIZE_H) +AI_think_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +AI_think_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + +al_think_screen_title1 = lv.label(AI_think_screen) +al_think_screen_title1.set_pos(0, 20) +al_think_screen_title1.set_size(LCD_SIZE_W, 40) +al_think_screen_title1.set_text("正在思考...") +al_think_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_think_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_think_screen_icon = lv.img(AI_think_screen) +al_think_screen_icon.set_size(130,130) +al_think_screen_icon.set_pos((240-130)//2,65) +al_think_screen_icon.set_src("E:/static/AI/AI_THINK001.png") +al_think_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_think_screen_icon1 = lv.img(AI_think_screen) +al_think_screen_icon1.set_size(230,58) +al_think_screen_icon1.set_pos((240-230)//2,210) +al_think_screen_icon1.set_src("E:/static/AI/ai_confirm_bt.png") +al_think_screen_icon1.add_flag(lv.obj.FLAG.CLICKABLE) +al_think_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_think_screen_title4 = lv.label(al_think_screen_icon1) +al_think_screen_title4.set_pos(0, 18) +al_think_screen_title4.set_size(230, 58) +al_think_screen_title4.set_text("取消") +al_think_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_think_screen_title4.add_style(style_font_youyuan_ai_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +# #连接超时 +AI_connect_timerout_screen = lv.obj(AI_screen) +AI_connect_timerout_screen.set_pos(0, 0) +AI_connect_timerout_screen.set_size(LCD_SIZE_W, LCD_SIZE_H) +print("AI_connect_timerout_screen") +AI_connect_timerout_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +AI_connect_timerout_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + +al_connect_timerout_title1 = lv.label(AI_connect_timerout_screen) +al_connect_timerout_title1.set_pos(0, 20) +al_connect_timerout_title1.set_size(LCD_SIZE_W, 40) +al_connect_timerout_title1.set_text("AI智能助手") +al_connect_timerout_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_connect_timerout_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_connect_timerout_icon = lv.img(AI_connect_timerout_screen) +al_connect_timerout_icon.set_size(42,42) +al_connect_timerout_icon.set_pos((240-42)//2,60) +al_connect_timerout_icon.set_src("E:/static/AI/ai_warning.png") +al_connect_timerout_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_connect_timerout_title2 = lv.label(AI_connect_timerout_screen) +al_connect_timerout_title2.set_pos(0, 125) +al_connect_timerout_title2.set_size(LCD_SIZE_W, 40) +al_connect_timerout_title2.set_text("连接超时") +al_connect_timerout_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_connect_timerout_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_connect_timerout_title3 = lv.label(AI_connect_timerout_screen) +al_connect_timerout_title3.set_pos(0, 165) +al_connect_timerout_title3.set_size(LCD_SIZE_W, 40) +al_connect_timerout_title3.set_text("请重新对话") +al_connect_timerout_title3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_connect_timerout_title3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_connect_timerout_icon1 = lv.img(AI_connect_timerout_screen) +al_connect_timerout_icon1.set_size(230,58) +al_connect_timerout_icon1.set_pos((240-230)//2,210) +al_connect_timerout_icon1.set_src("E:/static/AI/ai_confirm_bt.png") +al_connect_timerout_icon1.add_flag(lv.obj.FLAG.CLICKABLE) +al_connect_timerout_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_connect_timerout_title4 = lv.label(al_connect_timerout_icon1) +al_connect_timerout_title4.set_pos(0, 18) +al_connect_timerout_title4.set_size(230, 58) +al_connect_timerout_title4.set_text("确定") +al_connect_timerout_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_connect_timerout_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +#未检测到录音 +AI_not_listen_text_screen = lv.obj(AI_screen) +AI_not_listen_text_screen.set_pos(0, 0) +AI_not_listen_text_screen.set_size(LCD_SIZE_W, LCD_SIZE_H) +print("AI_not_listen_text_screen") +AI_not_listen_text_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +AI_not_listen_text_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + +al_not_listen_title1 = lv.label(AI_not_listen_text_screen) +al_not_listen_title1.set_pos(0, 20) +al_not_listen_title1.set_size(LCD_SIZE_W, 40) +al_not_listen_title1.set_text("AI智能助手") +al_not_listen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_not_listen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_not_listen_icon = lv.img(AI_not_listen_text_screen) +al_not_listen_icon.set_size(42,42) +al_not_listen_icon.set_pos((240-42)//2,60) +al_not_listen_icon.set_src("E:/static/AI/ai_warning.png") +al_not_listen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_not_listen_title2 = lv.label(AI_not_listen_text_screen) +al_not_listen_title2.set_pos(0, 125) +al_not_listen_title2.set_size(LCD_SIZE_W, 40) +al_not_listen_title2.set_text("未检测到录音数据") +al_not_listen_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_not_listen_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_not_listen_title3 = lv.label(AI_not_listen_text_screen) +al_not_listen_title3.set_pos(0, 165) +al_not_listen_title3.set_size(LCD_SIZE_W, 40) +al_not_listen_title3.set_text("请重新对话") +al_not_listen_title3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_not_listen_title3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + +al_not_listen_icon1 = lv.img(AI_not_listen_text_screen) +al_not_listen_icon1.set_size(230,58) +al_not_listen_icon1.set_pos((240-230)//2,210) +al_not_listen_icon1.set_src("E:/static/AI/ai_confirm_bt.png") +al_not_listen_icon1.add_flag(lv.obj.FLAG.CLICKABLE) +al_not_listen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +al_not_listen_title4 = lv.label(al_not_listen_icon1) +al_not_listen_title4.set_pos(0, 18) +al_not_listen_title4.set_size(230, 58) +al_not_listen_title4.set_text("确定") +al_not_listen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +al_not_listen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) class AIScreen(Screen):#AI_GUI # NAME = "AI_success" @@ -139,17 +476,17 @@ class AIScreen(Screen):#AI_GUI def __init__(self): super().__init__() self.meta = AI_screen - self.meta_type = "popup" + # self.meta_type = "popup" self.Audio_buf_size = 8*1024 self.record_timer = osTimer() self.record = audio.Record() #self.record.end_callback(self.record_callback) self.record.gain_set(4,10) self.aud = audio.Audio(0) - self.audio_play_start = 0 - self.audio_play_state = 0 #音频播放完状态 + self.audio_play_state = 1 #音频播放完状态 self.aud.setCallback(self.audio_cb) + self.TTS_PRO_TYPE = 0 #TTS协议类型,=0:用长文本合成接口,=1用音频流合成接口 self.AI_audio_queue_thread_id = 0 self.AI_send_data_queue_thread_id = 0 self.AI_client_chat_recv_id = 0 @@ -168,28 +505,332 @@ class AIScreen(Screen):#AI_GUI self.AI_client_tts_num = 2 self.AI_client_tts_timer = osTimer() self.AI_client_tts_data_len = 0 + self.AI_client_tts_data_total_len = 0 #单次tts总数据长度 + self.AI_client_tts_str_total_len = 0 #单次已发送tts字符串长度 + self.AI_client_tts_str_sen = '' #单次已发送tts字符串长度 self.AI_client_tts_tra_flag = 0 + self.AI_client_tts_full_sentence_flag = 0 #完整的句子标识 self.tts_time_count = 0 + self.timer_out_count = 0 + self.img_show_count = 0 + self.img_show_count_tmp = 0 self.tts_data_tmp = bytes() self.press_state = 0 self.AI_label_str = "" + self.AI_client_tts_play_data_len = 0 + self.refresh_texttimer = osTimer() + self.AI_listen_text = "" + self.AI_listen_end = 0 #语音识别完成 + self.refresh_count = 0 + self.text_refresh_show = Queue() + _thread.start_new_thread(self.text_refresh_queue_thread, ()) + EventMesh.subscribe("publish_message_event_text_refresh",self.publish_message_event_text_refresh) # AI_press_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talking_cb(e)), # lv.EVENT.LONG_PRESSED, None) # AI_press_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.sending_cb(e)), # lv.EVENT.RELEASED, None) - AI_press_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talking_cb(e)), - lv.EVENT.RELEASED, None) + al_talk_screen_icon.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talking_cb(e)), + lv.EVENT.SHORT_CLICKED, None) + + al_no_sim_popup_screen_icon1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e)), lv.EVENT.SHORT_CLICKED, None) #无网络按钮 + al_listen_screen_icon.add_event_cb(lambda e: EventMesh.callback_wrapper(self.listen_end_btcb(e)), lv.EVENT.SHORT_CLICKED, None) #说话完成按钮 + al_think_screen_icon1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.think_bt_cb(e)), lv.EVENT.SHORT_CLICKED, None) #思考界面取消按钮 + al_connect_timerout_icon1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talk_end_continue_cb(e)), lv.EVENT.SHORT_CLICKED, None) #连接超时 请重新对话按钮 + al_talk_end_screen_icon1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talk_end_cancel_cb(e)), lv.EVENT.SHORT_CLICKED, None) #对话结束 取消对话按钮 + al_talk_end_screen_icon2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talk_end_continue_cb(e)), lv.EVENT.SHORT_CLICKED, None) #对话结束 继续对话按钮 + al_not_listen_icon1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.talk_end_continue_cb(e)), lv.EVENT.SHORT_CLICKED, None) + + def text_refresh_queue_thread(self): + while True: + data = self.text_refresh_show.get() + #print("ledInfo_queue:data = {}".format(data)) + if data != None: + try: + data["func"](data["data"]) + except Exception as e: + print("ledInfo_queue:ERROR:{}".format(e)) + usys.print_exception(e) + def publish_message_event_text_refresh(self,event,msg): + self.text_refresh_show.put(msg) + + def publish_motor_event_cb(self, *args, **kwargs): + EventMesh.publish("publish_message_event_ui",{"func":self.text_show_refresh,"data":e}) + # EventMesh.publish("publish_message_event_text_refresh",{"func":self.text_show_refresh,"data":0}) + + def talk_end_cancel_cb(self,e):#对话结束已经播放音频取消继续对话按钮 + self.press_state = 0 + self.aud.stopPlayStream() + self.aud.stopAll() + self.audio_play_state =1 + self.tts_time_count = 0 + self.tts_data_tmp = b'' + self.AI_client_tts_data_len = 0 + self.AI_audio_queue.clear() + self.AI_send_data_queue.clear()#清音频队列 + self.AI_client_chat_play_str = '' + self.AI_client_tts_data_len = 0 + + self.AI_client_tts_timer.stop() + self.refresh_count = 0 + self.refresh_texttimer.stop() + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_talk_screen.clear_flag(lv.obj.FLAG.HIDDEN) # + + def talk_end_continue_cb(self,e):#连接超时确定按钮回调或者继续对话按钮 + # try: + # self.websocket_deconnect_asr() + # self.websocket_deconnect_tts() + # self.websocket_deconnect_chat() + # except Exception as e: + # usys.print_exception(e) + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_listen_screen.clear_flag(lv.obj.FLAG.HIDDEN) + al_listen_screen_icon1.set_src("E:/static/AI/AI_LISTEN_GIF001.png") + self.press_state = 0 + self.aud.stopPlayStream() + self.aud.stopAll() + self.audio_play_state =1 + self.AI_client_chat_play_str = '' + self.AI_client_tts_data_len = 0 + self.tts_time_count = 0 + self.tts_data_tmp = b'' + self.AI_client_tts_data_len = 0 + self.AI_audio_queue.clear() + self.AI_send_data_queue.clear()#清音频队列 + self.AI_client_tts_timer.stop() + + self.refresh_count = 0 + self.refresh_texttimer.start(500,1,self.text_show_refresh) + self.AI_client_tts_timer.start(1000,1,self.AI_client_tts_timer_cb) + EventMesh.publish("publish_message_event_ui",{"func":self.talking,"data":e}) + + pass + + def talk_connectout_cb(self,e):#连接超时确定按钮回调 + + pass + + def think_bt_cb(self,e):#正在思考确定按钮回调 取消播放 + self.press_state = 0 + self.aud.stopPlayStream() + self.aud.stopAll() + self.audio_play_state =1 + self.tts_time_count = 0 + self.tts_data_tmp = b'' + self.AI_audio_queue.clear() + self.AI_send_data_queue.clear()#清音频队列 + self.AI_client_chat_play_str = '' + self.AI_client_tts_data_len = 0 + + self.AI_client_tts_timer.stop() + self.refresh_count = 0 + self.refresh_texttimer.stop() + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_talk_screen.clear_flag(lv.obj.FLAG.HIDDEN) # + pass + + def not_talk_cb(self):#没有说话或者没有检测到录音数据 + self.record.stop()#关闭录音 + self.record_timer.stop()#关闭定时器 + self.refresh_texttimer.stop() + self.press_state = 0 + self.aud.stopPlayStream() + self.aud.stopAll() + self.audio_play_state =1 + self.tts_time_count = 0 + self.tts_data_tmp = b'' + self.AI_client_tts_data_len = 0 + self.AI_audio_queue.clear() + self.AI_send_data_queue.clear()#清音频队列 + self.AI_client_chat_play_str = '' + self.AI_client_tts_data_len = 0 + + self.AI_client_tts_timer.stop() + self.refresh_count = 0 + self.refresh_texttimer.stop() + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_not_listen_text_screen.clear_flag(lv.obj.FLAG.HIDDEN) # + try: + self.websocket_deconnect_asr() + except Exception as e: + usys.print_exception(e) + + def listen_end_btcb(self,e):#说话完成确定按钮回调 + if self.AI_listen_end == 1:#说话完成 已有录音文字返回 + self.AI_listen_end = 0 + self.refresh_count = 0 + self.refresh_texttimer.stop() + self.record.stop()#关闭录音 + self.record_timer.stop()#关闭定时器 + if self.AI_listen_text != "": + self.AI_client_chat_send(self.AI_listen_text) + print("self.AI_listen_text:{}".format(self.AI_listen_text)) + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_think_screen.clear_flag(lv.obj.FLAG.HIDDEN) # + al_think_screen_icon.set_src("E:/static/AI/AI_THINK001.png") + self.refresh_count = 0 + self.timer_out_count = 0 + self.img_show_count = 0 + self.refresh_texttimer.start(500,1,self.text_show_think) + else: + self.not_talk_cb() + return + try: + self.websocket_deconnect_asr() + except Exception as e: + usys.print_exception(e) + return + else:#没有识别到录音文字 + self.not_talk_cb() + + def ai_talk_end(self):#语言识别完 思考结束显示最后的文本和音频数据 + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_talk_end_screen.clear_flag(lv.obj.FLAG.HIDDEN) # + msg_detail_cont_obj.scroll_to(0, 0, lv.ANIM.OFF) + AI_listen_text.set_text(self.AI_listen_text) + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.refresh_count = 0 + self.refresh_texttimer.start(500,1,self.ai_talk_end_show_text) + + def ai_talk_end_show_text(self,*argc): + EventMesh.publish("system_sleep_rest")#防止黑屏 + pass + + def connect_timerout_popup(self):#连接超时弹窗提示 + self.record.stop()#关闭录音 + self.record_timer.stop()#关闭定时器 + self.refresh_texttimer.stop() + self.press_state = 0 + self.aud.stopPlayStream() + self.aud.stopAll() + self.audio_play_state =1 + self.tts_time_count = 0 + self.tts_data_tmp = b'' + self.AI_client_tts_data_len = 0 + self.AI_audio_queue.clear() + self.AI_send_data_queue.clear()#清音频队列 + self.AI_client_chat_play_str = '' + self.AI_client_tts_timer.stop() + self.refresh_count = 0 + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_connect_timerout_screen.clear_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + try: + self.websocket_deconnect_asr() + except Exception as e: + usys.print_exception(e) + + def text_show_think(self,*argc): + EventMesh.publish("publish_message_event_ui",{"func":self.text_show_think_cb,"data":0}) + + def text_show_think_cb(self,data): #文本刷新 + + if len(self.AI_label_str) != 0 and self.timer_out_count > 12: + if len(self.AI_client_chat_play_str) != 0: + self.refresh_texttimer.stop() + AI_label.set_text("语音识别中...") + self.ai_talk_end() + return + + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.timer_out_count += 1 + if self.timer_out_count > 2*30: #说话了服务器没有返回结果数据 + self.timer_out_count = 0 + #连接超时 + self.connect_timerout_popup() + return + + if self.img_show_count > 10: + self.img_show_count_tmp+=1 + self.img_show_count_tmp = self.img_show_count-self.img_show_count_tmp + if self.img_show_count_tmp >= 10: + self.img_show_count = 1 + al_think_screen_icon.set_src("E:/static/AI/AI_THINK{}.png".format("%03d"%(self.img_show_count_tmp))) + else: + self.img_show_count+=1 + self.img_show_count_tmp = 0 + al_think_screen_icon.set_src("E:/static/AI/AI_THINK{}.png".format("%03d"%(self.img_show_count))) + + + self.refresh_count+=1 + if self.refresh_count > 3: + self.refresh_count = 0 + if self.refresh_count == 1: + al_think_screen_title1.set_text("正在思考.") + elif self.refresh_count == 2: + al_think_screen_title1.set_text("正在思考..") + elif self.refresh_count == 3: + al_think_screen_title1.set_text("正在思考...") + pass + def img_cb(self,e): #无网络 无数据按钮回调 + self.refresh_texttimer.stop() + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_screen.clear_flag(lv.obj.FLAG.HIDDEN) # + pass def initialization(self): - AI_label.set_text(" ") - AI_press_label_countdown.set_text(" ") + self.TTS_PRO_TYPE = 0 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #开启显示 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_talk_screen.clear_flag(lv.obj.FLAG.HIDDEN) #先隐藏 self.aud.setVolume(11)#设置最大声录音 self.AI_audio_queue = Queue(100) self.AI_audio_queue_thread_id = _thread.start_new_thread(self.AI_audio_queue_thread, ()) self.AI_send_data_queue = Queue(100) self.AI_send_data_queue_thread_id = _thread.start_new_thread(self.AI_send_data_queue_thread, ()) + + self.AI_client_tts_timer.start(1000,1,self.AI_client_tts_timer_cb) - EventMesh.publish("publish_message_event_ui",{"func":self.websocket_connect,"data":""}) + self.AI_client_chat_play_str = '' + self.AI_client_chat_play_str ='' + self.AI_client_tts_data_len = 0 + self.AI_client_tts_data_total_len = 0 + self.AI_client_tts_str_total_len = 0 + self.AI_client_tts_tra_flag = 0 + #EventMesh.publish("publish_message_event_ui",{"func":self.websocket_connect,"data":""}) def websocket_connect(self,data): self.websocket_connect_asr() self.websocket_connect_chat() @@ -203,41 +844,133 @@ class AIScreen(Screen):#AI_GUI print('audio-play start.') elif event == 7: self.audio_play_state = 0 + # if self.AI_audio_queue.size() > 0: + # data = self.AI_audio_queue.get() + # print("audio_queue:data:{}".format(len(data))) + # if len(data) > 1: + # try: + # # while self.audio_play_state : + # # utime.sleep_ms(1) + # EventMesh.publish("system_sleep_rest")#防止黑屏 + # tmp=self.aud.playStream(3, data)#播放音频流文件 + # self.audio_play_state =1 + # print("playStream:{}".format(tmp)) + # except Exception as e: + # usys.print_exception(e) print('audio-play finish.') #按下录音 def talking_cb(self,e): - EventMesh.publish("publish_message_event_ui",{"func":self.talking,"data":e}) + self.press_state = 0 + self.refresh_count = 0 + self.refresh_texttimer.stop() + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#网络不正常 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_no_net_screen.clear_flag(lv.obj.FLAG.HIDDEN) #开启显示 + else: + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) #隐藏 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_think_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_listen_screen.clear_flag(lv.obj.FLAG.HIDDEN) + al_listen_screen_icon1.set_src("E:/static/AI/AI_LISTEN_GIF001.png") + self.timer_out_count = 0 + self.refresh_count = 0 + self.img_show_count = 0 + self.img_show_count_tmp = 0 + + self.refresh_texttimer.start(300,1,self.text_show_refresh) + self.AI_client_tts_timer.start(1000,1,self.AI_client_tts_timer_cb) + EventMesh.publish("publish_message_event_ui",{"func":self.talking,"data":e}) + def text_show_refresh(self,*argc): + EventMesh.publish("publish_message_event_ui",{"func":self.text_show_refresh_cb,"data":0}) + + def text_show_refresh_cb(self,data): + if self.AI_listen_end == 1 or self.timer_out_count >= 120:#语音识别结束 + self.AI_listen_end = 0 + self.refresh_count = 0 + self.refresh_texttimer.stop() + self.record.stop()#关闭录音 + self.record_timer.stop()#关闭定时器 + + if self.AI_listen_text != "": + + self.AI_client_chat_send(self.AI_listen_text) + print("self.AI_listen_text:{}".format(self.AI_listen_text)) + #正在思考 + AI_talk_end_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_listen_screen.add_flag(lv.obj.FLAG.HIDDEN) + AI_talk_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_no_net_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_connect_timerout_screen.add_flag(lv.obj.FLAG.HIDDEN) #先隐藏 + AI_not_listen_text_screen.add_flag(lv.obj.FLAG.HIDDEN) # + AI_think_screen.clear_flag(lv.obj.FLAG.HIDDEN) # + al_think_screen_icon.set_src("E:/static/AI/AI_THINK001.png") + self.refresh_count = 0 + self.timer_out_count = 0 + self.img_show_count = 0 + self.refresh_texttimer.start(500,1,self.text_show_think) + else: + self.not_talk_cb() + return + try: + self.websocket_deconnect_asr() + except Exception as e: + usys.print_exception(e) + return + + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.timer_out_count += 1 + + self.img_show_count+=1 + if self.img_show_count > 17: + self.img_show_count = 1 + + al_listen_screen_icon1.set_src("E:/static/AI/AI_LISTEN_GIF{}.png".format("%03d"%(self.img_show_count))) + + self.refresh_count+=1 + if self.refresh_count > 3: + self.refresh_count =0 + if self.refresh_count == 1: + al_listen_screen_title1.set_text("正在聆听.") + elif self.refresh_count == 2: + al_listen_screen_title1.set_text("正在聆听..") + elif self.refresh_count == 3: + al_listen_screen_title1.set_text("正在聆听...") + pass #按下录音 def talking(self,e): #self.AI_client_tts_send("创建客户端, debug=True输出日志")#TTS语音播放AI结果 #return if 1:#EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机 - if 1:#self.audio_play_start == 0: - self.audio_play_start = 1 + if 1:#self.audio_play_state == 0: + self.aud.stopPlayStream() + self.aud.stopAll() + self.audio_play_state = 1 print("talking1") #self.AI_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏列表选项方框 - if self.AI_client_asr_isconnect == 0: - self.websocket_connect_asr() - if self.AI_client_tts_isconnect == 0: - self.websocket_connect_tts() - if self.AI_client_chat_isconnect == 0: - self.websocket_connect_chat() try: self.record.stop()#关闭录音 self.record.stream_start(audio.Record.AMRNB, 8000, 60) except Exception as e: usys.print_exception(e) self.record_timer.start(1*1000,1,self.record_timer_cb) - self.aud.stopAll() + self.AI_listen_text ="" self.AI_client_chat_play_str = "" self.AI_send_data_queue.clear()#清音频队列 #self.AI_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏列表选项方框 - AI_label.clear_flag(lv.obj.FLAG.HIDDEN) - AI_label.set_text("语音识别中...") - AI_press_label_countdown.clear_flag(lv.obj.FLAG.HIDDEN) - #AI_press_label_countdown.set_text("{}S".format(str(self.countdown))) + # AI_label.clear_flag(lv.obj.FLAG.HIDDEN) + # AI_label.set_text("语音识别中...") + # AI_listen_text.clear_flag(lv.obj.FLAG.HIDDEN) + #AI_listen_text.set_text("{}S".format(str(self.countdown))) self.press_state = 1 self.AI_client_asr_start() else: @@ -253,15 +986,15 @@ class AIScreen(Screen):#AI_GUI self.record_timer.stop()#关闭定时器 # self.record.stream_start(audio.Record.AMRNB, 8000, 2) # self.record_timer.start(2*1000,0,self.record_timer_cb) - AI_label.clear_flag(lv.obj.FLAG.HIDDEN) + # AI_label.clear_flag(lv.obj.FLAG.HIDDEN) #AI_label.set_text(" ") - AI_press_label_countdown.clear_flag(lv.obj.FLAG.HIDDEN) - #AI_press_label_countdown.set_text(" ") + # AI_listen_text.clear_flag(lv.obj.FLAG.HIDDEN) + #AI_listen_text.set_text(" ") #Wechat_log("sending_cb1") #EventMesh.publish("publish_message_event_ui",{"func":self.sending,"data":e}) #self.sending(e) #Wechat_log("sending_cb2") - self.audio_play_start = 0 + self.audio_play_state = 0 else: self.press_state = 0 #EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"}) @@ -276,13 +1009,26 @@ class AIScreen(Screen):#AI_GUI if Record_len >0: read_buf = bytes(Record_read_buf[:Record_len]) self.AI_client_asr_send(read_buf) + #获取trace_id + def get_trace_id(self): + t = utime.mktime(utime.localtime()) + t = t*1000+urandom.randint(0, 1000) + md5_data = "{}".format(t)#md5签名 + sign_data = "" + hash_obj = uhashlib.md5(md5_data) + res = hash_obj.digest() + + # 转成十六进制表示 + sign_data = ubinascii.hexlify(res) + sign_data = sign_data.decode('ascii') + return sign_data ##################################################### #AI识别链路 def websocket_connect_chat(self): - print("websocket_connect_chat:{}".format(self.AI_client_chat_isconnect)) + print("websocket_connect_chat:{}!!!!!!!!!!!!!!!!!!!!!".format(self.AI_client_chat_isconnect)) #if self.AI_client_chat_isconnect == 0: # 创建客户端, debug=True输出日志, ip和端口需要自己填写, 或者是域名 - self.AI_client_chat = uwebsocket.Client.connect('ws://121.40.67.151:9099/chat/ws', debug=True) + self.AI_client_chat = uwebsocket.Client.connect('ws://121.40.67.151:9099/chat/ws', debug=False) # 线程接收数据 if self.AI_client_chat_recv_id != 0: try: @@ -316,22 +1062,27 @@ class AIScreen(Screen):#AI_GUI try: #print("AI_client_chat_recv recv_data = {}".format(recv_data)) jsload_data = ujson.loads(recv_data) - print("AI_client_chat_recv jsload_data = {}".format(jsload_data)) - if jsload_data["content"]: + #print("AI_client_chat_recv jsload_data = {}".format(jsload_data)) + chat_data = jsload_data["content"] + if chat_data: #self.AI_client_tts_send(jsload_data["content"])#TTS语音播放AI结果 - self.AI_label_str+=str(jsload_data["content"]) - self.AI_client_chat_play_str+=str(jsload_data["content"]) - AI_label.set_text(self.AI_label_str) - EventMesh.publish("system_sleep_rest")#防止黑屏 + print("AI_client_chat_recv chat_data = {}".format(chat_data)) + self.AI_label_str+=str(chat_data) + self.AI_client_chat_play_str+=str(chat_data) + if self.TTS_PRO_TYPE == 1: + AI_label.set_text(self.AI_label_str) + # EventMesh.publish("system_sleep_rest")#防止黑屏 else: # if self.AI_label_str: # self.AI_client_tts_send(self.AI_label_str)#TTS语音播放AI结果 - + print("AI_client_chat_recv chat_data start\r\n") if jsload_data['type']=='start': self.AI_label_str = "" self.AI_client_chat_end_flag = 0 - self.AI_client_tts_start() + self.websocket_connect_tts() #连接tts + # elif jsload_data['type']=='end': + print("chat end!!!!!!!!!!!!!!") self.AI_client_chat_end_flag = 1 except Exception as e: usys.print_exception(e) @@ -339,14 +1090,14 @@ class AIScreen(Screen):#AI_GUI except Exception as e: usys.print_exception(e) break - self.AI_client_tts_isconnect = 0 - self.AI_client_tts_recv_id = 0 + self.AI_client_chat_isconnect = 0 + self.AI_client_chat_recv_id = 0 ############################################################################## #文字转语音链路 def websocket_connect_tts(self): - print("websocket_connect_tts:{}".format(self.AI_client_tts_isconnect)) - #if self.AI_client_tts_isconnect == 0: - self.AI_client_tts = uwebsocket.Client.connect('ws://121.40.67.151:9099/tts/long-text-stream', debug=True) + print("websocket_connect_tts:{}!!!!!!!!!!!!!!!!!!!!!!".format(self.AI_client_tts_isconnect)) + if self.AI_client_tts_isconnect == 0: + self.AI_client_tts = uwebsocket.Client.connect('ws://121.40.67.151:9099/tts/long-text-stream', debug=False) # 线程接收数据 if self.AI_client_tts_recv_id != 0: try: @@ -358,46 +1109,70 @@ class AIScreen(Screen):#AI_GUI self.AI_client_tts_recv_id = _thread.start_new_thread(self.AI_client_tts_recv, (self.AI_client_tts,)) #_thread.stack_size(8*1024) self.AI_client_tts_isconnect = 1 + self.AI_client_tts_start() def websocket_deconnect_tts(self): if self.AI_client_tts_isconnect == 1: self.AI_client_tts_isconnect = 0 - self.AI_client_tts.close() + try: + self.AI_client_tts.close() + except Exception as e: + usys.print_exception(e) def AI_client_tts_timer_cb(self,*argc): + # EventMesh.publish("system_sleep_rest")#防止黑屏 self.tts_time_count+=1 - #tts数据入队 - #self.AI_client_tts_put_data() + if self.TTS_PRO_TYPE == 1: + #tts数据入队 + self.AI_client_tts_put_data() + print("AI_audio_queue.size:{},AI_send_data_queue.size:{} self.AI_client_chat_play_str:{}\r\n".format(self.AI_audio_queue.size(),self.AI_send_data_queue.size(),self.AI_client_chat_play_str) ) #字符串分段发送,等待播放缓存变小 - if len(self.AI_client_chat_play_str) >0 and self.AI_client_tts_data_len < 50*1024: - play_str = sub_utf8_String(self.AI_client_chat_play_str,40)#按中文切割字符串 + if len(self.AI_client_chat_play_str) >0 and self.AI_client_tts_data_len < 200*1024 :#and (self.AI_client_tts_str_total_len <100 or self.AI_client_tts_str_total_len - self.AI_client_tts_data_total_len//672 < 60)缓存200k以下,且tts发送文字字节数比返回音频数据少60字节 + # play_str = split_string(self.AI_client_chat_play_str,40)# + # if play_str =="":#没找到句号或者逗号,切割字符串 + if self.TTS_PRO_TYPE == 1: + play_str = sub_utf8_String(self.AI_client_chat_play_str,20)#按中文切割字符串 + self.AI_client_tts_str_total_len += len(play_str) + elif self.TTS_PRO_TYPE == 0: + if self.AI_audio_queue.size() >= 5 or self.AI_client_tts_tra_flag == 1:#存了超过4句,就等小于3次在转化 + return + play_str = split_string(self.AI_client_chat_play_str,70,150)#按逗号,句号切割 + if play_str =="" or len(play_str)>150:#没找到句号或者逗号,切割字符串 + play_str = sub_utf8_String(self.AI_client_chat_play_str,100)#按中文切割字符串 + self.AI_client_tts_tra_flag = 1 + self.AI_client_tts_str_sen = play_str + self.AI_client_tts_send(play_str)#TTS语音播放AI结果 self.AI_client_chat_play_str = self.AI_client_chat_play_str[len(play_str):] - self.AI_client_tts_tra_flag = 1 - print("TTS play:{}".format(play_str)) - if len(self.AI_client_chat_play_str) <=0 and self.AI_client_chat_end_flag ==1: + print("TTS play:len{},data{}".format(len(play_str),play_str)) + if len(self.AI_client_chat_play_str) <=0 and self.AI_client_chat_end_flag ==1 : + self.AI_client_chat_end_flag=0 self.AI_client_tts_end() - EventMesh.publish("system_sleep_rest")#防止黑屏 + def AI_client_tts_send(self,data_str): - #data_l ={"header": {"event": "RunSynthesis","trace_id": "3fa6b9e6a30b407ea38ad7ae69e6c291"},"payload": {"text":"%s"%(data_str)}} - data_l ={ - "header": { - "event": "LongTextStream", - "trace_id": "3fa6b9e6a30b407ea38ad7ae69e6c291" - }, - "payload": { - "voice":"xiaoyun", - "format":"mp3", - "sample_rate":8000, - "volume":100, - "speech_rate":0, - "text":"%s"%(data_str) + data_l = {} + if self.TTS_PRO_TYPE == 1: + + data_l ={"header": {"event": "RunSynthesis","trace_id": self.get_trace_id()},"payload": {"text":"%s"%(data_str)}} + elif self.TTS_PRO_TYPE == 0: + data_l ={ + "header": { + "event": "LongTextStream", + "trace_id": self.get_trace_id() + }, + "payload": { + "voice":"xiaoyun", + "format":"mp3", + "sample_rate":8000, + "volume":90, + "speech_rate":2, + "text":"%s"%(data_str) + } } - } json_data = ujson.dumps(data_l) self.AI_send_data_queue.put([self.AI_client_tts_num,json_data]) def AI_client_tts_start(self): - data_l ={"header": {"event": "StartSynthesis","trace_id": "3fa6b9e6a30b407ea38ad7ae69e6c291"}, - "payload": {"voice":"xiaoyun","format":"mp3","sample_rate":8000,"volume":80,"speech_rate":1,}} - print("\r\nAI_client_tts_start!!!!!!!!!!!!\r\n") + data_l ={"header": {"event": "StartSynthesis","trace_id": self.get_trace_id()}, + "payload": {"voice":"xiaoyun","format":"mp3","sample_rate":8000,"volume":60,"speech_rate":1,}} + #print("\r\nAI_client_tts_start!!!!!!!!!!!!\r\n") json_data = ujson.dumps(data_l) #print("AI_client_tts_send:{}".format(json_data)) self.record.stop()#关闭录音 @@ -405,27 +1180,41 @@ class AIScreen(Screen):#AI_GUI self.tts_time_count = 0 self.tts_data_tmp = b'' self.AI_client_tts_data_len = 0 - self.AI_audio_queue.clear() - #self.AI_client_tts.send(json_data) + self.AI_client_tts_data_total_len = 0 + self.AI_client_tts_str_total_len= 0 + + #self.AI_client_tts_str_sen = "" + if self.TTS_PRO_TYPE == 1: + self.AI_client_tts_tra_flag = 1 + self.AI_client_tts.send(json_data) + utime.sleep_ms(100) #self.AI_send_data_queue.put([self.AI_client_tts_num,json_data]) def AI_client_tts_end(self): - data_l ={"header": {"event": "StopSynthesis","trace_id": "3fa6b9e6a30b407ea38ad7ae69e6c291"}} - json_data = ujson.dumps(data_l) - #self.AI_send_data_queue.put([self.AI_client_tts_num,json_data]) + if self.TTS_PRO_TYPE == 1: + data_l ={"header": {"event": "StopSynthesis","trace_id": self.get_trace_id()}} + json_data = ujson.dumps(data_l) + self.AI_send_data_queue.put([self.AI_client_tts_num,json_data]) #TTS数据入队 def AI_client_tts_put_data(self): #存够5k数据或者3秒超时 - #if len(self.tts_data_tmp) >20*1024 or self.tts_time_count >= 3: + if (self.AI_client_tts_full_sentence_flag == 1 and len(self.tts_data_tmp) >30*1024) \ + or self.tts_time_count >= 3 \ + or (self.AI_client_tts_full_sentence_flag == 1 and self.AI_client_tts_tra_flag == 1 and len(self.tts_data_tmp) >5*1024): + self.AI_client_tts_full_sentence_flag == 0 #self.AI_client_tts_data_len +=len(self.tts_data_tmp) + if self.AI_client_tts_tra_flag == 1:#第一个数据去掉头 + self.tts_data_tmp = self.tts_data_tmp[9:] if len(self.tts_data_tmp)>0: - self.AI_audio_queue.put(self.tts_data_tmp) + self.AI_audio_queue.put([self.tts_data_tmp,self.AI_client_tts_str_sen]) print("入:{},{}".format(len(self.tts_data_tmp),self.AI_client_tts_data_len)) self.tts_time_count = 0 self.tts_data_tmp = b'' - self.AI_client_tts_tra_flag = 0 + if self.TTS_PRO_TYPE == 1: + self.AI_client_tts_tra_flag = 0 #文字转语音链路读数据 def AI_client_tts_recv(self,cli): - self.AI_client_tts_start() + recv_data_len_same_count = 0 + recv_data_len = 0 while True: try: # 死循环接收数据 @@ -444,14 +1233,31 @@ class AIScreen(Screen):#AI_GUI if recv_data.find('\"event\":\"EndSynthesis\"') != -1: print("EndSynthesis!!!!!!!!!!!!!!!!!\r\n") print("EndSynthesis!!!!!!!!!!!!!!!!!!\r\n") + #self.tts_data_tmp=self.tts_data_tmp[9:-100] + self.websocket_deconnect_tts()#断开 self.tts_time_count = 60#立即发送剩余数据 - self.tts_data_tmp=self.tts_data_tmp[9:-100] self.AI_client_tts_put_data() - self.AI_client_tts_tra_flag = 0 + + self.AI_client_tts_full_sentence_flag = 1 + break else: + #判断是否是一个完整的句子 + recv_data_len_tmp = len(recv_data) + if self.TTS_PRO_TYPE == 1: + print("recv_data_len_same_count:{}".format(recv_data_len_same_count)) + if recv_data_len == recv_data_len_tmp: + recv_data_len_same_count+=1 + else: + if recv_data_len_same_count > 2:#认为是完整的句子 + self.AI_client_tts_full_sentence_flag = 1 + print("self.AI_client_tts_full_sentence_flag = 1!!!!!!!!!!!!") + recv_data_len_same_count = 0 + recv_data_len = recv_data_len_tmp self.tts_data_tmp+=recv_data - self.AI_client_tts_data_len+=len(recv_data) - #self.AI_client_tts_put_data() + self.AI_client_tts_data_len+=recv_data_len_tmp + self.AI_client_tts_data_total_len += recv_data_len_tmp + if self.TTS_PRO_TYPE == 1: + self.AI_client_tts_put_data() #utime.sleep_ms(1000) except Exception as e: usys.print_exception(e) @@ -463,15 +1269,16 @@ class AIScreen(Screen):#AI_GUI break self.AI_client_tts_isconnect = 0 self.AI_client_tts_recv_id = 0 + self.AI_client_tts_tra_flag = 0 ####################################################################### #语音转文字链路 def websocket_connect_asr(self): - print("websocket_connect_asr:{}".format(self.AI_client_asr_isconnect)) + print("websocket_connect_asr:{}!!!!!!!!!!!!!!!!!!!!".format(self.AI_client_asr_isconnect)) try: self.websocket_deconnect_asr()#先断一次,预防出错 except Exception as e: usys.print_exception(e) - self.AI_client_asr = uwebsocket.Client.connect('ws://121.40.67.151:9099/asr/ws', debug=True) + self.AI_client_asr = uwebsocket.Client.connect('ws://121.40.67.151:9099/asr/ws', debug=False) # 线程接收数据 if self.AI_client_asr_recv_id != 0: try: @@ -511,21 +1318,27 @@ class AIScreen(Screen):#AI_GUI if jsload_data["result"] == None: continue if jsload_data["result"]["result"]: - AI_press_label_countdown.set_text(str(jsload_data["result"]["result"])) + self.AI_listen_text = str(jsload_data["result"]["result"]) + # AI_listen_text.set_text(str(jsload_data["result"]["result"])) if jsload_data["result"]["is_end"] == True: #{"type":"chat","content":"你好"} + self.AI_listen_end = 1 + self.audio_play_state = 0 + break #chat_data = bytearray(chat_data_str) - AI_label.set_text("思考中...") - self.AI_client_chat_send(str(jsload_data["result"]["result"])) - print("chat_data:{}".format(str(jsload_data["result"]["result"]))) - self.record.stop()#关闭录音 - self.record_timer.stop()#关闭定时器 - try: - self.websocket_deconnect_asr() - break - except Exception as e: - usys.print_exception(e) + # AI_label.set_text("思考中...") + # self.AI_client_chat_send(str(jsload_data["result"]["result"])) + # print("chat_data:{}".format(str(jsload_data["result"]["result"]))) + # self.record.stop()#关闭录音 + # self.record_timer.stop()#关闭定时器 + + # try: + # self.websocket_deconnect_asr() + # break + # except Exception as e: + # usys.print_exception(e) elif jsload_data["result"]["is_end"] == False: - AI_label.set_text("语音识别中...") + self.AI_listen_end = 0 + # AI_label.set_text("语音识别中...") except Exception as e: print("error recv_data:{}".format(recv_data)) usys.print_exception(e) @@ -541,17 +1354,20 @@ class AIScreen(Screen):#AI_GUI while True: #data[0]是websocket连接对象编号,data[1]是数据 data = self.AI_send_data_queue.get() - - - - if data != None: try: + #data["func"](data["data"]) + # self.record.stop() + # self.aud.playStream(4, data) + # self.record.stream_start(audio.Record.AMRNB, 8000, 60) + # 发送数据 + #bytes_data = bytes(data[1]) + #data[0].send(data[1]) if data[0] == self.AI_client_chat_num: if self.AI_client_chat_isconnect == 0: self.websocket_connect_chat() - self.AI_client_chat.send(data[1]) - print("chat send_data:{}".format(len(data[1]))) + tmp = self.AI_client_chat.send(data[1]) + print("chat send_data:{} tmp:{}".format(len(data[1]),tmp)) if data[0] == self.AI_client_asr_num: if self.AI_client_asr_isconnect == 0: self.websocket_connect_asr() @@ -560,7 +1376,7 @@ class AIScreen(Screen):#AI_GUI if data[0] == self.AI_client_tts_num: if self.AI_client_tts_isconnect == 0: self.websocket_connect_tts() - print("tts send_data:{}".format(len(data[1]))) + print("tts send_data:{}".format((data[1]))) self.AI_client_tts.send(data[1]) except Exception as e: print("DeviceInfo_queue_thread:ERROR:{}".format(e)) @@ -575,41 +1391,58 @@ class AIScreen(Screen):#AI_GUI count =10 while 1: count-=1 - if count<=0: + if count<=0: break self.AI_client_tts_isconnect = 0 self.websocket_connect_tts() #self.AI_client_tts_start() if self.AI_client_tts_isconnect == 1: - self.AI_client_tts.send(data[1]) + try: + self.AI_client_tts.send(data[1]) + break + except Exception as e: + usys.print_exception(e) + ############################################ # 音频队列 def AI_audio_queue_thread(self): + while True: - if self.audio_play_state == 0: - data = self.AI_audio_queue.get() - print("audio_queue:data:{}".format(len(data))) - - if len(data) > 1: - # f = open("/usr/test.mp3", "w+") - # f.write(data) - try: - # while self.audio_play_state: - # pass - print("1playStream!!!!!!!") - #data = data[9:] - tmp=self.aud.playStream(3, data)#播放音频流 - print("出:{},{}!!!".format(len(data),self.AI_client_tts_data_len)) - if tmp != 0: - print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data))) - print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data))) - print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data))) - print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data))) - self.AI_client_tts_data_len -=len(data) - except Exception as e: + try: + if self.audio_play_state == 0: + #print("AI_audio_queue_thread") + data = self.AI_audio_queue.get() + + #self.AI_client_tts_data_len=len(data) + print("audio_queue:len:{},data{}".format(len(data[0]),data[1])) + if len(data[0]) > 1: + if self.TTS_PRO_TYPE == 0: + AI_label.set_text(data[1]) + # + # f = open("/usr/test.mp3", "w+") + # f.write(data) + try: + # while self.audio_play_state: + # pass + #print("开始播放!!!!!!!!!!!!!!!!!!!!!") + #print("开始播放!!!!!!!!!!!!!!!!!!!!!") + #print("开始播放!!!!!!!!!!!!!!!!!!!!!") + #print("开始播放!!!!!!!!!!!!!!!!!!!!!") + + tmp=self.aud.playStream(3, data[0])#播放音频流 + print("出:{},{}!!!".format(len(data[0]),self.AI_client_tts_data_len)) + if tmp != 0: + print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data[0]))) + print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data[0]))) + print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data[0]))) + print("2playStream:error tmp:{} data len:{}!!!!!!!!!!!!".format(tmp,len(data[0]))) + self.AI_client_tts_data_len -=len(data[0]) + except Exception as e: + print("AI_audio_queue_thread:ERROR:") + usys.print_exception(e) + except Exception as e: print("AI_audio_queue_thread:ERROR:") usys.print_exception(e) - def Close(self): try: #销毁线程 @@ -646,12 +1479,18 @@ class AIScreen(Screen):#AI_GUI except Exception as e: usys.print_exception(e) self.AI_send_data_queue.clear() + print("close:AI_send_data_queue:size:{}".format(self.AI_send_data_queue.size())) self.AI_audio_queue.clear() + self.AI_client_tts_str_sen = '' self.record_timer.stop() - self. AI_client_tts_timer.stop() + self.AI_client_tts_timer.stop() + self.aud.stopPlayStream() self.aud.stopAll() self.AI_client_chat_play_str = "" + self.AI_client_tts_tra_flag = 0 self.record.stop()#关闭录音 + self.refresh_count = 0 + self.refresh_texttimer.stop() try: self.websocket_deconnect_asr() self.websocket_deconnect_tts() @@ -671,387 +1510,3 @@ class AIScreen(Screen):#AI_GUI EventMesh.publish("load_screen", {"screen": "main_menu"}) pass -al_no_sim_popup_screen = None -al_no_sim_popup_screen_title1 = None -al_no_sim_popup_screen_title2 = None -al_no_sim_popup_screen_title3 = None -al_no_sim_popup_screen_title4 =None -al_no_sim_popup_screen_icon = None -al_no_sim_popup_screen_icon1 = None -#启动失败 请先开启移动数据 -class AINoSimScreen(Screen):# - NAME = "ai_no_sim_popup" - def __init__(self): - super().__init__() - self.meta = None - self.meta_type = "popup" - self.checkMode = "0" - - def initialization(self): - self.checkMode = "0" - global al_no_sim_popup_screen,al_no_sim_popup_screen_title4,al_no_sim_popup_screen_icon1,al_no_sim_popup_screen_title1,al_no_sim_popup_screen_icon,al_no_sim_popup_screen_title2,al_no_sim_popup_screen_title3 - if al_no_sim_popup_screen == None : - al_no_sim_popup_screen = lv.obj() - print("no_sim_popup_screen") - al_no_sim_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_no_sim_popup_screen_title1 = lv.label(al_no_sim_popup_screen) - al_no_sim_popup_screen_title1.set_pos(0, 20) - al_no_sim_popup_screen_title1.set_size(LCD_SIZE_W, 40) - al_no_sim_popup_screen_title1.set_text("AI智能助手") - al_no_sim_popup_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_no_sim_popup_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_no_sim_popup_screen_icon = lv.img(al_no_sim_popup_screen) - al_no_sim_popup_screen_icon.set_size(42,42) - al_no_sim_popup_screen_icon.set_pos((240-42)//2,60) - al_no_sim_popup_screen_icon.set_src("E:/static/ai_warning.png") - al_no_sim_popup_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - - al_no_sim_popup_screen_title2 = lv.label(al_no_sim_popup_screen) - al_no_sim_popup_screen_title2.set_pos(0, 125) - al_no_sim_popup_screen_title2.set_size(LCD_SIZE_W, 40) - al_no_sim_popup_screen_title2.set_text("启动失败") - al_no_sim_popup_screen_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_no_sim_popup_screen_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_no_sim_popup_screen_title3 = lv.label(al_no_sim_popup_screen) - al_no_sim_popup_screen_title3.set_pos(0, 165) - al_no_sim_popup_screen_title3.set_size(LCD_SIZE_W, 40) - al_no_sim_popup_screen_title3.set_text("请先开启移动数据") - al_no_sim_popup_screen_title3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_no_sim_popup_screen_title3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - - al_no_sim_popup_screen_icon1 = lv.img(al_no_sim_popup_screen) - al_no_sim_popup_screen_icon1.set_size(230,58) - al_no_sim_popup_screen_icon1.set_pos((240-230)//2,210) - al_no_sim_popup_screen_icon1.set_src("E:/static/ai_confirm_bt.png") - al_no_sim_popup_screen_icon1.add_flag(lv.obj.FLAG.CLICKABLE) - al_no_sim_popup_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_no_sim_popup_screen_title4 = lv.label(al_no_sim_popup_screen_icon1) - al_no_sim_popup_screen_title4.set_pos(0, 18) - al_no_sim_popup_screen_title4.set_size(230, 58) - al_no_sim_popup_screen_title4.set_text("确定") - al_no_sim_popup_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_no_sim_popup_screen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - self.meta = al_no_sim_popup_screen - - if al_no_sim_popup_screen_icon1 != None: - al_no_sim_popup_screen_icon1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e)), lv.EVENT.SHORT_CLICKED, None) - self.checkMode = str(self.meta_info) - if self.checkMode =="1": #连接超时 请重新对话 - al_no_sim_popup_screen_title2.set_text("连接超时") - al_no_sim_popup_screen_title3.set_text("请重新对话") - else: - al_no_sim_popup_screen_title2.set_text("启动失败") - al_no_sim_popup_screen_title3.set_text("请先开启移动数据") - pass - def img_cb(self,e): - if self.checkMode == "0": - EventMesh.publish("load_screen", {"screen": "ai_talk_popup"}) - else: - EventMesh.publish("load_screen", {"screen": "ai_listen_popup"}) - - def done_return(self): - EventMesh.publish("return_prev_screen") - - - def btn1_release(self): - EventMesh.publish("return_prev_screen") - - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") - - def done_right_to_left(self): - EventMesh.publish("return_prev_screen") - - def done_bottom_to_top(self): - EventMesh.publish("return_prev_screen") - - def done_top_to_bottom(self): - EventMesh.publish("return_prev_screen") - - def btn8_press(self): - EventMesh.publish("watch_top_show") - EventMesh.publish("return_prev_screen") -al_talk_screen = None -al_talk_screen_title1 = None -al_talk_screen_title2 = None -al_talk_screen_title3 = None -al_talk_screen_title4 =None -al_talk_screen_icon = None -al_talk_screen_icon1 = None -#AI对话界面 -class AITalkScreen(Screen):# - NAME = "ai_talk_popup" - def __init__(self): - super().__init__() - self.meta = None - - def initialization(self): - global al_talk_screen,al_talk_screen_title4,al_talk_screen_icon1,al_talk_screen_title1,al_talk_screen_icon,al_talk_screen_title2,al_talk_screen_title3 - if al_talk_screen == None : - al_talk_screen = lv.obj() - print("no_sim_popup_screen") - al_talk_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_talk_screen_title1 = lv.label(al_talk_screen) - al_talk_screen_title1.set_pos(0, 20) - al_talk_screen_title1.set_size(LCD_SIZE_W, 40) - al_talk_screen_title1.set_text("AI智能助手") - al_talk_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_talk_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - - al_talk_screen_icon1 = lv.img(al_talk_screen) - al_talk_screen_icon1.set_size(32,32) - al_talk_screen_icon1.set_pos((240-32)//2,110) - al_talk_screen_icon1.set_src("E:/static/ai_listen.png") - al_talk_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_talk_screen_icon = lv.img(al_talk_screen) - al_talk_screen_icon.set_size(230,58) - al_talk_screen_icon.set_pos((240-230)//2,210) - al_talk_screen_icon.set_src("E:/static/ai_talk_bt.png") - al_talk_screen_icon.add_flag(lv.obj.FLAG.CLICKABLE) - al_talk_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_talk_screen_title4 = lv.label(al_talk_screen_icon) - al_talk_screen_title4.set_pos(0, 18) - al_talk_screen_title4.set_size(230, 58) - al_talk_screen_title4.set_text("开始对话") - al_talk_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_talk_screen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - self.meta = al_talk_screen - - if al_talk_screen_icon != None: - al_talk_screen_icon.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e)), lv.EVENT.SHORT_CLICKED, None) - def img_cb(self,e): - # EventMesh.publish("load_screen", {"screen": "AI_success"}) - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#网络不正常 - EventMesh.publish("load_screen", {"screen": "ai_listen_popup"}) - else: - EventMesh.publish("load_screen", {"screen": "ai_no_sim_popup","meta":str("0")}) - - def done_return(self): - EventMesh.publish("return_prev_screen") - - - def btn1_release(self): - EventMesh.publish("return_prev_screen") - - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") - - def done_right_to_left(self): - EventMesh.publish("return_prev_screen") - - def done_bottom_to_top(self): - EventMesh.publish("return_prev_screen") - - def done_top_to_bottom(self): - EventMesh.publish("return_prev_screen") - - def btn8_press(self): - EventMesh.publish("watch_top_show") - EventMesh.publish("return_prev_screen") - - -al_listen_screen = None -al_listen_screen_title1 = None -al_listen_screen_title2 = None -al_listen_screen_title3 = None -al_listen_screen_title4 =None -al_listen_screen_icon = None -al_listen_screen_icon1 = None -#AI聆听界面 -class AIListenScreen(Screen):# - NAME = "ai_listen_popup" - def __init__(self): - super().__init__() - self.meta = None - self.meta_type = "popup" - self.listeTimerCount = 0 - - self.listeTimer = osTimer() - - def initialization(self): - global al_listen_screen,al_listen_screen_title4,al_listen_screen_icon1,al_listen_screen_title1,al_listen_screen_icon,al_listen_screen_title2,al_listen_screen_title3 - if al_listen_screen == None : - al_listen_screen = lv.obj() - print("al_listen_screen") - al_listen_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_listen_screen_title1 = lv.label(al_listen_screen) - al_listen_screen_title1.set_pos(0, 20) - al_listen_screen_title1.set_size(LCD_SIZE_W, 40) - al_listen_screen_title1.set_text("正在聆听...") - al_listen_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_listen_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - - al_listen_screen_icon1 = lv.img(al_listen_screen) - al_listen_screen_icon1.set_size(32,32) - al_listen_screen_icon1.set_pos((240-32)//2,110) - al_listen_screen_icon1.set_src("E:/static/ai_listen.png") - al_listen_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_listen_screen_icon = lv.img(al_listen_screen) - al_listen_screen_icon.set_size(230,58) - al_listen_screen_icon.set_pos((240-230)//2,210) - al_listen_screen_icon.set_src("E:/static/ai_confirm_bt.png") - al_listen_screen_icon.add_flag(lv.obj.FLAG.CLICKABLE) - al_listen_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_listen_screen_title4 = lv.label(al_listen_screen_icon) - al_listen_screen_title4.set_pos(0, 18) - al_listen_screen_title4.set_size(230, 58) - al_listen_screen_title4.set_text("说话完成") - al_listen_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_listen_screen_title4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - self.meta = al_listen_screen - - if al_listen_screen_icon != None: - al_listen_screen_icon.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e)), lv.EVENT.SHORT_CLICKED, None) - self.listeTimerCount = 0 - self.listeTimer.start(500,1,self.text_show_cb) - def text_show_cb(self,*argc): - EventMesh.publish("system_sleep_rest")#防止黑屏 - if al_listen_screen_title1 != None: - self.listeTimerCount+=1 - if self.listeTimerCount > 3: - self.listeTimerCount = 0 - if self.listeTimerCount == 1: - al_listen_screen_title1.set_text("正在聆听.") - elif self.listeTimerCount == 2: - al_listen_screen_title1.set_text("正在聆听..") - else: - al_listen_screen_title1.set_text("正在聆听...") - - def Close(self): - self.listeTimerCount = 0 - self.listeTimer.stop() - - def img_cb(self,e): - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#网络不正常 - EventMesh.publish("load_screen", {"screen": "ai_think_popup"}) - else: - EventMesh.publish("load_screen", {"screen": "ai_no_sim_popup","meta":str("1")}) - - - def done_return(self): - pass - # EventMesh.publish("return_prev_screen") - - - def btn1_release(self): - pass - # EventMesh.publish("return_prev_screen") - - def btn8_press(self): - - pass - # EventMesh.publish("return_prev_screen") - - -al_think_screen = None -al_think_screen_title1 = None -al_think_screen_title2 = None -al_think_screen_title3 = None -al_think_screen_title4 =None -al_think_screen_icon = None -al_think_screen_icon1 = None -#AI思考界面 -class AIThinkScreen(Screen):# - NAME = "ai_think_popup" - def __init__(self): - super().__init__() - self.meta = None - self.meta_type = "popup" - self.listeTimerCount = 0 - self.listeTimer = osTimer() - - def initialization(self): - global al_think_screen,al_think_screen_title4,al_think_screen_icon,al_think_screen_title1,al_think_screen_icon1,al_think_screen_title2,al_think_screen_title3 - if al_think_screen == None : - al_think_screen = lv.obj() - print("al_think_screen") - al_think_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_think_screen_title1 = lv.label(al_think_screen) - al_think_screen_title1.set_pos(0, 20) - al_think_screen_title1.set_size(LCD_SIZE_W, 40) - al_think_screen_title1.set_text("正在思考...") - al_think_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_think_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - - al_think_screen_icon = lv.img(al_think_screen) - al_think_screen_icon.set_size(63,63) - al_think_screen_icon.set_pos((240-63)//2,90) - al_think_screen_icon.set_src("E:/static/ai_listen_gif.png") - al_think_screen_icon.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_think_screen_icon1 = lv.img(al_think_screen) - al_think_screen_icon1.set_size(230,58) - al_think_screen_icon1.set_pos((240-230)//2,210) - al_think_screen_icon1.set_src("E:/static/ai_confirm_bt.png") - al_think_screen_icon1.add_flag(lv.obj.FLAG.CLICKABLE) - al_think_screen_icon1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - al_think_screen_title4 = lv.label(al_think_screen_icon1) - al_think_screen_title4.set_pos(0, 18) - al_think_screen_title4.set_size(230, 58) - al_think_screen_title4.set_text("取消") - al_think_screen_title4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - al_think_screen_title4.add_style(style_font_youyuan_ai_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - self.meta = al_think_screen - - if al_think_screen_icon1 != None: - al_think_screen_icon1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e)), lv.EVENT.SHORT_CLICKED, None) - self.listeTimerCount = 0 - self.listeTimer.start(500,1,self.text_show_cb) - def text_show_cb(self,*argc): - EventMesh.publish("system_sleep_rest")#防止黑屏 - if al_think_screen_title1 != None: - self.listeTimerCount+=1 - if self.listeTimerCount > 3: - self.listeTimerCount = 0 - if self.listeTimerCount == 1: - al_think_screen_title1.set_text("正在思考.") - elif self.listeTimerCount == 2: - al_think_screen_title1.set_text("正在思考..") - else: - al_think_screen_title1.set_text("正在思考...") - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#网络不正常 - EventMesh.publish("load_screen", {"screen": "ai_no_sim_popup","meta":str("1")}) - else: - EventMesh.publish("load_screen", {"screen": "AI_success"}) - pass - def Close(self): - self.listeTimerCount = 0 - self.listeTimer.stop() - - def img_cb(self,e): - EventMesh.publish("load_screen", {"screen": "ai_talk_popup"}) - - def done_return(self): - pass - # EventMesh.publish("return_prev_screen") - - - def btn1_release(self): - pass - # EventMesh.publish("return_prev_screen") - - def btn8_press(self): - pass - # EventMesh.publish("return_prev_screen") - diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/appAlipay.py b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/appAlipay.py index 11e5d02b..11695ba5 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/appAlipay.py +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/appAlipay.py @@ -387,6 +387,7 @@ class AlipayOpenScreen(Screen): def __init__(self): super().__init__() self.meta = alipay_open_screen + alipay_open_screen.add_event_cb(lambda e:EventMesh.callback_wrapper(self.alipay_return_cb(e)), lv.EVENT.GESTURE, None) self.timer_AlipayOpen = osTimer() self.timer_AlipayOpen_count = 0 self.flag = 0 @@ -461,6 +462,15 @@ class AlipayOpenScreen(Screen): def done_return(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) + def alipay_return_cb(self,e): + code = e.get_code() + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def Close(self): self.flag = 0 self.timer_AlipayOpen.stop() @@ -644,6 +654,7 @@ class Alipay_invite(Screen): def __init__(self): super().__init__() self.meta = alipay_invite_screen + alipay_invite_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling_cb(e)), lv.EVENT.GESTURE, None) self.alipay_invite_time = osTimer() @@ -659,6 +670,15 @@ class Alipay_invite(Screen): print("alipay_invite:",str(self.meta_info)) alipay_invite_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data)) + def calling_cb(self,e): + code = e.get_code() + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: #手势向左还是向右 还是向下向上 + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def alipay_invite(self, *args): print("alipay_invite:") EventMesh.publish("system_sleep_rest")#防止黑屏 @@ -1027,7 +1047,7 @@ class Alipay_paycode(Screen): EventMesh.publish("publish_message_event_ui",{"func":self.update_show,"data":0}) # def done_left_to_right(self): - + def done_return(self): EventMesh.publish("load_screen", {"screen": "alipay_1_1"}) @@ -1098,6 +1118,8 @@ class Alipay_pay_success(Screen): def Close(self): EventMesh.publish("set_Alipay_Ui_isOpen",0) pass + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "alipay_paycode"}) def done_return(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/main_init.py b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/main_init.py index a7083721..871567fe 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/main_init.py +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/main_init.py @@ -220,20 +220,20 @@ def main_init(): #AI try: - from usr.ai import AIScreen,AINoSimScreen,AITalkScreen,AIListenScreen,AIThinkScreen + # from usr.ai import AIScreen - # import ai + import ai # ui.add_screen(ai.AIScreen()) # ui.add_screen(ai.AINoSimScreen()) # ui.add_screen(ai.AITalkScreen()) # ui.add_screen(ai.AIListenScreen()) # ui.add_screen(ai.AIThinkScreen()) ############################################## - ui.add_screen(AIScreen()) - ui.add_screen(AINoSimScreen()) - ui.add_screen(AITalkScreen()) - ui.add_screen(AIListenScreen()) - ui.add_screen(AIThinkScreen()) + ui.add_screen(ai.AIScreen()) + # ui.add_screen(AINoSimScreen()) + # ui.add_screen(AITalkScreen()) + # ui.add_screen(AIListenScreen()) + # ui.add_screen(AIThinkScreen()) except Exception as e: usys.print_exception(e) diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui.py index 8e89a233..cea57e83 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui.py @@ -336,6 +336,7 @@ class PhoneScreen(Screen): phone_screen = lv.obj() print("phone_screen") phone_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + phone_screen.add_event_cb(lambda e:EventMesh.callback_wrapper(self.button_cb(e,0)), lv.EVENT.GESTURE, None) phone_line = lv.line(phone_screen) phone_line.set_points(phone_line_points,2) @@ -487,90 +488,73 @@ class PhoneScreen(Screen): self.meta = phone_screen - phone_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.one(e)), + phone_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,1)), lv.EVENT.SHORT_CLICKED, None) # phone_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.one(e)), # lv.EVENT.PRESSING, None) - phone_two.add_event_cb(lambda e: EventMesh.callback_wrapper(self.two(e)), + phone_two.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,2)), lv.EVENT.SHORT_CLICKED, None) # phone_two.add_event_cb(lambda e: EventMesh.callback_wrapper(self.two(e)), # lv.EVENT.PRESSING, None) - phone_three.add_event_cb(lambda e: EventMesh.callback_wrapper(self.three(e)), + phone_three.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,3)), lv.EVENT.SHORT_CLICKED, None) # phone_three.add_event_cb(lambda e: EventMesh.callback_wrapper(self.three(e)), # lv.EVENT.PRESSING, None) - phone_four.add_event_cb(lambda e: EventMesh.callback_wrapper(self.four(e)), + phone_four.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,4)), lv.EVENT.SHORT_CLICKED, None) # phone_four.add_event_cb(lambda e: EventMesh.callback_wrapper(self.four(e)), # lv.EVENT.PRESSING, None) - phone_five.add_event_cb(lambda e: EventMesh.callback_wrapper(self.five(e)), + phone_five.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,5)), lv.EVENT.SHORT_CLICKED, None) # phone_five.add_event_cb(lambda e: EventMesh.callback_wrapper(self.five(e)), # lv.EVENT.PRESSING, None) - phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)), + phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,6)), lv.EVENT.SHORT_CLICKED, None) # phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)), # lv.EVENT.PRESSING, None) - phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven(e)), + phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,7)), lv.EVENT.SHORT_CLICKED, None) - phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven_longpress(e)), + phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,1)), lv.EVENT.LONG_PRESSED, None) - phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven_release(e)), + phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,1)), lv.EVENT.RELEASED, None) # phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven(e)), # lv.EVENT.PRESSING, None) - phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)), + phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,8)), lv.EVENT.SHORT_CLICKED, None) # phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)), # lv.EVENT.PRESSING, None) - phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine(e)), + phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,9)), lv.EVENT.SHORT_CLICKED, None) - phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine_longpress(e)), + phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,2)), lv.EVENT.LONG_PRESSED, None) - phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine_release(e)), + phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,2)), lv.EVENT.RELEASED, None) # phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine(e)), # lv.EVENT.PRESSING, None) - phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), + phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,10)), lv.EVENT.SHORT_CLICKED, None) - phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero_longpress(e)), + phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,3)), lv.EVENT.LONG_PRESSED, None) - phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero_release(e)), + phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,3)), lv.EVENT.RELEASED, None) # phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), # lv.EVENT.PRESSING, None) - phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)), + phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,11)), lv.EVENT.SHORT_CLICKED, None) - phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)), - lv.EVENT.PRESSING, None) - # # phone_contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.contact(e)), - # lv.EVENT.CLICKED, None) - phone_delete_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delete(e)), - lv.EVENT.SHORT_CLICKED, None) - - - # # phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - # lv.EVENT.CLICKED, None)#短按显示* - - # phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), - # lv.EVENT.LONG_PRESSED, None)#长按显示+ - - # phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.endpressed_start(e)), - # lv.EVENT.RELEASED, None)#释放按键 - - # phone_hash.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hash(e)), - # lv.EVENT.CLICKED, None) + phone_delete_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e,12)), + lv.EVENT.SHORT_CLICKED, None) phone_label_maxnum.add_flag(lv.obj.FLAG.HIDDEN) self.phone_num='' @@ -586,6 +570,201 @@ class PhoneScreen(Screen): self.timer_cb = 1 self.timer.start(1000,1,self.refresh_line) self.zero_button = 0 + def button_cb(self,e,msg): + code = e.get_code() + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: #手势向左还是向右 还是向下向上 + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + elif code == lv.EVENT.SHORT_CLICKED: + if msg == 1: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA: + self.show_maxnum_warin() + return + self.phone_list.append("1") + self.phone_num = ''.join(self.phone_list) + self.show_num() + pass + elif msg == 2: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA: + self.show_maxnum_warin() + return + self.phone_list.append("2") + self.phone_num = ''.join(self.phone_list) + self.show_num() + pass + elif msg == 3: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA: + self.show_maxnum_warin() + return + self.phone_list.append("3") + self.phone_num = ''.join(self.phone_list) + self.show_num() + pass + elif msg == 4: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA: + self.show_maxnum_warin() + return + self.phone_list.append("4") + self.phone_num = ''.join(self.phone_list) + self.show_num() + pass + elif msg == 5: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA: + self.show_maxnum_warin() + return + self.phone_list.append("5") + self.phone_num = ''.join(self.phone_list) + self.show_num() + elif msg == 6: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA: + self.show_maxnum_warin() + return + self.phone_list.append("6") + self.phone_num = ''.join(self.phone_list) + self.show_num() + elif msg == 7: + self.zero_button = 0 + elif msg == 8: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA: + self.show_maxnum_warin() + return + self.phone_list.append("8") + self.phone_num = ''.join(self.phone_list) + self.show_num() + elif msg == 9: + self.zero_button = 0 + elif msg == 10: + self.zero_button = 0 + elif msg == 11: + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1: + self.name = None + self.phonebook = {} + self.number_tmp = {} + if len(self.phone_list) != 0: + data = EventMesh.publish("get_phonebook_list") + if data != None: + check = data[0] + self.phonebook = data[1] + # print("check :{}".format(check)) + if check == 1:#检查通讯录 + phonebook_keys = sorted(self.phonebook.keys()) + b = str(self.phone_num) in self.phonebook.values()#查找key中是否包含content电话号码 True 包含在里面 False不包含在里面 + j = 0 + if b == True: + for i in range(len(self.phonebook)): #字典 key value + #'001:张三':15521469561 + name = self.phonebook[phonebook_keys[j]] + name_value = phonebook_keys[j] + number_tmp = str(self.phone_num) + # print("name :{} number_tmp:{}".format(name,number_tmp)) + if name.find(number_tmp) != -1:#查找电话号码是否在通讯录里面 + number_f= name_value + name_s = number_f.split(':') + name_s = name_s[1] + self.name = name_s + break + j+=1 + else: + self.name = self.phone_num + else: + self.name = self.phone_num + + EventMesh.publish("save_phonenum",self.phone_num) + EventMesh.publish("save_phonename",self.name)# + EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"}) + else: + EventMesh.publish("load_screen", {"screen": "no_valied_num_screen"}) + else:#未插卡 + EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"}) + elif msg == 12: + if len(self.phone_list) != 0: + self.phone_list.pop() + self.phone_num = ''.join(self.phone_list) + self.show_num() + + elif code == lv.EVENT.LONG_PRESSED: + print("button_cb LONG_PRESSED:{}\r\n".format(msg)) + if msg == 1: + self.zero_button = 1 + if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 + self.zero_button = 0 + self.show_maxnum_warin() + return + if self.zero_button == 1: + self.phone_list.append("*") + else: + self.phone_list.append("7") + self.zero_button = 0 + self.phone_num = ''.join(self.phone_list) + self.show_num() + elif msg == 2: + self.zero_button = 1 + if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 + self.zero_button = 0 + self.show_maxnum_warin() + return + if self.zero_button == 1: + self.phone_list.append("#") + else: + self.phone_list.append("9") + self.zero_button = 0 + self.phone_num = ''.join(self.phone_list) + self.show_num() + elif msg == 3: + self.zero_button = 1 + if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 + self.zero_button = 0 + self.show_maxnum_warin() + return + if self.zero_button == 1: + self.phone_list.append("+") + else: + self.phone_list.append("0") + self.zero_button = 0 + self.phone_num = ''.join(self.phone_list) + self.show_num() + + elif code == lv.EVENT.RELEASED: + print("button_cb RELEASED:{} self.zero_button:{} self.phone_list:{}\r\n".format(msg,self.zero_button,self.phone_list)) + if msg == 1: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 + self.zero_button = 0 + self.show_maxnum_warin() + return + if self.zero_button == 1: + self.phone_list.append("*") + else: + self.phone_list.append("7") + self.zero_button = 0 + self.phone_num = ''.join(self.phone_list) + self.show_num() + elif msg == 2: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 + self.zero_button = 0 + self.show_maxnum_warin() + return + if self.zero_button == 1: + self.phone_list.append("#") + else: + self.phone_list.append("9") + self.zero_button = 0 + self.phone_num = ''.join(self.phone_list) + self.show_num() + elif msg == 3: + if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 + self.zero_button = 0 + self.show_maxnum_warin() + return + if self.zero_button == 1: + self.phone_list.append("+") + else: + self.phone_list.append("0") + self.zero_button = 0 + self.phone_num = ''.join(self.phone_list) + self.show_num() def refresh_line(self,e): if self.count > 2 : @@ -840,8 +1019,6 @@ class PhoneScreen(Screen): def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) def btn8_press(self): EventMesh.publish("watch_top_show") diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py index ef4a72bc..c9cb89de 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py @@ -7,6 +7,7 @@ import constants from ui import Screen,style_screen,style_font_youyuan_28,style_font_youyuan_20_white import ql_fs import ujson +import sim from machine import RTC from lcd import LCD_SIZE_W,LCD_SIZE_H @@ -56,7 +57,7 @@ watchface1_mpsignal_img.set_pos(int(20),int(15)) watchface1_mpsignal_img.set_size(30,22) watchface1_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) watchface1_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) -watchface1_mpsignal_img.set_src("E:/static/mpsignal5.png") +watchface1_mpsignal_img.set_src("E:/static/mpsignal0.png") watchface1_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) watchface1_res_stat_battery_img = lv.img(Watchface1) @@ -262,14 +263,21 @@ class WatchFace1(): watchface1_week_span.set_text(msg[3]) #星期 def __signal(self, event, msg): - #print("__signal_cb:",str(msg)) + print("111111111__signal_cb:",str(msg)) # 信号强度值范围0 ~ 31,值越大表示信号强度越好 #print("__signal_cb:{}".format(msg//8)) - if msg: - if msg >= 0 and msg<=31 : - watchface1_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) - else : - watchface1_mpsignal_img.set_src("E:/static/mpsignal5.png") + sim_state = sim.getStatus() + if sim_state != 1:#没有卡 + watchface1_mpsignal_img.set_src("E:/static/mpsignal5.png") + else: + if msg == -1: + watchface1_mpsignal_img.set_src("E:/static/mpsignal0.png") + else: + if msg: + if msg >= 0 and msg<=31 : + watchface1_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) + else : + watchface1_mpsignal_img.set_src("E:/static/mpsignal0.png") def __battery(self, event, msg): #print("__battery_cb:",str(msg)) @@ -351,7 +359,7 @@ watchface2_mpsignal_img.set_pos(int(20),int(15)) watchface2_mpsignal_img.set_size(30,22) watchface2_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) watchface2_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) -watchface2_mpsignal_img.set_src("E:/static/mpsignal5.png") +watchface2_mpsignal_img.set_src("E:/static/mpsignal0.png") watchface2_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) watchface2_res_stat_battery_img = lv.img(Watchface2) @@ -515,14 +523,21 @@ class WatchFace2(): # watchface2_week.set_src("E:/static/watch_plate/style_2/week/%d_week.png"%(msg[5])) #星期 def __signal(self, event, msg): - #print("__signal_cb:",str(msg)) + print("Watchface2 __signal_cb:",str(msg)) # 信号强度值范围0 ~ 31,值越大表示信号强度越好 #print("__signal_cb:{}".format(msg//8)) - if msg: - if msg >= 0 and msg<=31 : - watchface2_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) - else : - watchface2_mpsignal_img.set_src("E:/static/mpsignal5.png") + sim_state = sim.getStatus() + if sim_state != 1:#没有卡 + watchface2_mpsignal_img.set_src("E:/static/mpsignal5.png") + else: + if msg == -1: + watchface2_mpsignal_img.set_src("E:/static/mpsignal0.png") + else: + if msg: + if msg >= 0 and msg<=31 : + watchface2_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) + else : + watchface2_mpsignal_img.set_src("E:/static/mpsignal0.png") def __battery(self, event, msg): #print("__battery_cb:",str(msg)) @@ -609,7 +624,7 @@ watchface3_mpsignal_img.set_pos(int(20),int(15)) watchface3_mpsignal_img.set_size(30,22) watchface3_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) watchface3_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) -watchface3_mpsignal_img.set_src("E:/static/mpsignal5.png") +watchface3_mpsignal_img.set_src("E:/static/mpsignal0.png") watchface3_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) watchface3_res_stat_battery_img = lv.img(Watchface3) @@ -724,14 +739,24 @@ class WatchFace3(): self.__battery(None, battery) def __signal(self, event, msg): - #print("__signal_cb:",str(msg)) + # 信号强度值范围0 ~ 31,值越大表示信号强度越好 #print("__signal_cb:{}".format(msg//8)) - if msg: - if msg >= 0 and msg<=31 : - watchface3_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) - else : - watchface3_mpsignal_img.set_src("E:/static/mpsignal5.png") + sim_state = sim.getStatus() + print("__signal_cb:",str(msg),sim_state) + if sim_state != 1:#没有卡 + watchface3_mpsignal_img.set_src("E:/static/mpsignal5.png") + else: + if msg == -1: + watchface3_mpsignal_img.set_src("E:/static/mpsignal0.png") + else: + if msg: + if msg >= 0 and msg<=31 : + print("111__signal_cb:",str(msg)) + watchface3_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) + else : + print("222__signal_cb:",str(msg)) + watchface3_mpsignal_img.set_src("E:/static/mpsignal0.png") def __battery(self, event, msg): #print("__battery_cb:",str(msg)) diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_main_menu.py b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_main_menu.py index fd5fd63c..38a97f70 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_main_menu.py +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_main_menu.py @@ -482,83 +482,81 @@ MainMenu1_img_calllog_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu1_img_calllog_text.set_text(" ") MainMenu1_img_calllog_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu1_num+=1 -MainMenu1x+=1 - -#通讯录 -MainMenu1_two = MainMenu1_til.add_tile(MainMenu1x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -label_text = lv.label(MainMenu1_two) -label_text.set_pos(0, LCD_SIZE_H) -label_text.set_size(0, 0) -label_text.set_text("{}".format(MainMenu1_num)) - - -MainMenu1_img_hr = lv.img(MainMenu1_two) -MainMenu1_img_hr.set_size(240,282) -MainMenu1_img_hr.set_pos(0,0) -MainMenu1_img_hr.set_src("U:/static/theme1/THEME1_HEART.png") -# MainMenu1_img_hr.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_hr.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu1_img_hr_text = lv.label(MainMenu1_two) -MainMenu1_img_hr_text.set_pos(int(MAIN1_ICON_X),int(MAIN1_ICON_Y+5)) -MainMenu1_img_hr_text.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_hr_text.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_hr_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_hr_text.set_text(" ") -MainMenu1_img_hr_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) - -# MainMenu1_img_spo2 = lv.img(MainMenu1_two) -# MainMenu1_img_spo2.set_size(THEME1_ICON_X,THEME1_ICON_Y) -# MainMenu1_img_spo2.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) -# MainMenu1_img_spo2.set_src("U:/static/theme1/THEME1_SPO2.png") -# MainMenu1_img_spo2.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu1_img_spo2.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu1_img_spo2_text = lv.label(MainMenu1_two) -MainMenu1_img_spo2_text.set_pos(int(MAIN1_ICON_X*2+85),int(MAIN1_ICON_Y+5)) -MainMenu1_img_spo2_text.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_spo2_text.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_spo2_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_spo2_text.set_text(" ") -MainMenu1_img_spo2_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) - - - -# MainMenu1_img_blood = lv.img(MainMenu1_two) -# MainMenu1_img_blood.set_size(THEME1_ICON_X,THEME1_ICON_Y) -# MainMenu1_img_blood.set_pos(MAIN1_ICON_X,140+5) -# MainMenu1_img_blood.set_src("U:/static/theme1/THEME1_BLOOD_PRESSURE.png") -# MainMenu1_img_blood.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu1_img_blood.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu1_img_blood_text = lv.label(MainMenu1_two) -MainMenu1_img_blood_text.set_pos(int(MAIN1_ICON_X),int(140+5)) -MainMenu1_img_blood_text.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_blood_text.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_blood_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_blood_text.set_text(" ") -MainMenu1_img_blood_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) - -# MainMenu1_img_temp = lv.img(MainMenu1_two) -# MainMenu1_img_temp.set_size(THEME1_ICON_X,THEME1_ICON_Y) -# MainMenu1_img_temp.set_pos(MAIN1_ICON_X*2+85,140+5) -# MainMenu1_img_temp.set_src("U:/static/theme1/THEME1_TEMP.png") -# MainMenu1_img_temp.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu1_img_temp.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu1_img_temp_text = lv.label(MainMenu1_two) -MainMenu1_img_temp_text.set_pos(int(MAIN1_ICON_X*2+85),int(140+5)) -MainMenu1_img_temp_text.set_size(THEME1_ICON_X,THEME1_ICON_X) -MainMenu1_img_temp_text.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_temp_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_temp_text.set_text(" ") -MainMenu1_img_temp_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) +# MainMenu1_num+=1 +# MainMenu1x+=1 +# #健康测试 +# MainMenu1_two = MainMenu1_til.add_tile(MainMenu1x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# label_text = lv.label(MainMenu1_two) +# label_text.set_pos(0, LCD_SIZE_H) +# label_text.set_size(0, 0) +# label_text.set_text("{}".format(MainMenu1_num)) + + +# MainMenu1_img_hr = lv.img(MainMenu1_two) +# MainMenu1_img_hr.set_size(240,282) +# MainMenu1_img_hr.set_pos(0,0) +# MainMenu1_img_hr.set_src("U:/static/theme1/THEME1_HEART.png") +# # MainMenu1_img_hr.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_hr.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu1_img_hr_text = lv.label(MainMenu1_two) +# MainMenu1_img_hr_text.set_pos(int(MAIN1_ICON_X),int(MAIN1_ICON_Y+5)) +# MainMenu1_img_hr_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +# MainMenu1_img_hr_text.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_hr_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu1_img_hr_text.set_text(" ") +# MainMenu1_img_hr_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) + +# # MainMenu1_img_spo2 = lv.img(MainMenu1_two) +# # MainMenu1_img_spo2.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# # MainMenu1_img_spo2.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) +# # MainMenu1_img_spo2.set_src("U:/static/theme1/THEME1_SPO2.png") +# # MainMenu1_img_spo2.add_flag(lv.obj.FLAG.CLICKABLE) +# # MainMenu1_img_spo2.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu1_img_spo2_text = lv.label(MainMenu1_two) +# MainMenu1_img_spo2_text.set_pos(int(MAIN1_ICON_X*2+85),int(MAIN1_ICON_Y+5)) +# MainMenu1_img_spo2_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +# MainMenu1_img_spo2_text.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_spo2_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu1_img_spo2_text.set_text(" ") +# MainMenu1_img_spo2_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) + + + +# # MainMenu1_img_blood = lv.img(MainMenu1_two) +# # MainMenu1_img_blood.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# # MainMenu1_img_blood.set_pos(MAIN1_ICON_X,140+5) +# # MainMenu1_img_blood.set_src("U:/static/theme1/THEME1_BLOOD_PRESSURE.png") +# # MainMenu1_img_blood.add_flag(lv.obj.FLAG.CLICKABLE) +# # MainMenu1_img_blood.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu1_img_blood_text = lv.label(MainMenu1_two) +# MainMenu1_img_blood_text.set_pos(int(MAIN1_ICON_X),int(140+5)) +# MainMenu1_img_blood_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +# MainMenu1_img_blood_text.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_blood_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu1_img_blood_text.set_text(" ") +# MainMenu1_img_blood_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) + +# # MainMenu1_img_temp = lv.img(MainMenu1_two) +# # MainMenu1_img_temp.set_size(THEME1_ICON_X,THEME1_ICON_Y) +# # MainMenu1_img_temp.set_pos(MAIN1_ICON_X*2+85,140+5) +# # MainMenu1_img_temp.set_src("U:/static/theme1/THEME1_TEMP.png") +# # MainMenu1_img_temp.add_flag(lv.obj.FLAG.CLICKABLE) +# # MainMenu1_img_temp.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu1_img_temp_text = lv.label(MainMenu1_two) +# MainMenu1_img_temp_text.set_pos(int(MAIN1_ICON_X*2+85),int(140+5)) +# MainMenu1_img_temp_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +# MainMenu1_img_temp_text.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu1_img_temp_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu1_img_temp_text.set_text(" ") +# MainMenu1_img_temp_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) MainMenu1_num+=1 MainMenu1x+=1 - #短信 MainMenu1_three = MainMenu1_til.add_tile(MainMenu1x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) label_text = lv.label(MainMenu1_three) @@ -573,8 +571,17 @@ MainMenu1_img_wechat.set_src("U:/static/theme1/THEME1_WECHAT.png") # MainMenu1_img_wechat.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_wechat.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +MainMenu1_img_health_text = lv.label(MainMenu1_three) +MainMenu1_img_health_text.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_health_text.set_size(THEME1_ICON_X,THEME1_ICON_X) +MainMenu1_img_health_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_health_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +MainMenu1_img_health_text.set_text(" ") +MainMenu1_img_health_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) + + MainMenu1_img_ai_text = lv.label(MainMenu1_three) -MainMenu1_img_ai_text.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_ai_text.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) MainMenu1_img_ai_text.set_size(THEME1_ICON_X,THEME1_ICON_X) MainMenu1_img_ai_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_ai_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -583,7 +590,7 @@ MainMenu1_img_ai_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STA MainMenu1_img_wechat_text = lv.label(MainMenu1_three) -MainMenu1_img_wechat_text.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) +MainMenu1_img_wechat_text.set_pos(MAIN1_ICON_X,140+5) MainMenu1_img_wechat_text.set_size(THEME1_ICON_X,THEME1_ICON_X) MainMenu1_img_wechat_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_wechat_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -598,36 +605,13 @@ MainMenu1_img_wechat_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv # MainMenu1_img_alarm.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu1_img_alarm_text = lv.label(MainMenu1_three) -MainMenu1_img_alarm_text.set_pos(MAIN1_ICON_X,140+5) +MainMenu1_img_alarm_text.set_pos(MAIN1_ICON_X*2+85,140+5) MainMenu1_img_alarm_text.set_size(THEME1_ICON_X,THEME1_ICON_X) MainMenu1_img_alarm_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_alarm_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu1_img_alarm_text.set_text(" ") MainMenu1_img_alarm_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) -# MainMenu1_img_stopwatch = lv.img(MainMenu1_three) -# MainMenu1_img_stopwatch.set_size(THEME1_ICON_X,THEME1_ICON_Y) -# MainMenu1_img_stopwatch.set_pos(MAIN1_ICON_X,140+5) -# MainMenu1_img_stopwatch.set_src("U:/static/theme1/THEME1_STOPWATCH.png") -# MainMenu1_img_stopwatch.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu1_img_stopwatch.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu1_img_stopwatch_text = lv.label(MainMenu1_three) -MainMenu1_img_stopwatch_text.set_pos(MAIN1_ICON_X*2+85,140+5) -MainMenu1_img_stopwatch_text.set_size(THEME1_ICON_X,THEME1_ICON_Y) -MainMenu1_img_stopwatch_text.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu1_img_stopwatch_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu1_img_stopwatch_text.set_text(" ") -MainMenu1_img_stopwatch_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) - -# MainMenu1_img_countdown = lv.img(MainMenu1_three) -# MainMenu1_img_countdown.set_size(THEME1_ICON_X,THEME1_ICON_Y) -# MainMenu1_img_countdown.set_pos(MAIN1_ICON_X*2+85,140+5) -# MainMenu1_img_countdown.set_src("U:/static/theme1/THEME1_COUNTDOWN.png") -# MainMenu1_img_countdown.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu1_img_countdown.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - - MainMenu1_num+=1 MainMenu1x+=1 @@ -694,8 +678,17 @@ MainMenu1_img_setting.set_src("U:/static/theme1/THEME1_SETING.png") # MainMenu1_img_setting.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_setting.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +MainMenu1_img_stopwatch_text = lv.label(MainMenu1_setting) +MainMenu1_img_stopwatch_text.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_stopwatch_text.set_size(THEME1_ICON_X,THEME1_ICON_Y) +MainMenu1_img_stopwatch_text.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu1_img_stopwatch_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +MainMenu1_img_stopwatch_text.set_text(" ") +MainMenu1_img_stopwatch_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) + + MainMenu1_img_countdown_text = lv.label(MainMenu1_setting) -MainMenu1_img_countdown_text.set_pos(MAIN1_ICON_X,MAIN1_ICON_Y+5) +MainMenu1_img_countdown_text.set_pos(MAIN1_ICON_X*2+85,MAIN1_ICON_Y+5) MainMenu1_img_countdown_text.set_size(THEME1_ICON_X,THEME1_ICON_Y) MainMenu1_img_countdown_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_countdown_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -703,7 +696,7 @@ MainMenu1_img_countdown_text.set_text(" ") MainMenu1_img_countdown_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) MainMenu1_img_toolbox_text = lv.label(MainMenu1_setting) -MainMenu1_img_toolbox_text.set_pos(int(MAIN1_ICON_X*2+85),int(MAIN1_ICON_Y+5)) +MainMenu1_img_toolbox_text.set_pos(int(MAIN1_ICON_X),int(140+5)) MainMenu1_img_toolbox_text.set_size(THEME1_ICON_X,THEME1_ICON_X) MainMenu1_img_toolbox_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_toolbox_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -711,7 +704,7 @@ MainMenu1_img_toolbox_text.set_text(" ") MainMenu1_img_toolbox_text.add_style(style_font_youyuan_20_black, lv.PART.MAIN|lv.STATE.DEFAULT) MainMenu1_img_setting_text = lv.label(MainMenu1_setting) -MainMenu1_img_setting_text.set_pos(int(MAIN1_ICON_X),int(140+5)) +MainMenu1_img_setting_text.set_pos(int(MAIN1_ICON_X*2+85),int(140+5)) MainMenu1_img_setting_text.set_size(THEME1_ICON_X,THEME1_ICON_X) MainMenu1_img_setting_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu1_img_setting_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -806,17 +799,21 @@ class MainMenuScreen(Screen): MainMenu1_img_phone_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_phone_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.PRESSING, None) - MainMenu1_img_hr_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_hr_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.PRESSING, None) - MainMenu1_img_spo2_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_spo2_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.PRESSING, None) + # MainMenu1_img_hr_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_hr_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.PRESSING, None) - MainMenu1_img_blood_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_blood_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.PRESSING, None) + # MainMenu1_img_spo2_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_spo2_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.PRESSING, None) - MainMenu1_img_temp_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.SHORT_CLICKED, None) - MainMenu1_img_temp_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.PRESSING, None) + # MainMenu1_img_blood_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_blood_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "blood_pressure")), lv.EVENT.PRESSING, None) + + # MainMenu1_img_temp_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu1_img_temp_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.PRESSING, None) + + MainMenu1_img_health_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "health")), lv.EVENT.SHORT_CLICKED, None) + MainMenu1_img_health_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "health")), lv.EVENT.PRESSING, None) MainMenu1_img_ai_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "AI_success")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_ai_text.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "AI_success")), lv.EVENT.PRESSING, None) @@ -989,16 +986,12 @@ class MainMenuScreen(Screen): if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 self.is_sliding = 0 print("img_cb:{}".format(msg)) - if msg == "AI_success":#ai语音界面需要判断网络是不是正常 - # if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#网络不正常 - EventMesh.publish("load_screen", {"screen": "{}".format("ai_talk_popup")}) - return - EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) else: self.is_sliding = 0 def lcd_on(self): + print("main Close lcd_on !!!!!!!!") self.is_sliding = 0 self.watchface.watchface_style.timerout_update() self.watchface.timer_update.start(10000, 1, self.watchface.timerout_update) @@ -1120,6 +1113,7 @@ class MainMenuScreen(Screen): self.menu_id = id self.is_sliding = 0 + def Close(self): self.watchface.Close() print("main_menu Close !!!!!!!!") diff --git a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_setting.py b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_setting.py index 6267a779..ca661a82 100644 --- a/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_setting.py +++ b/2.sdk/project/W8/sdk/services/microPython/ports/quectel/core/ui_setting.py @@ -82,20 +82,20 @@ setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT) # setting_language_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) #setting_cont_y += 60 -# setting_dialswitch_bg_img = lv.img(setting_cont) -# setting_dialswitch_bg_img.set_pos(0, setting_cont_y) -# setting_dialswitch_bg_img.set_size(TOOL_BG_ICON_W_SIZE, TOOL_BG_ICON_H_SIZE) -# setting_dialswitch_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) -# setting_dialswitch_bg_img.set_src("E:/static/list_bg.png") -# setting_dialswitch_bg_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -# setting_dialswitch_img = lv.img(setting_cont) -# setting_dialswitch_img.set_pos(8, setting_cont_y+6) -# setting_dialswitch_img.set_size(SETTING_ICON_W_SIZE, SETTING_ICON_H_SIZE) -# # setting_dialswitch_img.add_flag(lv.obj.FLAG.CLICKABLE) -# setting_dialswitch_img.set_src("E:/static/setting/menu_watch_switch.png") -# setting_dialswitch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -# setting_cont_y+=SETTING_ICON_OFFSET_SIZE +setting_dialswitch_bg_img = lv.img(setting_cont) +setting_dialswitch_bg_img.set_pos(0, setting_cont_y) +setting_dialswitch_bg_img.set_size(TOOL_BG_ICON_W_SIZE, TOOL_BG_ICON_H_SIZE) +setting_dialswitch_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) +setting_dialswitch_bg_img.set_src("E:/static/list_bg.png") +setting_dialswitch_bg_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +setting_dialswitch_img = lv.img(setting_cont) +setting_dialswitch_img.set_pos(8, setting_cont_y+6) +setting_dialswitch_img.set_size(SETTING_ICON_W_SIZE, SETTING_ICON_H_SIZE) +# setting_dialswitch_img.add_flag(lv.obj.FLAG.CLICKABLE) +setting_dialswitch_img.set_src("E:/static/setting/menu_watch_switch.png") +setting_dialswitch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +setting_cont_y+=SETTING_ICON_OFFSET_SIZE setting_themeswitch_bg_img = lv.img(setting_cont) @@ -260,7 +260,7 @@ class SettingScreen(Screen): setting_screen.add_event_cb(lambda e:EventMesh.callback_wrapper(self.setting_cb(e,"void")), lv.EVENT.GESTURE, None) # img regist btton # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None) - # setting_dialswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "dialswitch")), lv.EVENT.SHORT_CLICKED, None) + setting_dialswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "dialswitch")), lv.EVENT.SHORT_CLICKED, None) setting_themeswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "themeswitch")), lv.EVENT.SHORT_CLICKED, None) setting_imei_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "imei")), lv.EVENT.SHORT_CLICKED, None) setting_app_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "app")), lv.EVENT.SHORT_CLICKED, None) @@ -1178,6 +1178,7 @@ class PowerOnScreen(Screen): if self.count >= 9:#在上一个界面在播放音频时切换界面则关闭 以免一直播放 self.count = 0 self.timer.stop() + self.aud.stopAll() EventMesh.publish("set_UI_high_priority",0) EventMesh.publish("load_screen", {"screen": "main_menu"}) return diff --git a/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/autoconf.h b/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/autoconf.h index bdcb0b5a..9e035d27 100644 --- a/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/autoconf.h +++ b/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/autoconf.h @@ -4,7 +4,7 @@ * Helios SDK Configuration * */ -#define PROJECT_NAME_G3_C06S 1 +#define PROJECT_NAME_C3_W8 1 #define CONFIG_LVGL_SPAN 1 #define CONFIG_LVGL_FS_HELIOS 1 #define CONFIG_LVGL_GIF_DECODE 1 diff --git a/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/config.mk b/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/config.mk index 6d991956..1cea9093 100644 --- a/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/config.mk +++ b/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/config.mk @@ -2,7 +2,7 @@ # Automatically generated file; DO NOT EDIT. # Helios SDK Configuration # -PROJECT_NAME_G3_C06S=y +PROJECT_NAME_C3_W8=y # # System Configuration # diff --git a/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/include/app_link_start_addr.h b/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/include/app_link_start_addr.h index 9743c41c..f49e3291 100644 --- a/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/include/app_link_start_addr.h +++ b/2.sdk/project/W8/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/include/app_link_start_addr.h @@ -1,8 +1,8 @@ #ifndef __APP_LINK_START_ADDR_H__ #define __APP_LINK_START_ADDR_H__ -#define APP_LINK_START_ADDR 0x80591000 -#define APP_FLASH_MAX_SIZE 0x1C0000 +#define APP_LINK_START_ADDR 0x8058A000 +#define APP_FLASH_MAX_SIZE 0x1D0000 #define APP_RAM_START 0x7E3E0000 #define APP_RAM_MAX_SIZE 0x180000 diff --git a/2.sdk/project/W8/usr/static/IMAGE_ONE_PAGE_HEALTH.png b/2.sdk/project/W8/usr/static/IMAGE_ONE_PAGE_HEALTH.png index e9e5a112..2fafe0d1 100644 Binary files a/2.sdk/project/W8/usr/static/IMAGE_ONE_PAGE_HEALTH.png and b/2.sdk/project/W8/usr/static/IMAGE_ONE_PAGE_HEALTH.png differ diff --git a/2.sdk/project/W8/usr/static/theme1/THEME1_SETING.png b/2.sdk/project/W8/usr/static/theme1/THEME1_SETING.png index 2604bd34..9f93de61 100644 Binary files a/2.sdk/project/W8/usr/static/theme1/THEME1_SETING.png and b/2.sdk/project/W8/usr/static/theme1/THEME1_SETING.png differ diff --git a/2.sdk/project/W8/usr/static/theme1/THEME1_WECHAT.png b/2.sdk/project/W8/usr/static/theme1/THEME1_WECHAT.png index 9c57a032..ba00b00b 100644 Binary files a/2.sdk/project/W8/usr/static/theme1/THEME1_WECHAT.png and b/2.sdk/project/W8/usr/static/theme1/THEME1_WECHAT.png differ