K10bug修正
authorp15692025051 <846603105@qq.com>
Tue, 31 Oct 2023 01:27:03 +0000 (09:27 +0800)
committerp15692025051 <846603105@qq.com>
Tue, 31 Oct 2023 01:27:03 +0000 (09:27 +0800)
2.sdk/Helios_SDK/components/juphoon/jrtc.h
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.c
2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modVideoCall_juphoon.c
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/Makefile
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/D10/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/autoconf.h
2.sdk/project/D10/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/config.mk
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appFactoryMode.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py

index d7b70de..213a88a 100644 (file)
@@ -3,7 +3,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
+#define juphoon_LOG(msg, ...)      custom_log("juphoon", msg, ##__VA_ARGS__)
 /**
  * 呼叫流程: 假设 `设备A' 呼叫 `设备B'
  *
index 070426f..10b913d 100644 (file)
@@ -420,9 +420,10 @@ void qpy_callback_deal_thread(void * args_in)
                     mp_sched_schedule_ex(&cb_msg->callback,  mp_obj_new_int(cb_msg->state));
                                }
                 break;
+            
                 case CALLBACK_TYPE_ID_Gsensor:
                                {
-                    st_CallBack_Gsensor *cb_msg = (st_CallBack_TP *)msg.msg;
+                    st_CallBack_Gsensor *cb_msg = (st_CallBack_Gsensor *)msg.msg;
                     mp_sched_schedule_ex(&cb_msg->callback,  mp_obj_new_int(cb_msg->state));
                                }
                 break;
index 7aeee83..6cda6c3 100644 (file)
 
 #if 0
 
-#include "helios_gpio.h"
-
-
-
 
 #include "helios_debug.h"
 
 
 
 //////////////////////////////////////////////////////////////////////////////
-typedef struct _HX3918_obj_t
-{
-    mp_obj_base_t base;
-
-    uint8_t i2c_no;
-       uint8_t i2c_mode;
-    uint8_t irq;
-       uint8_t power;
-
-} HX3918_obj_t;
 
-STATIC HX3918_obj_t *g_HX3918 = NULL;
-static unsigned char is_HX3918 = 0;//是否存在IC
-static unsigned char is_open_HX3918 = 0; //是否打开测试
-static unsigned char s_HX3918_heart_rate = 0x0;//心律
-static unsigned char s_HX3918_high_blood = 0x0;//血压/高压
-static unsigned char s_HX3918_low_blood = 0x0;//血压/低压
-static unsigned char s_HX3918_blood_oxygen = 0x0;//血氧
-static unsigned char s_HX3918_HRV = 0x0;//hrv
-static unsigned char s_HX3918_wear_status = 1;//佩戴状态
-#define HEART_RATE_BUFF_LEN 10
-unsigned char s_HX3918_heart_rate_buff[HEART_RATE_BUFF_LEN]={0};
-unsigned short s_HX3918_heart_rate_buff_count = 0;
-
-char HX3918_sleep_flag =  0;
 #include "helios_extint.h"
 
-int sensor_timer = 0;
-#define TIMER_TIME_MS  100 //10ms
-#define IS_CYCLICAL 1
-uint8_t HX3918_irq_flag = 0;
-uint32_t HX3918_run_mode = NULL_MODE;
-uint32_t HX3918_jobs_mode = NULL_MODE;
-#define RUN_MODE_CLOSE 0xffff
-static uint32_t timer_Gsensor_count = 0;
-#if CONFIG_SC7A20
-extern int SC7A20_init(void);
-extern signed char SL_SC7A20_PEDO_KCAL_WRIST_SLEEP_SWAY_L_ALGO(void);
-extern unsigned char Gsensor_init_flag ;
-void HX3918_restart(void);
-#endif
-int ir_wear = 0;//红外佩戴状态
-int cap_wear = 1;//电容佩戴状态
-char is_open_sar = 0;//是否打开sar检测
-int wear_time = 0;
-// int test_count1 = 0;
-// int test_count2 = 0;
-void HX3918_test(uint32_t mode);
-void HX3918_close(void);
-void sensor_timerout_cb(void);
-
-void HX3918_thread_do(void)
-{
-       if(HX3918_run_mode == close_MODE)
-       {
-               HX3918_close();
-               //HX3918_LOG("HX3918_irq_cb: 1111111111111!!!!!!!!\r\n");
-               HX3918_run_mode = NULL_MODE;
-               HX3918_jobs_mode = NULL_MODE;
-               hx3918_ppg_timerout_flag = 0;
-               hx3918_agc_timerout_flag = 0;
-               return;
-       }
-       if(HX3918_run_mode != NULL_MODE )
-       {
-               if(HX3918_jobs_mode != NULL_MODE)//没关闭就打开其他模式,先关闭一次
-               {
-                       HX3918_close();
-                       Helios_msleep(20);
-                       HX3918_jobs_mode = NULL_MODE;
-               }
-               // else
-               //      HX3918_restart();
-               HX3918_test(HX3918_run_mode);
-               HX3918_jobs_mode = HX3918_run_mode;
-               HX3918_run_mode = NULL_MODE;
-       }
-       if(hx3918_ppg_timerout_flag)
-       {
-               hx3918_ppg_Int_handle();
-               hx3918_ppg_timerout_flag = 0;
-       }
-       if(hx3918_agc_timerout_flag)
-       {
-               agc_timeout_handler(NULL);
-               hx3918_agc_timerout_flag =0;
-       }
-       if(is_HX3918 == 1 && is_open_HX3918 == 1)//处理Hsensor定时数据
-       {
-
-               
-               if(timer_Gsensor_count>(500/TIMER_TIME_MS))//0.5秒定时,轮询更新Gsensor数据
-               {
-                       timer_Gsensor_count = 0;
-                       //Helios_msleep(5);
-                       #if CONFIG_SC7A20
-                       SL_SC7A20_PEDO_KCAL_WRIST_SLEEP_SWAY_L_ALGO();
-                       #endif
 
-               }
-       }
-       else
-       {
-               // if(hx3918_ppg_timerout_flag)//测试模式
-               // {
-               //      hx3918_ppg_Int_handle();
-               //      hx3918_ppg_timerout_flag = 0;
-               // }
-               // wear_time++;
-               // if(wear_time > 3)
-               // {
-               //      wear_time = 0;
-                       
-               //      //hx3918_prox_factory_hanging_cali();
-                       
-               //      ir_wear = hx3918_get_wear_ppg_Int_handle();
-               //      #ifdef  SAR_ALG_LIB
-               //      cap_wear = hx3918_report_prox_status();
-               //      #endif
-               //      HX3918_LOG("ir_wear:%d cap_wear%d\n",ir_wear,cap_wear);
-               //      if(ir_wear == 1 && cap_wear==1)
-               //      {
-               //              s_HX3918_wear_status = 1;
-               //      }else
-               //              s_HX3918_wear_status = 0;
-               // }
-               
-               #if CONFIG_SC7A20
-               if(ir_wear == 1 && cap_wear==1)
-               {
-                       SL_SC7A20_PEDO_KCAL_WRIST_SLEEP_SWAY_L_ALGO();
-                       
-               }
-                       
-               #endif
-               Helios_msleep(1000);
-               
-               if(HX3918_sleep_flag == 1)
-               {
-                       HX3918_sleep_flag = 0;
-                       Helios_msleep(3000);
-               }
-       }
-       Helios_msleep(5);
+#include "jrtc.h"
 
-}
-void HX3918_result_set_heart_rate(unsigned char heart_rate)
-{
-//    s_HX3918_heart_rate_buff[HEART_RATE_BUFF_LEN]={0};
-// uint16 s_HX3918_heart_rate_buff_count = 0;
-   uint32_t i,tmp = 0;
-   s_HX3918_heart_rate_buff[s_HX3918_heart_rate_buff_count] = heart_rate;
-   s_HX3918_heart_rate_buff_count++;
-   for(i=0;i<s_HX3918_heart_rate_buff_count;i++)//算总和,取平均值
-   {
-      tmp+=s_HX3918_heart_rate_buff[i];
-   }
-   s_HX3918_heart_rate = tmp/s_HX3918_heart_rate_buff_count;//取平均值
-   //s_HX3918_heart_rate = heart_rate; 
-   if(s_HX3918_heart_rate_buff_count >=  HEART_RATE_BUFF_LEN)
-      s_HX3918_heart_rate_buff_count = 0;
-   s_HX3918_high_blood = (uint8_t)(heart_rate * 1.5);
-   
-   s_HX3918_low_blood = (uint8_t)(heart_rate * 0.95);
-}
-void HX3918_result_set_wear_status(unsigned char wear_status)
-{
-       if(wear_status != 1)
-               s_HX3918_wear_status = 0;
-       else
-               s_HX3918_wear_status = 1;
-   //HX3918_LOG("s_HX3918_wear_status:%d !!!!!!!!!!!!!!!!!\n\n\n",s_HX3918_wear_status);
-}
-void HX3918_result_set_blood_oxygen(unsigned char blood_oxygen)
+/* 定义juphoon_obj_t结构体 */
+typedef struct _juphoon_obj_t
 {
-   s_HX3918_blood_oxygen = blood_oxygen;    
-}
- 
-void HX3918_result_set_hrv(unsigned char hrv)
-{
-   s_HX3918_HRV = hrv;    
-}
-STATIC mp_obj_t mp_activate_HX3918(mp_obj_t self_in)
-{
-    HX3918_obj_t *self = MP_OBJ_TO_PTR(self_in);
-
-    g_HX3918 = self;
-    return mp_const_none;
-}
-
-STATIC mp_obj_t HX3918_make_new(const mp_obj_type_t *type,
-                               size_t n_args,
-                               size_t n_kw,
-                               const mp_obj_t *all_args)
-{
-    enum{
-        ARG_i2c_no,
-        ARG_i2c_mode,
-        ARG_irq,
-               ARG_power,
-    };
-
-    static const mp_arg_t allowed_args[] = {
-        { MP_QSTR_i2c_no, MP_ARG_INT, {.u_int = 0}},
-        { MP_QSTR_i2c_mode, MP_ARG_INT, {.u_int = 1}},
-        { MP_QSTR_irq, MP_ARG_INT, {.u_int = 27}},
-               { MP_QSTR_power, MP_ARG_INT, {.u_int = 30}},
-    };
-
-    mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
-    mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
-    HX3918_obj_t *self = m_new_obj(HX3918_obj_t);
-    self->base.type = type;
-
-    self->i2c_no = args[ARG_i2c_no].u_int;
-       self->i2c_mode = args[ARG_i2c_mode].u_int;
-    self->irq = args[ARG_irq].u_int;
-
-       self->power = args[ARG_power].u_int;
-    return MP_OBJ_FROM_PTR(self);
-}
-
-STATIC mp_obj_t mp_HX3918_init(mp_obj_t self_in);
-STATIC mp_obj_t mp_HX3918_deinit(mp_obj_t self_in);
-
+    mp_obj_base_t base;   //定义的对象结构体要包含该成员
+}juphoon_obj_t;
 
