From: p15692025051 <846603105@qq.com> Date: Wed, 18 Oct 2023 02:41:13 +0000 (+0800) Subject: 1、C06S项目修改 2、K5低电充电关机问题处理 3、菊风库修改 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=0bd1dd75eb990c610acc51e16b7866addb28078b;p=mirrors%2FASR1603_G5.git 1、C06S项目修改 2、K5低电充电关机问题处理 3、菊风库修改 --- diff --git a/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c b/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c index 0514fbf1..a1ca1f51 100644 --- a/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c +++ b/2.sdk/Helios_SDK/components/HX3918/hx3918_prox.c @@ -184,9 +184,9 @@ static int16_t readlp_after_writeoffset(int16_t offset,uint8_t chx_offset) { int16_t lpout; hx3918_write_offset(offset,chx_offset); - hx3918_delay(32); + hx3918_delay(52); lpout = hx3918_read_diff_lp(chx_offset); - hx3918_delay(33); + hx3918_delay(53); lpout = hx3918_read_diff_lp(chx_offset); return lpout; } @@ -803,6 +803,7 @@ void hx3918_prox_factory_hanging_cali(void) } else { + hx3918_set_cap_enable(true); hx3918_factory_cali_save_nv(); } #endif 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 b96d3849..f3faea81 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 -#ifdef PROJECT_NAME_G5_K5 +#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S 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 11d6c1b0..2a61f365 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 +#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S /*----------------- * 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 16731802..d99d75eb 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 +#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S /*----------------- * BITMAPS 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 acffbd3a..c5ff3ca9 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 *----------------*/ -#ifdef PROJECT_NAME_G5_K5 +#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S /*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/microPython.mk b/2.sdk/Helios_SDK/services/microPython/microPython.mk index cafa43d5..62ac9a9d 100644 --- a/2.sdk/Helios_SDK/services/microPython/microPython.mk +++ b/2.sdk/Helios_SDK/services/microPython/microPython.mk @@ -262,6 +262,8 @@ QPY_SRCS = \ ports/quectel/core/source/modHsensor.c \ ports/quectel/core/source/modHsensor_GH3018.c \ ports/quectel/core/source/modHsensor_HX3918.c \ + ports/quectel/core/source/modVideoCall.c \ + ports/quectel/core/source/modVideoCall_juphoon.c \ ports/quectel/core/source/modrsa.c \ ports/quectel/core/source/utils_crc32.c \ ports/quectel/core/source/modwebserver.c \ @@ -691,7 +693,9 @@ endif ifeq ($(CONFIG_SC7A20), y) $(NAME)_COMPONENTS += components/SC7A20 endif - +ifeq ($(CONFIG_juphoon), y) +$(NAME)_COMPONENTS += components/juphoon +endif ifeq ($(CONFIG_QUECTHING), y) $(NAME)_INCS += ../../components/quecsdk $(NAME)_COMPONENTS += components/quecsdk 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 9d92becb..57349af7 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 @@ -26828,7 +26828,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 -#ifdef PROJECT_NAME_G5_K5 +#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S STATIC const mp_lv_struct_t mp_lv_font_70_bold = { { &mp_lv_font_t_type }, (lv_font_t*)&lv_font_70_bold @@ -32645,12 +32645,12 @@ 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[] = { -#ifdef PROJECT_NAME_G5_K5 +#if PROJECT_NAME_G5_K5 || PROJECT_NAME_G3_C06S { 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) }, #endif -#ifdef PROJECT_NAME_G3_K01 +#if PROJECT_NAME_G3_K01 { MP_ROM_QSTR(MP_QSTR_K01_font_16_ALL), MP_ROM_PTR(&mp_K01_font_16_ALL) }, { MP_ROM_QSTR(MP_QSTR_K01_font_30_DIAL), MP_ROM_PTR(&mp_K01_font_30_DIAL) }, #endif diff --git a/2.sdk/project/C06S/ext/static/0_BAT.png b/2.sdk/project/C06S/ext/static/0_BAT.png new file mode 100644 index 00000000..15389b0b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/0_BAT.png differ diff --git a/2.sdk/project/C06S/ext/static/0_weather.png b/2.sdk/project/C06S/ext/static/0_weather.png new file mode 100644 index 00000000..fb1b9cda Binary files /dev/null and b/2.sdk/project/C06S/ext/static/0_weather.png differ diff --git a/2.sdk/project/C06S/ext/static/1_weather.png b/2.sdk/project/C06S/ext/static/1_weather.png new file mode 100644 index 00000000..9a295164 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/1_weather.png differ diff --git a/2.sdk/project/C06S/ext/static/2_weather.png b/2.sdk/project/C06S/ext/static/2_weather.png new file mode 100644 index 00000000..b77505bf Binary files /dev/null and b/2.sdk/project/C06S/ext/static/2_weather.png differ diff --git a/2.sdk/project/C06S/ext/static/3_weather.png b/2.sdk/project/C06S/ext/static/3_weather.png new file mode 100644 index 00000000..b598f0ff Binary files /dev/null and b/2.sdk/project/C06S/ext/static/3_weather.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1.jpg b/2.sdk/project/C06S/ext/static/APP/alipay/1.jpg new file mode 100644 index 00000000..78bf3c55 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1.jpg differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_11.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_11.png new file mode 100644 index 00000000..ecf67873 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_11.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_11_1.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_11_1.png new file mode 100644 index 00000000..d4873f96 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_11_1.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_12.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_12.png new file mode 100644 index 00000000..58d75700 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_12.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_13.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_13.png new file mode 100644 index 00000000..b8afd22d Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_13.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_13_1_1.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_13_1_1.png new file mode 100644 index 00000000..0e1b0b84 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_13_1_1.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_1_1.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_1_1.png new file mode 100644 index 00000000..3ff4400f Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_1_1.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_2.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_2.png new file mode 100644 index 00000000..1cc13f6c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_2.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/alipay/1_2_1.png b/2.sdk/project/C06S/ext/static/APP/alipay/1_2_1.png new file mode 100644 index 00000000..481a84fc Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/alipay/1_2_1.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/wechat/R_1.png b/2.sdk/project/C06S/ext/static/APP/wechat/R_1.png new file mode 100644 index 00000000..dfc8af1e Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/wechat/R_1.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/wechat/R_2.png b/2.sdk/project/C06S/ext/static/APP/wechat/R_2.png new file mode 100644 index 00000000..07f2ea2a Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/wechat/R_2.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/wechat/R_3.png b/2.sdk/project/C06S/ext/static/APP/wechat/R_3.png new file mode 100644 index 00000000..d9e83ed4 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/wechat/R_3.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/wechat/S_1.png b/2.sdk/project/C06S/ext/static/APP/wechat/S_1.png new file mode 100644 index 00000000..aeddf4c6 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/wechat/S_1.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/wechat/S_2.png b/2.sdk/project/C06S/ext/static/APP/wechat/S_2.png new file mode 100644 index 00000000..e7861e04 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/wechat/S_2.png differ diff --git a/2.sdk/project/C06S/ext/static/APP/wechat/S_3.png b/2.sdk/project/C06S/ext/static/APP/wechat/S_3.png new file mode 100644 index 00000000..8c6c4e0b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/APP/wechat/S_3.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_APP_QR_CODE.png b/2.sdk/project/C06S/ext/static/IMAGE_APP_QR_CODE.png new file mode 100644 index 00000000..546c32b9 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_APP_QR_CODE.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DELKEY.png b/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DELKEY.png new file mode 100644 index 00000000..05b4c687 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DELKEY.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DIAL.png b/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DIAL.png new file mode 100644 index 00000000..df9dd100 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DIAL.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DIAL_CONTACT.png b/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DIAL_CONTACT.png new file mode 100644 index 00000000..2865f2b9 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_BUTTON_DIAL_CONTACT.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png b/2.sdk/project/C06S/ext/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png new file mode 100644 index 00000000..b5e4849b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NOTICE_CALL.png b/2.sdk/project/C06S/ext/static/IMAGE_NOTICE_CALL.png new file mode 100644 index 00000000..9b27fca0 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NOTICE_CALL.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NOTICE_NONE.png b/2.sdk/project/C06S/ext/static/IMAGE_NOTICE_NONE.png new file mode 100644 index 00000000..30cab58c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NOTICE_NONE.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY0_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY0_ICON.png new file mode 100644 index 00000000..15b6108a Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY0_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY1_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY1_ICON.png new file mode 100644 index 00000000..ac732ec5 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY1_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY2_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY2_ICON.png new file mode 100644 index 00000000..ab8e9cd6 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY2_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY3_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY3_ICON.png new file mode 100644 index 00000000..9715c25d Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY3_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY4_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY4_ICON.png new file mode 100644 index 00000000..abd24f25 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY4_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY5_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY5_ICON.png new file mode 100644 index 00000000..37ffa53c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY5_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY6_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY6_ICON.png new file mode 100644 index 00000000..1164e237 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY6_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY7_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY7_ICON.png new file mode 100644 index 00000000..86893a4b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY7_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY8_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY8_ICON.png new file mode 100644 index 00000000..13ffa6b0 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY8_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY9_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY9_ICON.png new file mode 100644 index 00000000..4bc6134c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEY9_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEYHASH_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEYHASH_ICON.png new file mode 100644 index 00000000..b3803db8 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEYHASH_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEYSTAR_ICON.png b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEYSTAR_ICON.png new file mode 100644 index 00000000..c3e133f2 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_NUMBER_KEYSTAR_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_SPO2_ONLY_TEST_DONE.png b/2.sdk/project/C06S/ext/static/IMAGE_SPO2_ONLY_TEST_DONE.png new file mode 100644 index 00000000..827b4612 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_SPO2_ONLY_TEST_DONE.png differ diff --git a/2.sdk/project/C06S/ext/static/IMAGE_STEP.png b/2.sdk/project/C06S/ext/static/IMAGE_STEP.png new file mode 100644 index 00000000..6b4c7bda Binary files /dev/null and b/2.sdk/project/C06S/ext/static/IMAGE_STEP.png differ diff --git a/2.sdk/project/C06S/ext/static/REDUCE_VOLUM_ICON.png b/2.sdk/project/C06S/ext/static/REDUCE_VOLUM_ICON.png new file mode 100644 index 00000000..10a69cab Binary files /dev/null and b/2.sdk/project/C06S/ext/static/REDUCE_VOLUM_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/RED_RETURN_PNG.png b/2.sdk/project/C06S/ext/static/RED_RETURN_PNG.png new file mode 100644 index 00000000..8589c8d9 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/RED_RETURN_PNG.png differ diff --git a/2.sdk/project/C06S/ext/static/R_POWER_1.mp3 b/2.sdk/project/C06S/ext/static/R_POWER_1.mp3 new file mode 100644 index 00000000..aaff01c8 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/R_POWER_1.mp3 differ diff --git a/2.sdk/project/C06S/ext/static/R_POWER_OFF_1.mp3 b/2.sdk/project/C06S/ext/static/R_POWER_OFF_1.mp3 new file mode 100644 index 00000000..3ff519d1 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/R_POWER_OFF_1.mp3 differ diff --git a/2.sdk/project/C06S/ext/static/VOLUM_ADD_ICON.png b/2.sdk/project/C06S/ext/static/VOLUM_ADD_ICON.png new file mode 100644 index 00000000..75b8c932 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/VOLUM_ADD_ICON.png differ diff --git a/2.sdk/project/C06S/ext/static/add_btn.png b/2.sdk/project/C06S/ext/static/add_btn.png new file mode 100644 index 00000000..4e180873 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/add_btn.png differ diff --git a/2.sdk/project/C06S/ext/static/answer.png b/2.sdk/project/C06S/ext/static/answer.png new file mode 100644 index 00000000..4121841f Binary files /dev/null and b/2.sdk/project/C06S/ext/static/answer.png differ diff --git a/2.sdk/project/C06S/ext/static/audio_audio_haixiu.mp3 b/2.sdk/project/C06S/ext/static/audio_audio_haixiu.mp3 new file mode 100644 index 00000000..5ef7a933 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/audio_audio_haixiu.mp3 differ diff --git a/2.sdk/project/C06S/ext/static/cancel_icon.png b/2.sdk/project/C06S/ext/static/cancel_icon.png new file mode 100644 index 00000000..5dcc48a6 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/cancel_icon.png differ diff --git a/2.sdk/project/C06S/ext/static/charge_ing.png b/2.sdk/project/C06S/ext/static/charge_ing.png new file mode 100644 index 00000000..070a502c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/charge_ing.png differ diff --git a/2.sdk/project/C06S/ext/static/find_phone.png b/2.sdk/project/C06S/ext/static/find_phone.png new file mode 100644 index 00000000..afb4e92c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/find_phone.png differ diff --git a/2.sdk/project/C06S/ext/static/hang_up.png b/2.sdk/project/C06S/ext/static/hang_up.png new file mode 100644 index 00000000..ef3e0fbb Binary files /dev/null and b/2.sdk/project/C06S/ext/static/hang_up.png differ diff --git a/2.sdk/project/C06S/ext/static/health/health_hr.png b/2.sdk/project/C06S/ext/static/health/health_hr.png new file mode 100644 index 00000000..7bc14280 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/health/health_hr.png differ diff --git a/2.sdk/project/C06S/ext/static/health/health_spo2.png b/2.sdk/project/C06S/ext/static/health/health_spo2.png new file mode 100644 index 00000000..48982890 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/health/health_spo2.png differ diff --git a/2.sdk/project/C06S/ext/static/health/health_temp.png b/2.sdk/project/C06S/ext/static/health/health_temp.png new file mode 100644 index 00000000..a7f260b3 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/health/health_temp.png differ diff --git a/2.sdk/project/C06S/ext/static/health/health_text.png b/2.sdk/project/C06S/ext/static/health/health_text.png new file mode 100644 index 00000000..1b914a16 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/health/health_text.png differ diff --git a/2.sdk/project/C06S/ext/static/hr_gif_01.png b/2.sdk/project/C06S/ext/static/hr_gif_01.png new file mode 100644 index 00000000..e7c7d584 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/hr_gif_01.png differ diff --git a/2.sdk/project/C06S/ext/static/hr_gif_02.png b/2.sdk/project/C06S/ext/static/hr_gif_02.png new file mode 100644 index 00000000..800f918a Binary files /dev/null and b/2.sdk/project/C06S/ext/static/hr_gif_02.png differ diff --git a/2.sdk/project/C06S/ext/static/hr_gif_03.png b/2.sdk/project/C06S/ext/static/hr_gif_03.png new file mode 100644 index 00000000..6a7f6ace Binary files /dev/null and b/2.sdk/project/C06S/ext/static/hr_gif_03.png differ diff --git a/2.sdk/project/C06S/ext/static/hr_line_bg.png b/2.sdk/project/C06S/ext/static/hr_line_bg.png new file mode 100644 index 00000000..20888120 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/hr_line_bg.png differ diff --git a/2.sdk/project/C06S/ext/static/low_power.png b/2.sdk/project/C06S/ext/static/low_power.png new file mode 100644 index 00000000..d5ffd706 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/low_power.png differ diff --git a/2.sdk/project/C06S/ext/static/menu_connect_device.png b/2.sdk/project/C06S/ext/static/menu_connect_device.png new file mode 100644 index 00000000..e9d3b607 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/menu_connect_device.png differ diff --git a/2.sdk/project/C06S/ext/static/menu_time.png b/2.sdk/project/C06S/ext/static/menu_time.png new file mode 100644 index 00000000..8b91c4cc Binary files /dev/null and b/2.sdk/project/C06S/ext/static/menu_time.png differ diff --git a/2.sdk/project/C06S/ext/static/mpsignal1.png b/2.sdk/project/C06S/ext/static/mpsignal1.png new file mode 100644 index 00000000..2691f718 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/mpsignal1.png differ diff --git a/2.sdk/project/C06S/ext/static/mpsignal2.png b/2.sdk/project/C06S/ext/static/mpsignal2.png new file mode 100644 index 00000000..7afdd947 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/mpsignal2.png differ diff --git a/2.sdk/project/C06S/ext/static/mpsignal3.png b/2.sdk/project/C06S/ext/static/mpsignal3.png new file mode 100644 index 00000000..10a5ef1e Binary files /dev/null and b/2.sdk/project/C06S/ext/static/mpsignal3.png differ diff --git a/2.sdk/project/C06S/ext/static/mpsignal4.png b/2.sdk/project/C06S/ext/static/mpsignal4.png new file mode 100644 index 00000000..51d49628 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/mpsignal4.png differ diff --git a/2.sdk/project/C06S/ext/static/mpsignal5.png b/2.sdk/project/C06S/ext/static/mpsignal5.png new file mode 100644 index 00000000..53352ab5 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/mpsignal5.png differ diff --git a/2.sdk/project/C06S/ext/static/off_icon.png b/2.sdk/project/C06S/ext/static/off_icon.png new file mode 100644 index 00000000..44f1bbfa Binary files /dev/null and b/2.sdk/project/C06S/ext/static/off_icon.png differ diff --git a/2.sdk/project/C06S/ext/static/point_black.png b/2.sdk/project/C06S/ext/static/point_black.png new file mode 100644 index 00000000..a64e8cb7 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/point_black.png differ diff --git a/2.sdk/project/C06S/ext/static/point_white.png b/2.sdk/project/C06S/ext/static/point_white.png new file mode 100644 index 00000000..318e3c22 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/point_white.png differ diff --git a/2.sdk/project/C06S/ext/static/poweroff_icon.png b/2.sdk/project/C06S/ext/static/poweroff_icon.png new file mode 100644 index 00000000..661295d8 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/poweroff_icon.png differ diff --git a/2.sdk/project/C06S/ext/static/reduce_btn.png b/2.sdk/project/C06S/ext/static/reduce_btn.png new file mode 100644 index 00000000..7c07bd0c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/reduce_btn.png differ diff --git a/2.sdk/project/C06S/ext/static/reset_hr_btn.png b/2.sdk/project/C06S/ext/static/reset_hr_btn.png new file mode 100644 index 00000000..289316bc Binary files /dev/null and b/2.sdk/project/C06S/ext/static/reset_hr_btn.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_app_qrcode.png b/2.sdk/project/C06S/ext/static/setting/menu_app_qrcode.png new file mode 100644 index 00000000..71c92154 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_app_qrcode.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_bright.png b/2.sdk/project/C06S/ext/static/setting/menu_bright.png new file mode 100644 index 00000000..c64fb441 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_bright.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_imei_qrcode.png b/2.sdk/project/C06S/ext/static/setting/menu_imei_qrcode.png new file mode 100644 index 00000000..a564ba5b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_imei_qrcode.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_language.png b/2.sdk/project/C06S/ext/static/setting/menu_language.png new file mode 100644 index 00000000..f6deb97f Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_language.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_poweroff.png b/2.sdk/project/C06S/ext/static/setting/menu_poweroff.png new file mode 100644 index 00000000..df5b92cb Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_poweroff.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_restore.png b/2.sdk/project/C06S/ext/static/setting/menu_restore.png new file mode 100644 index 00000000..34c01a21 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_restore.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_theme_switch.png b/2.sdk/project/C06S/ext/static/setting/menu_theme_switch.png new file mode 100644 index 00000000..e57ae268 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_theme_switch.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_upgrade.png b/2.sdk/project/C06S/ext/static/setting/menu_upgrade.png new file mode 100644 index 00000000..83ee667b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_upgrade.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_version.png b/2.sdk/project/C06S/ext/static/setting/menu_version.png new file mode 100644 index 00000000..f0bfd654 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_version.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_volume.png b/2.sdk/project/C06S/ext/static/setting/menu_volume.png new file mode 100644 index 00000000..200367c0 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_volume.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/menu_watch_switch.png b/2.sdk/project/C06S/ext/static/setting/menu_watch_switch.png new file mode 100644 index 00000000..d1c21be2 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/menu_watch_switch.png differ diff --git a/2.sdk/project/C06S/ext/static/setting/setting_text.png b/2.sdk/project/C06S/ext/static/setting/setting_text.png new file mode 100644 index 00000000..2a03c470 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/setting/setting_text.png differ diff --git a/2.sdk/project/C06S/ext/static/spo2_gif01.png b/2.sdk/project/C06S/ext/static/spo2_gif01.png new file mode 100644 index 00000000..69e124e1 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/spo2_gif01.png differ diff --git a/2.sdk/project/C06S/ext/static/spo2_gif02.png b/2.sdk/project/C06S/ext/static/spo2_gif02.png new file mode 100644 index 00000000..8fffc671 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/spo2_gif02.png differ diff --git a/2.sdk/project/C06S/ext/static/spo2_gif03.png b/2.sdk/project/C06S/ext/static/spo2_gif03.png new file mode 100644 index 00000000..23ee5d31 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/spo2_gif03.png differ diff --git a/2.sdk/project/C06S/ext/static/spo2_gif04.png b/2.sdk/project/C06S/ext/static/spo2_gif04.png new file mode 100644 index 00000000..60af6830 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/spo2_gif04.png differ diff --git a/2.sdk/project/C06S/ext/static/spo2_line_bg.png b/2.sdk/project/C06S/ext/static/spo2_line_bg.png new file mode 100644 index 00000000..04fc347b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/spo2_line_bg.png differ diff --git a/2.sdk/project/C06S/ext/static/stopwatch_play.png b/2.sdk/project/C06S/ext/static/stopwatch_play.png new file mode 100644 index 00000000..6984f950 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/stopwatch_play.png differ diff --git a/2.sdk/project/C06S/ext/static/stopwatch_reset.png b/2.sdk/project/C06S/ext/static/stopwatch_reset.png new file mode 100644 index 00000000..a5f85106 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/stopwatch_reset.png differ diff --git a/2.sdk/project/C06S/ext/static/stopwatch_stop.png b/2.sdk/project/C06S/ext/static/stopwatch_stop.png new file mode 100644 index 00000000..d102e527 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/stopwatch_stop.png differ diff --git a/2.sdk/project/C06S/usr/static/storage_file/wechat_num.txt b/2.sdk/project/C06S/ext/static/storage_file/wechat_num.txt similarity index 100% rename from 2.sdk/project/C06S/usr/static/storage_file/wechat_num.txt rename to 2.sdk/project/C06S/ext/static/storage_file/wechat_num.txt diff --git a/2.sdk/project/C06S/ext/static/temp_gif01.png b/2.sdk/project/C06S/ext/static/temp_gif01.png new file mode 100644 index 00000000..b1585cdf Binary files /dev/null and b/2.sdk/project/C06S/ext/static/temp_gif01.png differ diff --git a/2.sdk/project/C06S/ext/static/temp_gif02.png b/2.sdk/project/C06S/ext/static/temp_gif02.png new file mode 100644 index 00000000..6065cbba Binary files /dev/null and b/2.sdk/project/C06S/ext/static/temp_gif02.png differ diff --git a/2.sdk/project/C06S/ext/static/temp_gif03.png b/2.sdk/project/C06S/ext/static/temp_gif03.png new file mode 100644 index 00000000..4833bc5d Binary files /dev/null and b/2.sdk/project/C06S/ext/static/temp_gif03.png differ diff --git a/2.sdk/project/C06S/ext/static/temp_high.png b/2.sdk/project/C06S/ext/static/temp_high.png new file mode 100644 index 00000000..d18ab2fa Binary files /dev/null and b/2.sdk/project/C06S/ext/static/temp_high.png differ diff --git a/2.sdk/project/C06S/ext/static/temp_line_bg.png b/2.sdk/project/C06S/ext/static/temp_line_bg.png new file mode 100644 index 00000000..1fc3f49b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/temp_line_bg.png differ diff --git a/2.sdk/project/C06S/ext/static/time_down.png b/2.sdk/project/C06S/ext/static/time_down.png new file mode 100644 index 00000000..6338ed3c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/time_down.png differ diff --git a/2.sdk/project/C06S/ext/static/time_finish.png b/2.sdk/project/C06S/ext/static/time_finish.png new file mode 100644 index 00000000..a9826076 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/time_finish.png differ diff --git a/2.sdk/project/C06S/ext/static/time_up.png b/2.sdk/project/C06S/ext/static/time_up.png new file mode 100644 index 00000000..b0e189b7 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/time_up.png differ diff --git a/2.sdk/project/C06S/ext/static/time_up1.png b/2.sdk/project/C06S/ext/static/time_up1.png new file mode 100644 index 00000000..9a42d426 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/time_up1.png differ diff --git a/2.sdk/project/C06S/ext/static/time_up2.png b/2.sdk/project/C06S/ext/static/time_up2.png new file mode 100644 index 00000000..d723d2b8 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/time_up2.png differ diff --git a/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_ALARM.png b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_ALARM.png new file mode 100644 index 00000000..3647cae7 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_ALARM.png differ diff --git a/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_COUNTDOWN.png b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_COUNTDOWN.png new file mode 100644 index 00000000..c136bacc Binary files /dev/null and b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_COUNTDOWN.png differ diff --git a/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_STEP.png b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_STEP.png new file mode 100644 index 00000000..9f0a6f3b Binary files /dev/null and b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_STEP.png differ diff --git a/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_STOPWATCH.png b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_STOPWATCH.png new file mode 100644 index 00000000..ebde8323 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_STOPWATCH.png differ diff --git a/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_WEATHER.png b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_WEATHER.png new file mode 100644 index 00000000..6e113c3d Binary files /dev/null and b/2.sdk/project/C06S/ext/static/tool/IMAGE_SECMENU_WEATHER.png differ diff --git a/2.sdk/project/C06S/ext/static/tool/sms_setting.png b/2.sdk/project/C06S/ext/static/tool/sms_setting.png new file mode 100644 index 00000000..acdc5fc5 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/tool/sms_setting.png differ diff --git a/2.sdk/project/C06S/ext/static/tool/tool_text.png b/2.sdk/project/C06S/ext/static/tool/tool_text.png new file mode 100644 index 00000000..cbed113c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/tool/tool_text.png differ diff --git a/2.sdk/project/C06S/ext/static/update.png b/2.sdk/project/C06S/ext/static/update.png new file mode 100644 index 00000000..7aea5cf9 Binary files /dev/null and b/2.sdk/project/C06S/ext/static/update.png differ diff --git a/2.sdk/project/C06S/ext/static/vbat_0.png b/2.sdk/project/C06S/ext/static/vbat_0.png new file mode 100644 index 00000000..a830107c Binary files /dev/null and b/2.sdk/project/C06S/ext/static/vbat_0.png differ diff --git a/2.sdk/project/C06S/font/ext_font.bin b/2.sdk/project/C06S/font/ext_font.bin new file mode 100644 index 00000000..0864f185 Binary files /dev/null and b/2.sdk/project/C06S/font/ext_font.bin differ diff --git a/2.sdk/project/C06S/new.bat b/2.sdk/project/C06S/new.bat index 424606e4..5b5a5da9 100644 --- a/2.sdk/project/C06S/new.bat +++ b/2.sdk/project/C06S/new.bat @@ -2,8 +2,7 @@ md images del images /q -@GOTO :STEP1 -..\..\Helios_SDK\tools\ASR_1606\win32\mklfs.exe -c ext -b 4096 -r 4096 -p 4096 -s 1048576 -i .\images\ext_fs.bin +..\..\Helios_SDK\tools\ASR_1606\win32\mklfs.exe -c ext -b 4096 -r 4096 -p 4096 -s 1468000 -i .\images\ext_fs.bin if errorlevel 1 ( echo "ext_fs.binÉú³Éʧ°Ü !!!!!!!!!!!!!!! " goto exit @@ -11,9 +10,8 @@ if errorlevel 1 ( if errorlevel 0 ( echo "ext_fs.binÉú³É³É¹¦ !!!!!!!!!!!!!!! " ) -:STEP1 -..\..\Helios_SDK\tools\ASR_1606\win32\mklfs.exe -c usr -b 4096 -r 4096 -p 4096 -s 819200 -i .\images\customer_fs.bin +..\..\Helios_SDK\tools\ASR_1606\win32\mklfs.exe -c usr -b 4096 -r 4096 -p 4096 -s 716800 -i .\images\customer_fs.bin if errorlevel 1 ( echo "customer_fs.binÉú³Éʧ°Ü Çë¼ì²éusrĿ¼ÊÇ·ñ´óÓÚ316K!!!!!!!!!!!!!!!" goto exit @@ -22,7 +20,7 @@ if errorlevel 0 ( echo "customer_fs.binÉú³É³É¹¦ !!!!!!!!!!!!!!! " ) -%copy font\ext_font.bin images\ext_font.bin% +copy font\ext_font.bin images\ext_font.bin ..\..\Helios_SDK\tools\common\win32\7z\7z a sdk\system\platform\ASR_1606\boards\EG810MCN_GA_VOLTE\images\firmware_base_release_pack.zip .\images\ if errorlevel 0 ( diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py index cc684061..84c8fc71 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py @@ -78,6 +78,8 @@ def set_log(log_adapter): def add_filter(flt): event_store.add_filter(flt) +import utime +import uos Txt_Log = 1 def txt_log(data): if Txt_Log != 0 : diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/Makefile b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/Makefile index b6d1801d..7b20a27c 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/Makefile +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/Makefile @@ -356,6 +356,7 @@ SRC_QSTR += \ source/modGsensor_SC7A20.c \ source/modHsensor.c \ source/modHsensor_GH3018.c \ + source/modHsensor_HX3918.c \ source/modrsa.c \ source/utils_crc32.c \ source/http_parser.c \ @@ -657,6 +658,9 @@ ifeq ($(CONFIG_JPEG), y) INC += -I$(ROOT)/components/jpeg/jpeg-9c INC += -I$(ROOT)/components/jpeg endif +ifeq ($(CONFIG_HX3918), y) +INC += -I$(ROOT)/components/HX3918 +endif ifeq ($(CONFIG_GH301x), y) INC += -I$(ROOT)/components/GH301x endif diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py index e1c8b6fd..22814c3e 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py @@ -32,9 +32,7 @@ MAX_ALARM = 3 #CONT的样式 style_cont_alarm = lv.style_t() style_cont_alarm.init() -style_cont_alarm.set_bg_color(lv.color_make(0xA0, 0xA0, 0xA0)) -style_cont_alarm.set_bg_grad_color(lv.color_make(0xA0, 0xA0, 0xA0)) -style_cont_alarm.set_bg_opa(255) +style_cont_alarm.set_bg_color(lv.color_make(0x22, 0x28, 0x3D)) style_cont_alarm.set_radius(0) style_cont_alarm.set_pad_left(0) style_cont_alarm.set_pad_right(0) @@ -45,7 +43,7 @@ style_cont_alarm.set_pad_bottom(0) # style_font_white = lv.style_t() # style_font_white.init() # style_font_white.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -# style_font_white.set_text_font(lv.K01_font_16_ALL) +# style_font_white.set_text_font_v2("font_28.bin",28,0) # style_font_white.set_border_width(0) # style_font_white.set_pad_left(0) # style_font_white.set_pad_right(0) @@ -55,7 +53,7 @@ style_cont_alarm.set_pad_bottom(0) style_font_yellow = lv.style_t() style_font_yellow.init() style_font_yellow.set_text_color(lv.color_make(0xF1, 0xA3, 0x3B)) -style_font_yellow.set_text_font(lv.K01_font_16_ALL) +style_font_yellow.set_text_font_v2("font_28.bin",28,0) #背景样式 style_alarm_screen_default = lv.style_t() @@ -71,17 +69,16 @@ style_alarm_screen_default.set_pad_bottom(0) clk_list_screen = lv.obj() print("clk_list_screen") clk_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) -clk_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) clk_list_title_bg= lv.btn(clk_list_screen) -clk_list_title_bg.set_size(112,25) -clk_list_title_bg.set_pos(8,5) +clk_list_title_bg.set_size(220,40) +clk_list_title_bg.set_pos(10,10) clk_list_title_bg.add_style(style_cont_alarm, lv.PART.MAIN | lv.STATE.DEFAULT) -clk_list_title_bg.set_ext_click_area(25) +clk_list_title_bg.set_ext_click_area(40) clk_list_title = lv.label(clk_list_title_bg) -clk_list_title.set_pos(4, 5) -clk_list_title.set_size(112, 20) +clk_list_title.set_pos(0, 15) +clk_list_title.set_size(240, 40) clk_list_title.set_text("闹钟列表") clk_list_title.set_long_mode(lv.label.LONG.WRAP) clk_list_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -101,24 +98,23 @@ clk_list_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) # clk_list_add.set_ext_click_area(15) clk_list_screen1_1 = lv.obj(clk_list_screen) -clk_list_screen1_1.set_pos(0, 35) -clk_list_screen1_1.set_size(128, 128-35) -clk_list_screen1_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +clk_list_screen1_1.set_pos(0, 65) +clk_list_screen1_1.set_size(240, 255) clk_list_screen1_1.add_style(style_alarm_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT) -# no_add_alarm_img = lv.img(clk_list_screen1_1) -# no_add_alarm_img.set_pos(15, 0) -# no_add_alarm_img.set_size(98, 94) -# no_add_alarm_img.set_src("U:/static/IMAGE_IDLE_SCREEN_ALARM_POPUP_02.png") -# no_add_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +no_add_alarm_img = lv.img(clk_list_screen1_1) +no_add_alarm_img.set_pos(65, 0) +no_add_alarm_img.set_size(110, 140) +no_add_alarm_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png") +no_add_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) #暂未添加闹钟 no_add_alarm = lv.label(clk_list_screen1_1) -no_add_alarm.set_pos(0, 20) -no_add_alarm.set_size(128, 20) -no_add_alarm.set_text("请在app上设置") +no_add_alarm.set_pos(0, 170) +no_add_alarm.set_size(240, 50) +no_add_alarm.set_text("闹钟暂未设置") no_add_alarm.set_long_mode(lv.label.LONG.WRAP) no_add_alarm.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_add_alarm.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -401,10 +397,7 @@ label_ok.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) #闹钟信息 alarm_list = [{'hour': 16, 'repeart': 10, 'idx': 0, 'enabled': 0, 'days': [], 'minute': 39}, - {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39}, - {'hour': 15, 'repeart': 1, 'idx': 2, 'enabled': 0, 'days': [], 'minute': 13}, - {'hour': 16, 'repeart': 1, 'idx': 3, 'enabled': 0, 'days': [], 'minute': 39}, - {'hour': 15, 'repeart': 1, 'idx': 4, 'enabled': 0, 'days': [], 'minute': 13}] + {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39}] #用于显示闹钟列表不包含开关机信息 class ClockManager(Abstract): @@ -413,11 +406,11 @@ class ClockManager(Abstract): self.rtc = RTC() self.days = 0 self.idx = 0 - - IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") + self.rtc.enable_alarm(1) + IFEXIST = ql_fs.path_exists("/ext/static/storage_file/alarm_msg.json") self.check_alarm_list = [] if IFEXIST == True: - with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd: + with open("/ext/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd: self.check_alarm_list = ujson.load(fd) def post_processor_after_instantiation(self): @@ -449,15 +442,15 @@ class ClockManager(Abstract): alarm_list[idx]["days"] = msg["days"] alarm_list[idx]["enabled"] = msg["enabled"] alarm_list[idx]["repeart"] = msg["repeart"] - with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: ujson.dump(alarm_list,fd) def read_alarminjson(self, event, msg): - IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") + IFEXIST = ql_fs.path_exists("/ext/static/storage_file/alarm_msg.json") global alarm_list print("IFEXIST:{}".format(IFEXIST)) if IFEXIST == True: - with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd: + with open("/ext/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd: alarm_list = ujson.load(fd) return alarm_list @@ -589,7 +582,7 @@ class ClockManager(Abstract): # num+=1 print("alarm_list----len- :{}".format(len(alarm_list))) - with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: ujson.dump(alarm_list,fd) EventMesh.publish("push_update_alarm_show") @@ -617,7 +610,7 @@ class ClockManager(Abstract): alarm_list[j]["idx"] -= 1 print("delete_here4-----",alarm_list) - with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: ujson.dump(alarm_list,fd) @@ -638,7 +631,7 @@ class ClockManager(Abstract): print("关闭1:",alarm_list[idx]["days"]) print("关闭2:",alarm_list [idx]["days"]) alarm_list[idx]["enabled"] = False - with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: + with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd: ujson.dump(alarm_list,fd) EventMesh.publish("set_rtc_alarm") #设置下一个闹钟,定时开关机功能 @@ -792,14 +785,14 @@ popup_alarm_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) popup_alarm_img = lv.img(popup_alarm_screen) -popup_alarm_img.set_pos(15, 5) -popup_alarm_img.set_size(98, 94) -popup_alarm_img.set_src("U:/static/IMAGE_IDLE_SCREEN_ALARM_POPUP_02.png") +popup_alarm_img.set_pos(63, 60) +popup_alarm_img.set_size(110, 140) +popup_alarm_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png") popup_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) popup_alarm_time = lv.label(popup_alarm_screen) -popup_alarm_time.set_pos(0, 100) -popup_alarm_time.set_size(128, 20) +popup_alarm_time.set_pos(0, 230) +popup_alarm_time.set_size(240, 50) popup_alarm_time.set_text(" ") popup_alarm_time.set_long_mode(lv.label.LONG.WRAP) popup_alarm_time.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -810,14 +803,13 @@ class PopupAlarmScreen(Screen): def __init__(self): super().__init__() self.meta = popup_alarm_screen - self.meta_type = "popup" self.timer = osTimer() self.aud = audio.Audio(0) self.alarm_count = 0 def initialization(self): self.alarm_count = 0 - self.timer.start(2*1000,1,self.exit_alarm_page) + self.timer.start(1000,1,self.exit_alarm_page) time = EventMesh.publish("screen_get_time")#获取系统时间 popup_alarm_time.set_text("{}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))) @@ -828,15 +820,19 @@ class PopupAlarmScreen(Screen): self.aud.stop() def exit_alarm_page(self,*arges): - EventMesh.publish("system_sleep_rest") + EventMesh.publish("system_sleep_rest")#防止黑屏 self.alarm_count+=1 - if self.alarm_count > 5*60: + if self.alarm_count > 60: self.alarm_count = 0 self.aud.stop() self.timer.stop() EventMesh.publish("load_screen", {"screen": "main_menu"}) return - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') #播放声音 + play_state = EventMesh.publish("get_audio_state")#音频播放状态 + if play_state != None: + if play_state == 0:#在上一个界面在播放音频时切换界面则关闭 以免一直播放 + self.aud.stop() + self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音 def close_timer(self): self.alarm_count=0 @@ -882,13 +878,34 @@ class ClkListScreen(Screen): super().__init__() self.meta = clk_list_screen self.clock_list = [] + self.MXA_clk_num = 3#有两个开关机隐藏的 + self.contact_detail_listt_dict = [] # clk_list_add_btn.add_event_cb(lambda e: self.add_alarm_btn(e), # lv.EVENT.PRESSED, None) self.weekdays_list = ["日","一","二","三","四","五","六"] EventMesh.subscribe("push_update_alarm_show", self.update_show_info) self.alarm_show_list = lv.obj(clk_list_screen) + self.alarm_show_list.set_pos(0, 65) + self.alarm_show_list.set_size(240, 255) + self.alarm_show_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.alarm_show_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) self.timer=osTimer() - + for i in range(self.MXA_clk_num): + + _btn = lv.btn(self.alarm_show_list) + _btn.add_flag(lv.obj.FLAG.CLICKABLE) + _btn.add_style(style_cont_alarm, lv.PART.MAIN | lv.STATE.DEFAULT) + _btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_alarm(e)), + lv.EVENT.CLICKED, None) + _btn.add_flag(lv.obj.FLAG.HIDDEN) + _btn_label1 = lv.label(_btn) + _btn_label2 = lv.label(_btn) + _btn_label2.set_long_mode(lv.label.LONG.DOT) + _btn_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + _btn_label3 = lv.label(_btn) + _btn_label3.set_long_mode(lv.label.LONG.DOT) + _btn_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + self.contact_detail_listt_dict.append({"_btn":_btn,"_btn_label1":_btn_label1,"_btn_label2":_btn_label2,"_btn_label3":_btn_label3}) def initialization(self): EventMesh.publish("read_alarminjson") @@ -907,69 +924,77 @@ class ClkListScreen(Screen): def alarm_draw_btn(self): global alarm_list self.clock_list = alarm_list - IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") + IFEXIST = ql_fs.path_exists("/ext/static/storage_file/alarm_msg.json") if IFEXIST == True: if self.clock_list: # print("nalarm_list:{}".format(alarm_list)) - # no_add_alarm_img.add_flag(lv.obj.FLAG.HIDDEN) + no_add_alarm_img.add_flag(lv.obj.FLAG.HIDDEN) no_add_alarm.add_flag(lv.obj.FLAG.HIDDEN) - self.alarm_show_list.delete()#先删除一次控件 - self.alarm_show_list = lv.obj(clk_list_screen1_1) - self.alarm_show_list.set_pos(0, 0) - self.alarm_show_list.set_size(128, 128) - self.alarm_show_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.alarm_show_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.alarm_show_list.delete()#先删除一次控件 + # self.alarm_show_list = lv.obj(clk_list_screen) + # self.alarm_show_list.set_pos(0, 65) + # self.alarm_show_list.set_size(240, 255) + # self.alarm_show_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # self.alarm_show_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) #print("菜单的孩子个数:",clk_list_screen1.get_child_cnt()) num = 0 count = 0 - for i ,each in enumerate(self.clock_list): + clock_nums = len(self.clock_list)-2#3-2 = 1 0 + # for i ,each in enumerate(self.clock_list): + for i in range(0,self.MXA_clk_num): + if i >= clock_nums: + self.contact_detail_listt_dict[i]["_btn"].add_flag(lv.obj.FLAG.HIDDEN) + continue + each = self.clock_list[2+i] num = each["idx"] + if count >= 3: break - repeart = each["repeart"] - if repeart == 10: + repeart = each["repeart"]# + if repeart >= 10: continue - _btn = lv.btn(self.alarm_show_list) - _btn.set_size(112,45) - _btn.set_pos(8,49*count) - _btn.add_style(style_cont_alarm, lv.PART.MAIN | lv.STATE.DEFAULT) - _btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_alarm(e)), - lv.EVENT.CLICKED, None) + print("count1:{}".format(count)) + #_btn = lv.btn(self.alarm_show_list) + self.contact_detail_listt_dict[count]["_btn"].set_size(230,75) + self.contact_detail_listt_dict[count]["_btn"].set_pos(8,79*count) + # self.contact_detail_listt_dict[i]["_btn"].add_style(style_cont_alarm, lv.PART.MAIN | lv.STATE.DEFAULT) + # self.contact_detail_listt_dict[i]["_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.edit_alarm(e)), + # lv.EVENT.CLICKED, None) # print("------刷新闹钟列表噢:{} num:{}",each,num) - _btn_label1 = lv.label(_btn) - _btn_label1.set_pos(50, 0) - _btn_label1.set_size(0, 0) - _btn_label1.set_text(str(num)) - - _btn_label2 = lv.label(_btn) - _btn_label2.set_pos(8, 5) - _btn_label2.set_size(97, 20) - _btn_label2.set_text("%02d" % each["hour"] + ":"+"%02d" % each["minute"]) + #_btn_label1 = lv.label(_btn) + self.contact_detail_listt_dict[count]["_btn_label1"].set_pos(50, 0) + self.contact_detail_listt_dict[count]["_btn_label1"].set_size(0, 0) + self.contact_detail_listt_dict[count]["_btn_label1"].set_text(str(num)) + + #_btn_label2 = lv.label(_btn) + self.contact_detail_listt_dict[count]["_btn_label2"].set_pos(8, 10) + self.contact_detail_listt_dict[count]["_btn_label2"].set_size(97, 40) + self.contact_detail_listt_dict[count]["_btn_label2"].set_text("%02d" % each["hour"] + ":"+"%02d" % each["minute"]) # _btn_label2.set_text(str(each["days"])) - _btn_label2.set_long_mode(lv.label.LONG.DOT) - _btn_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - _btn_label2.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + # _btn_label2.set_long_mode(lv.label.LONG.DOT) + # _btn_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + self.contact_detail_listt_dict[count]["_btn_label2"].set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) _new_list = sorted(each["days"]) repeart = each["repeart"] _output = [self.weekdays_list[x] for x in _new_list] - _btn_label3 = lv.label(_btn) - _btn_label3.set_pos(8, 25) - _btn_label3.set_size(128-8, 20) + #_btn_label3 = lv.label(_btn) + self.contact_detail_listt_dict[count]["_btn_label3"].set_pos(5, 44) + self.contact_detail_listt_dict[count]["_btn_label3"].set_size(200, 40) print("_new_list:{} repeart:{}".format(_new_list,repeart)) if repeart == 1: - _btn_label3.set_text("一次") + self.contact_detail_listt_dict[count]["_btn_label3"].set_text("一次") elif repeart == 2: - _btn_label3.set_text("每天") + self.contact_detail_listt_dict[count]["_btn_label3"].set_text("每天") else: - _btn_label3.set_text(",".join(_output)) - _btn_label3.set_long_mode(lv.label.LONG.DOT) - _btn_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - _btn_label3.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) - + self.contact_detail_listt_dict[count]["_btn_label3"].set_text(",".join(_output)) + # _btn_label3.set_long_mode(lv.label.LONG.DOT) + # _btn_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + self.contact_detail_listt_dict[count]["_btn_label3"].set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + self.contact_detail_listt_dict[count]["_btn"].clear_flag(lv.obj.FLAG.HIDDEN) # _btn_switch = lv.switch(_btn) # _btn_switch.set_pos(178, 29) # _btn_switch.set_size(50, 25) @@ -990,15 +1015,19 @@ class ClkListScreen(Screen): # _btn_switch.clear_state(lv.STATE.CHECKED) count+=1 if count == 0: - # no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN) + no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN) no_add_alarm.clear_flag(lv.obj.FLAG.HIDDEN) self.alarm_show_list.add_flag(lv.obj.FLAG.HIDDEN) + else : + no_add_alarm_img.add_flag(lv.obj.FLAG.HIDDEN) + no_add_alarm.add_flag(lv.obj.FLAG.HIDDEN) + self.alarm_show_list.clear_flag(lv.obj.FLAG.HIDDEN) else: - # no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN) + no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN) no_add_alarm.clear_flag(lv.obj.FLAG.HIDDEN) self.alarm_show_list.add_flag(lv.obj.FLAG.HIDDEN) else: - # no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN) + no_add_alarm_img.clear_flag(lv.obj.FLAG.HIDDEN) no_add_alarm.clear_flag(lv.obj.FLAG.HIDDEN) self.alarm_show_list.add_flag(lv.obj.FLAG.HIDDEN) @@ -1046,6 +1075,11 @@ class ClkListScreen(Screen): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) + + + + + class NewEditClk(Screen): NAME = "new_edit_clk" diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py index 0226a8e3..ee21b2e0 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py @@ -10,18 +10,34 @@ from machine import Pin from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn import audio import utime +#import ALIPAY import usys from misc import Power factorymode_cont_y = 0 factorymode_screen = lv.obj() print("factorymode_screen") factorymode_screen.center() -factorymode_screen.set_size(128, 128) +factorymode_screen.set_size(240, 320) factorymode_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +style_btn_1 = lv.style_t() +style_btn_1.init() +style_btn_1.set_bg_opa(0) +style_btn_1.set_shadow_opa(0) +style_btn_1.set_border_width(0) +style_btn_1.set_bg_color(lv.color_make(0x00, 0xff, 0x2a)) +style_btn_1.set_bg_grad_color(lv.color_make(0x00, 0xff, 0x2a)) +style_btn_1.set_bg_grad_dir(lv.GRAD_DIR.NONE) + +style_font_W_B_28 = lv.style_t() +style_font_W_B_28.init() +style_font_W_B_28.set_text_color(lv.color_make(0xff, 0xff, 0xff)) +style_font_W_B_28.set_text_font_v2("font_28.bin",28,0) +style_font_W_B_28.set_bg_color(lv.color_make(0x00, 0xff, 0x2a)) + factorymode_title = lv.label(factorymode_screen) -factorymode_title.set_pos(0, 5) -factorymode_title.set_size(128, 20) +factorymode_title.set_pos(0, 10) +factorymode_title.set_size(240, 40) factorymode_title.set_text("-工厂模式-") factorymode_title.set_long_mode(lv.label.LONG.WRAP) factorymode_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -42,16 +58,16 @@ factorymode_cont_style.set_pad_bottom(0) factorymode_cont = lv.obj(factorymode_screen) factorymode_cont.set_pos(0, 50) -factorymode_cont.set_size(128, 270) +factorymode_cont.set_size(240, 270) factorymode_cont.add_style(factorymode_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT) factorymode_location = lv.btn(factorymode_cont) factorymode_location.set_pos(0, factorymode_cont_y) -factorymode_location.set_size(128, 60) +factorymode_location.set_size(240, 60) factorymode_location_label = lv.label(factorymode_location) factorymode_location_label.set_text("定位测试") factorymode_location.set_style_pad_all(0, lv.STATE.DEFAULT) -factorymode_location_label.align(lv.ALIGN.LEFT_MID, 0, 0) +factorymode_location_label.align(lv.ALIGN.LEFT_MID, 70, 0) factorymode_location_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) factorymode_location_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) factorymode_location.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -59,15 +75,51 @@ factorymode_location.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) factorymode_cont_y+=60 factorymode_bat_test = lv.btn(factorymode_cont) factorymode_bat_test.set_pos(0, factorymode_cont_y) -factorymode_bat_test.set_size(128, 60) +factorymode_bat_test.set_size(240, 60) factorymode_bat_test_label = lv.label(factorymode_bat_test) factorymode_bat_test_label.set_text("电池测试") factorymode_bat_test.set_style_pad_all(0, lv.STATE.DEFAULT) -factorymode_bat_test_label.align(lv.ALIGN.LEFT_MID, 0, 0) +factorymode_bat_test_label.align(lv.ALIGN.LEFT_MID, 70, 0) factorymode_bat_test_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) factorymode_bat_test_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) factorymode_bat_test.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) +factorymode_cont_y+=60 +factorymode_hsensor_test = lv.btn(factorymode_cont) +factorymode_hsensor_test.set_pos(0, factorymode_cont_y) +factorymode_hsensor_test.set_size(240, 60) +factorymode_hsensor_test_label = lv.label(factorymode_hsensor_test) +factorymode_hsensor_test_label.set_text("心率测试") +factorymode_hsensor_test.set_style_pad_all(0, lv.STATE.DEFAULT) +factorymode_hsensor_test_label.align(lv.ALIGN.LEFT_MID, 70, 0) +factorymode_hsensor_test_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +factorymode_hsensor_test_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +factorymode_hsensor_test.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + +factorymode_cont_y+=60 +factorymode_log = lv.btn(factorymode_cont) +factorymode_log.set_pos(0, factorymode_cont_y) +factorymode_log.set_size(240, 60) +factorymode_log_label = lv.label(factorymode_log) +factorymode_log_label.set_text("日志") +factorymode_log.set_style_pad_all(0, lv.STATE.DEFAULT) +factorymode_log_label.align(lv.ALIGN.LEFT_MID, 70, 0) +factorymode_log_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +factorymode_log_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +factorymode_log.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + +# factorymode_cont_y+=200 +# factorymode_alipay_init = lv.btn(factorymode_cont) +# factorymode_alipay_init.set_pos(0, factorymode_cont_y) +# factorymode_alipay_init.set_size(240, 60) +# factorymode_alipay_init_label = lv.label(factorymode_alipay_init) +# factorymode_alipay_init_label.set_text("支付宝初始化") +# factorymode_alipay_init.set_style_pad_all(0, lv.STATE.DEFAULT) +# factorymode_alipay_init_label.align(lv.ALIGN.LEFT_MID, 70, 0) +# factorymode_alipay_init_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +# factorymode_alipay_init_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# factorymode_alipay_init.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + class FactoryModeScreen(Screen): NAME = "factorymode" @@ -75,8 +127,10 @@ class FactoryModeScreen(Screen): super().__init__() self.meta = factorymode_screen factorymode_location.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeLocation"})), lv.EVENT.CLICKED, None) + #factorymode_alipay_init.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeAlipayInit"})), lv.EVENT.CLICKED, None) factorymode_bat_test.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeBatTest"})), lv.EVENT.CLICKED, None) - + factorymode_hsensor_test.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeHsensorTest"})), lv.EVENT.CLICKED, None) + factorymode_log.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeLog"})), lv.EVENT.CLICKED, None) def done_return(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -86,16 +140,229 @@ class FactoryModeScreen(Screen): def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) +#显示txt日志 +FactoryModeLog_screen = lv.obj() +FactoryModeLog_screen.center() +FactoryModeLog_screen.set_size(240, 320) +FactoryModeLog_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + +FactoryModeLog_label_obj = lv.obj(FactoryModeLog_screen) +FactoryModeLog_label_obj.center() +FactoryModeLog_label_obj.set_size(240, 290) +FactoryModeLog_label_obj.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeLog_label_obj.set_pos(0, 0) + +FactoryModeLog_label = lv.label(FactoryModeLog_label_obj) +FactoryModeLog_label.set_text("") +FactoryModeLog_label.set_size(240, lv.SIZE.CONTENT) +FactoryModeLog_label.set_pos(0, 0) +FactoryModeLog_label.set_long_mode(lv.label.LONG.WRAP) +FactoryModeLog_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +FactoryModeLog_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +FactoryModeLogClean_btn = lv.btn(FactoryModeLog_screen) +FactoryModeLogClean_btn.set_pos(5, 290) +FactoryModeLogClean_btn.set_size(110, 30) +FactoryModeLogClean_btn.add_style(style_btn_1, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeLogClean_btn.set_style_pad_all(0, lv.STATE.DEFAULT) +FactoryModeLogClean_label = lv.label(FactoryModeLogClean_btn) +FactoryModeLogClean_label.set_text("清空日志") +FactoryModeLogClean_label.align(lv.ALIGN.CENTER, 0, 0) +FactoryModeLogClean_label.add_style(style_font_W_B_28, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeLogClean_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +FactoryModeLogClean_label.set_style_text_color(lv.color_make(0x16, 0x2c, 0xd4), lv.STATE.DEFAULT) +#FactoryModeLogClean_label.set_style_bg_color(lv.color_make(0x00, 0xff, 0x2a), lv.PART.MAIN | lv.STATE.DEFAULT) + +FactoryModeLogNext_btn = lv.btn(FactoryModeLog_screen) +FactoryModeLogNext_btn.set_pos(120, 290) +FactoryModeLogNext_btn.set_size(110, 30) +FactoryModeLogNext_btn.add_style(style_btn_1, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeLogNext_btn.set_style_pad_all(0, lv.STATE.DEFAULT) +FactoryModeLogNext_label = lv.label(FactoryModeLogNext_btn) +FactoryModeLogNext_label.set_text("下一页") +FactoryModeLogNext_label.align(lv.ALIGN.CENTER, 0, 0) +FactoryModeLogNext_label.add_style(style_font_W_B_28, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeLogNext_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +FactoryModeLogNext_label.set_style_text_color(lv.color_make(0x16, 0x2c, 0xd4), lv.STATE.DEFAULT) +#FactoryModeLogNext_label.set_style_bg_color(lv.color_make(0x00, 0xff, 0x2a), lv.PART.MAIN | lv.STATE.DEFAULT) +screen_log_len = 250 +class FactoryModeLogScreen(Screen): + NAME = "FactoryModeLog" + def __init__(self): + super().__init__() + self.meta = FactoryModeLog_screen + self.Log_timer_count = 0 + self.Log_timer = osTimer() + self.log_data = "" + self.log_count = 0 + FactoryModeLogClean_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.LogClean_cb(e)), lv.EVENT.CLICKED, None) + FactoryModeLogNext_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.LogNext_cb(e)), lv.EVENT.CLICKED, None) + def initialization(self): + print("FactoryModeLogScreen") + self.Log_timer.start(1000,1,self.Log_timer_cb) + with open("/ext/log.txt","r",encoding="utf-8") as fd: + self.log_data = fd.read() + print(self.log_data) + if len(self.log_data) < screen_log_len: + FactoryModeLog_label.set_text("第1页\n"+self.log_data) + else: + FactoryModeLog_label.set_text("第1页 {}/{}\n".format(self.log_count+1,0,len(self.log_data))+self.log_data[:screen_log_len]) + self.log_count = 0 + def post_processor_after_initialization(self): + pass + + def LogClean_cb(self,e): + self.log_data = "" + with open("/ext/log.txt","w",encoding="utf-8") as fd: + fd.write("") + + def LogNext_cb(self,e): + self.log_count += 1 + if self.log_count*screen_log_len > len(self.log_data): + if self.log_count != 1: + FactoryModeLog_label.set_text("末尾页\n".format(self.log_count+1)+self.log_data[(self.log_count-1)*screen_log_len:]) + self.log_count = 0 + else : + FactoryModeLog_label.set_text("第{}页 {}/{}\n".format(self.log_count+1,(self.log_count)*screen_log_len,len(self.log_data))+self.log_data[(self.log_count-1)*screen_log_len:(self.log_count)*screen_log_len]) + + def Log_timer_cb(self,e): + EventMesh.publish("system_sleep_rest")#防止黑屏 + + + def Close(self): + self.Log_timer.stop() + self.log_data = "" + pass + + def done_return(self): + EventMesh.publish("load_screen", {"screen": "factorymode"}) + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "factorymode"}) + + def btn8_press(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + +#hsensor测试 +FactoryModeHsensorTest_screen = lv.obj() +FactoryModeHsensorTest_screen.center() +FactoryModeHsensorTest_screen.set_size(240, 320) +FactoryModeHsensorTest_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + +FactoryModeHsensorTest_label = lv.label(FactoryModeHsensorTest_screen) +FactoryModeHsensorTest_label.set_text(" 佩戴状态") +FactoryModeHsensorTest_label.set_size(240, 260) +FactoryModeHsensorTest_label.set_pos(0, 0) +FactoryModeHsensorTest_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +FactoryModeHsensorTest_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + +FactoryModeHsensorCali_btn = lv.btn(FactoryModeHsensorTest_screen) +FactoryModeHsensorCali_btn.set_pos(5, 260) +FactoryModeHsensorCali_btn.set_size(110, 35) +FactoryModeHsensorCali_btn.add_style(style_btn_1, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeHsensorCali_btn.set_style_pad_all(0, lv.STATE.DEFAULT) +FactoryModeHsensorCali_label = lv.label(FactoryModeHsensorCali_btn) +FactoryModeHsensorCali_label.set_text("活体校准") +FactoryModeHsensorCali_label.align(lv.ALIGN.CENTER, 0, 0) +FactoryModeHsensorCali_label.add_style(style_font_W_B_28, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeHsensorCali_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +FactoryModeHsensorCali_label.set_style_text_color(lv.color_make(0x16, 0x2c, 0xd4), lv.STATE.DEFAULT) +#FactoryModeHsensorCali_label.set_style_bg_color(lv.color_make(0x00, 0xff, 0x2a), lv.PART.MAIN | lv.STATE.DEFAULT) + +FactoryModeHsensorLeakLight_btn = lv.btn(FactoryModeHsensorTest_screen) +FactoryModeHsensorLeakLight_btn.set_pos(120, 260) +FactoryModeHsensorLeakLight_btn.set_size(110, 35) +FactoryModeHsensorLeakLight_btn.add_style(style_btn_1, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeHsensorLeakLight_btn.set_style_pad_all(0, lv.STATE.DEFAULT) +FactoryModeHsensorLeakLight_label = lv.label(FactoryModeHsensorLeakLight_btn) +FactoryModeHsensorLeakLight_label.set_text("漏光检测") +FactoryModeHsensorLeakLight_label.align(lv.ALIGN.CENTER, 0, 0) +FactoryModeHsensorLeakLight_label.add_style(style_font_W_B_28, lv.PART.MAIN | lv.STATE.DEFAULT) +FactoryModeHsensorLeakLight_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +FactoryModeHsensorLeakLight_label.set_style_text_color(lv.color_make(0x16, 0x2c, 0xd4), lv.STATE.DEFAULT) +#FactoryModeHsensorLeakLight_label.set_style_bg_color(lv.color_make(0x00, 0xff, 0x2a), lv.PART.MAIN | lv.STATE.DEFAULT) + +class FactoryModeHsensorTestScreen(Screen): + NAME = "FactoryModeHsensorTest" + def __init__(self): + super().__init__() + self.meta = FactoryModeHsensorTest_screen + self.hsensorTest_timer_count = 0 + self.hsensorTest_timer = osTimer() + self.Hsensor = None + FactoryModeHsensorCali_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.HsensorCali_cb(e)), lv.EVENT.CLICKED, None) + FactoryModeHsensorLeakLight_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.HsensorLeakLight_cb(e)), lv.EVENT.CLICKED, None) + def initialization(self): + print("FactoryModeHsensorTestScreen") + self.hsensorTest_timer.start(1000,1,self.hsensorTest_timer_cb) + if self.Hsensor == None: + self.Hsensor = EventMesh.publish("get_Hsensor") + #EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN) + def post_processor_after_initialization(self): + pass + + def HsensorCali_cb(self,e): + print("打开校准模式") + self.Hsensor.set_sar(1) + self.Hsensor.open_test(255) #打开校准模式 + utime.sleep_ms(500) + self.Hsensor.open_heart() + self.hsensorTest_timer_count = 5 + + def HsensorLeakLight_cb(self,e): + print("打开漏光检测") + self.Hsensor.open_test(6) #打开漏光检测 + # utime.sleep_ms(500) + # self.Hsensor.open_heart() + self.hsensorTest_timer_count = 5 + + def hsensorTest_timer_cb(self,e): + + EventMesh.publish("system_sleep_rest")#防止黑屏 + w_data = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据 + + #print("FactoryModeHsensorTest{}".format(data)) + try: + c_data = self.Hsensor.get_test_data()#校准数据和工厂数据 + text_data = " 佩戴状态\n红外:{}活体:{}佩戴:{}\n{},{} \n{},{} \n{},{}\n校准数据:{},{},{},{}\n漏光数据:{},{},{}".format( + c_data[3],c_data[4],w_data,c_data[5],c_data[6],c_data[7],c_data[8],c_data[9],c_data[10], + c_data[11],c_data[12],c_data[13],c_data[14],c_data[0],c_data[1],c_data[2],) + FactoryModeHsensorTest_label.set_text(text_data) + #print("aaa:{},{},{}".format(c_data[9],c_data[13],c_data[14])) + except Exception as e: + FactoryModeHsensorTest_label.set_text("佩戴状态:\n{}".format(w_data)) + if(self.hsensorTest_timer_count != 0): + self.hsensorTest_timer_count -= 1 + if self.hsensorTest_timer_count == 0: + self.Hsensor.close() + self.Hsensor.init(); + + def Close(self): + self.hsensorTest_timer.stop() + #EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) + pass + + def done_return(self): + EventMesh.publish("load_screen", {"screen": "factorymode"}) + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "factorymode"}) + + def btn8_press(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + +#电池测试 FactoryModeBatTest_screen = lv.obj() FactoryModeBatTest_screen.center() -FactoryModeBatTest_screen.set_size(128, 128) +FactoryModeBatTest_screen.set_size(240, 320) FactoryModeBatTest_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) FactoryModeBatTest_label = lv.label(FactoryModeBatTest_screen) FactoryModeBatTest_label.set_text("Vbat:0V") -FactoryModeBatTest_label.set_size(128, 100) -FactoryModeBatTest_label.set_pos(0, 40) -FactoryModeBatTest_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) +FactoryModeBatTest_label.set_size(240, 100) +FactoryModeBatTest_label.set_pos(50, 100) FactoryModeBatTest_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) FactoryModeBatTest_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -133,12 +400,51 @@ class FactoryModeBatTestScreen(Screen): EventMesh.publish("load_screen", {"screen": "main_menu"}) - +# FactoryModeAlipayInit_screen = lv.obj() +# FactoryModeAlipayInit_screen.center() +# FactoryModeAlipayInit_screen.set_size(240, 320) +# FactoryModeAlipayInit_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + +# FactoryModeAlipayInit_label = lv.label(FactoryModeAlipayInit_screen) +# FactoryModeAlipayInit_label.set_text("支付宝初始化成功") +# FactoryModeAlipayInit_label.set_size(240, 100) +# FactoryModeAlipayInit_label.set_pos(50, 100) +# FactoryModeAlipayInit_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) +# FactoryModeAlipayInit_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# import atcmd + +# class FactoryModeAlipayInitScreen(Screen): +# NAME = "FactoryModeAlipayInit" +# def __init__(self): +# super().__init__() +# self.meta = FactoryModeAlipayInit_screen + +# def initialization(self): +# ret =EventMesh.publish("id2_clean_data") +# print("id2_clean_data:ret:{}".format(ret)) + +# def post_processor_after_initialization(self): +# resp=bytearray(50) +# atcmd.sendSync('AT+RSTSET\r\n',resp,'',200) #清nv +# print("AT+RSTSET:{}".format(resp)) +# utime.sleep(5) +# Power.powerRestart() +# def Close(self): +# pass + +# def done_return(self): +# EventMesh.publish("load_screen", {"screen": "factorymode"}) + +# def btn1_release(self): +# EventMesh.publish("load_screen", {"screen": "factorymode"}) + +# def btn8_press(self): +# EventMesh.publish("load_screen", {"screen": "main_menu"}) FactoryModeLocation_screen = lv.obj() print("FactoryModeLocation_screen") FactoryModeLocation_screen.center() -FactoryModeLocation_screen.set_size(128, 128) +FactoryModeLocation_screen.set_size(240, 320) FactoryModeLocation_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) # FactoryModeLocation_WIFI_label = lv.label(FactoryModeLocation_screen) @@ -157,7 +463,7 @@ FactoryModeLocation_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAU FactoryModeLocation_GNSS_label = lv.label(FactoryModeLocation_screen) FactoryModeLocation_GNSS_label.set_text("GNSS:\n") -FactoryModeLocation_GNSS_label.set_size(128, lv.SIZE.CONTENT) +FactoryModeLocation_GNSS_label.set_size(240, lv.SIZE.CONTENT) FactoryModeLocation_GNSS_label.set_pos(0, 0) FactoryModeLocation_GNSS_label.set_long_mode(lv.label.LONG.WRAP) FactoryModeLocation_GNSS_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) @@ -173,7 +479,7 @@ class FactoryModeLocationScreen(Screen): self.time_count = 0 self.time_GNSS = 0 self.GNSS_status = 0 - + self.timer_c = 0 def initialization(self): FactoryModeLocation_GNSS_label.set_text("GNSS:\n") # FactoryModeLocation_WIFI_label.set_text("WIFI:") diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py index 9b8ccb91..404efffe 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py @@ -15,8 +15,6 @@ import _thread from protocol import ProtoCol,UnicodeHexStr_To_Utf8Str import usys import log -LCD_X = 128 -LCD_Y = 128 Testlog = log.getLogger("WechatLog") log.set_output(usys.stdout) is_appwechat_log = 0 @@ -36,35 +34,19 @@ style_wechat_s_btn.init() style_wechat_s_btn.set_bg_color(lv.color_make(0xff, 0xff, 0xff)) style_wechat_s_btn.set_border_width(0) style_wechat_s_btn.set_shadow_opa(0) -style_wechat_s_btn.set_border_width(0) -style_wechat_s_btn.set_pad_left(0) -style_wechat_s_btn.set_pad_right(0) -style_wechat_s_btn.set_pad_top(0) -style_wechat_s_btn.set_pad_bottom(0) - style_common_bg_rect_btn_pressed = lv.style_t() style_common_bg_rect_btn_pressed.init() style_common_bg_rect_btn_pressed.set_bg_color(lv.color_make(0x1E, 0x26, 0xff)) -style_common_bg_rect_btn_pressed.set_bg_opa(200) +style_common_bg_rect_btn_pressed.set_bg_opa(100) style_common_bg_rect_btn_pressed.set_border_width(0) style_common_bg_rect_btn_pressed.set_shadow_opa(0) -style_common_bg_rect_btn_pressed.set_border_width(0) -style_common_bg_rect_btn_pressed.set_pad_left(0) -style_common_bg_rect_btn_pressed.set_pad_right(0) -style_common_bg_rect_btn_pressed.set_pad_top(0) -style_common_bg_rect_btn_pressed.set_pad_bottom(0) style_wechat_btn = lv.style_t() style_wechat_btn.init() style_wechat_btn.set_bg_color(lv.color_make(0x1E, 0x26, 0xff)) style_wechat_btn.set_border_width(0) style_wechat_btn.set_shadow_opa(0) -style_wechat_btn.set_border_width(0) -style_wechat_btn.set_pad_left(0) -style_wechat_btn.set_pad_right(0) -style_wechat_btn.set_pad_top(0) -style_wechat_btn.set_pad_bottom(0) # -------------------------------------------wechat screen---------------------------------------------------------- wechat_screen = lv.obj() @@ -74,69 +56,43 @@ wechat_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_screen_list_screen = lv.obj(wechat_screen) wechat_screen_list_screen.set_pos(0, 0) -wechat_screen_list_screen.set_size(LCD_X, 95) +wechat_screen_list_screen.set_size(240, 260) wechat_screen_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) wechat_screen_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_press_btn = lv.btn(wechat_screen) -wechat_press_btn.set_pos(10, 94) -wechat_press_btn.set_size(LCD_X-20, 30) +wechat_press_btn.set_pos(10, 264) +wechat_press_btn.set_size(220, 56) wechat_press_btn.add_style(style_wechat_btn, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_press_btn.add_style(style_common_bg_rect_btn_pressed, lv.PART.MAIN | lv.STATE.PRESSED) -wechat_press_btn.set_style_radius(33,0) +wechat_press_btn.set_style_radius(30,0) wechat_press_label = lv.label(wechat_screen) wechat_press_label.set_text("请按住说话") -wechat_press_label.set_size(LCD_X, 20) -wechat_press_label.set_pos(0,101) +wechat_press_label.set_size(240, 38) +wechat_press_label.set_pos(0,282) wechat_press_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) wechat_press_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_label = lv.label(wechat_screen_list_screen) -wechat_label.set_pos(0, 50) -wechat_label.set_size(LCD_X, 20) +wechat_label.set_pos(0, 140) +wechat_label.set_size(240, 40) wechat_label.set_long_mode(lv.label.LONG.WRAP) wechat_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) wechat_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_press_label_countdown = lv.label(wechat_screen_list_screen) -wechat_press_label_countdown.set_pos(0, 30) -wechat_press_label_countdown.set_size(LCD_X, 20) +wechat_press_label_countdown.set_pos(0, 100) +wechat_press_label_countdown.set_size(240, 40) wechat_press_label_countdown.set_text(" ") wechat_press_label_countdown.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_press_label_countdown.set_long_mode(lv.label.LONG.WRAP) wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# wechat_show_infor_obj = lv.obj(wechat_screen) -# wechat_show_infor_obj.set_pos(0, 5) -# wechat_show_infor_obj.set_size(LCD_X, 90) -# wechat_show_infor_obj.clear_flag(lv.obj.FLAG.HIDDEN) -# wechat_show_infor_obj.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -# wechat_show_infor_obj.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) -# wechat_pause_img = lv.img(wechat_show_infor_obj) -# wechat_pause_img.set_pos(44, 40) -# wechat_pause_img.set_size(40, 40) -# wechat_pause_img.set_src("U:/static/pause.png") -# wechat_pause_img.add_flag(lv.obj.FLAG.CLICKABLE) -# wechat_pause_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -# wechat_update_one = lv.label(wechat_show_infor_obj) -# wechat_update_one.set_pos(0, 5) -# wechat_update_one.set_size(LCD_X, 20) -# wechat_update_one.set_text("最近一条消息") -# wechat_update_one.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# wechat_update_one.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - -# wechat_update_label = lv.label(wechat_show_infor_obj) -# wechat_update_label.set_pos(0, 35) -# wechat_update_label.set_size(LCD_X, 45) -# wechat_update_label.set_text(" ") -# wechat_update_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# wechat_update_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -145,14 +101,14 @@ class WechatScreen(Screen): def __init__(self): super().__init__() - self.MXA_MSG = 5 + self.MXA_MSG = 10 self.wechat_recode_list = {} self.wechat_num = 0 self.volum_size = 8 self.msg_tmp = "" - check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json") + check_txt = ql_fs.path_exists("/ext/static/storage_file/wechat_record.json") if check_txt == True : - with open("/usr/static/storage_file/wechat_record.json","r") as fd:#音频文件编号 + with open("/ext/static/storage_file/wechat_record.json","r") as fd:#音频文件编号 self.wechat_recode_list = ujson.load(fd) if not self.wechat_recode_list: self.wechat_recode_list = {"num":0} @@ -163,7 +119,7 @@ class WechatScreen(Screen): self.wechat_num = self.wechat_recode_list["num"] else : self.wechat_recode_list = {"num":0} - with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: + with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) # if self.wechat_num != 0: # with open("/ext/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录 @@ -194,7 +150,7 @@ class WechatScreen(Screen): self.check_json = 0 self.wechat_list = lv.obj(wechat_screen_list_screen) self.wechat_list.set_pos(0, 0) - self.wechat_list.set_size(128, 96) + self.wechat_list.set_size(240, 261) self.wechat_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.wechat_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) self.wechat_list.set_flex_flow(lv.FLEX_FLOW.COLUMN)#自动排成一列对齐 @@ -266,7 +222,7 @@ class WechatScreen(Screen): self.MXA_MSG = msg[0] self.wechat_recode_list = msg[1] self.wechat_num = self.wechat_recode_list["num"] - with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: + with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) #写编号 Wechat_log("set_wechat_data2:{} ".format(self.wechat_num)) @@ -329,32 +285,32 @@ class WechatScreen(Screen): #Wechat_log("wechat_list_dict:num:{}".format(self.wechat_list_dict[i]["num"])) value = self.wechat_recode_list[key] - self.startY = 27*i + self.startY = 64*i if value.find("S:") != -1 or value.find("R:") != -1: self.msg_tmp = value[2:] self.msg_tmp = int(self.msg_tmp) - self.startWidth = 55+self.msg_tmp*2 + self.startWidth = 55+self.msg_tmp*10 elif value.find("T:") != -1:#文字显示 self.msg_tmp = value[2:] - self.startWidth = 118 + self.startWidth = 230 #wechat_btn = lv.btn(self.wechat_list) # if value.find("R:") != -1:self.wechat_list_dict[i] - self.wechat_list_dict[i]["wechat_obj"].set_size(128,lv.SIZE.CONTENT) + self.wechat_list_dict[i]["wechat_obj"].set_size(240,lv.SIZE.CONTENT) if value.find("R:") != -1 or value.find("T:") != -1 :#显示文字: if value.find("T:") != -1: self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,lv.SIZE.CONTENT) else: - self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,25) + self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,62) self.wechat_list_dict[i]["wechat_btn"].set_pos(10,0 ) #self.wechat_list_dict[i]["wechat_btn"].add_style(style_wechat_s_btn, lv.PART.MAIN | lv.STATE.DEFAULT) self.wechat_list_dict[i]["wechat_btn"].set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT) elif value.find("S:") != -1 : - self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,25) - self.wechat_list_dict[i]["wechat_btn"].set_pos(118-self.startWidth,0 ) + self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,62) + self.wechat_list_dict[i]["wechat_btn"].set_pos(230-self.startWidth,0 ) #for k in range(100): #self.wechat_list_dict[i]["wechat_btn"].add_style(style_wechat_r_btn, lv.PART.MAIN | lv.STATE.DEFAULT) self.wechat_list_dict[i]["wechat_btn"].set_style_bg_color(lv.color_make(0x00, 0xff, 0x2a), lv.PART.MAIN | lv.STATE.DEFAULT) @@ -370,8 +326,8 @@ class WechatScreen(Screen): self.wechat_list_dict[i]["_btn_label1"].set_pos(self.startWidth-78, 18) self.wechat_list_dict[i]["_btn_label1"].set_text(str(self.msg_tmp)+'\"') elif value.find("T:") != -1: - self.wechat_list_dict[i]["_btn_label1"].set_size(104, lv.SIZE.CONTENT) - self.wechat_list_dict[i]["_btn_label1"].set_pos(5, 0) + self.wechat_list_dict[i]["_btn_label1"].set_size(216, lv.SIZE.CONTENT) + self.wechat_list_dict[i]["_btn_label1"].set_pos(0, 0) print("self.msg_tmp:{}".format(self.msg_tmp)) self.msg_tmp = self.msg_tmp.replace(':',':\n',1) print("self.msg_tmp:{}".format(self.msg_tmp)) @@ -388,13 +344,13 @@ class WechatScreen(Screen): self.wechat_list_dict[i]["_btn_label2"].set_text('T:'+key) if value.find("R:") != -1 or value.find("S:") != -1: #_btn_img = lv.img(wechat_btn) - self.wechat_list_dict[i]["_btn_img"].set_size(15, 15) + self.wechat_list_dict[i]["_btn_img"].set_size(30, 30) if value.find("R:") != -1: - self.wechat_list_dict[i]["_btn_img"].set_pos(10, 5) - self.wechat_list_dict[i]["_btn_img"].set_src("U:/static/R_3.png") + self.wechat_list_dict[i]["_btn_img"].set_pos(5, 10) + self.wechat_list_dict[i]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png") elif value.find("S:") != -1: - self.wechat_list_dict[i]["_btn_img"].set_pos(self.startWidth-20, 5) - self.wechat_list_dict[i]["_btn_img"].set_src("U:/static/S_3.png") + self.wechat_list_dict[i]["_btn_img"].set_pos(self.startWidth-50, 10) + self.wechat_list_dict[i]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png") #self.wechat_list_dict[i]["_btn_img"].add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) self.wechat_list_dict[i]["_btn_img"].clear_flag(lv.obj.FLAG.HIDDEN) else : @@ -415,7 +371,7 @@ class WechatScreen(Screen): #按下录音 def talking(self,e): if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机 - print("talking1") + Wechat_log("talking1") self.play_timer.stop() self.aud.stop() self.wechat_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏列表选项方框 @@ -433,13 +389,13 @@ class WechatScreen(Screen): self.wechat_num += 1 self.wechat_show = self.wechat_num self.wechat_recode_list["num"] = self.wechat_num - print("talking1.0") - self.record_test.start("/usr/static/storage_file/{}.amr".format(self.wechat_num),16) + Wechat_log("talking1.0") + self.record_test.start("/ext/static/storage_file/{}.amr".format(self.wechat_num),16) self.second_timer.start(1000, 1, self.reduce_second) self.press_state = 1 self.ble_send = 1 #松开发送 - print("talking2") + Wechat_log("talking2") else: EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"}) @@ -497,10 +453,10 @@ class WechatScreen(Screen): ##隐藏显示文本 显示列表显示框 EventMesh.publish("publish_message_event_ui",{"func":self.updata_list_show,"data":2}) self.timer.start(200, 0, self.hide_label) - with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd: + with open("/ext/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) Wechat_log("send wechat data!!!!!!!!!!!!!!!!!!!!!") - path = "/usr/static/storage_file/{}.amr".format(self.wechat_show) + path = "/ext/static/storage_file/{}.amr".format(self.wechat_show) with open(path,"rb") as fd: buf = bytearray(ql_fs.path_getsize(path)) fd.readinto(buf) @@ -528,9 +484,9 @@ class WechatScreen(Screen): text = self.wechat_list_dict[self.paay_btn_count]["_btn_label2"].get_text() self.play_text = text[0:2] #区分左右喇叭动画显示 "R":左边 "S:"右边 "T:":左边 if self.play_text == "R:": - self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/R_{}.png".format(self.count_img)) + self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/R_{}.png".format(self.count_img)) elif self.play_text == "S:": - self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/S_{}.png".format(self.count_img)) + self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/S_{}.png".format(self.count_img)) self.sec_num+=1 if self.sec_num % 2 == 0: @@ -540,17 +496,17 @@ class WechatScreen(Screen): if self.play_sec == 0: self.play_timer.stop() if self.play_text == "R:": - self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/R_3.png") + self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png") elif self.play_text == "S:": - self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/S_3.png") + self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png") get_play = EventMesh.publish("get_audio_state") if get_play != None: if get_play == 0: self.play_timer.stop() if self.play_text == "R:": - self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/R_3.png") + self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png") elif self.play_text == "S:": - self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/S_3.png") + self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png") Wechat_log("play_img2") def play_label_cb(self,e): #lvgl按钮回调 Wechat_log("play_label_cb1") @@ -573,9 +529,9 @@ class WechatScreen(Screen): text = self.wechat_list_dict[self.paay_btn_old_count]["_btn_label2"].get_text() self.play_text = text[0:2] if self.play_text == "R:": - self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("U:/static/R_3.png") + self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png") elif self.play_text == "S:": - self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("U:/static/S_3.png") + self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png") self.count_img = 0 #喇叭动画显示的数量 @@ -604,7 +560,7 @@ class WechatScreen(Screen): if self.play_text == "R:" or self.play_text == "S:":#过滤掉文字显示 不需要播放音频文件 self.aud = audio.Audio(0) self.aud.stop()# - self.aud.play(1, 1, '/usr/static/storage_file/{}.amr'.format(i)) #文件名前面要加上路径 + self.aud.play(1, 1, '/ext/static/storage_file/{}.amr'.format(i)) #文件名前面要加上路径 self.paay_btn_old_count = self.paay_btn_count Wechat_log("play_label2") @@ -648,22 +604,17 @@ class WechatScreen(Screen): def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - - - #微聊弹窗 wechat_popup_screen = lv.obj() print("wechat_popup_screen") wechat_popup_screen.center() -wechat_popup_screen.set_size(128, 128) +wechat_popup_screen.set_size(240, 320) wechat_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_popup_title = lv.label(wechat_popup_screen) -wechat_popup_title.set_pos(0, 40) -wechat_popup_title.set_size(128, 40) +wechat_popup_title.set_pos(0, 150) +wechat_popup_title.set_size(240, 40) wechat_popup_title.set_text("你有新的微聊消息") wechat_popup_title.set_long_mode(lv.label.LONG.WRAP) wechat_popup_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -804,7 +755,7 @@ class TK_ProtoCol(ProtoCol): else: EventMesh.publish("wechat_updata_list_show") # path = "/ext/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num) - path = "/usr/static/storage_file/{}.amr".format(wechat_num) + path = "/ext/static/storage_file/{}.amr".format(wechat_num) with open(path,"w") as fd: arm = bytearray() j = 0 @@ -898,7 +849,4 @@ class MESSAGE_ProtoCol(ProtoCol): - - - diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/code.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/code.py index 3f9b53cf..c6e3a2a0 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/code.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/code.py @@ -29,8 +29,7 @@ def code_128_generate_barcode(screen, data, width=180, height=80): # 删除上次的container old_container = screen.get_child(-1) - if old_container: - old_container.delete() + old_container.add_flag(lv.obj.FLAG.HIDDEN) # 生成二进制码 binary_data = code128.encode(data) @@ -44,7 +43,7 @@ def code_128_generate_barcode(screen, data, width=180, height=80): container.set_pos(0, 33) container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) container.add_style(style_bar,lv.PART.MAIN | lv.STATE.DEFAULT) - + container.add_flag(lv.obj.FLAG.HIDDEN) # 计算每个条的宽度 bar_width = width // (len(binary_data)) # print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data))) @@ -62,6 +61,10 @@ def code_128_generate_barcode(screen, data, width=180, height=80): else: bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT) left_curr_line += real_width + container.clear_flag(lv.obj.FLAG.HIDDEN) + old_container.clear_flag(lv.obj.FLAG.HIDDEN) + if old_container: + old_container.delete() # if __name__ == "__main__": diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/constants.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/constants.py index 2fdc3fbd..ff4d2d23 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/constants.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/constants.py @@ -81,12 +81,23 @@ class PROTOCOL: WLKEY_SEND = "WLKEY_SEND" WLKEY_RECV = "WLKEY_RECV" - SILENCETIME2_SEND ="SILENCETIME2_SEND" + SILENCETIME2_SEND = "SILENCETIME2_SEND" SILENCETIME2_RECV = "SILENCETIME2_RECV" - KEYBRD_SEND ="KEYBRD_SEND" + KEYBRD_SEND = "KEYBRD_SEND" KEYBRD_RECV = "KEYBRD_RECV" + SILENCETIMEFS_SEND = "SILENCETIMEFS_SEND" + SILENCETIMEFS_RECV = "SILENCETIMEFS_RECV" + + BODYTEMP_SEND ="bodytemp_SEND" + BODYTEMP_RECV ="bodytemp_RECV" + + BODYTEMP2_SEND ="bodytemp2_SEND" + BODYTEMP2_RECV ="bodytemp2_RECV" + + BTEMP2_SEND ="btemp2_SEND" + BTEMP2_RECV ="btemp2_RECV" class EVENT: CHANNEL_SOCKET_SEND = "CHANNEL_SOCKET_SEND" @@ -121,8 +132,8 @@ class EVENT: SYSTEM_UP = "SYSTEM_UP" START_HEART = "START_HEART" GET_HEART = "GET_HEART" - GET_WEAR = "GET_WEAR" STOP_HEART = "STOP_HEART" + GET_WEAR = "GET_WEAR" START_TEMP = "START_TEMP" STOP_TEMP = "STOP_TEMP" GET_TEMP = "GET_TEMP" diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/lcd.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/lcd.py index f0569c3f..8de53053 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/lcd.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/lcd.py @@ -107,14 +107,14 @@ init_data = ( ) -XSTART_H = 0xf0+36 -XSTART_L = 0xf1+36 -YSTART_H = 0xf2+36 -YSTART_L = 0xf3+36 -XEND_H = 0xE0+36 -XEND_L = 0xE1+36 -YEND_H = 0xE2+36 -YEND_L = 0xE3+36 +XSTART_H = 0xf0 +XSTART_L = 0xf1 +YSTART_H = 0xf2 +YSTART_L = 0xf3 +XEND_H = 0xE0 +XEND_L = 0xE1 +YEND_H = 0xE2 +YEND_L = 0xE3 XSTART = 0xD0 XEND = 0xD1 @@ -241,8 +241,18 @@ style_screen.set_pad_bottom(0) style_font_youyuan_40 = lv.style_t() style_font_youyuan_40.init() style_font_youyuan_40.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -style_font_youyuan_40.set_text_font(lv.K01_font_16_ALL) -#style_font_youyuan_40.set_text_font_v2("font_40.bin",40,0) +style_font_youyuan_40.set_text_font_v2("font_40.bin",40,0) + +style_font_youyuan_black_40 = lv.style_t() +style_font_youyuan_black_40.init() +style_font_youyuan_black_40.set_text_color(lv.color_make(0x00, 0x00, 0x00)) +style_font_youyuan_black_40.set_text_font_v2("font_40.bin",40,0) + +style_font_youyuan_20_op = lv.style_t() +style_font_youyuan_20_op.init() +style_font_youyuan_20_op.set_text_color(lv.color_make(0xff, 0xff, 0xff)) +style_font_youyuan_20_op.set_text_font_v2("font_28.bin",28,0) + lcd.lcd_display_on() utime.sleep_ms(2) @@ -253,14 +263,15 @@ print("power_on_screen") power_on_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) power_on_label = lv.label(power_on_screen) +power_on_label.set_pos(0, 150) +power_on_label.set_size(240, 40) power_on_label.set_text("系统初始化中") -power_on_label.set_pos(0, 50) -power_on_label.set_size(128, 20) power_on_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -power_on_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) +power_on_label.add_style(style_font_youyuan_20_op, lv.PART.MAIN | lv.STATE.DEFAULT) print("power_on_screen init...") + lv.scr_load(power_on_screen) utime.sleep_ms(200) print("power_on_screen end...") diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_1.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_1.py index 8666de66..68ba3fff 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_1.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_1.py @@ -1,2 +1,2 @@ -from main_init import main_init -main_init() \ No newline at end of file +import main_init +main_init.main_init() \ No newline at end of file diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_init.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_init.py index 3134dff9..90f7a3c7 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_init.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/main_init.py @@ -2,6 +2,7 @@ import sms import atcmd import net import machine +import usys resp=bytearray(50) # atcmd.sendSync('AT+log=52,1\r\n',resp,'',200) # print("AT+log=52,1:{}".format(resp)) @@ -11,17 +12,22 @@ class App(object): self.managers = [] def append_manager(self, manager): - if isinstance(manager, Abstract): - manager.post_processor_after_instantiation() - self.managers.append(manager) + try: + if isinstance(manager, Abstract): + manager.post_processor_after_instantiation() + self.managers.append(manager) + except Exception as e: + usys.print_exception(e) return self def start(self): - for manager in self.managers: - manager.post_processor_before_initialization() - manager.initialization() - manager.post_processor_after_initialization() - + try: + for manager in self.managers: + manager.post_processor_before_initialization() + manager.initialization() + manager.post_processor_after_initialization() + except Exception as e: + usys.print_exception(e) class watchApp(App): def __init__(self): @@ -42,235 +48,285 @@ def main_init(): import uos import ql_fs import utime - res = uos.statvfs("/usr") + if ql_fs.path_exists("/ext") == False: + ldev = uos.VfsLfs1(32, 32, 32, "ext_fs",0,3) + uos.mount(ldev,'/ext') + res = uos.statvfs("/ext") res = list(res) - print('总usr空间:{} MB,剩余空间:{} MB'.format((((res[0] * res[2]) / 1024 / 1024)),((res[0] * res[3]) / 1024 / 1024))) - print("init1:{}".format(utime.localtime())) - import EventMesh + print('总ext空间:{} MB,剩余空间:{} MB'.format((((res[0] * res[2]) / 1024 / 1024)),((res[0] * res[3]) / 1024 / 1024))) + #print("init1:{}".format(utime.localtime())) - print("init2:{}".format(utime.localtime())) + import EventMesh + EventMesh.txt_log("power on............\n") + #print("init2:{}".format(utime.localtime())) from lcd import tp_cst816 - print("init3:{}".format(utime.localtime())) - + #print("init3:{}".format(utime.localtime())) + from ui_main_menu import MainMenuScreen # from ui_WatchFaceScreen import WatchFaceScreen - from appFactoryMode import FactoryModeLocationScreen,FactoryModeScreen ,FactoryModeBatTestScreen - import ui as _ui - - from mgr import cameraAlbumManager,setclassTimeManager,setkeyboardManager,testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\ + from appFactoryMode import FactoryModeLocationScreen,FactoryModeScreen ,FactoryModeBatTestScreen,FactoryModeHsensorTestScreen,FactoryModeLogScreen + from mgr import setCallStateManager,setclassTimeManager,setSmsIndexManager,ConfigStoreManager,testSmsSetIPManager,playPowerAudioManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\ AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager - + + import ui as _ui # import ui as _ui - print("init4:{}".format(utime.localtime())) - - - app = watchApp() - app.append_manager(getStorageDataManager()) + #print("init4:{}".format(utime.localtime())) ui = _ui.UI() ui.post_processor_after_instantiation() + app = watchApp() app.set_ui(ui) - - - ui.add_screen(_ui.SystemInitScreen()) - EventMesh.publish("load_screen", {"screen": "system_init"}) - print("init5:{}".format(utime.localtime())) - ui.add_screen(MainMenuScreen()) + try: + app.append_manager(getStorageDataManager()) + except Exception as e: + usys.print_exception(e) + try: + ui.add_screen(_ui.SystemInitScreen()) + EventMesh.publish("load_screen", {"screen": "system_init"}) + except Exception as e: + usys.print_exception(e) + #print("init5:{}".format(utime.localtime())) + try: + ui.add_screen(MainMenuScreen()) + ui.add_screen(_ui.PopupScreen()) + ui.add_screen(_ui.PhoneScreen()) + ui.add_screen(_ui.HeartrateScreen()) + except Exception as e: + usys.print_exception(e) + try: + import ui_setting as _ui_setting + ui.add_screen(_ui_setting.SettingScreen()) + ui.add_screen(_ui.ToolboxScreen()) + ui.add_screen(_ui.StepScreen()) + ui.add_screen(_ui.CountdownScreen()) + ui.add_screen(_ui.StopwatchScreen()) + ui.add_screen(_ui.WeatherScreen()) + ui.add_screen(_ui.Spo2Screen()) + ui.add_screen(_ui.TemperatureScreen()) + ui.add_screen(_ui.ContactsScreen()) + except Exception as e: + usys.print_exception(e) + try: + from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen + ui.add_screen(WechatScreen()) + from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen + from ui_health import HealthScreen + ui.add_screen(ClkListScreen()) + ui.add_screen(_ui.CountdownEndScreen()) + ui.add_screen(NewEditClk()) + ui.add_screen(CLKTimeScreen()) + ui.add_screen(ClkPeriod()) + except Exception as e: + usys.print_exception(e) + try: + # ui.add_screen(_ui_setting.LanguageScreen()) + ui.add_screen(_ui_setting.DialswitchScreen()) + # ui.add_screen(_ui.ThemeswitchScreen()) + ui.add_screen(_ui_setting.ImeiScreen()) + ui.add_screen(_ui_setting.AppScreen()) + ui.add_screen(_ui_setting.BrightnessScreen()) + ui.add_screen(_ui_setting.VolumeScreen()) + ui.add_screen(_ui_setting.RestoreScreen()) + ui.add_screen(_ui_setting.PoweroffScreen()) + ui.add_screen(_ui_setting.VersionScreen()) + ui.add_screen(_ui_setting.UpdateScreen()) + ui.add_screen(_ui_setting.AlarmvolumeScreen()) + ui.add_screen(_ui_setting.MsgvolumeScreen()) + ui.add_screen(_ui_setting.PhoneringScreen()) + ui.add_screen(_ui_setting.totalvolumeScreen()) + ui.add_screen(_ui_setting.PoweroffConfirmScreen()) + ui.add_screen(_ui_setting.PowerOnScreen()) + ui.add_screen(_ui.DialingScreen()) + ui.add_screen(_ui.CallLogScreen()) + except Exception as e: + usys.print_exception(e) + # try: + # from appAlipay import Alipay ,AlipayOpenScreen,Alipay_1_1,Alipay_invite,Alipay_inviting,\ + # Alipay_success,Alipay_paycode,Alipay_pay_success,Alipay_collect,Alipay_parent + # from appFactoryMode import FactoryModeAlipayInitScreen, + # ui.add_screen(AlipayOpenScreen()) + # ui.add_screen(Alipay_1_1()) + # ui.add_screen(Alipay_invite()) + # ui.add_screen(Alipay_inviting()) + # ui.add_screen(Alipay_success()) + # ui.add_screen(Alipay_paycode()) + # ui.add_screen(Alipay_pay_success()) + # ui.add_screen(Alipay_collect()) + # ui.add_screen(Alipay_parent()) + # ui.add_screen(FactoryModeAlipayInitScreen()) + # except Exception as e: + # usys.print_exception(e) + try: + ui.add_screen(_ui.UIFINDScreen()) + ui.add_screen(_ui.MsgDetailScreen()) + ui.add_screen(_ui.IncomingCallScreen()) + ui.add_screen(_ui.OnCallScreen()) + ui.add_screen(_ui.MessageFullScreen()) + # ui.add_screen(_ui.PowerOnScreen()) + except Exception as e: + usys.print_exception(e) + try: + ui.add_screen(FactoryModeLocationScreen()) + ui.add_screen(FactoryModeScreen()) + + ui.add_screen(FactoryModeBatTestScreen()) + ui.add_screen(FactoryModeHsensorTestScreen()) + ui.add_screen(FactoryModeLogScreen()) + ui.add_screen(PopupAlarmScreen()) + except Exception as e: + usys.print_exception(e) + try: + ui.add_screen(_ui.LowPowerScreen()) + ui.add_screen(_ui.NewMessageScreen()) + ui.add_screen(_ui.sosScreen()) + ui.add_screen(_ui.noSosDataScreen()) + ui.add_screen(_ui.NoSimScreen()) + ui.add_screen(_ui.NoSimPowerScreen()) + ui.add_screen(_ui.DialingNoPlayPopupScreen()) + ui.add_screen(_ui.NovaliedNumScreen()) + ui.add_screen(_ui.DialNoconnectPopupScreen()) + ui.add_screen(_ui.LowOnePowerScreen()) + ui.add_screen(_ui.RemoveMessageScreen()) + ui.add_screen(_ui.NoSimAutoScreen()) + ui.add_screen(_ui.chargefullScreen()) + ui.add_screen(_ui.chargeInScreen()) + ui.add_screen(_ui.chargeOutScreen()) + ui.add_screen(_ui.restore_confirmScreen()) - ui.add_screen(_ui.PopupScreen()) - ui.add_screen(_ui.PhoneScreen()) - ui.add_screen(_ui.HeartrateScreen()) - import ui_setting as _ui_setting - ui.add_screen(_ui_setting.SettingScreen()) - ui.add_screen(_ui.ToolboxScreen()) - ui.add_screen(_ui.StepScreen()) - ui.add_screen(_ui.CountdownScreen()) - ui.add_screen(_ui.StopwatchScreen()) - ui.add_screen(_ui.WeatherScreen()) - ui.add_screen(_ui.Spo2Screen()) - ui.add_screen(_ui.TemperatureScreen()) - ui.add_screen(_ui.ContactsScreen()) - from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen - ui.add_screen(WechatScreen()) - from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen - from ui_health import HealthScreen - ui.add_screen(ClkListScreen()) - ui.add_screen(_ui.CountdownEndScreen()) - ui.add_screen(NewEditClk()) - ui.add_screen(CLKTimeScreen()) - ui.add_screen(ClkPeriod()) - # ui.add_screen(_ui_setting.LanguageScreen()) - ui.add_screen(_ui_setting.PowerOnScreen()) - ui.add_screen(_ui_setting.DialswitchScreen()) - # ui.add_screen(_ui.ThemeswitchScreen()) - ui.add_screen(_ui_setting.ImeiScreen()) - ui.add_screen(_ui_setting.AppScreen()) - ui.add_screen(_ui_setting.BrightnessScreen()) - ui.add_screen(_ui_setting.VolumeScreen()) - ui.add_screen(_ui_setting.RestoreScreen()) - ui.add_screen(_ui_setting.PoweroffScreen()) - ui.add_screen(_ui_setting.VersionScreen()) - ui.add_screen(_ui_setting.UpdateScreen()) - ui.add_screen(_ui_setting.AlarmvolumeScreen()) - ui.add_screen(_ui_setting.MsgvolumeScreen()) - ui.add_screen(_ui_setting.PhoneringScreen()) - ui.add_screen(_ui_setting.totalvolumeScreen()) - ui.add_screen(_ui_setting.PoweroffConfirmScreen()) - ui.add_screen(_ui.DialingScreen()) - ui.add_screen(_ui.CallLogScreen()) - ui.add_screen(_ui.UIFINDScreen()) - ui.add_screen(_ui.MsgDetailScreen()) - ui.add_screen(_ui.IncomingCallScreen()) - ui.add_screen(_ui.OnCallScreen()) - ui.add_screen(_ui.MessageFullScreen()) - # ui.add_screen(_ui.PowerOnScreen()) - ui.add_screen(FactoryModeLocationScreen()) - ui.add_screen(FactoryModeScreen()) - ui.add_screen(FactoryModeBatTestScreen()) - ui.add_screen(PopupAlarmScreen()) - ui.add_screen(_ui.LowPowerScreen()) - ui.add_screen(_ui.NewMessageScreen()) - ui.add_screen(_ui.sosScreen()) - ui.add_screen(_ui.noSosDataScreen()) - ui.add_screen(_ui.NoSimScreen()) - ui.add_screen(_ui.NoSimPowerScreen()) - ui.add_screen(_ui.DialingNoPlayPopupScreen()) - ui.add_screen(_ui.NovaliedNumScreen()) - ui.add_screen(_ui.DialNoconnectPopupScreen()) - ui.add_screen(_ui.LowOnePowerScreen()) - ui.add_screen(_ui.wechatFailedScreen()) - ui.add_screen(_ui.NoSimAutoScreen()) - ui.add_screen(_ui.chargeInScreen()) - ui.add_screen(_ui.chargeOutScreen()) - ui.add_screen(_ui.RemoveMessageScreen()) - ui.add_screen(_ui.keyboardScreen()) - ui.add_screen(_ui.classMgrPopupScreen()) - ui.add_screen(_ui.calculatorScreen()) - ui.add_screen(_ui.cameraScreen()) - ui.add_screen(_ui.cameraalbumScreen()) - ui.add_screen(_ui.cameraVdieoScreen()) - ui.add_screen(_ui.albumPreviewScreen()) - ui.add_screen(_ui.cameraFullScreen()) - ui.add_screen(_ui.restore_confirmScreen()) - ui.add_screen(NewWechatPopupScreen()) - ui.add_screen(HealthScreen()) - # ui.add_screen(_ui.Setting3Screen()) - print("init6:{}".format(utime.localtime())) - - from protocol import WLKEY_ProtoCol,SILENCETIME2_ProtoCol,KEYBRD_ProtoCol,LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,CENTER_ProtoCol,UPLOAD_ProtoCol,\ - TEMP_ProtoCol,DLT_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,Time_ProtoCol,\ - ProtoColResolver,PHL_ProtoCol,MONITOR_ProtoCol,bootoff_ProtoCol,WDSTART_ProtoCol,LOWBAT_ProtoCol,sosHome_dial_ProtoCol,SockManager,NetManager - - import mgr as mgr - print("init7:{}".format(utime.localtime())) + ui.add_screen(NewWechatPopupScreen()) + ui.add_screen(HealthScreen()) + ui.add_screen(_ui.classMgrPopupScreen()) + # ui.add_screen(_ui.Setting3Screen()) + except Exception as e: + usys.print_exception(e) + #print("init6:{}".format(utime.localtime())) + try: + from protocol import btemp2_ProtoCol,bodytemp2_ProtoCol,TEMP_Hour_ProtoCol,SILENCETIMEFS_ProtoCol,KEYBRD_ProtoCol,SILENCETIME2_ProtoCol,WLKEY_ProtoCol,LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,CENTER_ProtoCol,UPLOAD_ProtoCol,\ + TEMP_ProtoCol,DLT_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,Time_ProtoCol,\ + ProtoColResolver,PHL_ProtoCol,MONITOR_ProtoCol,bootoff_ProtoCol,WDSTART_ProtoCol,LOWBAT_ProtoCol,sosHome_dial_ProtoCol,SockManager,NetManager + import mgr as mgr + #print("init7:{}".format(utime.localtime())) + + #print("init8:{}".format(utime.localtime())) + + + #from ui_WatchFaceScreen import WatchFaceScreen + + + # from usr.test_sms import HRSTART_ProtoCol,getHrTimeManager,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,getBrightnessManager,\ + # getStorageDataManager + #print("init9:{}".format(utime.localtime())) + #from usr.ui_wechat import WechatScreen,TK_ProtoCol - print("init8:{}".format(utime.localtime())) - - - #from ui_WatchFaceScreen import WatchFaceScreen - - - # from test_sms import HRSTART_ProtoCol,getHrTimeManager,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,getBrightnessManager,\ - # getStorageDataManager - print("init9:{}".format(utime.localtime())) - #from usr.ui_wechat import WechatScreen,TK_ProtoCol + #print("init10:{}".format(utime.localtime())) + - print("init10:{}".format(utime.localtime())) + EventMesh.publish("load_screen", {"screen": "poweron"})#开机画面 + app.append_manager(mgr.AlarmVolumeLevelManager()) \ + .append_manager(mgr.MsgVolumeLevelManager()) \ + .append_manager(mgr.PhoneVolumeLevelManager()) \ + .append_manager(mgr.DeviceInfoManager()) \ + .append_manager(mgr.BatteryManager()) \ + + # .append_manager(mgr.StopwatchManager()) \ + # .append_manager(mgr.CountdownManager()) \ + app.append_manager(playPowerAudioManager()) + #app.append_manager(Alipay()) + app.append_manager(ConfigStoreManager()) + app.append_manager(NetManager()) + app.append_manager(LocationManager()) + app.append_manager(AddrBookManager()) + app.append_manager(mgr.MsgManager()) + app.append_manager(MsgdetailManager()) + app.append_manager(mgr.CallLogManager()) + app.append_manager(mgr.getWeatherDataManager()) + app.append_manager(PhoneCallingManager()) + app.append_manager(ClockManager()) + app.append_manager(gethistoryDataManager()) + app.append_manager(getHrTimeManager()) + app.append_manager(getBrightnessManager()) + except Exception as e: + usys.print_exception(e) + try: + app.append_manager(getUpLoadDataManager()) + app.append_manager(getVolumSizeManager()) + app.append_manager(getTempTimeManager()) + app.append_manager(getplayAudiodStateManager()) + app.append_manager(getLowBatManager()) + app.append_manager(getBootOffManager()) + app.append_manager(getOldTimeManager()) + app.append_manager(getSosFlagManager()) + app.append_manager(CountdownManager()) + app.append_manager(sosInfoCallManager()) + app.append_manager(testSmsSetIPManager()) + app.append_manager(setSmsIndexManager()) + app.append_manager(setclassTimeManager()) + app.append_manager(setCallStateManager()) + except Exception as e: + usys.print_exception(e) + #print("init21:{}".format(utime.localtime())) + #print("init11:{}".format(utime.localtime())) + try: + pcr = ProtoColResolver() + pcr.add_support(LK_ProtoCol()) + pcr.add_support(PING_ProtoCol()) + pcr.add_support(KA_ProtoCol()) + pcr.add_support(UD_ProtoCol()) + pcr.add_support(CR_ProtoCol()) + pcr.add_support(FIND_ProtoCol()) + pcr.add_support(POWEROFF_ProtoCol()) + pcr.add_support(PHL_ProtoCol()) + pcr.add_support(TK_ProtoCol()) + pcr.add_support(MESSAGE_ProtoCol()) + pcr.add_support(WT_ProtoCol()) + pcr.add_support(REMIND_ProtoCol()) + pcr.add_support(HRSTART_ProtoCol()) + pcr.add_support(HEART_ProtoCol()) + pcr.add_support(OXYGEN_ProtoCol()) + pcr.add_support(OXYGEN_One_ProtoCol()) + pcr.add_support(TEMP_ProtoCol()) + pcr.add_support(DLT_ProtoCol()) + pcr.add_support(UPLOAD_ProtoCol()) + pcr.add_support(MONITOR_ProtoCol()) + # pcr.add_support(CENTER_ProtoCol()) + pcr.add_support(CENTER_ProtoCol()) + pcr.add_support(bootoff_ProtoCol()) + pcr.add_support(WDSTART_ProtoCol()) + pcr.add_support(LOWBAT_ProtoCol()) + pcr.add_support(sosHome_dial_ProtoCol()) + pcr.add_support(Time_ProtoCol()) + pcr.add_support(WLKEY_ProtoCol()) + pcr.add_support(KEYBRD_ProtoCol()) + pcr.add_support(SILENCETIME2_ProtoCol()) + pcr.add_support(SILENCETIMEFS_ProtoCol()) + pcr.add_support(TEMP_Hour_ProtoCol()) + pcr.add_support(bodytemp2_ProtoCol()) + pcr.add_support(btemp2_ProtoCol()) + except Exception as e: + usys.print_exception(e) + try: + sm = SockManager() + sm.add_support_resolver(pcr) + app.append_manager(sm) + #print("init11.0:{}".format(utime.localtime())) + app.start() + sms_data = sms.getSaveLoc() + if(sms_data != -1): + sms_lacv = sms_data[0][0] + if sms_lacv != 'SM':#每次开机设置一下短信的存储位置 + sms.setSaveLoc('SM', 'SM', 'SM') + #print("init12:{}".format(utime.localtime())) + timer_t = net.nitzTime() + print("timer_t:{}".format(timer_t)) + if(timer_t != -1): + timeSecond = int(timer_t[1]) + if timeSecond != 0: + next_alarm_time = utime.localtime(timeSecond) + machine.RTC().datetime((next_alarm_time[0],next_alarm_time[1],next_alarm_time[2],next_alarm_time[6],next_alarm_time[3],next_alarm_time[4],next_alarm_time[5],0)) + except Exception as e: + usys.print_exception(e) - app.append_manager(mgr.AlarmVolumeLevelManager()) \ - .append_manager(mgr.MsgVolumeLevelManager()) \ - .append_manager(mgr.PhoneVolumeLevelManager()) \ - .append_manager(mgr.DeviceInfoManager()) \ - .append_manager(mgr.BatteryManager()) \ - - # .append_manager(mgr.StopwatchManager()) \ - # .append_manager(mgr.CountdownManager()) \ - - app.append_manager(setkeyboardManager()) - app.append_manager(ConfigStoreManager()) - app.append_manager(NetManager()) - app.append_manager(LocationManager()) - app.append_manager(AddrBookManager()) - app.append_manager(mgr.MsgManager()) - app.append_manager(MsgdetailManager()) - app.append_manager(mgr.CallLogManager()) - app.append_manager(mgr.getWeatherDataManager()) - app.append_manager(PhoneCallingManager()) - app.append_manager(ClockManager()) - app.append_manager(gethistoryDataManager()) - app.append_manager(getHrTimeManager()) - app.append_manager(getBrightnessManager()) - app.append_manager(getUpLoadDataManager()) - app.append_manager(getVolumSizeManager()) - app.append_manager(getTempTimeManager()) - app.append_manager(getplayAudiodStateManager()) - app.append_manager(getLowBatManager()) - app.append_manager(getBootOffManager()) - app.append_manager(getOldTimeManager()) - app.append_manager(getSosFlagManager()) - app.append_manager(CountdownManager()) - app.append_manager(sosInfoCallManager()) - app.append_manager(testSmsSetIPManager()) - app.append_manager(setclassTimeManager()) - app.append_manager(cameraAlbumManager()) - - print("init21:{}".format(utime.localtime())) - - print("init11:{}".format(utime.localtime())) - pcr = ProtoColResolver() - pcr.add_support(LK_ProtoCol()) - pcr.add_support(PING_ProtoCol()) - pcr.add_support(KA_ProtoCol()) - pcr.add_support(UD_ProtoCol()) - pcr.add_support(CR_ProtoCol()) - pcr.add_support(FIND_ProtoCol()) - pcr.add_support(POWEROFF_ProtoCol()) - pcr.add_support(PHL_ProtoCol()) - pcr.add_support(TK_ProtoCol()) - pcr.add_support(MESSAGE_ProtoCol()) - pcr.add_support(WT_ProtoCol()) - pcr.add_support(REMIND_ProtoCol()) - pcr.add_support(HRSTART_ProtoCol()) - pcr.add_support(HEART_ProtoCol()) - pcr.add_support(OXYGEN_ProtoCol()) - pcr.add_support(OXYGEN_One_ProtoCol()) - pcr.add_support(TEMP_ProtoCol()) - pcr.add_support(DLT_ProtoCol()) - pcr.add_support(UPLOAD_ProtoCol()) - pcr.add_support(MONITOR_ProtoCol()) - # pcr.add_support(CENTER_ProtoCol()) - pcr.add_support(CENTER_ProtoCol()) - pcr.add_support(bootoff_ProtoCol()) - pcr.add_support(WDSTART_ProtoCol()) - pcr.add_support(LOWBAT_ProtoCol()) - pcr.add_support(sosHome_dial_ProtoCol()) - pcr.add_support(Time_ProtoCol()) - pcr.add_support(KEYBRD_ProtoCol()) - pcr.add_support(SILENCETIME2_ProtoCol()) - pcr.add_support(WLKEY_ProtoCol()) - EventMesh.publish("load_screen", {"screen": "poweron"}) - sm = SockManager() - sm.add_support_resolver(pcr) - app.append_manager(sm) - print("init11.0:{}".format(utime.localtime())) - app.start() - sms_data = sms.getSaveLoc() - if(sms_data != -1): - sms_lacv = sms_data[0][0] - if sms_lacv != 'SM':#每次开机设置一下短信的存储位置 - sms.setSaveLoc('SM', 'SM', 'SM') - print("init12:{}".format(utime.localtime())) - timer_t = net.nitzTime() - print("timer_t:{}".format(timer_t)) - if(timer_t != -1): - timeSecond = int(timer_t[1]) - if timeSecond != 0: - next_alarm_time = utime.localtime(timeSecond) - machine.RTC().datetime((next_alarm_time[0],next_alarm_time[1],next_alarm_time[2],next_alarm_time[6],next_alarm_time[3],next_alarm_time[4],next_alarm_time[5],0)) - - - diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py index de28d8f9..d42031da 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py @@ -458,7 +458,7 @@ class ConfigStoreManager(Abstract): """ def __init__(self): - self.file_name = "//conf_store.json" + self.file_name = "/ext/conf_store.json" self.lock = Lock() self.map = dict() @@ -518,6 +518,22 @@ class sosInfoCallManager(Abstract): num_len = len(number)+2 # print("number:{} number_len :{} num:{} num_len:{}".format(number,len(number),num,num_len)) if num > num_len : + if len(number) == 1: + number1 = str(number[0]) + sms.sendPduMsg(number1, '我需要你的帮助', 'UCS2') + elif len(number) == 2: + number1 = str(number[0]) + sms.sendPduMsg(number1, '我需要你的帮助', 'UCS2') + + number2 = str(number[1]) + sms.sendPduMsg(number2, '我需要你的帮助', 'UCS2') + elif len(number) == 3: + number1 = str(number[0]) + sms.sendPduMsg(number1, '我需要你的帮助', 'UCS2') + number2 = str(number[1]) + sms.sendPduMsg(number2, '我需要你的帮助', 'UCS2') + number3 = str(number[2]) + sms.sendPduMsg(number3, '我需要你的帮助', 'UCS2') EventMesh.publish("set_sos_flag",0) EventMesh.publish("set_sos_num",0) else: @@ -560,6 +576,7 @@ def voice_callback(args): if b == True and size_len > 11: tmp = tmp[size_len-11:] + EventMesh.publish("set_call_state",2)#设置关机时间 EventMesh.publish("load_screen", {"screen": "incoming_call","meta":str(tmp)}) elif args[0] == 11: @@ -577,6 +594,7 @@ def voice_callback(args): b = tmp[0].isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了 if b == True and size_len > 11: tmp = tmp[size_len-11:] + EventMesh.publish("set_call_state",1)#设置关机时间 EventMesh.publish("load_screen", {"screen": "on_call","meta":str(tmp)}) elif args[0] == 12: @@ -596,12 +614,13 @@ def voice_callback(args): EventMesh.publish("set_sos_info_call") print('voicecall disconnect end') + EventMesh.publish("set_call_state",0)#设置关机时间 elif args[0] == 13: print('voicecall is waiting, PhoneNO.: ', args[6]) elif args[0] == 14: - + EventMesh.publish("set_call_state",4)#设置关机时间 print('voicecall dialing, PhoneNO.: ', args[6]) EventMesh.publish("set_UI_high_priority",0) EventMesh.publish("load_screen", {"screen": "dialing"}) @@ -635,7 +654,7 @@ class DeviceInfoManager(Abstract): #self.battery_push_schedule = osTimer() self.check_battery_list = [] - + self.step = [0,0,0,0] self.timer_push=0 self.timer_push_tmp=60 @@ -685,6 +704,7 @@ class DeviceInfoManager(Abstract): self.log = LogAdapter(self.__class__.__name__) self.rtc = RTC() self.aud = audio.Audio(0) + print("DeviceInfoManager:1") self.gsensor = SC7A20() print("DeviceInfoManager:1.0") self.gsensor.activate() @@ -692,8 +712,23 @@ class DeviceInfoManager(Abstract): self.gsensor.init() print("DeviceInfoManager:2") self.gsensor.set_callback(self.gsensor_cb) - - + try : + self.hsensor = HX3918() + + except Exception as e: + print("Hsensor none HX3918:{}".format(e)) + try : + self.hsensor = GH3018() + except Exception as e: + print("Hsensor none GH3018:{}".format(e)) + # + self.hsensor.activate() + self.hsensor.init() + self.hsensor.close() + try : + self.hsensor.set_sar(1) + except Exception as e: + print("Hsensor none set_sar:{}".format(e)) self.old_temp_time = 0 # #print("hsensor.open_heart:%d\r\n"%(self.hsensor.open_heart())) print("DeviceInfoManager:3") @@ -755,6 +790,7 @@ class DeviceInfoManager(Abstract): #EventMesh.publish(constants.EVENT.START_HEART) # 设备开机立刻更新一次参数 self.publish_event_cb() + print("post_processor_after_instantiation:3") def publish_message_event_DeviceInfo(self,event,msg): @@ -800,193 +836,207 @@ class DeviceInfoManager(Abstract): :return: """ + try : + self.timer_push = self.timer_push+1 - self.timer_push = self.timer_push+1 - - #if self.timer_push > 10 : - # EventMesh.publish("time", self.get_time()) - # EventMesh.publish("battery", self.get_battery()) - # EventMesh.publish("signal", self.get_signal()) - - self.timer_push = 0 - date_tmp = utime.localtime() - time_tmp = utime.mktime(date_tmp) - # print("date_tmp......01....{} time_tmp:{}\r\n".format(date_tmp,time_tmp)) - EventMesh.publish("countdown_end_cb") - """定时检查是否关闭gps失败""" - # gnss_state = quecgnss.get_state() - # get_location_flag = EventMesh.publish("get_location_flag") - # if get_location_flag != None: - # # if gnss_state == 2 and get_location_flag == 0: - # # EventMesh.publish(constants.EVENT.GPSCLOSE) - # if(get_location_flag == 0): - # EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.UD_SEND) #开始UD定位 - - """7分钟一次心跳""" - if math.fabs(time_tmp - self.KA_time) > 7*60: #7分钟一次心跳 - self.KA_time = time_tmp - EventMesh.publish(constants.PROTOCOL.KA_SEND) - - """定时定位""" - self.upload_time = EventMesh.publish("get_upload_data") - #print("self.upload_time:{} math.fabs(time_tmp - self.UD_time):{}".format(self.upload_time,math.fabs(time_tmp - self.UD_time))) - if self.upload_time != None : - if math.fabs(time_tmp - self.UD_time) > self.upload_time: #30分钟一次定位 - self.UD_time = time_tmp - status_tmp = self.gsensor.get_status()#获取运动次数 - #status_tmp = 4 - #EventMesh.txt_log("status_count:{}".format(status_tmp)) - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and status_tmp > 3 : - EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.UD_SEND) #开始UD定位 - self.gsensor.clean_status()#清除运动次数 - else : #关闭定位 - #EventMesh.txt_log("NO status") - print("NO status") - EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位 - EventMesh.publish(constants.EVENT.PUSH_STEP, self.get_step_count()) - - - """电池平均值""" - temp = Power.getVbatt() - - if self.bat_count < 10: - self.vbat_buf.append(temp) - self.bat_count += 1 - else: - for i in range(9): - self.vbat_buf[i] = self.vbat_buf[i+1] - self.vbat_buf[9] = temp - - curr_count = len(self.vbat_buf) - bat_total_value = 0 - for i in range(curr_count): - bat_total_value += self.vbat_buf[i] - - bat_total_value = bat_total_value//curr_count#一分钟更新一次电量 10个平均值 + #if self.timer_push > 10 : + # EventMesh.publish("time", self.get_time()) + # EventMesh.publish("battery", self.get_battery()) + # EventMesh.publish("signal", self.get_signal()) + + self.timer_push = 0 + date_tmp = utime.localtime() + time_tmp = utime.mktime(date_tmp) + # print("date_tmp......01....{} time_tmp:{}\r\n".format(date_tmp,time_tmp)) + + """电量小于20% 5分钟提醒一次""" + get_low_btn = EventMesh.publish("get_low_bat_btn")# + battery = EventMesh.publish("screen_get_battery") + # print("get_low_btn:{} self.bat_time:{}".format(get_low_btn,self.bat_time)) + if get_low_btn != None:#低电使能开关 + if get_low_btn == 1: + self.bat_time+=10 + # print("date_tmp:{} self.bat_time:{}".format(date_tmp,self.bat_time)) + + if self.bat_time > 5*60: + self.bat_time = 0 + if battery[1] <= 20 and battery[1] > 0 and battery[0] != "1": + EventMesh.publish("load_screen", {"screen": "LOW_POWER"}) + else: + self.bat_time = 0 - EventMesh.publish("set_curr_battery_level",bat_total_value) - # print("self.vbat_buf:{} curr_count :{} bat_total_value:{} temp:{}".format(self.vbat_buf,curr_count,bat_total_value,temp)) - - - bat_tmp = EventMesh.publish("screen_get_battery") - self.vbat_count+=10 - if self.vbat_count >= 60: - self.vbat_count = 0 - if bat_tmp != None: - bat_value = bat_tmp[1] - if bat_value <= 0: - EventMesh.publish("load_screen", {"screen": "LOW_ONE_POWER"}) - - - """"隔天清步数""" - hour = 0 - min = 0 - hour = date_tmp[3] - min = date_tmp[4] - old_Timesec = EventMesh.publish("get_old_time_data") - if old_Timesec != None: - data = RTC().datetime() - hour = data[4] - min = data[5] - next_alarm_time = utime.localtime(old_Timesec) - # print("data[5]:{} {} next_alarm_time:{} old_Timesec:{}".format(data[1],data[2],next_alarm_time,old_Timesec)) - month = next_alarm_time[1] - day = next_alarm_time[2] - if month != data[1] or day != data[2]: - step = EventMesh.publish("get_old_step_value") - if step > 0: - self.gsensor.reset_step() - EventMesh.publish("set_old_step_value",0) - - hr = EventMesh.publish("get_old_hr_data",) - if hr != 0: - EventMesh.publish("set_old_hr_data", 0) - - spo2 = EventMesh.publish("get_old_spo2_data") - if spo2 != 0: - EventMesh.publish("set_old_spo2_data", 0) - EventMesh.publish("set_old_time_data",time_tmp) - - if hour == 0:#清步数 - if min <= 1: - if self.clear_step == 0: + EventMesh.publish("countdown_end_cb") + """定时检查是否关闭gps失败""" + # gnss_state = quecgnss.get_state() + # get_location_flag = EventMesh.publish("get_location_flag") + # if get_location_flag != None: + # # if gnss_state == 2 and get_location_flag == 0: + # # EventMesh.publish(constants.EVENT.GPSCLOSE) + # if(get_location_flag == 0): + # EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.UD_SEND) #开始UD定位 + + """7分钟一次心跳""" + if math.fabs(time_tmp - self.KA_time) > 7*60: #7分钟一次心跳 + self.KA_time = time_tmp + EventMesh.publish(constants.PROTOCOL.KA_SEND) + + """定时定位""" + #EventMesh.publish("set_upload_data",3*60) + self.upload_time = EventMesh.publish("get_upload_data") + #print("self.upload_time:{} math.fabs(time_tmp - self.UD_time):{}".format(self.upload_time,math.fabs(time_tmp - self.UD_time))) + if self.upload_time != None : + if math.fabs(time_tmp - self.UD_time) > self.upload_time: #30分钟一次定位 + self.UD_time = time_tmp + status_tmp = self.gsensor.get_status()#获取运动次数 + #status_tmp = 4 + #EventMesh.txt_log("status_count:{}".format(status_tmp)) + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and status_tmp > 3 : + EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.UD_SEND) #开始UD定位 + self.gsensor.clean_status()#清除运动次数 + else : #关闭定位 + #EventMesh.txt_log("NO status") + print("NO status") + EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位 + EventMesh.publish(constants.EVENT.PUSH_STEP, self.get_step_count()) + except Exception as e: + usys.print_exception(e) + EventMesh.txt_log("publish_event1:".format(e)) + try : + """电池平均值""" + temp = Power.getVbatt() + if self.bat_count < 10: + self.vbat_buf.append(temp) + self.bat_count += 1 + else: + for i in range(9): + self.vbat_buf[i] = self.vbat_buf[i+1] + self.vbat_buf[9] = temp + curr_count = len(self.vbat_buf) + bat_total_value = 0 + for i in range(curr_count): + bat_total_value += self.vbat_buf[i] + bat_total_value = bat_total_value//curr_count#一分钟更新一次电量 10个平均值 + EventMesh.publish("set_curr_battery_level",bat_total_value) + # print("self.vbat_buf:{} curr_count :{} bat_total_value:{} temp:{}".format(self.vbat_buf,curr_count,bat_total_value,temp)) + bat_tmp = EventMesh.publish("screen_get_battery") + self.vbat_count+=10 + if self.vbat_count >= 60: + self.vbat_count = 0 + if bat_tmp != None: + bat_value = bat_tmp[1] + if bat_value <= 0 and battery[0] != "1": + + EventMesh.publish("load_screen", {"screen": "LOW_ONE_POWER"}) + except Exception as e: + usys.print_exception(e) + EventMesh.txt_log("publish_event2:".format(e)) + try : + """"隔天清步数""" + hour = 0 + min = 0 + hour = date_tmp[3] + min = date_tmp[4] + old_Timesec = EventMesh.publish("get_old_time_data") + if old_Timesec != None: + data = RTC().datetime() + hour = data[4] + min = data[5] + next_alarm_time = utime.localtime(old_Timesec) + # print("data[5]:{} {} next_alarm_time:{} old_Timesec:{}".format(data[1],data[2],next_alarm_time,old_Timesec)) + month = next_alarm_time[1] + day = next_alarm_time[2] + if month != data[1] or day != data[2]: step = EventMesh.publish("get_old_step_value") - EventMesh.publish("set_old_time_data",time_tmp) if step > 0: - EventMesh.publish("set_old_step_value",0) self.gsensor.reset_step() - hr = EventMesh.publish("get_old_hr_data") + EventMesh.publish("set_old_step_value",0) + + hr = EventMesh.publish("get_old_hr_data",) if hr != 0: EventMesh.publish("set_old_hr_data", 0) spo2 = EventMesh.publish("get_old_spo2_data") if spo2 != 0: EventMesh.publish("set_old_spo2_data", 0) - self.clear_step = 1 + EventMesh.publish("set_old_time_data",time_tmp) + if hour == 0:#清步数 + if min <= 1: + if self.clear_step == 0: + step = EventMesh.publish("get_old_step_value") + EventMesh.publish("set_old_time_data",time_tmp) + if step > 0: + EventMesh.publish("set_old_step_value",0) + self.gsensor.reset_step() + hr = EventMesh.publish("get_old_hr_data") + if hr != 0: + EventMesh.publish("set_old_hr_data", 0) + + spo2 = EventMesh.publish("get_old_spo2_data") + if spo2 != 0: + EventMesh.publish("set_old_spo2_data", 0) + self.clear_step = 1 + else: + if self.clear_step == 1: + self.clear_step = 0 else: if self.clear_step == 1: self.clear_step = 0 - else: - if self.clear_step == 1: - self.clear_step = 0 - - """电量小于20% 5分钟提醒一次""" - get_low_btn = EventMesh.publish("get_low_bat_btn")# - battery = EventMesh.publish("screen_get_battery") - # print("get_low_btn:{} self.bat_time:{}".format(get_low_btn,self.bat_time)) - if get_low_btn != None:#低电使能开关 - if get_low_btn == 1: - self.bat_time+=10 - # print("date_tmp:{} self.bat_time:{}".format(date_tmp,self.bat_time)) - - if self.bat_time > 5*60: - self.bat_time = 0 - if battery[1] <= 20 and battery[1] > 0: - EventMesh.publish("load_screen", {"screen": "LOW_POWER"}) - else: - self.bat_time = 0 - - """未联网提示关机""" - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机 - if battery[0] == "0": - self.no_smi_count+=10 - if self.no_smi_count > (15*60) and self.no_smi_state == 0: + + + + """未联网提示关机""" + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机 + if battery[0] == "0": + self.no_smi_count+=10 + if self.no_smi_count > (15*60) and self.no_smi_state == 0: + self.no_smi_count = 0 + self.no_smi_state = 1 + EventMesh.publish("load_screen", {"screen": "no_sim_auto_screen"}) + else: self.no_smi_count = 0 - self.no_smi_state = 1 - EventMesh.publish("load_screen", {"screen": "no_sim_auto_screen"}) + self.no_smi_state = 0 else: self.no_smi_count = 0 self.no_smi_state = 0 - else: - self.no_smi_count = 0 - self.no_smi_state = 0 - if battery[0] == "1": - if battery[1] >= 100: - if self.charge_full_count > 60 and self.charge_full_count % (60*10) == 0:#每十分钟提醒一次 - EventMesh.publish("load_screen", {"screen": "charge_full"}) - self.charge_full_count+=10 - else: - self.charge_full_count = 0 - - """检测短信已满,提示是否清掉""" - msg_nums = sms.getMsgNums() #获取短信条数 - if(msg_nums != -1): - sms_data = sms.getSaveLoc() - sms_max = sms_data[0][2] - if msg_nums >= sms_max-1: - self.sms_full_flag+=10 - if self.sms_full_flag >= 120: - self.sms_full_flag=0 - EventMesh.publish("load_screen", {"screen": "message_full"}) + if battery[0] == "1": + if battery[1] >= 100: + if self.charge_full_count > 60 and self.charge_full_count % (60*10) == 0:#每十分钟提醒一次 + EventMesh.publish("load_screen", {"screen": "charge_full"}) + self.charge_full_count+=10 else: - self.sms_full_flag = 0 + self.charge_full_count = 0 + + """检测短信已满,提示是否清掉""" + msg_nums = sms.getMsgNums() #获取短信条数 + if(msg_nums != -1): + sms_data = sms.getSaveLoc() + sms_max = sms_data[0][2] + if msg_nums >= sms_max-1: + self.sms_full_flag+=10 + if self.sms_full_flag >= 120: + self.sms_full_flag=0 + EventMesh.publish("load_screen", {"screen": "message_full"}) + else: + self.sms_full_flag = 0 + except Exception as e: + usys.print_exception(e) + EventMesh.txt_log("publish_event3:".format(e)) + """定时测量心率,血氧,体温""" WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据 + if WEAR == None : + WEAR = 0 self.get_hr_state = EventMesh.publish("get_hr_state") + if self.get_hr_state == None : + self.get_hr_state = 0 self.get_spo2_state = EventMesh.publish("get_spo2_state") + if self.get_spo2_state == None : + self.get_spo2_state = 0 get_temp_time = EventMesh.publish("get_temp_time") get_temp_state = EventMesh.publish("get_temp_state") + if get_temp_state == None : + get_temp_state = 0 hr_time = {} hr_time = EventMesh.publish("get_time_hr_spo2")#获取时间是否大于0 if get_temp_state != None : #突然脱腕 @@ -1000,7 +1050,7 @@ class DeviceInfoManager(Abstract): elif self.get_spo2_state > 1: EventMesh.publish("set_spo2_state",0)#2代表后台进入测试 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) - if 0: + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and battery[0] != "1" and WEAR == 1: # print("get_temp_time:{} self.temp_one_state:{}".format(get_temp_time,self.temp_one_state)) if get_temp_time != None:#定时测量体温 @@ -1032,15 +1082,22 @@ class DeviceInfoManager(Abstract): temp += 0.5 if temp < 25 or temp > 42: temp = 0 - tmp_f = str(temp).split('.')[0] - tmp_f_tmp = int(tmp_f) - + tmp_f_tmp = 0 + tmp_d_tmp = 0 + if str(temp).find(".") != -1: + tmp_f = str(temp).split('.')[0] + tmp_f_tmp = int(tmp_f) + + tmp_d = str(temp).split('.')[1][:1] + tmp_d_tmp = int(tmp_d) + else: + tmp_f_tmp = temp - tmp_d = str(temp).split('.')[1][:1] - tmp_d_tmp = int(tmp_d) if temp != 0: EventMesh.publish("set_history_temp_value",temp) EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) + num = str(tmp_f_tmp)+"."+ str(tmp_d_tmp) + EventMesh.publish(constants.PROTOCOL.BTEMP2_SEND,[1,num]) EventMesh.publish(constants.EVENT.STOP_TEMP) print("AUTO temp:{} tmp_f:{} tmp_f_tmp:{} tmp_d:{} tmp_d_tmp:{}".format(temp,tmp_f,tmp_f_tmp,tmp_d,tmp_d_tmp)) EventMesh.publish("set_temp_state",0) @@ -1059,17 +1116,22 @@ class DeviceInfoManager(Abstract): temp += 0.5 if temp < 25 or temp > 42: temp = 0 - tmp_f = str(temp).split('.')[0] - tmp_f_tmp = int(tmp_f) - - - tmp_d = str(temp).split('.')[1][:1] - tmp_d_tmp = int(tmp_d) + tmp_f_tmp = 0 + tmp_d_tmp = 0 + if str(temp).find(".") != -1: + tmp_f = str(temp).split('.')[0] + tmp_f_tmp = int(tmp_f) + + tmp_d = str(temp).split('.')[1][:1] + tmp_d_tmp = int(tmp_d) + else: + tmp_f_tmp = temp if temp != None: if temp != 0: EventMesh.publish("set_history_temp_value",temp) EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) - EventMesh.publish("set_history_temp_value",temp) + num = str(tmp_f_tmp)+"."+ str(tmp_d_tmp) + EventMesh.publish(constants.PROTOCOL.BTEMP2_SEND,[1,num]) EventMesh.publish(constants.EVENT.STOP_TEMP) print("once temp:{} tmp_f:{} tmp_f_tmp:{} tmp_d:{} tmp_d_tmp:{}".format(temp,tmp_f,tmp_f_tmp,tmp_d,tmp_d_tmp)) EventMesh.publish("set_temp_state",0) @@ -1100,15 +1162,22 @@ class DeviceInfoManager(Abstract): temp += 0.5 if temp < 25 or temp > 42: temp = 0 - tmp_f = str(temp).split('.')[0] - tmp_f_tmp = int(tmp_f) - - tmp_d = str(temp).split('.')[1][:1] - tmp_d_tmp = int(tmp_d) + tmp_f_tmp = 0 + tmp_d_tmp = 0 + if str(temp).find(".") != -1: + tmp_f = str(temp).split('.')[0] + tmp_f_tmp = int(tmp_f) + + tmp_d = str(temp).split('.')[1][:1] + tmp_d_tmp = int(tmp_d) + else: + tmp_f_tmp = temp if temp != None: if temp != 0: EventMesh.publish("set_history_temp_value",temp) EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) + num = str(tmp_f_tmp)+"."+ str(tmp_d_tmp) + EventMesh.publish(constants.PROTOCOL.BTEMP2_SEND,[1,num]) EventMesh.publish(constants.EVENT.STOP_TEMP) print("AUTO once temp:{} tmp_f:{} tmp_f_tmp:{} tmp_d:{} tmp_d_tmp:{}".format(temp,tmp_f,tmp_f_tmp,tmp_d,tmp_d_tmp)) EventMesh.publish("set_temp_state",0) @@ -1433,17 +1502,24 @@ class DeviceInfoManager(Abstract): temp += 0.5 if temp < 25 or temp > 42: temp = 0 - - tmp_f = str(temp).split('.')[0] - tmp_f_tmp = int(tmp_f) + tmp_f_tmp = 0 + tmp_d_tmp = 0 + if str(temp).find(".") != -1: + tmp_f = str(temp).split('.')[0] + tmp_f_tmp = int(tmp_f) + + tmp_d = str(temp).split('.')[1][:1] + tmp_d_tmp = int(tmp_d) + else: + tmp_f_tmp = temp - tmp_d = str(temp).split('.')[1][:1] - tmp_d_tmp = int(tmp_d) EventMesh.publish("set_temp_state",0) if temp != None: if temp != 0: EventMesh.publish("set_history_temp_value",temp) EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) + num = str(tmp_f_tmp)+"."+ str(tmp_d_tmp) + EventMesh.publish(constants.PROTOCOL.BTEMP2_SEND,[1,num]) EventMesh.publish(constants.EVENT.STOP_TEMP) self.SENSOR_time = time_tmp self.HR_Onestate = 0 @@ -1675,43 +1751,62 @@ class DeviceInfoManager(Abstract): return self.connect def start_blood_oxygen(self, topic, msg): - pass + print("start_blood_oxygen!!!") + self.hsensor.open_blood_oxygen() def start_heart(self, topic, msg): - pass + print("start_heart!!!") + self.hsensor.open_heart() def stop_blood_oxygen(self, topic, msg): - pass + print("stop_blood_oxygen!!!") + self.hsensor.close() def stop_heart(self, topic, msg): - pass + print("stop_heart!!!") + self.hsensor.close() def get_blood_oxygen(self, topic, msg): - - return 0 + data = self.hsensor.get_all_data() + return data[1] def get_heart(self, topic, msg): - - return 0 + data = self.hsensor.get_all_data() + return data[0] def get_wear(self, topic, msg): - return 0 + return self.hsensor.get_wear() def get_Hsensor(self, topic, msg): - return 0 + return self.hsensor def Hsensor_set_sleep(self, topic, msg): - pass + self.hsensor.set_sleep() def start_temp(self, topic, msg): - pass + WHO_AM_I = bytearray([0x01, 0]) + I2C_SLAVE_ADDR = 0x49 + r_data = bytearray(2) + data = bytearray([0x61A0, 0]) # 唤醒 + return self.i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2) def stop_temp(self, topic, msg): - pass - + WHO_AM_I = bytearray([0x01, 0]) + I2C_SLAVE_ADDR = 0x49 + r_data = bytearray(2) + data = bytearray([0x60A0, 0]) #休眠 + return self.i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2) def get_temp(self, topic, msg): - - return 0 + WHO_AM_I = bytearray([0x00, 0]) + I2C_SLAVE_ADDR = 0x49 + r_data = bytearray(2) + self.i2c0.read(I2C_SLAVE_ADDR, WHO_AM_I, 1, r_data, 2, 0) + #print("temp_data:{}".format(r_data)) + temp_s = ((r_data[0]<<8) | (r_data[1]))>>4 + #print("temp_s:{}".format(temp_s)) + temp_data = temp_s * 0.0625 + #print("temp_data:{}".format(temp_data)) + return temp_data @@ -1733,19 +1828,16 @@ class DeviceInfoManager(Abstract): def usb_event_cb(self, state): status = state if status == 1:#拔出 - print("USB OUT") screen_NAME = EventMesh.publish("get_screen_NAME") if screen_NAME != None: if screen_NAME == "poweron" or screen_NAME == "system_init": return - bat_tmp = EventMesh.publish("screen_get_battery") if bat_tmp != None: if bat_tmp[0] == "1": EventMesh.publish("load_screen", {"screen": "charge_in"}) - pass + pass elif status == 0:#插入usb - print("USB IN") screen_NAME = EventMesh.publish("get_screen_NAME") if screen_NAME != None: if screen_NAME == "poweron" or screen_NAME == "system_init": @@ -1754,7 +1846,7 @@ class DeviceInfoManager(Abstract): if bat_tmp != None: if bat_tmp[0] == "0": EventMesh.publish("load_screen", {"screen": "charge_out"}) - EventMesh.publish("battery", self.get_battery()) + #EventMesh.publish("battery", self.get_battery()) def get_usb_state(self): state = self.usb.getStatus() @@ -2235,10 +2327,10 @@ class AddrBookManager(Abstract): def __init__(self): self.read_phonebook = {} self.check_json = 0 - self.check_json = ql_fs.path_exists("/usr/static/storage_file/phonebook.json") + self.check_json = ql_fs.path_exists("/ext/static/storage_file/phonebook.json") if self.check_json == True: - with open("/usr/static/storage_file/phonebook.json","r",encoding="utf-8") as fd: + with open("/ext/static/storage_file/phonebook.json","r",encoding="utf-8") as fd: self.read_phonebook = ujson.load(fd) print("读取电话本") @@ -2247,7 +2339,7 @@ class AddrBookManager(Abstract): EventMesh.subscribe("set_phonebook_list", self.set) def get(self, event, msg): - self.check_json = ql_fs.path_exists("/usr/static/storage_file/phonebook.json") + self.check_json = ql_fs.path_exists("/ext/static/storage_file/phonebook.json") return [self.check_json,self.read_phonebook] def set(self, event, msg): @@ -2295,9 +2387,11 @@ class MsgdetailManager(Abstract): def save_msg_name(self, event, msg): self.msg_name = str(msg) + print("save_msg_name:msg".format(msg)) def save_msg_content(self, event, msg): self.msg_content = str(msg) + print("save_msg_content:msg".format(msg)) def get_msg_content(self, event, msg): return self.msg_content @@ -2309,10 +2403,10 @@ class CallLogManager(Abstract): # 通话记录 def __init__(self): self.read_call_log = {} - self.check_json = ql_fs.path_exists("/usr/static/storage_file/Call_log.json") + self.check_json = ql_fs.path_exists("/ext/static/storage_file/Call_log.json") if self.check_json == True: - with open("/usr/static/storage_file/Call_log.json","r",encoding="utf-8") as fd: + with open("/ext/static/storage_file/Call_log.json","r",encoding="utf-8") as fd: self.read_call_log = ujson.load(fd) print("读取通话记录") @@ -2321,13 +2415,13 @@ class CallLogManager(Abstract): EventMesh.subscribe("set_call_log_list", self.set) def get(self, event, msg): - self.check_json = ql_fs.path_exists("/usr/static/storage_file/Call_log.json") + self.check_json = ql_fs.path_exists("/ext/static/storage_file/Call_log.json") return [self.check_json,self.read_call_log] def set(self, event, msg): self.check_json = msg[0] self.read_call_log = msg[1] - with open("/usr/static/storage_file/Call_log.json","w+",encoding="utf-8") as fd: + with open("/ext/static/storage_file/Call_log.json","w+",encoding="utf-8") as fd: ujson.dump(self.read_call_log,fd) # def call_usr(self,event,msg): # content = self.log[msg] @@ -2381,20 +2475,24 @@ class gethistoryDataManager(Abstract): self.oldstep = old_step - check_hr= ql_fs.path_exists("/usr/static/storage_file/history_hr.json") + check_hr= ql_fs.path_exists("/ext/static/storage_file/history_hr.json") if check_hr == True : - with open("/usr/static/storage_file/history_hr.json","r") as fd:#音频文件编号 + with open("/ext/static/storage_file/history_hr.json","r") as fd:#音频文件编号 self.read_histroy_hr_data = ujson.load(fd) - - check_temp= ql_fs.path_exists("/usr/static/storage_file/history_temp.json") + if self.read_histroy_hr_data == None: + self.read_histroy_hr_data = [] + check_temp= ql_fs.path_exists("/ext/static/storage_file/history_temp.json") if check_temp == True : - with open("/usr/static/storage_file/history_temp.json","r") as fd:#音频文件编号 + with open("/ext/static/storage_file/history_temp.json","r") as fd:#音频文件编号 self.read_histroy_temp_data = ujson.load(fd) - - check_spo2= ql_fs.path_exists("/usr/static/storage_file/history_spo2.json") + if self.read_histroy_temp_data == None: + self.read_histroy_temp_data = [] + check_spo2= ql_fs.path_exists("/ext/static/storage_file/history_spo2.json") if check_spo2 == True : - with open("/usr/static/storage_file/history_spo2.json","r") as fd:#音频文件编号 + with open("/ext/static/storage_file/history_spo2.json","r") as fd:#音频文件编号 self.read_histroy_spo2_data = ujson.load(fd) + if self.read_histroy_spo2_data == None: + self.read_histroy_spo2_data = [] self.temp_value = 0 # self.read_histroy_hr_data=[{"timeSec":16789890,"value":90},{"timeSec":16789888,"value":78},{"timeSec":16789688,"value":68},{"timeSec":16789898,"value":58},\ @@ -2447,12 +2545,15 @@ class gethistoryDataManager(Abstract): else: self.read_histroy_temp_data.append({"timeSec": time_tmp, "temp": self.temp_value}) - with open("/usr/static/storage_file/history_temp.json","w",encoding="utf-8") as fd: + with open("/ext/static/storage_file/history_temp.json","w",encoding="utf-8") as fd: ujson.dump(self.read_histroy_temp_data,fd) #print(self.read_histroy_temp_data) def get_history_hr_value(self, event, msg): #近7次心率历史数据统计显示 - return self.read_histroy_hr_data + if self.read_histroy_hr_data: + return self.read_histroy_hr_data + else : + return [] def set_history_hr_value(self, event, msg): pass @@ -2480,7 +2581,7 @@ class gethistoryDataManager(Abstract): self.read_histroy_hr_data.append({"timeSec": time_tmp, "hr": self.oldHr}) - with open("/usr/static/storage_file/history_hr.json","w",encoding="utf-8") as fd: + with open("/ext/static/storage_file/history_hr.json","w",encoding="utf-8") as fd: ujson.dump(self.read_histroy_hr_data,fd) #print(self.read_histroy_hr_data) @@ -2508,7 +2609,7 @@ class gethistoryDataManager(Abstract): else: self.read_histroy_spo2_data.append({"timeSec": time_tmp, "spo2": self.oldspo2}) - with open("/usr/static/storage_file/history_spo2.json","w",encoding="utf-8") as fd: + with open("/ext/static/storage_file/history_spo2.json","w",encoding="utf-8") as fd: ujson.dump(self.read_histroy_spo2_data,fd) #print(self.read_histroy_spo2_data) @@ -2619,13 +2720,19 @@ class getHrTimeManager(Abstract): self.set_hr = msg def get_hr_state(self, event, msg): - return self.set_hr + if self.set_hr: + return self.set_hr + else: + return 0 def set_spo2_state(self, event, msg): self.set_spo2 = msg def get_spo2_state(self, event, msg): - return self.set_spo2 + if self.set_spo2: + return self.set_spo2 + else: + return 0 #体温 class getTempTimeManager(Abstract): @@ -2651,17 +2758,23 @@ class getTempTimeManager(Abstract): EventMesh.publish("set_storage_config",["set_temp_time",self.set_time]) def get_temp_time(self, event, msg): - return self.set_time + if self.set_time: + return self.set_time + else : + return 0 def set_temp_state(self, event, msg): self.get_temp = msg - def get_temp_state(self, event, msg): - return self.get_temp + def get_temp_state(self, event, msg): + if self.get_temp: + return self.get_temp + else : + return 0 class getBrightnessManager(Abstract):#获取亮度级别 def __init__(self): - self.level = 2#默认值6 + self.level = 6#默认值6 # self.read_data = {} self.time = 5 self.PWM_backlight = None @@ -2701,19 +2814,18 @@ class getBrightnessManager(Abstract):#获取亮度级别 def add(self, event, msg): if self.level < 10: self.level = self.level + 2 - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, self.level*100, 1000) + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10) self.PWM_backlight.open() EventMesh.publish("set_storage_config", ["brightness_level",self.level]) - level = EventMesh.publish("get_storage_config","brightness_level") def reduce(self, event, msg): if self.level > 0: self.level = self.level - 2 if self.level <= 0: - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, 1*100, 1000) + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 1, 10) else: - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US,self.level*100, 1000) + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS,self.level, 10) self.PWM_backlight.open() EventMesh.publish("set_storage_config", ["brightness_level",self.level]) @@ -2722,14 +2834,13 @@ class getBrightnessManager(Abstract):#获取亮度级别 class getStorageDataManager(Abstract):#获取内存数据 def __init__(self): self.config_data = {} - check = ql_fs.path_exists("/usr/static/storage_file/config.json") + check = ql_fs.path_exists("/ext/static/storage_file/config.json") if check == True: - with open("/usr/static/storage_file/config.json","r") as fd: + with open("/ext/static/storage_file/config.json","r") as fd: self.config_data = ujson.load(fd) else : self.config_data = {'old_time': 0, 'flip_sw': 0} pass - print("self.config_data:{}".format(self.config_data)) def post_processor_after_instantiation(self): EventMesh.subscribe("set_storage_data", self.set_storage_data) @@ -2741,7 +2852,7 @@ class getStorageDataManager(Abstract):#获取内存数据 # print("set_storage_data:{}".format(msg)) if msg != None: self.config_data = msg - with open("/usr/static/storage_file/config.json",'w+',encoding="utf-8") as fd: + with open("/ext/static/storage_file/config.json",'w+',encoding="utf-8") as fd: ujson.dump(self.config_data,fd) @@ -2752,8 +2863,7 @@ class getStorageDataManager(Abstract):#获取内存数据 # print("set_storage_key_data2:{}".format(self.config_data[msg[0]])) EventMesh.publish("publish_message_event_ui",{"func":self.set_storage_save,"data":0}) def set_storage_save(self, data): - print("set_storage_key_data2:{}".format(self.config_data)) - with open("/usr/static/storage_file/config.json",'w+',encoding="utf-8") as fd: + with open("/ext/static/storage_file/config.json",'w+',encoding="utf-8") as fd: ujson.dump(self.config_data,fd) def get_storage_data(self, event, msg): # print("get_storage_data:{}".format(self.config_data)) @@ -2762,7 +2872,7 @@ class getStorageDataManager(Abstract):#获取内存数据 # print("get_storage_key_data1:{}".format(msg)) b = msg in self.config_data.keys() if b == True: - print("get_storage_key_data2:{}".format(self.config_data[msg])) + # print("get_storage_key_data2:{}".format(self.config_data[msg])) return self.config_data[msg] else : return None @@ -2933,11 +3043,11 @@ class playPowerAudioManager(Abstract):#播放开关机音频文件 EventMesh.subscribe("play_poewr_off_event", self.play_poewr_off_event) def play_poewr_on_event(self, event, msg): - self.aud.play(1, 1, 'U:/static/R_POWER_1.mp3') #播放播放开机铃声 + self.aud.play(1, 1, 'E:/static/R_POWER_1.mp3') #播放播放开机铃声 def play_poewr_off_event(self, event, msg): self.aud.setVolume(11) - self.aud.play(1, 1, 'U:/static/R_POWER_OFF_1.mp3') #播放关机铃声 + self.aud.play(1, 1, 'E:/static/R_POWER_OFF_1.mp3') #播放关机铃声 class getBootOffManager(Abstract):#开关机时间 def __init__(self): @@ -3026,8 +3136,6 @@ class testSmsSetIPManager(Abstract):# #短信格式:SETIP:api.xcloudtech.com:9000:bZld0ALsZTt15tKEZhOlLPgbsO75BLTP 以冒号分隔 SETIP:ip地址:ip端口号:ip密钥key # self.read_data["set_new_md5"] = self.newmd5 #通过短信设置ip的key密钥 - - EventMesh.publish("set_storage_config",["set_new_ip_addr",self.newip]) EventMesh.publish("set_storage_config",["set_new_com",self.newcom]) @@ -3041,74 +3149,34 @@ class testSmsSetIPManager(Abstract):# def get_new_ip(self, event, msg): tmp_data = EventMesh.publish("get_storage_config","set_new_ip_addr") # return [self.newip,self.newcom,self.newmd5] -class setkeyboardManager(Abstract):#设置键盘开关状态 - def __init__(self): - self.key_state = 0 - tmp_data = EventMesh.publish("get_storage_config","key_board") - if tmp_data != None: - self.key_state = tmp_data + if(tmp_data != None): + return [self.newip,self.newcom] - def post_processor_after_instantiation(self): - EventMesh.subscribe("set_key_board", self.set_key_board)#设置关机时间 - EventMesh.subscribe("get_key_board", self.get_key_board) - - def set_key_board(self, event, msg): - self.key_state = msg - EventMesh.publish("set_storage_config",["key_board",self.key_state]) - - - def get_key_board(self, event, msg): - - return self.key_state - -class cameraAlbumManager(Abstract):#保存相册数目 +class setCallStateManager(Abstract):#设置电话通话状态 def __init__(self): - self.album_list = {} - - check_txt = ql_fs.path_exists("/usr/static/storage_file/album_config.json") - if check_txt == True : - with open("/usr/static/storage_file/album_config.json","r") as fd:#音频文件编号 - self.album_list = ujson.load(fd) - if not self.album_list: - self.album_list = {} - self.album_num = 0 - else: - b = str("num") in self.album_list.keys() - if b == True: - self.album_num = self.album_list["num"] - else : - self.album_list = {} - with open("/usr/static/storage_file/album_config.json","w",encoding="utf-8") as fd: - ujson.dump(self.album_list,fd) - - + self.call_state = 0 def post_processor_after_instantiation(self): - EventMesh.subscribe("set_camera_num", self.set_camera_num)#设置关机时间 - EventMesh.subscribe("get_camera_num", self.get_camera_num) + EventMesh.subscribe("set_call_state", self.set_call_state)#设置关机时间 + EventMesh.subscribe("get_call_state", self.get_call_state) - def set_camera_num(self, event, msg): - - self.album_list = msg - with open("/usr/static/storage_file/album_config.json","w+",encoding="utf-8") as fd: - ujson.dump(self.album_list,fd) - # sorted_keys = sorted(self.album_list.keys()) - # print("self.album_list",self.album_list,sorted_keys) + def set_call_state(self, event, msg): + self.call_state = msg - def get_camera_num(self, event, msg): + def get_call_state(self, event, msg): - return self.album_list - + return self.call_state + class setclassTimeManager(Abstract):#设置上课禁用时间 def __init__(self): self.class_buf = {} self.class_state = 0 - check_json = ql_fs.path_exists("/usr/static/storage_file/class_msg.json") + check_json = ql_fs.path_exists("/ext/static/storage_file/class_msg.json") if check_json == True: - with open("/usr/static/storage_file/class_msg.json","r",encoding="utf-8") as fd: + with open("/ext/static/storage_file/class_msg.json","r",encoding="utf-8") as fd: self.class_buf = ujson.load(fd) print("读取上课禁用时间段") # print("self.class_buf:",self.class_buf) @@ -3257,8 +3325,4 @@ class setclassTimeManager(Abstract):#设置上课禁用时间 EventMesh.publish("load_screen", {"screen": "main_menu"}) pass - - - - \ No newline at end of file diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/protocol.py index c56f6362..7588d8f3 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/protocol.py @@ -23,9 +23,9 @@ import usys def server_init(server_type = None): - #服务器选择1,防走丢,2大锤,3三基同创,4童信 + #服务器选择1,防走丢,2大锤,3三基同创,4童信,5云米,6荣为 if server_type == None: - server_type = 1 + server_type = 4 #print("server_init:server_type:{}".format(server_type)) d_server_addr = "api.xcloudtech.com" d_server_port = 9000 @@ -220,8 +220,8 @@ class SockManager(Abstract): except Exception as e: self.reconnect() self.socket_send_queue.put(data)#重新把数据加回队列 - print("socket_send_queue_thread1:ERROR:") - usys.print_exception(e) + #print("socket_send_queue_thread1:ERROR:") + #usys.print_exception(e) elif socketsta < 4:#正在连接,等待连接成功重新发送 count = 0 while True: @@ -235,8 +235,8 @@ class SockManager(Abstract): except Exception as e: self.reconnect() self.socket_send_queue.put(data)#重新把数据加回队列 - print("socket_send_queue_thread2:ERROR:") - usys.print_exception(e) + #print("socket_send_queue_thread2:ERROR:") + #usys.print_exception(e) break else :#连接错误 print("socket_send_queue_thread:ERROR:reconnect") @@ -311,7 +311,7 @@ class NetManager(Abstract): count = 0 while True: count += 1 - if count > 5 : + if count > 3 : return data = dataCall.getInfo(1, 0) print("data call INFO {}".format(data)) @@ -746,10 +746,11 @@ class WT_ProtoCol(ProtoCol): # msg_weather_content,msg_type,msg_temp,msg_min_temp,msg_max_temp,msg_city)) print("WT_ProtoCol RECV msg:%s"%(msg)) + + EventMesh.publish("set_weather_data",[msg_date,msg_time,msg_weather_content,msg_type,msg_temp,msg_min_temp,msg_max_temp,msg_city,1]) EventMesh.publish("updata_weather_show") - class REMIND_ProtoCol(ProtoCol): """闹钟数据""" TYPE = "REMIND" @@ -780,39 +781,65 @@ class REMIND_ProtoCol(ProtoCol): alarm_new = EventMesh.publish("read_alarminjson") # print("alarm_list:{} msg_tmp:{}",alarm_new,msg_tmp) - - k=0 - if len(alarm_new) < 5 : - alarm_new = [] - for i in range(5): - alarm_new.append({'hour': 16, 'repeart': 1, 'idx': i, 'enabled': 0, 'days': [], 'minute': 39}) - for j in range(2,5):#0 1是开关机,234是闹钟 + k=1 + count = 0 + + for i in range(len(str(msg_tmp))):#寻找有多少个,号 + if msg_tmp[i] == ',':#, , , + k+=1 + if len(alarm_new) > 2: + for i in range(0,len(alarm_new)-2): + del alarm_new[2] + # print("alarm_new:{}",alarm_new) + for j in range(2,2+k):#0 1是开关机,234是闹钟 alarm_day = [] alarm_week = [] alarm_total_data = [] - alarm_total_data = msg_tmp.split(',')[k] - k+=1 - b = alarm_total_data.find('-') - if b != -1: - alarm_data = alarm_total_data.split('-')#-作为分隔符 - alarm_switch = int(alarm_data[1])#开关 - alarm_day_num = int(alarm_data[2])#天 - alarm_time = alarm_data[0]#时间 - alarm_time_tmp = alarm_time.split(':')#冒号分隔时间 时 分 - alarm_time_hour = int(alarm_time_tmp[0]) - alarm_time_min = int(alarm_time_tmp[1]) - if alarm_day_num == 3: - alarm_week = alarm_data[3]#星期 - - if alarm_day_num == 2:#每一天 - alarm_day = [1,2,3,4,5,6,0] - elif alarm_day_num == 3:#自定义 - for i in range(0,7): - if alarm_week[i] != '0': - alarm_day.append(i) - alarm_new[j] = {"idx": j, "hour": alarm_time_hour, "minute": alarm_time_min, "days":alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num} - - # print("self.alarm_list: {}".format(alarm_new)) + if k == 1: + if len(msg_tmp) != 0: + alarm_data = msg_tmp.split('-')#-作为分隔符 + alarm_switch = int(alarm_data[1])#开关 + alarm_day_num = int(alarm_data[2])#天 + alarm_time = alarm_data[0]#时间 + alarm_time_tmp = alarm_time.split(':')#冒号分隔时间 时 分 + alarm_time_hour = int(alarm_time_tmp[0]) + alarm_time_min = int(alarm_time_tmp[1]) + if alarm_day_num == 3: + alarm_week = alarm_data[3]#星期 + + if alarm_day_num == 2:#每一天 + alarm_day = [1,2,3,4,5,6,0] + elif alarm_day_num == 3:#自定义 + for i in range(0,7): + if alarm_week[i] != '0': + alarm_day.append(i) + alarm_new.append({"idx": j, "hour": alarm_time_hour, "minute": alarm_time_min, "days":alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num}) + else: + if len(msg_tmp) != 0: + alarm_total_data = msg_tmp.split(',')[count] + count+=1 + b = alarm_total_data.find('-') + if b != -1: + alarm_data = alarm_total_data.split('-')#-作为分隔符 + alarm_switch = int(alarm_data[1])#开关 + alarm_day_num = int(alarm_data[2])#天 + alarm_time = alarm_data[0]#时间 + alarm_time_tmp = alarm_time.split(':')#冒号分隔时间 时 分 + alarm_time_hour = int(alarm_time_tmp[0]) + alarm_time_min = int(alarm_time_tmp[1]) + if alarm_day_num == 3: + alarm_week = alarm_data[3]#星期 + + if alarm_day_num == 2:#每一天 + alarm_day = [1,2,3,4,5,6,0] + elif alarm_day_num == 3:#自定义 + for i in range(0,7): + if alarm_week[i] != '0': + alarm_day.append(i) + alarm_new.append({"idx": j, "hour": alarm_time_hour, "minute": alarm_time_min, "days":alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num}) + + # print("alarm_new end:{}",alarm_new) + with open("/ext/static/storage_file/alarm_msg.json", 'w',encoding='utf-8') as fd: ujson.dump(alarm_new,fd) EventMesh.publish("push_update_alarm_show") @@ -820,6 +847,7 @@ class REMIND_ProtoCol(ProtoCol): # EventMesh.publish("add_alarm",[0,msg_tmp]) EventMesh.publish(constants.PROTOCOL.REMIND_SEND) + class HRSTART_ProtoCol(ProtoCol): """心率频率数据""" TYPE = "hrtstart" @@ -960,8 +988,6 @@ class TEMP_ProtoCol(ProtoCol): """上传体温测试数据""" TYPE = "temp" def send(self, event, msg): - # [SZKW*334588000000156*len*heart,x] - # print("temp:send:{}".format(msg)) len_size = len(str(msg[0]))+len("temp,")+1+len(str(msg[1])) print("temp:send:{} len:{}".format(msg,len_size)) # 实例:[XT*334588000000156*0009*temp,36.2] @@ -975,7 +1001,7 @@ class TEMP_ProtoCol(ProtoCol): # print("temp:data:%s"%(data)) # 通过socket发送到服务器端 EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) - + def recv(self, event, msg): """ @param event: @@ -984,6 +1010,99 @@ class TEMP_ProtoCol(ProtoCol): # print("HRSTART_ProtoCol RECV msg:") #EventMesh.publish(constants.PROTOCOL.TEMP_SEND) + +class TEMP_Hour_ProtoCol(ProtoCol): #云米服务独立指令体温 + """上传体温频率 小时单位""" + TYPE = "bodytemp" + def send(self, event, msg): + #[XT*334588000000156*len*wdstart,300] + send_data = self.PID+"*%s*0008*bodytemp"%(self.imei) + MD5_SIGN = self.pack_MD5_head(send_data) + data = "[%s%s]"%(str(MD5_SIGN),send_data) + # print("temp:data:%s"%(data)) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: 体温下发频率数据 + @param msg: 接收到的下行数据 + """ + # print("WDSTART_ProtoCol RECV msg:") + #TCP recv: data:b'[3G*860132060126844*000C*bodytemp,1,2]' + print("bodytemp:{}".format(msg)) + msg = msg[1:-1] + msg_tmp = msg.decode('ascii') + msg_tmp = msg_tmp.split('bodytemp,') + msg_tmp = msg_tmp[1] + + body_time = 0 + body_on = 0 + body_on = msg_tmp.split(',')[0]#开关 + body_time = msg_tmp.split(',')[1] + + if int(body_on) == 0: + body_time = 0 + else: + body_time = int(body_time)*3600 + + tempTotal = int(body_time) + + + EventMesh.publish("set_temp_time",tempTotal) + EventMesh.publish(constants.PROTOCOL.BODYTEMP_SEND) + +class bodytemp2_ProtoCol(ProtoCol): + """立即测量""" + TYPE = "bodytemp2" + def send(self, event, msg): + #[XT*334588000000156*len*bodytemp2,300] + send_data = self.PID+"*%s*0009*bodytemp2"%(self.imei) + MD5_SIGN = self.pack_MD5_head(send_data) + data = "[%s%s]"%(str(MD5_SIGN),send_data) + # print("temp:data:%s"%(data)) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: 体温下发频率数据 + @param msg: 接收到的下行数据 + """ + # print("bodytemp2_ProtoCol RECV msg:") + print("bodytemp2:{}".format(msg)) + get_temp_state = EventMesh.publish("get_temp_state") + print("get_temp_state:{}".format(get_temp_state)) + if get_temp_state == 0:#只要两个不在测量 单次优先级最低 + EventMesh.publish("set_temp_state",3)#3代表单次测量 + EventMesh.publish(constants.PROTOCOL.BODYTEMP2_SEND) +class btemp2_ProtoCol(ProtoCol):#上传体温数据 + """立即测量""" + TYPE = "btemp2" + def send(self, event, msg): + # [3G*YYYYYYYYYY*LEN*btemp2,type,temp] Type :测量模式:0:额头模式 1: 手腕模式Temp :体温, + len_size = len(str(msg[0]))+len("btemp2,")+1+len(str(msg[1])) + print("btemp2:send:{} len:{}".format(msg,len_size)) + # 实例:[XT*334588000000156*0009*btemp2,1,36.2] + # 代表终端的温度为:36.2 + # 平台回复: + # [XT*334588000000156*0004*btemp2] + send_data = self.PID+"*%s*%04X*btemp2"%(self.imei,len_size) + MD5_head_data = self.PID+"*%s*%04X*%s"%(self.imei,len_size,"btemp2") + MD5_SIGN = self.pack_MD5_head(MD5_head_data) + data = "[%s%s,%d,%f]"%(str(MD5_SIGN),send_data,1,msg[1]) + # print("btemp2:data:%s"%(data)) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: 体温下发频率数据 + @param msg: 接收到的下行数据 + """ + # print("btemp2_ProtoCol RECV msg:") + + class WDSTART_ProtoCol(ProtoCol): """上传体温频率""" TYPE = "wdstart" @@ -1014,7 +1133,6 @@ class WDSTART_ProtoCol(ProtoCol): get_temp_state = EventMesh.publish("get_temp_state") print("get_temp_state:{}".format(get_temp_state)) if get_temp_state == 0:#只要两个不在测量 单次优先级最低 - EventMesh.publish("set_temp_state",3)#3代表单次测量 else: if tempTotal > 0 and tempTotal <= 300: @@ -1023,9 +1141,6 @@ class WDSTART_ProtoCol(ProtoCol): tempTotal = 65536 EventMesh.publish("set_temp_time",tempTotal) - - - EventMesh.publish(constants.PROTOCOL.WDSTART_SEND) #解绑 # [XT*334588000000156*0003*DLT] @@ -1036,11 +1151,11 @@ class DLT_ProtoCol(ProtoCol): """解绑数据""" TYPE = "DLT" def send(self, event, msg): - # [XT*334588000000156*0004*temp] + # [XT*334588000000156*0004*DLT] send_data = self.PID+"*%s*0003*DLT"%(self.imei) MD5_SIGN = self.pack_MD5_head(send_data) data = "[%s%s]"%(str(MD5_SIGN),send_data) - print("temp:data:%s"%(data)) + print("DLT:data:%s"%(data)) # 通过socket发送到服务器端 EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) @@ -1057,7 +1172,7 @@ class UPLOAD_ProtoCol(ProtoCol): """定位频率数据""" TYPE = "UPLOAD" def send(self, event, msg): - # [XT*334588000000156*0004*temp] + # [XT*334588000000156*0004*UPLOAD] send_data = self.PID+"*%s*0006*UPLOAD"%(self.imei) MD5_SIGN = self.pack_MD5_head(send_data) data = "[%s%s]"%(str(MD5_SIGN),send_data) @@ -1087,7 +1202,7 @@ class CENTER_ProtoCol(ProtoCol): """设置快捷号码""" TYPE = "CENTER" def send(self, event, msg): - # [XT*334588000000156*0004*temp] + # [XT*334588000000156*0004*CENTER] send_data = self.PID+"*%s*0006*CENTER"%(self.imei) MD5_SIGN = self.pack_MD5_head(send_data) data = "[%s%s]"%(str(MD5_SIGN),send_data) @@ -1130,16 +1245,26 @@ class MONITOR_ProtoCol(ProtoCol): @param event: @param msg: 接收到的下行数据 """ - # b'[SZKW*867387060319166*000A*MONITOR]' - read_data = EventMesh.publish("get_storage_config","center_dial") - - if read_data != None: - contact = read_data - if len(contact) > 0: - print("MONITOR RECV msg:{} {}".format(contact,type(contact))) - EventMesh.publish("save_phonename", contact) - EventMesh.publish("save_phonenum", contact) - voiceCall.callStart(contact) + msg = msg[1:-1] + msg_tmp = msg.decode('ascii') + msg_tmp = msg_tmp.split('MONITOR') + msg_tmp = msg_tmp[1] + print("MONITOR_ProtoCol RECV msg:{} msg_:{}".format(msg,len(msg_tmp))) + if len(msg_tmp) != 0: + EventMesh.publish("save_phonename", contact) + EventMesh.publish("save_phonenum", contact) + EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"}) + # voiceCall.callStart(contact) + else: + read_data = EventMesh.publish("get_storage_config","center_dial") + + if read_data != None: + contact = read_data + if len(contact) > 0: + print("MONITOR RECV msg:{} {}".format(contact,type(contact))) + EventMesh.publish("save_phonename", contact) + EventMesh.publish("save_phonenum", contact) + EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"}) EventMesh.publish(constants.PROTOCOL.MONITOR_SEND) #定时开关机 @@ -1304,6 +1429,98 @@ class WLKEY_ProtoCol(ProtoCol): # print("WLKEY!!!!!!!!!!!!!",msg) EventMesh.publish(constants.PROTOCOL.WLKEY_SEND) +#免打扰 +class SILENCETIMEFS_ProtoCol(ProtoCol):#云米 + """上课禁用""" + TYPE = "SILENCETIMEFS" + def send(self, event, msg): + # [XT*334588000000156*0006*SILENCETIME2] a b c d + send_data = self.PID+"*%s*000D*SILENCETIMEFS"%(self.imei) + MD5_SIGN = self.pack_MD5_head(send_data) + data = "[%s%s]"%(str(MD5_SIGN),send_data) + # print("KEYBRD:data:%s"%(data)) + # print("SILENCETIME2!!!!!!!!!!!!!",msg) + # 通过socket发送到服务器端 + EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data) + + def recv(self, event, msg): + """ + @param event: + @param msg: 接收到的下行数据 + """ + class_in_buf = {"1": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []},\ + "0": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []}, \ + "3": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []}, \ + "2": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []}} + + # class_in_buf.append({'start_hour': "16:54", 'week': [], 'idx': 0, 'enabled': 0, 'end_hour': "18:39"}) + msg = msg[1:-1] + msg_tmp = msg.decode('ascii') + msg_tmp_d = str(msg_tmp.split('SILENCETIMEFS,')[1]) + + count = 1 + k = 0 + + for i in range(len(str(msg_tmp_d))): + if msg_tmp_d[i] == ',': + count+=1 + + for x in range(count):#21:10-7:30@0111110,21:10-7:30@0111110,21:10-7:30@0111110,21:10-7:30@0111110 + week = [] + if x >= 4: + break + if count > 1: + + msg_data = msg_tmp_d.split(',')[x] + print("SILENCETIMEFS count",msg_data) + b = msg_data.find('-') + if b != -1: + data = msg_data.split('-')#-作为分隔符 + time = data[1].split('@')#@作为分隔符 + print("data",data,time,data[0],time[0]) + start_time = data[0]#开始时间 + end_time = time[0]#结束时间 + enable = 1 + week_day = time[1] + for i in range(0,7): + if week_day[i] != '0': + week.append(i) + tmp={} + tmp["start_time"] = start_time + tmp["end_time"] = end_time + tmp["week"] = week + tmp["enable"] = enable + class_in_buf["{}".format(x)] = tmp + else: + if len(msg_tmp_d) != 0: + b = msg_tmp_d.find('-') + if b != -1: + + data = msg_tmp_d.split('-')#-作为分隔符 + time = data[1].split('@')#@作为分隔符 + print("data",data,time,data[0],time[0]) + start_time = data[0]#开始时间 + end_time = time[0]#结束时间 + enable = 1 + week_day = time[1] + for i in range(0,7): + if week_day[i] != '0': + week.append(i) + tmp={} + tmp["start_time"] = start_time + tmp["end_time"] = end_time + tmp["week"] = week + tmp["enable"] = enable + class_in_buf["{}".format(x)] = tmp + + with open("/ext/static/storage_file/class_msg.json", 'w+',encoding='utf-8') as fd: + ujson.dump(class_in_buf,fd) + + + EventMesh.publish("set_class_time", class_in_buf) + EventMesh.publish(constants.PROTOCOL.SILENCETIMEFS_SEND) + EventMesh.publish("get_class_in_time_page") + #免打扰 class SILENCETIME2_ProtoCol(ProtoCol): """免打扰""" @@ -1323,9 +1540,71 @@ class SILENCETIME2_ProtoCol(ProtoCol): @param event: @param msg: 接收到的下行数据 """ - # b'[SZKW*867387060319166*000A*KEYBRD]' - # print("SILENCETIME2!!!!!!!!!!!!!",msg) + class_in_buf = {"1": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []},\ + "0": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []}, \ + "3": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []}, \ + "2": {'enable': 0, 'end_time': '00:00', 'start_time': '00:00', 'week': []}} + + # class_in_buf.append({'start_hour': "16:54", 'week': [], 'idx': 0, 'enabled': 0, 'end_hour': "18:39"}) + msg = msg[1:-1] + msg_tmp = msg.decode('ascii') + msg_tmp_d = str(msg_tmp.split('SILENCETIME2,')[1]) + + count = 1 + k = 0 + + for i in range(len(str(msg_tmp_d))): + if msg_tmp_d[i] == ',': + count+=1 + + for x in range(count):#08:00-17:00-1-0111110,08:00-17:00-1-0111110 + week = [] + if count > 1: + msg_data = msg_tmp_d.split(',')[k] + # print("SILENCETIME count",msg_data) + k+= 1 + b = msg_data.find('-') + if b != -1: + data = msg_data.split('-')#-作为分隔符 + start_time = data[0] + end_time = data[1] + enable = int(data[2]) + week_day = data[3] + for i in range(0,7): + if week_day[i] != '0': + week.append(i) + tmp={} + tmp["start_time"] = start_time + tmp["end_time"] = end_time + tmp["week"] = week + tmp["enable"] = enable + class_in_buf["{}".format(x)] = tmp + else: + b = msg_tmp_d.find('-') + if b != -1: + data = msg_tmp_d.split('-')#-作为分隔符 + start_time = data[0] + end_time = data[1] + enable = int(data[2]) + week_day = data[3] + for i in range(0,7): + if week_day[i] != '0': + week.append(i) + tmp={} + tmp["start_time"] = start_time + tmp["end_time"] = end_time + tmp["week"] = week + tmp["enable"] = enable + class_in_buf["{}".format(x)] = tmp + + with open("/ext/static/storage_file/class_msg.json", 'w+',encoding='utf-8') as fd: + ujson.dump(class_in_buf,fd) + + + EventMesh.publish("set_class_time", class_in_buf) EventMesh.publish(constants.PROTOCOL.SILENCETIME2_SEND) + EventMesh.publish("get_class_in_time_page") +#键盘开关 #键盘开关 class KEYBRD_ProtoCol(ProtoCol): diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/sleep_test.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/sleep_test.py index 854879f0..609a9e36 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/sleep_test.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/sleep_test.py @@ -6,49 +6,228 @@ if ql_fs.path_exists("/ext") == False: res = uos.statvfs("/ext") res = list(res) print('总ext空间:{} MB,剩余空间:{} MB'.format((((res[0] * res[2]) / 1024 / 1024)),((res[0] * res[3]) / 1024 / 1024))) -from lcd import tp_cst816 -from btn_device_ec800m import BtnDevice +# from lcd import tp_cst816 +# from btn_device_ec800m import BtnDevice import lvgl as lv import utime import osTimer import pm import ql_fs +# from machine import Pin +# from lcd import lcd,lcd_ctrl,tp_cst816,lcd_ctrl +# from misc import PWM +# import uos +# from machine import I2C +# from Hsensor import GH3018 +# from Gsensor import SC7A20 +# btn_device = BtnDevice(tp_cst816) +# btn_device.start() +# i2c0 = I2C(I2C.I2C0, I2C.FAST_MODE) +# WHO_AM_I = bytearray([0x01, 0]) +# I2C_SLAVE_ADDR = 0x49 +# r_data = bytearray(2) +# data = bytearray([0x60A0, 0]) #休眠 +# i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2) +# def gsensor_cb(self, para): +# print("gsensor_cb:{}".format(para)) +# gsensor = SC7A20() +# print("DeviceInfoManager:1.0") +# gsensor.activate() +# print("DeviceInfoManager:1.1") +# gsensor.init() +# print("DeviceInfoManager:2") +# gsensor.set_callback(gsensor_cb) +# hsensor = GH3018() +# hsensor.activate() +# hsensor.init() +# hsensor.open_blood_oxygen() +# utime.sleep(5) +# PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 0, 1) +# PWM_backlight.open() +# hsensor.close() +# tp_cst816.suspend() +# lcd.lcd_display_off() +# #lcd_ctrl.write(0) +# lv.autoSleep(1) +# pm.autosleep(1) +# print("test end2") + + +import request +import ujson + + +def manual_url_encode(s: str) -> str: + """Encodes a string for use in a URL query string.""" + safe_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.*" + encoded_str = "" + + for char in s: + if char in safe_chars: + encoded_str += char + else: + encoded_str += ''.join(['%' + hex(c)[2:].upper() for c in char.encode('utf-8')]) + return encoded_str + +def generate_url(base_uri: str, params: dict) -> str: + """Generates a full URL given a base URI and a dictionary of query parameters.""" + # Encode each key-value pair in the params dictionary + encoded_params = "&".join([key + "=" + manual_url_encode(str(value)) for key, value in params.items()]) + return base_uri + "?" + encoded_params + +# Test the function with the given example +base_uri = "http://ability.raisound.com:8096/bwtts" +params = { + "text": "这是一个测试用例,一二三四五,上山打老虎", + "voice_name": "xiaomu", + "sample_rate": 44100, + "audio_format": "mp3" +} +import audio from machine import Pin -from lcd import lcd,lcd_ctrl,tp_cst816,lcd_ctrl -from misc import PWM -import uos -from machine import I2C -from Hsensor import GH3018 -from Gsensor import SC7A20 -btn_device = BtnDevice(tp_cst816) -btn_device.start() -i2c0 = I2C(I2C.I2C0, I2C.FAST_MODE) -WHO_AM_I = bytearray([0x01, 0]) -I2C_SLAVE_ADDR = 0x49 -r_data = bytearray(2) -data = bytearray([0x60A0, 0]) #休眠 -i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2) -def gsensor_cb(self, para): - print("gsensor_cb:{}".format(para)) -gsensor = SC7A20() -print("DeviceInfoManager:1.0") -gsensor.activate() -print("DeviceInfoManager:1.1") -gsensor.init() -print("DeviceInfoManager:2") -gsensor.set_callback(gsensor_cb) -hsensor = GH3018() -hsensor.activate() -hsensor.init() -hsensor.open_blood_oxygen() -utime.sleep(5) -PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, 0, 1000) -PWM_backlight.open() -hsensor.close() -tp_cst816.suspend() -lcd.lcd_display_off() -#lcd_ctrl.write(0) -lv.autoSleep(1) -pm.autosleep(1) -print("test end2") \ No newline at end of file +record_test = audio.Record() +record_test.gain(4,12) +aud = audio.Audio(0) +aud.set_pa(Pin.GPIO29) +aud.setVolume(11) +tmp = bytearray() +generated_url = generate_url(base_uri, params) +print("url:{}".format(generated_url)) +response = request.get(generated_url) +print("status_code:{}".format(response.status_code)) +play_flag = 1 # = 1流播放 =2保存文件播放 + +size = 10*1024 +ret = 0 +if play_flag == 1: + for i in response.content: + print("len:{}".format(len(i))) + #tmp+= bytearray(i) + ret = aud.playStream(3, bytearray(i)) + print("data len:{}".format(len(tmp))) + #print("data:{}".format(tmp)) + #ret = aud.playStream(3, tmp) + utime.sleep_ms(20) +else: + len_tmp = 0 + with open('/ext/test.mp3', 'w+')as fp: + for i in response.content: + fp.write(i) + len_tmp+=len(i) + print("data len:{}".format(len_tmp)) + #ret = aud.play(1, 1, '/ext/test.mp3') + with open("/ext/test.mp3", "rb")as f: + while 1: + b = f.read(size) # read + if not b: + break + ret =aud.playStream(3, b) + utime.sleep_ms(20) +print("ret:{}".format(ret)) + + + + +# import quecgnss +# import utime + +# import quecgnss +# import utime +# import ure + +# gnss_init_flag = 0 +# ret = -1 +# fix_num = 0 + +# def gnss_nmea_debug(gnss_data): +# global fix_num +# global gnss_init_flag +# try: +# rmc_info = ure.search("GNRMC(.+?)M", gnss_data) +# if rmc_info.group(0).split(",")[2] == 'A': +# if fix_num > 1: +# print("输出有效定位!\r\n") +# else: +# fix_num = fix_num + 1 + +# except: +# pass + + +# def gnss_nmea_get_sat(gnss_data): +# try: +# nema_str_list = gnss_data.split('\r\n') +# for i in range(len(nema_str_list)): +# if(ure.search("GPGSV(.+?)", nema_str_list[i]) != None): +# # print(nema_str_list[i].split(",")[3]) +# try: +# print('GPS SAT NUM:{},SAT1 {} SNR {},SAT2 {} SNR {},SAT3 {} SNR {},SAT4 {} SNR {}\r\n'.format(nema_str_list[i].split(",")[3], \ +# nema_str_list[i].split(",")[4], nema_str_list[i].split(",")[7], nema_str_list[i].split(",")[8], \ +# nema_str_list[i].split(",")[11], nema_str_list[i].split(",")[12], nema_str_list[i].split(",")[15], \ +# nema_str_list[i].split(",")[16], nema_str_list[i].split(",")[19])) + +# except: +# pass + +# elif(ure.search("GBGSV(.+?)", nema_str_list[i]) != None): +# # print(nema_str_list[i].split(",")[3]) +# try: +# print('BDS SAT NUM:{},SAT1 {} SNR {},SAT2 {} SNR {},SAT3 {} SNR {},SAT4 {} SNR {}\r\n'.format(nema_str_list[i].split(",")[3], \ +# nema_str_list[i].split(",")[4], nema_str_list[i].split(",")[7], nema_str_list[i].split(",")[8], \ +# nema_str_list[i].split(",")[11], nema_str_list[i].split(",")[12], nema_str_list[i].split(",")[15], \ +# nema_str_list[i].split(",")[16], nema_str_list[i].split(",")[19])) +# except: +# pass + +# else: +# pass +# except Exception as e: +# print(str(e)) + + +# def main(): +# global fix_num +# global gnss_init_flag +# global ret +# if(gnss_init_flag == 0): +# ret = quecgnss.init() +# if ret == 0: +# print('GNSS init ok.\r\n') +# gnss_init_flag = 1 +# else: +# print('GNSS init failed.\r\n') +# return -1 +# else: +# print('GNSS has been init.\r\n') +# quecgnss.gnssEnable(1) + +# for i in range(60): +# print("==========GNSS READTIME {}==========\r\n".format(i+1)) +# data = quecgnss.read(4096) +# gnss_data = data[1].decode() +# print(gnss_data) +# gnss_nmea_get_sat(gnss_data) +# utime.sleep(1) + +# quecgnss.gnssEnable(0) +# fix_num = 0 +# utime.sleep(5) +# quecgnss.gnssEnable(1) +# print("==========GNSS RESTART==========\r\n") + +# for i in range(60): +# print("==========GNSS READTIME {}==========\r\n".format(i+1)) +# data = quecgnss.read(4096) +# gnss_data = data[1].decode() +# print(gnss_data) +# gnss_nmea_get_sat(gnss_data) +# utime.sleep(1) + +# quecgnss.gnssEnable(0) +# fix_num = 0 + + + +# if __name__ == '__main__': +# main() \ No newline at end of file diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py index 10c9a609..00e9ba15 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py @@ -20,10 +20,8 @@ import uos import gc import _thread from queue import Queue -import camera from machine import RTC -LCD_X = 128 -LCD_Y = 128 +import usys def audio_cb(event): if event == 0: EventMesh.publish("set_audio_state", 1) @@ -46,13 +44,34 @@ style_screen.set_pad_right(0) style_screen.set_pad_top(0) style_screen.set_pad_bottom(0) +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_gray_bg = lv.style_t() +style_gray_bg.init() +style_gray_bg.set_bg_color(lv.color_make(0x00, 0xff, 0x2a)) +style_gray_bg.set_border_width(0) +style_gray_bg.set_shadow_opa(0) +style_gray_bg.set_pad_left(0) +style_gray_bg.set_pad_right(0) +style_gray_bg.set_pad_top(0) +style_gray_bg.set_pad_bottom(0) + style_bar = lv.style_t() style_bar.init() style_bar.set_radius(10) style_bar.set_bg_color(lv.color_make(0xA0, 0xA0, 0xA0)) style_bar.set_bg_grad_color(lv.color_make(0xA0, 0xA0, 0xA0)) style_bar.set_bg_grad_dir(lv.GRAD_DIR.VER) -style_bar.set_bg_opa(255) +style_bar.set_bg_opa(60) style_bar.set_pad_left(0) style_bar.set_pad_right(0) style_bar.set_pad_top(0) @@ -71,27 +90,41 @@ style_bar_indic.set_bg_opa(255) style_font_youyuan_20 = lv.style_t() style_font_youyuan_20.init() style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -#style_font_youyuan_20.set_text_font_v2("font_28.bin",28,0) -style_font_youyuan_20.set_text_font(lv.K01_font_16_ALL) +style_font_youyuan_20.set_text_font_v2("font_28.bin",28,0) + + +style_font_youyuan_20_gray = lv.style_t() +style_font_youyuan_20_gray.init() +style_font_youyuan_20_gray.set_text_color(lv.color_make(128, 128, 128)) +style_font_youyuan_20_gray.set_text_font_v2("font_28.bin",28,0) style_font_youyuan_40 = lv.style_t() style_font_youyuan_40.init() style_font_youyuan_40.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -style_font_youyuan_40.set_text_font(lv.K01_font_16_ALL) -#style_font_youyuan_40.set_text_font_v2("font_40.bin",40,0) +style_font_youyuan_40.set_text_font_v2("font_40.bin",40,0) #黑色 style_font_youyuan_20_black = lv.style_t() style_font_youyuan_20_black.init() style_font_youyuan_20_black.set_text_color(lv.color_make(0x00, 0x00, 0x00)) -style_font_youyuan_20_black.set_text_font(lv.K01_font_16_ALL) -#style_font_youyuan_20_black.set_text_font_v2("font_28.bin",28,0) +style_font_youyuan_20_black.set_text_font_v2("font_28.bin",28,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)) + +#黑色 +style_black = lv.style_t() +style_black.init() +style_black.set_text_color(lv.color_make(0x00, 0x00, 0x00)) style_font_youyuan_20_red = lv.style_t() style_font_youyuan_20_red.init() style_font_youyuan_20_red.set_text_color(lv.color_make(0xff, 0x00, 0x00)) -style_font_youyuan_20_red.set_text_font(lv.K01_font_16_ALL) -#style_font_youyuan_20_red.set_text_font_v2("font_28.bin",28,0) +style_font_youyuan_20_red.set_text_font_v2("font_28.bin",28,0) style_img = lv.style_t() style_img.init() @@ -124,25 +157,17 @@ style_btn.set_bg_opa(0) style_btn.set_shadow_opa(0) style_btn.set_border_width(0) - style_wechat_btn = lv.style_t() style_wechat_btn.init() style_wechat_btn.set_bg_color(lv.color_make(0x1E, 0x26, 0xff)) style_wechat_btn.set_border_width(0) style_wechat_btn.set_shadow_opa(0) - -style_contact_btn = lv.style_t() +style_contact_btn = lv.style_t() style_contact_btn.init() -style_contact_btn.set_radius(5) style_contact_btn.set_bg_color(lv.color_make(0xff, 0xff, 0xff)) -style_contact_btn.set_bg_opa(255) style_contact_btn.set_border_width(0) -style_contact_btn.set_pad_left(0) -style_contact_btn.set_pad_right(0) -style_contact_btn.set_pad_top(0) -style_contact_btn.set_pad_bottom(0) - +style_contact_btn.set_shadow_opa(0) style_common_bg_rect_btn_pressed = lv.style_t() style_common_bg_rect_btn_pressed.init() @@ -153,7 +178,7 @@ style_common_bg_rect_btn_pressed.set_shadow_opa(0) style_contact_btn_pressed = lv.style_t() style_contact_btn_pressed.init() -style_contact_btn_pressed.set_radius(0) +style_contact_btn_pressed.set_radius(5) style_contact_btn_pressed.set_bg_color(lv.color_make(0xff,0xff,0xff)) style_contact_btn_pressed.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6)) style_contact_btn_pressed.set_bg_grad_dir(lv.GRAD_DIR.HOR) @@ -164,6 +189,13 @@ style_contact_btn_pressed.set_border_opa(255) style_contact_btn_pressed.set_text_color(lv.color_make(0x00,0x00,0x00)) +style_alipay_btn = lv.style_t() +style_alipay_btn.init() +style_alipay_btn.set_bg_color(lv.color_make(0xFF, 0xFF, 0xff)) +style_alipay_btn.set_bg_opa(20) +style_alipay_btn.set_border_width(0) +style_alipay_btn.set_shadow_opa(0) + style_circle = lv.style_t() @@ -226,12 +258,6 @@ class Screen(Abstract): def done_error(self): pass - def done_DOWN(self): - pass - def done_UP(self): - pass - - def handle_message_event(self,data): pass def publish_message_event(self,data): @@ -284,126 +310,146 @@ class PhoneScreen(Screen): global phone_screen ,phone_line,phone_label,phone_one,phone_two,phone_three,phone_four,phone_five,phone_six,phone_seven,phone_eight,phone_nine,phone_start,\ phone_zero,phone_hash,phone_call,phone_call_btn,phone_contact,phone_contact_btn,phone_delete,phone_delete_btn - size_x = 36 #按钮大小 - size_y = 22 - start_x = 5 - start_y = 25 - offset_y = 4 if phone_screen == None: phone_screen = lv.obj() print("phone_screen") phone_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - # phone_line = lv.line(phone_screen) - # phone_line.set_points(phone_line_points,2) - # phone_line.set_pos(125,5) - # phone_line.set_size(2,18) - # phone_line.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - # phone_line.add_style(style_line,0) + phone_line = lv.line(phone_screen) + phone_line.set_points(phone_line_points,2) + phone_line.set_pos(235,8) + phone_line.set_size(2,40) + phone_line.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + phone_line.add_style(style_line,0) phone_label = lv.label(phone_screen) - phone_label.set_pos(0, 5) - phone_label.set_size(128, 20) + phone_label.set_pos(0, 14) + phone_label.set_size(0, 48) phone_label.set_text(" ") phone_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) phone_label.set_long_mode(lv.label.LONG.CLIP) - phone_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + phone_label.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) phone_one = lv.img(phone_screen) - phone_one.set_src("U:/static/IMAGE_NUMBER_KEY1_ICON.png") + phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png") phone_one.add_flag(lv.obj.FLAG.CLICKABLE) phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_one.set_pos(start_x, start_y) - phone_one.set_size(size_x, size_y) + phone_one.set_pos(3, 60) + phone_one.set_size(76, 50) phone_two = lv.img(phone_screen) - phone_two.set_size(size_x, size_y) - phone_two.set_src("U:/static/IMAGE_NUMBER_KEY2_ICON.png") + phone_two.set_size(76, 50) + phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png") phone_two.add_flag(lv.obj.FLAG.CLICKABLE) phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_two.set_pos(start_x+size_x+5*1, start_y) + phone_two.set_pos(82, 60) phone_three = lv.img(phone_screen) - phone_three.set_size(size_x, size_y) - phone_three.set_src("U:/static/IMAGE_NUMBER_KEY3_ICON.png") + phone_three.set_size(76, 50) + phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png") phone_three.add_flag(lv.obj.FLAG.CLICKABLE) phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_three.set_pos(start_x+size_x*2+5*2, start_y) + phone_three.set_pos(161, 60) phone_four = lv.img(phone_screen) - phone_four.set_size(size_x, size_y) - phone_four.set_src("U:/static/IMAGE_NUMBER_KEY4_ICON.png") + phone_four.set_size(76, 50) + phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png") phone_four.add_flag(lv.obj.FLAG.CLICKABLE) phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_four.set_pos(start_x, start_y+size_y+offset_y) + phone_four.set_pos(3, 112) phone_five = lv.img(phone_screen) - phone_five.set_size(size_x, size_y) - phone_five.set_src("U:/static/IMAGE_NUMBER_KEY5_ICON.png") + phone_five.set_size(76, 50) + phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png") phone_five.add_flag(lv.obj.FLAG.CLICKABLE) phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_five.set_pos(start_x+size_x+5*1, start_y+size_y+offset_y) + phone_five.set_pos(82, 112) phone_six = lv.img(phone_screen) - phone_six.set_size(size_x, size_y) - phone_six.set_src("U:/static/IMAGE_NUMBER_KEY6_ICON.png") + phone_six.set_size(76, 50) + phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png") phone_six.add_flag(lv.obj.FLAG.CLICKABLE) phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_six.set_pos(start_x+size_x*2+5*2, start_y+size_y+offset_y) + phone_six.set_pos(161, 112) phone_seven = lv.img(phone_screen) - phone_seven.set_size(size_x, size_y) - phone_seven.set_src("U:/static/IMAGE_NUMBER_KEY7_ICON.png") + phone_seven.set_size(76, 50) + phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png") phone_seven.add_flag(lv.obj.FLAG.CLICKABLE) phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_seven.set_pos(start_x, start_y+size_y*2+offset_y*2) + phone_seven.set_pos(3, 164) phone_eight = lv.img(phone_screen) - phone_eight.set_size(size_x, size_y) - phone_eight.set_src("U:/static/IMAGE_NUMBER_KEY8_ICON.png") + phone_eight.set_size(76, 50) + phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png") phone_eight.add_flag(lv.obj.FLAG.CLICKABLE) phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_eight.set_pos(start_x+size_x+5*1, start_y+size_y*2+offset_y*2) + phone_eight.set_pos(82, 164) phone_nine = lv.img(phone_screen) - phone_nine.set_size(size_x, size_y) - phone_nine.set_src("U:/static/IMAGE_NUMBER_KEY9_ICON.png") + phone_nine.set_size(76, 50) + phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png") phone_nine.add_flag(lv.obj.FLAG.CLICKABLE) phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_nine.set_pos(start_x+size_x*2+5*2, start_y+size_y*2+offset_y*2) - - # phone_start = lv.img(phone_screen) - # phone_start.set_size(size_x, size_y) - # phone_start.set_src("U:/static/IMAGE_NUMBER_KEYSTAR_ICON.png") - # phone_start.add_flag(lv.obj.FLAG.CLICKABLE) - # phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # phone_start.set_pos(start_x, start_y+size_y*3) - - phone_delete = lv.img(phone_screen) - phone_delete.set_size(size_x, size_y) - phone_delete.set_src("U:/static/IMAGE_BUTTON_DELKEY.png") - phone_delete.add_flag(lv.obj.FLAG.CLICKABLE) - phone_delete.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_delete.set_pos(start_x, start_y+size_y*3+offset_y*3) - + phone_nine.set_pos(161, 164) + phone_start = lv.img(phone_screen) + phone_start.set_size(76, 50) + phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png") + phone_start.add_flag(lv.obj.FLAG.CLICKABLE) + phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + phone_start.set_pos(3, 216) phone_zero = lv.img(phone_screen) - phone_zero.set_size(size_x, size_y) - phone_zero.set_src("U:/static/IMAGE_NUMBER_KEY0_ICON.png") + phone_zero.set_size(76, 50) + phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png") phone_zero.add_flag(lv.obj.FLAG.CLICKABLE) phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_zero.set_pos(start_x+size_x+5*1, start_y+size_y*3+offset_y*3) + phone_zero.set_pos(82, 216) + + phone_hash = lv.img(phone_screen) + phone_hash.set_size(76, 50) + phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png") + phone_hash.add_flag(lv.obj.FLAG.CLICKABLE) + phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + phone_hash.set_pos(161, 216) phone_call = lv.img(phone_screen) - phone_call.set_size(size_x, size_y) - phone_call.set_src("U:/static/IMAGE_BUTTON_DIAL.png") + phone_call.set_size(76, 50) + phone_call.set_src("E:/static/IMAGE_BUTTON_DIAL.png") phone_call.add_flag(lv.obj.FLAG.CLICKABLE) phone_call.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - phone_call.set_pos(start_x+size_x*2+5*2, start_y+size_y*3+offset_y*3) + phone_call.set_pos(3, 270) + + phone_call_btn = lv.img(phone_screen) + phone_call_btn.set_size(76, 52) + phone_call_btn.add_flag(lv.obj.FLAG.CLICKABLE) + phone_call_btn.set_pos(3, 268) + + phone_contact = lv.img(phone_screen) + phone_contact.set_size(64, 50) + phone_contact.set_src("E:/static/IMAGE_BUTTON_DIAL_CONTACT.png") + phone_contact.add_flag(lv.obj.FLAG.CLICKABLE) + phone_contact.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + phone_contact.set_pos(87, 270) + + phone_contact_btn = lv.img(phone_screen) + phone_contact_btn.set_size(76, 52) + phone_contact_btn.add_flag(lv.obj.FLAG.CLICKABLE) + phone_contact_btn.set_pos(87, 268) + phone_delete = lv.img(phone_screen) + phone_delete.set_size(76, 50) + phone_delete.set_src("E:/static/IMAGE_BUTTON_DELKEY.png") + phone_delete.add_flag(lv.obj.FLAG.CLICKABLE) + phone_delete.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + phone_delete.set_pos(161, 270) + phone_delete_btn = lv.img(phone_screen) + phone_delete_btn.set_size(76, 52) + phone_delete_btn.add_flag(lv.obj.FLAG.CLICKABLE) + phone_delete_btn.set_pos(161, 268) self.meta = phone_screen @@ -419,75 +465,51 @@ class PhoneScreen(Screen): lv.EVENT.CLICKED, None) phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)), lv.EVENT.CLICKED, None) - phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), + phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven(e)), lv.EVENT.CLICKED, None) - - phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), - lv.EVENT.LONG_PRESSED, None)#长按显示+ - - phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.endpressed_start(e)), - lv.EVENT.RELEASED, None)#释放按键 - phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)), lv.EVENT.CLICKED, None) - phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - lv.EVENT.CLICKED, None) - - phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), - lv.EVENT.LONG_PRESSED, None)#长按显示+ - - phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine_endpressed_start(e)), - lv.EVENT.RELEASED, None)#释放按键 - - # phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), - # lv.EVENT.CLICKED, None) - - phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - lv.EVENT.CLICKED, None)#短按显示* - - phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), - lv.EVENT.LONG_PRESSED, None)#长按显示+ - - phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero_endpressed_start(e)), - lv.EVENT.RELEASED, None)#释放按键 + phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine(e)), + lv.EVENT.CLICKED, None) + phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), + lv.EVENT.CLICKED, None) - phone_call.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)), + phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)), lv.EVENT.CLICKED, None) - # phone_contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.contact(e)), - # lv.EVENT.CLICKED, None) - phone_delete.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delete(e)), + 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.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.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.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_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_hash.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hash(e)), + lv.EVENT.CLICKED, None) self.phone_num='' self.phone_list = [] self.count = 0 if phone_label != None: - phone_label.set_pos(0, 0) + phone_label.set_pos(0, 14) phone_label.set_size(0, 0) phone_label.set_text(" ") #phone_label.set_text(" ") # print("self.phone_list :{} self.phone_num:{}".format(self.phone_list,self.phone_num)) if self.timer_cb == 0: self.timer_cb = 1 - # self.timer.start(1000,1,self.refresh_line) + self.timer.start(1000,1,self.refresh_line) def refresh_line(self,e): - return if self.count > 2 : self.count = 1 if self.count%2 == 0: @@ -584,20 +606,7 @@ class PhoneScreen(Screen): self.timer_cb = 0 self.timer.stop() - def nine_endpressed_start(self,e): - if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 - #self.phone_list.pop(0) - return - - if self.button == 1:#长按 - self.phone_list.append("#") - else:#短按 - self.phone_list.append("9") - self.phone_num = ''.join(self.phone_list) - self.show_num() - - - def zero_endpressed_start(self,e): + def endpressed_start(self,e): if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 #self.phone_list.pop(0) return @@ -605,20 +614,8 @@ class PhoneScreen(Screen): if self.button == 1:#长按 self.phone_list.append("+") else:#短按 - self.phone_list.append("0") - - self.phone_num = ''.join(self.phone_list) - self.show_num() - - def endpressed_start(self,e): - if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 - #self.phone_list.pop(0) - return - - if self.button == 1:#长按 self.phone_list.append("*") - else:#短按 - self.phone_list.append("7") + self.phone_num = ''.join(self.phone_list) self.show_num() @@ -685,9 +682,11 @@ class PhoneScreen(Screen): def show_num(self): #print("self.phone_num ",self.phone_num,self.phone_list) - global phone_label - phone_label.set_pos(0, 5) - phone_label.set_size(128, 20) + len_t = len(self.phone_list)*40 + if len_t > 230: + len_t = 230 + phone_label.set_size(len_t,48) + phone_label.set_pos(230-len_t,14) phone_label.set_text(self.phone_num) def lcd_on(self): @@ -760,23 +759,23 @@ class CallLogScreen(Screen): call_log_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) call_log_cont_list_screen = lv.obj(call_log_screen) - call_log_cont_list_screen.set_pos(0, 30) - call_log_cont_list_screen.set_size(LCD_X, LCD_Y-30) + call_log_cont_list_screen.set_pos(0, 50) + call_log_cont_list_screen.set_size(240, 270) call_log_cont_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) call_log_cont_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) call_log_title = lv.label(call_log_screen) - call_log_title.set_pos(0, 5) - call_log_title.set_size(LCD_X, 20) - call_log_title.set_long_mode(lv.label.LONG.WRAP) + call_log_title.set_pos(0, 10) + call_log_title.set_size(240, 40) + call_log_title.set_long_mode(lv.label.LONG.CLIP) call_log_title.set_text("通话记录") call_log_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) call_log_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) none_call_log_title = lv.label(call_log_cont_list_screen) - none_call_log_title.set_pos(0, (LCD_Y-30)//2-20) - none_call_log_title.set_size(LCD_X, 20) + none_call_log_title.set_pos(0, 120) + none_call_log_title.set_size(240, 40) none_call_log_title.set_long_mode(lv.label.LONG.WRAP) none_call_log_title.set_text(" ") none_call_log_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -784,7 +783,7 @@ class CallLogScreen(Screen): #self.call_log_detail_list = lv.obj(call_log_screen) self.call_log_detail_list = lv.obj(call_log_cont_list_screen) self.call_log_detail_list.set_pos(0, 0) - self.call_log_detail_list.set_size(LCD_X, LCD_Y-30+1) + self.call_log_detail_list.set_size(240, 271) self.call_log_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.call_log_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) for i in range(self.CALL_LOG_MAX): @@ -798,6 +797,10 @@ class CallLogScreen(Screen): _btn_label4 = lv.label(_btn) _btn_label5 = lv.label(_btn) _btn_label6 = lv.label(_btn) + _btn.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + _btn_label4.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + _btn_label6.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + self.call_log_detail_list_dict.append({"_btn":_btn,"_btn_label2":_btn_label2,"_btn_label3":_btn_label3, "_btn_label4":_btn_label4,"_btn_label5":_btn_label5,"_btn_label6":_btn_label6}) self.meta = call_log_screen @@ -824,7 +827,7 @@ class CallLogScreen(Screen): if self.check_json == True and len(self.read_call_log) != 0: none_call_log_title.set_text(" ") - self.call_log_detail_list.clear_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 + # self.call_log_detail_list.delete()#先删除一次控件 # self.call_log_detail_list = lv.obj(call_log_cont_list_screen) # self.call_log_detail_list.set_pos(0, 0) @@ -834,9 +837,8 @@ class CallLogScreen(Screen): sort_tmp = self.read_call_log.values() sort_new = sorted(sort_tmp, key = lambda i: i['timesec'],reverse = True)#按照时间戳进行排序 去掉最旧的一次数据如果满了五十条 # print("self.call_log :{} \r\n sort_new:{}\r\n".format(self.read_call_log,sort_new)) - + self.call_log_detail_list.clear_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 for sort_new_tmp in sort_new: #字典 key value - num_count = sort_new_tmp["count"]#获取通话次数 num_name = sort_new_tmp["name"]#获取名称 num_phonnum = sort_new_tmp["number"]#获取电话号码 @@ -844,16 +846,16 @@ class CallLogScreen(Screen): # print("num_count :{} num_name:{} num_time:{}".format(num_count,num_name,num_time)) #_btn = lv.btn(self.call_log_detail_list) - self.call_log_detail_list_dict[h]["_btn"].set_size(LCD_X,45) - self.call_log_detail_list_dict[h]["_btn"].set_pos(0,47*h) - self.call_log_detail_list_dict[h]["_btn"].add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + self.call_log_detail_list_dict[h]["_btn"].set_size(240,80) + self.call_log_detail_list_dict[h]["_btn"].set_pos(0,82*h) + #self.call_log_detail_list_dict[h]["_btn"].add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) self.call_log_detail_list_dict[h]["_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), lv.EVENT.CLICKED, None) #_btn_label2 = lv.label(_btn) - self.call_log_detail_list_dict[h]["_btn_label2"].set_pos(0, 0) - self.call_log_detail_list_dict[h]["_btn_label2"].set_size(0, 20) + self.call_log_detail_list_dict[h]["_btn_label2"].set_pos(0, 5) + self.call_log_detail_list_dict[h]["_btn_label2"].set_size(0, 25) self.call_log_detail_list_dict[h]["_btn_label2"].set_text(num_phonnum) #_btn_label2.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) # @@ -864,11 +866,11 @@ class CallLogScreen(Screen): # _btn_label3.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) #_btn_label4 = lv.label(_btn) - self.call_log_detail_list_dict[h]["_btn_label4"].set_pos(5, 24) - self.call_log_detail_list_dict[h]["_btn_label4"].set_size(LCD_X-15, 21) - self.call_log_detail_list_dict[h]["_btn_label4"].set_text(num_phonnum) + self.call_log_detail_list_dict[h]["_btn_label4"].set_pos(0, 38) + self.call_log_detail_list_dict[h]["_btn_label4"].set_size(230, 30) self.call_log_detail_list_dict[h]["_btn_label4"].set_long_mode(lv.label.LONG.CLIP) - self.call_log_detail_list_dict[h]["_btn_label4"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + self.call_log_detail_list_dict[h]["_btn_label4"].set_text(num_phonnum) + #self.call_log_detail_list_dict[h]["_btn_label4"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) #_btn_label5 = lv.label(_btn) self.call_log_detail_list_dict[h]["_btn_label5"].set_pos(0, 5) @@ -878,11 +880,11 @@ class CallLogScreen(Screen): # _btn_label5.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) #_btn_label6 = lv.label(_btn) - self.call_log_detail_list_dict[h]["_btn_label6"].set_pos(5, 4) - self.call_log_detail_list_dict[h]["_btn_label6"].set_size(LCD_X-15, 20) - self.call_log_detail_list_dict[h]["_btn_label6"].set_text(num_name) + self.call_log_detail_list_dict[h]["_btn_label6"].set_pos(0, 5) + self.call_log_detail_list_dict[h]["_btn_label6"].set_size(230, 28) self.call_log_detail_list_dict[h]["_btn_label6"].set_long_mode(lv.label.LONG.CLIP) - self.call_log_detail_list_dict[h]["_btn_label6"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + self.call_log_detail_list_dict[h]["_btn_label6"].set_text(num_name) + #self.call_log_detail_list_dict[h]["_btn_label6"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) self.call_log_detail_list_dict[h]["_btn"].clear_flag(lv.obj.FLAG.HIDDEN) #self.call_log_detail_list_dict[h]["_btn"].scroll_to_view(lv.ANIM.OFF) @@ -971,11 +973,11 @@ dialing_call_label = None hangup_imgbtn = None class DialingScreen(Screen): NAME = "dialing" - + def __init__(self): super().__init__() self.meta = None - self.meta_type = "popup" + self.timer = osTimer() self.call_log = {} self.call_log_value = {} self.read_call_log = {} @@ -989,33 +991,32 @@ class DialingScreen(Screen): print("dialing_screen") dialing_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - # dialing_img = lv.img(dialing_screen) - # dialing_img.set_pos(80, 20) - # dialing_img.set_size(64, 64) - # dialing_img.set_src("U:/static/IMAGE_NOTICE_CALL.png") - # dialing_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + dialing_img = lv.img(dialing_screen) + dialing_img.set_pos(80, 20) + dialing_img.set_size(64, 64) + dialing_img.set_src("E:/static/IMAGE_NOTICE_CALL.png") + dialing_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_name = lv.label(dialing_screen) - dialing_name.set_pos(0, 14) - dialing_name.set_size(LCD_X, 20) + dialing_name.set_pos(0, 120) + dialing_name.set_size(240, 50) dialing_name.set_text(" ") - dialing_name.set_long_mode(lv.label.LONG.DOT) dialing_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) dialing_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_call_label = lv.label(dialing_screen) - dialing_call_label.set_pos(0, 43) - dialing_call_label.set_size(LCD_X, 40) + dialing_call_label.set_pos(0, 174) + dialing_call_label.set_size(240, 50) dialing_call_label.set_text("正在等待对方接\n听电话") dialing_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) dialing_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - hangup_imgbtn = lv.img(dialing_screen) #64 - hangup_imgbtn.set_size(32, 32) - hangup_imgbtn.set_src("U:/static/hang_up.png") + hangup_imgbtn = lv.img(dialing_screen) + hangup_imgbtn.set_size(64, 64) + hangup_imgbtn.set_src("E:/static/hang_up.png") hangup_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) hangup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - hangup_imgbtn.set_pos(48, 90) + hangup_imgbtn.set_pos(80, 250) hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), lv.EVENT.CLICKED, None) self.meta = dialing_screen @@ -1023,12 +1024,25 @@ class DialingScreen(Screen): name = EventMesh.publish("get_phonename")#获取拨打电话名称 dialing_name.set_text(name)#名称 def post_processor_after_initialization(self): - pass + # print("创建通话记录 post_processor_before_initialization\n") + utime.sleep_ms(200)#不加延时会切屏 + def hangup(self,e): EventMesh.publish("set_UI_high_priority", 0) EventMesh.publish("set_hangup_mode", 1) voiceCall.callEnd() + self.timer.start(5000,0,self.call_end) + + def Close(self): + self.timer.stop() + + def call_end(self,*argc): + call_state = EventMesh.publish("get_call_state")#设置关机时间 + if call_state != None: + if call_state == 0:#未打通 + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_return(self): pass @@ -1066,15 +1080,15 @@ class NoSimScreen(Screen):# no_sim_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) no_sim_popup_screen_title1 = lv.label(no_sim_popup_screen) - no_sim_popup_screen_title1.set_pos(0, 40) - no_sim_popup_screen_title1.set_size(LCD_X, 40) + no_sim_popup_screen_title1.set_pos(0, 140) + no_sim_popup_screen_title1.set_size(240, 40) no_sim_popup_screen_title1.set_text("无SIM卡或") no_sim_popup_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_sim_popup_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) no_sim_popup_screen_title2 = lv.label(no_sim_popup_screen) - no_sim_popup_screen_title2.set_pos(0, 60) - no_sim_popup_screen_title2.set_size(LCD_X, 40) + no_sim_popup_screen_title2.set_pos(0, 190) + no_sim_popup_screen_title2.set_size(240, 40) no_sim_popup_screen_title2.set_text("无网络") no_sim_popup_screen_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_sim_popup_screen_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -1103,63 +1117,6 @@ class NoSimScreen(Screen):# def btn8_press(self): EventMesh.publish("return_prev_screen") -wechat_failed_popup_screen = None -wechat_failed_popup_title1 = None -wechat_failed_popup_title2 = None -#未插卡 -class wechatFailedScreen(Screen):#录音失败提示 - NAME = "wechat_failed_popup_screen" - def __init__(self): - super().__init__() - self.meta = None - self.meta_type = "popup" - - def initialization(self): - global wechat_failed_popup_screen,wechat_failed_popup_title1,wechat_failed_popup_title2 - if wechat_failed_popup_screen == None : - wechat_failed_popup_screen = lv.obj() - print("wechat_failed_popup_screen") - wechat_failed_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - wechat_failed_popup_title1 = lv.label(wechat_failed_popup_screen) - wechat_failed_popup_title1.set_pos(0, 40) - wechat_failed_popup_title1.set_size(LCD_X, 40) - wechat_failed_popup_title1.set_text("录音太短") - wechat_failed_popup_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - wechat_failed_popup_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - wechat_failed_popup_title2 = lv.label(wechat_failed_popup_screen) - wechat_failed_popup_title2.set_pos(0, 60) - wechat_failed_popup_title2.set_size(LCD_X, 40) - wechat_failed_popup_title2.set_text("请重试!") - wechat_failed_popup_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - wechat_failed_popup_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - self.meta = wechat_failed_popup_screen - - def done_left_to_right(self): - EventMesh.publish("load_screen",{"screen":"wechat"}) - - def done_right_to_left(self): - EventMesh.publish("load_screen",{"screen":"wechat"}) - - def done_bottom_to_top(self): - EventMesh.publish("load_screen",{"screen":"wechat"}) - - def done_top_to_bottom(self): - EventMesh.publish("load_screen",{"screen":"wechat"}) - - def done_return(self): - EventMesh.publish("load_screen",{"screen":"wechat"}) - - - def btn1_release(self): - EventMesh.publish("load_screen",{"screen":"wechat"}) - - def btn8_press(self): - EventMesh.publish("load_screen",{"screen":"wechat"}) - - no_valied_num_screen = None no_valied_num_screen_title1 = None @@ -1182,16 +1139,16 @@ class NovaliedNumScreen(Screen):# no_valied_num_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) no_valied_num_screen_title1 = lv.label(no_valied_num_screen) - no_valied_num_screen_title1.set_pos(0, 20) - no_valied_num_screen_title1.set_size(128, 20) + no_valied_num_screen_title1.set_pos(0, 140) + no_valied_num_screen_title1.set_size(240, 40) no_valied_num_screen_title1.set_text("无效的号码,") no_valied_num_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_valied_num_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) no_valied_num_screen_title2 = lv.label(no_valied_num_screen) - no_valied_num_screen_title2.set_pos(0, 50) - no_valied_num_screen_title2.set_size(128, 40) + no_valied_num_screen_title2.set_pos(0, 190) + no_valied_num_screen_title2.set_size(240, 40) no_valied_num_screen_title2.set_text("请重新输入") no_valied_num_screen_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_valied_num_screen_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -1256,23 +1213,23 @@ class NoSimPowerScreen(Screen):# no_sim_power_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) no_sim_power_screen_title = lv.label(no_sim_power_screen) - no_sim_power_screen_title.set_pos(0, 5) - no_sim_power_screen_title.set_size(128, 40) + no_sim_power_screen_title.set_pos(0, 20) + no_sim_power_screen_title.set_size(240, 40) no_sim_power_screen_title.set_text("无SIM卡,无法拨打") no_sim_power_screen_title.set_long_mode(lv.label.LONG.WRAP) no_sim_power_screen_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_sim_power_screen_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - # no_sim_power_screen_img = lv.img(no_sim_power_screen) - # no_sim_power_screen_img.set_pos(49, 30) - # no_sim_power_screen_img.set_size(30, 30) - # no_sim_power_screen_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # no_sim_power_screen_img.set_src("U:/static/poweroff_icon.png") + no_sim_power_screen_img = lv.img(no_sim_power_screen) + no_sim_power_screen_img.set_pos(100, 70) + no_sim_power_screen_img.set_size(61, 61) + no_sim_power_screen_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + no_sim_power_screen_img.set_src("E:/static/poweroff_icon.png") no_sim_power_screen_label = lv.label(no_sim_power_screen) - no_sim_power_screen_label.set_pos(0, 45) - no_sim_power_screen_label.set_size(128, 20) + no_sim_power_screen_label.set_pos(0, 150) + no_sim_power_screen_label.set_size(240, 40) no_sim_power_screen_label.set_text("是否关机?") no_sim_power_screen_label.set_long_mode(lv.label.LONG.WRAP) no_sim_power_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -1280,48 +1237,34 @@ class NoSimPowerScreen(Screen):# no_sim_power_screen_comfirm = lv.img(no_sim_power_screen) - no_sim_power_screen_comfirm.set_size(88, 23) - no_sim_power_screen_comfirm.set_pos(20, 65) - no_sim_power_screen_comfirm.set_src("U:/static/off_icon.png") + no_sim_power_screen_comfirm.set_size(176, 46) + no_sim_power_screen_comfirm.set_pos(32, 190) + no_sim_power_screen_comfirm.set_src("E:/static/off_icon.png") no_sim_power_screen_comfirm.add_flag(lv.obj.FLAG.CLICKABLE) no_sim_power_screen_comfirm.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - no_sim_power_screen_comfirm_btn = lv.img(no_sim_power_screen) - no_sim_power_screen_comfirm_btn.set_size(88, 35) - no_sim_power_screen_comfirm_btn.set_pos(20, 55) - no_sim_power_screen_comfirm_btn.add_flag(lv.obj.FLAG.CLICKABLE) - no_sim_power_screen_comfirm_btn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - poweroff_confirm_label = lv.label(no_sim_power_screen_comfirm) poweroff_confirm_label.set_text("确定") - poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 0) + poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 5) poweroff_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) no_sim_power_screen_cancel = lv.img(no_sim_power_screen) - no_sim_power_screen_cancel.set_size(88, 23) - no_sim_power_screen_cancel.set_pos(20, 95) - no_sim_power_screen_cancel.set_src("U:/static/cancel_icon.png") + no_sim_power_screen_cancel.set_size(176, 46) + no_sim_power_screen_cancel.set_pos(32, 265) + no_sim_power_screen_cancel.set_src("E:/static/cancel_icon.png") no_sim_power_screen_cancel.add_flag(lv.obj.FLAG.CLICKABLE) no_sim_power_screen_cancel.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - no_sim_power_screen_cancel_btn = lv.img(no_sim_power_screen) - no_sim_power_screen_cancel_btn.set_size(88, 38) - no_sim_power_screen_cancel_btn.set_pos(20, 90) - no_sim_power_screen_cancel_btn.add_flag(lv.obj.FLAG.CLICKABLE) - no_sim_power_screen_cancel_btn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - poweroff_return_label = lv.label(no_sim_power_screen_cancel) poweroff_return_label.set_text("取消") - poweroff_return_label.align(lv.ALIGN.CENTER, 0, 0) + poweroff_return_label.align(lv.ALIGN.CENTER, 0, 5) poweroff_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) no_sim_power_screen_cancel.set_ext_click_area(20) self.meta = no_sim_power_screen - no_sim_power_screen_comfirm_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), + no_sim_power_screen_comfirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), lv.EVENT.CLICKED, None) - no_sim_power_screen_cancel_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.cancel(e)), + no_sim_power_screen_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.cancel(e)), lv.EVENT.CLICKED, None) def confirm(self,e): @@ -1349,6 +1292,118 @@ class NoSimPowerScreen(Screen):# def btn8_press(self): EventMesh.publish("return_prev_screen") +no_sim_auto_screen = None +no_sim_auto_screen_title = None +no_sim_auto_screen_label =None +no_sim_auto_screen_comfirm =None +no_sim_autor_screen_cancel = None +no_sim_auto_screen_img = None +no_sim_confirm_label = None + +#未插卡,长按关机 +class NoSimAutoScreen(Screen):#无sim卡是否关机 + NAME = "no_sim_auto_screen" + def __init__(self): + super().__init__() + self.meta = None + self.meta_type = "popup" + self.timer = osTimer() + self.count = 0 + + def initialization(self): + global no_sim_auto_screen,no_sim_confirm_label,no_sim_cancel_label,no_sim_auto_screen_img,no_sim_auto_screen_title,no_sim_auto_screen_comfirm,no_sim_auto_screen_cancel,no_sim_auto_screen_label + if no_sim_auto_screen == None : + no_sim_auto_screen = lv.obj() + print("no_sim_power_screen") + no_sim_auto_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + no_sim_auto_screen_title = lv.label(no_sim_auto_screen) + no_sim_auto_screen_title.set_pos(0, 10) + no_sim_auto_screen_title.set_size(240, 50) + no_sim_auto_screen_title.set_text("无SIM卡,无操作30s\n后自动关机") + no_sim_auto_screen_title.set_long_mode(lv.label.LONG.WRAP) + no_sim_auto_screen_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + no_sim_auto_screen_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + no_sim_auto_screen_img = lv.img(no_sim_auto_screen) + no_sim_auto_screen_img.set_pos(100, 70) + no_sim_auto_screen_img.set_size(61, 61) + no_sim_auto_screen_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + no_sim_auto_screen_img.set_src("E:/static/poweroff_icon.png") + + + no_sim_auto_screen_label = lv.label(no_sim_auto_screen) + no_sim_auto_screen_label.set_pos(0, 150) + no_sim_auto_screen_label.set_size(240, 40) + no_sim_auto_screen_label.set_text("是否关机?") + no_sim_auto_screen_label.set_long_mode(lv.label.LONG.WRAP) + no_sim_auto_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + no_sim_auto_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + + no_sim_auto_screen_comfirm = lv.img(no_sim_auto_screen) + no_sim_auto_screen_comfirm.set_size(176, 46) + no_sim_auto_screen_comfirm.set_pos(32, 190) + no_sim_auto_screen_comfirm.set_src("E:/static/off_icon.png") + no_sim_auto_screen_comfirm.add_flag(lv.obj.FLAG.CLICKABLE) + no_sim_auto_screen_comfirm.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + + no_sim_confirm_label = lv.label(no_sim_auto_screen_comfirm) + no_sim_confirm_label.set_text("确定") + no_sim_confirm_label.align(lv.ALIGN.CENTER, 0, 5) + no_sim_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + no_sim_auto_screen_cancel = lv.img(no_sim_auto_screen) + no_sim_auto_screen_cancel.set_size(176, 46) + no_sim_auto_screen_cancel.set_pos(32, 265) + no_sim_auto_screen_cancel.set_src("E:/static/cancel_icon.png") + no_sim_auto_screen_cancel.add_flag(lv.obj.FLAG.CLICKABLE) + no_sim_auto_screen_cancel.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + no_sim_cancel_label = lv.label(no_sim_auto_screen_cancel) + no_sim_cancel_label.set_text("取消") + no_sim_cancel_label.align(lv.ALIGN.CENTER, 0, 5) + no_sim_cancel_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + no_sim_auto_screen_cancel.set_ext_click_area(20) + + self.meta = no_sim_auto_screen + no_sim_auto_screen_comfirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), + lv.EVENT.CLICKED, None) + + no_sim_auto_screen_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.cancel(e)), + lv.EVENT.CLICKED, None) + self.timer.start(1*1000,1,self.fun) + self.count = 0 + def fun(self,*argc): + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.count+=1 + if self.count > 30: + self.count = 0 + self.timer.stop() + EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) + + + def Close(self): + self.count = 0 + self.timer.stop() + + def confirm(self,e): + EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) + + def cancel(self,e): + EventMesh.publish("return_prev_screen") + + def done_return(self): + EventMesh.publish("return_prev_screen") + + def btn1_release(self): + EventMesh.publish("return_prev_screen") + + def btn8_press(self): + EventMesh.publish("return_prev_screen") + + + + dialing_popup_screen = None dialing_popup_img = None dialing_popup_name = None @@ -1363,9 +1418,12 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 self.timer1 = osTimer() self.time_count = 0 self.timer2 = osTimer() - self.CALL_LOG_MAX = CALL_LOG_MAX + self.call_log = {} + self.call_log_value = {} self.read_call_log = {} - + self.number_tmp = {} + self.CALL_LOG_MAX = CALL_LOG_MAX + def initialization(self): EventMesh.publish("set_UI_high_priority", 1) global dialing_popup_screen,dialing_popup_img,dialing_popup_name ,dialing_popup_call,dialing_popup_hangup_imgbtn @@ -1374,33 +1432,32 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 print("dialing_popup_screen") dialing_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - # dialing_popup_img = lv.img(dialing_popup_screen) - # dialing_popup_img.set_pos(32, 5) - # dialing_popup_img.set_size(64, 64) - # dialing_popup_img.set_src("U:/static/IMAGE_NOTICE_CALL.png") - # dialing_popup_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + dialing_popup_img = lv.img(dialing_popup_screen) + dialing_popup_img.set_pos(80, 20) + dialing_popup_img.set_size(64, 64) + dialing_popup_img.set_src("E:/static/IMAGE_NOTICE_CALL.png") + dialing_popup_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_popup_name = lv.label(dialing_popup_screen) - dialing_popup_name.set_pos(0, 15) - dialing_popup_name.set_size(LCD_X, 20) + dialing_popup_name.set_pos(0, 120) + dialing_popup_name.set_size(240, 50) dialing_popup_name.set_text(" ") - dialing_popup_name.set_long_mode(lv.label.LONG.DOT) dialing_popup_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) dialing_popup_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_popup_call = lv.label(dialing_popup_screen) - dialing_popup_call.set_pos(0, 50) - dialing_popup_call.set_size(LCD_X, 20) + dialing_popup_call.set_pos(0, 180) + dialing_popup_call.set_size(240, 50) dialing_popup_call.set_text("正在拨号中") dialing_popup_call.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) dialing_popup_call.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_popup_hangup_imgbtn = lv.img(dialing_popup_screen) - dialing_popup_hangup_imgbtn.set_size(32, 32) - dialing_popup_hangup_imgbtn.set_src("U:/static/hang_up.png") + dialing_popup_hangup_imgbtn.set_size(64, 64) + dialing_popup_hangup_imgbtn.set_src("E:/static/hang_up.png") dialing_popup_hangup_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) dialing_popup_hangup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - dialing_popup_hangup_imgbtn.set_pos(48, 90) + dialing_popup_hangup_imgbtn.set_pos(80, 250) dialing_popup_hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), lv.EVENT.CLICKED, None) self.meta = dialing_popup_screen @@ -1410,8 +1467,6 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 def post_processor_after_initialization(self): self.time_count = 0 - # print("创建通话记录 post_processor_before_initialization\n") - utime.sleep_ms(200)#不加延时会切屏 #获取字符串 name = EventMesh.publish("get_phonename")#获取拨打电话名称 content = EventMesh.publish("get_phonenum")#获取电话号码 @@ -1425,11 +1480,11 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 date_tmp = utime.localtime() time_tmp = utime.mktime(date_tmp) # print("time_tmp:{}".format(time_tmp)) - read_call_log = EventMesh.publish("get_call_log_list") - check_json = read_call_log[0] + read_call_log_tmp = EventMesh.publish("get_call_log_list") + check_json = read_call_log_tmp[0] if check_json == True: - self.read_call_log = read_call_log[1] + self.read_call_log = read_call_log_tmp[1] b = content in self.read_call_log.keys()#查找key中是否包含content电话号码 True 包含在里面 False不包含在里面 if b == True:#查找是否有相同的电话号码 有就直接读出来的次数上加一 没有则从1开始加起 number_tmp = {} @@ -1463,12 +1518,11 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 tmp["number"] = content self.read_call_log[content] = tmp - with open("/usr/static/storage_file/Call_log.json","w",encoding="utf-8") as fd: + with open("/ext/static/storage_file/Call_log.json","w",encoding="utf-8") as fd: ujson.dump(self.read_call_log,fd) print("创建通话记录") EventMesh.publish("set_call_log_list", [1,self.read_call_log]) EventMesh.publish("call_log_update_show_list") - self.timer1.start(1000, 1, self.timeout_hangup) self.timer2.start(2000, 0, self.timeout_call) @@ -1479,13 +1533,10 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 def timeout_hangup(self,e): EventMesh.publish("system_sleep_rest")#防止黑屏 self.time_count+=1 - if self.time_count >= 10:#5s内没有打通则不在继续拨打关闭 + if self.time_count >= 5:#5s内没有打通则不在继续拨打关闭 self.time_count = 0 EventMesh.publish("set_UI_high_priority", 0) - sos_flag = EventMesh.publish("get_sos_flag") - print("sos_flag!!!!!!!!!!!!!!!!:",sos_flag) - if sos_flag == 1: - EventMesh.publish("set_sos_info_call") + EventMesh.publish("set_sos_info_call") EventMesh.publish("load_screen", {"screen": "dial_no_connect_popup"}) @@ -1538,8 +1589,8 @@ class DialNoconnectPopupScreen(Screen):#你所拨打的电话暂时无法接通 dial_no_connect_popup.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_connect_call = lv.label(dial_no_connect_popup) - dialing_connect_call.set_pos(0, 40) - dialing_connect_call.set_size(128, 88) + dialing_connect_call.set_pos(0, 110) + dialing_connect_call.set_size(240, 150) dialing_connect_call.set_text("你好,你所拨打的\n电话暂时无法接\n通,请稍后再拨") dialing_connect_call.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) dialing_connect_call.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -1553,15 +1604,13 @@ class DialNoconnectPopupScreen(Screen):#你所拨打的电话暂时无法接通 def timeout_hangup(self,e): EventMesh.publish("system_sleep_rest")#防止黑屏 self.time_count+=1 - if self.time_count >= 10: + if self.time_count >= 5: self.time_count = 0 EventMesh.publish("return_prev_screen") def Close(self): - self.timer.stop() EventMesh.publish("set_sos_info_call") - - + self.timer.stop() def done_left_to_right(self): EventMesh.publish("return_prev_screen") @@ -1584,119 +1633,92 @@ class DialNoconnectPopupScreen(Screen):#你所拨打的电话暂时无法接通 def btn8_press(self): EventMesh.publish("return_prev_screen") -message_popup_screen = None -message_popup_title = None -#信息弹窗 -class NewMessageScreen(Screen): - NAME = "message_popup" +charge_full_screen = None +charge_full_screen_title = None +class chargefullScreen(Screen):#充电已满弹窗提示 + NAME = "charge_full" def __init__(self): super().__init__() self.meta = None self.meta_type = "popup" - + self.timer = osTimer() + self.count = 0 def initialization(self): - global message_popup_screen,message_popup_title - if message_popup_screen == None : - message_popup_screen = lv.obj() - print("message_popup_screen") - message_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + global charge_full_screen,charge_full_screen_title + if charge_full_screen == None : + charge_full_screen = lv.obj() + print("charge_full_screen") + charge_full_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + + charge_full_screen_title = lv.label(charge_full_screen) + charge_full_screen_title.set_pos(0, 150) + charge_full_screen_title.set_size(240, 40) + charge_full_screen_title.set_text("充电已满") + charge_full_screen_title.set_long_mode(lv.label.LONG.WRAP) + charge_full_screen_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + charge_full_screen_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + self.meta = charge_full_screen + self.count = 0 + self.timer.start(1*1000,1,self.fun) - message_popup_title = lv.label(message_popup_screen) - message_popup_title.set_pos(0, 40) - message_popup_title.set_size(128, 40) - message_popup_title.set_text("你有新的消息") - message_popup_title.set_long_mode(lv.label.LONG.WRAP) - message_popup_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - message_popup_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - self.meta = message_popup_screen - EventMesh.publish("set_sms_clear_all_data",10) - - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") - - def done_right_to_left(self): + def Close(self): + self.count = 0 + self.timer.stop() + pass + + def fun(self,*argc): + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.count+=1 + if self.count > 2*60: + self.count = 0 + self.timer.stop() + #EventMesh.publish("return_prev_screen") + + def done_click(self): EventMesh.publish("return_prev_screen") - def done_bottom_to_top(self): + def done_return(self): EventMesh.publish("return_prev_screen") - def done_top_to_bottom(self): + def btn1_release(self): EventMesh.publish("return_prev_screen") - def done_return(self): + def btn8_press(self): EventMesh.publish("return_prev_screen") - def done_click(self): - EventMesh.publish("load_screen", {"screen": "popup"}) - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) -message_full_screen = None -message_full_label = None -message_full_confirm = None -message_full_cancel = None +message_popup_screen = None +message_popup_title = None #信息弹窗 -class MessageFullScreen(Screen): - NAME = "message_full" +class NewMessageScreen(Screen): + NAME = "message_popup" def __init__(self): super().__init__() self.meta = None self.meta_type = "popup" - EventMesh.subscribe("remove_all_sms_cb",self.remove_all_sms_cb) def initialization(self): - global message_full_screen,message_full_label,message_full_confirm,message_full_cancel - if message_full_screen == None : - message_full_screen = lv.obj() - print("message_full_screen") - message_full_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - message_full_label = lv.label(message_full_screen) - message_full_label.set_pos(0, 10) - message_full_label.set_size(128, 40) - message_full_label.set_text("信息已满,是否清除所有?") - message_full_label.set_long_mode(lv.label.LONG.WRAP) - message_full_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - message_full_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - message_full_confirm = lv.label(message_full_screen) - message_full_confirm.set_text("确认") - message_full_confirm.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - message_full_confirm.set_size(64, 63) - message_full_confirm.set_pos(0,65) - message_full_confirm.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - message_full_confirm.add_flag(lv.obj.FLAG.CLICKABLE) - # message_full_confirm.set_ext_click_area(63) - - message_full_cancel = lv.label(message_full_screen) - message_full_cancel.set_text("取消") - message_full_cancel.set_size(64, 63) - message_full_cancel.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - message_full_cancel.set_pos(64,65) - message_full_cancel.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - message_full_cancel.add_flag(lv.obj.FLAG.CLICKABLE) - # message_full_cancel.set_ext_click_area(63) - self.meta = message_full_screen - - message_full_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None) - message_full_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None) - + global message_popup_screen,message_popup_title + if message_popup_screen == None : + message_popup_screen = lv.obj() + print("message_popup_screen") + message_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - def remove_all_sms_cb(self, event, msg): - sms.deleteMsg(1,4) + message_popup_title = lv.label(message_popup_screen) + message_popup_title.set_pos(0, 150) + message_popup_title.set_size(240, 40) + message_popup_title.set_text("你有新的信息") + message_popup_title.set_long_mode(lv.label.LONG.WRAP) + message_popup_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + message_popup_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + self.meta = message_popup_screen + EventMesh.publish("set_sms_clear_all_data",10) + - def confirm(self, e): - print("sms confirm!!!!!!!!") - # self.timer.start(2*1000,0,self.clear_data) - EventMesh.publish("load_screen", {"screen": "remove_message_popup"}) - EventMesh.publish_async("remove_all_sms_cb","",1*1024) - def concel(self, e): - EventMesh.publish("return_prev_screen") def done_left_to_right(self): EventMesh.publish("return_prev_screen") @@ -1712,6 +1734,8 @@ class MessageFullScreen(Screen): def done_return(self): EventMesh.publish("return_prev_screen") + def done_click(self): + EventMesh.publish("load_screen", {"screen": "popup"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1738,8 +1762,8 @@ class RemoveMessageScreen(Screen):#删除短信弹窗框 remove_message_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) message_popup_title = lv.label(remove_message_popup_screen) - message_popup_title.set_pos(0, 40) - message_popup_title.set_size(120, 50) + message_popup_title.set_pos(0, 150) + message_popup_title.set_size(240, 50) message_popup_title.set_text("正在删除中...\n请稍候") message_popup_title.set_long_mode(lv.label.LONG.WRAP) message_popup_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -1747,7 +1771,6 @@ class RemoveMessageScreen(Screen):#删除短信弹窗框 self.meta = remove_message_popup_screen self.timer.start(1000,1,self.timer_cb) def timer_cb(self,*argc): - EventMesh.publish("system_sleep_rest")#防止黑屏 msg_nums = sms.getMsgNums() # print("timer_cb remove!!!!!!!!!",msg_nums) if msg_nums == 0: @@ -1779,10 +1802,88 @@ class RemoveMessageScreen(Screen):#删除短信弹窗框 def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) +message_full_screen = None +message_full_label = None +message_full_confirm = None +message_full_cancel = None +#信息弹窗 +class MessageFullScreen(Screen): + NAME = "message_full" + def __init__(self): + super().__init__() + self.meta = None + self.meta_type = "popup" + EventMesh.subscribe("remove_all_sms_cb",self.remove_all_sms_cb) + def initialization(self): + global message_full_screen,message_full_label,message_full_confirm,message_full_cancel + if message_full_screen == None : + message_full_screen = lv.obj() + print("message_full_screen") + message_full_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + message_full_label = lv.label(message_full_screen) + message_full_label.set_pos(0, 100) + message_full_label.set_size(240, 50) + message_full_label.set_text("信息已满,是否清除所有?") + message_full_label.set_long_mode(lv.label.LONG.WRAP) + message_full_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + message_full_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + + message_full_confirm = lv.label(message_full_screen) + message_full_confirm.set_text("确认") + message_full_confirm.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + message_full_confirm.set_size(120, 60) + message_full_confirm.set_pos(0,180) + message_full_confirm.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + message_full_confirm.add_flag(lv.obj.FLAG.CLICKABLE) + message_full_confirm.set_ext_click_area(20) + + message_full_cancel = lv.label(message_full_screen) + message_full_cancel.set_text("取消") + message_full_cancel.set_size(120, 60) + message_full_cancel.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + message_full_cancel.set_pos(120,180) + message_full_cancel.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + message_full_cancel.add_flag(lv.obj.FLAG.CLICKABLE) + message_full_cancel.set_ext_click_area(20) + self.meta = message_full_screen + + message_full_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None) + message_full_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None) + + def remove_all_sms_cb(self, event, msg): + sms.deleteMsg(1,4) + + def confirm(self, e): + print("sms confirm!!!!!!!!") + # self.timer.start(2*1000,0,self.clear_data) + EventMesh.publish("load_screen", {"screen": "remove_message_popup"}) + EventMesh.publish_async("remove_all_sms_cb","",1*1024) + + def concel(self, e): + 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 done_return(self): + EventMesh.publish("return_prev_screen") + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn8_press(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) ############短信############################### MSG_FLAG = 0 MSG_MAX = 5 #最大显示短信内容条数 @@ -1795,11 +1896,12 @@ def msg_cb(args): if index != -1: tmp = sms.searchTextMsg(index) detail = tmp[1]#内容 + print("msg_cb:detail {}".format,detail) if detail.find("SETIP:") != -1:#寻找是否有这个字符串 tmp_test = detail.split("SETIP:")[1] if tmp_test.find(":") != -1: new_ip = tmp_test.split(':')[0] - print("tmp_test:{} new_ip:{}".format(tmp_test,new_ip)) + # print("tmp_test:{} new_ip:{}".format(tmp_test,new_ip)) new_com = tmp_test.split(':')[1] # new_md5 = detail.split(':')[3] if len(new_ip) > 0 and len(new_com) > 0: @@ -1820,6 +1922,7 @@ style_sms_bg_btn.set_bg_grad_color(lv.color_make(0xff, 0xff, 0xff)) style_sms_bg_btn.set_bg_opa(255) style_sms_bg_btn.set_border_color(lv.color_make(0xff, 0xff, 0xff)) style_sms_bg_btn.set_border_opa(255) +style_sms_bg_btn.set_border_width(0) style_sms_bg_btn.set_pad_left(0) style_sms_bg_btn.set_pad_right(0) style_sms_bg_btn.set_pad_top(0) @@ -1866,8 +1969,8 @@ class PopupScreen(Screen): msg_top_title = lv.label(msg_list_screen) - msg_top_title.set_pos(0, 5) - msg_top_title.set_size(LCD_X, 20) + msg_top_title.set_pos(0, 10) + msg_top_title.set_size(240, 40) msg_top_title.set_text("信息") msg_top_title.set_long_mode(lv.label.LONG.WRAP) msg_top_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -1875,21 +1978,21 @@ class PopupScreen(Screen): msg_cont_list_screen = lv.obj(msg_list_screen) - msg_cont_list_screen.set_pos(0, 30) - msg_cont_list_screen.set_size(LCD_X, LCD_Y-30) + msg_cont_list_screen.set_pos(0, 50) + msg_cont_list_screen.set_size(240, 270) msg_cont_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) msg_cont_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) msg_list_t_done_img = lv.img(msg_cont_list_screen) - msg_list_t_done_img.set_pos(39, 10) - msg_list_t_done_img.set_size(50, 44) - msg_list_t_done_img.set_src("U:/static/IMAGE_NOTICE_NONE.png") + msg_list_t_done_img.set_pos(53, 20) + msg_list_t_done_img.set_size(134, 117) + msg_list_t_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.png") msg_list_t_done_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) no_msg_text = lv.label(msg_cont_list_screen) - no_msg_text.set_pos(0, 75) - no_msg_text.set_size(LCD_X, 20) + no_msg_text.set_pos(0, 210) + no_msg_text.set_size(240, 40) no_msg_text.set_text("暂无信息") no_msg_text.set_long_mode(lv.label.LONG.WRAP) no_msg_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -1897,7 +2000,7 @@ class PopupScreen(Screen): self.sms_detail_list = lv.obj(msg_cont_list_screen) self.sms_detail_list.set_pos(0, 0) - self.sms_detail_list.set_size(LCD_X, 129) + self.sms_detail_list.set_size(230, 271) self.sms_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.sms_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) for i in range(MSG_MAX): @@ -1909,6 +2012,10 @@ class PopupScreen(Screen): _btn_label3 = lv.label(msg_btn) _btn_label4 = lv.label(msg_btn) _btn_label5 = lv.label(msg_btn) + msg_btn.add_style(style_sms_bg_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + _btn_label4.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + _btn_label5.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + self.sms_detail_list_dict.append({"msg_btn":msg_btn,"_btn_label2":_btn_label2,"_btn_label3":_btn_label3, "_btn_label4":_btn_label4,"_btn_label5":_btn_label5}) self.meta = msg_list_screen @@ -2042,7 +2149,6 @@ class PopupScreen(Screen): if msg_cont_list_screen != None: msg_list_t_done_img.clear_flag(lv.obj.FLAG.HIDDEN) no_msg_text.clear_flag(lv.obj.FLAG.HIDDEN) - self.sms_detail_list.add_flag(lv.obj.FLAG.HIDDEN) no_msg_text.set_text("正在加载···") if self.sms_detail_list != None: self.sms_detail_list.add_flag(lv.obj.FLAG.HIDDEN) @@ -2103,9 +2209,9 @@ class PopupScreen(Screen): tmp = self.sms_data[i] if tmp != -1: #msg_btn = lv.btn(self.sms_detail_list) - self.sms_detail_list_dict[i]["msg_btn"].set_size(LCD_X,45) - self.sms_detail_list_dict[i]["msg_btn"].set_pos(0,47*count) - self.sms_detail_list_dict[i]["msg_btn"].add_style(style_sms_bg_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + self.sms_detail_list_dict[i]["msg_btn"].set_size(230,65) + self.sms_detail_list_dict[i]["msg_btn"].set_pos(0,67*count) + #self.sms_detail_list_dict[i]["msg_btn"].add_style(style_sms_bg_btn, lv.PART.MAIN | lv.STATE.DEFAULT) # self.sms_detail_list_dict[i]["msg_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.sms_cb(e)), # lv.EVENT.CLICKED, None) @@ -2127,19 +2233,19 @@ class PopupScreen(Screen): detail1 = tmp[1] #_btn_label4 = lv.label(msg_btn) - self.sms_detail_list_dict[i]["_btn_label4"].set_pos(5, 24) - self.sms_detail_list_dict[i]["_btn_label4"].set_size(LCD_X-15, 21) + self.sms_detail_list_dict[i]["_btn_label4"].set_pos(0, 34) + self.sms_detail_list_dict[i]["_btn_label4"].set_size(230, 28) self.sms_detail_list_dict[i]["_btn_label4"].set_text(detail1) self.sms_detail_list_dict[i]["_btn_label4"].set_long_mode(lv.label.LONG.DOT) - self.sms_detail_list_dict[i]["_btn_label4"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + #self.sms_detail_list_dict[i]["_btn_label4"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) title1 = tmp[0] #_btn_label5 = lv.label(msg_btn) - self.sms_detail_list_dict[i]["_btn_label5"].set_pos(5, 5) - self.sms_detail_list_dict[i]["_btn_label5"].set_size(LCD_X-15, 20) + self.sms_detail_list_dict[i]["_btn_label5"].set_pos(0, 5) + self.sms_detail_list_dict[i]["_btn_label5"].set_size(230, 28) self.sms_detail_list_dict[i]["_btn_label5"].set_text(title1) self.sms_detail_list_dict[i]["_btn_label5"].set_long_mode(lv.label.LONG.DOT) - self.sms_detail_list_dict[i]["_btn_label5"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + #self.sms_detail_list_dict[i]["_btn_label5"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) self.sms_detail_list_dict[i]["msg_btn"].clear_flag(lv.obj.FLAG.HIDDEN) #if msg == 1: @@ -2182,30 +2288,12 @@ class PopupScreen(Screen): def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) -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_20_black_bg_gray = lv.style_t() -style_font_20_black_bg_gray.init() -style_font_20_black_bg_gray.set_text_color(lv.color_make(0x00, 0x00, 0x00)) -#style_font_youyuan_20.set_text_font_v2("font_28.bin",28,0) -style_font_20_black_bg_gray.set_bg_color(lv.color_make(0xe1,0xdb,0xdb)) -style_font_20_black_bg_gray.set_text_font(lv.K01_font_16_ALL) msg_detail_screen = None msg_detail_title = None msg_detail_cont = None +msg_detail_cont_obj = None class MsgDetailScreen(Screen): NAME = "msg_detail" @@ -2223,29 +2311,30 @@ class MsgDetailScreen(Screen): msg_detail_screen = lv.obj() print("msg_detail_screen") msg_detail_screen.add_style(style_white_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - msg_detail_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + msg_detail_title = lv.label(msg_detail_screen) msg_detail_title.set_pos(0, 10) - msg_detail_title.set_size(128, 20) + msg_detail_title.set_size(240, 35) msg_detail_title.set_long_mode(lv.label.LONG.WRAP) msg_detail_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - msg_detail_title.add_style(style_font_20_black_bg_gray, lv.PART.MAIN | lv.STATE.DEFAULT) + msg_detail_title.add_style(style_font_28_black_bg_gray, lv.PART.MAIN | lv.STATE.DEFAULT) msg_detail_cont_obj = lv.obj(msg_detail_screen) - msg_detail_cont_obj.set_pos(0, 30) - msg_detail_cont_obj.set_size(128, 98) - msg_detail_cont_obj.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + msg_detail_cont_obj.set_pos(0, 45) + msg_detail_cont_obj.set_size(240, 270) msg_detail_cont_obj.add_style(style_white_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - msg_detail_cont = lv.label(msg_detail_cont_obj) - msg_detail_cont.set_pos(5, 5) - msg_detail_cont.set_width(118) - msg_detail_cont.set_style_text_align(lv.TEXT_ALIGN.LEFT, 5) - msg_detail_cont.add_style(style_font_20_black_bg_gray, lv.PART.MAIN | lv.STATE.DEFAULT) + msg_detail_cont.set_pos(0, 5) + msg_detail_cont.set_size(240, lv.SIZE.CONTENT) + msg_detail_cont.set_long_mode(lv.label.LONG.WRAP) + msg_detail_cont.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + msg_detail_cont.add_style(style_font_28_black_bg_gray, lv.PART.MAIN | lv.STATE.DEFAULT) self.meta = msg_detail_screen #获取字符串 + + msg_detail_cont_obj.scroll_to(0, 0, lv.ANIM.OFF) - + self.name = EventMesh.publish("get_msg_name") self.content = EventMesh.publish("get_msg_content") msg_detail_title.set_text(self.name) @@ -2253,8 +2342,11 @@ class MsgDetailScreen(Screen): # msg_detail_cont.set_size(240, tmp_y) msg_detail_cont.set_text(self.content) - - + + def post_processor_after_initialization(self): + size = msg_detail_cont.get_height() + print("size:",size) + def done_return(self): EventMesh.publish("load_screen", {"screen": "popup"}) @@ -2320,23 +2412,23 @@ class HeartrateScreen(Screen): heartrate_line_bg_img = lv.img(heartrate_screen) heartrate_line_bg_img.set_pos(5, 60) heartrate_line_bg_img.set_size(230, 120) - heartrate_line_bg_img.set_src("U:/static/hr_line_bg.png") + heartrate_line_bg_img.set_src("E:/static/hr_line_bg.png") heartrate_done_img = lv.img(heartrate_screen) heartrate_done_img.set_pos(20, 249) - heartrate_done_img.set_src("U:/static/hr_gif_03.png") + heartrate_done_img.set_src("E:/static/hr_gif_03.png") heartrate_reset_btn_img = lv.img(heartrate_screen) heartrate_reset_btn_img.set_pos(0, 192) - heartrate_reset_btn_img.set_src("U:/static/reset_hr_btn.png") + heartrate_reset_btn_img.set_src("E:/static/reset_hr_btn.png") heartrate_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN) heartrate_reset_btn_img.add_flag(lv.obj.FLAG.CLICKABLE) heartrate_start_label = lv.label(heartrate_screen) heartrate_start_label.set_size(240,40) heartrate_start_label.set_pos(0,200) - heartrate_start_label.set_text(" ") + heartrate_start_label.set_text("正在测量中.") heartrate_start_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) heartrate_start_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) heartrate_start_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) @@ -2387,6 +2479,7 @@ class HeartrateScreen(Screen): heartrate_bpm_label = lv.label(heartrate_screen) heartrate_bpm_label.set_size(120, 40) heartrate_bpm_label.set_pos(120, 270) + heartrate_bpm_label.set_text("-- bpm") heartrate_bpm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) heartrate_bpm_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) @@ -2433,107 +2526,68 @@ class HeartrateScreen(Screen): global hr_line1,hr_line2,hr_line3,hr_line4,hr_line5,hr_line6,hr_line7 read_data = {} read_data = EventMesh.publish("get_history_hr_value") - print("hr history read_data",read_data) - if read_data != None: - count = len(read_data) - if count != 0: - if count >= 7: - for i in range(count): - value = read_data["0{}".format(i+1)] - if value < 30: - value = 30 - if value >= 210: - value = 210 - line_value = value - 30 #180-80 = 100 160-100 = 60 - line_value = int(line_value*0.58)+1 - if line_value >= 100: - line_value = 100 - #print("hr hist",line_value) - hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}] - if i == 0: - hr_line1.set_points(hr_line_points,2) - hr_line1.set_pos(25,160-line_value) - hr_line1.set_size(10,line_value) - if i == 1: - hr_line2.set_points(hr_line_points,2) - hr_line2.set_pos(53,160-line_value) - hr_line2.set_size(10,line_value) - - if i == 2: - hr_line3.set_points(hr_line_points,2) - hr_line3.set_pos(80,160-line_value) - hr_line3.set_size(10,line_value) - - if i == 3: - hr_line4.set_points(hr_line_points,2) - hr_line4.set_pos(109,160-line_value) - hr_line4.set_size(10,line_value) - - if i == 4: - hr_line5.set_points(hr_line_points,2) - hr_line5.set_pos(136,160-line_value) - hr_line5.set_size(10,line_value) - - if i == 5: - hr_line6.set_points(hr_line_points,2) - hr_line6.set_pos(164,160-line_value) - hr_line6.set_size(10,line_value) - - if i == 6: - hr_line7.set_points(hr_line_points,2) - hr_line7.set_pos(192,160-line_value) - hr_line7.set_size(10,line_value) - else: - value = read_data["0{}".format(count)] + if len(read_data) != 0: + sort_new = {} + sort_new = sorted(read_data, key = lambda i: i['timeSec'],reverse = False)#按照时间戳进行排序 去掉最旧的一次数据如果满了五十条 + # print("hr history sort_new",sort_new) + if sort_new != []: + for i in range(len(sort_new)): + print(int(sort_new[i]["hr"])) + # print("hr history read_data",read_data) + value = int(sort_new[i]["hr"]) if value < 30: value = 30 - if value >= 180: - value = 180 + if value >= 210: + value = 210 line_value = value - 30 #180-80 = 100 160-100 = 60 line_value = int(line_value*0.58)+1 - # + if line_value >= 100: + line_value = 100 + #print("hr hist",line_value) hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}] - if count == 1: + if i == 0: hr_line1.set_points(hr_line_points,2) hr_line1.set_pos(25,160-line_value) hr_line1.set_size(10,line_value) - if count == 2: + if i == 1: hr_line2.set_points(hr_line_points,2) hr_line2.set_pos(53,160-line_value) hr_line2.set_size(10,line_value) - if count == 3: + if i == 2: hr_line3.set_points(hr_line_points,2) hr_line3.set_pos(80,160-line_value) hr_line3.set_size(10,line_value) - if count == 4: + if i == 3: hr_line4.set_points(hr_line_points,2) hr_line4.set_pos(109,160-line_value) hr_line4.set_size(10,line_value) - if count == 5: + if i == 4: hr_line5.set_points(hr_line_points,2) hr_line5.set_pos(136,160-line_value) hr_line5.set_size(10,line_value) - if count == 6: + if i == 5: hr_line6.set_points(hr_line_points,2) hr_line6.set_pos(164,160-line_value) hr_line6.set_size(10,line_value) - if count == 7: + if i == 6: hr_line7.set_points(hr_line_points,2) hr_line7.set_pos(192,160-line_value) - hr_line7.set_size(10,line_value) - - - def start_measure(self,*args): + hr_line7.set_size(10,line_value) + def start_measure(self,*args): + EventMesh.publish("publish_message_event_ui",{"func":self.start_measure_do,"data":0}) + def start_measure_do(self,data): global heartrate_screen,heartrate_label,heartrate_done_img ,heartrate_reset_btn_img,heartrate_start_label,heartrate_bpm_label ,heartrate_done_label self.point = self.point + 1 EventMesh.publish("system_sleep_rest")#防止黑屏 self.heart_value = EventMesh.publish(constants.EVENT.GET_HEART) - print("self.heart_value:{}".format(self.heart_value)) + WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据 + #print("heart WEAR:{}".format(WEAR)) + # print("self.heart_value:{}".format(self.heart_value)) if self.point >= 2: if self.heart_value < 40: self.heart_value = 0 @@ -2544,39 +2598,44 @@ class HeartrateScreen(Screen): if self.point%4 == 0 : heartrate_start_label.set_text("正在测量中..") - heartrate_done_img.set_src("U:/static/hr_gif_02.png") + heartrate_done_img.set_src("E:/static/hr_gif_02.png") if self.point%4 == 1 : heartrate_start_label.set_text("正在测量中...") - heartrate_done_img.set_src("U:/static/hr_gif_01.png") + heartrate_done_img.set_src("E:/static/hr_gif_01.png") if self.point%4 == 2 : heartrate_start_label.set_text("正在测量中.") - heartrate_done_img.set_src("U:/static/hr_gif_02.png") + heartrate_done_img.set_src("E:/static/hr_gif_02.png") if self.point%4 == 3 : heartrate_start_label.set_text("正在测量中.") - heartrate_done_img.set_src("U:/static/hr_gif_03.png") + heartrate_done_img.set_src("E:/static/hr_gif_03.png") - if self.point > 120: #测20s - heartrate_done_img.set_src("U:/static/hr_gif_03.png") + if self.point > 120 or (WEAR == 0 and self.point > 10): #测60s或没佩戴 + self.timer.stop() + heartrate_done_img.set_src("E:/static/hr_gif_03.png") + self.heart_value = EventMesh.publish(constants.EVENT.GET_HEART) + if WEAR == 0: + self.heart_value = 0 + heartrate_start_label.set_text("佩戴异常,点击重测") + else : + heartrate_start_label.set_text("测量结束,点击重测") + if self.heart_value > 50: EventMesh.publish("set_old_hr_data",self.heart_value) EventMesh.publish("set_history_hr_value",self.heart_value) EventMesh.publish(constants.PROTOCOL.HEART_SEND,self.heart_value) heartrate_reset_btn_img.clear_flag(lv.obj.FLAG.HIDDEN) - heartrate_start_label.set_text("测量结束,点击重测") + if self.heart_value != 0: heartrate_bpm_label.set_text("{} bpm".format(self.heart_value)) # heartrate_done_label.set_text("测量完成") else: heartrate_bpm_label.set_text("-- bpm") - self.show_history_data() - - self.timer.stop() self.point = 0 EventMesh.publish("set_hr_state",0)#0代表关闭测试 print("stop debug9") @@ -2638,151 +2697,78 @@ class ToolboxScreen(Screen): global toolbox_screen,toolbox_text_img,toolbox_cont,toolbox_step_img,toolbox_weather_img ,toolbox_alarm_img ,\ toolbox_countdown_img,toolbox_stopwatch_img if toolbox_screen == None: - tool_set_y = 5 + tool_set_y = 0 toolbox_screen = lv.obj() print("toolbox_screen") toolbox_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) toolbox_screen.set_scrollbar_mode(0) - # toolbox_text_img = lv.img(toolbox_screen) - # toolbox_text_img.set_pos(75, 10) - # toolbox_text_img.set_size(90, 30) - # toolbox_text_img.set_src("U:/static/tool/tool_text.png") - # toolbox_text_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # toolbox_title = lv.label(toolbox_screen) - # toolbox_title.set_pos(0, 5) - # toolbox_title.set_size(128, 20) - # toolbox_title.set_text("工具箱") - # toolbox_title.set_long_mode(lv.label.LONG.WRAP) - # toolbox_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - # toolbox_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + toolbox_text_img = lv.img(toolbox_screen) + toolbox_text_img.set_pos(75, 10) + toolbox_text_img.set_size(90, 30) + toolbox_text_img.set_src("E:/static/tool/tool_text.png") + toolbox_text_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) toolbox_cont = lv.obj(toolbox_screen) - toolbox_cont.set_pos(0, 0) - toolbox_cont.set_size(128, 128) + toolbox_cont.set_pos(0, 50) + toolbox_cont.set_size(240, 270) toolbox_cont.add_style(toolbox_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT) toolbox_step_img = lv.img(toolbox_cont) - toolbox_step_img.set_pos(5, tool_set_y) - toolbox_step_img.set_size(25, 25) + toolbox_step_img.set_pos(4, tool_set_y) + toolbox_step_img.set_size(232, 80) toolbox_step_img.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_step_img.set_src("U:/static/IMAGE_SECMENU_STEP.png") + toolbox_step_img.set_src("E:/static/tool/IMAGE_SECMENU_STEP.png") toolbox_step_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - toolbox_step_img_label = lv.label(toolbox_cont) - toolbox_step_img_label.set_pos(35, tool_set_y+5) - toolbox_step_img_label.set_size(128-35, 35) - toolbox_step_img_label.set_text("计步") - toolbox_step_img_label.set_long_mode(lv.label.LONG.WRAP) - toolbox_step_img_label.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_step_img_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) - toolbox_step_img_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - tool_set_y+=35 + tool_set_y+=90 toolbox_weather_img = lv.img(toolbox_cont) - toolbox_weather_img.set_pos(5, tool_set_y) - toolbox_weather_img.set_size(25, 25) + toolbox_weather_img.set_pos(4, tool_set_y) + toolbox_weather_img.set_size(232, 80) toolbox_weather_img.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_weather_img.set_src("U:/static/IMAGE_SECMENU_WEATHER.png") + toolbox_weather_img.set_src("E:/static/tool/IMAGE_SECMENU_WEATHER.png") toolbox_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - toolbox_weather_img_label = lv.label(toolbox_cont) - toolbox_weather_img_label.set_pos(35, tool_set_y+5) - toolbox_weather_img_label.set_size(128-35, 35) - toolbox_weather_img_label.set_text("天气") - toolbox_weather_img_label.set_long_mode(lv.label.LONG.WRAP) - toolbox_weather_img_label.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_weather_img_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) - toolbox_weather_img_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - - tool_set_y+=35 + tool_set_y+=90 toolbox_alarm_img = lv.img(toolbox_cont) - toolbox_alarm_img.set_pos(5, tool_set_y) - toolbox_alarm_img.set_size(25, 25) + toolbox_alarm_img.set_pos(4, tool_set_y) + toolbox_alarm_img.set_size(232, 80) toolbox_alarm_img.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_alarm_img.set_src("U:/static/IMAGE_SECMENU_ALARM.png") + toolbox_alarm_img.set_src("E:/static/tool/IMAGE_SECMENU_ALARM.png") toolbox_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - toolbox_alarm_img_label = lv.label(toolbox_cont) - toolbox_alarm_img_label.set_pos(35, tool_set_y+5) - toolbox_alarm_img_label.set_size(128-35, 35) - toolbox_alarm_img_label.set_text("闹钟") - toolbox_alarm_img_label.set_long_mode(lv.label.LONG.WRAP) - toolbox_alarm_img_label.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_alarm_img_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) - toolbox_alarm_img_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - # tool_set_y+=90 # toolbox_sms_img = lv.img(toolbox_cont) # toolbox_sms_img.set_pos(4, tool_set_y) # toolbox_sms_img.set_size(232, 80) # toolbox_sms_img.add_flag(lv.obj.FLAG.CLICKABLE) - # toolbox_sms_img.set_src("U:/static/tool/sms_setting.png") + # toolbox_sms_img.set_src("E:/static/tool/sms_setting.png") # toolbox_sms_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - tool_set_y+=35 + tool_set_y+=90 toolbox_countdown_img = lv.img(toolbox_cont) - toolbox_countdown_img.set_pos(5, tool_set_y) - toolbox_countdown_img.set_size(25, 25) + toolbox_countdown_img.set_pos(4, tool_set_y) + toolbox_countdown_img.set_size(232, 80) toolbox_countdown_img.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_countdown_img.set_src("U:/static/IMAGE_SECMENU_COUNTDOWN.png") + toolbox_countdown_img.set_src("E:/static/tool/IMAGE_SECMENU_COUNTDOWN.png") toolbox_countdown_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - toolbox_countdown_img_label = lv.label(toolbox_cont) - toolbox_countdown_img_label.set_pos(35, tool_set_y+5) - toolbox_countdown_img_label.set_size(128-35, 35) - toolbox_countdown_img_label.set_text("倒计时") - toolbox_countdown_img_label.set_long_mode(lv.label.LONG.WRAP) - toolbox_countdown_img_label.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_countdown_img_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) - toolbox_countdown_img_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - - tool_set_y+=35 + tool_set_y+=90 toolbox_stopwatch_img = lv.img(toolbox_cont) - toolbox_stopwatch_img.set_pos(5, tool_set_y) - toolbox_stopwatch_img.set_size(25, 25) + toolbox_stopwatch_img.set_pos(4, tool_set_y) + toolbox_stopwatch_img.set_size(232, 80) toolbox_stopwatch_img.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_stopwatch_img.set_src("U:/static/IMAGE_SECMENU_STOPWATCH.png") + toolbox_stopwatch_img.set_src("E:/static/tool/IMAGE_SECMENU_STOPWATCH.png") toolbox_stopwatch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - toolbox_stopwatch_img_label = lv.label(toolbox_cont) - toolbox_stopwatch_img_label.set_pos(35, tool_set_y+5) - toolbox_stopwatch_img_label.set_size(128-35, 35) - toolbox_stopwatch_img_label.set_text("秒表") - toolbox_stopwatch_img_label.set_long_mode(lv.label.LONG.WRAP) - - toolbox_stopwatch_img_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) - toolbox_stopwatch_img_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - toolbox_stopwatch_img_label_btn = lv.label(toolbox_cont) - toolbox_stopwatch_img_label_btn.set_pos(0, tool_set_y) - toolbox_stopwatch_img_label_btn.set_size(128, 45) - toolbox_stopwatch_img_label_btn.set_text(" ") - toolbox_stopwatch_img_label_btn.set_long_mode(lv.label.LONG.WRAP) - toolbox_stopwatch_img_label_btn.add_flag(lv.obj.FLAG.CLICKABLE) - toolbox_stopwatch_img_label_btn.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - toolbox_step_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "step"})), lv.EVENT.CLICKED, None) toolbox_weather_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "weather"})), lv.EVENT.CLICKED, None) toolbox_alarm_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "clk_list"})), lv.EVENT.CLICKED, None) # toolbox_sms_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "popup"})), lv.EVENT.CLICKED, None) toolbox_countdown_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "countdown"})), lv.EVENT.CLICKED, None) toolbox_stopwatch_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "stopwatch"})), lv.EVENT.CLICKED, None) - - toolbox_step_img_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "step"})), lv.EVENT.CLICKED, None) - toolbox_weather_img_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "weather"})), lv.EVENT.CLICKED, None) - toolbox_alarm_img_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "clk_list"})), lv.EVENT.CLICKED, None) - # toolbox_sms_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "popup"})), lv.EVENT.CLICKED, None) - toolbox_countdown_img_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "countdown"})), lv.EVENT.CLICKED, None) - toolbox_stopwatch_img_label_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "stopwatch"})), lv.EVENT.CLICKED, None) - - self.meta = toolbox_screen def done_return(self): @@ -2808,9 +2794,9 @@ class IncomingCallScreen(Screen): def __init__(self): super().__init__() self.CALL_LOG_MAX = CALL_LOG_MAX - self.read_data = {} - self.meta_type = "popup" + self.aud = audio.Audio(0) + self.call_timer = osTimer() self.name = None self.phonebook = {} @@ -2832,31 +2818,32 @@ class IncomingCallScreen(Screen): incoming_call_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) incoming_call_img = lv.img(incoming_call_screen) - incoming_call_img.set_pos(48, 10) - incoming_call_img.set_size(32, 32) - incoming_call_img.set_src("U:/static/IMAGE_NOTICE_CALL.png") + incoming_call_img.set_pos(80, 20) + incoming_call_img.set_size(64, 64) + incoming_call_img.set_src("E:/static/IMAGE_NOTICE_CALL.png") incoming_call_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) incoming_call_name_label = lv.label(incoming_call_screen) - incoming_call_name_label.set_pos(0, 50) + incoming_call_name_label.set_pos(0, 140) incoming_call_name_label.set_text(" ") - incoming_call_name_label.set_size(128, 40) + incoming_call_name_label.set_size(240, 50) incoming_call_name_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) incoming_call_name_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) incoming_call_answer = lv.img(incoming_call_screen) - incoming_call_answer.set_size(32, 32) + incoming_call_answer.set_size(64, 64) incoming_call_answer.add_flag(lv.obj.FLAG.CLICKABLE) - incoming_call_answer.set_pos(84, 85) + incoming_call_answer.set_pos(150, 220) incoming_call_answer.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - incoming_call_answer.set_src("U:/static/answer.png") + incoming_call_answer.set_src("E:/static/answer.png") incoming_call_hangup = lv.img(incoming_call_screen) - incoming_call_hangup.set_size(32, 32) + incoming_call_hangup.set_size(64, 64) incoming_call_hangup.add_flag(lv.obj.FLAG.CLICKABLE) - incoming_call_hangup.set_pos(11, 85) + incoming_call_hangup.set_pos(30, 220) incoming_call_hangup.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - incoming_call_hangup.set_src("U:/static/hang_up.png") + incoming_call_hangup.set_src("E:/static/hang_up.png") + incoming_call_answer.add_event_cb(lambda e: EventMesh.callback_wrapper(self.answer(e)), lv.EVENT.CLICKED, None) incoming_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), @@ -2969,7 +2956,7 @@ class IncomingCallScreen(Screen): tmp["number"] = self.meta_info self.read_call_log[self.meta_info] = tmp - with open("/usr/static/storage_file/Call_log.json","w",encoding="utf-8") as fd: + with open("/ext/static/storage_file/Call_log.json","w",encoding="utf-8") as fd: ujson.dump(self.read_call_log,fd) print("创建通话记录") EventMesh.publish("set_call_log_list", [1,self.read_call_log]) @@ -3058,17 +3045,15 @@ class OnCallScreen(Screen): def __init__(self): super().__init__() self.meta = None - self.meta_type = "popup" self.count_sec = 0 self.timer = osTimer() self.aud = audio.Audio(0) - # self.aud.set_pa(Pin.GPIO29) - self.read_data = {} self.volum_size = 8 self.open_volum = 0 self.phone_num = '' self.phone_list = [] self.button = 0 + self.mute_btn = 0 def initialization(self): EventMesh.publish("set_UI_high_priority", 1) @@ -3078,37 +3063,31 @@ class OnCallScreen(Screen): on_call_phone_zero ,on_call_phone_hash,on_call_phone_return_btn,\ on_call_screen_tab if on_call_screen ==None : - size_x = 36 #按钮大小 - size_y = 22 - start_x = 5 - start_y = 25 - offset_y = 4 - on_call_screen = lv.obj() on_call_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_obj = lv.obj(on_call_screen) - on_call_obj.set_size(128,128) + on_call_obj.set_size(240,320) on_call_obj.set_pos(0,0) on_call_obj.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) print("on_call_screen") on_call_label_name = lv.label(on_call_obj) - on_call_label_name.set_pos(0, 5) - on_call_label_name.set_size(128, 40) + on_call_label_name.set_pos(0, 80) + on_call_label_name.set_size(240, 50) on_call_label_name.set_text(" ") on_call_label_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) on_call_label_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_second_label = lv.label(on_call_obj) - on_call_second_label.set_pos(0, 35) - on_call_second_label.set_size(128, 20) + on_call_second_label.set_pos(0, 140) + on_call_second_label.set_size(240, 30) on_call_second_label.set_text("00:00") on_call_second_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) on_call_second_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_bar = lv.bar(on_call_obj) - on_call_bar.set_pos(28, 65) - on_call_bar.set_size(72, 12) + on_call_bar.set_pos(49, 183) + on_call_bar.set_size(140, 25) on_call_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT) on_call_bar.set_mode(lv.bar.MODE.NORMAL) on_call_bar.set_value(50, lv.ANIM.OFF) @@ -3116,43 +3095,40 @@ class OnCallScreen(Screen): on_call_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT) on_call_volum_reduce = lv.img(on_call_obj) - on_call_volum_reduce.set_size(18, 18) - # on_call_volum_reduce.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_volum_reduce.set_pos(5, 62) + on_call_volum_reduce.set_size(36, 36) + on_call_volum_reduce.set_pos(4, 178) on_call_volum_reduce.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_volum_reduce.set_src("U:/static/REDUCE_VOLUM_ICON.png") - # on_call_volum_reduce.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)), - # lv.EVENT.CLICKED, None) + on_call_volum_reduce.set_src("E:/static/REDUCE_VOLUM_ICON.png") - on_call_volum_reduce_btn = lv.img(on_call_obj) - on_call_volum_reduce_btn.set_size(80, 40) - on_call_volum_reduce_btn.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_volum_reduce_btn.set_pos(48, 50) - on_call_volum_reduce_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)), - lv.EVENT.CLICKED, None) + on_call_volum_reduce_btn = lv.label(on_call_obj) + on_call_volum_reduce_btn.set_pos(0, 170) + on_call_volum_reduce_btn.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_volum_reduce_btn.set_size(60, 50) + on_call_volum_reduce_btn.set_text(" ") + on_call_volum_reduce_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)), + lv.EVENT.CLICKED, None) on_call_volum_add = lv.img(on_call_obj) - on_call_volum_add.set_size(18, 18) - # on_call_volum_add.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_volum_add.set_pos(105, 62) + on_call_volum_add.set_size(36, 36) + on_call_volum_add.set_pos(194, 178) on_call_volum_add.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_volum_add.set_src("U:/static/VOLUM_ADD_ICON.png") - # on_call_volum_add.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)), - # lv.EVENT.CLICKED, None) + on_call_volum_add.set_src("E:/static/VOLUM_ADD_ICON.png") + - on_call_volum_add_btn = lv.img(on_call_obj) - on_call_volum_add_btn.set_size(40, 40) + on_call_volum_add_btn = lv.label(on_call_obj) + on_call_volum_add_btn.set_pos(180, 170) on_call_volum_add_btn.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_volum_add_btn.set_pos(0, 50) - on_call_volum_add_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)), - lv.EVENT.CLICKED, None) + on_call_volum_add_btn.set_size(60, 50) + on_call_volum_add_btn.set_text(" ") + on_call_volum_add_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)), + lv.EVENT.CLICKED, None) on_call_volum_label = lv.label(on_call_obj) - on_call_volum_label.set_pos(0, 100) + on_call_volum_label.set_pos(0, 270) on_call_volum_label.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_volum_label.set_size(48, 28) + on_call_volum_label.set_size(85, 50) on_call_volum_label.set_text("静音") on_call_volum_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) on_call_volum_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -3160,18 +3136,18 @@ class OnCallScreen(Screen): lv.EVENT.CLICKED, None) on_call_hangup = lv.img(on_call_obj) - on_call_hangup.set_size(32, 32) + on_call_hangup.set_size(64, 64) on_call_hangup.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_hangup.set_pos(48, 90) + on_call_hangup.set_pos(85, 245) on_call_hangup.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_hangup.set_src("U:/static/hang_up.png") + on_call_hangup.set_src("E:/static/hang_up.png") on_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), lv.EVENT.CLICKED, None) on_call_tab_label = lv.label(on_call_obj) - on_call_tab_label.set_pos(80, 100) + on_call_tab_label.set_pos(150, 270) on_call_tab_label.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_tab_label.set_size(48, 28) + on_call_tab_label.set_size(90, 50) on_call_tab_label.set_text("键盘") on_call_tab_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) on_call_tab_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -3179,130 +3155,120 @@ class OnCallScreen(Screen): lv.EVENT.CLICKED, None) on_call_screen_tab = lv.obj(on_call_screen) - on_call_screen_tab.set_size(128,128) + on_call_screen_tab.set_size(240,320) on_call_screen_tab.set_pos(0,0) on_call_screen_tab.add_flag(lv.obj.FLAG.HIDDEN) on_call_screen_tab.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_screen_tab_label = lv.label(on_call_screen_tab) - on_call_screen_tab_label.set_pos(40, 5) - on_call_screen_tab_label.set_size(0, 20) + on_call_screen_tab_label.set_pos(40, 34) + on_call_screen_tab_label.set_size(0, 30) on_call_screen_tab_label.set_text(" ") on_call_screen_tab_label.set_long_mode(lv.label.LONG.CLIP) on_call_screen_tab_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_screen_tab_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) on_call_phone_return = lv.img(on_call_screen_tab) - on_call_phone_return.set_src("U:/static/RED_RETURN_PNG.png") + on_call_phone_return.set_src("E:/static/RED_RETURN_PNG.png") on_call_phone_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_return.set_pos(0, 5) - on_call_phone_return.set_size(18, 18) + on_call_phone_return.set_pos(0, 30) + on_call_phone_return.set_size(36, 36) on_call_phone_return_btn = lv.img(on_call_screen_tab) on_call_phone_return_btn.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_return_btn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_phone_return_btn.set_pos(0, 0) - on_call_phone_return_btn.set_size(50, 25) + on_call_phone_return_btn.set_size(50, 100) on_call_phone_return_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.on_return_show(e)), lv.EVENT.CLICKED, None) + on_call_phone_one = lv.img(on_call_screen_tab) - on_call_phone_one.set_src("U:/static/IMAGE_NUMBER_KEY1_ICON.png") + on_call_phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png") on_call_phone_one.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_one.set_pos(start_x, start_y) - on_call_phone_one.set_size(size_x, size_y) + on_call_phone_one.set_pos(3, 110) + on_call_phone_one.set_size(76, 50) on_call_phone_two = lv.img(on_call_screen_tab) - on_call_phone_two.set_size(size_x, size_y) - on_call_phone_two.set_src("U:/static/IMAGE_NUMBER_KEY2_ICON.png") + on_call_phone_two.set_size(76, 50) + on_call_phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png") on_call_phone_two.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_two.set_pos(start_x+size_x+5*1, start_y) + on_call_phone_two.set_pos(82, 110) on_call_phone_three = lv.img(on_call_screen_tab) - on_call_phone_three.set_size(size_x, size_y) - on_call_phone_three.set_src("U:/static/IMAGE_NUMBER_KEY3_ICON.png") + on_call_phone_three.set_size(76, 50) + on_call_phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png") on_call_phone_three.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_three.set_pos(start_x+size_x*2+5*2, start_y) + on_call_phone_three.set_pos(161, 110)#1 on_call_phone_four = lv.img(on_call_screen_tab) - on_call_phone_four.set_size(size_x, size_y) - on_call_phone_four.set_src("U:/static/IMAGE_NUMBER_KEY4_ICON.png") + on_call_phone_four.set_size(76, 50) + on_call_phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png") on_call_phone_four.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_four.set_pos(start_x, start_y+size_y+offset_y) + on_call_phone_four.set_pos(3, 162) on_call_phone_five = lv.img(on_call_screen_tab) - on_call_phone_five.set_size(size_x, size_y) - on_call_phone_five.set_src("U:/static/IMAGE_NUMBER_KEY5_ICON.png") + on_call_phone_five.set_size(76, 50) + on_call_phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png") on_call_phone_five.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_five.set_pos(start_x+size_x+5*1, start_y+size_y+offset_y) + on_call_phone_five.set_pos(82, 162) on_call_phone_six = lv.img(on_call_screen_tab) - on_call_phone_six.set_size(size_x, size_y) - on_call_phone_six.set_src("U:/static/IMAGE_NUMBER_KEY6_ICON.png") + on_call_phone_six.set_size(76, 50) + on_call_phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png") on_call_phone_six.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_six.set_pos(start_x+size_x*2+5*2, start_y+size_y+offset_y) + on_call_phone_six.set_pos(161, 162)#2 on_call_phone_seven = lv.img(on_call_screen_tab) - on_call_phone_seven.set_size(size_x, size_y) - on_call_phone_seven.set_src("U:/static/phone_seven_icon.png") + on_call_phone_seven.set_size(76, 50) + on_call_phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png") on_call_phone_seven.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_seven.set_pos(start_x, start_y+size_y*2+offset_y*2) + on_call_phone_seven.set_pos(3, 214) on_call_phone_eight = lv.img(on_call_screen_tab) - on_call_phone_eight.set_size(size_x, size_y) - on_call_phone_eight.set_src("U:/static/IMAGE_NUMBER_KEY8_ICON.png") + on_call_phone_eight.set_size(76, 50) + on_call_phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png") on_call_phone_eight.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_eight.set_pos(start_x+size_x+5*1, start_y+size_y*2+offset_y*2) + on_call_phone_eight.set_pos(82, 214) on_call_phone_nine = lv.img(on_call_screen_tab) - on_call_phone_nine.set_size(size_x, size_y) - on_call_phone_nine.set_src("U:/static/phnone_nine_icon.png") + on_call_phone_nine.set_size(76, 50) + on_call_phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png") on_call_phone_nine.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_nine.set_pos(start_x+size_x*2+5*2, start_y+size_y*2+offset_y*2) - - - on_call_phone_xing = lv.img(on_call_screen_tab) - on_call_phone_xing.set_size(size_x, size_y) - on_call_phone_xing.set_src("U:/static/xing_icon.png") - on_call_phone_xing.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_phone_xing.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_xing.set_pos(start_x, start_y+size_y*3+offset_y*3) + on_call_phone_nine.set_pos(161, 214) + on_call_phone_start = lv.img(on_call_screen_tab) + on_call_phone_start.set_size(76, 50) + on_call_phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png") + on_call_phone_start.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_start.set_pos(3, 266) on_call_phone_zero = lv.img(on_call_screen_tab) - on_call_phone_zero.set_size(size_x, size_y) - on_call_phone_zero.set_src("U:/static/IMAGE_NUMBER_KEY0_ICON.png") + on_call_phone_zero.set_size(76, 50) + on_call_phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png") on_call_phone_zero.add_flag(lv.obj.FLAG.CLICKABLE) on_call_phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_zero.set_pos(start_x+size_x+5*1, start_y+size_y*3+offset_y*3) - - - on_call_phone_jing = lv.img(on_call_screen_tab) - on_call_phone_jing.set_size(size_x, size_y) - on_call_phone_jing.set_src("U:/static/jing_icon.png") - on_call_phone_jing.add_flag(lv.obj.FLAG.CLICKABLE) - on_call_phone_jing.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - on_call_phone_jing.set_pos(start_x+size_x*2+5*2, start_y+size_y*3+offset_y*3) - - - + on_call_phone_zero.set_pos(82, 266) + on_call_phone_hash = lv.img(on_call_screen_tab) + on_call_phone_hash.set_size(76, 50) + on_call_phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png") + on_call_phone_hash.add_flag(lv.obj.FLAG.CLICKABLE) + on_call_phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + on_call_phone_hash.set_pos(161, 266) self.meta = on_call_screen - on_call_phone_jing.add_event_cb(lambda e: EventMesh.callback_wrapper(self.jingpressed_start(e)), - lv.EVENT.CLICKED, None) - on_call_phone_xing.add_event_cb(lambda e: EventMesh.callback_wrapper(self.xingpressed_start(e)), - lv.EVENT.CLICKED, None) on_call_phone_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.one(e)), lv.EVENT.CLICKED, None) @@ -3316,45 +3282,41 @@ class OnCallScreen(Screen): lv.EVENT.CLICKED, None) on_call_phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)), lv.EVENT.CLICKED, None) - on_call_phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.endpressed_start(e)), + on_call_phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven(e)), lv.EVENT.CLICKED, None) - on_call_phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)), lv.EVENT.CLICKED, None) + on_call_phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine(e)), + lv.EVENT.CLICKED, None) + on_call_phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), + lv.EVENT.CLICKED, None) - on_call_phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine_endpressed_start(e)), - lv.EVENT.CLICKED, None) - - # phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), - # lv.EVENT.CLICKED, None) + on_call_phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), + lv.EVENT.CLICKED, None)#短按显示* - on_call_phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - lv.EVENT.CLICKED, None)#短按显示* - - on_call_phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), + on_call_phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), lv.EVENT.LONG_PRESSED, None)#长按显示+ - on_call_phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero_endpressed_start(e)), - lv.EVENT.RELEASED, None)#释放按键 - - - + on_call_phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.endpressed_start(e)), + lv.EVENT.RELEASED, None)#释放按键 + + on_call_phone_hash.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hash(e)), + lv.EVENT.CLICKED, None) name = EventMesh.publish("get_phonename") on_call_label_name.set_text(name) # on_call_label.set_text(str(self.meta_info)) on_call_second_label.set_text("00:00") + on_call_volum_label.set_style_text_color(lv.color_make(255,255,255), lv.STATE.DEFAULT) self.phone_num = '' self.phone_list = [] self.button = 0 - self.mute_state = 0 - on_call_volum_label.set_style_text_color(lv.color_make(255,255,255), lv.STATE.DEFAULT) + self.mute_btn = 0 voiceCall.mute(2,0,0) def show_num(self): global on_call_screen_tab_label - #print("phone self.phone_num ",self.phone_num,self.phone_list) - on_call_screen_tab_label.set_size(128-30, 20) - on_call_screen_tab_label.set_pos(20, 5) + print("phone self.phone_num ",self.phone_num,self.phone_list) + on_call_screen_tab_label.set_size(200, 30) on_call_screen_tab_label.set_text(self.phone_num) def one(self,e): if len(self.phone_list) >= ON_CALL_MAX_DATA: @@ -3445,35 +3407,6 @@ class OnCallScreen(Screen): self.phone_num = ''.join(self.phone_list) self.show_num() - def zero_endpressed_start(self,e): - if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 - #self.phone_list.pop(0) - return - - if self.button == 1:#长按 - self.phone_list.append("+") - voiceCall.startDtmf("+",100) - else:#短按 - self.phone_list.append("0") - voiceCall.startDtmf("0",100) - - self.phone_num = ''.join(self.phone_list) - self.show_num() - - def nine_endpressed_start(self,e): - if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字 - #self.phone_list.pop(0) - return - - # if self.button == 1:#长按 - # self.phone_list.append("#") - # voiceCall.startDtmf("#",100) - # else:#短按 - self.phone_list.append("9") - voiceCall.startDtmf("9",100) - self.phone_num = ''.join(self.phone_list) - self.show_num() - def start(self,e): self.button = 0 @@ -3483,50 +3416,20 @@ class OnCallScreen(Screen): self.timer_cb = 0 self.timer.stop() - def xingpressed_start(self,e): + def endpressed_start(self,e): if len(self.phone_list) >= ON_CALL_MAX_DATA:#限制拨号数量20个数字 self.phone_list.pop(0) #return # if self.button == 1:#长按 - # voiceCall.startDtmf("*",100) - # self.phone_list.append("*") + # voiceCall.startDtmf("+",100) + # self.phone_list.append("+") # else:#短按 voiceCall.startDtmf("*",100) self.phone_list.append("*") self.phone_num = ''.join(self.phone_list) self.show_num() - - def jingpressed_start(self,e): - if len(self.phone_list) >= ON_CALL_MAX_DATA:#限制拨号数量20个数字 - self.phone_list.pop(0) - #return - - # if self.button == 1:#长按 - # voiceCall.startDtmf("*",100) - # self.phone_list.append("*") - # else:#短按 - voiceCall.startDtmf("#",100) - self.phone_list.append("#") - - self.phone_num = ''.join(self.phone_list) - self.show_num() - - def endpressed_start(self,e): - if len(self.phone_list) >= ON_CALL_MAX_DATA:#限制拨号数量20个数字 - self.phone_list.pop(0) - #return - - # if self.button == 1:#长按 - # voiceCall.startDtmf("*",100) - # self.phone_list.append("*") - # else:#短按 - voiceCall.startDtmf("7",100) - self.phone_list.append("7") - - self.phone_num = ''.join(self.phone_list) - self.show_num() def hash(self,e): if len(self.phone_list) >= ON_CALL_MAX_DATA:#限制拨号数量20个数字 @@ -3549,13 +3452,14 @@ class OnCallScreen(Screen): def open_volum_show(self, e): global on_call_screen_tab,on_call_screen,on_call_obj - if self.mute_state == 0:#默认是开启 - self.mute_state = 1 + if self.mute_btn == 0:#默认是开启 + self.mute_btn = 1 voiceCall.mute(2,1,0) on_call_volum_label.set_style_text_color(lv.color_make(0, 169, 242), lv.STATE.DEFAULT) else: - on_call_volum_label.set_style_text_color(lv.color_make(255,255,255), lv.STATE.DEFAULT) - self.mute_state = 0 + + on_call_volum_label.set_style_text_color(lv.color_make(255, 255, 255), lv.STATE.DEFAULT) + self.mute_btn = 0 voiceCall.mute(2,0,0) # self.aud.setVolume(0) # if self.open_volum_state == 1: @@ -3602,19 +3506,18 @@ class OnCallScreen(Screen): if msg == 1: self.aud.setVolume(self.volum_size) EventMesh.publish("set_volum_size",self.volum_size) + def post_processor_after_initialization(self): global on_call_screen_tab,on_call_obj self.count_sec = 0 self.timer.start(1000,1,self.refresh) - self.read_data = EventMesh.publish("get_storage_data") - # print("self.read_data:{}".format(self.read_data)) + num = EventMesh.publish("get_volum_size") if num == None: self.volum_size = 8 else: self.volum_size = num - self.aud.setVolume(self.volum_size) self.show_bar(0) self.open_volum = 0 self.phone_num = '' @@ -3625,9 +3528,10 @@ class OnCallScreen(Screen): if on_call_screen_tab != None: on_call_screen_tab.add_flag(lv.obj.FLAG.HIDDEN) self.show_num() - - def refresh(self,e): + EventMesh.publish("publish_message_event_ui",{"func":self.refresh_do,"data":0}) + + def refresh_do(self,data): # print("call_in") global on_call_screen,on_call_label_name,on_call_second_label ,on_call_hangup min = self.count_sec/60 @@ -3680,25 +3584,25 @@ class StepScreen(Screen): step_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) step_label = lv.label(step_screen) - step_label.set_pos(10, 10) - step_label.set_size(128-10, 20) + step_label.set_pos(10, 30) + step_label.set_size(230, 50) step_label.set_text("今日步数") step_label.set_long_mode(lv.label.LONG.WRAP) step_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) step_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) step_label_01 = lv.label(step_screen) - step_label_01.set_pos(0, 50) - step_label_01.set_size(128, 20) + step_label_01.set_pos(0, 100) + step_label_01.set_size(240, 50) step_label_01.set_text("0æ­¥") step_label_01.set_long_mode(lv.label.LONG.WRAP) step_label_01.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) step_label_01.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) step_img = lv.img(step_screen) - step_img.set_pos(49, 80) - step_img.set_size(20, 33) - step_img.set_src("U:/static/IMAGE_STEP.png") + step_img.set_pos(100, 150) + step_img.set_size(40, 65) + step_img.set_src("E:/static/IMAGE_STEP.png") step_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) self.meta = step_screen @@ -3754,63 +3658,65 @@ class WeatherScreen(Screen): weather_img = lv.img(weather_screen) weather_img.set_pos(10, 10) - weather_img.set_size(45, 40) + weather_img.set_size(135, 120) + weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) no_weather_img = lv.img(weather_screen) no_weather_img.set_pos(10, 10) - no_weather_img.set_size(45, 40) - no_weather_img.set_src("U:/static/update.png") + no_weather_img.set_size(135, 120) + no_weather_img.set_src("E:/static/update.png") no_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) weather_tem_label = lv.label(weather_screen) - weather_tem_label.set_pos(65, 11) - weather_tem_label.set_size(45, 20) + weather_tem_label.set_pos(155, 44) + weather_tem_label.set_size(60, 50) weather_tem_label.set_text("_ _") weather_tem_label.set_long_mode(lv.label.LONG.WRAP) - weather_tem_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + weather_tem_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) weather_tem_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) no_weather_degree = lv.img(weather_screen) - no_weather_degree.set_pos(88, 15) - no_weather_degree.set_size(11, 11) + no_weather_degree.set_pos(200, 40) + no_weather_degree.set_size(22, 22) no_weather_degree.set_src("U:/static/degree.png") no_weather_degree.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) weather_detail_label = lv.label(weather_screen) - weather_detail_label.set_pos(65, 30) - weather_detail_label.set_size(50, 50) + weather_detail_label.set_pos(155, 80) + weather_detail_label.set_size(85, 50) weather_detail_label.set_text("-/-") weather_detail_label.set_long_mode(lv.label.LONG.WRAP) - weather_detail_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) + weather_detail_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) weather_detail_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - # weather_location_label = lv.label(weather_screen) - # weather_location_label.set_pos(0, 60) - # weather_location_label.set_size(128, 50) - # weather_location_label.set_text("--") - # weather_location_label.set_long_mode(lv.label.LONG.WRAP) - # weather_location_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - # weather_location_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + weather_location_label = lv.label(weather_screen) + weather_location_label.set_pos(0, 200) + weather_location_label.set_size(240, 50) + weather_location_label.set_text("--") + weather_location_label.set_long_mode(lv.label.LONG.WRAP) + weather_location_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + weather_location_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) no_connect_label = lv.label(weather_screen) - no_connect_label.set_pos(0, 60) - no_connect_label.set_size(128, 20) + no_connect_label.set_pos(0, 200) + no_connect_label.set_size(240, 40) no_connect_label.set_text("找不到服务器") no_connect_label.set_long_mode(lv.label.LONG.WRAP) no_connect_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_connect_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) no_connect_label1 = lv.label(weather_screen) - no_connect_label1.set_pos(0, 90) - no_connect_label1.set_size(128, 20) + no_connect_label1.set_pos(0, 250) + no_connect_label1.set_size(240, 70) no_connect_label1.set_text("请联网后重试") no_connect_label1.set_long_mode(lv.label.LONG.WRAP) no_connect_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) no_connect_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) self.meta = weather_screen - EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.WT_SEND) #开始WT定位 + #EventMesh.publish(constants.PROTOCOL.WT_SEND) + EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.WT_SEND) #开始WT定位 def post_processor_after_initialization(self): EventMesh.publish("updata_weather_show") @@ -3826,19 +3732,24 @@ class WeatherScreen(Screen): if no_data != 0 : no_weather_img.add_flag(lv.obj.FLAG.HIDDEN) weather_img.clear_flag(lv.obj.FLAG.HIDDEN) - # no_connect_label.set_text(" ") + no_connect_label.set_text(" ") no_connect_label1.set_text(" ") # print("self.weather_data:{}".format(self.weather_data)) type = self.weather_data[3] if type == None: - weather_img.set_src("U:/static/update.png")#天气类型 + weather_img.set_src("E:/static/update.png")#天气类型 else: - weather_img.set_src("U:/static/{}_weather.png".format(type))#天气类型 + weather_img.set_src("E:/static/{}_weather.png".format(type))#天气类型 temp = self.weather_data[4] if temp == None: + no_weather_degree.set_pos(200, 40) weather_tem_label.set_text("_ _") else: + if len(temp) > 2: + no_weather_degree.set_pos(218, 40) + else: + no_weather_degree.set_pos(200, 40) weather_tem_label.set_text("{}".format(temp)) date = self.weather_data[0] @@ -3851,11 +3762,12 @@ class WeatherScreen(Screen): city = self.weather_data[7] if city != '{}': - no_connect_label.set_text("{}".format(city))#城市 + weather_location_label.set_text("{}".format(city))#城市 else: - no_connect_label.set_text("--") + weather_location_label.set_text("--") else:#已联网未获取到天气数据 - # no_connect_label.set_text(" ") + no_weather_degree.set_pos(200, 40) + weather_location_label.set_text(" ") weather_detail_label.set_text("-/-") weather_tem_label.set_text("_ _") @@ -3863,7 +3775,8 @@ class WeatherScreen(Screen): no_connect_label1.set_text("请稍候重试") else: - + no_weather_degree.set_pos(200, 40) + weather_location_label.set_text(" ") weather_detail_label.set_text("-/-") weather_tem_label.set_text("_ _") @@ -3932,14 +3845,14 @@ class ContactsScreen(Screen): contacts_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) contacts_screen_list_screen = lv.obj(contacts_screen) - contacts_screen_list_screen.set_pos(0, 30) - contacts_screen_list_screen.set_size(LCD_X, LCD_Y-30) + contacts_screen_list_screen.set_pos(0, 50) + contacts_screen_list_screen.set_size(240, 270) contacts_screen_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) contacts_screen_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) contacts_top_title = lv.label(contacts_screen) - contacts_top_title.set_pos(0, 5) - contacts_top_title.set_size(LCD_X, 20) + contacts_top_title.set_pos(0, 10) + contacts_top_title.set_size(240, 40) contacts_top_title.set_text("联系人") contacts_top_title.set_long_mode(lv.label.LONG.WRAP) contacts_top_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -3947,16 +3860,16 @@ class ContactsScreen(Screen): contact_none_label = lv.label(contacts_screen_list_screen) - contact_none_label.set_pos(0, 20) - contact_none_label.set_size(LCD_X, 40) - contact_none_label.set_text("无联系人,请在手\n机APP上添加") + contact_none_label.set_pos(0, 80) + contact_none_label.set_size(240, 50) + contact_none_label.set_text("无联系人,请在手机\nAPP上添加") contact_none_label.set_long_mode(lv.label.LONG.WRAP) contact_none_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) contact_none_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) self.contact_detail_list = lv.obj(contacts_screen_list_screen) self.contact_detail_list.set_pos(0, 0) - self.contact_detail_list.set_size(LCD_X, LCD_Y-30+1) + self.contact_detail_list.set_size(240, 271) self.contact_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.contact_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) for i in range(self.MXA_phone_num): @@ -3969,6 +3882,10 @@ class ContactsScreen(Screen): contact_btn_label_1 = lv.label(contact_btn) contact_btn_label_2 = lv.label(contact_btn) contact_btn_label_3 = lv.label(contact_btn) + contact_btn.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + contact_btn_label_1.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + contact_btn_label_3.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + self.contact_detail_listt_dict.append({"contact_btn":contact_btn,"contact_btn_label_1":contact_btn_label_1,"contact_btn_label_2":contact_btn_label_2,"contact_btn_label_3":contact_btn_label_3}) self.meta = contacts_screen self.count = 0 @@ -3997,7 +3914,13 @@ class ContactsScreen(Screen): print("self.phonebook sorted :{} len(self.phonebook) :{}".format(sorted(self.phonebook.keys()),len(self.phonebook))) phonebook_keys = sorted(self.phonebook.keys()) - + # self.contact_detail_list.delete()#先删除一次控件 + # self.contact_detail_list = lv.obj(contacts_screen_list_screen) + # self.contact_detail_list.set_pos(0, 0) + # self.contact_detail_list.set_size(240, 271) + # self.contact_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # self.contact_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + # print("self.phonebook sorted :{}".format(len(self.phonebook))) if len(self.phonebook) > self.MXA_phone_num: j = len(self.phonebook) - self.MXA_phone_num for i in range(self.MXA_phone_num): #字典 key value @@ -4010,19 +3933,19 @@ class ContactsScreen(Screen): print("name :{} key_tmp:{}".format(name,key_tmp)) #contact_btn = lv.btn(self.contact_detail_list) - self.contact_detail_listt_dict[i]["contact_btn"].set_size(LCD_X,45) - self.contact_detail_listt_dict[i]["contact_btn"].set_pos(0,47*i ) - self.contact_detail_listt_dict[i]["contact_btn"].add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) + self.contact_detail_listt_dict[i]["contact_btn"].set_size(230,80) + self.contact_detail_listt_dict[i]["contact_btn"].set_pos(0,82*i ) + #self.contact_detail_listt_dict[i]["contact_btn"].add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) # contact_btn.add_style(style_contact_btn_pressed, lv.PART.MAIN | lv.STATE.PRESSED) # self.contact_detail_listt_dict[i]["contact_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), # lv.EVENT.CLICKED, None) #contact_btn_label_1 = lv.label(contact_btn) - self.contact_detail_listt_dict[i]["contact_btn_label_1"].set_pos(5, 4) - self.contact_detail_listt_dict[i]["contact_btn_label_1"].set_size(LCD_X-15, 20) + self.contact_detail_listt_dict[i]["contact_btn_label_1"].set_pos(0, 0) + self.contact_detail_listt_dict[i]["contact_btn_label_1"].set_size(180, 30) self.contact_detail_listt_dict[i]["contact_btn_label_1"].set_text(key_tmp[4:]) self.contact_detail_listt_dict[i]["contact_btn_label_1"].set_long_mode(lv.label.LONG.DOT) - self.contact_detail_listt_dict[i]["contact_btn_label_1"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + #self.contact_detail_listt_dict[i]["contact_btn_label_1"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) #contact_btn_label_2 = lv.label(contact_btn) self.contact_detail_listt_dict[i]["contact_btn_label_2"].set_pos(0, 5) @@ -4031,10 +3954,10 @@ class ContactsScreen(Screen): #contact_btn_label_3 = lv.label(contact_btn) - self.contact_detail_listt_dict[i]["contact_btn_label_3"].set_pos(5, 24) - self.contact_detail_listt_dict[i]["contact_btn_label_3"].set_size(LCD_X-15, 21) + self.contact_detail_listt_dict[i]["contact_btn_label_3"].set_pos(0, 35) + self.contact_detail_listt_dict[i]["contact_btn_label_3"].set_size(220, 35) self.contact_detail_listt_dict[i]["contact_btn_label_3"].set_text(name) - self.contact_detail_listt_dict[i]["contact_btn_label_3"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) + #self.contact_detail_listt_dict[i]["contact_btn_label_3"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) self.contact_detail_listt_dict[i]["contact_btn"].clear_flag(lv.obj.FLAG.HIDDEN) @@ -4149,23 +4072,23 @@ class TemperatureScreen(Screen): temperature_line_bg_img = lv.img(temperature_screen) temperature_line_bg_img.set_pos(5, 50) temperature_line_bg_img.set_size(230, 120) - temperature_line_bg_img.set_src("U:/static/temp_line_bg.png") + temperature_line_bg_img.set_src("E:/static/temp_line_bg.png") temperature_done_img = lv.img(temperature_screen) temperature_done_img.set_pos(20, 226) - temperature_done_img.set_src("U:/static/temp_gif03.png") + temperature_done_img.set_src("E:/static/temp_gif03.png") temp_reset_btn_img = lv.img(temperature_screen) temp_reset_btn_img.set_pos(0, 182) - temp_reset_btn_img.set_src("U:/static/reset_hr_btn.png") + temp_reset_btn_img.set_src("E:/static/reset_hr_btn.png") temp_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN) temp_reset_btn_img.add_flag(lv.obj.FLAG.CLICKABLE) temperature_start_label = lv.label(temperature_screen) temperature_start_label.set_size(240,40) temperature_start_label.set_pos(0,190) - temperature_start_label.set_text(" ") + temperature_start_label.set_text("正在测量中.") temperature_start_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) temperature_start_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_start_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) @@ -4223,13 +4146,14 @@ class TemperatureScreen(Screen): temperature_bpm_label = lv.label(temperature_screen) temperature_bpm_label.set_size(120, 40) temperature_bpm_label.set_pos(100, 244) + temperature_bpm_label.set_text("- -") temperature_bpm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_bpm_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) temperature_keep_label = lv.label(temperature_screen) temperature_keep_label.set_size(140, 40) temperature_keep_label.set_pos(100, 280) - temperature_keep_label.set_text(" ") + temperature_keep_label.set_text("未出值") temperature_keep_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) temperature_keep_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) @@ -4255,7 +4179,7 @@ class TemperatureScreen(Screen): def restart_up(self,e): global temperature_done_label,temperature_keep_label,temperature_bpm_label,temperature_start_label,temp_reset_btn_img temperature_bpm_label.set_text("- -") - temperature_keep_label.set_text(" ") + temperature_keep_label.set_text("未出值") temp_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN) self.point = 0 temperature_bpm_label.set_text("- -") @@ -4269,94 +4193,16 @@ class TemperatureScreen(Screen): global temp_line1,temp_line2,temp_line3,temp_line4,temp_line5,temp_line6,temp_line7 read_data = {} read_data = EventMesh.publish("get_history_temp_value") - print("hr history read_data",read_data) - if read_data != None: - count = len(read_data) + # print("hr get_history_temp_value",read_data) + if len(read_data) != 0: + sort_new = {} + sort_new = sorted(read_data, key = lambda i: i['timeSec'],reverse = False)#按照时间戳进行排序 去掉最旧的一次数据如果满了五 + count = len(sort_new) if count != 0: - if count >= 7: - for i in range(count): - value = read_data["0{}".format(i+1)] - value_temp = int(value) - if value <= 30: - line_value = int(value_temp) - elif value <= 34: - line_value = int((value_temp-30)*4.25)+30 - elif value <= 38: - line_value = int((value_temp-34)*5)+47 - elif value <= 42: - line_value = int((value_temp-38)*4)+67 - elif value < 46: - line_value = int((value_temp-42)*3.75)+85 - else: - value = 46 - line_value = 100 - - - if line_value >= 100: - line_value = 100 - #print("hr hist",line_value) - hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}] - if i == 0: - temp_line1.set_points(hr_line_points,2) - temp_line1.set_pos(29,150-line_value) - temp_line1.set_size(10,line_value) - if value >= 37.3: - temp_line1.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) - else: - temp_line1.set_style_line_color(lv.color_make(35,141,255),0) - if i == 1: - temp_line2.set_points(hr_line_points,2) - temp_line2.set_pos(57,150-line_value) - temp_line2.set_size(10,line_value) - if value >= 37.3: - temp_line2.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) - else: - temp_line2.set_style_line_color(lv.color_make(35,141,255),0) - - if i == 2: - temp_line3.set_points(hr_line_points,2) - temp_line3.set_pos(84,150-line_value) - temp_line3.set_size(10,line_value) - if value >= 37.3: - temp_line3.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) - else: - temp_line3.set_style_line_color(lv.color_make(35,141,255),0) - if i == 3: - temp_line4.set_points(hr_line_points,2) - temp_line4.set_pos(112,150-line_value) - temp_line4.set_size(10,line_value) - if value >= 37.3: - temp_line4.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) - else: - temp_line4.set_style_line_color(lv.color_make(35,141,255),0) - if i == 4: - temp_line5.set_points(hr_line_points,2) - temp_line5.set_pos(140,150-line_value) - temp_line5.set_size(10,line_value) - if value >= 37.3: - temp_line5.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) - else: - temp_line5.set_style_line_color(lv.color_make(35,141,255),0) - - if i == 5: - temp_line6.set_points(hr_line_points,2) - temp_line6.set_pos(167,150-line_value) - temp_line6.set_size(10,line_value) - if value >= 37.3: - temp_line6.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) - else: - temp_line6.set_style_line_color(lv.color_make(35,141,255),0) - - if i == 6: - temp_line7.set_points(hr_line_points,2) - temp_line7.set_pos(195,150-line_value) - temp_line7.set_size(10,line_value) - if value >= 37.3: - temp_line7.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) - else: - temp_line7.set_style_line_color(lv.color_make(35,141,255),0) - else: - value = read_data["0{}".format(count)] + for i in range(count): + # print(int(sort_new[i]["temp"])) + # print("hr history read_data",read_data) + value = int(sort_new[i]["temp"]) value_temp = int(value) if value <= 30: line_value = int(value_temp) @@ -4372,22 +4218,20 @@ class TemperatureScreen(Screen): value = 46 line_value = 100 - if line_value >= 100: line_value = 100 - # - hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}] - if count == 1: - temp_line1.set_points(hr_line_points,2) + #print("hr hist",line_value) + temp_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}] + if i == 0: + temp_line1.set_points(temp_line_points,2) temp_line1.set_pos(29,150-line_value) temp_line1.set_size(10,line_value) if value >= 37.3: temp_line1.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) else: temp_line1.set_style_line_color(lv.color_make(35,141,255),0) - - if count == 2: - temp_line2.set_points(hr_line_points,2) + if i == 1: + temp_line2.set_points(temp_line_points,2) temp_line2.set_pos(57,150-line_value) temp_line2.set_size(10,line_value) if value >= 37.3: @@ -4395,27 +4239,24 @@ class TemperatureScreen(Screen): else: temp_line2.set_style_line_color(lv.color_make(35,141,255),0) - if count == 3: - temp_line3.set_points(hr_line_points,2) + if i == 2: + temp_line3.set_points(temp_line_points,2) temp_line3.set_pos(84,150-line_value) temp_line3.set_size(10,line_value) if value >= 37.3: temp_line3.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) else: temp_line3.set_style_line_color(lv.color_make(35,141,255),0) - - - if count == 4: - temp_line4.set_points(hr_line_points,2) + if i == 3: + temp_line4.set_points(temp_line_points,2) temp_line4.set_pos(112,150-line_value) temp_line4.set_size(10,line_value) if value >= 37.3: temp_line4.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) else: temp_line4.set_style_line_color(lv.color_make(35,141,255),0) - - if count == 5: - temp_line5.set_points(hr_line_points,2) + if i == 4: + temp_line5.set_points(temp_line_points,2) temp_line5.set_pos(140,150-line_value) temp_line5.set_size(10,line_value) if value >= 37.3: @@ -4423,8 +4264,8 @@ class TemperatureScreen(Screen): else: temp_line5.set_style_line_color(lv.color_make(35,141,255),0) - if count == 6: - temp_line6.set_points(hr_line_points,2) + if i == 5: + temp_line6.set_points(temp_line_points,2) temp_line6.set_pos(167,150-line_value) temp_line6.set_size(10,line_value) if value >= 37.3: @@ -4432,23 +4273,28 @@ class TemperatureScreen(Screen): else: temp_line6.set_style_line_color(lv.color_make(35,141,255),0) - if count == 7: - temp_line7.set_points(hr_line_points,2) + if i == 6: + temp_line7.set_points(temp_line_points,2) temp_line7.set_pos(195,150-line_value) - temp_line7.set_size(10,line_value) + temp_line7.set_size(10,line_value) if value >= 37.3: temp_line7.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) else: temp_line7.set_style_line_color(lv.color_make(35,141,255),0) - + def start_measure(self,*args): + EventMesh.publish("publish_message_event_ui",{"func":self.start_measure_do,"data":0}) + def start_measure_do(self,data): global temperature_label,temperature_keep_label,temperature_done_img ,temp_reset_btn_img,temperature_start_label,temperature_bpm_label ,temperature_done_label self.point = self.point + 1 EventMesh.publish("system_sleep_rest")#防止黑屏 - + WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据 temp = EventMesh.publish(constants.EVENT.GET_TEMP) + temp += 0.5 tmp = str(temp).split('.')[0] + '.' + str(temp).split('.')[1][:1]#获取小数点后一位 舍去小数点最后一位 - print("self.temp:{}".format(temp)) + if temp < 25 or temp > 42: + temp = 0 + # print("self.temp:{}".format(temp)) if self.point >= 2: if temp != 0: temperature_bpm_label.set_text("{}".format(tmp)) @@ -4457,45 +4303,66 @@ class TemperatureScreen(Screen): if self.point%4 == 0 : temperature_start_label.set_text("正在测量中..") - temperature_done_img.set_src("U:/static/temp_gif02.png") + temperature_done_img.set_src("E:/static/temp_gif02.png") if self.point%4 == 1 : temperature_start_label.set_text("正在测量中...") - temperature_done_img.set_src("U:/static/temp_gif01.png") + temperature_done_img.set_src("E:/static/temp_gif01.png") if self.point%4 == 2 : temperature_start_label.set_text("正在测量中.") - temperature_done_img.set_src("U:/static/temp_gif02.png") + temperature_done_img.set_src("E:/static/temp_gif02.png") if self.point%4 == 3 : temperature_start_label.set_text("正在测量中.") - temperature_done_img.set_src("U:/static/temp_gif03.png") + temperature_done_img.set_src("E:/static/temp_gif03.png") - tmp_f = str(temp).split('.')[0] - tmp_f_tmp = int(tmp_f) + tmp_f_tmp = 0 + tmp_d_tmp = 0 + if str(temp).find(".") != -1: + tmp_f = str(temp).split('.')[0] + tmp_f_tmp = int(tmp_f) + + tmp_d = str(temp).split('.')[1][:1] + tmp_d_tmp = int(tmp_d) + else: + tmp_f_tmp = temp - tmp_d = str(temp).split('.')[1][:1] - tmp_d_tmp = int(tmp_d) if self.point >= 2: + if temp >= 37.3: temperature_keep_label.set_text("体温偏高") temperature_keep_label.set_style_text_color(lv.color_make(0xff, 0x00, 0x00), lv.STATE.DEFAULT) + elif temp == 0: + temperature_keep_label.set_text(" ") + temperature_keep_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) else: temperature_keep_label.set_text("体温正常") temperature_keep_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) - if self.point > 120 : #测2min + if self.point > 120 or (WEAR == 0 and self.point > 10): #测2min + self.timer.stop() + if WEAR == 0: + temp = 0 + temperature_start_label.set_text("佩戴异常,点击重测") + temperature_bpm_label.set_text("- -") + temperature_keep_label.set_text(" ") + temperature_keep_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) + else : + temperature_start_label.set_text("测量结束,点击重测") + EventMesh.publish("set_history_temp_value",temp) + EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) + num = str(tmp_f_tmp)+"."+ str(tmp_d_tmp) + EventMesh.publish(constants.PROTOCOL.BTEMP2_SEND,[1,num]) if temp >= 37.3: - temperature_done_img.set_src("U:/static/temp_high.png") + temperature_done_img.set_src("E:/static/temp_high.png") else: - temperature_done_img.set_src("U:/static/temp_gif03.png") + temperature_done_img.set_src("E:/static/temp_gif03.png") temp_reset_btn_img.clear_flag(lv.obj.FLAG.HIDDEN) - temperature_start_label.set_text("测量结束,点击重测") - EventMesh.publish("set_history_temp_value",temp) self.show_history_data() - self.timer.stop() + self.point = 0 EventMesh.publish("set_temp_state",0) - EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) + EventMesh.publish(constants.EVENT.STOP_TEMP) @@ -4516,147 +4383,6 @@ class TemperatureScreen(Screen): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) - -# class TemperatureScreen(Screen): -# NAME = "temperature" - -# def __init__(self): -# super().__init__() -# self.meta = None -# self.temp_timer = osTimer() -# self.count = 0 -# def initialization(self): -# global temperature_screen,temperature_bg_img ,temperature_body_label ,temperature_degree_img ,temperature_value_label,\ -# temperature_wrist_label,temperature_wrist_degree_img ,temperature_wrist_value_label,temperature_measure_end_label,temperature_measure_countdown_label -# if temperature_screen == None: -# temperature_screen = lv.obj() -# print("temperature_screen") -# temperature_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - -# temperature_bg_img = lv.img(temperature_screen) -# temperature_bg_img.set_pos(30, 50) -# temperature_bg_img.set_size(31, 32) -# temperature_bg_img.set_src("U:/static/temp_hand.png") -# temperature_bg_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -# temperature_body_label = lv.label(temperature_screen) -# temperature_body_label.set_pos(80, 40) -# temperature_body_label.set_size(160, 20) -# temperature_body_label.set_text("当前腕温") -# temperature_body_label.set_long_mode(lv.label.LONG.WRAP) -# temperature_body_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) -# temperature_body_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# temperature_degree_img = lv.img(temperature_screen) -# temperature_degree_img.set_pos(146, 70) -# temperature_degree_img.set_size(22, 22) -# temperature_degree_img.set_src("U:/static/degree.png") -# temperature_degree_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -# temperature_value_label = lv.label(temperature_screen) -# temperature_value_label.set_pos(90,73) -# temperature_value_label.set_size(50, 30) -# temperature_value_label.set_text("--") -# temperature_value_label.set_long_mode(lv.label.LONG.WRAP) -# temperature_value_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# temperature_value_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# # temperature_wrist_label = lv.label(temperature_screen) -# # temperature_wrist_label.set_pos(80,120) -# # temperature_wrist_label.set_size(100, 20) -# # temperature_wrist_label.set_text("当前腕温") -# # temperature_wrist_label.set_long_mode(lv.label.LONG.WRAP) -# # temperature_wrist_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# # temperature_wrist_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# # temperature_wrist_degree_img = lv.img(temperature_screen) -# # temperature_wrist_degree_img.set_pos(150, 150) -# # temperature_wrist_degree_img.set_size(22, 22) -# # temperature_wrist_degree_img.set_src("U:/static/degree.png") -# # temperature_wrist_degree_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -# # temperature_wrist_value_label = lv.label(temperature_screen) -# # temperature_wrist_value_label.set_pos(96,155) -# # temperature_wrist_value_label.set_size(50, 30) -# # temperature_wrist_value_label.set_text("--") -# # temperature_wrist_value_label.set_long_mode(lv.label.LONG.WRAP) -# # temperature_wrist_value_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# # temperature_wrist_value_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# temperature_measure_countdown_label = lv.label(temperature_screen) -# temperature_measure_countdown_label.set_pos(0,160) -# temperature_measure_countdown_label.set_size(240, 30) -# temperature_measure_countdown_label.set_text("03:00") -# temperature_measure_countdown_label.set_long_mode(lv.label.LONG.WRAP) -# temperature_measure_countdown_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# temperature_measure_countdown_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# temperature_measure_end_label = lv.label(temperature_screen) -# temperature_measure_end_label.set_pos(0,220) -# temperature_measure_end_label.set_size(240, 30) -# temperature_measure_end_label.set_text(" ") -# temperature_measure_end_label.set_long_mode(lv.label.LONG.WRAP) -# temperature_measure_end_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# temperature_measure_end_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# self.meta = temperature_screen -# if temperature_value_label != None: -# temperature_value_label.set_text("--") -# if temperature_measure_end_label != None: -# temperature_measure_end_label.set_text(" ") -# if temperature_measure_countdown_label != None: -# temperature_measure_countdown_label.set_text("03:00") -# EventMesh.publish("set_temp_state",1) -# EventMesh.publish(constants.EVENT.START_TEMP) -# self.count = 0 -# self.countdown = 3*60 -# self.temp_timer.start(1*1000, 1, self.temp_timerout) -# def temp_timerout(self,*args): -# global temperature_value_label,temperature_measure_countdown_label,temperature_measure_end_label -# self.count += 1 -# EventMesh.publish("system_sleep_rest")#防止黑屏 -# temp = EventMesh.publish(constants.EVENT.GET_TEMP) -# tmp = str(temp).split('.')[0] + '.' + str(temp).split('.')[1][:1]#获取小数点后一位 舍去小数点最后一位 -# if temperature_measure_end_label != None: -# temperature_value_label.set_text("{}".format(tmp)) - -# tmp_f = str(temp).split('.')[0] -# tmp_f_tmp = int(tmp_f) - -# tmp_d = str(temp).split('.')[1][:1] -# tmp_d_tmp = int(tmp_d) - -# if self.countdown > 0: -# self.countdown-=1 -# min = self.countdown / 60 -# sec = self.countdown % 60 -# if temperature_measure_countdown_label != None: -# temperature_measure_countdown_label.set_text("{}:{}".format("%02d"%(min),"%02d"%(sec))) - -# # print("temp:{} tmp_f:{} tmp_f_tmp:{} tmp_d:{} tmp_d_tmp:{} self.count:{}".format(temp,tmp_f,tmp_f_tmp,tmp_d,tmp_d_tmp,self.count)) -# if self.count >= 3*60: -# self.count = 0 -# EventMesh.publish("set_temp_state",0) -# if temperature_measure_end_label != None: -# temperature_measure_end_label.set_text("测量完成") -# self.temp_timer.stop() -# EventMesh.publish(constants.PROTOCOL.TEMP_SEND,[tmp_f_tmp,tmp_d_tmp]) -# EventMesh.publish(constants.EVENT.STOP_TEMP) -# def Close(self): -# self.count = 0 -# self.temp_timer.stop() -# EventMesh.publish("set_temp_state",0) -# EventMesh.publish(constants.EVENT.STOP_TEMP) - -# def done_return(self): -# EventMesh.publish("load_screen", {"screen": "health"}) - -# def btn1_release(self): -# EventMesh.publish("load_screen", {"screen": "health"}) - -# def btn8_press(self): -# EventMesh.publish("watch_top_show") -# EventMesh.publish("load_screen", {"screen": "main_menu"}) - line_points = [{"x":0,"y":0},{"x":240,"y":0}] @@ -4700,7 +4426,7 @@ class Spo2Screen(Screen): self.timer = osTimer() self.point = 0 self.spo2_value = 0 - + #self.Hsensor = None def initialization(self): global spo2_screen,spo2_label,spo2_value_label,spo2_reset_btn_img,spo2_done_img,spo2_line_bg_img,spo2_line1,spo2_line2,\ spo2_line3,spo2_line4,spo2_line5,spo2_line6,spo2_line7,spo2_line_bg_img ,spo2_start_label ,spo2_done_label @@ -4720,23 +4446,23 @@ class Spo2Screen(Screen): spo2_line_bg_img = lv.img(spo2_screen) spo2_line_bg_img.set_pos(5, 60) spo2_line_bg_img.set_size(230, 120) - spo2_line_bg_img.set_src("U:/static/spo2_line_bg.png") + spo2_line_bg_img.set_src("E:/static/spo2_line_bg.png") spo2_done_img = lv.img(spo2_screen) spo2_done_img.set_pos(20, 240) - spo2_done_img.set_src("U:/static/spo2_gif04.png") + spo2_done_img.set_src("E:/static/spo2_gif04.png") spo2_reset_btn_img = lv.img(spo2_screen) spo2_reset_btn_img.set_pos(0, 192) - spo2_reset_btn_img.set_src("U:/static/reset_hr_btn.png") + spo2_reset_btn_img.set_src("E:/static/reset_hr_btn.png") spo2_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN) spo2_reset_btn_img.add_flag(lv.obj.FLAG.CLICKABLE) spo2_start_label = lv.label(spo2_screen) spo2_start_label.set_size(240,40) spo2_start_label.set_pos(0,200) - spo2_start_label.set_text(" ") + spo2_start_label.set_text("正在测量中.") spo2_start_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) spo2_start_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) spo2_start_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) @@ -4787,6 +4513,7 @@ class Spo2Screen(Screen): spo2_value_label = lv.label(spo2_screen) spo2_value_label.set_size(110, 40) spo2_value_label.set_pos(130, 270) + spo2_value_label.set_text("- -%") spo2_value_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) spo2_value_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) @@ -4800,13 +4527,14 @@ class Spo2Screen(Screen): self.spo2_value = 0 self.show_history_data() self.restart_up(0) - + def restart_up(self,e): global spo2_value_label,heartrate_bpm_label,spo2_start_label,spo2_reset_btn_img + self.point = 0 self.timer.start(1*500, 1, self.start_measure) if spo2_reset_btn_img != None: spo2_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN) - self.point = 0 + spo2_value_label.set_text("- -%") spo2_start_label.set_text("正在测量中.") @@ -4817,75 +4545,20 @@ class Spo2Screen(Screen): global spo2_line1,spo2_line2,spo2_line3,spo2_line4,spo2_line5,spo2_line6,spo2_line7 read_data = {} read_data = EventMesh.publish("get_history_spo2_value") - print("hr get_history_spo2_value",read_data) - if read_data != None: - count = len(read_data) + # print("hr get_history_spo2_value",read_data) + if len(read_data) != 0: + sort_new = {} + sort_new = sorted(read_data, key = lambda i: i['timeSec'],reverse = False)#按照时间戳进行排序 去掉最旧的一次数据如果满了五 + count = len(sort_new) if count != 0: - if count >= 7: - for i in range(count): - value = read_data["0{}".format(i+1)] - if value < 80: - value = 80 - if value >= 100: - value = 100 - if value <= 85: - value = value - 80 - line_value = int(value*6) - elif value <= 90: - value = value-85 - line_value = int((17/5)*value)+30 - elif value <= 95: - value = value-90 - line_value = int((21/5)*value)+47 - elif value <= 100: - value = value-95 - line_value = int((16/5)*value)+68 - - - if line_value >= 100: - line_value = 100 - #print("hr hist",line_value) - hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}] - if i == 0: - spo2_line1.set_points(hr_line_points,2) - spo2_line1.set_pos(25,160-line_value) - spo2_line1.set_size(10,line_value) - if i == 1: - spo2_line2.set_points(hr_line_points,2) - spo2_line2.set_pos(53,160-line_value) - spo2_line2.set_size(10,line_value) - - if i == 2: - spo2_line3.set_points(hr_line_points,2) - spo2_line3.set_pos(80,160-line_value) - spo2_line3.set_size(10,line_value) - - if i == 3: - spo2_line4.set_points(hr_line_points,2) - spo2_line4.set_pos(109,160-line_value) - spo2_line4.set_size(10,line_value) - - if i == 4: - spo2_line5.set_points(hr_line_points,2) - spo2_line5.set_pos(136,160-line_value) - spo2_line5.set_size(10,line_value) - - if i == 5: - spo2_line6.set_points(hr_line_points,2) - spo2_line6.set_pos(164,160-line_value) - spo2_line6.set_size(10,line_value) - - if i == 6: - spo2_line7.set_points(hr_line_points,2) - spo2_line7.set_pos(192,160-line_value) - spo2_line7.set_size(10,line_value) - else: - value = read_data["0{}".format(count)] + for i in range(count): + print(int(sort_new[i]["spo2"])) + # print("hr history read_data",read_data) + value = int(sort_new[i]["spo2"]) if value < 80: - value = 80 + value = 80 if value >= 100: value = 100 - if value <= 85: value = value - 80 line_value = int(value*6) @@ -4902,47 +4575,56 @@ class Spo2Screen(Screen): if line_value >= 100: line_value = 100 - # + #print("hr hist",line_value) hr_line_points = [{"x":0,"y":0},{"x":0,"y":line_value}] - if count == 1: + if i == 0: spo2_line1.set_points(hr_line_points,2) spo2_line1.set_pos(25,160-line_value) spo2_line1.set_size(10,line_value) - if count == 2: + if i == 1: spo2_line2.set_points(hr_line_points,2) spo2_line2.set_pos(53,160-line_value) spo2_line2.set_size(10,line_value) - if count == 3: + if i == 2: spo2_line3.set_points(hr_line_points,2) spo2_line3.set_pos(80,160-line_value) spo2_line3.set_size(10,line_value) - if count == 4: + if i == 3: spo2_line4.set_points(hr_line_points,2) spo2_line4.set_pos(109,160-line_value) spo2_line4.set_size(10,line_value) - if count == 5: + if i == 4: spo2_line5.set_points(hr_line_points,2) spo2_line5.set_pos(136,160-line_value) spo2_line5.set_size(10,line_value) - if count == 6: + if i == 5: spo2_line6.set_points(hr_line_points,2) spo2_line6.set_pos(164,160-line_value) spo2_line6.set_size(10,line_value) - if count == 7: + if i == 6: spo2_line7.set_points(hr_line_points,2) spo2_line7.set_pos(192,160-line_value) - spo2_line7.set_size(10,line_value) - - + spo2_line7.set_size(10,line_value) + def start_measure(self,*args): + EventMesh.publish("publish_message_event_ui",{"func":self.start_measure_do,"data":0}) + def start_measure_do(self,data): global spo2_screen,spo2_label,spo2_start_label,spo2_value_label,spo2_done_img ,spo2_reset_btn_img self.point = self.point + 1 EventMesh.publish("system_sleep_rest")#防止黑屏 + WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据 + # if self.Hsensor == None: + # self.Hsensor = EventMesh.publish("get_Hsensor") + # c_data = self.Hsensor.get_test_data()#校准数据和工厂数据 + # print(" 佩戴状态\n红外:{}活体:{}佩戴:{}\n{},{} \n{},{} \n{},{}\n校准数据:{},{},{},{}\n漏光数据:{},{},{}" + # .format(c_data[3],c_data[4],WEAR,c_data[5],c_data[6],c_data[7],c_data[8],c_data[9],c_data[10], + # c_data[11],c_data[12],c_data[13],c_data[14],c_data[0],c_data[1],c_data[2],)) + # print("sop2:start_measure:point{}".format(self.point)) self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) if self.point >= 2: if self.spo2_value != 0: @@ -4952,25 +4634,32 @@ class Spo2Screen(Screen): if self.point%4 == 0 : spo2_start_label.set_text("正在测量中..") - spo2_done_img.set_src("U:/static/spo2_gif03.png") + spo2_done_img.set_src("E:/static/spo2_gif03.png") if self.point%4 == 1 : spo2_start_label.set_text("正在测量中...") - spo2_done_img.set_src("U:/static/spo2_gif02.png") + spo2_done_img.set_src("E:/static/spo2_gif02.png") if self.point%4 == 2 : spo2_start_label.set_text("正在测量中.") - spo2_done_img.set_src("U:/static/spo2_gif01.png") + spo2_done_img.set_src("E:/static/spo2_gif01.png") if self.point%4 == 3 : spo2_start_label.set_text("正在测量中.") - spo2_done_img.set_src("U:/static/spo2_gif04.png") + spo2_done_img.set_src("E:/static/spo2_gif04.png") - if self.point > 120: #测20s - spo2_done_img.set_src("U:/static/spo2_gif04.png") + if self.point > 120 or (WEAR == 0 and self.point > 10): #测60s + self.timer.stop() + spo2_done_img.set_src("E:/static/spo2_gif04.png") self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) + if WEAR == 0: + self.spo2_value = 0 + spo2_start_label.set_text("佩戴异常,点击重测") + else : + spo2_start_label.set_text("测量结束,点击重测") + if self.spo2_value >= 85: EventMesh.publish("set_old_spo2_data",self.spo2_value) EventMesh.publish("set_history_spo2_value",self.spo2_value) @@ -4978,17 +4667,16 @@ class Spo2Screen(Screen): spo2_reset_btn_img.clear_flag(lv.obj.FLAG.HIDDEN) + if self.spo2_value != 0: - spo2_start_label.set_text("测量结束,点击重测") spo2_value_label.set_text("{}%".format(self.spo2_value)) # heartrate_done_label.set_text("测量完成") else: spo2_value_label.set_text("- - %") - spo2_start_label.set_text("测量异常,点击重测") + self.show_history_data() - self.timer.stop() self.point = 0 EventMesh.publish("set_spo2_state",0)#0代表关闭测试 print("stop debug9") @@ -5015,154 +4703,6 @@ class Spo2Screen(Screen): -# class Spo2Screen(Screen): -# NAME = "spo2" - -# def __init__(self): -# super().__init__() -# self.meta = None -# self.timer = osTimer() -# self.point = 0 -# self.spo2_value = 0 -# self.last_spo2_value = 0 -# self.rtc = RTC() - -# def initialization(self): -# global spo2_screen ,spo2_label_0 ,spo2_done_img ,spo2_label ,spo2_label_1 ,spo2_line ,spo2_last_time,spo2_last_value -# if spo2_screen == None: -# spo2_screen = lv.obj() -# print("spo2_screen") -# spo2_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - -# spo2_label_0 = lv.label(spo2_screen) -# spo2_label_0.set_pos(0, 10) -# spo2_label_0.set_size(240, 40) -# spo2_label_0.set_text("血氧") -# spo2_label_0.set_long_mode(lv.label.LONG.WRAP) -# spo2_label_0.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# spo2_label_0.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# spo2_done_img = lv.img(spo2_screen) -# spo2_done_img.set_pos(89, 50) -# spo2_done_img.set_size(62, 84) -# spo2_done_img.set_src("U:/static/IMAGE_SPO2_ONLY_TEST_DONE.png") - -# spo2_label = lv.label(spo2_screen) -# spo2_label.set_size(240,30) -# spo2_label.set_pos(0,160) -# spo2_label.set_text(" ") -# spo2_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# spo2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -# spo2_label_1 = lv.label(spo2_screen) -# spo2_label_1.set_size(240,40) -# spo2_label_1.set_pos(0,200) -# spo2_label_1.set_text("测量中.") -# spo2_label_1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# spo2_label_1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - -# spo2_line = lv.line(spo2_screen) -# spo2_line.set_points(line_points,2) -# spo2_line.set_pos(0,240) -# spo2_line.set_size(240,10) -# spo2_line.add_style(style_line,0) - -# spo2_last_time = lv.label(spo2_screen) -# spo2_last_time.set_size(240, 15) -# spo2_last_time.set_pos(0, 250) -# spo2_last_time.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# spo2_last_time.set_text(" ") -# spo2_last_time.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - -# spo2_last_value = lv.label(spo2_screen) -# spo2_last_value.set_size(240, 15) -# spo2_last_value.set_pos(0, 280) -# spo2_last_value.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# spo2_last_value.set_text(" ") -# spo2_last_value.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# self.meta = spo2_screen - -# self.point = 0 -# self.spo2_value = 0 -# self.timer.start(1*1000, 1, self.start_measure) -# EventMesh.publish("set_spo2_state",1)#2代表后台进入血氧测试 -# EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN) -# self.last_spo2_value = EventMesh.publish("get_old_spo2_data") -# spo2_label.set_text("--%") -# if self.last_spo2_value == 0: -# spo2_last_value.set_text(" ") -# else: -# spo2_last_value.set_text("{}%".format(self.last_spo2_value)) - -# def start_measure(self,*args): -# global spo2_screen ,spo2_label_0 ,spo2_done_img ,spo2_label ,spo2_label_1 ,spo2_line ,spo2_last_time,spo2_last_value -# self.point = self.point + 1 -# EventMesh.publish("system_sleep_rest")#防止黑屏 -# self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) -# if self.spo2_value == 0: -# spo2_label.set_text("--%") -# else: -# spo2_label.set_text("{} %".format(self.spo2_value)) -# if self.point%4 == 0 : -# spo2_label_1.set_text("测量中..") -# if self.point%4 == 1 : -# spo2_label_1.set_text("测量中...") -# if self.point%4 == 2 : -# spo2_label_1.set_text("测量中....") -# if self.point%4 == 3 : -# spo2_label_1.set_text("测量中.") - -# if self.point > 60: #测20s -# self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN) -# # print("ui self.spo2_value :{}".format(self.spo2_value)) -# if self.spo2_value > 85 and self.spo2_value != None: -# EventMesh.publish("set_old_spo2_data",self.spo2_value) -# EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,self.spo2_value) -# spo2_label.set_text("{} %".format(self.spo2_value)) -# if self.spo2_value == 0: -# spo2_label.set_text(" ") -# spo2_label_1.set_text("退出,请重新测量") -# self.last_spo2_value = EventMesh.publish("get_old_spo2_data") -# spo2_last_value.set_text(" ") -# else: -# self.last_spo2_value = self.spo2_value -# spo2_last_value.set_text("{}%".format(self.last_spo2_value)) -# spo2_label_1.set_text("测量完成") -# time = EventMesh.publish("screen_get_time") -# #print("time ",time) -# rtc_time = self.rtc.datetime() -# time_time =" {}:{}".format("%02d"%(time[0][0]),"%02d"%(time[0][1]))#测量时间 -# spo2_last_time.set_text(str(rtc_time[0])+'/'+str(rtc_time[1])+'/'+str(rtc_time[2])+str(time_time)) - - - -# self.timer.stop() -# self.point = 0 -# EventMesh.publish("set_spo2_state",0)#0代表关闭测试 -# EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) -# # spo2_last_time.set_text() - -# def Close(self): -# self.timer.stop() -# get_hr_state = EventMesh.publish("get_hr_state") -# get_spo2_state = EventMesh.publish("get_spo2_state") -# if get_hr_state == 1 or get_spo2_state == 1: -# EventMesh.publish("set_spo2_state",0)#0代表关闭测试 -# EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) - -# def done_return(self): -# EventMesh.publish("load_screen", {"screen": "health"}) - -# def btn1_release(self): -# EventMesh.publish("load_screen", {"screen": "health"}) - -# def btn8_press(self): -# EventMesh.publish("watch_top_show") -# EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - @@ -5224,24 +4764,24 @@ class CountdownScreen(Screen): countdown_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_title = lv.label(countdown_screen) - countdown_title.set_pos(0, 5) - countdown_title.set_size(128, 20) + countdown_title.set_pos(0, 20) + countdown_title.set_size(240, 20) countdown_title.set_text("倒计时") countdown_title.set_long_mode(lv.label.LONG.WRAP) countdown_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) countdown_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_hour = lv.label(countdown_screen) - countdown_hour.set_pos(19, 50) - countdown_hour.set_size(40, 30) + countdown_hour.set_pos(30, 140) + countdown_hour.set_size(60, 30) countdown_hour.set_text("00") countdown_hour.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_hour.set_long_mode(lv.label.LONG.WRAP) countdown_hour.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) countdown_mao = lv.label(countdown_screen) - countdown_mao.set_pos(45, 50) - countdown_mao.set_size(20, 20) + countdown_mao.set_pos(82, 138) + countdown_mao.set_size(30, 30) countdown_mao.set_text(":") countdown_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_mao.set_long_mode(lv.label.LONG.WRAP) @@ -5249,16 +4789,16 @@ class CountdownScreen(Screen): countdown_min = lv.label(countdown_screen) - countdown_min.set_pos(55, 50) - countdown_min.set_size(40, 30) + countdown_min.set_pos(95, 140) + countdown_min.set_size(60, 30) countdown_min.set_text("00") countdown_min.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_min.set_long_mode(lv.label.LONG.WRAP) countdown_min.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) countdown_mao1 = lv.label(countdown_screen) - countdown_mao1.set_pos(81, 50) - countdown_mao1.set_size(20, 20) + countdown_mao1.set_pos(146, 138) + countdown_mao1.set_size(30, 30) countdown_mao1.set_text(":") countdown_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_mao1.set_long_mode(lv.label.LONG.WRAP) @@ -5266,125 +4806,122 @@ class CountdownScreen(Screen): countdown_sec = lv.label(countdown_screen) - countdown_sec.set_pos(91, 50) - countdown_sec.set_size(128-91, 20) + countdown_sec.set_pos(160, 140) + countdown_sec.set_size(60, 30) countdown_sec.set_text("00") countdown_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_sec.set_long_mode(lv.label.LONG.WRAP) countdown_sec.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) countdown_hour_up = lv.img(countdown_screen) - countdown_hour_up.set_size(17, 15) - countdown_hour_up.set_pos(19, 30) - countdown_hour_up.set_src("U:/static/time_up.png") - countdown_hour_up.add_flag(lv.obj.FLAG.CLICKABLE) + countdown_hour_up.set_size(34, 30) + countdown_hour_up.set_pos(36, 100) + countdown_hour_up.set_src("E:/static/time_up.png") countdown_hour_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_hour_up_btn= lv.img(countdown_screen) - countdown_hour_up_btn.set_size(45, 40) - countdown_hour_up_btn.set_pos(0, 25) + countdown_hour_up_btn.set_size(62, 70) + countdown_hour_up_btn.set_pos(20, 80) countdown_hour_up_btn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_hour_down = lv.img(countdown_screen) - countdown_hour_down.set_size(17, 15) - countdown_hour_down.set_pos(19, 70) - countdown_hour_down.set_src("U:/static/time_down.png") + countdown_hour_down.set_size(34, 30) + countdown_hour_down.set_pos(36, 180) + countdown_hour_down.set_src("E:/static/time_down.png") countdown_hour_down.add_flag(lv.obj.FLAG.CLICKABLE) countdown_hour_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_hour_down_btn= lv.img(countdown_screen) - countdown_hour_down_btn.set_size(45, 40) - countdown_hour_down_btn.set_pos(0, 65) + countdown_hour_down_btn.set_size(62, 80) + countdown_hour_down_btn.set_pos(20, 150) countdown_hour_down_btn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_min_up = lv.img(countdown_screen) - countdown_min_up.set_size(17, 15) - countdown_min_up.set_pos(53+2, 30) - countdown_min_up.set_src("U:/static/time_up.png") + countdown_min_up.set_size(34, 30) + countdown_min_up.set_pos(99, 100) + countdown_min_up.set_src("E:/static/time_up.png") countdown_min_up.add_flag(lv.obj.FLAG.CLICKABLE) countdown_min_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_min_up_btn= lv.img(countdown_screen) - countdown_min_up_btn.set_size(36, 40) - countdown_min_up_btn.set_pos(45, 25) + countdown_min_up_btn.set_size(64, 70) + countdown_min_up_btn.set_pos(82, 80) countdown_min_up_btn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_min_down = lv.img(countdown_screen) - countdown_min_down.set_size(17, 15) - countdown_min_down.set_pos(53+2, 70) - countdown_min_down.set_src("U:/static/time_down.png") + countdown_min_down.set_size(34, 30) + countdown_min_down.set_pos(99, 180) + countdown_min_down.set_src("E:/static/time_down.png") countdown_min_down.add_flag(lv.obj.FLAG.CLICKABLE) countdown_min_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_min_down_btn= lv.img(countdown_screen) - countdown_min_down_btn.set_size(36, 40) - countdown_min_down_btn.set_pos(45, 65) + countdown_min_down_btn.set_size(64, 80) + countdown_min_down_btn.set_pos(82, 150) countdown_min_down_btn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_sec_up = lv.img(countdown_screen) - countdown_sec_up.set_size(17, 15) - countdown_sec_up.set_pos(91, 30) - countdown_sec_up.set_src("U:/static/time_up.png") - countdown_sec_up.add_flag(lv.obj.FLAG.CLICKABLE) + countdown_sec_up.set_size(34, 30) + countdown_sec_up.set_pos(165, 100) + countdown_sec_up.set_src("E:/static/time_up.png") countdown_sec_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_sec_up_btn = lv.img(countdown_screen) - countdown_sec_up_btn.set_size(128-81, 40) - countdown_sec_up_btn.set_pos(81, 25) + countdown_sec_up_btn.set_size(64, 70) + countdown_sec_up_btn.set_pos(146, 80) countdown_sec_up_btn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_sec_down = lv.img(countdown_screen) - countdown_sec_down.set_size(17, 15) - countdown_sec_down.set_pos(91, 70) - countdown_sec_down.set_src("U:/static/time_down.png") + countdown_sec_down.set_size(34, 30) + countdown_sec_down.set_pos(165, 180) + countdown_sec_down.set_src("E:/static/time_down.png") countdown_sec_down.add_flag(lv.obj.FLAG.CLICKABLE) countdown_sec_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_sec_down_btn = lv.img(countdown_screen) - countdown_sec_down_btn.set_size(128-81, 40) - countdown_sec_down_btn.set_pos(81, 65) + countdown_sec_down_btn.set_size(64, 80) + countdown_sec_down_btn.set_pos(146, 150) countdown_sec_down_btn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_reset_img = lv.img(countdown_screen) - countdown_reset_img.set_size(50, 18) - countdown_reset_img.set_src("U:/static/stopwatch_reset.png") + countdown_reset_img.set_size(99, 36) + countdown_reset_img.set_src("E:/static/stopwatch_reset.png") countdown_reset_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - countdown_reset_img.set_pos(8, 100) + countdown_reset_img.set_pos(10, 260) countdown_reset_imgbtn = lv.img(countdown_screen) - countdown_reset_imgbtn.set_size(66, 23) + countdown_reset_imgbtn.set_size(99, 70) countdown_reset_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_reset_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - countdown_reset_imgbtn.set_pos(0, 105) + countdown_reset_imgbtn.set_pos(10, 240) countdown_start_img = lv.img(countdown_screen) - countdown_start_img.set_size(50, 18) - countdown_start_img.set_src("U:/static/stopwatch_play.png") + countdown_start_img.set_size(99, 36) + countdown_start_img.set_src("E:/static/stopwatch_play.png") countdown_start_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - countdown_start_img.set_pos(66, 100) + countdown_start_img.set_pos(120, 260) countdown_start_imgbtn = lv.img(countdown_screen) - countdown_start_imgbtn.set_size(128-66, 23) + countdown_start_imgbtn.set_size(99, 70) countdown_start_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) countdown_start_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - countdown_start_imgbtn.set_pos(66, 105) + countdown_start_imgbtn.set_pos(120, 240) countdown_stop_img = lv.img(countdown_screen) - countdown_stop_img.set_size(50, 18) - countdown_stop_img.set_src("U:/static/stopwatch_stop.png") + countdown_stop_img.set_size(99, 36) + countdown_stop_img.set_src("E:/static/stopwatch_stop.png") countdown_stop_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - countdown_stop_img.set_pos(66, 100) + countdown_stop_img.set_pos(120, 260) countdown_stop_img.add_flag(lv.obj.FLAG.HIDDEN) - countdown_start_img.clear_flag(lv.obj.FLAG.HIDDEN) countdown_stop_img.add_flag(lv.obj.FLAG.HIDDEN) @@ -5545,34 +5082,35 @@ class CountdownScreen(Screen): # EventMesh.publish("load_screen", {"screen": "countdown"}) def fun(self,e): - date_tmp = utime.localtime() - self.time_tmp = utime.mktime(date_tmp) - total_sec = self.time_tmp - self.timeSecond - # print("total_sec:{} self.time_tmp:{} self.timeSecond:{} self.total:{}".format(total_sec,self.time_tmp,self.timeSecond,self.total)) - if self.total > 0: - self.total = self.total - total_sec - self.timeSecond = self.time_tmp - - - self.hour = self.total//3600 - self.min = self.total%3600//60 - self.sec = self.total%60 - + if self.g_state == 1: + date_tmp = utime.localtime() + self.time_tmp = utime.mktime(date_tmp) + total_sec = self.time_tmp - self.timeSecond + # print("total_sec:{} self.time_tmp:{} self.timeSecond:{} self.total:{}".format(total_sec,self.time_tmp,self.timeSecond,self.total)) + if self.total > 0: + self.total = self.total - total_sec + self.timeSecond = self.time_tmp + + + self.hour = self.total//3600 + self.min = self.total%3600//60 + self.sec = self.total%60 + - # print("self.total:{} self.time_tmp:{} self.timeSecond:{} test_hour:{} test_min:{} test_sec:{}".format(self.total,self.time_tmp,self.timeSecond,test_hour,test_min,test_sec)) - self.show_value() - # print("Close self.timeSecond:22") - EventMesh.publish("set_countdown_all_time", [self.total,self.timeSecond]) - if self.total <= 0: - self.g_state = 0 - self.g_end = 1 - self.hour = 0 - self.min = 0 - self.sec = 0 - EventMesh.publish("set_countdown_off_state", [0,self.g_state]) - self.timer.stop() - self.show_value() - EventMesh.publish("load_screen", {"screen": "countdown_end"}) + # print("self.total:{} self.time_tmp:{} self.timeSecond:{} test_hour:{} test_min:{} test_sec:{}".format(self.total,self.time_tmp,self.timeSecond,test_hour,test_min,test_sec)) + self.show_value() + # print("Close self.timeSecond:22") + EventMesh.publish("set_countdown_all_time", [self.total,self.timeSecond]) + if self.total <= 0: + self.g_state = 0 + self.g_end = 1 + self.hour = 0 + self.min = 0 + self.sec = 0 + EventMesh.publish("set_countdown_off_state", [0,self.g_state]) + self.timer.stop() + self.show_value() + EventMesh.publish("load_screen", {"screen": "countdown_end"}) # self.total = self.total - 1 @@ -5594,7 +5132,6 @@ class CountdownScreen(Screen): msg_tmp = EventMesh.publish("get_countdown_off_state") self.g_state = msg_tmp[1] EventMesh.publish("set_countdown_off_state", [0,self.g_state]) - def close_count_show_info(self, event, msg): self.reset(0) @@ -5625,6 +5162,8 @@ class CountdownScreen(Screen): countdown_sec_up.clear_flag(lv.obj.FLAG.HIDDEN) countdown_sec_down.clear_flag(lv.obj.FLAG.HIDDEN) self.show_value() + + def show_value(self): @@ -5682,6 +5221,10 @@ class CountdownScreen(Screen): else: EventMesh.publish("set_countdown_off_state", [0,self.g_state]) + def stop_count_down(self,*argc,a): + if self.g_state == 0: + self.timer.stop() + def done_return(self): if self.g_state == 0: self.timer.stop() @@ -5714,7 +5257,6 @@ class CountdownEndScreen(Screen): self.FIND_timer=osTimer() self.aud = audio.Audio(0) self.FIND_timer_count = 0 - self.meta_type = "popup" def initialization(self): global countdown_end_screen ,countdown_end_img ,countdown_end_label @@ -5723,23 +5265,23 @@ class CountdownEndScreen(Screen): print("countdown_end_screen") countdown_end_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_end_img = lv.img(countdown_end_screen) - countdown_end_img.set_size(38, 57) - countdown_end_img.set_pos(45, 20) - countdown_end_img.set_src("U:/static/time_finish.png") + countdown_end_img.set_size(140, 140) + countdown_end_img.set_pos(50, 60) + countdown_end_img.set_src("E:/static/time_finish.png") countdown_end_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_end_label = lv.label(countdown_end_screen) - countdown_end_label.set_pos(0, 90) - countdown_end_label.set_size(128, 38) + countdown_end_label.set_pos(0, 240) + countdown_end_label.set_size(240, 40) countdown_end_label.set_text("时间到") countdown_end_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) countdown_end_label.set_long_mode(lv.label.LONG.WRAP) countdown_end_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) self.meta = countdown_end_screen self.FIND_timer_count = 0 + self.FIND_timer.start(3000, 1, self.FIND_timer_cb) EventMesh.publish("close_count_show_info") - self.FIND_timer.start(2000, 1, self.FIND_timer_cb) - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') #播放声音 + self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音 def FIND_timer_cb(self, *args): EventMesh.publish("system_sleep_rest")#防止黑屏 @@ -5748,14 +5290,15 @@ class CountdownEndScreen(Screen): self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) return - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') + self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') def stop_FIND(self) : + self.FIND_timer.stop() self.aud.stopAll() def Close(self): - self.stop_FIND() + self.stop_FIND() def done_left_to_right(self): self.stop_FIND() @@ -5778,6 +5321,7 @@ class CountdownEndScreen(Screen): EventMesh.publish("load_screen", {"screen": "countdown"}) def done_click(self): + print("count down !!!!!!!!!!") self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) @@ -5820,7 +5364,7 @@ class StopwatchScreen(Screen): def initialization(self): global stopwatch_screen,stopwatch_title,stopwatch_label_min,stopwatch_mao,stopwatch_label_sec ,\ - stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img,stopwatch_start_img ,\ + stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,topwatch_reset_imgbtn ,stopwatch_start_img ,\ stopwatch_start_imgbtn, stopwatch_stop_img if stopwatch_screen == None : stopwatch_screen = lv.obj() @@ -5828,24 +5372,24 @@ class StopwatchScreen(Screen): stopwatch_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_title = lv.label(stopwatch_screen) - stopwatch_title.set_pos(0, 5) - stopwatch_title.set_size(128, 20) + stopwatch_title.set_pos(0, 20) + stopwatch_title.set_size(240, 20) stopwatch_title.set_text("秒表") stopwatch_title.set_long_mode(lv.label.LONG.WRAP) stopwatch_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) stopwatch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_label_min = lv.label(stopwatch_screen) - stopwatch_label_min.set_pos(33, 50) - stopwatch_label_min.set_size(20, 30) + stopwatch_label_min.set_pos(30, 140) + stopwatch_label_min.set_size(60, 30) stopwatch_label_min.set_text("00") stopwatch_label_min.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_label_min.set_long_mode(lv.label.LONG.WRAP) stopwatch_label_min.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) stopwatch_mao = lv.label(stopwatch_screen) - stopwatch_mao.set_pos(53, 50) - stopwatch_mao.set_size(12, 30) + stopwatch_mao.set_pos(82, 138) + stopwatch_mao.set_size(30, 30) stopwatch_mao.set_text(":") stopwatch_mao.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_mao.set_long_mode(lv.label.LONG.WRAP) @@ -5853,16 +5397,16 @@ class StopwatchScreen(Screen): stopwatch_label_sec = lv.label(stopwatch_screen) - stopwatch_label_sec.set_pos(59, 50) - stopwatch_label_sec.set_size(20, 30) + stopwatch_label_sec.set_pos(95, 140) + stopwatch_label_sec.set_size(60, 30) stopwatch_label_sec.set_text("00") stopwatch_label_sec.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_label_sec.set_long_mode(lv.label.LONG.WRAP) - stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + stopwatch_label_sec.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) stopwatch_mao1 = lv.label(stopwatch_screen) - stopwatch_mao1.set_pos(80, 50) - stopwatch_mao1.set_size(12, 30) + stopwatch_mao1.set_pos(146, 138) + stopwatch_mao1.set_size(30, 30) stopwatch_mao1.set_text(".") stopwatch_mao1.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_mao1.set_long_mode(lv.label.LONG.WRAP) @@ -5870,8 +5414,8 @@ class StopwatchScreen(Screen): stopwatch_label_ms = lv.label(stopwatch_screen) - stopwatch_label_ms.set_pos(85, 50) - stopwatch_label_ms.set_size(12, 30) + stopwatch_label_ms.set_pos(160, 140) + stopwatch_label_ms.set_size(60, 30) stopwatch_label_ms.set_text("0") stopwatch_label_ms.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) stopwatch_label_ms.set_long_mode(lv.label.LONG.WRAP) @@ -5881,35 +5425,35 @@ class StopwatchScreen(Screen): stopwatch_reset_img = lv.img(stopwatch_screen) - stopwatch_reset_img.set_size(50, 18) - stopwatch_reset_img.set_src("U:/static/stopwatch_reset.png") + stopwatch_reset_img.set_size(99, 36) + stopwatch_reset_img.set_src("E:/static/stopwatch_reset.png") stopwatch_reset_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - stopwatch_reset_img.set_pos(8, 90) + stopwatch_reset_img.set_pos(10, 210) stopwatch_reset_imgbtn = lv.img(stopwatch_screen) - stopwatch_reset_imgbtn.set_size(62, 33) + stopwatch_reset_imgbtn.set_size(99, 76) stopwatch_reset_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) - stopwatch_reset_imgbtn.set_pos(0, 85) + stopwatch_reset_imgbtn.set_pos(10, 190) stopwatch_start_img = lv.img(stopwatch_screen) - stopwatch_start_img.set_size(50, 18) - stopwatch_start_img.set_src("U:/static/stopwatch_play.png") + stopwatch_start_img.set_size(99, 36) + stopwatch_start_img.set_src("E:/static/stopwatch_play.png") stopwatch_start_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - stopwatch_start_img.set_pos(66, 90) + stopwatch_start_img.set_pos(115, 210) stopwatch_start_imgbtn = lv.img(stopwatch_screen) - stopwatch_start_imgbtn.set_size(128-62, 33) + stopwatch_start_imgbtn.set_size(99, 76) stopwatch_start_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) - stopwatch_start_imgbtn.set_pos(62, 85) + stopwatch_start_imgbtn.set_pos(115, 190) stopwatch_stop_img = lv.img(stopwatch_screen) - stopwatch_stop_img.set_size(50, 18) - stopwatch_stop_img.set_src("U:/static/stopwatch_stop.png") + stopwatch_stop_img.set_size(99, 36) + stopwatch_stop_img.set_src("E:/static/stopwatch_stop.png") stopwatch_stop_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - stopwatch_stop_img.set_pos(66, 90) + stopwatch_stop_img.set_pos(115, 210) stopwatch_stop_img.add_flag(lv.obj.FLAG.HIDDEN) stopwatch_start_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), lv.EVENT.CLICKED, None) @@ -5937,7 +5481,7 @@ class StopwatchScreen(Screen): def start(self, e): global stopwatch_screen,stopwatch_title,stopwatch_label_min,stopwatch_mao,stopwatch_label_sec ,\ - stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,stopwatch_start_img ,\ + stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,topwatch_reset_imgbtn ,stopwatch_start_img ,\ stopwatch_start_imgbtn, stopwatch_stop_img print("stopwatch start:{}".format(self.s_state)) #self.timer.start(100, 1, self._fun) @@ -5964,7 +5508,7 @@ class StopwatchScreen(Screen): def paused(self): global stopwatch_screen,stopwatch_title,stopwatch_label_min,stopwatch_mao,stopwatch_label_sec ,\ - stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,stopwatch_start_img ,\ + stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,topwatch_reset_imgbtn ,stopwatch_start_img ,\ stopwatch_start_imgbtn, stopwatch_stop_img print("stopwatch pause") stopwatch_start_img.clear_flag(lv.obj.FLAG.HIDDEN) @@ -5974,7 +5518,7 @@ class StopwatchScreen(Screen): def reset(self,e): global stopwatch_screen,stopwatch_title,stopwatch_label_min,stopwatch_mao,stopwatch_label_sec ,\ - stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,stopwatch_start_img ,\ + stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,topwatch_reset_imgbtn ,stopwatch_start_img ,\ stopwatch_start_imgbtn, stopwatch_stop_img print("stopwatch reset") @@ -5996,7 +5540,7 @@ class StopwatchScreen(Screen): self.total_time+=1 if self.sec_value > 59: self.sec_value = 0 - if self.total_time >= 99*60: + if self.total_time > 99*60: self.total_time = 99*60 self.timer.stop() stopwatch_start_img.clear_flag(lv.obj.FLAG.HIDDEN) @@ -6006,18 +5550,16 @@ class StopwatchScreen(Screen): def show_value(self): global stopwatch_screen,stopwatch_title,stopwatch_label_min,stopwatch_mao,stopwatch_label_sec ,\ - stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,stopwatch_start_img ,\ + stopwatch_mao1 ,stopwatch_label_ms,stopwatch_reset_img ,topwatch_reset_imgbtn ,stopwatch_start_img ,\ stopwatch_start_imgbtn, stopwatch_stop_img if self.total_time >= 99*60: self.total_time = 99*60 - self.ms_value = 0 test_s = self.total_time % 60 test_m = self.total_time//60 # print("test_s:{} test_m:{} self.total_time:{}".format(test_s,test_m,self.total_time)) stopwatch_label_ms.set_text(str("%d"%(self.ms_value))) stopwatch_label_sec.set_text(str("%02d"%(test_s))) - # stopwatch_label_sec.set_text("{}:{}.{}".format("%02d"%(test_m),"%02d"%(test_s),"%d"%(self.ms_value))) stopwatch_label_min.set_text(str("%02d"%(test_m))) def Close(self): @@ -6084,13 +5626,14 @@ class UIFINDScreen(Screen): def __init__(self): super().__init__() self.aud = audio.Audio(0) + # self.aud.setVolume(self.volum_size) self.FIND_timer = osTimer() self.FIND_timer_count = 0 + self.meta = None - self.meta_type = "popup" def initialization(self): - global FIND_screen ,findphone_img + global FIND_screen ,watchface_mpsignal_img if FIND_screen ==None: FIND_screen = lv.obj() @@ -6099,22 +5642,13 @@ class UIFINDScreen(Screen): # add style for watchface FIND_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) #进入图片 - findphone_img = lv.img(FIND_screen) - findphone_img.set_pos(int(15),int(10)) - findphone_img.set_size(98,66) - findphone_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - findphone_img.add_flag(lv.obj.FLAG.CLICKABLE) - findphone_img.set_src("U:/static/find_phone.png") - findphone_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) - - findphone_img_label = lv.label(FIND_screen) - findphone_img_label.set_pos(int(0),int(90)) - findphone_img_label.set_size(128,66) - findphone_img_label.set_text("点击关闭屏幕") - findphone_img_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - findphone_img_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) - - + watchface_mpsignal_img = lv.img(FIND_screen) + watchface_mpsignal_img.set_pos(int(40),int(45)) + watchface_mpsignal_img.set_size(160,230) + watchface_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + watchface_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) + watchface_mpsignal_img.set_src("E:/static/find_phone.png") + watchface_mpsignal_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) self.meta = FIND_screen @@ -6122,12 +5656,12 @@ class UIFINDScreen(Screen): utime.sleep_ms(200)#不加延时会切屏 self.FIND_timer_count = 0 print("self.FIND_timer_count:{}".format(self.FIND_timer_count)) - self.FIND_timer.start(2000, 1, self.FIND_timer_cb) - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') #播放声音 + self.FIND_timer.start(3000, 1, self.FIND_timer_cb) + self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音 def FIND_timer_cb(self, *args): EventMesh.publish("system_sleep_rest") - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') + self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') self.FIND_timer_count += 1 if self.FIND_timer_count > 20: #120秒 self.stop_FIND() @@ -6185,20 +5719,12 @@ class LowPowerScreen(Screen): Lowpower_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) #进入图片 Lowpower_screen_img = lv.img(Lowpower_screen) - Lowpower_screen_img.set_pos(int(24),int(10)) - Lowpower_screen_img.set_size(80,80) + Lowpower_screen_img.set_pos(int(40),int(45)) + Lowpower_screen_img.set_size(160,230) Lowpower_screen_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) Lowpower_screen_img.add_flag(lv.obj.FLAG.CLICKABLE) - Lowpower_screen_img.set_src("U:/static/low_power.png") + Lowpower_screen_img.set_src("E:/static/low_power.png") Lowpower_screen_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) - - Lowpower_screen_img_label = lv.label(Lowpower_screen) - Lowpower_screen_img_label.set_pos(int(0),int(100)) - Lowpower_screen_img_label.set_size(128,28) - Lowpower_screen_img_label.set_text("电量低") - Lowpower_screen_img_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - Lowpower_screen_img_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) - self.meta = Lowpower_screen def done_left_to_right(self): @@ -6241,36 +5767,34 @@ class LowOnePowerScreen(Screen): #0%的电池电量 LowOnePower_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) #进入图片 LowOnePower_screen_img = lv.img(LowOnePower_screen) - LowOnePower_screen_img.set_pos(int(47),int(5)) - LowOnePower_screen_img.set_size(30,49) + LowOnePower_screen_img.set_pos(int(86),int(30)) + LowOnePower_screen_img.set_size(68,110) LowOnePower_screen_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) LowOnePower_screen_img.add_flag(lv.obj.FLAG.CLICKABLE) - LowOnePower_screen_img.set_src("U:/static/0_BAT.png") + LowOnePower_screen_img.set_src("E:/static/0_BAT.png") LowOnePower_screen_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) LowOnePower_screen_label1 = lv.label(LowOnePower_screen) - LowOnePower_screen_label1.set_pos(0, 55) - LowOnePower_screen_label1.set_size(128, 73) - LowOnePower_screen_label1.set_text("电池电量过低\n部分功能不能正常\n使用,5s过后强制关机") + LowOnePower_screen_label1.set_pos(0, 180) + LowOnePower_screen_label1.set_size(240, 60) + LowOnePower_screen_label1.set_text("电池电量过低,请及时充电") LowOnePower_screen_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) LowOnePower_screen_label1.set_long_mode(lv.label.LONG.WRAP) LowOnePower_screen_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - # LowOnePower_screen_label2 = lv.label(LowOnePower_screen) - # LowOnePower_screen_label2.set_pos(0, 70) - # LowOnePower_screen_label2.set_size(128, 58) - # LowOnePower_screen_label2.set_text("部分功能不能正常\n使用,5s过后强制关机") - # LowOnePower_screen_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - # LowOnePower_screen_label2.set_long_mode(lv.label.LONG.WRAP) - # LowOnePower_screen_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + LowOnePower_screen_label2 = lv.label(LowOnePower_screen) + LowOnePower_screen_label2.set_pos(0, 250) + LowOnePower_screen_label2.set_size(240, 60) + LowOnePower_screen_label2.set_text("继续使用,5s过后强制关机") + LowOnePower_screen_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + LowOnePower_screen_label2.set_long_mode(lv.label.LONG.WRAP) + LowOnePower_screen_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) self.meta = LowOnePower_screen def post_processor_after_initialization(self): self.timer.start(5000,0,self.fun) - - def fun(self,e): EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) @@ -6324,51 +5848,51 @@ class sosScreen(Screen): sos_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) #进入图片 - # sos_screen_label = lv.label(sos_screen) - # sos_screen_label.set_pos(0, 5) - # sos_screen_label.set_size(128, 20) - # sos_screen_label.set_text("SOS") - # sos_screen_label.add_style(style_font_youyuan_20_red, lv.PART.MAIN | lv.STATE.DEFAULT) - # sos_screen_label.set_long_mode(lv.label.LONG.WRAP) - # sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + sos_screen_label = lv.label(sos_screen) + sos_screen_label.set_pos(0, 20) + sos_screen_label.set_size(240, 30) + sos_screen_label.set_text("SOS") + sos_screen_label.add_style(style_font_youyuan_20_red, lv.PART.MAIN | lv.STATE.DEFAULT) + sos_screen_label.set_long_mode(lv.label.LONG.WRAP) + sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) sos_screen_label = lv.label(sos_screen) - sos_screen_label.set_text("是否拨打求助电话?") + sos_screen_label.set_text("是否拨打紧急\n求助电话?") sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - sos_screen_label.set_size(128, 20) - sos_screen_label.set_pos(0,2) + sos_screen_label.set_size(240, 50) + sos_screen_label.set_pos(0,65) sos_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) sos_screen_label = lv.label(sos_screen) sos_screen_label.set_text("无操作10s后\n自动拨打") sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - sos_screen_label.set_size(128, 40) - sos_screen_label.set_pos(0,25) + sos_screen_label.set_size(240, 50) + sos_screen_label.set_pos(0,140) sos_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) sos_screen_confirm_img = lv.img(sos_screen) - sos_screen_confirm_img.set_size(88, 23) - sos_screen_confirm_img.set_pos(20, 65) - sos_screen_confirm_img.set_src("U:/static/off_icon.png") + sos_screen_confirm_img.set_size(176, 46) + sos_screen_confirm_img.set_pos(32, 210) + sos_screen_confirm_img.set_src("E:/static/off_icon.png") sos_screen_confirm_img.add_flag(lv.obj.FLAG.CLICKABLE) sos_screen_confirm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) sos_screen_confirm_label = lv.label(sos_screen_confirm_img) sos_screen_confirm_label.set_text("确定") - sos_screen_confirm_label.align(lv.ALIGN.CENTER, 0, 0) + sos_screen_confirm_label.align(lv.ALIGN.CENTER, 0, 5) sos_screen_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) sos_screen_return = lv.img(sos_screen) - sos_screen_return.set_size(88, 23) - sos_screen_return.set_pos(20, 98) - sos_screen_return.set_src("U:/static/cancel_icon.png") + sos_screen_return.set_size(176, 46) + sos_screen_return.set_pos(32, 270) + sos_screen_return.set_src("E:/static/cancel_icon.png") sos_screen_return.add_flag(lv.obj.FLAG.CLICKABLE) sos_screen_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) sos_screen_return_label = lv.label(sos_screen_return) sos_screen_return_label.set_text("取消") - sos_screen_return_label.align(lv.ALIGN.CENTER, 0, 0) + sos_screen_return_label.align(lv.ALIGN.CENTER, 0, 5) sos_screen_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) sos_screen_return_label.set_ext_click_area(20) @@ -6428,12 +5952,13 @@ class sosScreen(Screen): EventMesh.publish("return_prev_screen") pass -charge_in_screen = None -charge_in_screen_label = None + +no_sos_screen = None +no_sos_screen_label = None #没有设置紧急联系人的号码 -class chargeInScreen(Screen): - NAME = "charge_in" +class noSosDataScreen(Screen): + NAME = "NO_SOS_POPUP" def __init__(self): super().__init__() self.meta = None @@ -6442,40 +5967,36 @@ class chargeInScreen(Screen): self.timer = osTimer() def initialization(self): - global charge_in_screen ,charge_in_screen_label - if charge_in_screen == None : - charge_in_screen = lv.obj() - print("charge_in_screen") - charge_in_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + global no_sos_screen ,no_sos_screen_label + if no_sos_screen == None : + no_sos_screen = lv.obj() + print("NO_SOS_POPUP") + no_sos_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) # add style for watchface - charge_in_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) + no_sos_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) #进入图片 - charge_in_screen_label = lv.label(charge_in_screen) - charge_in_screen_label.set_pos(0, 50) - charge_in_screen_label.set_size(128, 20) - charge_in_screen_label.set_text(" ") - charge_in_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - charge_in_screen_label.set_long_mode(lv.label.LONG.WRAP) - charge_in_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - - self.meta = charge_in_screen + no_sos_screen_label = lv.label(no_sos_screen) + no_sos_screen_label.set_pos(0, 110) + no_sos_screen_label.set_size(240, 80) + no_sos_screen_label.set_text("请在手机app上设置\n紧急联系人号码") + no_sos_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + no_sos_screen_label.set_long_mode(lv.label.LONG.WRAP) + no_sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - def post_processor_after_initialization(self): - global charge_in_screen_label + self.meta = no_sos_screen + def post_processor_before_initialization(self): self.count = 0 self.timer.start(1000,1,self.timer_cb_onescond) - charge_in_screen_label.set_text("正在充电") - + def Close(self): self.timer.stop() def timer_cb_onescond(self,e): EventMesh.publish("system_sleep_rest")#防止黑屏 self.count+=1 - if self.count >= 5: + if self.count >= 10: self.count = 0 EventMesh.publish("return_prev_screen") @@ -6500,7 +6021,7 @@ class chargeInScreen(Screen): pass def btn8_press(self): - EventMesh.publish("return_prev_screen") + pass def btn1_press(self): EventMesh.publish("return_prev_screen") @@ -6510,171 +6031,64 @@ class chargeInScreen(Screen): pass -charge_out_screen = None -charge_out_screen_label = None -# -class chargeOutScreen(Screen): - NAME = "charge_out" + +system_init_screen = None +system_init_label = None +class SystemInitScreen(Screen): + #系统初始化中... + NAME = "system_init" + def __init__(self): super().__init__() self.meta = None - self.meta_type = "popup" - self.count = 0 - self.timer = osTimer() - + self.system_init_timer=osTimer() + self.system_init_timer_count = 0 def initialization(self): - global charge_out_screen ,charge_out_screen_label - if charge_out_screen == None : - charge_out_screen = lv.obj() - print("charge_out_screen") - charge_out_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - # add style for watchface - charge_out_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) - #进入图片 - - charge_out_screen_label = lv.label(charge_out_screen) - charge_out_screen_label.set_pos(0, 50) - charge_out_screen_label.set_size(128, 20) - charge_out_screen_label.set_text(" ") - charge_out_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - charge_out_screen_label.set_long_mode(lv.label.LONG.WRAP) - charge_out_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - + global system_init_screen ,system_init_label + if system_init_screen == None: + system_init_screen = lv.obj() + print("Lowpower_screen") + system_init_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + system_init_label = lv.label(system_init_screen) + system_init_label.set_pos(0, 150) + system_init_label.set_size(240, 40) + system_init_label.set_text("系统初始化中") + system_init_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + system_init_label.set_long_mode(lv.label.LONG.WRAP) + system_init_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + self.meta = system_init_screen + self.system_init_timer_count = 0 + self.system_init_timer.start(1000, 1, self.system_init_timer_cb) - self.meta = charge_out_screen - - - - def post_processor_after_initialization(self): - global charge_out_screen_label - self.count = 0 - self.timer.start(1000,1,self.timer_cb_onescond) - charge_out_screen_label.set_text("充电已移出") - - def Close(self): - self.timer.stop() - - def timer_cb_onescond(self,e): + def system_init_timer_cb(self, *args): EventMesh.publish("system_sleep_rest")#防止黑屏 - self.count+=1 - if self.count >= 5: - self.count = 0 - EventMesh.publish("return_prev_screen") - - - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") - pass - def done_right_to_left(self): - EventMesh.publish("return_prev_screen") - pass - def done_bottom_to_top(self): - EventMesh.publish("return_prev_screen") - pass - def done_top_to_bottom(self): - EventMesh.publish("return_prev_screen") - pass - def done_return(self): - EventMesh.publish("return_prev_screen") - pass - def done_click(self): - EventMesh.publish("return_prev_screen") - pass - - def btn8_press(self): - EventMesh.publish("return_prev_screen") - pass - def btn1_press(self): - EventMesh.publish("return_prev_screen") - pass - def btn1_release(self): - EventMesh.publish("return_prev_screen") - pass - -no_sos_screen = None -no_sos_screen_label = None - -#没有设置紧急联系人的号码 -class noSosDataScreen(Screen): - NAME = "NO_SOS_POPUP" - def __init__(self): - super().__init__() - self.meta = None - self.meta_type = "popup" - self.count = 0 - self.timer = osTimer() - - def initialization(self): - global no_sos_screen ,no_sos_screen_label - if no_sos_screen == None : - no_sos_screen = lv.obj() - print("NO_SOS_POPUP") - no_sos_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - # add style for watchface - no_sos_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) - #进入图片 - - no_sos_screen_label = lv.label(no_sos_screen) - no_sos_screen_label.set_pos(0, 40) - no_sos_screen_label.set_size(128, 80) - no_sos_screen_label.set_text("请在手机app上设\n置紧急联系人号码") - no_sos_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - no_sos_screen_label.set_long_mode(lv.label.LONG.WRAP) - no_sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + self.system_init_timer_count += 1 + if self.system_init_timer_count > 4: + self.system_init_timer_count = 1 + if system_init_screen != None: + system_init_label_str = "系统初始化中" + if self.system_init_timer_count == 1: + system_init_label.set_text("系统初始化中.") + elif self.system_init_timer_count == 2: + system_init_label.set_text("系统初始化中..") + elif self.system_init_timer_count == 3: + system_init_label.set_text("系统初始化中...") + else: + system_init_label.set_text("系统初始化中....") - self.meta = no_sos_screen - def post_processor_before_initialization(self): - self.count = 0 - self.timer.start(1000,1,self.timer_cb_onescond) - def Close(self): - self.timer.stop() - - def timer_cb_onescond(self,e): - EventMesh.publish("system_sleep_rest")#防止黑屏 - self.count+=1 - if self.count >= 10: - self.count = 0 - EventMesh.publish("return_prev_screen") - - - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") - pass - def done_right_to_left(self): - EventMesh.publish("return_prev_screen") - pass - def done_bottom_to_top(self): - EventMesh.publish("return_prev_screen") - pass - def done_top_to_bottom(self): - EventMesh.publish("return_prev_screen") - pass - def done_return(self): - EventMesh.publish("return_prev_screen") - pass - def done_click(self): - EventMesh.publish("return_prev_screen") - pass + self.system_init_timer.stop() - def btn8_press(self): - - pass - def btn1_press(self): - EventMesh.publish("return_prev_screen") - pass - def btn1_release(self): - EventMesh.publish("return_prev_screen") - pass -key_borad_screen = None -key_borad_screen_label = None +charge_in_screen = None +charge_in_screen_label = None -#键盘弹窗 -class keyboardScreen(Screen):#键盘弹窗 - NAME = "keyboard_popup" +#正在充电 +class chargeInScreen(Screen): + NAME = "charge_in" def __init__(self): super().__init__() self.meta = None @@ -6683,2144 +6097,156 @@ class keyboardScreen(Screen):#键盘弹窗 self.timer = osTimer() def initialization(self): - global key_borad_screen ,no_sos_screen_label - if key_borad_screen == None : - key_borad_screen = lv.obj() - print("keyboard_popup") - key_borad_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + global charge_in_screen ,charge_in_screen_label + if charge_in_screen == None : + charge_in_screen = lv.obj() + print("charge_in_screen") + charge_in_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) # add style for watchface - key_borad_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) + charge_in_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) #进入图片 - key_borad_screen_label = lv.label(key_borad_screen) - key_borad_screen_label.set_pos(0, 40) - key_borad_screen_label.set_size(128, 80) - key_borad_screen_label.set_text("如使用拨号盘,\n请在手机app上开启") - key_borad_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - key_borad_screen_label.set_long_mode(lv.label.LONG.WRAP) - key_borad_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - - self.meta = key_borad_screen - def post_processor_before_initialization(self): - self.count = 0 - self.timer.start(1000,1,self.timer_cb_onescond) - - def Close(self): - self.timer.stop() - - def timer_cb_onescond(self,e): - EventMesh.publish("system_sleep_rest")#防止黑屏 - self.count+=1 - if self.count >= 5: - self.count = 0 - EventMesh.publish("return_prev_screen") - - - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") - pass - def done_right_to_left(self): - EventMesh.publish("return_prev_screen") - pass - def done_bottom_to_top(self): - EventMesh.publish("return_prev_screen") - pass - def done_top_to_bottom(self): - EventMesh.publish("return_prev_screen") - pass - def done_return(self): - EventMesh.publish("return_prev_screen") - pass - def done_click(self): - EventMesh.publish("return_prev_screen") - pass - - def btn8_press(self): - - pass - def btn1_press(self): - EventMesh.publish("return_prev_screen") - pass - def btn1_release(self): - EventMesh.publish("return_prev_screen") - pass - -no_sim_auto_screen = None -no_sim_auto_screen_title = None -no_sim_auto_screen_label =None -no_sim_auto_screen_comfirm =None -no_sim_autor_screen_cancel = None -no_sim_auto_screen_img = None -no_sim_confirm_label = None - -#未插卡,长按关机 -class NoSimAutoScreen(Screen):#无sim卡是否关机 - NAME = "no_sim_auto_screen" - def __init__(self): - super().__init__() - self.meta = None - self.meta_type = "popup" - self.timer = osTimer() - self.count = 0 - - def initialization(self): - global no_sim_auto_screen,no_sim_confirm_label,no_sim_cancel_label,no_sim_auto_screen_img,no_sim_auto_screen_title,no_sim_auto_screen_comfirm,no_sim_auto_screen_cancel,no_sim_auto_screen_label - if no_sim_auto_screen == None : - no_sim_auto_screen = lv.obj() - print("no_sim_power_screen") - no_sim_auto_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - no_sim_auto_screen_title = lv.label(no_sim_auto_screen) - no_sim_auto_screen_title.set_pos(0, 5) - no_sim_auto_screen_title.set_size(128, 40) - no_sim_auto_screen_title.set_text("无SIM卡,无操作\n30s后自动关机") - no_sim_auto_screen_title.set_long_mode(lv.label.LONG.WRAP) - no_sim_auto_screen_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - no_sim_auto_screen_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - # no_sim_auto_screen_img = lv.img(no_sim_auto_screen) - # no_sim_auto_screen_img.set_pos(49, 40) - # no_sim_auto_screen_img.set_size(30, 30) - # no_sim_auto_screen_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # no_sim_auto_screen_img.set_src("E:/static/poweroff_icon.png") - - - no_sim_auto_screen_label = lv.label(no_sim_auto_screen) - no_sim_auto_screen_label.set_pos(0, 40) - no_sim_auto_screen_label.set_size(128, 20) - no_sim_auto_screen_label.set_text("是否关机?") - no_sim_auto_screen_label.set_long_mode(lv.label.LONG.WRAP) - no_sim_auto_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - no_sim_auto_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - - no_sim_auto_screen_comfirm = lv.img(no_sim_auto_screen) - no_sim_auto_screen_comfirm.set_size(88, 23) - no_sim_auto_screen_comfirm.set_pos(20, 64) - no_sim_auto_screen_comfirm.set_src("U:/static/off_icon.png") - no_sim_auto_screen_comfirm.add_flag(lv.obj.FLAG.CLICKABLE) - no_sim_auto_screen_comfirm.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - no_sim_confirm_label = lv.label(no_sim_auto_screen_comfirm) - no_sim_confirm_label.set_text("确定") - no_sim_confirm_label.align(lv.ALIGN.CENTER, 0, 0) - no_sim_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - - no_sim_auto_screen_cancel = lv.img(no_sim_auto_screen) - no_sim_auto_screen_cancel.set_size(88, 23) - no_sim_auto_screen_cancel.set_pos(20, 95) - no_sim_auto_screen_cancel.set_src("U:/static/cancel_icon.png") - no_sim_auto_screen_cancel.add_flag(lv.obj.FLAG.CLICKABLE) - no_sim_auto_screen_cancel.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - no_sim_cancel_label = lv.label(no_sim_auto_screen_cancel) - no_sim_cancel_label.set_text("取消") - no_sim_cancel_label.align(lv.ALIGN.CENTER, 0, 0) - no_sim_cancel_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - no_sim_auto_screen_cancel.set_ext_click_area(20) - - self.meta = no_sim_auto_screen - no_sim_auto_screen_comfirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), - lv.EVENT.CLICKED, None) - - no_sim_auto_screen_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.cancel(e)), - lv.EVENT.CLICKED, None) - self.timer.start(1*1000,1,self.fun) - self.count = 0 - def fun(self,*argc): - EventMesh.publish("system_sleep_rest")#防止黑屏 - self.count+=1 - if self.count > 30: - self.count = 0 - self.timer.stop() - EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) - - - def Close(self): - self.count = 0 - self.timer.stop() - - def confirm(self,e): - EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) - - def cancel(self,e): - EventMesh.publish("return_prev_screen") - - def done_return(self): - EventMesh.publish("return_prev_screen") - - def btn1_release(self): - EventMesh.publish("return_prev_screen") - - def btn8_press(self): - EventMesh.publish("return_prev_screen") - - -system_init_screen = None -system_init_label = None -class SystemInitScreen(Screen): - #系统初始化中... - NAME = "system_init" - - def __init__(self): - super().__init__() - self.meta = None - self.system_init_timer=osTimer() - self.system_init_timer_count = 0 - - def initialization(self): - global system_init_screen ,system_init_label - if system_init_screen == None: - system_init_screen = lv.obj() - print("Lowpower_screen") - system_init_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - system_init_label = lv.label(system_init_screen) - system_init_label.set_pos(0, 50) - system_init_label.set_size(128, 20) - system_init_label.set_text("系统初始化中") - system_init_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - system_init_label.set_long_mode(lv.label.LONG.WRAP) - system_init_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.meta = system_init_screen - self.system_init_timer_count = 0 - self.system_init_timer.start(1000, 1, self.system_init_timer_cb) - - def system_init_timer_cb(self, *args): - EventMesh.publish("system_sleep_rest")#防止黑屏 - self.system_init_timer_count += 1 - if self.system_init_timer_count > 4: - self.system_init_timer_count = 1 - if system_init_screen != None: - - system_init_label_str = "系统初始化中" - if self.system_init_timer_count == 1: - system_init_label.set_text("系统初始化中.") - elif self.system_init_timer_count == 2: - system_init_label.set_text("系统初始化中..") - elif self.system_init_timer_count == 3: - system_init_label.set_text("系统初始化中...") - else: - system_init_label.set_text("系统初始化中....") - - def Close(self): - self.system_init_timer.stop() - -style_font_youyuan_30 = lv.style_t() -style_font_youyuan_30.init() -style_font_youyuan_30.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF)) -style_font_youyuan_30.set_text_font(lv.K01_font_30_DIAL) - -class_mgr_popup_screen = None -class_mgr_popup_label = None -class_mgr_popup_time1_text = None -class classMgrPopupScreen(Screen):#上课禁用时间界面 - #上课禁用 - NAME = "class_time" - - def __init__(self): - super().__init__() - self.meta = None - self.timer = osTimer() - def initialization(self): - global class_mgr_popup_screen ,class_mgr_popup_label ,class_mgr_popup_time1_text - if class_mgr_popup_screen == None: - class_mgr_popup_screen = lv.obj() - print("Lowpower_screen") - class_mgr_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - class_mgr_popup_time1_text = lv.label(class_mgr_popup_screen) - class_mgr_popup_time1_text.set_pos(0, 15) - class_mgr_popup_time1_text.set_size(128, 71) - class_mgr_popup_time1_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - class_mgr_popup_time1_text.set_text(" ") - class_mgr_popup_time1_text.add_style(style_font_youyuan_30, lv.PART.MAIN|lv.STATE.DEFAULT) - - class_mgr_popup_label = lv.label(class_mgr_popup_screen) - class_mgr_popup_label.set_pos(0, 60) - class_mgr_popup_label.set_size(128, 50) - class_mgr_popup_label.set_text("现在是上课时间点,禁用手表功能") - class_mgr_popup_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - class_mgr_popup_label.set_long_mode(lv.label.LONG.WRAP) - class_mgr_popup_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.meta = class_mgr_popup_screen - - data = RTC().datetime() - hour = data[4] - min = data[5] - class_mgr_popup_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min))) - self.timer.start(1*1000,1,self.fun) - - def lcd_on(self): - self.timer.start(1*1000,1,self.fun) - - def lcd_off(self): - self.timer.stop() - - def fun(self,*argc): - global class_mgr_popup_time1_text - data = RTC().datetime() - hour = data[4] - min = data[5] - class_mgr_popup_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min))) - - - def btn1_release(self): - flag = EventMesh.publish("get_lcd_state") - if flag == 1: - EventMesh.publish(constants.EVENT.SYSTEM_SLEEP) - else: - EventMesh.publish(constants.EVENT.SYSTEM_UP) - - def btn8_press(self): - flag = EventMesh.publish("get_lcd_state") - if flag == 1: - EventMesh.publish(constants.EVENT.SYSTEM_SLEEP) - else: - EventMesh.publish(constants.EVENT.SYSTEM_UP) - - -camera_popup_screen = None -camera_popup_label = None -def camCapturecallback(result_list): - print("camCapturecallback",result_list) - if result_list[0] == 0:#保存成功 - file = str(result_list[1]) - tmp = file.split('/')[3] - tmp = tmp.split("_camera")[0] - time = int(tmp) - album_data = EventMesh.publish("get_camera_num") - album_data_tmp = {} - album_data_tmp["timeSec"] = time - album_data[time] = album_data_tmp - EventMesh.publish("set_camera_num",album_data) - pass - pass -dec = camera.camCapture(0,240,320,1,128,128) -dec.callback(camCapturecallback) - -camera_full_popup_screen = None -camera_full_label_popup_screen = None -class cameraFullScreen(Screen):#相册已满 - # - NAME = "camera_full" - - def __init__(self): - super().__init__() - self.meta = None - self.meta_type = "popup" - - - def initialization(self): - global camera_full_popup_screen ,camera_full_label_popup_screen - - - if camera_full_popup_screen == None: - camera_full_popup_screen = lv.obj() - print("camera_full") - camera_full_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - camera_full_label_popup_screen = lv.label(camera_full_popup_screen) - camera_full_label_popup_screen.set_pos(0, 50) - camera_full_label_popup_screen.set_size(128, 40) - camera_full_label_popup_screen.set_text("相册已满,删除即可拍照") - camera_full_label_popup_screen.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - camera_full_label_popup_screen.set_long_mode(lv.label.LONG.WRAP) - camera_full_label_popup_screen.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.meta = camera_full_popup_screen - - - def done_click(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - - def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - -class cameraScreen(Screen):#相机拍照二级界面 - # - NAME = "camera" - - def __init__(self): - super().__init__() - self.meta = None - self.preview1 = None - self.timer = osTimer() - self.timer2 =osTimer() - self.camera_num = 0 - - def initialization(self): - global camera_popup_screen ,camera_popup_label - - - if camera_popup_screen == None: - camera_popup_screen = lv.obj() - print("Lowpower_screen") - camera_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - camera_popup_label = lv.label(camera_popup_screen) - camera_popup_label.set_pos(0, 20) - camera_popup_label.set_size(128, 20) - camera_popup_label.set_text("点击屏幕保存") - camera_popup_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - camera_popup_label.set_long_mode(lv.label.LONG.WRAP) - camera_popup_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - self.meta = camera_popup_screen - album_data = EventMesh.publish("get_camera_num") - if len(album_data) >= 2:#相册已满 - EventMesh.publish("load_screen", {"screen": "camera_full"}) - pass - - state = dec.open() - self.timer.start(1*1000,1,self.fun) - print("state",state) - - def fun(self,*argc): - EventMesh.publish("system_sleep_rest")#防止黑屏 - - - - - def Close(self): - self.timer.stop() - state = dec.close() - - def done_click(self): - self.timer2.start(1*1000,0,self.save_album)#延迟1s保存图片 - pass - def save_album(self,*argc): - album_data = EventMesh.publish("get_camera_num") - if len(album_data) < 2: - date_tmp = utime.localtime() - time_tmp = utime.mktime(date_tmp) - dec.start(50,50, "U:/static/album/%d_camera"%(time_tmp)) - else: - EventMesh.publish("load_screen", {"screen": "camera_full"}) - - def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - - -camera_album_popup_screen = None -camera_album_popup_label = None -camera_album_popup_img = None -imgbt_contanier = None -camera_album_popup_img1 = None -camera_album_popup_img2 = None -camera_album_popup_img3 = None -camera_album_popup_img4 = None -camera_album_popup_img5 = None -class cameraalbumScreen(Screen):#相册 - # - NAME = "camera_album" - - def __init__(self): - super().__init__() - self.meta = None - - def initialization(self): - global camera_album_popup_screen ,camera_album_popup_label,camera_album_popup_img1,camera_album_popup_img2,camera_album_popup_img3,camera_album_popup_img4,camera_album_popup_img5 - - if camera_album_popup_screen == None: - camera_album_popup_screen = lv.obj() - print("camera_album_popup_screen") - camera_album_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - camera_album_popup_label = lv.label(camera_album_popup_screen) - camera_album_popup_label.set_pos(0, 5) - camera_album_popup_label.set_size(128, 20) - camera_album_popup_label.set_text("相册预览") - camera_album_popup_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - camera_album_popup_label.set_long_mode(lv.label.LONG.WRAP) - camera_album_popup_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - camera_album_popup_img1 = lv.img(camera_album_popup_screen) - camera_album_popup_img1.set_pos(5, 30) - camera_album_popup_img1.set_size(50, 50) - camera_album_popup_img1.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img1.add_flag(lv.obj.FLAG.CLICKABLE) - # camera_album_popup_img1.set_zoom(160) - camera_album_popup_img1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.click_album(e,0)), lv.EVENT.CLICKED, None) - - camera_album_popup_img2 = lv.img(camera_album_popup_screen) - camera_album_popup_img2.set_pos(65, 30) - camera_album_popup_img2.set_size(50, 50) - camera_album_popup_img2.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img2.add_flag(lv.obj.FLAG.CLICKABLE) - # camera_album_popup_img2.set_zoom(160) - camera_album_popup_img2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.click_album(e,1)), lv.EVENT.CLICKED, None) - - camera_album_popup_img3 = lv.img(camera_album_popup_screen) - camera_album_popup_img3.set_pos(5, 90) - camera_album_popup_img3.set_size(50, 50) - camera_album_popup_img3.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img3.add_flag(lv.obj.FLAG.CLICKABLE) - # camera_album_popup_img3.set_zoom(160) - camera_album_popup_img3.add_event_cb(lambda e: EventMesh.callback_wrapper(self.click_album(e,2)), lv.EVENT.CLICKED, None) - - camera_album_popup_img4 = lv.img(camera_album_popup_screen) - camera_album_popup_img4.set_pos(50, 90) - camera_album_popup_img4.set_size(65, 50) - camera_album_popup_img4.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img4.add_flag(lv.obj.FLAG.CLICKABLE) - # camera_album_popup_img4.set_zoom(160) - camera_album_popup_img4.add_event_cb(lambda e: EventMesh.callback_wrapper(self.click_album(e,3)), lv.EVENT.CLICKED, None) - - camera_album_popup_img5 = lv.img(camera_album_popup_screen) - camera_album_popup_img5.set_pos(5, 140) - camera_album_popup_img5.set_size(50, 50) - camera_album_popup_img5.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img5.add_flag(lv.obj.FLAG.CLICKABLE) - # camera_album_popup_img5.set_zoom(160) - camera_album_popup_img5.add_event_cb(lambda e: EventMesh.callback_wrapper(self.click_album(e,4)), lv.EVENT.CLICKED, None) - - self.meta = camera_album_popup_screen - read_album = {} - read_album = EventMesh.publish("get_camera_num") - sort_new = {} - sort_new = sorted(read_album.keys())#按照key的升序排序 - count = 0 - camera_album_popup_img1.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img2.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img3.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img4.add_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img5.add_flag(lv.obj.FLAG.HIDDEN) - - # print("sort_new read_album ",sort_new,read_album) - for i in range(0,len(sort_new)): - key = sort_new[i] - value = int(read_album[key]["timeSec"]) - print(value) - check_img = ql_fs.path_exists("/usr/static/album/%d_camera.jpg"%(value)) - if check_img == True :#图片存着 - print("图片存在显示") - pass - else: - print("图片不存在不显示循环下一个显示") - continue - - if count == 0: - camera_album_popup_img1.clear_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img1.set_src("U:/static/album/%d_camera.jpg"%(value)) #'U:/6_camera.jpeg' - pass - elif count == 1: - camera_album_popup_img2.clear_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img2.set_src("U:/static/album/%d_camera.jpg"%(value))#'U:/6_camera.jpeg' - pass - elif count == 2: - camera_album_popup_img3.clear_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img3.set_src("U:/static/album/%d_camera.jpg"%(value))#'U:/6_camera.jpeg' - pass - elif count == 3: - camera_album_popup_img4.clear_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img4.set_src("U:/static/album/%d_camera.jpg"%(value))#'U:/6_camera.jpeg' - pass - elif count == 4: - camera_album_popup_img5.clear_flag(lv.obj.FLAG.HIDDEN) - camera_album_popup_img5.set_src("U:/static/album/%d_camera.jpg"%(value))#'U:/6_camera.jpeg' - pass - count+=1 - - def click_album(self,e,i): - read_album = {} - read_album = EventMesh.publish("get_camera_num") - if len(read_album) != 0 and i < len(read_album): - sort_new = {} - sort_new = sorted(read_album.keys()) - key = sort_new[i] - value = int(read_album[key]["timeSec"]) - self.meta_info = value - print(self.meta_info,i) - EventMesh.publish("load_screen", {"screen": "album_preview","meta": self.meta_info})#点击进入相册预览大图显示 - print(i) - pass - - def Close(self): - pass - - def done_click(self): - - pass - - def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - -album_preview_popup_screen = None -album_preview_popup_img = None -album_preview_popup_delet_con_label = None -album_preview_popup_delet_con_label = None -album_preview_popup_delet_label = None -class albumPreviewScreen(Screen):#点击预览 - # - NAME = "album_preview" - - def __init__(self): - super().__init__() - self.meta = None - - def initialization(self): - global album_preview_popup_screen ,album_preview_popup_delet_label,album_preview_popup_img,album_preview_popup_delet_can_label,album_preview_popup_delet_con_label - - if album_preview_popup_screen == None: - album_preview_popup_screen = lv.obj() - print("album_preview_popup_screen") - album_preview_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - - album_preview_popup_img = lv.img(album_preview_popup_screen) - album_preview_popup_img.set_pos(39, 5) - album_preview_popup_img.set_size(50,50) - # album_preview_popup_img.set_zoom(400) - - album_preview_popup_delet_label = lv.label(album_preview_popup_screen) - album_preview_popup_delet_label.set_pos(0, 65) - album_preview_popup_delet_label.set_size(128, 20) - album_preview_popup_delet_label.set_text("是否删除") - album_preview_popup_delet_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - album_preview_popup_delet_label.set_long_mode(lv.label.LONG.WRAP) - album_preview_popup_delet_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - album_preview_popup_delet_con_label = lv.label(album_preview_popup_screen) - album_preview_popup_delet_con_label.set_pos(0, 95) - album_preview_popup_delet_con_label.set_size(64, 33) - album_preview_popup_delet_con_label.set_text("确定") - album_preview_popup_delet_con_label.add_flag(lv.obj.FLAG.CLICKABLE) - album_preview_popup_delet_con_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - album_preview_popup_delet_con_label.set_long_mode(lv.label.LONG.WRAP) - album_preview_popup_delet_con_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - - album_preview_popup_delet_can_label = lv.label(album_preview_popup_screen) - album_preview_popup_delet_can_label.set_pos(64, 95) - album_preview_popup_delet_can_label.set_size(64, 33) - album_preview_popup_delet_can_label.set_text("取消") - album_preview_popup_delet_can_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - album_preview_popup_delet_can_label.set_long_mode(lv.label.LONG.WRAP) - album_preview_popup_delet_can_label.add_flag(lv.obj.FLAG.CLICKABLE) - album_preview_popup_delet_can_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - self.meta = album_preview_popup_screen - album_num_tmp = None - album_num_tmp = int(self.meta_info) - print(album_num_tmp) - album_preview_popup_delet_can_label.add_event_cb(lambda e:EventMesh.callback_wrapper(self.cancel_pop(e)),lv.EVENT.CLICKED,None) - album_preview_popup_delet_con_label.add_event_cb(lambda e:EventMesh.callback_wrapper(self.confirm_pop(e)),lv.EVENT.CLICKED,None) - - album_preview_popup_img.set_src("U:/static/album/%d_camera.jpg"%(album_num_tmp))#'U:/6_camera.jpeg' - - def cancel_pop(self,e):#取消删除 - EventMesh.publish("load_screen", {"screen": "main_menu"})#点击回到相册界面 - pass - - def confirm_pop(self,e):#确认删除 - # album_num = int(self.meta_info.split(':')[1]) - album_num_tmp = None - album_num_tmp = int(self.meta_info) - print(album_num_tmp) - - check_img = ql_fs.path_exists("/usr/static/album/%d_camera.jpg"%(album_num_tmp)) - if check_img == True :#图片存在 - uos.remove("/usr/static/album/%d_camera.jpg"%(album_num_tmp))#删除单张图片 - read_album = {} - read_album = EventMesh.publish("get_camera_num")#删除的同时把数据部分也清掉 - print("img is exit1",read_album) - if read_album != {}: - key_tmp = album_num_tmp - del read_album[key_tmp]#删除内容 - EventMesh.publish("set_camera_num",read_album) - print("img is exit2",read_album) - pass - else:#图片不存在 - print("img is not exit") - pass - EventMesh.publish("load_screen", {"screen": "camera_album"})#点击回到相册界面 - pass - - def Close(self): - pass - - def done_click(self): - pass - - def done_return(self): - - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - -camera_video_screen = None -camera_video_label_screen = None -class cameraVdieoScreen(Screen):#视频通话 - #上课禁用 - NAME = "camera_video" - - def __init__(self): - super().__init__() - self.meta = None - self.preview1 = None - self.timer = osTimer() - self.open_preview1 = 0 - - def initialization(self): - global camera_video_screen,camera_video_label_screen - - if camera_video_screen == None: - camera_video_screen = lv.obj() - print("Lowpower_screen") - camera_video_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - camera_video_label_screen = lv.label(camera_video_screen) - camera_video_label_screen.set_pos(0, 40) - camera_video_label_screen.set_size(128, 40) - camera_video_label_screen.set_text(" ") - camera_video_label_screen.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - camera_video_label_screen.set_long_mode(lv.label.LONG.WRAP) - camera_video_label_screen.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - self.meta = camera_video_screen - - if EventMesh.publish(constants.EVENT.GET_CONNECT) != 0:#未联网提示关机 - self.preview1 = camera.camPreview(0,240,320,128,128,1) - state = self.preview1.open() - self.timer.start(1*1000,1,self.fun) - camera_video_label_screen.set_text(" ") - self.open_preview1 = 1 - else: - self.open_preview1 = 0 - camera_video_label_screen.set_text("无SIM卡或无网络") - - def fun(self,*argc): - EventMesh.publish("system_sleep_rest")#防止黑屏 - - - def Close(self): - if self.open_preview1 == 1: - self.timer.stop() - self.preview1.close() - - def done_click(self): - pass - - - - - def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - -style_screen_calendar_1_extra_header_main_default = lv.style_t() -style_screen_calendar_1_extra_header_main_default.init() -style_screen_calendar_1_extra_header_main_default.set_bg_color(lv.color_make(0x21,0x95,0xf6)) -style_screen_calendar_1_extra_header_main_default.set_bg_grad_color(lv.color_make(0x21,0x95,0xf6)) -style_screen_calendar_1_extra_header_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE) -style_screen_calendar_1_extra_header_main_default.set_bg_opa(255) -style_screen_calendar_1_extra_header_main_default.set_text_color(lv.color_make(0xff,0xff,0xff)) -style_screen_calendar_1_extra_header_main_default.set_text_font(lv.K01_font_16_ALL) - -style_screen_calendar_1_main_main_default = lv.style_t() -style_screen_calendar_1_main_main_default.init() -style_screen_calendar_1_main_main_default.set_radius(0) -style_screen_calendar_1_main_main_default.set_bg_color(lv.color_make(0xff,0xff,0xff)) -style_screen_calendar_1_main_main_default.set_bg_grad_color(lv.color_make(0xff,0xff,0xff)) -style_screen_calendar_1_main_main_default.set_bg_grad_dir(lv.GRAD_DIR.NONE) -style_screen_calendar_1_main_main_default.set_bg_opa(255) -style_screen_calendar_1_main_main_default.set_border_color(lv.color_make(0xc0,0xc0,0xc0)) -style_screen_calendar_1_main_main_default.set_border_width(1) -style_screen_calendar_1_main_main_default.set_border_opa(255) - -# add style for screen_calendar_1 - - - - -calendar_screen = None -calendar_label_screen = None -screen_calendar_1 = None -class calendar_Screen(Screen):#日历 - #上课禁用 - NAME = "calendar_screen" - - def __init__(self): - super().__init__() - self.meta = None - self.preview1 = None - self.timer = osTimer() - self.open_preview1 = 0 - - def initialization(self): - global calendar_screen,calendar_label_screen,screen_calendar_1 - data = RTC().datetime() - hour = data[4] - min = data[5] - - week = data[3] - - date1 = data[0] - date2 = data[1] - date3 = data[2] - highlighted_days=[lv.calendar_date_t({'year':date1, 'month':date2, 'day':date3})] - if calendar_screen == None: - calendar_screen = lv.obj() - print("calendar_screen") - calendar_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - screen_calendar_1 = lv.calendar(calendar_screen) - screen_calendar_1.set_pos(int(0),int(30)) - screen_calendar_1.set_size(240,260) - screen_calendar_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - screen_calendar_1.set_today_date(date1,date2,date3) - screen_calendar_1.set_showed_date(date1,date2) - screen_calendar_1.set_highlighted_dates(highlighted_days, len(highlighted_days)) - screen_calendar_1.add_style(style_screen_calendar_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT) - - screen_calendar_1_header = lv.calendar_header_arrow(screen_calendar_1) - screen_calendar_1_header.add_style(style_screen_calendar_1_extra_header_main_default, lv.PART.MAIN|lv.STATE.DEFAULT) - screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_day_names_items_default_event_cb(e)), lv.EVENT.DRAW_PART_BEGIN, None) - # screen_calendar_1.get_btnmatrix().add_event_cb(style_screen_calendar_1_extra_ctrl_day_names_items_default_event_cb, lv.EVENT.DRAW_PART_BEGIN, None) - screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_days_of_current_month_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None) - - screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_highlight_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None) - - screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_today_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None) - - screen_calendar_1.get_btnmatrix().add_event_cb(lambda e: EventMesh.callback_wrapper(self.style_screen_calendar_1_extra_ctrl_other_month_items_default_event_cb(e)),lv.EVENT.DRAW_PART_BEGIN,None) - - self.meta = calendar_screen - - - screen_calendar_1.set_today_date(date1,date2,date3) - screen_calendar_1.set_showed_date(date1,date2) - screen_calendar_1.set_highlighted_dates(highlighted_days, len(highlighted_days)) - - if EventMesh.publish(constants.EVENT.GET_CONNECT) != 0:#未联网提示关机 - self.preview1 = camera.camPreview(0,240,320,128,128,1) - state = self.preview1.open() - self.timer.start(1*1000,1,self.fun) - camera_video_label_screen.set_text(" ") - self.open_preview1 = 1 - else: - self.open_preview1 = 0 - - camera_video_label_screen.set_text("无SIM卡或无网络") - - - - def style_screen_calendar_1_extra_ctrl_days_of_current_month_items_default_event_cb(self,e): - obj = lv.btnmatrix.__cast__(e.get_target()) - dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) - if (dsc.id >= 7 - and not obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_1) - and not obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_2) - and not obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.DISABLED)): - dsc.rect_dsc.bg_color = lv.color_make(0x01,0xa2,0xb1) - - dsc.rect_dsc.bg_opa = 0 - dsc.rect_dsc.border_color = lv.color_make(0xc0,0xc0,0xc0) - dsc.rect_dsc.border_width = 1 - dsc.rect_dsc.border_opa = 255 - if dsc.label_dsc: - dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55) - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - dsc.label_dsc.font = lv.K01_font_16_ALL - - - - def style_screen_calendar_1_extra_ctrl_day_names_items_default_event_cb(self,e): - obj = lv.btnmatrix.__cast__(e.get_target()) - dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) - if dsc.id < 7: - - if dsc.label_dsc: - dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55) - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - dsc.label_dsc.font = lv.K01_font_16_ALL - - - def style_screen_calendar_1_extra_ctrl_highlight_items_default_event_cb(self,e): - obj = lv.btnmatrix.__cast__(e.get_target()) - dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) - if dsc.id >= 7 and obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_2): - dsc.rect_dsc.bg_color = lv.color_make(0x21,0x95,0xf6) - - dsc.rect_dsc.bg_opa = 255 - if dsc.label_dsc: - dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55) - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - dsc.label_dsc.font = lv.K01_font_16_ALL - - - def style_screen_calendar_1_extra_ctrl_today_items_default_event_cb(self,e): - obj = lv.btnmatrix.__cast__(e.get_target()) - dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) - if dsc.id >= 7 and obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.CUSTOM_1): - dsc.rect_dsc.bg_color = lv.color_make(0x01,0xa2,0xb1) - - dsc.rect_dsc.bg_opa = 255 - dsc.rect_dsc.border_color = lv.color_make(0xc0,0xc0,0xc0) - dsc.rect_dsc.border_width = 1 - dsc.rect_dsc.border_opa = 255 - if dsc.label_dsc: - dsc.label_dsc.color = lv.color_make(0x0D,0x30,0x55) - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - dsc.label_dsc.font = lv.K01_font_16_ALL - - - def style_screen_calendar_1_extra_ctrl_other_month_items_default_event_cb(self,e): - obj = lv.btnmatrix.__cast__(e.get_target()) - dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) - if dsc.id >= 7 and obj.has_btn_ctrl(dsc.id, lv.btnmatrix.CTRL.DISABLED): - dsc.rect_dsc.bg_color = lv.color_make(0x01,0xa2,0xb1) - - dsc.rect_dsc.bg_opa = 0 - if dsc.label_dsc: - dsc.label_dsc.color = lv.color_make(0xA9,0xA2,0xA2) - try: - lv.K01_font_16_ALL - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - try: - lv.font_montserrat_13 - dsc.label_dsc.font = lv.K01_font_16_ALL - except AttributeError: - dsc.label_dsc.font = lv.K01_font_16_ALL - - def fun(self,*argc): - EventMesh.publish("system_sleep_rest")#防止黑屏 - - - def Close(self): - if self.open_preview1 == 1: - self.timer.stop() - self.preview1.close() - - def done_click(self): - pass - - - - - def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - def btn8_press(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - pass - - - - -calculator_CALL_MAX_DATA = 16 - -calculator_line_points = [{"x":0,"y":0},{"x":0,"y":40}] -calculator_screen = None -calculator_line = None -calculator_label = None -calculator_one = None -calculator_two = None -calculator_three = None -calculator_four = None -calculator_five = None -calculator_six = None -calculator_seven = None -calculator_eight = None -calculator_nine = None -calculator_start = None -calculator_zero = None -calculator_hash = None -calculator_call = None -calculator_call_btn = None -calculator_contact = None -calculator_contact_btn = None -calculator_delete = None -calculator_delete_btn = None - -class calculatorScreen(Screen): - NAME = "calculator" - - def __init__(self): - - super().__init__() - self.meta = None - self.phone_num = '' - self.phone_list = [] - self.button = 0 - self.timer = osTimer() - self.timer_cb = 0 - self.count = 0 - - - - def initialization(self): - self.phone_num='' - self.phone_list = [] - global calculator_screen ,calculator_line,calculator_label,calculator_one,calculator_two,calculator_three,calculator_four,calculator_five,calculator_six,calculator_seven,calculator_eight,calculator_nine,calculator_start,\ - calculator_zero,calculator_hash,calculator_call,calculator_call_btn,calculator_contact,calculator_contact_btn,calculator_delete,calculator_delete_btn - - size_x = 36 #按钮大小 - size_y = 22 - start_x = 5 - start_y = 25 - - offset_y = 4 - if calculator_screen == None: - calculator_screen = lv.obj() - print("phone_screen") - calculator_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - # phone_line = lv.line(phone_screen) - # phone_line.set_points(phone_line_points,2) - # phone_line.set_pos(125,5) - # phone_line.set_size(2,18) - # phone_line.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - # phone_line.add_style(style_line,0) - calculator_label_screen = lv.obj(calculator_screen) - calculator_label_screen.set_pos(0,0) - calculator_label_screen.set_size(128,16) - calculator_label_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - print("phone_screen") - calculator_label_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - - - calculator_label = lv.label(calculator_label_screen) - calculator_label.set_pos(0, 0) - calculator_label.set_size(0, 20) - calculator_label.set_text(" ") - calculator_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) - - calculator_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - calculator_one = lv.img(calculator_screen) - calculator_one.set_src("U:/static/IMAGE_NUMBER_KEY1_ICON.png") - calculator_one.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_one.set_pos(start_x, start_y) - calculator_one.set_size(size_x, size_y) - - calculator_two = lv.img(calculator_screen) - calculator_two.set_size(size_x, size_y) - calculator_two.set_src("U:/static/IMAGE_NUMBER_KEY2_ICON.png") - calculator_two.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_two.set_pos(start_x+size_x+5*1, start_y) - - calculator_three = lv.img(calculator_screen) - calculator_three.set_size(size_x, size_y) - calculator_three.set_src("U:/static/IMAGE_NUMBER_KEY3_ICON.png") - calculator_three.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_three.set_pos(start_x+size_x*2+5*2, start_y) - - calculator_four = lv.img(calculator_screen) - calculator_four.set_size(size_x, size_y) - calculator_four.set_src("U:/static/IMAGE_NUMBER_KEY4_ICON.png") - calculator_four.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_four.set_pos(start_x, start_y+size_y+offset_y) - - calculator_five = lv.img(calculator_screen) - calculator_five.set_size(size_x, size_y) - calculator_five.set_src("U:/static/IMAGE_NUMBER_KEY5_ICON.png") - calculator_five.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_five.set_pos(start_x+size_x+5*1, start_y+size_y+offset_y) - - calculator_six = lv.img(calculator_screen) - calculator_six.set_size(size_x, size_y) - calculator_six.set_src("U:/static/IMAGE_NUMBER_KEY6_ICON.png") - calculator_six.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_six.set_pos(start_x+size_x*2+5*2, start_y+size_y+offset_y) - - calculator_seven = lv.img(calculator_screen) - calculator_seven.set_size(size_x, size_y) - calculator_seven.set_src("U:/static/IMAGE_NUMBER_KEY7_ICON.png") - calculator_seven.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_seven.set_pos(start_x, start_y+size_y*2+offset_y*2) - - calculator_eight = lv.img(calculator_screen) - calculator_eight.set_size(size_x, size_y) - calculator_eight.set_src("U:/static/IMAGE_NUMBER_KEY8_ICON.png") - calculator_eight.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_eight.set_pos(start_x+size_x+5*1, start_y+size_y*2+offset_y*2) - - calculator_nine = lv.img(calculator_screen) - calculator_nine.set_size(size_x, size_y) - calculator_nine.set_src("U:/static/IMAGE_NUMBER_KEY9_ICON.png") - calculator_nine.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_nine.set_pos(start_x+size_x*2+5*2, start_y+size_y*2+offset_y*2) - - # phone_start = lv.img(phone_screen) - # phone_start.set_size(size_x, size_y) - # phone_start.set_src("U:/static/IMAGE_NUMBER_KEYSTAR_ICON.png") - # phone_start.add_flag(lv.obj.FLAG.CLICKABLE) - # phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # phone_start.set_pos(start_x, start_y+size_y*3) - - # calculator_delete = lv.img(calculator_screen) - # calculator_delete.set_size(size_x, size_y) - # calculator_delete.set_src("U:/static/IMAGE_BUTTON_DELKEY.png") - # calculator_delete.add_flag(lv.obj.FLAG.CLICKABLE) - # calculator_delete.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # calculator_delete.set_pos(start_x, start_y+size_y*3+offset_y*3) - - calculator_delete = lv.label(calculator_screen) - calculator_delete.set_pos(start_x, start_y+size_y*3+offset_y*3) - calculator_delete.set_size(start_x+size_x+5*1-start_x, 128-(start_y+size_y*3+offset_y*3)) - calculator_delete.set_text("/") - calculator_delete.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_delete.set_long_mode(lv.label.LONG.CLIP) - calculator_delete.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_delete.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - - - - calculator_zero = lv.img(calculator_screen) - calculator_zero.set_size(size_x, size_y) - calculator_zero.set_src("U:/static/IMAGE_NUMBER_KEY0_ICON.png") - calculator_zero.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_zero.set_pos(start_x+size_x+5*1, start_y+size_y*3+offset_y*3) - - calculator_call = lv.label(calculator_screen) - calculator_call.set_pos(start_x+size_x*2+5*2, start_y+size_y*3+offset_y*3) - calculator_call.set_size(128-(start_x+size_x*2+5*2), 128-(start_y+size_y*3+offset_y*3)) - calculator_call.set_text("-") - calculator_call.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) - calculator_call.set_long_mode(lv.label.LONG.CLIP) - calculator_call.add_flag(lv.obj.FLAG.CLICKABLE) - calculator_call.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - # calculator_call = lv.img(calculator_screen) - # calculator_call.set_size(size_x, size_y) - # calculator_call.set_src("U:/static/IMAGE_BUTTON_DIAL.png") - # calculator_call.add_flag(lv.obj.FLAG.CLICKABLE) - # calculator_call.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - # calculator_call.set_pos(start_x+size_x*2+5*2, start_y+size_y*3+offset_y*3) - - - - self.meta = calculator_screen - - calculator_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.one(e)), - lv.EVENT.CLICKED, None) - calculator_two.add_event_cb(lambda e: EventMesh.callback_wrapper(self.two(e)), - lv.EVENT.CLICKED, None) - calculator_three.add_event_cb(lambda e: EventMesh.callback_wrapper(self.three(e)), - lv.EVENT.CLICKED, None) - calculator_four.add_event_cb(lambda e: EventMesh.callback_wrapper(self.four(e)), - lv.EVENT.CLICKED, None) - calculator_five.add_event_cb(lambda e: EventMesh.callback_wrapper(self.five(e)), - lv.EVENT.CLICKED, None) - calculator_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)), - lv.EVENT.CLICKED, None) - calculator_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - lv.EVENT.CLICKED, None) - - calculator_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), - lv.EVENT.LONG_PRESSED, None)#长按显示+ - - calculator_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.endpressed_start(e)), - lv.EVENT.RELEASED, None)#释放按键 - - calculator_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)), - lv.EVENT.CLICKED, None) - calculator_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - lv.EVENT.CLICKED, None) - - calculator_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), - lv.EVENT.LONG_PRESSED, None)#长按显示+ - - calculator_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine_endpressed_start(e)), - lv.EVENT.RELEASED, None)#释放按键 - - # phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)), - # lv.EVENT.CLICKED, None) - - calculator_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - lv.EVENT.CLICKED, None)#短按显示* - - calculator_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.pressed_start(e)), - lv.EVENT.LONG_PRESSED, None)#长按显示+ - - calculator_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero_endpressed_start(e)), - lv.EVENT.RELEASED, None)#释放按键 - - calculator_call.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)), - lv.EVENT.CLICKED, None) - # phone_contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.contact(e)), - # lv.EVENT.CLICKED, None) - calculator_delete.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delete(e)), - lv.EVENT.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) - - - self.phone_num='' - self.calcul_num='' - self.phone_list = [] - self.one_buf = '' - self.two_buf = '' - self.operator = '' - self.result_buf = ''#计算结果 - - - self.count = 0 - self.show_num() - if calculator_label != None: - calculator_label.set_pos(0, 0) - calculator_label.set_size(0, 0) - calculator_label.set_text(" ") - #phone_label.set_text(" ") - # print("self.phone_list :{} self.phone_num:{}".format(self.phone_list,self.phone_num)) - if self.timer_cb == 0: - self.timer_cb = 1 - # self.timer.start(1000,1,self.refresh_line) - - - def refresh_line(self,e): - return - if self.count > 2 : - self.count = 1 - if self.count%2 == 0: - phone_line.clear_flag(lv.obj.FLAG.HIDDEN) - else: - phone_line.add_flag(lv.obj.FLAG.HIDDEN) - self.count+=1 - def one(self,e): - self.input_num("1") - - def two(self,e): - self.input_num("2") - - def three(self,e): - self.input_num(".") - # self.input_num("3") - - def four(self,e): - self.input_num("4") - - def five(self,e): - self.input_num("5") - - def six(self,e): - self.input_num("6") - - def seven(self,e): - self.input_num("7") - - def eight(self,e): - self.input_num("8") - - def nine(self,e): - self.input_num("9") - - def zero(self,e): - self.input_num("0") - - def start(self,e): - self.button = 0 - - def pressed_start(self,e): - self.button = 1 - def Close(self): - self.timer_cb = 0 - self.timer.stop() - - def nine_endpressed_start(self,e): - - if self.button == 1:#长按 - self.input_char("=") - - else:#短按 - self.input_num("9") - - - - def zero_endpressed_start(self,e): - - if self.button == 1:#长按 - self.input_char("+") - else:#短按 - self.input_num("0") - - - - def endpressed_start(self,e): - if self.button == 1:#长按 - self.input_char("*") - else:#短按 - self.input_num("7") - - - def hash(self,e): - - self.calculator_fun("#") - - def is_all_zero(self,lst): - return all(element == 0 for element in lst) - - def input_num(self,msg):#输入数字 - if msg == 'delete': - if len(self.result_buf) == 0: - if self.one_buf != '': - if self.operator != '': - if self.two_buf != '': - self.phone_list = list(self.two_buf) - self.phone_list.pop() - self.two_buf = ''.join(self.phone_list) - print("two_buf!!!") - else: - self.phone_list = list(self.operator) - self.phone_list.pop() - self.operator = ''.join(self.phone_list) - print("self.operator!!!") - else: - self.phone_list = list(self.one_buf) - self.phone_list.pop() - self.one_buf = ''.join(self.phone_list) - print("self.one_buf!!!") - self.show_result()#显示计算结果以及输入结果 - return - global calculator_label - print("input_num",msg) - if len(self.result_buf) > 0: - self.result_buf = '' - self.two_buf = '' - self.one_buf = '' - - if self.one_buf == '':#第一个数字为空 - if msg == '.':#如果第一个数据为空并且输入的第一个数字是.就直接置0.开始 - self.one_buf = "0." - else: - self.one_buf = self.one_buf+msg - else: - if self.operator == '':#没有特殊字符 + - / * 一直会将数字添加到数字1中 否则添加到数字2中 - if self.one_buf.find('.') == -1: - if len(self.one_buf) <= 10 and len(self.one_buf) > 0:#第二个数据超过10个数据不让输入 0 - if len(self.one_buf) == 1 and self.one_buf == '0' and msg != '.': - self.one_buf = msg - else: - self.one_buf = self.one_buf+msg#还是第一个数据继续加 0 - pass - else: - if len(self.one_buf) > 10: - print("大于是10位数字") - pass - else: - if msg == '.': - self.one_buf = '0.' - else: - self.one_buf = self.one_buf+msg#还是第一个数据继续加 0 - pass - else: - if self.one_buf.find('.') != -1:#找到一个点如果还是点的话不让点 - if msg != '.': - if len(self.one_buf) <= 10: - self.one_buf = self.one_buf+msg#还是第一个数据继续加 0 - - else: - - if self.two_buf.find('.') == -1: - if len(self.two_buf) <= 10 and len(self.two_buf) > 0:#第二个数据超过10个数据不让输入 0 - if len(self.two_buf) == 1 and self.two_buf == '0' and msg != '.': - self.two_buf = msg - else: - self.two_buf = self.two_buf+msg#还是第一个数据继续加 0 - pass - else: - if len(self.two_buf) > 10: - pass - else: - if msg == '.': - self.two_buf = '0.' - else: - self.two_buf = self.two_buf+msg#还是第一个数据继续加 0 - pass - else: - if self.two_buf.find('.') != -1: - if msg != '.': - if len(self.two_buf) <= 10: - self.two_buf = self.two_buf+msg#还是第一个数据继续加 0 - - - self.show_result()#显示计算结果以及输入结果 - pass + charge_in_screen_label = lv.label(charge_in_screen) + charge_in_screen_label.set_pos(0, 170) + charge_in_screen_label.set_size(240, 20) + charge_in_screen_label.set_text(" ") + charge_in_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + charge_in_screen_label.set_long_mode(lv.label.LONG.WRAP) + charge_in_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - def input_char(self,msg):#输入字符 - - if self.one_buf != '': - if self.one_buf.find(".") != -1: - tmp = self.one_buf.split(".")[1] - if len(tmp) == 0: - self.one_buf = self.one_buf.split('.')[0] - if self.two_buf != '': - if self.two_buf.find(".") != -1: - tmp = self.two_buf.split(".")[1] - if len(tmp) == 0: - self.two_buf = self.two_buf.split('.')[0] - - global calculator_label - if len(self.two_buf) != 0 and float(self.two_buf) == 0:#0.000 - if self.operator == '/' and (msg == '/' or msg == '=' or msg == '*'or msg == '+' or msg =='-'):#如果第二个数据为0并且符号是除号就提示除数不为0 - print("除数不可以为0") - self.operator = '' - self.one_buf = '' - self.two_buf = '' - calculator_label.set_text("除数不可以为0") - return - else: - print("除数不为0") - self.show_result() - - self.result_buf = '' - print("input_char",msg) - if self.one_buf != '':#只有第一个数据不为空的时候才可以输入特殊字符 - if msg == "+":#加 - if self.one_buf != '': - if self.operator != '':#90 - print("operator") - if self.two_buf != '':#90+90 计算结果 -0.9 - - if self.one_buf.find('.') != -1: - if self.one_buf.find('e') == -1:#1.2e - if int(self.one_buf.split(".")[1]) == 0: - self.one_buf = self.one_buf.split('.')[0] - - if self.two_buf.find('.') != -1: - if self.two_buf.find('e') == -1:#1.2e - if int(self.two_buf.split('.')[1]) == 0: - self.two_buf = self.two_buf.split('.')[0] - - str_sum = '' - # if self.one_buf.find('e') != -1:#1.2e - # tmp1 = (self.one_buf.split('e')[0])#2.1717041952680391897126070275863e-15 - # tmp2 = (self.one_buf.split('e')[1]) - # if len(tmp2) > 0: - # self.result_buf = str(eval(tmp1 + "*"+"10**"+tmp2)) - # else: - # self.result_buf = str(eval(tmp1 + "*"+"10**"+"0")) - # pass - # pass - # else: - str_sum = (self.one_buf.split()[0])+self.operator+(self.two_buf.split()[0]) - self.result_buf = str(eval(str_sum)) - # pass - - print("str_sum",str_sum,self.result_buf) - if self.result_buf.find('e') == -1: - if self.result_buf.find('.') != -1:#有小数点 - print("input_dot",self.result_buf) - if int(self.result_buf.split(".")[1]) == 0:#小数点后面全是0 就取整数 - self.result_buf = (self.result_buf.split(".")[0]) - - if len(self.result_buf) > 14:#99978654.087766666 - tmp = str(self.result_buf[:14]) - self.result_buf = tmp - - self.one_buf = str(self.result_buf) - self.two_buf = '' - self.operator = '' - self.show_result()#显示计算结果以及输入结果 - else: - if self.operator != '+':#有+就不需要再显示+ - self.operator = msg#90 没有特殊字符则加上不计算结果 - if self.one_buf.split()[0] == 0:#如果数字是0.就显示0负数不在内 - self.one_buf = "0" - self.show_result()#显示计算结果以及输入结果 - else: - print("operator !!!!!") - self.operator = msg - self.show_result()#显示计算结果以及输入结果 - pass - elif msg == '-':#减 - if self.one_buf != '': - if self.operator != '':#90 - print("operator!!!!!!!!!!!!") - if self.two_buf != '':#90+90 计算结果 -0.9 - if self.one_buf.find('.') != -1: - if self.one_buf.find('e') == -1:#1.2e - if int(self.one_buf.split(".")[1]) == 0: - self.one_buf = self.one_buf.split('.')[0] - - if self.two_buf.find('.') != -1: - if self.two_buf.find('e') == -1:#1.2e - if int(self.two_buf.split('.')[1]) == 0: - self.two_buf = self.two_buf.split('.')[0] - str_sum = '' - # if self.one_buf.find('e') != -1:#1.2e - # tmp1 = (self.one_buf.split('e')[0])#2.1717041952680391897126070275863e-15 - # tmp2 = (self.one_buf.split('e')[1]) - # if len(tmp2) > 0: - # self.result_buf = str(eval(tmp1 + "*"+"10**"+tmp2)) - # else: - # self.result_buf = str(eval(tmp1 + "*"+"10**"+"0")) - # pass - # pass - # else: - str_sum = (self.one_buf.split()[0])+self.operator+(self.two_buf.split()[0]) - self.result_buf = str(eval(str_sum)) - - print("str_sum",str_sum,self.result_buf) - if self.result_buf.find('e') == -1: - if self.result_buf.find('.') != -1:#有小数点 - print("input_dot",self.result_buf) - if int(self.result_buf.split(".")[1]) == 0:#小数点后面全是0 就取整数 - self.result_buf = (self.result_buf.split(".")[0]) - - if len(self.result_buf) > 14:#99978654.087766666 - tmp = str(self.result_buf[:14]) - self.result_buf = tmp - - self.one_buf = str(self.result_buf) - self.two_buf = '' - self.operator = '' - self.show_result()#显示计算结果以及输入结果 - else: - if self.operator != '-':#有+就不需要再显示+ - self.operator = msg#90 没有特殊字符则加上不计算结果 - if self.one_buf.split()[0] == 0:#如果数字是0.就显示0负数不在内 - self.one_buf = "0" - self.show_result()#显示计算结果以及输入结果 - else: - print("operator ---------") - self.operator = msg - self.show_result()#显示计算结果以及输入结果 - pass - elif msg == '*':#乘 - if self.one_buf != '': - if self.operator != '':#90 - print("operator====***********") - if self.two_buf != '':#90+90 计算结果 -0.9 - if self.one_buf.find('.') != -1: - if self.one_buf.find('e') == -1:#1.2e - if int(self.one_buf.split(".")[1]) == 0: - self.one_buf = self.one_buf.split('.')[0] - - if self.two_buf.find('.') != -1: - if self.two_buf.find('e') == -1:#1.2e - if int(self.two_buf.split('.')[1]) == 0: - self.two_buf = self.two_buf.split('.')[0] - - str_sum = '' - # if self.one_buf.find('e') != -1:#1.2e - # tmp1 = (self.one_buf.split('e')[0])#2.1717041952680391897126070275863e-15 - # tmp2 = (self.one_buf.split('e')[1]) - # if len(tmp2) > 0: - # self.result_buf = str(eval(tmp1 + "*"+"10**"+tmp2)) - # else: - # self.result_buf = str(eval(tmp1 + "*"+"10**"+"0")) - # pass - # pass - # else: - str_sum = (self.one_buf.split()[0])+self.operator+(self.two_buf.split()[0]) - self.result_buf = str(eval(str_sum)) - # pass - - print("str_sum",str_sum,self.result_buf) - if self.result_buf.find('e') == -1:#有e - if self.result_buf.find('.') != -1:#有小数点 - print("input_dot",self.result_buf) - if int(self.result_buf.split(".")[1]) == 0:#小数点后面全是0 就取整数 - self.result_buf = (self.result_buf.split(".")[0]) - - if len(self.result_buf) > 14:#99978654.087766666 - tmp = str(self.result_buf[:14]) - self.result_buf = tmp - - self.one_buf = str(self.result_buf) - self.two_buf = '' - self.operator = '' - self.show_result()#显示计算结果以及输入结果 - else: - if self.operator != '*':#有+就不需要再显示+ - self.operator = msg#90 没有特殊字符则加上不计算结果 - if self.one_buf.split()[0] == 0:#如果数字是0.就显示0负数不在内 - self.one_buf = "0" - self.show_result()#显示计算结果以及输入结果 - else: - print("operator **********") - self.operator = msg - self.show_result()#显示计算结果以及输入结果 - pass - - elif msg == '/':#除 - if self.one_buf != '': - if self.operator != '':#90 - print("operator ==== //////////",self.two_buf) - if self.two_buf != '':#90+90 计算结果 -0.9 - if float(self.two_buf) != 0: - if self.one_buf.find('.') != -1: - if self.one_buf.find('e') == -1:#1.2e - if int(self.one_buf.split(".")[1]) == 0: - self.one_buf = self.one_buf.split('.')[0] - - if self.two_buf.find('.') != -1: - if self.two_buf.find('e') == -1:#1.2e - if int(self.two_buf.split('.')[1]) == 0: - self.two_buf = self.two_buf.split('.')[0] - - str_sum = '' - # if self.one_buf.find('e') != -1:#1.2e - - # tmp = (self.one_buf.split('e')[0]) - - # str_sum = tmp + self.operator + self.two_buf - # self.result_buf = str(eval(str_sum))+'e' - # pass - # else: - str_sum = (self.one_buf.split()[0])+self.operator+(self.two_buf.split()[0]) - self.result_buf = str(eval(str_sum)) - # pass - - print("str_sum",str_sum,self.result_buf) - if self.result_buf.find('e') == -1:#有小数点 - if self.result_buf.find('.') != -1:#有小数点 - print("input_dot",self.result_buf) - if int(self.result_buf.split(".")[1]) == 0:#小数点后面全是0 就取整数 - self.result_buf = (self.result_buf.split(".")[0]) - - # if len(self.result_buf) > 14:#99978654.087766666 - # tmp = str(self.result_buf[:14]) - # self.result_buf = tmp - - self.one_buf = str(self.result_buf) - self.two_buf = '' - self.operator = '' - self.show_result()#显示计算结果以及输入结果 - else: - print("除数不为0") - else: - if self.operator != '/':#有+就不需要再显示+ - self.operator = msg#90 没有特殊字符则加上不计算结果 - if self.one_buf.split()[0] == 0:#如果数字是0.就显示0负数不在内 - self.one_buf = "0" - self.show_result()#显示计算结果以及输入结果 - else: - print("operator ////////////////////") - self.operator = msg - self.show_result()#显示计算结果以及输入结果 - pass - - pass - - elif msg == '=':#等于 - if self.one_buf != '': - if self.operator != '': - print("operator ===========") - if self.two_buf != '':#90+90 计算结果 -0.9 - if float(self.two_buf) != 0: - if self.one_buf.find('.') != -1: - if self.one_buf.find('e') == -1:#1.2e - if int(self.one_buf.split(".")[1]) == 0: - self.one_buf = self.one_buf.split('.')[0] - - if self.two_buf.find('.') != -1: - if self.two_buf.find('e') == -1:#1.2e - if int(self.two_buf.split('.')[1]) == 0: - self.two_buf = self.two_buf.split('.')[0] - - str_sum = '' - # if self.one_buf.find('e') != -1:#1.2e - # tmp = (self.one_buf.split('e')[0]) - # str_sum = tmp + self.operator + self.two_buf - # self.result_buf = str(eval(str_sum))+'e' - # pass - # else: - str_sum = (self.one_buf.split()[0])+self.operator+(self.two_buf.split()[0]) - self.result_buf = str(eval(str_sum)) - # pass - - print("str_sum",str_sum,self.result_buf) - if self.result_buf.find('e') == -1:#有小数点 - if self.result_buf.find('.') != -1:#有小数点 - print("input_dot",self.result_buf) - if int(self.result_buf.split(".")[1]) == 0:#小数点后面全是0 就取整数 - self.result_buf = (self.result_buf.split(".")[0]) - - if len(self.result_buf) > 14:#99978654.087766666 - tmp = str(self.result_buf[:14]) - self.result_buf = tmp - - self.one_buf = str(self.result_buf) - self.two_buf = '' - self.operator = '' - self.show_result()#显示计算结果以及输入结果 - else: - if self.operator != '=':#有=就不需要再显示+ 90 - self.operator = '' #90 没有特殊字符则加上不计算结果 - self.two_buf = '' - self.show_result()#显示计算结果以及输入结果 + self.meta = charge_in_screen - pass - else: - self.operator = '' - self.two_buf = '' - self.show_result()#显示计算结果以及输入结果 只显示第一个数据的内容 - - pass - else: - #无效的数据 - pass - + def post_processor_after_initialization(self): + global charge_in_screen_label + self.count = 0 + self.timer.start(1000,1,self.timer_cb_onescond) + charge_in_screen_label.set_text("正在充电") - def show_result(self): - print("self.one_buf ",self.one_buf,self.two_buf,self.operator) - global calculator_label - tmp = str(self.one_buf)+str(self.operator)+str(self.two_buf) - label_size = len(tmp)*16 - calculator_label.set_pos(0, 0) - calculator_label.set_size(128, 16) - calculator_label.set_text(tmp) - - def calculator_fun(self,msg): - result = 0 - if len(self.phone_num) >= calculator_CALL_MAX_DATA:#限制拨号数量20个数字 - #self.phone_list.pop(0) - return - if len(self.phone_num) != 0: - if len(self.calcul_num) > 0: - self.calcul_num = '' - if msg == "+" or msg == '-' or msg == 'X' or msg == '/':#如果是计算完结果再按特殊字符就让他继续加 - print("不包含特殊字符1") - - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - else:# - print("不包含特殊字符2",msg) - if msg == '=': - self.show_num() - else: - - self.phone_num = '' - self.phone_list = [] - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() + def Close(self): + self.timer.stop() - else: - + def timer_cb_onescond(self,e): + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.count+=1 + if self.count >= 5: + self.count = 0 + EventMesh.publish("return_prev_screen") - if self.phone_num.find('/') != -1 or self.phone_num.find('+') != -1 or self.phone_num.find('x') != -1 or self.phone_num.find('-') != -1: - - - tmp_2 = '' - tmp_3 = '' - state1 = 0 - state2 = 0 - state3 = 0 - tmp_1 = '' - tmp = '' - data1 = 0 - data2 = 0 - - if self.phone_num.find('+') != -1:#加运算 - if (self.phone_num.split('+')[0]).find('.') == -1:#还没有输入小数点 0.00 - tmp = self.phone_num.split('+')[0] - tmp = float(tmp.split()[0]) - - - - pass - - data1 = float(self.phone_num.split('+')[0]) - - if len(self.phone_num.split('+')[1]) > 0 and (msg == '+' or msg =='='):#计算结果 - # tmp = self.phone_num.split('+')[0] - # data1 = float(tmp.split()[0]) - # tmp2 = self.phone_num.split('+')[1] - # data2 = float(tmp2.split()[0]) - # if self.phone_num.split('+')[0].find('.') == -1: - # if int(data2) == 0: - # data1 = int(data1) - - # if self.phone_num.split('+')[1].find('.') == -1: - # if int(data2) == 0: - # data2 = int(data2) - if self.phone_num.find('e') != -1: - if (self.phone_num.split('+')[0]).split('e') != -1 or (self.phone_num.split('+')[1]).split('e') != -1: - if (self.phone_num.split('+')[0]).split('e') != -1 and (self.phone_num.split('+')[1]).split('e') != -1: - self.phone_num = "2.71828182+2.71828182" - elif (self.phone_num.split('+')[0]).split('e') != -1: - self.phone_num = self.phone_num.split('+')[0] +"2.71828182" - elif (self.phone_num.split('+')[1]).split('e') != -1: - self.phone_num = "2.71828182"+ self.phone_num.split('+')[1] - - sum = eval(self.phone_num) - - result = sum - print("data1",data1,data2,result,sum) - self.calcul_num = str(result) - self.calaulator_results() - - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - print("加数====",result) - else: - if msg == '-' or msg == '/' or msg == 'X': - self.phone_list.pop() - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - print("减数") - else: - if msg != '=' and msg != '+': - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - else: - result = data1 - result_tmp = str(result) - if result_tmp.find('.') != -1: - tmp_zero = int(result_tmp.split('.')[1]) - if tmp_zero == 0: - result = result_tmp.split('.')[0] - print("data1!!!!!!!!!!",data1,data2,result) - self.calcul_num = str(result) - self.calaulator_results() - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - print("减数") - print("加数") - - if self.phone_num.find('-') != -1:#减运算 - data1 = float(self.phone_num.split('-')[0]) - if len(self.phone_num.split('-')[1]) > 0 and (msg == '-' or msg =='='):#计算结果 - data2 = float(self.phone_num.split('-')[1]) - # if self.phone_num.split('-')[0].find('.') == -1: - # if int(data1) == 0: - # data1 = int(data1) - - # if self.phone_num.split('-')[1].find('.') == -1: - # if int(data2.slpit('.')[1]) == 0: - # data2 = int(data2) - result = data1-data2 - print("data1222222222222",data1,data2,result) - self.calcul_num = str(result) - self.calaulator_results() - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - else: - if msg == '+' or msg == '/' or msg == 'X': - self.phone_list.pop() - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - print("减数") - else: - if msg != '=' and msg != '-': - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - else: - # if self.phone_num.split('-')[1].find('.') == -1: - # if int(data1.slpit('.')[1]) == 0: - # data1 = int(data1) - result = data1 - result_tmp = str(result) - if result_tmp.find('.') != -1: - tmp_zero = int(result_tmp.split('.')[1]) - if tmp_zero == 0: - result = result_tmp.split('.')[0] - print("data333333",data1) - self.calcul_num = str(result) - self.calaulator_results() - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + pass + def done_right_to_left(self): + EventMesh.publish("return_prev_screen") + pass + def done_bottom_to_top(self): + EventMesh.publish("return_prev_screen") + pass + def done_top_to_bottom(self): + EventMesh.publish("return_prev_screen") + pass + def done_return(self): + EventMesh.publish("return_prev_screen") + pass + def done_click(self): + EventMesh.publish("return_prev_screen") + pass - if self.phone_num.find('X') != -1:#乘运算 - data1 = float(self.phone_num.split('X')[0]) - if len(self.phone_num.split('X')[1]) > 0 and (msg == 'X' or msg =='='):#计算结果 - - data2 = float(self.phone_num.split('X')[1]) - # if self.phone_num.split('X')[0].find('.') == -1: - # if int(data1.slpit('.')[1]) == 0: - # data1 = int(data1) - - # if self.phone_num.split('X')[1].find('.') == -1: - # if int(self.phone_num.split('X')[1].find('.').slpit('.')[1]) == 0: - # data2 = int(data2) - - result = data1*data2 - print("data44444",data1,data2) - self.calcul_num = str(result) - self.calaulator_results() - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - print("乘数====",result) - else: - if msg == '+' or msg == '/' or msg == '-': - self.phone_list.pop() - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - print("乘数") - else: - if msg != '=' and msg != 'X': - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - else: - # if self.phone_num.split('X')[0].find('.') == -1: - # if (self.phone_num.split('X')[1].find('.') == -1:) - result = data1 - result_tmp = str(result) - if result_tmp.find('.') != -1: - tmp_zero = int(result_tmp.split('.')[1]) - if tmp_zero == 0: - result = result_tmp.split('.')[0] - print("data5555555",data1,data2) - self.calcul_num = str(result) - self.calaulator_results() - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - - - if self.phone_num.find('/') != -1:#除运算 - - tmp = self.phone_num.split('/')[0] - tmp_1 = self.phone_num.split('/')[1] - if len(tmp_1) > 0 and (msg == '/' or msg == '='): - if tmp_1.find('.') != -1: - state1 = int(tmp_1.split('.')[0])#0.009 10:00 - state2 = int(tmp_1.split('.')[1])#0.009 + def btn8_press(self): + EventMesh.publish("return_prev_screen") + pass + def btn1_press(self): + EventMesh.publish("return_prev_screen") + pass + def btn1_release(self): + EventMesh.publish("return_prev_screen") + pass - else: - state1 = int(tmp_1) #10 - print("state3",state1,state2,state3,tmp_1) - if (state1 == 0 and state2 == 0): - print("除数不可以为0") - else: - data1 = float(self.phone_num.split('/')[0]) - data2 = 0 - # if data1.find('.') == -1: - # if int(data1.slpit('.')[1]) == 0: - # data1 = int(data1) - - # if data2.find('.') == -1: - # if int(data2.slpit('.')[1]) == 0: - # data2 = int(data2) - - if len(self.phone_num.split('/')[1]) > 0: - data2 = float(self.phone_num.split('/')[1]) - if data2 != 0: - result = data1/data2 - else: - result = data1 - print("data6666666",data1,data2) - - result_tmp = str(result) - if result_tmp.find('.') != -1: - tmp_zero = int(result_tmp.split('.')[1]) - if tmp_zero == 0: - result = result_tmp.split('.')[0] - else: - pass - self.calcul_num = str(result) - self.calaulator_results() - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - else: - if msg == '+' or msg == 'X' or msg == '-': - self.phone_list.pop() - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - print("减数") - else: - if msg != '=' and msg != '/': - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - else: - result = float(tmp) - self.calcul_num = str(result) - print("data7777777777",result) - self.calaulator_results() - self.phone_num = self.calcul_num - self.phone_list = list(self.phone_num) - print("除数没有数字") - else: - +charge_out_screen = None +charge_out_screen_label = None - if msg == '=': - self.show_num() - pass - else: - if msg == "+" and msg == '-' and msg == 'X' and msg == '/':#如果是计算完结果再按特殊字符就让他继续加 - print("不包含特殊字符") - self.calcul_num = '' - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - elif msg == ".": - if self.phone_num.find('.') == -1:#还没有输入小数点 - self.phone_num = '0.' - self.phone_list = list(self.phone_num) - self.show_num() - pass - else:# - print("不包含特殊字符") - if len(self.calcul_num) > 0:#表示已计算了一次结果 全部置0 - self.phone_num = '' - self.phone_list = [] - self.calcul_num = '' - - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() +#充电已移出 +class chargeOutScreen(Screen): + NAME = "charge_out" + def __init__(self): + super().__init__() + self.meta = None + self.meta_type = "popup" + self.count = 0 + self.timer = osTimer() - else: - if msg != "+" and msg != '-' and msg != 'X' and msg != '/': - print("数组为0时") - self.phone_list.append(msg) - self.phone_num = ''.join(self.phone_list) - self.show_num() - pass - def delete(self,e): - self.input_char("/") - # if len(self.phone_list) != 0: - # self.phone_list.pop() - # self.phone_num = ''.join(self.phone_list) - # self.show_num() + def initialization(self): + global charge_out_screen ,charge_out_screen_label + if charge_out_screen == None : + charge_out_screen = lv.obj() + print("charge_out_screen") + charge_out_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # add style for watchface + charge_out_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) + #进入图片 - def contact(self,e): - EventMesh.publish("load_screen", {"screen": "contacts"}) + charge_out_screen_label = lv.label(charge_out_screen) + charge_out_screen_label.set_pos(0, 170) + charge_out_screen_label.set_size(240, 20) + charge_out_screen_label.set_text(" ") + charge_out_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + charge_out_screen_label.set_long_mode(lv.label.LONG.WRAP) + charge_out_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - def call(self,e): - self.input_char("-") - def show_num(self): - print("self.phone_num ",self.phone_num,self.phone_list) - pass - # global calculator_label - # calculator_label.set_pos(0, 5) - # calculator_label.set_size(128, 20) - # calculator_label.set_text(self.phone_num) + self.meta = charge_out_screen + + - def calaulator_results(self):#计算结果显示 - pass + def post_processor_after_initialization(self): + global charge_out_screen_label + self.count = 0 + self.timer.start(1000,1,self.timer_cb_onescond) + charge_out_screen_label.set_text("充电已移出") + def Close(self): + self.timer.stop() - def lcd_on(self): - if self.timer_cb != 0: - self.timer_cb = 0 - self.timer.start(1000,1,self.refresh_line) - - def lcd_off(self): - self.timer_cb = 1 - self.timer.stop() + def timer_cb_onescond(self,e): + EventMesh.publish("system_sleep_rest")#防止黑屏 + self.count+=1 + if self.count >= 5: + self.count = 0 + EventMesh.publish("return_prev_screen") + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + pass + def done_right_to_left(self): + EventMesh.publish("return_prev_screen") + pass + def done_bottom_to_top(self): + EventMesh.publish("return_prev_screen") + pass + def done_top_to_bottom(self): + EventMesh.publish("return_prev_screen") + pass def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("return_prev_screen") + pass + def done_click(self): + EventMesh.publish("return_prev_screen") + pass def btn8_press(self): - EventMesh.publish("watch_top_show") - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - + EventMesh.publish("return_prev_screen") + pass + def btn1_press(self): + EventMesh.publish("return_prev_screen") + pass + def btn1_release(self): + EventMesh.publish("return_prev_screen") + pass rrestor_confirm_n_screen = None rrestor_confirm_n_screen_label = None @@ -8846,8 +6272,8 @@ class restore_confirmScreen(Screen): #进入图片 rrestor_confirm_n_screen_label = lv.label(rrestor_confirm_n_screen) - rrestor_confirm_n_screen_label.set_pos(0, 40) - rrestor_confirm_n_screen_label.set_size(128, 60) + rrestor_confirm_n_screen_label.set_pos(0, 150) + rrestor_confirm_n_screen_label.set_size(240, 60) rrestor_confirm_n_screen_label.set_text("正在恢复出厂中\n请稍等...") rrestor_confirm_n_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) rrestor_confirm_n_screen_label.set_long_mode(lv.label.LONG.WRAP) @@ -8862,7 +6288,7 @@ class restore_confirmScreen(Screen): if ret == True: ql_fs.rmdirs("/ext/static/storage_file") ql_fs.mkdirs("/ext/static/storage_file") - + EventMesh.publish("alipay_unbind") if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#已连接服务器发指令恢复出厂 EventMesh.publish(constants.PROTOCOL.DLT_SEND) self.timer2.start(4000,0,self.timer_cb_threescond) @@ -8900,9 +6326,97 @@ class restore_confirmScreen(Screen): def btn1_release(self): pass +style_font_youyuan_70_red = lv.style_t() +style_font_youyuan_70_red.init() +style_font_youyuan_70_red.set_text_color(lv.color_make(0xff, 0xff, 0xff)) +style_font_youyuan_70_red.set_text_font(lv.font_70_bold) + +class_mgr_popup_screen = None +class_mgr_popup_label = None +class_mgr_popup_time1_text = None +class classMgrPopupScreen(Screen):#上课禁用时间界面 + #上课禁用 + NAME = "class_time" + + def __init__(self): + super().__init__() + self.meta = None + self.timer = osTimer() + def initialization(self): + global class_mgr_popup_screen ,class_mgr_popup_label ,class_mgr_popup_time1_text + if class_mgr_popup_screen == None: + class_mgr_popup_screen = lv.obj() + print("Lowpower_screen") + class_mgr_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + + class_mgr_popup_time1_text = lv.label(class_mgr_popup_screen) + class_mgr_popup_time1_text.set_pos(0, 10) + class_mgr_popup_time1_text.set_size(240, 80) + class_mgr_popup_time1_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + class_mgr_popup_time1_text.set_text(" ") + class_mgr_popup_time1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT) + + class_mgr_popup_label = lv.label(class_mgr_popup_screen) + class_mgr_popup_label.set_pos(0, 120) + class_mgr_popup_label.set_size(240, 50) + class_mgr_popup_label.set_text("现在是上课时间点,禁用手表功能") + class_mgr_popup_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) + class_mgr_popup_label.set_long_mode(lv.label.LONG.WRAP) + class_mgr_popup_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + self.meta = class_mgr_popup_screen + + sos_flag = EventMesh.publish("get_sos_flag") + if sos_flag == 1: + EventMesh.publish("set_sos_flag",0) + EventMesh.publish("set_sos_num",0) + EventMesh.publish("set_hangup_mode",0) + data = RTC().datetime() + hour = data[4] + min = data[5] + class_mgr_popup_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min))) + self.timer.start(1*1000,1,self.fun) + + def lcd_on(self): + self.timer.start(1*1000,1,self.fun) + + def lcd_off(self): + self.timer.stop() + + def fun(self,*argc): + global class_mgr_popup_time1_text + data = RTC().datetime() + hour = data[4] + min = data[5] + class_mgr_popup_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min))) + + def btn1_release(self): + state = EventMesh.publish("get_cur_class_time_state") + print("state:{}".format(state)) + if state != None: + if state == 0: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + return + flag = EventMesh.publish("get_lcd_state") + if flag == 1: + EventMesh.publish(constants.EVENT.SYSTEM_SLEEP) + else: + EventMesh.publish(constants.EVENT.SYSTEM_UP) + + def btn8_press(self): + state = EventMesh.publish("get_cur_class_time_state") + print("state:{}".format(state)) + if state != None: + if state == 0: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + return + flag = EventMesh.publish("get_lcd_state") + if flag == 1: + EventMesh.publish(constants.EVENT.SYSTEM_SLEEP) + else: + EventMesh.publish(constants.EVENT.SYSTEM_UP) -#from ui_WatchFaceScreen import WatchFaceScreen +#from usr.ui_WatchFaceScreen import WatchFaceScreen class UI(object): def __init__(self): #self.screen = WatchFaceScreen() @@ -8919,19 +6433,19 @@ class UI(object): self.system_sleep_timer = osTimer() self.system_sleep_timer_count = 0 self.sleep_flag = 1 + self.level = 6 self.aud = audio.Audio(0) - self.aud.set_pa(Pin.GPIO29) - self.level = 2 + self.main_flag = 0 self.main_id = 0 self.set_interrup_flag = 0 self.UI_high_priority_flag = 0 #如果=1,则当前ui不被打断 self.level = EventMesh.publish("get_storage_config","brightness_level") - print("self.level:{}".format(self.level)) - + + if self.level == None: - self.level = 2 - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, self.level*100, 1000) + self.level = 6 + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10) self.PWM_backlight.open() self.sleep_lock = 0 @@ -8953,8 +6467,6 @@ class UI(object): EventMesh.subscribe("done_click", self.ui_press) EventMesh.subscribe("done_error", self.ui_press) EventMesh.subscribe("done_press", self.ui_press) - EventMesh.subscribe("done_DOWN", self.ui_press) - EventMesh.subscribe("done_UP", self.ui_press) EventMesh.subscribe("call_in", self.publish_call_in) EventMesh.subscribe("get_lcd_state", self.get_lcd_state) @@ -8989,13 +6501,13 @@ class UI(object): try: data["func"](data["data"]) except Exception as e: + usys.print_exception(e) print("ui_queue_thread:ERROR:{}".format(e)) # for scr in self.screen_list: # if scr.handle_message_event(data) == 1 : # break def return_prev_screen(self, event, msg): if self.screen_prev != None: - # print("return_prev_screen",self.screen_prev) EventMesh.publish("load_screen", {"screen": self.screen_prev.NAME}) def set_interrup_incall(self, event, msg): @@ -9039,11 +6551,6 @@ class UI(object): self.screen.done_return() if event == "done_click": self.screen.done_click() - if event == "done_DOWN": - self.screen.done_DOWN() - if event == "done_UP": - self.screen.done_UP() - # if event == "done_press": # self.system_sleep_timeout_rest() def btn_press(self, event, key): @@ -9133,15 +6640,15 @@ class UI(object): utime.sleep_ms(60) self.level = EventMesh.publish("get_brightness_level") if self.level == None: - self.level = 6 + self.level = 6 elif self.level > 10: self.level = 10 elif self.level <= 0: self.level = 1 - # print("__lcd_on self.level:",self.level) - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, self.level*100, 1000) + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10) self.PWM_backlight.open() self.sleep_lock = 0 + def publish_call_in(self, event, msg): EventMesh.publish("load_screen", {"screen": "dialing", "meta": msg}) @@ -9155,7 +6662,7 @@ class UI(object): utime.sleep_ms(200) self.sleep_lock = 1 self.sleep_flag = 0 - self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_10US, 0, 1000) + self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 0, 1) self.PWM_backlight.open() #lcd_ctrl.write(0) # @@ -9197,7 +6704,10 @@ class UI(object): pass def add_screen(self, screen): - self.screen_list.append(screen) + try: + self.screen_list.append(screen) + except Exception as e: + usys.print_exception(e) return self def get_screen_NAME(self, event, msg): @@ -9208,19 +6718,28 @@ class UI(object): def load_screen(self, msg): print("msg1={} self.UI_high_priority_flag:{}".format(msg,self.UI_high_priority_flag)) + if self.UI_high_priority_flag == 1:#电话界面屏蔽其他界面 + return state = EventMesh.publish("get_cur_class_time_state") + print("state:{}".format(state)) if state != None: if state == 1: screen_NAME = EventMesh.publish("get_screen_NAME") if screen_NAME != None: - if screen_NAME == "class_time" :#在上课禁用界面打断其他操作界面 - print("class_time UI") - if msg["screen"] == "countdown_end": - print("countdown_end UI") - EventMesh.publish("close_count_show_info") - return - if self.UI_high_priority_flag == 1:#电话界面屏蔽其他界面 - return + if msg["screen"] == "charge_out" or msg["screen"] == "charge_in": + pass + else: + if screen_NAME == "class_time" :#在上课禁用界面打断其他操作界面 + print("class_time UI") + if msg["screen"] == "countdown_end": + # print("countdown_end UI") + EventMesh.publish("close_count_show_info") + return + else: + if screen_NAME != "dialing_noplay_popup" or screen_NAME != "dial_no_connect_popup" or \ + screen_NAME != "on_call" or screen_NAME != "dialing" or screen_NAME != "incoming_call" or \ + screen_NAME != "charge_in" or screen_NAME != "charge_out": + EventMesh.publish("load_screen", {"screen": "class_time"}) if self.screen : if self.screen.NAME == msg["screen"]: return diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py index 1465054c..c9418eff 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_WatchFaceScreen.py @@ -19,19 +19,25 @@ from machine import RTC watchface_style_default = lv.style_t() watchface_style_default.init() watchface_style_default.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -#watchface_style_default.set_text_font_v2("font_28.bin",28,0) -watchface_style_default.set_text_font(lv.K01_font_16_ALL) +watchface_style_default.set_text_font_v2("font_28.bin",28,0) + style_font_youyuan_28 = lv.style_t() style_font_youyuan_28.init() -style_font_youyuan_28.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -style_font_youyuan_28.set_text_font(lv.K01_font_16_ALL) +style_font_youyuan_28.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF)) +style_font_youyuan_28.set_text_font(lv.font_28_dial) + +power_line_points = [{"x":0,"y":0},{"x":0,"y":16}] +power_line_red = lv.style_t() +power_line_red.init() +power_line_red.set_line_width(0)#23 宽度 +power_line_red.set_line_color(lv.color_make(0xff, 0xff, 0xff)) Watchface = lv.obj() print("Watchface") Watchface1 = lv.obj(Watchface) -Watchface1.set_size(128,128) +Watchface1.set_size(240,320) #Watchface1.set_pos(0,0) Watchface1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) Watchface1.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -45,62 +51,58 @@ style_watchface_img_default.set_img_opa(255) #表盘 -#主图片 -watchface1_bg_img = lv.img(Watchface1) -watchface1_bg_img.set_pos(int(0),int(0)) -watchface1_bg_img.set_size(128,128) -watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) -watchface1_bg_img.set_src("U:/static/bg.png") -watchface1_bg_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) -#状态栏 - -power_line_points = [{"x":0,"y":0},{"x":0,"y":10}] -power_line_red = lv.style_t() -power_line_red.init() -power_line_red.set_line_width(0)#23 宽度 -power_line_red.set_line_color(lv.color_make(0xff, 0xff, 0xff)) - +#状态栏 watchface1_mpsignal_img = lv.img(Watchface1) -watchface1_mpsignal_img.set_pos(int(10),int(5)) -watchface1_mpsignal_img.set_size(22,12) +watchface1_mpsignal_img.set_pos(int(20),int(5)) +watchface1_mpsignal_img.set_size(30,22) watchface1_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -watchface1_mpsignal_img.set_src("U:/static/mpsignal5.png") +watchface1_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE) +watchface1_mpsignal_img.set_src("E:/static/mpsignal5.png") watchface1_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) watchface1_res_stat_battery_img = lv.img(Watchface1) -watchface1_res_stat_battery_img.set_pos(int(102),int(5)) -watchface1_res_stat_battery_img.set_size(24,12)#16 8 +watchface1_res_stat_battery_img.set_pos(int(196),int(5)) +watchface1_res_stat_battery_img.set_size(40,22) watchface1_res_stat_battery_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -watchface1_res_stat_battery_img.set_src("U:/static/vbat_0.png") +watchface1_res_stat_battery_img.add_flag(lv.obj.FLAG.CLICKABLE) +watchface1_res_stat_battery_img.set_src("E:/static/vbat_0.png") watchface1_res_stat_battery_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + + + watchface1_res_stat_battery_line = lv.line(Watchface1) watchface1_res_stat_battery_line.set_points(power_line_points,2) -watchface1_res_stat_battery_line.set_pos(int(110),int(6)) -watchface1_res_stat_battery_line.set_size(0,10)#高度12 +watchface1_res_stat_battery_line.set_pos(int(203),int(3)) +watchface1_res_stat_battery_line.set_size(0,16)#高度12 watchface1_res_stat_battery_line.add_style(power_line_red,0) -# watchface1_res_stat_charge_in_img = lv.img(Watchface1) -# watchface1_res_stat_charge_in_img.set_pos(int(80),int(0)) -# watchface1_res_stat_charge_in_img.set_size(10,18) -# watchface1_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -# watchface1_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE) -# watchface1_res_stat_charge_in_img.set_src("U:/static/charge_in.png") -# # add style for watchface1_res_stat_charge_in_img -# watchface1_res_stat_charge_in_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - +watchface1_res_stat_charge_in_img = lv.img(Watchface1) +watchface1_res_stat_charge_in_img.set_pos(int(180),int(0)) +watchface1_res_stat_charge_in_img.set_size(10,18) +watchface1_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +watchface1_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE) +# watchface1_res_stat_charge_in_img.set_src("E:/static/charge_in.png") +# add style for watchface1_res_stat_charge_in_img +watchface1_res_stat_charge_in_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) +#主图片 +watchface1_bg_img = lv.img(Watchface1) +watchface1_bg_img.set_pos(int(9),int(65)) +watchface1_bg_img.set_size(222,222) +watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) +watchface1_bg_img.set_src("U:/static/bg.png") +watchface1_bg_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #时间 style_font_youyuan_70_black = lv.style_t() style_font_youyuan_70_black.init() -style_font_youyuan_70_black.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF)) -style_font_youyuan_70_black.set_text_font(lv.K01_font_30_DIAL) -#style_font_youyuan_70_black.set_text_font(lv.font_70_bold) +style_font_youyuan_70_black.set_text_color(lv.color_make(0x32, 0xc8, 0xdb)) +style_font_youyuan_70_black.set_text_font(lv.font_70_bold) #init3:(2106, 2, 7, 6, 29, 38, 6, 38) data = RTC().datetime() hour = data[4] @@ -130,8 +132,8 @@ def get_week(msg): watchface1_time1_text = lv.label(Watchface1) -watchface1_time1_text.set_pos(4, 25) -watchface1_time1_text.set_size(100, 71) +watchface1_time1_text.set_pos(20, 50) +watchface1_time1_text.set_size(190, 71) watchface1_time1_text.set_align(lv.TEXT_ALIGN.LEFT) watchface1_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min))) # watchface1_time1_text.set_text("%02d:%02d"%(hour,min)) @@ -139,27 +141,27 @@ watchface1_time1_text.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STA #日期 watchface1_date_span = lv.label(Watchface1) -watchface1_date_span.set_pos(4, 52) -watchface1_date_span.set_size(60, 20) +watchface1_date_span.set_pos(8, 122) +watchface1_date_span.set_size(140, 30) watchface1_date_span.set_align(lv.TEXT_ALIGN.LEFT) watchface1_date_span.set_text("%d月%d日"%(date1,date2)) watchface1_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) #星期 watchface1_week_span = lv.label(Watchface1) -watchface1_week_span.set_pos(4, 72) -watchface1_week_span.set_size(64, 20) +watchface1_week_span.set_pos(8, 160) +watchface1_week_span.set_size(100, 30) watchface1_week_span.set_align(lv.TEXT_ALIGN.LEFT) watchface1_week_span.set_text("星期%s"%(get_week(week))) watchface1_week_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) -# watchface1_step_span = lv.label(Watchface1) -# watchface1_step_span.set_pos(80, 70) -# watchface1_step_span.set_size(48, 20) -# watchface1_step_span.set_align(lv.TEXT_ALIGN.LEFT) -# watchface1_step_span.set_text("0") -# watchface1_step_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) +watchface1_step_span = lv.label(Watchface1) +watchface1_step_span.set_pos(142, 159) +watchface1_step_span.set_size(78, 30) +watchface1_step_span.set_align(lv.TEXT_ALIGN.LEFT) +watchface1_step_span.set_text("0") +watchface1_step_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -170,20 +172,20 @@ watchface1_week_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFA # watchface1_HB_span.set_text("0") # watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) -# watchface1_HB_span = lv.label(Watchface1) -# watchface1_HB_span.set_pos(5, 100) -# watchface1_HB_span.set_size(60, 20) -# watchface1_HB_span.set_text("0") -# watchface1_HB_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN | lv.STATE.DEFAULT) +watchface1_HB_span = lv.label(Watchface1) +watchface1_HB_span.set_pos(5, 235) +watchface1_HB_span.set_size(115, 30) +watchface1_HB_span.set_text("0") +watchface1_HB_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN | lv.STATE.DEFAULT) -# watchface1_SPO2_span = lv.label(Watchface1) -# watchface1_SPO2_span.set_pos(68, 100) -# watchface1_SPO2_span.set_size(60, 20) -# watchface1_SPO2_span.set_text("0") -# watchface1_SPO2_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# watchface1_SPO2_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) +watchface1_SPO2_span = lv.label(Watchface1) +watchface1_SPO2_span.set_pos(110, 235) +watchface1_SPO2_span.set_size(120, 30) +watchface1_SPO2_span.set_text("0") +watchface1_SPO2_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +watchface1_SPO2_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) class WatchFace1(): @@ -263,36 +265,35 @@ class WatchFace1(): #print("__signal_cb:{}".format(msg//8)) if msg: if msg >= 0 and msg<=31 : - watchface1_mpsignal_img.set_src("U:/static/mpsignal{}.png".format(msg//8+1)) + watchface1_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) else : - watchface1_mpsignal_img.set_src("U:/static/mpsignal5.png") + watchface1_mpsignal_img.set_src("E:/static/mpsignal5.png") def __battery(self, event, msg): #print("__battery_cb:",str(msg)) #print(msg) if msg[0] == '1': - watchface1_res_stat_battery_line.set_pos(int(0),int(0)) + + watchface1_res_stat_battery_line.set_pos(int(0),int(8)) watchface1_res_stat_battery_line.set_size(0,0) watchface1_res_stat_battery_line.set_style_line_width(0,lv.PART.MAIN) - watchface1_res_stat_battery_img.set_src("U:/static/charge_ing.png") - # watchface1_res_stat_charge_in_img.set_src("U:/static/charge_in.png") + watchface1_res_stat_battery_img.set_src("E:/static/charge_ing.png") else: - watchface1_res_stat_battery_img.set_src("U:/static/vbat_0.png") + watchface1_res_stat_battery_img.set_src("E:/static/vbat_0.png") level = msg[1] if level >= 100: level = 100 - line_len = int(level*(21/100)) + line_len = int(level*(30/100)) # print("__battery_cb:",level,line_len,30/100) - if line_len >= 21: - line_len = 21 - if line_len <= 5: - line_len = 5 - - set_x = int(103+line_len//2) - watchface1_res_stat_battery_line.set_pos(int(set_x),int(6)) - watchface1_res_stat_battery_line.set_size(line_len,10) + if line_len >= 30: + line_len = 30 + if line_len <= 6: + line_len = 6 + set_x = int(199+line_len//2) + watchface1_res_stat_battery_line.set_pos(int(set_x),int(8)) + watchface1_res_stat_battery_line.set_size(line_len,15) watchface1_res_stat_battery_line.set_style_line_width(line_len,lv.PART.MAIN) - if line_len <= 5: + if line_len <= 6: watchface1_res_stat_battery_line.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) else: watchface1_res_stat_battery_line.set_style_line_color(lv.color_make(0x00,0xff,0x00),0) @@ -300,20 +301,16 @@ class WatchFace1(): pass def __oldHrValue(self, event, msg): - pass - # watchface1_HB_span.set_text("120") + watchface1_HB_span.set_text(str(msg)) def __oldSpo2Value(self, event, msg): - pass - # watchface1_SPO2_span.set_text(str(msg)) + watchface1_SPO2_span.set_text(str(msg)) def __stepValue(self, event, msg): if msg == None: - pass - # watchface1_step_span.set_text("0") + watchface1_step_span.set_text("0") else: - pass - # watchface1_step_span.set_text(str(msg)) + watchface1_step_span.set_text(str(msg)) def Close(self): pass @@ -338,7 +335,7 @@ style_watchface_img_default.set_img_recolor_opa(0) style_watchface_img_default.set_img_opa(255) Watchface2 = lv.obj(Watchface) -Watchface2.set_size(128,128) +Watchface2.set_size(240,320) #Watchface2.set_pos(0,0) Watchface2.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) Watchface2.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -346,58 +343,64 @@ Watchface2.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) #表盘 #状态栏 + watchface2_mpsignal_img = lv.img(Watchface2) watchface2_mpsignal_img.set_pos(int(20),int(5)) -watchface2_mpsignal_img.set_size(14,8) +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("U:/static/mpsignal5.png") +watchface2_mpsignal_img.set_src("E:/static/mpsignal5.png") watchface2_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) watchface2_res_stat_battery_img = lv.img(Watchface2) -watchface2_res_stat_battery_img.set_pos(int(100),int(5)) -watchface2_res_stat_battery_img.set_size(16,8) +watchface2_res_stat_battery_img.set_pos(int(196),int(5)) +watchface2_res_stat_battery_img.set_size(40,22) watchface2_res_stat_battery_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) watchface2_res_stat_battery_img.add_flag(lv.obj.FLAG.CLICKABLE) -watchface2_res_stat_battery_img.set_src("U:/static/vbat_0.png") +watchface2_res_stat_battery_img.set_src("E:/static/vbat_0.png") watchface2_res_stat_battery_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + +watchface2_res_stat_battery_line = lv.line(Watchface2) +watchface2_res_stat_battery_line.set_points(power_line_points,2) +watchface2_res_stat_battery_line.set_pos(int(203),int(3)) +watchface2_res_stat_battery_line.set_size(0,16)#高度12 +watchface2_res_stat_battery_line.add_style(power_line_red,0) # watchface2_res_stat_charge_in_img = lv.img(Watchface2) -# watchface2_res_stat_charge_in_img.set_pos(int(80),int(0)) +# watchface2_res_stat_charge_in_img.set_pos(int(180),int(0)) # watchface2_res_stat_charge_in_img.set_size(10,18) # watchface2_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) # watchface2_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE) -# watchface2_res_stat_charge_in_img.set_src("U:/static/charge_in.png") +# watchface2_res_stat_charge_in_img.set_src("E:/static/charge_ing.png") # # add style for watchface_res_stat_charge_in_img # watchface2_res_stat_charge_in_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) style_font_youyuan_70_red = lv.style_t() style_font_youyuan_70_red.init() style_font_youyuan_70_red.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -style_font_youyuan_70_red.set_text_font(lv.K01_font_16_ALL) -#style_font_youyuan_70_red.set_text_font(lv.font_70_bold) +style_font_youyuan_70_red.set_text_font(lv.font_70_bold) #时间 x = 30 y = 80 watchface2_time1_hour_text = lv.label(Watchface2) -watchface2_time1_hour_text.set_pos(20, 20) -watchface2_time1_hour_text.set_size(40, 35) +watchface2_time1_hour_text.set_pos(20, 80) +watchface2_time1_hour_text.set_size(88, 70) watchface2_time1_hour_text.set_align(lv.TEXT_ALIGN.LEFT) watchface2_time1_hour_text.set_text("{}".format("%02d"%(hour))) watchface2_time1_hour_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT) watchface2_time1_mao_text = lv.label(Watchface2) -watchface2_time1_mao_text.set_pos(60, 22) -watchface2_time1_mao_text.set_size(20, 70) +watchface2_time1_mao_text.set_pos(108, 76) +watchface2_time1_mao_text.set_size(44, 70) watchface2_time1_mao_text.set_align(lv.TEXT_ALIGN.LEFT) watchface2_time1_mao_text.set_text(":") watchface2_time1_mao_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT) watchface2_time1_hour1_text = lv.label(Watchface2) -watchface2_time1_hour1_text.set_pos(80, 20) -watchface2_time1_hour1_text.set_size(40, 35) +watchface2_time1_hour1_text.set_pos(152, 80) +watchface2_time1_hour1_text.set_size(88, 70) watchface2_time1_hour1_text.set_align(lv.TEXT_ALIGN.LEFT) watchface2_time1_hour1_text.set_text("{}".format("%02d"%(min))) watchface2_time1_hour1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -407,16 +410,16 @@ watchface2_time1_hour1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv #日期 watchface2_date_span = lv.label(Watchface2) -watchface2_date_span.set_pos(9, 55) -watchface2_date_span.set_size(60, 25) +watchface2_date_span.set_pos(18, 170) +watchface2_date_span.set_size(120, 35) watchface2_date_span.set_align(lv.TEXT_ALIGN.LEFT) watchface2_date_span.set_text("%d月%d日"%(date1,date2)) watchface2_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) #日期 watchface2_week = lv.label(Watchface2) -watchface2_week.set_pos(70, 55) -watchface2_week.set_size(60, 25) +watchface2_week.set_pos(146, 170) +watchface2_week.set_size(110, 35) watchface2_week.set_align(lv.TEXT_ALIGN.LEFT) watchface2_week.set_text("星期%s"%(get_week(week))) watchface2_week.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -427,21 +430,21 @@ watchface2_week.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) # watchface2_week.set_pos(int(30+56+20+25),int(y+56+30)) # watchface2_week.set_size(90,30) # watchface2_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -# watchface2_week.set_src("U:/static/watch_plate/style_2/week/0_week.png") +# watchface2_week.set_src("E:/static/watch_plate/style_2/week/0_week.png") # watchface2_week.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) watchface2_step_img = lv.img(Watchface2) -watchface2_step_img.set_pos(int(40),int(85)) +watchface2_step_img.set_pos(int(95),int(260)) watchface2_step_img.set_size(26,21) watchface2_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) watchface2_step_img.set_src("U:/static/step.png") watchface2_step_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) watchface2_step_txt = lv.label(Watchface2) -watchface2_step_txt.set_pos(70, 85) -watchface2_step_txt.set_size(50, 25) +watchface2_step_txt.set_pos(125, 260) +watchface2_step_txt.set_size(80, 35) watchface2_step_txt.set_align(lv.TEXT_ALIGN.LEFT) watchface2_step_txt.set_text("0") watchface2_step_txt.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT) @@ -506,7 +509,7 @@ class WatchFace2(): # watchface2_time2_min2_text.set_text("{}".format("%d"%(min2_chose))) watchface2_date_span.set_text(msg[2])#日期 watchface2_week.set_text(msg[3])#星期 - # watchface2_week.set_src("U:/static/watch_plate/style_2/week/%d_week.png"%(msg[5])) #星期 + # 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)) @@ -514,20 +517,39 @@ class WatchFace2(): #print("__signal_cb:{}".format(msg//8)) if msg: if msg >= 0 and msg<=31 : - watchface2_mpsignal_img.set_src("U:/static/mpsignal{}.png".format(msg//8+1)) + watchface2_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1)) else : - watchface2_mpsignal_img.set_src("U:/static/mpsignal5.png") + watchface2_mpsignal_img.set_src("E:/static/mpsignal5.png") def __battery(self, event, msg): #print("__battery_cb:",str(msg)) #print(msg) if msg[0] == '1': - pass - # watchface2_res_stat_charge_in_img.set_src("U:/static/charge_in.png") + + watchface2_res_stat_battery_line.set_pos(int(0),int(0)) + watchface2_res_stat_battery_line.set_size(0,0) + watchface2_res_stat_battery_line.set_style_line_width(0,lv.PART.MAIN) + watchface2_res_stat_battery_img.set_src("E:/static/charge_ing.png") else: - # watchface2_res_stat_charge_in_img.set_src("U:/static/charge_in1.png") - pass - watchface2_res_stat_battery_img.set_src("U:/static/vbat_%d.png"%(msg[1]))#"U:/vbat_60.png" + watchface2_res_stat_battery_img.set_src("E:/static/vbat_0.png") + level = msg[1] + if level >= 100: + level = 100 + line_len = int(level*(30/100)) + # print("__battery_cb:",level,line_len,30/100) + if line_len >= 30: + line_len = 30 + if line_len <= 6: + line_len = 6 + set_x = int(199+line_len//2) + watchface2_res_stat_battery_line.set_pos(int(set_x),int(8)) + watchface2_res_stat_battery_line.set_size(line_len,16) + watchface2_res_stat_battery_line.set_style_line_width(line_len,lv.PART.MAIN) + if line_len <= 6: + watchface2_res_stat_battery_line.set_style_line_color(lv.color_make(0xff,0x00,0x00),0) + else: + watchface2_res_stat_battery_line.set_style_line_color(lv.color_make(0x00,0xff,0x00),0) + # watchface2_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png" pass def __stepValue(self, event, msg): if msg == None: @@ -544,7 +566,7 @@ class WatchFace2(): # type = int(msg) # watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) # watchface2_temp_img.clear_flag(lv.obj.FLAG.HIDDEN) - # watchface2_temp_img.set_src("U:/static/watch_plate/style_2/%d_main2_weather.png"%(type)) + # watchface2_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type)) # def __weather_value(self, event, msg): # if msg == None: @@ -587,6 +609,7 @@ class WatchFace(): self.watchface_style_num = read_data + def initialization(self,main_menu): if self.watchface_list == [] : #第一次初始化 self.watchface_list.append( WatchFace1(main_menu)) diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py index 736822dd..ba3cf5a3 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py @@ -9,7 +9,7 @@ import osTimer import audio from machine import Pin import ujson - +from lcd import style_font_youyuan_40 # -------------------------------------------setting screen---------------------------------------------------------- style_bar = lv.style_t() @@ -47,7 +47,7 @@ health_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) health_title_img = lv.img(health_screen) health_title_img.set_pos(58, 10) health_title_img.set_size(124, 30) -health_title_img.set_src("U:/static/health/health_text.png") +health_title_img.set_src("E:/static/health/health_text.png") health_title_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -92,7 +92,7 @@ health_hr_img = lv.img(setting_cont) health_hr_img.set_pos(0, health_cont_y) health_hr_img.set_size(232, 80) health_hr_img.add_flag(lv.obj.FLAG.CLICKABLE) -health_hr_img.set_src("U:/static/health/health_hr.png") +health_hr_img.set_src("E:/static/health/health_hr.png") health_hr_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) health_cont_y+=90 @@ -112,7 +112,7 @@ health_spo2_img = lv.img(setting_cont) health_spo2_img.set_pos(0, health_cont_y) health_spo2_img.set_size(232, 80) health_spo2_img.add_flag(lv.obj.FLAG.CLICKABLE) -health_spo2_img.set_src("U:/static/health/health_spo2.png") +health_spo2_img.set_src("E:/static/health/health_spo2.png") health_spo2_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) health_cont_y+=90 @@ -130,7 +130,7 @@ health_temp_img = lv.img(setting_cont) health_temp_img.set_pos(0, health_cont_y) health_temp_img.set_size(232, 80) health_temp_img.add_flag(lv.obj.FLAG.CLICKABLE) -health_temp_img.set_src("U:/static/health/health_temp.png") +health_temp_img.set_src("E:/static/health/health_temp.png") health_temp_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) health_cont_y+=90 diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py index 1fc4d92c..2d1ad777 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py @@ -28,7 +28,15 @@ style_MainMenu_img_default.set_img_recolor(lv.color_make(0xff,0xff,0xff)) style_MainMenu_img_default.set_img_recolor_opa(0) style_MainMenu_img_default.set_img_opa(255) +style_font_youyuan_20 = lv.style_t() +style_font_youyuan_20.init() +style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff)) +style_font_youyuan_20.set_text_font_v2("font_28.bin",28,0) +style_font_youyuan_25 = lv.style_t() +style_font_youyuan_25.init() +style_font_youyuan_25.set_text_color(lv.color_make(0xff, 0xff, 0xff)) +style_font_youyuan_25.set_text_font_v2("font_28.bin",28,0) style_btn = lv.style_t() style_btn.init() @@ -80,8 +88,7 @@ style_btn.set_border_width(0) style_font_youyuan_font_60 = lv.style_t() style_font_youyuan_font_60.init() style_font_youyuan_font_60.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF)) -style_font_youyuan_font_60.set_text_font(lv.K01_font_16_ALL) -#style_font_youyuan_font_60.set_text_font(lv.font_60_main_menu) +style_font_youyuan_font_60.set_text_font(lv.font_60_main_menu) MainMenu2x = 0 MainMenu2_num = 0 MainMenu2 = lv.obj() @@ -89,32 +96,59 @@ print("MainMenu2") MainMenu2_til = lv.tileview(MainMenu2) MainMenu2_til.set_scrollbar_mode(0) MainMenu2_til.add_style(style_MainMenu_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT) +#MainMenu2_til.add_flag(lv.obj.FLAG.SCROLL_ELASTIC) +#LV_OBJ_FLAG_SCROLL_MOMENTUM #表盘 - MainMenu2_Watchface = MainMenu2_til.add_tile(0, 1, lv.DIR.LEFT | lv.DIR.RIGHT) label_text = lv.label(MainMenu2_Watchface) -label_text.set_pos(0, 0) +label_text.set_pos(0, 240) label_text.set_size(0, 0) -label_text.set_text("{}".format(MainMenu2_num)) +label_text.set_text("0") MainMenu2_num+=1 +# #支付宝 +# MainMenu2_alipay = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# #MainMenu2_alipay.set_tile_act(7,0,lv.ANIM.ON)#设置拼接 +# label_text = lv.label(MainMenu2_alipay) +# label_text.set_pos(0, 240) +# label_text.set_size(0, 0) +# label_text.set_text("{}".format(MainMenu2_num)) +# MainMenu2_img_alipay_text = lv.label(MainMenu2_alipay) +# MainMenu2_img_alipay_text.set_pos(int(0),int(220)) +# MainMenu2_img_alipay_text.set_size(240,100) +# MainMenu2_img_alipay_text.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_alipay_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu2_img_alipay_text.set_text("支付宝") +# MainMenu2_img_alipay_text.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) + +# MainMenu2_img_alipay = lv.img(MainMenu2_alipay) +# MainMenu2_img_alipay.set_size(160,160) +# MainMenu2_img_alipay.set_pos(40,20) +# MainMenu2_img_alipay.set_src("U:/static/alipay_.png") +# MainMenu2_img_alipay.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_alipay.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) +# MainMenu2_num+=1 +# MainMenu2x+=1 +# label_alipay.set_long_mode(lv.label.LONG.WRAP) +# label_alipay.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# label_alipay.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT) #拨号盘 MainMenu2_phone = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) label_text = lv.label(MainMenu2_phone) -label_text.set_pos(0, 0) +label_text.set_pos(0, 240) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu2_num)) MainMenu2_img_phone = lv.img(MainMenu2_phone) -MainMenu2_img_phone.set_size(80,80) -MainMenu2_img_phone.set_pos(24,10) +MainMenu2_img_phone.set_size(160,160) +MainMenu2_img_phone.set_pos(40,20) MainMenu2_img_phone.set_src("U:/static/IMAGE_ONE_PAGE_CALL.png") MainMenu2_img_phone.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_phone.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu2_img_phone_text = lv.label(MainMenu2_phone) -MainMenu2_img_phone_text.set_pos(int(0),int(100)) -MainMenu2_img_phone_text.set_size(128,20) +MainMenu2_img_phone_text.set_pos(int(0),int(220)) +MainMenu2_img_phone_text.set_size(240,100) MainMenu2_img_phone_text.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_phone_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu2_img_phone_text.set_text("拨号盘") @@ -125,19 +159,19 @@ MainMenu2x+=1 #通讯录 MainMenu2_contacts = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) label_text = lv.label(MainMenu2_contacts) -label_text.set_pos(0, 0) +label_text.set_pos(0, 240) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu2_num)) MainMenu2_img_contacts = lv.img(MainMenu2_contacts) -MainMenu2_img_contacts.set_size(80,80) -MainMenu2_img_contacts.set_pos(24,10) +MainMenu2_img_contacts.set_size(160,160) +MainMenu2_img_contacts.set_pos(40,20) MainMenu2_img_contacts.set_src("U:/static/IMAGE_ONE_PAGE_CONTACTS.png") MainMenu2_img_contacts.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_contacts.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu2_img_contacts_txt = lv.label(MainMenu2_contacts) -MainMenu2_img_contacts_txt.set_pos(int(0),int(100)) -MainMenu2_img_contacts_txt.set_size(128,20) +MainMenu2_img_contacts_txt.set_pos(int(0),int(220)) +MainMenu2_img_contacts_txt.set_size(240,100) MainMenu2_img_contacts_txt.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_contacts_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu2_img_contacts_txt.set_text("联系人") @@ -148,19 +182,19 @@ MainMenu2x+=1 #短信 MainMenu2_SMS = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) label_text = lv.label(MainMenu2_SMS) -label_text.set_pos(0, 0) +label_text.set_pos(0, 240) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu2_num)) MainMenu2_img_sms = lv.img(MainMenu2_SMS) -MainMenu2_img_sms.set_size(80,80) -MainMenu2_img_sms.set_pos(24,10) +MainMenu2_img_sms.set_size(160,160) +MainMenu2_img_sms.set_pos(40,20) MainMenu2_img_sms.set_src("U:/static/IMAGE_ONE_PAGE_SMS.png") MainMenu2_img_sms.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_sms.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu2_img_sms_txt = lv.label(MainMenu2_SMS) -MainMenu2_img_sms_txt.set_pos(int(0),int(100)) -MainMenu2_img_sms_txt.set_size(128,20) +MainMenu2_img_sms_txt.set_pos(int(0),int(220)) +MainMenu2_img_sms_txt.set_size(240,100) MainMenu2_img_sms_txt.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_sms_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu2_img_sms_txt.set_text("短信") @@ -171,19 +205,19 @@ MainMenu2x+=1 #微聊 MainMenu2_wechat = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) label_text = lv.label(MainMenu2_wechat) -label_text.set_pos(0, 0) +label_text.set_pos(0, 240) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu2_num)) MainMenu2_img_wechat = lv.img(MainMenu2_wechat) -MainMenu2_img_wechat.set_size(80,80) -MainMenu2_img_wechat.set_pos(24,10) +MainMenu2_img_wechat.set_size(160,160) +MainMenu2_img_wechat.set_pos(40,20) MainMenu2_img_wechat.set_src("U:/static/IMAGE_ONE_PAGE_WECHAT.png") MainMenu2_img_wechat.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_wechat.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu2_img_wechat_txt = lv.label(MainMenu2_wechat) -MainMenu2_img_wechat_txt.set_pos(int(0),int(100)) -MainMenu2_img_wechat_txt.set_size(128,20) +MainMenu2_img_wechat_txt.set_pos(int(0),int(220)) +MainMenu2_img_wechat_txt.set_size(240,100) MainMenu2_img_wechat_txt.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_wechat_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu2_img_wechat_txt.set_text("微聊") @@ -192,114 +226,66 @@ MainMenu2_num+=1 MainMenu2x+=1 #健康测量 -# MainMenu2_heartrate = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -# label_text = lv.label(MainMenu2_heartrate) -# label_text.set_pos(0, 0) -# label_text.set_size(0, 0) -# label_text.set_text("{}".format(MainMenu2_num)) -# MainMenu2_img_health = lv.img(MainMenu2_heartrate) -# MainMenu2_img_health.set_size(80,80) -# MainMenu2_img_health.set_pos(24,10) -# MainMenu2_img_health.set_src("U:/static/IMAGE_ONE_PAGE_HEALTH.png") -# MainMenu2_img_health.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu2_img_health.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -# MainMenu2_img_health_txt = lv.label(MainMenu2_heartrate) -# MainMenu2_img_health_txt.set_pos(int(0),int(100)) -# MainMenu2_img_health_txt.set_size(128,20) -# MainMenu2_img_health_txt.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu2_img_health_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# MainMenu2_img_health_txt.set_text("健康测量") -# MainMenu2_img_health_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) -# MainMenu2_num+=1 -# MainMenu2x+=1 - -#视频通话 -MainMenu2_camera_video = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -label_text = lv.label(MainMenu2_camera_video) -label_text.set_pos(0, 0) +MainMenu2_heartrate = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +label_text = lv.label(MainMenu2_heartrate) +label_text.set_pos(0, 240) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu2_num)) -MainMenu2_img_camera_video = lv.img(MainMenu2_camera_video) -MainMenu2_img_camera_video.set_size(80,80) -MainMenu2_img_camera_video.set_pos(24,10) -MainMenu2_img_camera_video.set_src("U:/static/IMAGE_ONE_PAGE_VIDEOCALL.png") -MainMenu2_img_camera_video.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera_video.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu2_img_camera_video_txt = lv.label(MainMenu2_camera_video) -MainMenu2_img_camera_video_txt.set_pos(int(0),int(100)) -MainMenu2_img_camera_video_txt.set_size(128,20) -MainMenu2_img_camera_video_txt.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera_video_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu2_img_camera_video_txt.set_text("视频通话") -MainMenu2_img_camera_video_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) +MainMenu2_img_health = lv.img(MainMenu2_heartrate) +MainMenu2_img_health.set_size(160,160) +MainMenu2_img_health.set_pos(40,20) +MainMenu2_img_health.set_src("U:/static/IMAGE_ONE_PAGE_HEALTH.png") +MainMenu2_img_health.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu2_img_health.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +MainMenu2_img_health_txt = lv.label(MainMenu2_heartrate) +MainMenu2_img_health_txt.set_pos(int(0),int(220)) +MainMenu2_img_health_txt.set_size(240,100) +MainMenu2_img_health_txt.add_flag(lv.obj.FLAG.CLICKABLE) +MainMenu2_img_health_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +MainMenu2_img_health_txt.set_text("健康测量") +MainMenu2_img_health_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) MainMenu2_num+=1 MainMenu2x+=1 - -# #相机 -# MainMenu2_camera = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -# label_text = lv.label(MainMenu2_camera) -# label_text.set_pos(0, 0) +#血样检测 +# MainMenu2_spo2 = MainMenu2_til.add_tile(4, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# label_text = lv.label(MainMenu2_spo2) +# label_text.set_pos(0, 240) # label_text.set_size(0, 0) -# label_text.set_text("{}".format(MainMenu2_num)) -# MainMenu2_img_camera = lv.img(MainMenu2_camera) -# MainMenu2_img_camera.set_size(80,80) -# MainMenu2_img_camera.set_pos(24,10) -# MainMenu2_img_camera.set_src("U:/static/IMAGE_ONE_PAGE_CAMERA.png") -# MainMenu2_img_camera.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu2_img_camera.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -# MainMenu2_img_camera_txt = lv.label(MainMenu2_camera) -# MainMenu2_img_camera_txt.set_pos(int(0),int(100)) -# MainMenu2_img_camera_txt.set_size(128,20) -# MainMenu2_img_camera_txt.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu2_img_camera_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# MainMenu2_img_camera_txt.set_text("相机") -# MainMenu2_img_camera_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) -# MainMenu2_num+=1 -# MainMenu2x+=1 - - -# #相册 -# MainMenu2_camera_album = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -# label_text = lv.label(MainMenu2_camera_album) -# label_text.set_pos(0, 0) -# label_text.set_size(0, 0) -# label_text.set_text("{}".format(MainMenu2_num)) -# MainMenu2_img_camera_album = lv.img(MainMenu2_camera_album) -# MainMenu2_img_camera_album.set_size(80,80) -# MainMenu2_img_camera_album.set_pos(24,10) -# MainMenu2_img_camera_album.set_src("U:/static/IMAGE_ONE_PAGE_ALBUM.png") -# MainMenu2_img_camera_album.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu2_img_camera_album.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -# MainMenu2_img_camera_album_txt = lv.label(MainMenu2_camera_album) -# MainMenu2_img_camera_album_txt.set_pos(int(0),int(100)) -# MainMenu2_img_camera_album_txt.set_size(128,20) -# MainMenu2_img_camera_album_txt.add_flag(lv.obj.FLAG.CLICKABLE) -# MainMenu2_img_camera_album_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -# MainMenu2_img_camera_album_txt.set_text("相册") -# MainMenu2_img_camera_album_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) -# MainMenu2_num+=1 -# MainMenu2x+=1 +# label_text.set_text("5") +# MainMenu2_img_spo2 = lv.img(MainMenu2_spo2) +# MainMenu2_img_spo2.set_size(160,160) +# MainMenu2_img_spo2.set_pos(40,20) +# MainMenu2_img_spo2.set_src("U:/static/IMAGE_ONE_PAGE_SPO2_DETECT.png") +# MainMenu2_img_spo2.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_spo2.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu2_img_spo2_txt = lv.label(MainMenu2_spo2) +# MainMenu2_img_spo2_txt.set_pos(int(0),int(220)) +# MainMenu2_img_spo2_txt.set_size(240,100) +# MainMenu2_img_spo2_txt.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_spo2_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu2_img_spo2_txt.set_text("血氧检测") +# MainMenu2_img_spo2_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) +#MainMenu2_num+=1 +#MainMenu2x+=1 #工具箱 MainMenu2_toolbox = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) label_text = lv.label(MainMenu2_toolbox) -label_text.set_pos(0, 0) +label_text.set_pos(0, 240) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu2_num)) MainMenu2_img_toolbox = lv.img(MainMenu2_toolbox) -MainMenu2_img_toolbox.set_size(80,80) -MainMenu2_img_toolbox.set_pos(24,10) +MainMenu2_img_toolbox.set_size(160,160) +MainMenu2_img_toolbox.set_pos(40,20) MainMenu2_img_toolbox.set_src("U:/static/IMAGE_ONE_PAGE_TOOLS.png") MainMenu2_img_toolbox.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_toolbox.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu2_img_toolbox_txt = lv.label(MainMenu2_toolbox) -MainMenu2_img_toolbox_txt.set_pos(int(0),int(100)) -MainMenu2_img_toolbox_txt.set_size(128,20) +MainMenu2_img_toolbox_txt.set_pos(int(0),int(220)) +MainMenu2_img_toolbox_txt.set_size(240,100) MainMenu2_img_toolbox_txt.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_toolbox_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu2_img_toolbox_txt.set_text("工具箱") @@ -311,19 +297,19 @@ MainMenu2x+=1 MainMenu2_setting = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) #MainMenu2_setting.set_tile_act(0,0,lv.ANIM.ON) label_text = lv.label(MainMenu2_setting) -label_text.set_pos(0, 0) +label_text.set_pos(0, 240) label_text.set_size(0, 0) label_text.set_text("{}".format(MainMenu2_num)) MainMenu2_img_setting = lv.img(MainMenu2_setting) -MainMenu2_img_setting.set_size(80,80) -MainMenu2_img_setting.set_pos(24,10) +MainMenu2_img_setting.set_size(160,160) +MainMenu2_img_setting.set_pos(40,20) MainMenu2_img_setting.set_src("U:/static/IMAGE_ONE_PAGE_SETTINGS.png") MainMenu2_img_setting.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_setting.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) MainMenu2_img_setting_txt = lv.label(MainMenu2_setting) -MainMenu2_img_setting_txt.set_pos(int(0),int(100)) -MainMenu2_img_setting_txt.set_size(128,20) +MainMenu2_img_setting_txt.set_pos(int(0),int(220)) +MainMenu2_img_setting_txt.set_size(240,100) MainMenu2_img_setting_txt.add_flag(lv.obj.FLAG.CLICKABLE) MainMenu2_img_setting_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) MainMenu2_img_setting_txt.set_text("设置") @@ -343,23 +329,27 @@ class MainMenuScreen(Screen): self.meta = MainMenu2 self.watchface = WatchFace() self.menu_id = "0" + self.menu_new_id = "255" + self.menu_old_id = "255" + self.scroll_begin_event_count = 0 + self.menu_action = 0 # =1左滑 =2右划 print("MainMenu1:__init__") - #MainMenu2_til.add_event_cb(lambda e: EventMesh.callback_wrapper(self.scroll_begin_event(e)),lv.EVENT.SCROLL_END,None) + MainMenu2_til.add_event_cb(lambda e: EventMesh.callback_wrapper(self.scroll_begin_event_cb(e)),lv.EVENT.SCROLL_END,None) #lv_obj_add_event_cb(lv_tabview_get_content(tabview), scroll_begin_event, LV_EVENT_SCROLL_END, NULL); MainMenu2_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.CLICKED, None) MainMenu2_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.CLICKED, None) MainMenu2_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.CLICKED, None) - MainMenu2_img_camera_video.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_video")), lv.EVENT.CLICKED, None) - # MainMenu2_img_camera.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera")), lv.EVENT.CLICKED, None) - # MainMenu2_img_camera_album.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_album")), lv.EVENT.CLICKED, None) + MainMenu2_img_health.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "health")), lv.EVENT.CLICKED, None) MainMenu2_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.CLICKED, None) MainMenu2_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.CLICKED, None) # MainMenu2_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.CLICKED, None) MainMenu2_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.CLICKED, None) + #MainMenu2_img_alipay.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "alipay_open")), lv.EVENT.CLICKED, None) - EventMesh.subscribe("watch_top_show", self.watch_top_show) + EventMesh.subscribe("return_alipay", self.return_alipay) EventMesh.subscribe("return_setiing", self.return_setiing) + #MainMenu2_img_alipay.add_event_cb(lambda e: img_cb(e, "Watchface_set"), lv.EVENT.CLICKED, None) def initialization(self): self.watchface.initialization(MainMenu2_Watchface) @@ -370,30 +360,41 @@ class MainMenuScreen(Screen): # MainMenu2_til.set_tile_id(self.meta_info[0],self.meta_info[1],lv.ANIM.OFF) pass# - def scroll_begin_event(self, e): - print("MainMenu2:scroll_begin_event!") - MainMenu = e.get_target() - code = e.get_code() - if code == lv.EVENT.SCROLL_END: - pass + def scroll_begin_event_cb(self, e): + pass + # EventMesh.publish("publish_message_event_ui",{"func":self.scroll_begin_event,"data":0}) + # def scroll_begin_event(self, data): + #处理轻微滑动不跳页面问题 + # self.scroll_begin_event_count+=1 + + # if self.scroll_begin_event_count == 1: + # self.menu_new_id = MainMenu2_til.get_tile_act().get_child(0).get_text() + # #print("scroll_begin_event scroll_begin_event {} old_id {} new_id{}".format(self.scroll_begin_event_count,self.menu_old_id,self.menu_new_id)) + # elif self.scroll_begin_event_count == 2: + # self.menu_old_id = MainMenu2_til.get_tile_act().get_child(0).get_text() + # print("scroll_begin_event menu_action {} old_id {} new_id {}".format(self.menu_action,self.menu_old_id,self.menu_new_id)) + # self.scroll_begin_event_count = 0 + # if self.menu_old_id == self.menu_new_id and self.menu_action == 1: + # MainMenu2_til.set_tile_id(int(self.menu_old_id)-2,0,lv.ANIM.ON) + # print("scroll_begin_event menu_action == 1") + # elif self.menu_old_id == self.menu_new_id and self.menu_action == 2: + # print("scroll_begin_event menu_action == 2") + # MainMenu2_til.set_tile_id(int(self.menu_old_id),0,lv.ANIM.ON) + # self.menu_action = 0 + # else : + # self.scroll_begin_event_count = 0 + + # MainMenu = e.get_target() + # code = e.get_code() + # print("MainMenu2:scroll_begin_event code {}!!!!!".format(code)) + # if code == lv.EVENT.SCROLL_END: + # pass def watch_top_show(self, event, msg): # MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF) def img_cb(self, e, msg): - state = EventMesh.publish("get_key_board", "key_board") - # print("state",state) - if state == 1: - # print("state11",state) - if msg == 'Phone': - # print("Phone",state) - EventMesh.publish("load_screen", {"screen": "keyboard_popup"}) - pass - else: - EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) - else: - EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) - print("MainMenu2:img_cb:{} {}".format(msg,type(msg))) - + print("MainMenu2:img_cb:{}".format(msg)) + EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) def lcd_on(self): self.watchface.watchface_style.timerout_update() @@ -414,7 +415,12 @@ class MainMenuScreen(Screen): id = MainMenu2_til.get_tile_act().get_child(0).get_text() if id != "0": MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF) + else: + EventMesh.publish("load_screen", {"screen": "alipay_open"}) + def return_alipay(self, event, msg): + MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF) + def return_setiing(self, event, msg): MainMenu2_til.set_tile_id(7,0,lv.ANIM.OFF) @@ -453,46 +459,23 @@ class MainMenuScreen(Screen): self.menu_id = id def done_left_to_right(self): id = MainMenu2_til.get_tile_act().get_child(0).get_text() - print("done_left_to_right:ID{}".format(id)) + print("done_left_to_right:ID{} menu_id{}".format(id,self.menu_id)) if id == "0": MainMenu2_til.set_tile_id(MainMenu2_num-2,0,lv.ANIM.OFF) elif self.menu_id != '2' and id == '1': MainMenu2_til.set_tile_id(MainMenu2_num-2,0,lv.ANIM.OFF) + elif self.menu_id == id : + self.menu_action = 1 self.menu_id = id def done_right_to_left(self): id = MainMenu2_til.get_tile_act().get_child(0).get_text() - print("done_right_to_left:ID{}".format(id)) - if id == "0": - MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF) - elif (self.menu_id != str(MainMenu2_num-2) ) and id == str(MainMenu2_num-1) : - MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF) - self.menu_id = id - def done_DOWN(self):#下滑 - id = MainMenu2_til.get_tile_act().get_child(0).get_text() - print("done_right_to_left: {} {} {}".format(id,self.menu_id,MainMenu2_num)) - if id == "0": - MainMenu2_til.set_tile_id(MainMenu2_num-2,0,lv.ANIM.OFF) - elif self.menu_id != '2' and id == '1': - MainMenu2_til.set_tile_id(MainMenu2_num-2,0,lv.ANIM.OFF) - else : - if id == "1": - MainMenu2_til.set_tile_id(MainMenu2_num-2,0,lv.ANIM.OFF) - else : - MainMenu2_til.set_tile_id(int(id)-2,0,lv.ANIM.ON) - self.menu_id = id - def done_UP(self):#上滑 - id = MainMenu2_til.get_tile_act().get_child(0).get_text() - print("done_right_to_left: {} {} {}".format(id,self.menu_id,MainMenu2_num)) + print("done_right_to_left:ID{} menu_id{}".format(id,self.menu_id)) if id == "0": MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF) elif (self.menu_id != str(MainMenu2_num-2) ) and id == str(MainMenu2_num-1) : MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF) else : - if int(id) == MainMenu2_num-1 : - MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF) - else : - MainMenu2_til.set_tile_id(int(id),0,lv.ANIM.ON) - + self.menu_action = 2 self.menu_id = id def Close(self): diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py index de287fb1..546cc493 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py @@ -3,17 +3,16 @@ import lvgl as lv import ql_fs import EventMesh from misc import Power -from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic +from ui import style_screen,style_font_youyuan_20_gray,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic import constants import osTimer import audio from machine import Pin import ujson - +from lcd import style_font_youyuan_40 # -------------------------------------------setting screen---------------------------------------------------------- -set_icon_x = 25 -set_icon_y = 25 + style_volume_btn = lv.style_t() style_volume_btn.init() @@ -23,24 +22,23 @@ style_volume_btn.set_bg_color(lv.color_make(0x80, 0x80, 0x80)) -setting_cont_y = 5 +setting_cont_y = 0 setting_screen = lv.obj() print("setting_screen") setting_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) -# setting_imei_img = lv.img(setting_screen) -# setting_imei_img.set_pos(75, 10) -# setting_imei_img.set_size(90, 30) -# setting_imei_img.set_src("U:/static/setting/setting_text.png") -# setting_imei_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -# setting_title = lv.label(setting_screen) -# setting_title.set_pos(0, 5) -# setting_title.set_size(128, 20) +setting_imei_img = lv.img(setting_screen) +setting_imei_img.set_pos(75, 10) +setting_imei_img.set_size(90, 30) +setting_imei_img.set_src("E:/static/setting/setting_text.png") +setting_imei_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +# setting_title = lv.label(setting) +# setting_title.set_pos(0, 10) +# setting_title.set_size(240, 40) # setting_title.set_text("设置") # setting_title.set_long_mode(lv.label.LONG.WRAP) # setting_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) # setting_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - setting_cont_style = lv.style_t() setting_cont_style.init() setting_cont_style.set_radius(0) @@ -56,8 +54,8 @@ setting_cont_style.set_pad_bottom(0) setting_cont = lv.obj(setting_screen) -setting_cont.set_pos(0, 0) -setting_cont.set_size(128, 128) +setting_cont.set_pos(0, 50) +setting_cont.set_size(240, 270) setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT) # setting_language = lv.btn(setting_cont) @@ -74,27 +72,27 @@ setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT) # setting_language_img.set_pos(10, setting_cont_y)set_size(47, 47) # setting_language_img.set_size(232, 80) # setting_language_img.add_flag(lv.obj.FLAG.CLICKABLE) -# setting_language_img.set_src("U:/static/menu_language.png") +# setting_language_img.set_src("E:/static/menu_language.png") # setting_language_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) #setting_cont_y += 60 - -setting_dialswitch_label = lv.label(setting_cont) +setting_dialswitch = lv.btn(setting_cont) +setting_dialswitch.set_pos(0, setting_cont_y) +setting_dialswitch.set_size(0, 0) +setting_dialswitch_label = lv.label(setting_dialswitch) setting_dialswitch_label.set_text("表盘切换") -setting_dialswitch_label.set_pos(34, setting_cont_y+5) -setting_dialswitch_label.set_size(128-34, 35) -setting_dialswitch_label.add_flag(lv.obj.FLAG.CLICKABLE) -# setting_dialswitch_label.set_text_align(lv.ALIGN.LEFT_MID, 30, setting_cont_y) +setting_dialswitch.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_dialswitch_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_dialswitch_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_dialswitch_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_dialswitch.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_dialswitch_img = lv.img(setting_cont) -setting_dialswitch_img.set_pos(4, setting_cont_y) -setting_dialswitch_img.set_size(set_icon_x, set_icon_y) +setting_dialswitch_img.set_pos(0, setting_cont_y) +setting_dialswitch_img.set_size(232, 80) setting_dialswitch_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_dialswitch_img.set_src("U:/static/menu_watch_switch.png") +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+=35 +setting_cont_y+=90 # setting_themeswitch = lv.btn(setting_cont) @@ -111,151 +109,151 @@ setting_cont_y+=35 # setting_themeswitch_img.set_pos(10, 120) # setting_themeswitch_img.set_size(232, 80) # setting_themeswitch_img.add_flag(lv.obj.FLAG.CLICKABLE) -# setting_themeswitch_img.set_src("U:/static/menu_theme_switch.png") +# setting_themeswitch_img.set_src("E:/static/menu_theme_switch.png") # setting_themeswitch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) #setting_cont_y+=60 - -setting_imei_label = lv.label(setting_cont) +setting_imei = lv.btn(setting_cont) +setting_imei.set_pos(0, setting_cont_y) +setting_imei.set_size(0, 0) +setting_imei_label = lv.label(setting_imei) setting_imei_label.set_text("设备IMEI号") -setting_imei_label.set_pos(34, setting_cont_y+5) -setting_imei_label.set_size(128-34, 35) -setting_imei_label.add_flag(lv.obj.FLAG.CLICKABLE) +setting_imei.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_imei_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_imei_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_imei_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_imei.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_imei_img = lv.img(setting_cont) -setting_imei_img.set_pos(4, setting_cont_y) -setting_imei_img.set_size(set_icon_x, set_icon_y) +setting_imei_img.set_pos(0, setting_cont_y) +setting_imei_img.set_size(232, 80) setting_imei_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_imei_img.set_src("U:/static/menu_imei_qrcode.png") +setting_imei_img.set_src("E:/static/setting/menu_imei_qrcode.png") setting_imei_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+=35 - - -setting_app_label = lv.label(setting_cont) -setting_app_label.set_text("手机APP") -setting_app_label.set_pos(34, setting_cont_y+5) -setting_app_label.set_size(128-34, 35) -setting_app_label.add_flag(lv.obj.FLAG.CLICKABLE) +setting_cont_y+=90 + +setting_app = lv.btn(setting_cont) +setting_app.set_pos(0, setting_cont_y) +setting_app.set_size(0, 0) +setting_app_label = lv.label(setting_app) +setting_app_label.set_text("手机安装APP") +setting_app.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_app_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_app_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_app_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_app.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_app_img = lv.img(setting_cont) -setting_app_img.set_pos(4, setting_cont_y) -setting_app_img.set_size(set_icon_x, set_icon_y) +setting_app_img.set_pos(0, setting_cont_y) +setting_app_img.set_size(232, 80) setting_app_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_app_img.set_src("U:/static/menu_app_qrcode.png") +setting_app_img.set_src("E:/static/setting/menu_app_qrcode.png") setting_app_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+=35 +setting_cont_y+=90 - -setting_bright_label = lv.label(setting_cont) +setting_bright = lv.btn(setting_cont) +setting_bright.set_pos(0, setting_cont_y) +setting_bright.set_size(0, 0) +setting_bright_label = lv.label(setting_bright) setting_bright_label.set_text("屏幕调节") -setting_bright_label.add_flag(lv.obj.FLAG.CLICKABLE) -setting_bright_label.set_size(128-34, 35) -setting_bright_label.set_pos(34, setting_cont_y+5) +setting_bright.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_bright_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_bright_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_bright_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_bright.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_bright_img = lv.img(setting_cont) -setting_bright_img.set_pos(4, setting_cont_y) -setting_bright_img.set_size(set_icon_x, set_icon_y) +setting_bright_img.set_pos(0, setting_cont_y) +setting_bright_img.set_size(232, 80) setting_bright_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_bright_img.set_src("U:/static/menu_bright.png") +setting_bright_img.set_src("E:/static/setting/menu_bright.png") setting_bright_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+=35 - +setting_cont_y+=90 -setting_volume_label = lv.label(setting_cont) +setting_volume = lv.btn(setting_cont) +setting_volume.set_pos(0, setting_cont_y) +setting_volume.set_size(0, 0) +setting_volume_label = lv.label(setting_volume) setting_volume_label.set_text("铃声") -setting_volume_label.add_flag(lv.obj.FLAG.CLICKABLE) -setting_volume_label.set_size(128-34, 35) -setting_volume_label.set_pos(34, setting_cont_y+5) +setting_volume.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_volume_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_volume_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_volume_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_volume.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_volume_img = lv.img(setting_cont) -setting_volume_img.set_pos(4, setting_cont_y) -setting_volume_img.set_size(set_icon_x, set_icon_y) +setting_volume_img.set_pos(0, setting_cont_y) +setting_volume_img.set_size(232, 80) setting_volume_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_volume_img.set_src("U:/static/menu_volume.png") +setting_volume_img.set_src("E:/static/setting/menu_volume.png") setting_volume_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+=35 - - -setting_restore_label = lv.label(setting_cont) -setting_restore_label.set_text("恢复出厂") -setting_restore_label.add_flag(lv.obj.FLAG.CLICKABLE) -setting_restore_label.set_size(128-34, 35) -setting_restore_label.set_pos(34, setting_cont_y+5) +setting_cont_y+=90 + +setting_restore = lv.btn(setting_cont) +setting_restore.set_pos(0, setting_cont_y) +setting_restore.set_size(0, 0) +setting_restore_label = lv.label(setting_restore) +setting_restore_label.set_text("恢复出厂设置") +setting_restore.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_restore_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_restore_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_restore_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_restore.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_restore_img = lv.img(setting_cont) -setting_restore_img.set_pos(4, setting_cont_y) -setting_restore_img.set_size(set_icon_x, set_icon_y) +setting_restore_img.set_pos(0, setting_cont_y) +setting_restore_img.set_size(232, 80) setting_restore_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_restore_img.set_src("U:/static/menu_restore.png") +setting_restore_img.set_src("E:/static/setting/menu_restore.png") setting_restore_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+=35 - +setting_cont_y+=90 -setting_poweroff_label = lv.label(setting_cont) +setting_poweroff = lv.btn(setting_cont) +setting_poweroff.set_pos(0, setting_cont_y) +setting_poweroff.set_size(0, 0) +setting_poweroff_label = lv.label(setting_poweroff) setting_poweroff_label.set_text("关机") -setting_poweroff_label.add_flag(lv.obj.FLAG.CLICKABLE) -setting_poweroff_label.set_size(128-34, 35) -setting_poweroff_label.set_pos(34, setting_cont_y+5) +setting_poweroff.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_poweroff_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_poweroff_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_poweroff_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_poweroff.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_poweroff_img = lv.img(setting_cont) -setting_poweroff_img.set_pos(4, setting_cont_y) -setting_poweroff_img.set_size(set_icon_x, set_icon_y) +setting_poweroff_img.set_pos(0, setting_cont_y) +setting_poweroff_img.set_size(232, 80) setting_poweroff_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_poweroff_img.set_src("U:/static/menu_poweroff.png") +setting_poweroff_img.set_src("E:/static/setting/menu_poweroff.png") setting_poweroff_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+=35 - +setting_cont_y+=90 -setting_version_label = lv.label(setting_cont) +setting_version = lv.btn(setting_cont) +setting_version.set_pos(0, setting_cont_y) +setting_version.set_size(0, 0) +setting_version_label = lv.label(setting_version) setting_version_label.set_text("关于设备") -setting_version_label.add_flag(lv.obj.FLAG.CLICKABLE) -setting_version_label.set_size(128-34, 35) -setting_version_label.set_pos(34, setting_cont_y+5) +setting_version.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_version_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_version_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_version_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_version.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_version_img = lv.img(setting_cont) -setting_version_img.set_pos(4, setting_cont_y) -setting_version_img.set_size(set_icon_x, set_icon_y) +setting_version_img.set_pos(0, setting_cont_y) +setting_version_img.set_size(232, 80) setting_version_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_version_img.set_src("U:/static/menu_version.png") +setting_version_img.set_src("E:/static/setting/menu_version.png") setting_version_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -setting_cont_y+=35 - +setting_cont_y+=90 -setting_update_label = lv.label(setting_cont) +setting_update = lv.btn(setting_cont) +setting_update.set_pos(0, setting_cont_y) +setting_update.set_size(0, 0) +setting_update_label = lv.label(setting_update) setting_update_label.set_text("系统升级") -setting_update_label.add_flag(lv.obj.FLAG.CLICKABLE) -setting_update_label.set_size(128-34, 35) -setting_update_label.set_pos(34, setting_cont_y+5) +setting_update.set_style_pad_all(0, lv.STATE.DEFAULT) +setting_update_label.align(lv.ALIGN.LEFT_MID, 70, 0) setting_update_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) setting_update_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -setting_update_label_btn = lv.label(setting_cont) -setting_update_label_btn.set_text(" ") -setting_update_label_btn.add_flag(lv.obj.FLAG.CLICKABLE) -setting_update_label_btn.set_size(128, 45) -setting_update_label_btn.set_pos(0, setting_cont_y) -setting_update_label_btn.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT) -setting_update_label_btn.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - +setting_update.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT) setting_update_img = lv.img(setting_cont) -setting_update_img.set_pos(4, setting_cont_y) -setting_update_img.set_size(set_icon_x, set_icon_y) +setting_update_img.set_pos(0, setting_cont_y) +setting_update_img.set_size(232, 80) setting_update_img.add_flag(lv.obj.FLAG.CLICKABLE) -setting_update_img.set_src("U:/static/menu_upgrade.png") +setting_update_img.set_src("E:/static/setting/menu_upgrade.png") setting_update_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) class SettingScreen(Screen): @@ -265,16 +263,16 @@ class SettingScreen(Screen): super().__init__() self.meta = setting_screen # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None) - setting_dialswitch_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "dialswitch"})), lv.EVENT.CLICKED, None) + setting_dialswitch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "dialswitch"})), lv.EVENT.CLICKED, None) # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None) - setting_imei_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "imei"})), lv.EVENT.CLICKED, None) - setting_app_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "app"})), lv.EVENT.CLICKED, None) - setting_bright_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "brightness"})), lv.EVENT.CLICKED, None) - setting_volume_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "totalvolume"})), lv.EVENT.CLICKED, None) - setting_restore_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "restore"})), lv.EVENT.CLICKED, None) - setting_poweroff_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "poweroff"})), lv.EVENT.CLICKED, None) - setting_update_label_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "update"})), lv.EVENT.CLICKED, None) - setting_version_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "version"})), lv.EVENT.CLICKED, None) + setting_imei.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "imei"})), lv.EVENT.CLICKED, None) + setting_app.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "app"})), lv.EVENT.CLICKED, None) + setting_bright.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "brightness"})), lv.EVENT.CLICKED, None) + setting_volume.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "totalvolume"})), lv.EVENT.CLICKED, None) + setting_restore.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "restore"})), lv.EVENT.CLICKED, None) + setting_poweroff.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "poweroff"})), lv.EVENT.CLICKED, None) + setting_update.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "update"})), lv.EVENT.CLICKED, None) + setting_version.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "version"})), lv.EVENT.CLICKED, None) # img regist btton # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None) @@ -344,16 +342,16 @@ dialswitch_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) dialswitch_title = lv.label(dialswitch_screen) -dialswitch_title.set_pos(0, 5) -dialswitch_title.set_size(120, 20) +dialswitch_title.set_pos(0, 10) +dialswitch_title.set_size(240, 40) dialswitch_title.set_text("表盘切换") dialswitch_title.set_long_mode(lv.label.LONG.WRAP) dialswitch_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) dialswitch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) dialswitch_img1 = lv.img(dialswitch_screen)#表盘预览图 -dialswitch_img1.set_pos(27, 30) -dialswitch_img1.set_size(70, 70) +dialswitch_img1.set_pos(50, 60) +dialswitch_img1.set_size(140, 172) dialswitch_img1.set_src("U:/static/DIAL_PREV01.png") dialswitch_img1.add_flag(lv.obj.FLAG.CLICKABLE) dialswitch_img1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -362,22 +360,22 @@ dialswitch_img1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) dialswitch_btn1_label = lv.label(dialswitch_screen)#显示表盘1 表盘2 dialswitch_btn1_label.set_text(" ") -dialswitch_btn1_label.align(lv.ALIGN.TOP_MID, 0, 104) +dialswitch_btn1_label.align(lv.ALIGN.TOP_MID, 0, 260) dialswitch_btn1_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -# dialswitch_butoom_crcile1 = lv.img(dialswitch_screen)#底部显示圆点 -# dialswitch_butoom_crcile1.set_pos(95, 300) -# dialswitch_butoom_crcile1.set_size(10, 10) -# dialswitch_butoom_crcile1.set_src("U:/static/point_white.png") -# dialswitch_butoom_crcile1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +dialswitch_butoom_crcile1 = lv.img(dialswitch_screen)#底部显示圆点 +dialswitch_butoom_crcile1.set_pos(95, 300) +dialswitch_butoom_crcile1.set_size(10, 10) +dialswitch_butoom_crcile1.set_src("E:/static/point_white.png") +dialswitch_butoom_crcile1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -# dialswitch_butoom_crcile2 = lv.img(dialswitch_screen)#底部显示圆点 -# dialswitch_butoom_crcile2.set_pos(140, 300) -# dialswitch_butoom_crcile2.set_size(10, 10) -# dialswitch_butoom_crcile2.set_src("U:/static/point_black.png") -# dialswitch_butoom_crcile2.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) +dialswitch_butoom_crcile2 = lv.img(dialswitch_screen)#底部显示圆点 +dialswitch_butoom_crcile2.set_pos(140, 300) +dialswitch_butoom_crcile2.set_size(10, 10) +dialswitch_butoom_crcile2.set_src("E:/static/point_black.png") +dialswitch_butoom_crcile2.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) # dialswitch_btn2 = lv.btn(dialswitch_screen) # dialswitch_btn2.set_size(240,54) @@ -458,11 +456,6 @@ menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB # -------------------------------------------app screen---------------------------------------------------------- -style_font_youyuan_20_default = lv.style_t() -style_font_youyuan_20_default.init() -style_font_youyuan_20_default.set_text_color(lv.color_make(0xff, 0xff, 0xff)) -# style_font_youyuan_20_black.set_text_font(lv.K01_font_16_ALL) - #app_screen = lv.obj() app_screen = lv.obj() print("app_screen") @@ -471,28 +464,27 @@ app_screen.set_size(240, 320) app_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) app_img = lv.img(app_screen) -app_img.set_pos(int(24),int(5)) -app_img.set_size(80,80) +app_img.set_pos(int(20),int(40)) +app_img.set_size(200,200) app_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) app_img.add_flag(lv.obj.FLAG.CLICKABLE) -app_img.set_src("U:/static/IMAGE_APP_QR_CODE.png") +app_img.set_src("E:/static/IMAGE_APP_QR_CODE.png") app_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) # app_qr = lv.qrcode(imei, 150, fg_color, bg_color) # app_qr.center() # Add a border with bg_color - # app_qr.set_style_border_color(bg_color, 0) # app_qr.set_style_border_width(5, 0) # app_qr_data = str("https://fangzoudiu.xcloudtech.com/xiao_jian") # app_qr.update(app_qr_data,len(app_qr_data)) app_label = lv.label(app_screen) -app_label.set_pos(0, 90) -app_label.set_size(128, 38) +app_label.set_pos(0, 280) +app_label.set_size(240, 20) app_label.set_text(" ") app_label.set_long_mode(lv.label.LONG.WRAP) app_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -app_label.add_style(style_font_youyuan_20_default, lv.PART.MAIN | lv.STATE.DEFAULT) +app_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) # -------------------------------------------volume screen---------------------------------------------------------- @@ -564,16 +556,16 @@ phonering_reduce_imgbtn = lv.img(phonering_screen) phonering_reduce_imgbtn.set_pos(0, 150) phonering_reduce_imgbtn.set_size(110, 46) phonering_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -phonering_reduce_imgbtn.set_src("U:/static/reduce_btn.png") +phonering_reduce_imgbtn.set_src("E:/static/reduce_btn.png") phonering_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) phonering_add_imgbtn = lv.img(phonering_screen) phonering_add_imgbtn.set_pos(120, 150) -phonering_add_imgbtn.set_size(55, 23) +phonering_add_imgbtn.set_size(110, 46) phonering_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -phonering_add_imgbtn.set_src("U:/static/add_btn.png") +phonering_add_imgbtn.set_src("E:/static/add_btn.png") phonering_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -613,17 +605,17 @@ alarmvolume_reduce_imgbtn.set_pos(5, 150) alarmvolume_reduce_imgbtn.set_size(110, 46) alarmvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -alarmvolume_reduce_imgbtn.set_src("U:/static/reduce_btn.png") +alarmvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png") alarmvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) alarmvolume_add_imgbtn = lv.img(alarmvolume_screen) alarmvolume_add_imgbtn.set_pos(125, 150) -alarmvolume_add_imgbtn.set_size(55, 23) +alarmvolume_add_imgbtn.set_size(110, 46) alarmvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -alarmvolume_add_imgbtn.set_src("U:/static/add_btn.png") +alarmvolume_add_imgbtn.set_src("E:/static/add_btn.png") alarmvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -663,17 +655,17 @@ msgvolume_reduce_imgbtn.set_pos(5, 150) msgvolume_reduce_imgbtn.set_size(110, 46) msgvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -msgvolume_reduce_imgbtn.set_src("U:/static/reduce_btn.png") +msgvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png") msgvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) msgvolume_add_imgbtn = lv.img(msgvolume_screen) msgvolume_add_imgbtn.set_pos(125, 150) -msgvolume_add_imgbtn.set_size(55, 23) +msgvolume_add_imgbtn.set_size(110, 46) msgvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -msgvolume_add_imgbtn.set_src("U:/static/add_btn.png") +msgvolume_add_imgbtn.set_src("E:/static/add_btn.png") msgvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -684,8 +676,8 @@ print("restore_screen") restore_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) restore_label = lv.label(restore_screen) -restore_label.set_pos(0, 20) -restore_label.set_size(128, 20) +restore_label.set_pos(0, 100) +restore_label.set_size(240, 40) restore_label.set_text("恢复出厂设置?") restore_label.set_long_mode(lv.label.LONG.WRAP) restore_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) @@ -694,28 +686,28 @@ restore_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) restore_confirm_label = lv.label(restore_screen) restore_confirm_label.set_text("确认") restore_confirm_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -restore_confirm_label.set_size(64, 20) -restore_confirm_label.set_pos(0,60) +restore_confirm_label.set_size(120, 60) +restore_confirm_label.set_pos(0,180) restore_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) restore_confirm = lv.label(restore_screen) restore_confirm.set_text(" ") -restore_confirm.set_size(64, 40) -restore_confirm.set_pos(0,60) +restore_confirm.set_size(120, 80) +restore_confirm.set_pos(0,160) restore_confirm.add_flag(lv.obj.FLAG.CLICKABLE) restore_cancel_label = lv.label(restore_screen) restore_cancel_label.set_text("返回") -restore_cancel_label.set_size(64, 20) +restore_cancel_label.set_size(120, 60) restore_cancel_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -restore_cancel_label.set_pos(64,60) +restore_cancel_label.set_pos(120,180) restore_cancel_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) restore_cancel = lv.label(restore_screen) restore_cancel.set_text(" ") -restore_cancel.set_size(64, 40) -restore_cancel.set_pos(64,60) +restore_cancel.set_size(120, 80) +restore_cancel.set_pos(120,160) restore_cancel.add_flag(lv.obj.FLAG.CLICKABLE) @@ -726,7 +718,7 @@ restore_cancel.add_flag(lv.obj.FLAG.CLICKABLE) version_screen = lv.obj() print("version_screen") version_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) -version_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + version_msg = "Software Version:\n\ MMI\n\ Version:UIX8910_C55_V\n\ @@ -739,37 +731,37 @@ IMEI:\n\ import versions version_label1 = lv.label(version_screen) -version_label1.set_pos(0, 5) -version_label1.set_size(128, 40) +version_label1.set_pos(10, 30) +version_label1.set_size(230, 30) version_label1.set_long_mode(lv.label.LONG.WRAP) -version_label1.set_text("Software Version:") -version_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +version_label1.set_text("产品名称:") +version_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) version_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -version_label2 = lv.label(version_screen) -version_label2.set_pos(0, 45) -version_label2.set_size(128, 20) -version_label2.set_long_mode(lv.label.LONG.WRAP) -version_label2.set_text("Python Lvgl") -version_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -version_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# version_label2 = lv.label(version_screen) +# version_label2.set_pos(0, 60) +# version_label2.set_size(240, 30) +# version_label2.set_long_mode(lv.label.LONG.WRAP) +# version_label2.set_text("Python Lvgl") +# version_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# version_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -version_label3 = lv.label(version_screen) -version_label3.set_pos(0, 65) -version_label3.set_size(128, 20) -version_label3.set_long_mode(lv.label.LONG.WRAP) -version_label3.set_text("Version:") -version_label3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -version_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# version_label3 = lv.label(version_screen) +# version_label3.set_pos(0, 90) +# version_label3.set_size(240, 30) +# version_label3.set_long_mode(lv.label.LONG.WRAP) +# version_label3.set_text("Version:") +# version_label3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# version_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) version_label3 = lv.label(version_screen) -version_label3.set_pos(0, 90) -version_label3.set_size(128, 20) +version_label3.set_pos(10, 70) +version_label3.set_size(230, 30) version_label3.set_long_mode(lv.label.LONG.WRAP) version_label3.set_text(versions.Version) -version_label3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -version_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +version_label3.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) +version_label3.add_style(style_font_youyuan_20_gray, lv.PART.MAIN | lv.STATE.DEFAULT) # version_label4 = lv.label(version_screen) # version_label4.set_pos(0, version_label_y) @@ -780,20 +772,20 @@ version_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) # version_label4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) version_label5 = lv.label(version_screen) -version_label5.set_pos(0, 115) -version_label5.set_size(128, 20) +version_label5.set_pos(10, 120) +version_label5.set_size(230, 30) version_label5.set_long_mode(lv.label.LONG.WRAP) -version_label5.set_text("Build Time:") -version_label5.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +version_label5.set_text("软件版本:") +version_label5.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) version_label5.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) version_label6 = lv.label(version_screen) -version_label6.set_pos(0, 140) -version_label6.set_size(128, 40) +version_label6.set_pos(10, 160) +version_label6.set_size(230, 60) version_label6.set_long_mode(lv.label.LONG.WRAP) version_label6.set_text(versions.Build_Time) -version_label6.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -version_label6.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +version_label6.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) +version_label6.add_style(style_font_youyuan_20_gray, lv.PART.MAIN | lv.STATE.DEFAULT) # version_label7 = lv.label(version_screen) # version_label7.set_pos(0, 210) @@ -803,20 +795,21 @@ version_label6.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) # version_label7.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) # version_label7.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -version_label8 = lv.label(version_screen) -version_label8.set_pos(0, 180) -version_label8.set_size(128, 20) -version_label8.set_long_mode(lv.label.LONG.WRAP) -version_label8.set_text("IMEI:") -version_label8.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -version_label8.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# version_label8 = lv.label(version_screen) +# version_label8.set_pos(0, 210) +# version_label8.set_size(240, 30) +# version_label8.set_long_mode(lv.label.LONG.WRAP) +# version_label8.set_text("IMEI:") +# version_label8.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# version_label8.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -version_label9 = lv.label(version_screen) -version_label9.set_pos(0, 200) -version_label9.set_size(128, 38) -version_label9.set_text(" ") -version_label9.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -version_label9.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# version_label9 = lv.label(version_screen) +# version_label9.set_pos(0, 240) +# version_label9.set_size(240, 30) +# version_label9.set_long_mode(lv.label.LONG.WRAP) +# version_label9.set_text(" ") +# version_label9.set_style_text_align(lv.TEXT_ALIGN.LEF, 0) +# version_label9.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -827,24 +820,24 @@ update_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) update_title = lv.label(update_screen) update_title.set_pos(0, 10) -update_title.set_size(128, 20) +update_title.set_size(240, 40) update_title.set_text("系统更新") update_title.set_long_mode(lv.label.LONG.WRAP) update_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) update_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) update_label = lv.label(update_screen) -update_label.set_text("已经是最新版本") +update_label.set_text(" 已经是最新版本") update_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -update_label.set_size(128, 20) -update_label.set_pos(0,40) +update_label.set_size(240, 50) +update_label.set_pos(0,50) update_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) update_return = lv.label(update_screen) update_return.set_text("返回") -update_return.set_size(128, 40) +update_return.set_size(240, 40) update_return.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -update_return.set_pos(0,70) +update_return.set_pos(0,240) update_return.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) update_return.add_flag(lv.obj.FLAG.CLICKABLE) @@ -860,6 +853,7 @@ class RestoreScreen(Screen): def confirm(self, e): EventMesh.publish("load_screen", {"screen": "restore_confirm"}) + def concel(self, e): EventMesh.publish("load_screen", {"screen": "setting"}) @@ -906,8 +900,7 @@ class VersionScreen(Screen): self.btn_count = 0 def initialization(self): imei = EventMesh.publish(constants.EVENT.GET_IMEI) - print("imei",imei) - version_label9.set_text("{}".format(imei)) + # version_label9.set_text(imei) def Close(self): self.btn_count = 0 @@ -938,63 +931,55 @@ print("poweroff_screen") poweroff_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) poweroff_img = lv.img(poweroff_screen) -poweroff_img.set_pos(49, 5) -poweroff_img.set_size(30, 30) +poweroff_img.set_pos(100, 30) +poweroff_img.set_size(61, 61) poweroff_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -poweroff_img.set_src("U:/static/poweroff_icon.png") +poweroff_img.set_src("E:/static/poweroff_icon.png") poweroff_label = lv.label(poweroff_screen) poweroff_label.set_text("是否关机?") poweroff_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -poweroff_label.set_size(128, 20) -poweroff_label.set_pos(0,40) +poweroff_label.set_size(240, 20) +poweroff_label.set_pos(0,120) poweroff_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) poweroff_confirm_img = lv.img(poweroff_screen) -poweroff_confirm_img.set_size(88, 23) -poweroff_confirm_img.set_pos(24, 65) -poweroff_confirm_img.set_src("U:/static/off_icon.png") +poweroff_confirm_img.set_size(176, 46) +poweroff_confirm_img.set_pos(32, 160) +poweroff_confirm_img.set_src("E:/static/off_icon.png") +poweroff_confirm_img.add_flag(lv.obj.FLAG.CLICKABLE) poweroff_confirm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) -poweroff_confirm_imgbtn = lv.img(poweroff_screen) -poweroff_confirm_imgbtn.set_size(128, 35) -poweroff_confirm_imgbtn.set_pos(0, 60) -poweroff_confirm_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -poweroff_confirm_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - - poweroff_confirm_label = lv.label(poweroff_confirm_img) poweroff_confirm_label.set_text("关机") -poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 0) +poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 5) poweroff_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) poweroff_return = lv.img(poweroff_screen) -poweroff_return.set_size(88, 23) -poweroff_return.set_pos(24, 100) -poweroff_return.set_src("U:/static/cancel_icon.png") +poweroff_return.set_size(176, 46) +poweroff_return.set_pos(32, 240) +poweroff_return.set_src("E:/static/cancel_icon.png") +poweroff_return.add_flag(lv.obj.FLAG.CLICKABLE) poweroff_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -poweroff_return_btn = lv.img(poweroff_screen) -poweroff_return_btn.set_size(128, 33) -poweroff_return_btn.set_pos(0, 95) -poweroff_return_btn.add_flag(lv.obj.FLAG.CLICKABLE) -poweroff_return_btn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - poweroff_return_label = lv.label(poweroff_return) poweroff_return_label.set_text("返回") -poweroff_return_label.align(lv.ALIGN.CENTER, 0, 0) +poweroff_return_label.align(lv.ALIGN.CENTER, 0, 5) poweroff_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) poweroff_return.set_ext_click_area(20) + + + + class PoweroffScreen(Screen): NAME = "poweroff" def __init__(self): super().__init__() self.meta = poweroff_screen - poweroff_confirm_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None) - poweroff_return_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None) + poweroff_confirm_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None) + poweroff_return.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None) def initialization(self): pass @@ -1003,7 +988,9 @@ class PoweroffScreen(Screen): EventMesh.publish("load_screen", {"screen": "setting"}) def confirm(self, e): - EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) + EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) + #EventMesh.publish("load_screen", {"screen": "no_sim_power_screen"}) + def concel(self, e): EventMesh.publish("load_screen", {"screen": "setting"}) @@ -1015,58 +1002,6 @@ class PoweroffScreen(Screen): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) - - -poweroff_confirm_screen = lv.obj() -print("poweroff_confirm_screen") -poweroff_confirm_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - -poweroff_confirm_label = lv.label(poweroff_confirm_screen) -poweroff_confirm_label.set_text("Goodbye") -poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 0) -poweroff_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) - -import utime -class PoweroffConfirmScreen(Screen): - NAME = "poweroff_comfirm" - - def __init__(self): - super().__init__() - self.meta = poweroff_confirm_screen - self.timer = osTimer() - self.aud = audio.Audio(0) - - - def initialization(self): - step = EventMesh.publish("get_old_step_value") - if step != 0: - EventMesh.publish("set_storage_config",["old_step",step]) - - date_tmp = utime.localtime() - time_tmp = utime.mktime(date_tmp) - EventMesh.publish("set_storage_config",["old_time",time_tmp])#关机保存一个是时间 - self.count = 0 - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') #文件名前面要加上路径 - self.timer.start(1*1000,1,self.power_off) - - def power_off(self,*args): - self.count+=1 - EventMesh.publish("system_sleep_rest")#防止黑屏 - # print("power off!!!!!!!",self.count) - if self.count > 5:#在上一个界面在播放音频时切换界面则关闭 以免一直播放 - self.count = 0 - self.timer.stop() - Power.powerDown() - - def done_return(self): - pass - - def btn1_release(self): - pass - - def btn8_press(self): - pass - poweron_screen = lv.obj() print("poweron_screen") poweron_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -1074,22 +1009,20 @@ poweron_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) poweron_label = lv.label(poweron_screen) poweron_label.set_text("WELCOME") poweron_label.align(lv.ALIGN.CENTER, 0, 0) -poweron_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +poweron_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) class PowerOnScreen(Screen): NAME = "poweron" def __init__(self): super().__init__() self.meta = poweron_screen - self.timer1 = osTimer() - self.timer2 = osTimer() + self.timer = osTimer() self.aud = audio.Audio(0) self.aud.set_pa(Pin.GPIO29) self.volum_size = 8 check_volum = EventMesh.publish("get_storage_config","volum") - if check_volum != None: - self.volum_size = check_volum + self.volum_size = check_volum self.aud.setVolume(self.volum_size) @@ -1097,22 +1030,26 @@ class PowerOnScreen(Screen): def initialization(self): self.count = 0 - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') #播放开机铃声 - self.timer1.start(1000,1,self.fun) - self.timer2.start(4000,0,self.open_fun) - + self.aud.setVolume(11) + self.timer.start(1000,1,self.fun) pass def fun(self,*argc): EventMesh.publish("system_sleep_rest")#防止黑屏 - - def open_fun(self,*argc): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - + if self.count == 0: + self.aud.play(1, 1, 'E:/static/R_POWER_1.mp3') #播放来电铃声 + else: + play_state = EventMesh.publish("get_audio_state")#音频播放状态 + if play_state != None: + if self.count >= 9:#在上一个界面在播放音频时切换界面则关闭 以免一直播放 + self.count = 0 + self.timer.stop() + EventMesh.publish("load_screen", {"screen": "main_menu"}) + return + self.count+=1 def Close(self): - self.timer1.stop() - self.timer2.stop() + self.timer.stop() self.aud.setVolume(self.volum_size) pass def done_return(self): @@ -1124,6 +1061,58 @@ class PowerOnScreen(Screen): def btn8_press(self): pass +poweroff_confirm_screen = lv.obj() +print("poweroff_confirm_screen") +poweroff_confirm_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + +poweroff_confirm_label = lv.label(poweroff_confirm_screen) +poweroff_confirm_label.set_text("Goodbye") +poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 0) +poweroff_confirm_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT) + +import utime +class PoweroffConfirmScreen(Screen): + NAME = "poweroff_comfirm" + + def __init__(self): + super().__init__() + self.meta = poweroff_confirm_screen + self.timer = osTimer() + self.count = 0 + + def initialization(self): + step = EventMesh.publish("get_old_step_value") + if step != 0: + EventMesh.publish("set_storage_config",["old_step",step]) + + date_tmp = utime.localtime() + time_tmp = utime.mktime(date_tmp) + EventMesh.publish("set_storage_config",["old_time",time_tmp])#关机保存一个是时间 + + #print("self.read_data:{}".format(self.read_data)) + EventMesh.publish("play_poewr_off_event")# + self.count = 0 + self.timer.start(1*1000,1,self.power_off) + + def power_off(self,*args): + self.count+=1 + EventMesh.publish("system_sleep_rest")#防止黑屏 + play_state = EventMesh.publish("get_audio_state")#音频播放状态 + if play_state != None: + # print("power off!!!!!!!",self.count) + if self.count > 5:#在上一个界面在播放音频时切换界面则关闭 以免一直播放 + self.count = 0 + self.timer.stop() + Power.powerDown() + + def done_return(self): + pass + + def btn1_release(self): + pass + + def btn8_press(self): + pass from common import Abstract class TimePoweroffScreen(Abstract): @@ -1131,7 +1120,7 @@ class TimePoweroffScreen(Abstract): def __init__(self): super().__init__() self.power_off_flag = 0 - self.read_data = {} + EventMesh.subscribe("get_time_power_off", self.get_time_power_off) EventMesh.subscribe("power_off_callback", self.power_off_callback) EventMesh.subscribe("set_time_power_off", self.set_time_power_off) @@ -1156,11 +1145,8 @@ class TimePoweroffScreen(Abstract): self.power_off_flag = 0 def set_time_power_off(self,event,msg): - self.read_data = EventMesh.publish("get_storage_data") - if self.read_data != {}: - b = str("off_on") in self.read_data().keys() - if b == True: - pass + + pass @@ -1197,7 +1183,6 @@ class DialswitchScreen(Screen): def __init__(self): super().__init__() self.meta = dialswitch_screen - self.read_data = {} self.watchface_style_num = "Watchface1" dialswitch_img1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.watchface01(e)), lv.EVENT.CLICKED, None) @@ -1208,11 +1193,10 @@ class DialswitchScreen(Screen): def initialization(self): self.dial_num = 1 self.move = 0 - self.read_data = EventMesh.publish("get_storage_data") - if self.read_data != {}: - b = str("watchface") in self.read_data.keys() - if b == True: - self.watchface_style_num = self.read_data["watchface"] + read_data = EventMesh.publish("get_storage_config","watchface") + + if read_data != None: + self.watchface_style_num = read_data if self.watchface_style_num == "Watchface1": self.dial_num = 1 else: @@ -1223,12 +1207,11 @@ class DialswitchScreen(Screen): def watchface01(self,e): code = e.get_code() - # if code == lv.EVENT.CLICKED: - # self.timer.start(50,0,self.enter_main_show) - self.enter_main_show(0) + if code == lv.EVENT.CLICKED: + self.timer.start(50,0,self.enter_main_show) def enter_main_show(self,e): - self.dial_num = 1 + EventMesh.publish("set_storage_config",["watchface","Watchface{}".format(self.dial_num)]) EventMesh.publish("set_change_face", "Watchface{}".format(self.dial_num)) EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1238,49 +1221,41 @@ class DialswitchScreen(Screen): EventMesh.publish("load_screen", {"screen": "setting"}) def done_left_to_right(self):#右滑 - pass #print("done_left_to_right!!!!!!!!!") - # self.move = 1 - # if self.dial_num > 1: - # self.dial_num-=1 - # else: - # self.dial_num = 2 - # self.timer.stop() - # self.show_info() + self.move = 1 + if self.dial_num > 1: + self.dial_num-=1 + else: + self.dial_num = 2 + self.timer.stop() + self.show_info() def done_right_to_left(self):#左滑 - pass #print("done_right_to_left!!!!!!!!!") - # self.move = 2 - # self.dial_num+=1 - # if self.dial_num > 2: - # self.dial_num = 1 - # self.show_info() - # self.timer.stop() + self.move = 2 + self.dial_num+=1 + if self.dial_num > 2: + self.dial_num = 1 + self.show_info() + self.timer.stop() def done_bottom_to_top(self): - pass - # self.move = 3 - # self.timer.stop() + self.move = 3 + self.timer.stop() def done_top_to_bottom(self): - pass - # self.move = 4 - # self.timer.stop() + self.move = 4 + self.timer.stop() def show_info(self): - dialswitch_img1.set_src("U:/static/DIAL_PREV01.png") - dialswitch_btn1_label.set_text("表盘1") - # dialswitch_img1.set_src("U:/static/DIAL_PREV01.png".format(self.dial_num)) - # dialswitch_btn1_label.set_text("表盘{}".format(self.dial_num)) - # if(self.dial_num == 1): - # pass - # # dialswitch_butoom_crcile1.set_src("U:/static/point_white.png") - # # dialswitch_butoom_crcile2.set_src("U:/static/point_black.png") - # else: - # pass - # dialswitch_butoom_crcile1.set_src("U:/static/point_black.png") - # dialswitch_butoom_crcile2.set_src("U:/static/point_white.png") + dialswitch_img1.set_src("U:/static/DIAL_PREV0{}.png".format(self.dial_num)) + dialswitch_btn1_label.set_text("表盘{}".format(self.dial_num)) + if(self.dial_num == 1): + dialswitch_butoom_crcile1.set_src("E:/static/point_white.png") + dialswitch_butoom_crcile2.set_src("E:/static/point_black.png") + else: + dialswitch_butoom_crcile1.set_src("E:/static/point_black.png") + dialswitch_butoom_crcile2.set_src("E:/static/point_white.png") def Close(self): self.timer.stop() @@ -1333,20 +1308,20 @@ imei_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5) fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4) -imei_qr = lv.qrcode(imei_screen, 80, fg_color, bg_color) -imei_qr.set_pos(24, 4) +imei_qr = lv.qrcode(imei_screen, 150, fg_color, bg_color) +imei_qr.center() # Add a border with bg_color imei_qr.set_style_border_color(bg_color, 0) -imei_qr.set_style_border_width(2, 0) +imei_qr.set_style_border_width(5, 0) imei_label = lv.label(imei_screen) -imei_label.set_pos(0, 90) -imei_label.set_size(128, 38) +imei_label.set_pos(0, 280) +imei_label.set_size(240, 20) imei_label.set_text(" ") imei_label.set_long_mode(lv.label.LONG.WRAP) imei_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -imei_label.add_style(style_font_youyuan_20_default, lv.PART.MAIN | lv.STATE.DEFAULT) +imei_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) class ImeiScreen(Screen): NAME = "imei" @@ -1398,24 +1373,24 @@ brightness_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_title = lv.label(brightness_screen) -brightness_title.set_pos(0, 5) -brightness_title.set_size(120, 20) +brightness_title.set_pos(0, 10) +brightness_title.set_size(240, 40) brightness_title.set_text("屏幕调节") brightness_title.set_long_mode(lv.label.LONG.WRAP) brightness_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) brightness_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_label1 = lv.label(brightness_screen) -brightness_label1.set_pos(5, 30) -brightness_label1.set_size(128-5, 20) +brightness_label1.set_pos(10, 70) +brightness_label1.set_size(230, 40) brightness_label1.set_text("亮度:") brightness_label1.set_long_mode(lv.label.LONG.WRAP) brightness_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) brightness_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_bar = lv.bar(brightness_screen) -brightness_bar.set_pos(10, 55) -brightness_bar.set_size(108, 12) +brightness_bar.set_pos(20, 100) +brightness_bar.set_size(200, 25) brightness_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT) brightness_bar.set_mode(lv.bar.MODE.NORMAL) brightness_bar.set_value(50, lv.ANIM.OFF) @@ -1423,59 +1398,76 @@ brightness_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT) brightness_reduce_imgbtn = lv.img(brightness_screen) -brightness_reduce_imgbtn.set_pos(6, 70) -brightness_reduce_imgbtn.set_size(55, 23) +brightness_reduce_imgbtn.set_pos(5, 195) +brightness_reduce_imgbtn.set_size(110, 46) brightness_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -brightness_reduce_imgbtn.set_src("U:/static/reduce_btn.png") +brightness_reduce_imgbtn.set_src("E:/static/reduce_btn.png") brightness_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_add_imgbtn = lv.img(brightness_screen) -brightness_add_imgbtn.set_pos(67, 70) -brightness_add_imgbtn.set_size(55, 23) +brightness_add_imgbtn.set_pos(125, 195) +brightness_add_imgbtn.set_size(110, 46) brightness_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -brightness_add_imgbtn.set_src("U:/static/add_btn.png") +brightness_add_imgbtn.set_src("E:/static/add_btn.png") brightness_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_label_time = lv.label(brightness_screen) -brightness_label_time.set_pos(5, 97) -brightness_label_time.set_size(45, 20) +brightness_label_time.set_pos(10, 150) +brightness_label_time.set_size(80, 30) brightness_label_time.set_text("时间:") brightness_label_time.set_long_mode(lv.label.LONG.WRAP) brightness_label_time.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) brightness_label_time.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_time_reduce_img = lv.img(brightness_screen) -brightness_time_reduce_img.set_pos(50, 97) -brightness_time_reduce_img.set_size(15, 17) -brightness_time_reduce_img.set_src("U:/static/time_up2.png") +brightness_time_reduce_img.set_pos(90, 145) +brightness_time_reduce_img.set_size(30, 34) +brightness_time_reduce_img.set_src("E:/static/time_up2.png") brightness_time_reduce_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_time_reduce_imgbtn= lv.img(brightness_screen) -brightness_time_reduce_imgbtn.set_size(49, 32) -brightness_time_reduce_imgbtn.set_pos(79, 96) +brightness_time_reduce_imgbtn.set_size(80, 45) +brightness_time_reduce_imgbtn.set_pos(90, 140) brightness_time_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) brightness_label_time_text = lv.label(brightness_screen) -brightness_label_time_text.set_pos(65, 98) -brightness_label_time_text.set_size(45, 20) -brightness_label_time_text.set_text("5s") +brightness_label_time_text.set_pos(130, 152) +brightness_label_time_text.set_size(60, 30) +brightness_label_time_text.set_text("5秒") brightness_label_time_text.set_long_mode(lv.label.LONG.WRAP) -brightness_label_time_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +brightness_label_time_text.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) brightness_label_time_text.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_time_add_img = lv.img(brightness_screen) -brightness_time_add_img.set_pos(110, 97) -brightness_time_add_img.set_size(15, 17) -brightness_time_add_img.set_src("U:/static/time_up1.png") +brightness_time_add_img.set_pos(190, 145) +brightness_time_add_img.set_size(30, 34) +brightness_time_add_img.set_src("E:/static/time_up1.png") brightness_time_add_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) brightness_time_add_imgbtn= lv.img(brightness_screen) -brightness_time_add_imgbtn.set_size(49, 32) -brightness_time_add_imgbtn.set_pos(30, 96) +brightness_time_add_imgbtn.set_size(70, 45) +brightness_time_add_imgbtn.set_pos(170, 140) brightness_time_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) +brightness_flip_label = lv.label(brightness_screen) +brightness_flip_label.set_pos(0, 270) +brightness_flip_label.set_size(140, 40) +brightness_flip_label.set_text("翻腕亮屏") +#brightness_flip_label.set_long_mode(lv.label.LONG.WRAP) +brightness_flip_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) +brightness_flip_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +brightness_flip_sw = lv.switch(brightness_screen) +brightness_flip_sw.set_pos(140, 260) +brightness_flip_sw.set_size(80, 40) + +brightness_flip_label_btn = lv.label(brightness_screen) +brightness_flip_label_btn.set_pos(135, 255) +brightness_flip_label_btn.set_size(105, 65) +brightness_flip_label_btn.set_text(" ") +brightness_flip_label_btn.add_flag(lv.obj.FLAG.CLICKABLE) + class BrightnessScreen(Screen): @@ -1483,20 +1475,21 @@ class BrightnessScreen(Screen): def __init__(self): super().__init__() - self.level = 2 + self.level = 6 self.time = 10 - self.read_data = {} + self.flip_sw =0 self.meta = brightness_screen brightness_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)), lv.EVENT.CLICKED, None) brightness_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_level(e)), lv.EVENT.CLICKED, None) - brightness_time_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_time_level(e)), + brightness_time_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_time_level(e)), lv.EVENT.CLICKED, None) - brightness_time_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_time_level(e)), + brightness_time_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_time_level(e)), lv.EVENT.CLICKED, None) + brightness_flip_label_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.flip_sw_cb(e)),lv.EVENT.CLICKED, None) def initialization(self): self.level = EventMesh.publish("get_brightness_level") self.time = EventMesh.publish("get_brightness_time") @@ -1504,11 +1497,18 @@ class BrightnessScreen(Screen): if self.time == None: self.time = 5 brightness_label_time_text.set_text("{}秒".format(self.time)) + EventMesh.publish("get_storage_config","flip_sw") + if self.flip_sw == None: + self.flip_sw = 0 + if self.flip_sw == 0: + brightness_flip_sw.clear_state(lv.STATE.CHECKED) + else: + brightness_flip_sw.add_state(lv.STATE.CHECKED) self.show_bar() def add_level(self, e): EventMesh.publish("push_add_brightness_level") self.level = EventMesh.publish("get_brightness_level") - # print("self.level:{}".format(self.level)) + print("self.level:{}".format(self.level)) self.show_bar() def reduce_level(self, e): @@ -1516,27 +1516,41 @@ class BrightnessScreen(Screen): self.level = EventMesh.publish("get_brightness_level") self.show_bar() + def flip_sw_cb(self,e): + code = e.get_code() + obj = e.get_target() + if code == lv.EVENT.CLICKED: + if self.flip_sw == 0: + self.flip_sw = 1 + brightness_flip_sw.add_state(lv.STATE.CHECKED) + else: + self.flip_sw = 0 + brightness_flip_sw.clear_state(lv.STATE.CHECKED) + # print("self.flip_sw:",self.flip_sw) + EventMesh.publish("set_storage_config",["flip_sw",self.flip_sw]) + def reduce_time_level(self, e): if self.time > 5: self.time-=5 EventMesh.publish("set_brightness_time",self.time) brightness_label_time_text.set_text("{}秒".format(self.time)) - # print("reduce_time_level:{}".format(self.read_data)) + + def add_time_level(self, e): self.time+=5 if self.time >= 30: self.time = 30 EventMesh.publish("set_brightness_time",self.time) brightness_label_time_text.set_text("{}秒".format(self.time)) - # print("add_time_level:{}".format(self.read_data)) + def show_bar(self): if self.level == None: - self.level = 2 - brightness_bar.set_value((100 // 10) * self.level,lv.ANIM.OFF) + self.level = 6 + brightness_bar.set_value((100 // 10) * self.level, lv.ANIM.OFF) @@ -1577,7 +1591,7 @@ class PhoneringScreen(Screen): def __init__(self): super().__init__() - self.level = 2 + self.level = 0 self.meta = phonering_screen phonering_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)), lv.EVENT.CLICKED, None) @@ -1624,7 +1638,7 @@ class AlarmvolumeScreen(Screen): def __init__(self): super().__init__() - self.level = 2 + self.level = 0 self.meta = alarmvolume_screen alarmvolume_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)), lv.EVENT.CLICKED, None) @@ -1664,7 +1678,7 @@ class MsgvolumeScreen(Screen): def __init__(self): super().__init__() - self.level = 2 + self.level = 0 self.meta = msgvolume_screen msgvolume_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)), lv.EVENT.CLICKED, None) @@ -1706,24 +1720,24 @@ print("volume_adjust_screen") volume_adjust_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) totalvolume_title = lv.label(volume_adjust_screen) -totalvolume_title.set_pos(0, 5) -totalvolume_title.set_size(128, 20) +totalvolume_title.set_pos(0, 10) +totalvolume_title.set_size(240, 40) totalvolume_title.set_text("铃声调节") totalvolume_title.set_long_mode(lv.label.LONG.WRAP) totalvolume_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) totalvolume_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) totalvolume_label1 = lv.label(volume_adjust_screen) -totalvolume_label1.set_pos(5, 30) -totalvolume_label1.set_size(128-5, 20) +totalvolume_label1.set_pos(10, 70) +totalvolume_label1.set_size(230, 40) totalvolume_label1.set_text("铃声:") totalvolume_label1.set_long_mode(lv.label.LONG.WRAP) totalvolume_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) totalvolume_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) totalvolume_bar = lv.bar(volume_adjust_screen) -totalvolume_bar.set_pos(10, 55) -totalvolume_bar.set_size(108, 12) +totalvolume_bar.set_pos(20, 100) +totalvolume_bar.set_size(200, 25) totalvolume_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT) totalvolume_bar.set_mode(lv.bar.MODE.NORMAL) totalvolume_bar.set_value(50, lv.ANIM.OFF) @@ -1731,18 +1745,18 @@ totalvolume_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT) totalvolume_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT) totalvolume_reduce_imgbtn = lv.img(volume_adjust_screen) -totalvolume_reduce_imgbtn.set_pos(6, 70) -totalvolume_reduce_imgbtn.set_size(55, 23) +totalvolume_reduce_imgbtn.set_pos(5, 145) +totalvolume_reduce_imgbtn.set_size(110, 46) totalvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -totalvolume_reduce_imgbtn.set_src("U:/static/reduce_btn.png") +totalvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png") totalvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) totalvolume_add_imgbtn = lv.img(volume_adjust_screen) -totalvolume_add_imgbtn.set_pos(67, 70) -totalvolume_add_imgbtn.set_size(55, 23) +totalvolume_add_imgbtn.set_pos(125, 145) +totalvolume_add_imgbtn.set_size(110, 46) totalvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE) -totalvolume_add_imgbtn.set_src("U:/static/add_btn.png") +totalvolume_add_imgbtn.set_src("E:/static/add_btn.png") totalvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) class totalvolumeScreen(Screen): @@ -1755,14 +1769,10 @@ class totalvolumeScreen(Screen): lv.EVENT.CLICKED, None) totalvolume_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)), lv.EVENT.CLICKED, None) - self.read_data = {} self.volum_size = 8 self.aud = audio.Audio(0) - # self.aud.set_pa(Pin.GPIO29) def initialization(self): - self.read_data = EventMesh.publish("get_storage_data") - # print("self.read_data:{}".format(self.read_data)) num = EventMesh.publish("get_volum_size") if num == None: self.volum_size = 8 @@ -1789,7 +1799,9 @@ class totalvolumeScreen(Screen): if msg == 1: self.aud.setVolume(self.volum_size) EventMesh.publish("set_volum_size",self.volum_size) - self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') #播放声音 + # print("self.read_data:size :{}".format(self.read_data)) + + self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音 def Close(self): self.aud.stop() diff --git a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/autoconf.h b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/autoconf.h index 26766385..2fe8e6bf 100644 --- a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/autoconf.h +++ b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/autoconf.h @@ -4,7 +4,7 @@ * Helios SDK Configuration * */ -#define PROJECT_NAME_G3_K01 1 //项目宏定义 +#define PROJECT_NAME_G3_C06S 1 //项目宏定义 #define CONFIG_LVGL_SPAN 1 #define CONFIG_LVGL_FS_HELIOS 1 #define CONFIG_LVGL_GIF_DECODE 1 @@ -28,6 +28,7 @@ #define CONFIG_LVGL_PNG_DECODE 1 #define CONFIG_LVGL_IMGBTN 1 //#define CONFIG_GH301x 1 +#define CONFIG_HX3918 1 #define CONFIG_MBEDTLS 1 #define CONFIG_SC7A20 1 #define CONFIG_LVGL_WIN 1 diff --git a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/config.mk b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/config.mk index bf69c97c..168ac944 100644 --- a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/config.mk +++ b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/config.mk @@ -2,7 +2,7 @@ # Automatically generated file; DO NOT EDIT. # Helios SDK Configuration # -PROJECT_NAME_G3_K01=y +PROJECT_NAME_G3_C06S=y # # System Configuration # @@ -60,5 +60,6 @@ CONFIG_LCD=y # CONFIG_UART_SLIP is not set # CONFIG_POC is not set #CONFIG_GH301x=y +CONFIG_HX3918=y CONFIG_SC7A20=y diff --git a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip index 7f21f4bf..bf23d524 100644 Binary files a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip and b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip differ diff --git a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h index bfd51397..79d53f71 100644 --- a/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h +++ b/2.sdk/project/C06S/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h @@ -3,7 +3,7 @@ #define __APP_LINK_START_ADDR_H__ #define APP_LINK_START_ADDR 0x80521000 -#define APP_FLASH_MAX_SIZE 0x1A8000 +#define APP_FLASH_MAX_SIZE 0x18A000 #define APP_RAM_START 0x7E3E0000 #define APP_RAM_MAX_SIZE 0x180000 diff --git a/2.sdk/project/C06S/usr/main.py b/2.sdk/project/C06S/usr/main.py index 8666de66..68ba3fff 100644 --- a/2.sdk/project/C06S/usr/main.py +++ b/2.sdk/project/C06S/usr/main.py @@ -1,2 +1,2 @@ -from main_init import main_init -main_init() \ No newline at end of file +import main_init +main_init.main_init() \ No newline at end of file diff --git a/2.sdk/project/C06S/usr/main_1.py b/2.sdk/project/C06S/usr/main_1.py new file mode 100644 index 00000000..68ba3fff --- /dev/null +++ b/2.sdk/project/C06S/usr/main_1.py @@ -0,0 +1,2 @@ +import main_init +main_init.main_init() \ No newline at end of file diff --git a/2.sdk/project/C06S/usr/static/0_BAT.png b/2.sdk/project/C06S/usr/static/0_BAT.png deleted file mode 100644 index 5ddc5f70..00000000 Binary files a/2.sdk/project/C06S/usr/static/0_BAT.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/0_weather.png b/2.sdk/project/C06S/usr/static/0_weather.png deleted file mode 100644 index 1429545f..00000000 Binary files a/2.sdk/project/C06S/usr/static/0_weather.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/1_weather.png b/2.sdk/project/C06S/usr/static/1_weather.png deleted file mode 100644 index df11b7e7..00000000 Binary files a/2.sdk/project/C06S/usr/static/1_weather.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/2_weather.png b/2.sdk/project/C06S/usr/static/2_weather.png deleted file mode 100644 index df34dd19..00000000 Binary files a/2.sdk/project/C06S/usr/static/2_weather.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/3_weather.png b/2.sdk/project/C06S/usr/static/3_weather.png deleted file mode 100644 index 149adb85..00000000 Binary files a/2.sdk/project/C06S/usr/static/3_weather.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/DIAL_PREV01.png b/2.sdk/project/C06S/usr/static/DIAL_PREV01.png index 97e7ec5c..3e6567e9 100644 Binary files a/2.sdk/project/C06S/usr/static/DIAL_PREV01.png and b/2.sdk/project/C06S/usr/static/DIAL_PREV01.png differ diff --git a/2.sdk/project/C06S/usr/static/DIAL_PREV02.png b/2.sdk/project/C06S/usr/static/DIAL_PREV02.png new file mode 100644 index 00000000..a7c9c0ba Binary files /dev/null and b/2.sdk/project/C06S/usr/static/DIAL_PREV02.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_APP_QR_CODE.png b/2.sdk/project/C06S/usr/static/IMAGE_APP_QR_CODE.png deleted file mode 100644 index 88de1187..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_APP_QR_CODE.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_BUTTON_DELKEY.png b/2.sdk/project/C06S/usr/static/IMAGE_BUTTON_DELKEY.png deleted file mode 100644 index 9bde723a..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_BUTTON_DELKEY.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_BUTTON_DIAL.png b/2.sdk/project/C06S/usr/static/IMAGE_BUTTON_DIAL.png deleted file mode 100644 index 0f6b4151..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_BUTTON_DIAL.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_IDLE_SCREEN_ALARM_POPUP_02.png b/2.sdk/project/C06S/usr/static/IMAGE_IDLE_SCREEN_ALARM_POPUP_02.png deleted file mode 100644 index 5150641b..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_IDLE_SCREEN_ALARM_POPUP_02.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NOTICE_CALL.png b/2.sdk/project/C06S/usr/static/IMAGE_NOTICE_CALL.png deleted file mode 100644 index 638c12a6..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NOTICE_CALL.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NOTICE_NONE.png b/2.sdk/project/C06S/usr/static/IMAGE_NOTICE_NONE.png deleted file mode 100644 index f2297154..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NOTICE_NONE.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY0_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY0_ICON.png deleted file mode 100644 index 502ff78c..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY0_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY1_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY1_ICON.png deleted file mode 100644 index 4c01263a..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY1_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY2_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY2_ICON.png deleted file mode 100644 index d017c483..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY2_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY3_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY3_ICON.png deleted file mode 100644 index 3a9e0559..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY3_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY4_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY4_ICON.png deleted file mode 100644 index d5fd3954..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY4_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY5_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY5_ICON.png deleted file mode 100644 index 39aea823..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY5_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY6_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY6_ICON.png deleted file mode 100644 index fa0c0ec7..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY6_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY7_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY7_ICON.png deleted file mode 100644 index 726fd751..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY7_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY8_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY8_ICON.png deleted file mode 100644 index d157f880..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY8_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY9_ICON.png b/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY9_ICON.png deleted file mode 100644 index e9ce23a8..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_NUMBER_KEY9_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_ALBUM.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_ALBUM.png deleted file mode 100644 index 34df5ca6..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_ALBUM.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CALL.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CALL.png index 11399086..3ddd503a 100644 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CALL.png and b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CALL.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CAMERA.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CAMERA.png deleted file mode 100644 index 1931413c..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CAMERA.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CONTACTS.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CONTACTS.png index bd4df367..8af90be3 100644 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CONTACTS.png and b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_CONTACTS.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_HEALTH.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_HEALTH.png new file mode 100644 index 00000000..2312686c Binary files /dev/null and b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_HEALTH.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SETTINGS.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SETTINGS.png index 97e31cc5..0d6a188f 100644 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SETTINGS.png and b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SETTINGS.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SMS.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SMS.png index f1e7f8d9..1b0fe104 100644 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SMS.png and b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_SMS.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_TOOLS.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_TOOLS.png index c2953abf..457394ae 100644 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_TOOLS.png and b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_TOOLS.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_VIDEOCALL.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_VIDEOCALL.png deleted file mode 100644 index 2b0610bb..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_VIDEOCALL.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_WECHAT.png b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_WECHAT.png index 76f20efc..9b9a37f9 100644 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_WECHAT.png and b/2.sdk/project/C06S/usr/static/IMAGE_ONE_PAGE_WECHAT.png differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_ALARM.png b/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_ALARM.png deleted file mode 100644 index 148edc47..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_ALARM.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_COUNTDOWN.png b/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_COUNTDOWN.png deleted file mode 100644 index ed6a9b66..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_COUNTDOWN.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_STEP.png b/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_STEP.png deleted file mode 100644 index ee45af53..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_STEP.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_STOPWATCH.png b/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_STOPWATCH.png deleted file mode 100644 index 1048f7ee..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_STOPWATCH.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_WEATHER.png b/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_WEATHER.png deleted file mode 100644 index a7fa7dc0..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_SECMENU_WEATHER.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/IMAGE_STEP.png b/2.sdk/project/C06S/usr/static/IMAGE_STEP.png deleted file mode 100644 index 85288c3d..00000000 Binary files a/2.sdk/project/C06S/usr/static/IMAGE_STEP.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/REDUCE_VOLUM_ICON.png b/2.sdk/project/C06S/usr/static/REDUCE_VOLUM_ICON.png deleted file mode 100644 index a5140fb6..00000000 Binary files a/2.sdk/project/C06S/usr/static/REDUCE_VOLUM_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/RED_RETURN_PNG.png b/2.sdk/project/C06S/usr/static/RED_RETURN_PNG.png deleted file mode 100644 index 2def6f42..00000000 Binary files a/2.sdk/project/C06S/usr/static/RED_RETURN_PNG.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/R_1.png b/2.sdk/project/C06S/usr/static/R_1.png deleted file mode 100644 index 4181128b..00000000 Binary files a/2.sdk/project/C06S/usr/static/R_1.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/R_2.png b/2.sdk/project/C06S/usr/static/R_2.png deleted file mode 100644 index 306ee598..00000000 Binary files a/2.sdk/project/C06S/usr/static/R_2.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/R_3.png b/2.sdk/project/C06S/usr/static/R_3.png deleted file mode 100644 index 50740e14..00000000 Binary files a/2.sdk/project/C06S/usr/static/R_3.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/R_VOLUME_SET_1.mp3 b/2.sdk/project/C06S/usr/static/R_VOLUME_SET_1.mp3 deleted file mode 100644 index 3fd8ed2c..00000000 Binary files a/2.sdk/project/C06S/usr/static/R_VOLUME_SET_1.mp3 and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/S_1.png b/2.sdk/project/C06S/usr/static/S_1.png deleted file mode 100644 index 3e2569fa..00000000 Binary files a/2.sdk/project/C06S/usr/static/S_1.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/S_2.png b/2.sdk/project/C06S/usr/static/S_2.png deleted file mode 100644 index e9121ab6..00000000 Binary files a/2.sdk/project/C06S/usr/static/S_2.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/S_3.png b/2.sdk/project/C06S/usr/static/S_3.png deleted file mode 100644 index c8459595..00000000 Binary files a/2.sdk/project/C06S/usr/static/S_3.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/VOLUM_ADD_ICON.png b/2.sdk/project/C06S/usr/static/VOLUM_ADD_ICON.png deleted file mode 100644 index a9aef5f5..00000000 Binary files a/2.sdk/project/C06S/usr/static/VOLUM_ADD_ICON.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/add_btn.png b/2.sdk/project/C06S/usr/static/add_btn.png deleted file mode 100644 index 777b41b3..00000000 Binary files a/2.sdk/project/C06S/usr/static/add_btn.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/alipay_.png b/2.sdk/project/C06S/usr/static/alipay_.png new file mode 100644 index 00000000..d4f435d0 Binary files /dev/null and b/2.sdk/project/C06S/usr/static/alipay_.png differ diff --git a/2.sdk/project/C06S/usr/static/answer.png b/2.sdk/project/C06S/usr/static/answer.png deleted file mode 100644 index 63d2e014..00000000 Binary files a/2.sdk/project/C06S/usr/static/answer.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/bg.png b/2.sdk/project/C06S/usr/static/bg.png index 831069b0..527708dc 100644 Binary files a/2.sdk/project/C06S/usr/static/bg.png and b/2.sdk/project/C06S/usr/static/bg.png differ diff --git a/2.sdk/project/C06S/usr/static/cancel_icon.png b/2.sdk/project/C06S/usr/static/cancel_icon.png deleted file mode 100644 index a65d24d0..00000000 Binary files a/2.sdk/project/C06S/usr/static/cancel_icon.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/charge_ing.png b/2.sdk/project/C06S/usr/static/charge_ing.png deleted file mode 100644 index 6061f3ea..00000000 Binary files a/2.sdk/project/C06S/usr/static/charge_ing.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/degree.png b/2.sdk/project/C06S/usr/static/degree.png index 8738d7b1..62b467f5 100644 Binary files a/2.sdk/project/C06S/usr/static/degree.png and b/2.sdk/project/C06S/usr/static/degree.png differ diff --git a/2.sdk/project/C06S/usr/static/find_phone.png b/2.sdk/project/C06S/usr/static/find_phone.png deleted file mode 100644 index 4efc00ba..00000000 Binary files a/2.sdk/project/C06S/usr/static/find_phone.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/hang_up.png b/2.sdk/project/C06S/usr/static/hang_up.png deleted file mode 100644 index 73eeda86..00000000 Binary files a/2.sdk/project/C06S/usr/static/hang_up.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/jia_icon.png b/2.sdk/project/C06S/usr/static/jia_icon.png deleted file mode 100644 index cdc33e32..00000000 Binary files a/2.sdk/project/C06S/usr/static/jia_icon.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/jing_icon.png b/2.sdk/project/C06S/usr/static/jing_icon.png deleted file mode 100644 index 6725c9d0..00000000 Binary files a/2.sdk/project/C06S/usr/static/jing_icon.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/low_power.png b/2.sdk/project/C06S/usr/static/low_power.png deleted file mode 100644 index bc148ea1..00000000 Binary files a/2.sdk/project/C06S/usr/static/low_power.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_app_qrcode.png b/2.sdk/project/C06S/usr/static/menu_app_qrcode.png deleted file mode 100644 index bbc70c39..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_app_qrcode.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_bright.png b/2.sdk/project/C06S/usr/static/menu_bright.png deleted file mode 100644 index 12249660..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_bright.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_imei_qrcode.png b/2.sdk/project/C06S/usr/static/menu_imei_qrcode.png deleted file mode 100644 index d7955659..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_imei_qrcode.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_poweroff.png b/2.sdk/project/C06S/usr/static/menu_poweroff.png deleted file mode 100644 index b5c4c580..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_poweroff.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_restore.png b/2.sdk/project/C06S/usr/static/menu_restore.png deleted file mode 100644 index 384225d3..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_restore.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_upgrade.png b/2.sdk/project/C06S/usr/static/menu_upgrade.png deleted file mode 100644 index 4950c319..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_upgrade.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_version.png b/2.sdk/project/C06S/usr/static/menu_version.png deleted file mode 100644 index c930ad60..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_version.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_volume.png b/2.sdk/project/C06S/usr/static/menu_volume.png deleted file mode 100644 index 9ca10118..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_volume.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/menu_watch_switch.png b/2.sdk/project/C06S/usr/static/menu_watch_switch.png deleted file mode 100644 index e4f70533..00000000 Binary files a/2.sdk/project/C06S/usr/static/menu_watch_switch.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/mpsignal1.png b/2.sdk/project/C06S/usr/static/mpsignal1.png deleted file mode 100644 index c360fde0..00000000 Binary files a/2.sdk/project/C06S/usr/static/mpsignal1.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/mpsignal2.png b/2.sdk/project/C06S/usr/static/mpsignal2.png deleted file mode 100644 index 3342a221..00000000 Binary files a/2.sdk/project/C06S/usr/static/mpsignal2.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/mpsignal3.png b/2.sdk/project/C06S/usr/static/mpsignal3.png deleted file mode 100644 index c17b1972..00000000 Binary files a/2.sdk/project/C06S/usr/static/mpsignal3.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/mpsignal4.png b/2.sdk/project/C06S/usr/static/mpsignal4.png deleted file mode 100644 index b74b40e5..00000000 Binary files a/2.sdk/project/C06S/usr/static/mpsignal4.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/mpsignal5.png b/2.sdk/project/C06S/usr/static/mpsignal5.png deleted file mode 100644 index 37d7d8f2..00000000 Binary files a/2.sdk/project/C06S/usr/static/mpsignal5.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/off_icon.png b/2.sdk/project/C06S/usr/static/off_icon.png deleted file mode 100644 index 0aa18c72..00000000 Binary files a/2.sdk/project/C06S/usr/static/off_icon.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/pause.png b/2.sdk/project/C06S/usr/static/pause.png deleted file mode 100644 index 48f11acb..00000000 Binary files a/2.sdk/project/C06S/usr/static/pause.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/phnone_nine_icon.png b/2.sdk/project/C06S/usr/static/phnone_nine_icon.png deleted file mode 100644 index 2436cb4c..00000000 Binary files a/2.sdk/project/C06S/usr/static/phnone_nine_icon.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/phone_seven_icon.png b/2.sdk/project/C06S/usr/static/phone_seven_icon.png deleted file mode 100644 index 5965beb5..00000000 Binary files a/2.sdk/project/C06S/usr/static/phone_seven_icon.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/play.png b/2.sdk/project/C06S/usr/static/play.png deleted file mode 100644 index 507efb2a..00000000 Binary files a/2.sdk/project/C06S/usr/static/play.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/poweroff_icon.png b/2.sdk/project/C06S/usr/static/poweroff_icon.png deleted file mode 100644 index 0aca766d..00000000 Binary files a/2.sdk/project/C06S/usr/static/poweroff_icon.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/reduce_btn.png b/2.sdk/project/C06S/usr/static/reduce_btn.png deleted file mode 100644 index ba93fc18..00000000 Binary files a/2.sdk/project/C06S/usr/static/reduce_btn.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/step.png b/2.sdk/project/C06S/usr/static/step.png new file mode 100644 index 00000000..385213b6 Binary files /dev/null and b/2.sdk/project/C06S/usr/static/step.png differ diff --git a/2.sdk/project/C06S/usr/static/stopwatch_play.png b/2.sdk/project/C06S/usr/static/stopwatch_play.png deleted file mode 100644 index 028b3e14..00000000 Binary files a/2.sdk/project/C06S/usr/static/stopwatch_play.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/stopwatch_reset.png b/2.sdk/project/C06S/usr/static/stopwatch_reset.png deleted file mode 100644 index c5d70833..00000000 Binary files a/2.sdk/project/C06S/usr/static/stopwatch_reset.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/stopwatch_stop.png b/2.sdk/project/C06S/usr/static/stopwatch_stop.png deleted file mode 100644 index f4100c71..00000000 Binary files a/2.sdk/project/C06S/usr/static/stopwatch_stop.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/time_down.png b/2.sdk/project/C06S/usr/static/time_down.png deleted file mode 100644 index a5d13a35..00000000 Binary files a/2.sdk/project/C06S/usr/static/time_down.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/time_finish.png b/2.sdk/project/C06S/usr/static/time_finish.png deleted file mode 100644 index 227e30d9..00000000 Binary files a/2.sdk/project/C06S/usr/static/time_finish.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/time_up.png b/2.sdk/project/C06S/usr/static/time_up.png deleted file mode 100644 index 3c7d2bb8..00000000 Binary files a/2.sdk/project/C06S/usr/static/time_up.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/time_up1.png b/2.sdk/project/C06S/usr/static/time_up1.png deleted file mode 100644 index f5a9284f..00000000 Binary files a/2.sdk/project/C06S/usr/static/time_up1.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/time_up2.png b/2.sdk/project/C06S/usr/static/time_up2.png deleted file mode 100644 index 1e1edf07..00000000 Binary files a/2.sdk/project/C06S/usr/static/time_up2.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/update.png b/2.sdk/project/C06S/usr/static/update.png deleted file mode 100644 index 8f33d015..00000000 Binary files a/2.sdk/project/C06S/usr/static/update.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/vbat_0.png b/2.sdk/project/C06S/usr/static/vbat_0.png deleted file mode 100644 index ad103985..00000000 Binary files a/2.sdk/project/C06S/usr/static/vbat_0.png and /dev/null differ diff --git a/2.sdk/project/C06S/usr/static/xing_icon.png b/2.sdk/project/C06S/usr/static/xing_icon.png deleted file mode 100644 index 2350f545..00000000 Binary files a/2.sdk/project/C06S/usr/static/xing_icon.png and /dev/null differ diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py index f9b5303e..d42031da 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py @@ -849,6 +849,21 @@ class DeviceInfoManager(Abstract): time_tmp = utime.mktime(date_tmp) # print("date_tmp......01....{} time_tmp:{}\r\n".format(date_tmp,time_tmp)) + """电量小于20% 5分钟提醒一次""" + get_low_btn = EventMesh.publish("get_low_bat_btn")# + battery = EventMesh.publish("screen_get_battery") + # print("get_low_btn:{} self.bat_time:{}".format(get_low_btn,self.bat_time)) + if get_low_btn != None:#低电使能开关 + if get_low_btn == 1: + self.bat_time+=10 + # print("date_tmp:{} self.bat_time:{}".format(date_tmp,self.bat_time)) + + if self.bat_time > 5*60: + self.bat_time = 0 + if battery[1] <= 20 and battery[1] > 0 and battery[0] != "1": + EventMesh.publish("load_screen", {"screen": "LOW_POWER"}) + else: + self.bat_time = 0 EventMesh.publish("countdown_end_cb") """定时检查是否关闭gps失败""" @@ -909,7 +924,8 @@ class DeviceInfoManager(Abstract): self.vbat_count = 0 if bat_tmp != None: bat_value = bat_tmp[1] - if bat_value <= 0: + if bat_value <= 0 and battery[0] != "1": + EventMesh.publish("load_screen", {"screen": "LOW_ONE_POWER"}) except Exception as e: usys.print_exception(e) @@ -966,21 +982,7 @@ class DeviceInfoManager(Abstract): if self.clear_step == 1: self.clear_step = 0 - """电量小于20% 5分钟提醒一次""" - get_low_btn = EventMesh.publish("get_low_bat_btn")# - battery = EventMesh.publish("screen_get_battery") - # print("get_low_btn:{} self.bat_time:{}".format(get_low_btn,self.bat_time)) - if get_low_btn != None:#低电使能开关 - if get_low_btn == 1: - self.bat_time+=10 - # print("date_tmp:{} self.bat_time:{}".format(date_tmp,self.bat_time)) - - if self.bat_time > 5*60: - self.bat_time = 0 - if battery[1] <= 20 and battery[1] > 0: - EventMesh.publish("load_screen", {"screen": "LOW_POWER"}) - else: - self.bat_time = 0 + """未联网提示关机""" if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:#未联网提示关机