+const mp_obj_type_t juphoon_type;
+juphoon_obj_t *single_juphoon = NULL;
 
-void sensor_timerout_cb(void)
+#define CONFIG_STR_LEN 40
+//void jrtc_config (const char* appkey, const char* uid, const char key[16], const char* tokens);
+STATIC mp_obj_t Juphoon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args)
 {
-
-       if(timer_Gsensor_count < 65536)
-               timer_Gsensor_count++;  
-}
-void HX3918_irq_cb(void)
-{
-       HX3918_irq_flag = 1;
-       //HX3918_LOG("HX3918_irq_cb: 1111111111111!!!!!!!!\r\n");
-       Helios_ExtInt_Enable(g_HX3918->irq);
-}
-/*
-**函数名:HX3918_Init
-**功能:初始化HX3918
-*/
-mp_obj_t mp_HX3918_init(mp_obj_t self_in)
-{
-    HX3918_obj_t *self = MP_OBJ_TO_PTR(self_in);
-       g_HX3918 = self;
-    mp_activate_HX3918(self_in);
-       uint8_t index = 0;
-       uint8_t device_id = 0;
-       Helios_GPIOInitStruct gpio_struct = {0};
-       gpio_struct.dir = HELIOS_GPIO_INPUT;
-       gpio_struct.pull = HELIOS_PULL_UP;
-       gpio_struct.value = HELIOS_LVL_LOW;
-
-       // ret = Helios_GPIO_Init((Helios_GPIONum) self->irq, &gpio_struct);
-       // HX3918_LOG("cst816 irq=%d, irq ret: %d\n", self->irq, ret);
-
-       gpio_struct.pull = HELIOS_PULL_NONE;
-       gpio_struct.dir = HELIOS_GPIO_OUTPUT;
-       Helios_GPIO_Init(self->power, &gpio_struct);//ldo
-
-       gpio_struct.dir = HELIOS_GPIO_OUTPUT;
-       gpio_struct.pull = HELIOS_PULL_NONE;
-       gpio_struct.value = HELIOS_LVL_LOW;
-       //Helios_GPIO_Init(25, &gpio_struct);//体温
-       Helios_GPIO_Init(31, &gpio_struct);//复位
-
-       gpio_struct.dir = HELIOS_GPIO_INPUT;
-       gpio_struct.pull = HELIOS_PULL_NONE;
-       gpio_struct.value = HELIOS_LVL_LOW;
-       // Helios_GPIO_Init(self->irq, &gpio_struct);//IRQ
-
-       // Helios_ExtInt_Deinit(self->irq);//关闭中断
-       // Helios_ExtIntStruct extint_struct1 = {0};
-       // // Helios_TriggerMode gpio_trigger;  //GPIO interrupt trigger mode  (0-EDGE_TRIGGER  1-LEVEL_TRIGGER)
-       // // Helios_DebounceMode gpio_debounce;        //GPIO interrupt trigger debounce enable/disable  (0-disable  1-enable)
-       // // Helios_EdgeMode gpio_edge;                        //GPIO interrupt edge/level trigger configure  (0-EDGE_RISING 1-EDGE_FALLING 2-EDGE_BOTH)
-       // // Helios_PullMode gpio_pull;                        //GPIO get input pull (0-PULL_NONE 1-PULL_UP 2-PULL_DOWN)
-       // // void *eint_cb;                                            //GPIO interrupt cb
-       // // void *wakeup_eint_cb;                             //GPIO interrupt cb_ctx
-       // extint_struct1.gpio_trigger = HELIOS_EDGE_TRIGGER;
-       // extint_struct1.gpio_edge = HELIOS_EDGE_RISING;
-       // extint_struct1.gpio_debounce = HELIOS_DEBOUNCE_EN;
-       // extint_struct1.gpio_pull = HELIOS_PULL_NONE;
-       // extint_struct1.eint_cb = HX3918_irq_cb;
-       // extint_struct1.wakeup_eint_cb = NULL;
-       
-       
-       Helios_I2C_Init((Helios_I2CEnum)self->i2c_no, HELIOS_FAST_MODE);
-       Helios_GPIO_SetLevel(self->power, HELIOS_LVL_LOW);
-       Helios_msleep(10);
-       Helios_GPIO_SetLevel(self->power, HELIOS_LVL_HIGH);
-       Helios_GPIO_SetLevel(31, HELIOS_LVL_LOW);
-       Helios_msleep(20);
-       Helios_GPIO_SetLevel(31, HELIOS_LVL_HIGH);
-               
-       if(sensor_timer == 0)
-       {
-               sensor_timer = Helios_Timer_init( (void* )sensor_timerout_cb, NULL);
-       }
-       if(sensor_thread_id == 0)
-       {
-               HX3918_LOG("mp_HX3918_open_heart Helios_Thread_Create\r\n");
-               sensor_thread_id = Helios_Thread_Create(&ThreadAttr);
-       }       
-       
-       
-       bool ret = 0;
-       ret = hx3918_chip_check();
-       if(!ret){
-               //mp_raise_ValueError("i2c init fail ");
-               HX3918_LOG("mp_HX3918_init: i2c init fail\r\n");
-               is_HX3918 = 0;
-       }else
-       {
-               HX3918_LOG("mp_HX3918_init: OK\r\n");
-               is_HX3918 = 1;
-               // Helios_ExtInt_Init(self->irq,  &extint_struct1);//初始化中断
-               // Helios_ExtInt_Enable(self->irq);//打开中断
-               #ifdef  SAR_ALG_LIB
-               hx3918_prox_init();
-               #endif
-               hx3918_init(WEAR_MODE);//打开佩戴检测
-               #if CONFIG_SC7A20
-               if(Gsensor_init_flag == 0)//初始化Gsensor
-                       SC7A20_init();
-               #endif
+    mp_arg_check_num(n_args, n_kw, 0, 4, false);   //检查参数个数
+    if( single_juphoon == NULL ) {
+               single_juphoon = m_new_obj_with_finaliser(juphoon_obj_t);  //创建对象,分配空间
        }
-       
-    return mp_obj_new_int(1);
-}
-
-STATIC mp_obj_t mp_HX3918_deinit(mp_obj_t self_in)
-{
-    HX3918_obj_t *self = MP_OBJ_TO_PTR(self_in);
-
-       HX3918_close();
-       // Helios_GPIO_Deinit((Helios_GPIONum)self->irq);
-       // Helios_ExtInt_Deinit(self->irq);
-       // Helios_I2C_Deinit((Helios_I2CEnum) self->i2c_no);
-       Helios_GPIO_SetLevel(self->power, HELIOS_LVL_LOW);
-
-    return mp_const_none;
-}
-void HX3918_test(uint32_t mode)
-{
-       s_HX3918_heart_rate = 0x0;
-       s_HX3918_heart_rate_buff_count = 0; 
-       s_HX3918_high_blood = 0x0;
-       s_HX3918_low_blood = 0x0;
-       s_HX3918_HRV = 0;
-       //s_HX3918_wear_status = 0;
-       s_HX3918_blood_oxygen = 0x0;
-       if(mode <= close_MODE)
-       {
-               if(hx3918_init(mode) == true)
-               {
-                       is_open_HX3918 = 1;
-                       if(sensor_timer== 0)
-                       {
-                               sensor_timer = Helios_Timer_init( (void* )sensor_timerout_cb, NULL);
+       juphoon_obj_t *self = single_juphoon;
+       self->base.type = &juphoon_type;         //定义对象的类型
+
+    int ret = 0;
+
+    char appkey[CONFIG_STR_LEN + 1] = {0};                     /*appkey 当前APP特有的标识, 需向Juphoon申请获得*/
+    char uid[CONFIG_STR_LEN + 1] = {0};                        /*uid 账户*/
+    char key[CONFIG_STR_LEN + 1] = {0};                        /*key 通讯密钥, 必须与appkey匹配, 需向Juphoon申请或注册*/
+    char tokens[CONFIG_STR_LEN + 1] = {0};                     /*用于鉴权的tokens,默认为""*/
+
+    switch(n_args){
+        case 4:{
+            mp_buffer_info_t tokens_info;
+            mp_get_buffer_raise(args[3], &tokens_info, MP_BUFFER_READ);
+            if( tokens_info.len > CONFIG_STR_LEN ) {
+                               juphoon_LOG("tokens length error");
+                ret = -1;
+                break;
                        }
-                       
-                       Helios_Timer_Start(sensor_timer, TIMER_TIME_MS, IS_CYCLICAL);
-               }
-       }else if(mode == 255)//活体校准功能
-       {
-               // Helios_GPIO_SetLevel(g_HX3918->power, HELIOS_LVL_LOW);
-               // Helios_msleep(150);
-               // Helios_GPIO_SetLevel(g_HX3918->power, HELIOS_LVL_HIGH);
-               // Helios_msleep(20);
-               // hx3918_init(WEAR_MODE);//打开佩戴检测
-               #ifdef  SAR_ALG_LIB
-               hx3918_prox_factory_hanging_cali();
-               #endif
-       }
-
-       
-               
-       
-}
-//打开心律测试
-STATIC mp_obj_t mp_HX3918_open_heart(mp_obj_t self_in)
-{
-
-       HX3918_run_mode = HRS_MODE;
-    return mp_obj_new_int(1);
-}
-//打开血氧测试
-STATIC mp_obj_t mp_HX3918_open_blood_oxygen(mp_obj_t self_in)
-{
-       HX3918_run_mode = SPO2_MODE     ;
-    return mp_obj_new_int(1);
-}
-//打开HRV测试
-STATIC mp_obj_t mp_HX3918_open_hrv(mp_obj_t self_in)
-{
-
-       //HX3918_run_mode = HRV_MODE;
-    return mp_obj_new_int(1);
-}
-//打开测试模式
-STATIC mp_obj_t mp_HX3918_open_test(mp_obj_t self_in,mp_obj_t val1)
-{
-       HX3918_obj_t *self = MP_OBJ_TO_PTR(self_in);
-       HX3918_run_mode = mp_obj_get_int(val1);
-    return mp_obj_new_int(1);
-}
-//设置是否打开sar模式
-STATIC mp_obj_t mp_HX3918_set_sar(mp_obj_t self_in,mp_obj_t val1)
-{
-       HX3918_obj_t *self = MP_OBJ_TO_PTR(self_in);
-       is_open_sar = mp_obj_get_int(val1);
-    return mp_obj_new_int(1);
-}
-void HX3918_close(void)
-{
-       if(is_open_HX3918 == 1)
-       {
-               
-               //hx3918_hrs_disable
-               if(HX3918_jobs_mode == HRS_MODE)
-               {
-                       hx3918_hrs_disable();
-               }else if(HX3918_jobs_mode == SPO2_MODE)
-               {
-                       hx3918_spo2_disable();
-               }else if(HX3918_jobs_mode == HRV_MODE)
-               {
-                       //hx3918_hrv_disable();
-               }
-               if(sensor_timer != 0)
-               {
-                       Helios_Timer_Stop(sensor_timer);
-               }
-       }
-       is_open_HX3918 = 0;
-       HX3918_restart();
-       #ifdef  SAR_ALG_LIB
-       hx3918_prox_init();
-       #endif
-       hx3918_init(WEAR_MODE);//打开佩戴检测
-
-}
-void HX3918_restart(void)
-{
-       Helios_GPIO_SetLevel(g_HX3918->power, HELIOS_LVL_LOW);
-       Helios_msleep(50);
-       Helios_GPIO_SetLevel(g_HX3918->power, HELIOS_LVL_HIGH);
-       Helios_msleep(50);
-}
-//关闭hsensor
-STATIC mp_obj_t mp_HX3918_close(mp_obj_t self_in)
-{
-    HX3918_obj_t *self = MP_OBJ_TO_PTR(self_in);
-       
-       HX3918_run_mode = close_MODE;
-       //Helios_GPIO_SetLevel(self->power, HELIOS_LVL_LOW);
-    return mp_obj_new_int(1);
-}
-//获取心律
-STATIC mp_obj_t mp_HX3918_get_heart(mp_obj_t self_in)
-{
-    return mp_obj_new_int(s_HX3918_heart_rate);
-}
-//获取血氧
-STATIC mp_obj_t mp_HX3918_get_blood_oxygen(mp_obj_t self_in)
-{
-    return mp_obj_new_int(s_HX3918_blood_oxygen);
-}
-//获取血压
-STATIC mp_obj_t mp_HX3918_get_blood_pressure(mp_obj_t self_in)
-{
-    mp_obj_t coordinate_list[2] = {mp_obj_new_int(s_HX3918_high_blood), mp_obj_new_int(s_HX3918_low_blood),};
-    return mp_obj_new_list(2, coordinate_list);
-}
-//获取hrv
-STATIC mp_obj_t mp_HX3918_get_hrv(mp_obj_t self_in)
-{
-    return mp_obj_new_int(s_HX3918_HRV);
-}
-// ir_wear = hx3918_get_wear_ppg_Int_handle();
-//                     cap_wear = hx3918_report_prox_status();
+            memcpy(tokens, tokens_info.buf,tokens_info.len);
+            juphoon_LOG("tokens = %s\n\r",tokens);
+            //no break
+        }
+        
+        case 3:{
+            mp_buffer_info_t key_info;
+            mp_get_buffer_raise(args[2], &key_info, MP_BUFFER_READ);
+            if(key_info.len != 16 ) {
+                juphoon_LOG("key length error\n\r");
+                ret = -1;
+                break;
+            }
+            memcpy(key, key_info.buf,key_info.len);
+            juphoon_LOG(" key = %s\n\r",key);
+            //no break;
+        }
+        
+        case 2:{
+            mp_buffer_info_t uid_info;
+            mp_get_buffer_raise(args[1], &uid_info, MP_BUFFER_READ);
+            if(uid_info.len == 0 || uid_info.len > CONFIG_STR_LEN) {
+                juphoon_LOG("uid length error\n\r");
+                ret = -1;
+                break;
+            }
+            memcpy(uid,uid_info.buf,key_info.len);
+            juphoon_LOG("uid = %s\n\r",uid);
+            //no break
+        }
+        
+        case 1:{
+            mp_buffer_info_t appkey_info;
+            mp_get_buffer_raise(args[0], &appkey_info, MP_BUFFER_READ);
+            if(appkey_info.len == 0 || appkey_info.len > CONFIG_STR_LEN) {
+                juphoon_LOG("appkey length error\n\r");
+                ret = -1;
+                break;
+            }
+            memcpy(appkey, appkey_info.buf, appkey_info.len);
+            juphoon_LOG("appkey = %s\n\r",appkey);
+            break;
+        }
+        
+        default:
+            juphoon_LOG(" info error");
+            ret = -1;
+            break;
+    }
+
+    if(ret != 0){
+        return mp_obj_new_int(ret);
+    }
+
+    juphoon_LOG("ret = %d\n\r",ret);
+       //配置全局参数,只需调用一次.
+       jrtc_config (appkey,  uid, key, tokens);
+    return MP_OBJ_FROM_PTR(self);                 //返回对象的指针
+}
+struct jrtc_t* jrtc_open (const char* id, const char* ticket, struct jrtc_image_t* video, struct jrtc_image_t* camera);
+struct jrtc_image_t
+{/* 可强转为 jrtc_photo_t 使用 */
+    void* data;
+    unsigned bytes;
+    unsigned short width, height;
+    char format;/*< enum jrtc_dtype */
+    char fps;
+    unsigned short kbps;
+    volatile char put, get;
+    char reserve[2];
+};
 
-//获取佩戴状态
-STATIC mp_obj_t mp_HX3918_get_wear(mp_obj_t self_in)
+STATIC const mp_arg_t alipay_pay_config_args[] = 
 {
-       //mp_obj_t coordinate_list[1] = {mp_obj_new_int((int)s_HX3918_wear_status)};
-       //return mp_obj_new_list(1, coordinate_list);
-    return mp_obj_new_int(s_HX3918_wear_status);
-}
-//获取所有数据  心律、血氧、高压、低压、HRV、佩戴状态
-STATIC mp_obj_t mp_HX3918_get_all_data(mp_obj_t self_in)
-{
-    mp_obj_t coordinate_list[6] = {mp_obj_new_int((int)s_HX3918_heart_rate),mp_obj_new_int((int)s_HX3918_blood_oxygen),\
-                                                                  mp_obj_new_int((int)s_HX3918_high_blood),mp_obj_new_int((int)s_HX3918_low_blood),\
-                                                                  mp_obj_new_int((int)s_HX3918_HRV),mp_obj_new_int((int)s_HX3918_wear_status)};
-    return mp_obj_new_list(6, coordinate_list);
+       { MP_QSTR_id,       MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_obj = MP_OBJ_NULL} },
+    { MP_QSTR_ticket,   MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_obj = MP_OBJ_NULL} },
+    { MP_QSTR_bind_interval,      MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } },
+    { MP_QSTR_payment_interval,   MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } },
+    { MP_QSTR_msg_task_priority,  MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } },
+    { MP_QSTR_msg_task_stacksize, MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } },
+    { MP_QSTR_notifier_cb,        MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_obj = MP_OBJ_NULL} },
+    { MP_QSTR_sync_mode,          MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } },
+};
+STATIC mp_obj_t juphoon_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
+{
+    enum {ARG_bind_timeout, ARG_payment_timeout, ARG_bind_interval, ARG_payment_interval, ARG_msg_task_priority, ARG_msg_task_stacksize, 
+        ARG_notifier_cb, ARG_sync_mode,};
+    
+    mp_arg_val_t args[MP_ARRAY_SIZE(alipay_pay_config_args)];
+    mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,MP_ARRAY_SIZE(alipay_pay_config_args), alipay_pay_config_args, args);
+    
+    ALIPAY_obj_t *self = (ALIPAY_obj_t *)MP_OBJ_TO_PTR(pos_args[0]);
+
+    helios_pay_config_t pay_config = {0};
+    int ret = 0;
+
+    pay_config.query_bind_result_timeout = args[ARG_bind_timeout].u_int;
+    pay_config.query_payment_result_timeout = args[ARG_payment_timeout].u_int;
+    pay_config.query_bind_result_interval = args[ARG_bind_interval].u_int;
+    pay_config.query_payment_result_interval = args[ARG_payment_interval].u_int;
+    pay_config.msg_task_priority = args[ARG_msg_task_priority].u_int;
+    pay_config.msg_task_stacksize = args[ARG_msg_task_stacksize].u_int;
+    if (args[ARG_notifier_cb].u_obj != mp_const_none) {
+        static c_callback_t cb = {0};
+        memset(&cb, 0, sizeof(c_callback_t));
+       pay_init_callback = &cb;
+       mp_sched_schedule_callback_register(pay_init_callback, args[ARG_notifier_cb].u_obj);
+    }
+    pay_config.notifier_cb = helios_callback_to_pay_init;
+    pay_config.sync_mode = args[ARG_sync_mode].u_int;
+
+    MP_THREAD_GIL_EXIT();
+       ret  = Helios_upay_init(&pay_config);
+       MP_THREAD_GIL_ENTER();
+    
+    return mp_obj_new_int(ret);
 }
 
-extern factory_result_t factory_reslts; 
-//FT_LEAK_LIGHT_MODE 产测漏光测试模式;
-//FT_GRAY_CARD_MODE 产测灰卡测试模式;
-//LAB_TEST_MODE 实验室模式。
-// extern uint16_t prox_factory_offset0 ;
-// extern uint16_t prox_factory_offset1 ;
-// extern int16_t prox_factory_lp[2] ;
-#ifdef  SAR_ALG_LIB
-extern int16_t nv_wear_offset[2] ;    // 芯片产测校准的两个通道的OFFSET值, 值记录在fash里面
-extern int16_t nv_base_data[2];     // 芯片产测校准的两个通道的对空LP值, 值记录在flash里面
-//lp[0],bl[0],lp[1],bl[1],gdiff[0]
-extern int16_t glp[2] ;
-extern int16_t gbl[2];
-extern int16_t gdiff[2];
-#else
- int16_t nv_wear_offset[2] ;    // 芯片产测校准的两个通道的OFFSET值, 值记录在fash里面
- int16_t nv_base_data[2];     // 芯片产测校准的两个通道的对空LP值, 值记录在flash里面
-//lp[0],bl[0],lp[1],bl[1],gdiff[0]
- int16_t glp[2] ;
- int16_t gbl[2];
- int16_t gdiff[2];
-#endif
-
-STATIC mp_obj_t mp_HX3918_get_test_data(mp_obj_t self_in)
-{
-       mp_obj_t coordinate_list[15] = {mp_obj_new_int((int)factory_reslts.green_data_final),mp_obj_new_int((int)factory_reslts.red_data_final),mp_obj_new_int((int)factory_reslts.ir_data_final),
-                                                                       mp_obj_new_int((int)ir_wear),mp_obj_new_int((int)cap_wear),mp_obj_new_int((int)glp[0]),mp_obj_new_int((int)gbl[0]),mp_obj_new_int((int)glp[1]),mp_obj_new_int((int)gbl[1]),
-                                                                       mp_obj_new_int((int)(gdiff[0])),mp_obj_new_int((int)(gdiff[1])),mp_obj_new_int((int)nv_wear_offset[0]),mp_obj_new_int((int)nv_wear_offset[1]),mp_obj_new_int((int)nv_base_data[0]),
-                                                                       mp_obj_new_int((int)nv_base_data[1]),
-                                                                  };
-       return mp_obj_new_list(15, coordinate_list);
-}
-//设置sleep
-STATIC mp_obj_t mp_HX3918_set_sleep(mp_obj_t self_in)
-{
-       HX3918_sleep_flag = 1;
-       HX3918_LOG("mp_HX3918_set_sleep\r\n");
-    return mp_obj_new_int(1);
-}
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_init_HX3918_obj, mp_HX3918_init);//初始化
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_deinit_HX3918_obj, mp_HX3918_deinit);//
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_activate_HX3918_obj, mp_activate_HX3918);//
index 2a8e5aa..771238d 100644 (file)
@@ -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
index da27311..c3cd4fd 100644 (file)
@@ -842,15 +842,15 @@ class intervManager(Abstract):
         get_spo2_state = EventMesh.publish("get_spo2_state")
         get_temp_state = EventMesh.publish("get_temp_state")
         if get_hr_state != None or get_spo2_state != None or get_temp_state != None:
-            if get_hr_state == 1:
+            if get_hr_state != 0:
                 EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率 
                 print("sstop hr")
                 EventMesh.publish(constants.EVENT.STOP_HEART) 
-            elif get_spo2_state == 1:
+            elif get_spo2_state != 0:
                 print("stop spo2")
                 EventMesh.publish("set_spo2_state",0)#2代表后台进入测试
                 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
-            if get_temp_state == 1:
+            if get_temp_state != 0:
                 print("stop temp")
                 EventMesh.publish("set_temp_state",0)
                 EventMesh.publish(constants.EVENT.STOP_TEMP)#手动体温测试
@@ -941,7 +941,7 @@ class intervManager(Abstract):
         if data_tmp.find(".") != -1:
             temp_shi = int(data_tmp.split('.')[0])//10
             temp_ge = int(data_tmp.split('.')[0])%10
-            dot_ge = int(data_tmp.split('.')[1])%10
+            dot_ge = int(data_tmp.split('.')[1][:1])
             if temp_ge > 0:#37.0
                 if dot_ge > 0:#37.5
                     str_data = 'mp3files={}.mp3+{}.mp3+{}.mp3+{}.mp3+{}.mp3+{}.mp3'.format(audio_buf.index("R_HSENSOR_TEMP_TITLE"),audio_buf.index("R_READ_TIME_{}".format(temp_shi)),\
@@ -1692,7 +1692,7 @@ class BtnDevice(Abstract):
         self.pwkey_count = 0
         self.pwkey_press = 0
         self.led_state = 0
-
+        self.hsensorTest_timer = osTimer()
         self.btnInfo_queue = Queue()
         _thread.stack_size(10*1024+192)
         _thread.start_new_thread(self.btnInfo_queue_thread, ())
@@ -1798,10 +1798,59 @@ class BtnDevice(Abstract):
                     self.pwKey_press_count+=1
                     self.pwkey_timer.start(500, 0, self.publish_pwKey_timeout_cb_do)#松手超时1s判断
 
+    def  hsensorTest_timer_cb(self,e):
+        EventMesh.publish("system_sleep_rest")#防止黑屏 
+        w_data = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据
+        #print("FactoryModeHsensorTest{}".format(data))
+    
+        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],)
+            
+        if(self.hsensorTest_timer_count != 0):
+                self.hsensorTest_timer_count -= 1
+                if self.hsensorTest_timer_count%5 == 0:
+                    print("c_data:{} {} {} {}".format(c_data[11],c_data[12],c_data[13],c_data[14]))
+                    if c_data[11] != 0 and c_data[13] != 0: #校准成功
+                        str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_HSENSOR_RESULT_OK"))
+                        EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
+                        self.Hsensor.close() 
+                        self.Hsensor.init()
+                        self.hsensorTest_timer.stop()
+                        return
+                if self.hsensorTest_timer_count == 0:#50秒超时,失败
+                    self.Hsensor.close() 
+                    self.Hsensor.init(); 
+                    self.hsensorTest_timer.stop()
+                    str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_HSENSOR_RESULT_FAILE"))
+                    EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
+            
     def publish_pwKey_timeout_cb_do(self, *args, **kwargs):
         EventMesh.publish("publish_message_event_btnInfo",{"func":self.pwKey_timeout_cb,"data":0})  
-
+    
     def pwKey_timeout_cb(self, data):#侧边按键
+        boot_count = EventMesh.publish("get_boot_time_count")
+        try :
+            if boot_count < 50 :#开机50秒内按键次数大于10就校准
+                #print("boot_count:{}".format(boot_count))
+                if self.pwKey_press_count >= 10:
+                    self.Hsensor =  EventMesh.publish("get_Hsensor")
+                    self.hsensorTest_timer.start(1000,1,self.hsensorTest_timer_cb) 
+                    print("打开校准模式")
+                    self.Hsensor.set_sar(1)
+                    self.Hsensor.open_test(255) #打开校准模式
+                    utime.sleep_ms(500)
+                    self.Hsensor.open_heart()
+                    self.hsensorTest_timer_count = 50
+                    self.hsensorTest_timer.start(1000,1,self.hsensorTest_timer_cb)
+                    str_data = 'mp3files={}.mp3+{}.mp3'.format(audio_buf.index("R_HSENSOR_RESULT_HR_TITLE"),audio_buf.index("R_HSENSOR_SPO2_TITLE"),)
+                    EventMesh.publish("play_audio_file",[str_data,1])
+                    self.pwKey_press_count = 0
+                    return
+
+        except Exception as e:
+            usys.print_exception(e)
         if self.pwKey_press_count >= 1:
             print("pwKey_timeout_cb:self.pwKey_press_count >= 1")
             EventMesh.publish("stop_led_timer")#设置参数
@@ -1818,6 +1867,7 @@ class BtnDevice(Abstract):
             flag = EventMesh.publish("get_call_state") 
             if flag != 1:
                 EventMesh.publish("set_sim_mode")#
+        
         self.pwKey_press_count = 0
 
     def sosKey_extint_cb(self,args):
index 3e626ed..f528b02 100644 (file)
@@ -24,6 +24,7 @@ from machine import I2C
 from Gsensor import SC7A20
 import pm
 import ure
+import urandom
 try :
     from Hsensor import GH3018
 except Exception as e:
@@ -649,7 +650,7 @@ class DeviceInfoManager(Abstract):
         _thread.stack_size((9+6)*1024)
         _thread.start_new_thread(self.DeviceInfo_queue_thread, ())
         _thread.stack_size(8*1024)
-        
+        self.boot_time_count = 0
         EventMesh.subscribe("publish_message_event_DeviceInfo",self.publish_message_event_DeviceInfo)
         self.key = ""
         self.imei = ""
@@ -692,6 +693,7 @@ class DeviceInfoManager(Abstract):
         self.temp_time = 0
         self.temp_state = 0
         self.temp_one_state = 0
+        self.temp_warning = 0
 
         self.vbat_count = 0
 
@@ -790,7 +792,7 @@ class DeviceInfoManager(Abstract):
         EventMesh.subscribe(constants.EVENT.START_TEMP, self.start_temp)
         EventMesh.subscribe(constants.EVENT.STOP_TEMP, self.stop_temp)
         EventMesh.subscribe(constants.EVENT.GET_TEMP, self.get_temp)
-
+        EventMesh.subscribe("get_boot_time_count", self.get_boot_time_count)
         print("post_processor_after_instantiation:2")
         self.timer_push_schedule.start(10000, 1, self.publish_event_cb)
         # self.timer_pusht_test.start(2000, 1, self.publish_test)
@@ -834,9 +836,31 @@ class DeviceInfoManager(Abstract):
             pass
             # if flip_sw == 1:
             #     EventMesh.publish(constants.EVENT.SYSTEM_SLEEP)
-
+    def get_boot_time_count(self, event, msg):
+        return self.boot_time_count
     def publish_event_cb(self, *args, **kwargs):
+        if self.boot_time_count < 50000000:
+            self.boot_time_count += 10
+            #print("boot_time_count:{}".format(self.boot_time_count))
         EventMesh.publish("publish_message_event_DeviceInfo",{"func":self.publish_event,"data":0})  
+    def optimize_temp(self,temp):
+        temp += 0.5
+        get_temp_time  = EventMesh.publish("get_temp_time")
+        print("temp:{}".format(temp))
+        if temp < 36 :#or temp > 37.5:
+            temp = 36+urandom.random()
+        if temp > 37.5:
+            
+            self.temp_warning += 1
+            print("temp_warning:{} get_temp_time{}".format(self.temp_warning,get_temp_time))
+            
+            if self.temp_warning*get_temp_time < 3:#高温没连续超过3次,和谐成37.5度以下
+                temp = 37+(urandom.randint(1, 4)/10)
+        else:
+            if self.temp_warning>=1:
+                self.temp_warning -= 1
+            
+        return temp
     def publish_event(self,data):
         """
         定时事件处理
@@ -1066,13 +1090,11 @@ class DeviceInfoManager(Abstract):
                                 print("AUTO temp:") 
                                 EventMesh.publish(constants.EVENT.START_TEMP)
 
-                            elif (time_tmp-self.temp_time) >= 60 and self.temp_state == 1:
+                            elif (time_tmp-self.temp_time) >= 30 and self.temp_state == 1:
                                 self.temp_state = 0
                                 self.temp_one_state = 0
                                 temp = EventMesh.publish(constants.EVENT.GET_TEMP) 
-                                temp += 0.5
-                                if temp < 25 or temp > 42:
-                                    temp = 0
+                                temp = self.optimize_temp(temp)
                                 EventMesh.publish("set_temp_state",0)
                                 tmp_f_tmp = 0
                                 tmp_d_tmp = 0
@@ -1105,12 +1127,11 @@ class DeviceInfoManager(Abstract):
                                         EventMesh.publish("set_temp_state",3)
                                         print("AUTO one temp:1") 
                                         EventMesh.publish(constants.EVENT.START_TEMP)   
-                                    elif self.temp_one_state > 6:
+                                    elif self.temp_one_state > 3:
                                         self.temp_one_state = 0
                                         temp = EventMesh.publish(constants.EVENT.GET_TEMP) 
-                                        temp += 0.5
-                                        if temp < 25 or temp > 42:
-                                            temp = 0
+                                        temp = self.optimize_temp(temp)
+                                        
                                         EventMesh.publish("set_temp_state",0)
                                         tmp_f_tmp = 0
                                         tmp_d_tmp = 0
@@ -1155,12 +1176,11 @@ class DeviceInfoManager(Abstract):
                             print("AUTO one temp:2") 
                             EventMesh.publish("set_temp_state",3)
                             EventMesh.publish(constants.EVENT.START_TEMP)   
-                        elif self.temp_one_state > 6:
+                        elif self.temp_one_state > 3:
                             self.temp_one_state = 0
                             temp = EventMesh.publish(constants.EVENT.GET_TEMP) 
-                            temp += 0.5
-                            if temp < 25 or temp > 42:
-                                temp = 0
+                            temp = self.optimize_temp(temp)
+                            
                             EventMesh.publish("set_temp_state",0)
                             tmp_f_tmp = 0
                             tmp_d_tmp = 0
@@ -1548,9 +1568,7 @@ class DeviceInfoManager(Abstract):
                         self.temp_one_state = 0
                         self.temp_state = 0
                         temp = EventMesh.publish(constants.EVENT.GET_TEMP)       
-                        temp += 0.5      
-                        if temp < 25 or temp > 42:
-                            temp = 0
+                        temp = self.optimize_temp(temp)
                         EventMesh.publish("set_temp_state",0)
                         tmp_f_tmp = 0
                         tmp_d_tmp = 0
@@ -1600,7 +1618,12 @@ class DeviceInfoManager(Abstract):
                                 EventMesh.publish(constants.PROTOCOL.HEART_SEND,heart_value)#上传心率数据
                             else:
                                 EventMesh.publish("play_hr_value",0) 
-
+                        else :
+                            if WEAR  != 1:
+                                EventMesh.publish("set_hr_state",0)#0代表g关闭测试
+                                print("stop debug7")
+                                EventMesh.publish(constants.EVENT.STOP_HEART)                               
+                                EventMesh.publish("play_hr_value",0) 
                 pass
             if spo2_state == 1:#手动测试血氧
                 time_s = EventMesh.publish("get_start_measure_time")#设置开始测量的时间戳时间
@@ -1617,18 +1640,22 @@ class DeviceInfoManager(Abstract):
                                 EventMesh.publish(constants.PROTOCOL.OXYGEN_SEND,spo2_value)
                             else:
                                 EventMesh.publish("play_spo2_value",0)
+                        else :
+                            if WEAR  != 1:
+                                EventMesh.publish("set_spo2_state",0)#0代表g关闭测试
+                                print("stop debug8")
+                                EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)                               
+                                EventMesh.publish("play_spo2_value",0) 
                 pass
 
             if temp_state == 1:#手动测试体温
                 time_s = EventMesh.publish("get_start_temp_measure_time")#设置开始测量的时间戳时间
                 if time_s != None:
                     if time_s != 0:
-                        if (time_tmp - time_s) >= 60:#大于60s关闭测试
+                        if (time_tmp - time_s) >= 30:#大于60s关闭测试
                             print("体温测量结束")
                             temp = EventMesh.publish(constants.EVENT.GET_TEMP)       
-                            temp += 0.5      
-                            if temp < 25 or temp > 42:
-                                temp = 0
+                            temp = self.optimize_temp(temp)
                             print("temp",temp)
                             EventMesh.publish("set_temp_state",0)
                             tmp_f_tmp = 0
@@ -1652,6 +1679,12 @@ class DeviceInfoManager(Abstract):
                                     EventMesh.publish("play_temp_value",0)#播放体温数值
                             
                             EventMesh.publish(constants.EVENT.STOP_TEMP)
+                        else :
+                            if WEAR  != 1:
+                                EventMesh.publish("set_temp_state",0)#0代表g关闭测试
+                                print("stop debug9")
+                                EventMesh.publish(constants.EVENT.STOP_TEMP)                               
+                                EventMesh.publish("play_temp_value",0) 
 
         EventMesh.publish("play_unread_wechat_infor")#每10s检测是否有未读语音数据
 
@@ -1935,6 +1968,7 @@ class DeviceInfoManager(Abstract):
         print("start_temp!!!!!!!")
         WHO_AM_I = bytearray([0x01, 0])
         I2C_SLAVE_ADDR = 0x49
+        #I2C_SLAVE_ADDR = 0x48
         r_data = bytearray(2)
         data = bytearray([0x61A0, 0])   # 唤醒
         return self.i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2)
@@ -1942,6 +1976,7 @@ class DeviceInfoManager(Abstract):
         print("stop_temp!!!!!!!")
         WHO_AM_I = bytearray([0x01, 0])
         I2C_SLAVE_ADDR = 0x49
+        #I2C_SLAVE_ADDR = 0x48
         r_data = bytearray(2)
         data = bytearray([0x60A0, 0])   #休眠
         return self.i2c0.write(I2C_SLAVE_ADDR, WHO_AM_I, 1, data, 2)
@@ -1949,13 +1984,14 @@ class DeviceInfoManager(Abstract):
     def get_temp(self, topic, msg):
         WHO_AM_I = bytearray([0x00, 0])
         I2C_SLAVE_ADDR = 0x49
+        #I2C_SLAVE_ADDR = 0x48
         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))
+        print("temp_data:{}".format(temp_data))
         return temp_data
  
             
@@ -2313,10 +2349,10 @@ class LocationManager(Abstract):
                         rmc_data = quecgnss.get_rmc()
                         gga_data = quecgnss.get_gga()
                         vtg_data = quecgnss.get_vtg()
-                        print("gsv:{}".format(quecgnss.get_gsv()))
-                        print("gga:{}".format(quecgnss.get_gga()))
-                        print("rmc:{}".format(quecgnss.get_rmc()))
-                        print("vtg:{}".format(quecgnss.get_vtg())) 
+                        # print("gsv:{}".format(quecgnss.get_gsv()))
+                        # print("gga:{}".format(quecgnss.get_gga()))
+                        # print("rmc:{}".format(quecgnss.get_rmc()))
+                        # print("vtg:{}".format(quecgnss.get_vtg())) 
                         for i in range(len(gsv_data)) :
                             
                             if i % 2 == 0:
@@ -2415,12 +2451,13 @@ class LocationManager(Abstract):
                 elif self.location_type == 0: #正常模式     
                     if self.gps_data  != {} or self.location_timer_count > 100: #or( self.wifi_data != [] and self.cell_data != []): 
                         if self.location_queue.empty() == False:#有定位队列
-                            EventMesh.txt_log("LOCATION timer:{} ok:{} very_ok:{}".format(self.location_timer_count,self.GSV_sig_ok_count,self.GSV_sig_very_ok_count))   
+                            pass
+                            #EventMesh.txt_log("LOCATION timer:{} ok:{} very_ok:{}".format(self.location_timer_count,self.GSV_sig_ok_count))   
                             #EventMesh.txt_log("LOCATION:timer:{} ok_count:{} ".format(self.location_timer_count,self.GSV_sig_ok_count))
                         if self.gps_data  == {}: #定位超时,且信噪比多个大于30,下次启动agps
                             if self.GSV_sig_very_ok_count > 3:#3个超30以上
                                 self.start_agps = 1
-                                EventMesh.txt_log("open agps:{}".format(GSV_dict))
+                                #EventMesh.txt_log("open agps:{}".format(GSV_dict))
                         #upload_time = EventMesh.publish("get_upload_data")    
                         self.Location_send([self.gps_data,self.wifi_data,self.cell_data])
                         #if upload_time > 200  : 
@@ -2437,7 +2474,7 @@ class LocationManager(Abstract):
                         
                     if self.GSV_sig_ok_count <= 1 and self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 20: #超过40秒且信号大于30的不足3个
                         EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位   
-                        EventMesh.txt_log("GSV_sig_ok_count<3:timer:{} ok_count:{} ".format(self.location_timer_count,self.GSV_sig_ok_count))
+                        #EventMesh.txt_log("GSV_sig_ok_count<3:timer:{} ok_count:{} ".format(self.location_timer_count,self.GSV_sig_ok_count))
                         self.Location_send([self.gps_data,self.wifi_data,self.cell_data])
                         #break
                 # if self.location_type != 1 and self.location_timer_count >= 60*4 : #4分钟关闭
index 384631a..32bf6e3 100644 (file)
@@ -4,6 +4,7 @@
  * Helios SDK Configuration
  *
  */
+#define PROJECT_NAME_G5_D10  1  //项目宏定义
 #define CONFIG_LVGL_SPAN 1
 #define CONFIG_LVGL_FS_HELIOS 1
 #define CONFIG_LVGL_GIF_DECODE 1
 #define CONFIG_VIOCE_CALL 1
 #define CONFIG_LVGL_FS_EXTFLASH_HELIOS 1
 #define CONFIG_LVGL_TABVIEW 1
-#define CONFIG_LVGL_LINE 1
+//#define CONFIG_LVGL_LINE 1
 #define CONFIG_LVGL 1
-#define CONFIG_LVGL_CHART 1
-#define CONFIG_LVGL_LIST 1
-#define CONFIG_LVGL_MSGBOX 1
-#define CONFIG_LVGL_ARC 1
-#define CONFIG_LVGL_METER 1
-#define CONFIG_LVGL_JPG_DECODE 1
-#define CONFIG_LVGL_PNG_DECODE 1
-#define CONFIG_LVGL_IMGBTN 1
-#define CONFIG_GH301x 1
+// #define CONFIG_LVGL_CHART 1
+// #define CONFIG_LVGL_LIST 1
+// #define CONFIG_LVGL_MSGBOX 1
+// #define CONFIG_LVGL_ARC 1
+// #define CONFIG_LVGL_METER 1
+// #define CONFIG_LVGL_JPG_DECODE 1
+// #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
index aa98ec6..7f176d0 100644 (file)
@@ -2,14 +2,14 @@
 # Automatically generated file; DO NOT EDIT.
 # Helios SDK Configuration
 #
-
+PROJECT_NAME_G5_D10=y
 #
 # System Configuration
 #
 CONFIG_MBEDTLS=y
 
 #
-# EG810MCN_GA_ALIPAY
+# EG810MCN_GA_VOLTE
 #
 CONFIG_LVGL=y
 
@@ -18,17 +18,17 @@ CONFIG_LVGL=y
 #
 CONFIG_LVGL_PNG_DECODE=y
 # CONFIG_LVGL_GIF_DECODE is not set
-CONFIG_LVGL_JPG_DECODE=y
-CONFIG_LVGL_FS_HELIOS=y
+#CONFIG_LVGL_JPG_DECODE=y
+#CONFIG_LVGL_FS_HELIOS=y
 # CONFIG_LVGL_FS_SD_HELIOS is not set
 CONFIG_LVGL_FS_EXTFLASH_HELIOS=y
 # CONFIG_LVGL_CUSTOMER_FONT_SUPPORT is not set
 CONFIG_LVGL_QRCODE=y
 # CONFIG_LVGL_FONT is not set
 # CONFIG_LVGL_ARC is not set
-CONFIG_LVGL_IMGBTN=y
-CONFIG_LVGL_LINE=y
-CONFIG_LVGL_LIST=y
+#CONFIG_LVGL_IMGBTN=y
+#CONFIG_LVGL_LINE=y
+#CONFIG_LVGL_LIST=y
 # CONFIG_LVGL_CHART is not set
 # CONFIG_LVGL_LED is not set
 CONFIG_LVGL_CANVAS=y
@@ -57,5 +57,6 @@ CONFIG_VIOCE_CALL=y
 CONFIG_LCD=y
 # CONFIG_UART_SLIP is not set
 # CONFIG_POC is not set
-CONFIG_GH301x=y
+#CONFIG_GH301x=y
+CONFIG_HX3918=y
 CONFIG_SC7A20=y
index 62b14c0..4b4f098 100644 (file)
@@ -336,7 +336,7 @@ class FactoryModeHsensorTestScreen(Screen):
                 self.hsensorTest_timer_count -= 1
                 if self.hsensorTest_timer_count == 0:
                     self.Hsensor.close() 
-                    self.Hsensor.init();   
+                    self.Hsensor.init()  
 
     def Close(self):
         self.hsensorTest_timer.stop()
index d42031d..595e1f5 100644 (file)
@@ -2078,7 +2078,7 @@ class LocationManager(Abstract):
         send_data += ",%s,%d,%s"%(state,CELL_num,CELL_data)
         send_data += ",%d,%s"%(WIFI_num,WIFI_data)
         send_data+=",%s"%(precision)
-        #print("Location_send2:{} q_size:{}".format(send_data,self.location_queue.size()))
+        print("Location_send2:{} q_size:{}".format(send_data,self.location_queue.size()))
         while True:
             if self.location_queue.empty() == False:
                 TYPE = self.location_queue.get()
@@ -2163,10 +2163,10 @@ class LocationManager(Abstract):
                         rmc_data = quecgnss.get_rmc()
                         gga_data = quecgnss.get_gga()
                         vtg_data = quecgnss.get_vtg()
-                        print("gsv:{}".format(quecgnss.get_gsv()))
-                        print("gga:{}".format(quecgnss.get_gga()))
-                        print("rmc:{}".format(quecgnss.get_rmc()))
-                        print("vtg:{}".format(quecgnss.get_vtg())) 
+                        # print("gsv:{}".format(quecgnss.get_gsv()))
+                        # print("gga:{}".format(quecgnss.get_gga()))
+                        # print("rmc:{}".format(quecgnss.get_rmc()))
+                        # print("vtg:{}".format(quecgnss.get_vtg())) 
                         for i in range(len(gsv_data)) :
                             
                             if i % 2 == 0: