static void HMI_thread_entry(void *parameter) { u8 counter_printer = 0; TIRED_DoorValue_Init(); Init_4442(); IC_info_default(); //--------自检过后操作DF 读取----- DF_init(); SysConfiguration(); // system config // total_ergotic(); DF_initOver = 1; Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate pMenuItem = &Menu_0_0_self_Checking; pMenuItem->show(); pMenuItem->timetick(10); pMenuItem->keypress(10); while (1) { // 6. ACC 状态检测 ACC_status_Check(); //-------------------------------------------- rt_thread_delay(25); //25 } }
static void HMI_thread_entry(void *parameter) { u8 counter_printer = 0; TIRED_DoorValue_Init(); Init_4442(); IC_info_default(); while(1) { pMenuItem = &Menu_0_0_self_Checking; pMenuItem->show(); pMenuItem->timetick(10); pMenuItem->keypress(10); if(self_checking_result == 10) //自检正常 { //rt_kprintf("\r\n------------------自检正常,退出-------"); break; } if(self_checking_result == 30) //自检异常2,按 确认 后为3 { //rt_kprintf("\r\n------------------自检异常,退出-------"); break; } rt_thread_delay(25); } //--------自检过后操作DF 读取----- DF_init(); SysConfiguration(); // system config total_ergotic(); DF_initOver = 1; Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate //----------------------------------------------------------------- if(Login_Menu_Flag == 0) { JT808Conf_struct.Regsiter_Status = 0; //需要重新注册 pMenuItem = &Menu_0_0_password; pMenuItem->show(); } else { pMenuItem = &Menu_1_Idle; pMenuItem->show(); } while (1) { // 6. ACC 状态检测 ACC_status_Check(); #if 1 pMenuItem->timetick( 10 ); pMenuItem->keypress( 10 ); //------- if((print_rec_flag == 1) && (TTS_Var.Playing == 0)) // 为了避开大电流 播报时候不打印 { counter_printer++; if(counter_printer >= 5) //加电后1s开始打印,打印间隔必须>300ms { counter_printer = 0; #ifdef SPD_WARN_SAVE if(ExpSpdRec_write > 0) { ReadEXspeed(1); WatchDog_Feed(); Dis_chaosu(data_tirexps); } #endif print_rec_flag = 2; DaYin = 1; //开始打印 WatchDog_Feed(); } } else if(print_rec_flag == 2) { counter_printer++; if(counter_printer >= 2) //打印间隔必须>300ms 7 { counter_printer = 0; Dayin_Fun(1); } } if(ASK_Centre.ASK_disp_Enable == 1) { ASK_Centre.ASK_disp_Enable = 0; pMenuItem = &Menu_3_1_CenterQuesSend; pMenuItem->show(); } else if(TextInfo.TEXT_SD_FLAG == 1) { TextInfo.TEXT_SD_FLAG = 0; pMenuItem = &Menu_7_CentreTextDisplay; pMenuItem->show(); } #endif //-------------------------------------------- rt_thread_delay(25); //25 } }
static void keypress(unsigned int key) { switch(KeyValue) { case KeyValueMenu: if(comfirmation_flag==4) { pMenuItem=&Menu_1_Idle; pMenuItem->show(); } else { pMenuItem=&Menu_0_loggingin; pMenuItem->show(); } col_screen=0; CarBrandCol_Cou=1; comfirmation_flag=0; break; case KeyValueOk: if(col_screen==1) { if(MENU_set_carinfor_flag==1) { comfirmation_flag=0; lcd_fill(0); lcd_text12(12,3,"车牌颜色设置完成",16,LCD_MODE_SET); lcd_text12(24,18,"按菜单键返回",12,LCD_MODE_SET); lcd_update_all(); rt_kprintf("\r\n车牌颜色设置完成,按菜单键返回,%d",Vechicle_Info.Dev_Color); // 车牌颜色 if(License_Not_SetEnable==1) Vechicle_Info.Dev_Color=0; else Vechicle_Info.Dev_Color=Menu_color_num; DF_WriteFlashSector(DF_Vehicle_Struct_offset,0,(u8*)&Vechicle_Info,sizeof(Vechicle_Info)); } else { col_screen=2; CarSet_0_counter=0;// menu_color_flag=1;//车牌颜色设置完成 lcd_fill(0); lcd_text12(20,3,(char *)car_col,13,LCD_MODE_SET); lcd_text12(12,18,"按确认键查看信息",16,LCD_MODE_SET); lcd_update_all(); } } else if(col_screen==2) { menu_color_flag=0; col_screen=3; comfirmation_flag=1;//保存设置信息标志 lcd_fill(0); if(License_Not_SetEnable==1) lcd_text12(0,0,"无牌照",6,LCD_MODE_SET); else lcd_text12(0,0,(char *)Menu_Car_license,8,LCD_MODE_SET); lcd_text12(54,0,(char *)Menu_VechileType,6,LCD_MODE_SET); //==== 车牌号未设置===== if(License_Not_SetEnable==1) lcd_text12(96,0,(char *)"0",1,LCD_MODE_SET); else lcd_text12(96,0,(char *)Menu_VecLogoColor,4,LCD_MODE_SET); lcd_text12(0,12,"SIM卡号",7,LCD_MODE_SET); lcd_text12(43,12,(char *)Menu_sim_Code,11,LCD_MODE_SET); lcd_text12(24,23,"确定",4,LCD_MODE_INVERT); lcd_text12(72,23,"取消",4,LCD_MODE_SET); lcd_update_all(); } else if(comfirmation_flag==1) { col_screen=0; comfirmation_flag=4; //保存设置的信息 lcd_fill(0); lcd_text12(18,3,"保存已设置信息",14,LCD_MODE_SET); lcd_text12(0,18,"按菜单键进入待机界面",20,LCD_MODE_SET); lcd_update_all(); // 保存速度类型 // gps速度JT808Conf_struct.Speed_GetType= 0: 传感器速度 JT808Conf_struct.Speed_GetType=1 spd_type(JT808Conf_struct.Speed_GetType); //车牌号 //rt_kprintf("\r\n(保存信息)Menu_Car_license=%s",Menu_Car_license); memset(Vechicle_Info.Vech_Num,0,sizeof(Vechicle_Info.Vech_Num)); memcpy(Vechicle_Info.Vech_Num,Menu_Car_license,strlen((const char*)Menu_Car_license)); //rt_kprintf("\r\n(保存信息)Vechicle_Info.Vech_Num=%s",Vechicle_Info.Vech_Num); // 车辆类型 memset(Vechicle_Info.Vech_Type,0,sizeof(Vechicle_Info.Vech_Type)); memcpy(Vechicle_Info.Vech_Type,Menu_VechileType,10); //rt_kprintf("\r\n(保存1 )Vechicle_Info.Vech_Num=%s",Vechicle_Info.Vech_Num); /////// //车辆VIN memset(Vechicle_Info.Vech_VIN,0,sizeof(Vechicle_Info.Vech_VIN)); memcpy(Vechicle_Info.Vech_VIN,Menu_Vin_Code,17); //rt_kprintf("\r\n(保存2 )Vechicle_Info.Vech_Num=%s",Vechicle_Info.Vech_Num); // SIM卡号码 //memset(JT808Conf_struct.Vech_sim,0,sizeof(JT808Conf_struct.Vech_sim)); //memcpy(JT808Conf_struct.Vech_sim,Menu_sim_Code,11); //----------------------------------------------------------------------------- memset(SimID_12D,0,sizeof(SimID_12D)); SimID_12D[0]='0'; memcpy(SimID_12D+1,Menu_sim_Code,11); DF_WriteFlashSector(DF_SIMID_12D,0,SimID_12D,13); delay_ms(80); //rt_kprintf("\r\n 显示屏设备SIM_ID设置为 : %s", SimID_12D); DF_ReadFlash(DF_SIMID_12D,0,SimID_12D,13); SIMID_Convert_SIMCODE(); // 转换 //---------------------------------------------------------------------------- //rt_kprintf("\r\n(保存3 )Vechicle_Info.Vech_Num=%s",Vechicle_Info.Vech_Num); // 车牌颜色 if(License_Not_SetEnable==1) Vechicle_Info.Dev_Color=0; else Vechicle_Info.Dev_Color=Menu_color_num; //车辆设置完成 Login_Menu_Flag=1; // 输入界面为0 DF_WriteFlashSector(DF_LOGIIN_Flag_offset,0,&Login_Menu_Flag,1); // 存储 //rt_kprintf("\r\n(保存4 )Vechicle_Info.Vech_Num=%s",Vechicle_Info.Vech_Num); DF_WriteFlashSector(DF_Vehicle_Struct_offset,0,(u8*)&Vechicle_Info,sizeof(Vechicle_Info)); WatchDog_Feed(); DF_WriteFlashSector(DF_VehicleBAK_Struct_offset,0,(u8*)&Vechicle_Info,sizeof(Vechicle_Info)); WatchDog_Feed(); DF_WriteFlashSector(DF_VehicleBAK2_Struct_offset,0,(u8*)&Vechicle_Info,sizeof(Vechicle_Info)); delay_ms(3); DF_ReadFlash(DF_Vehicle_Struct_offset,0,(u8*)&Vechicle_Info,sizeof(Vechicle_Info)); } else if(comfirmation_flag==2) { col_screen=0; comfirmation_flag=3; lcd_fill(0); lcd_text12(6, 3,"请确认是否重新设置",18,LCD_MODE_SET); lcd_text12(12,18,"按确认键重新设置",16,LCD_MODE_SET); lcd_update_all(); } else if(comfirmation_flag==3) { col_screen=0; comfirmation_flag=0; //重新设置 pMenuItem=&Menu_0_loggingin; pMenuItem->show(); comfirmation_flag=0; col_screen=0; CarBrandCol_Cou=1; } break; case KeyValueUP: if(col_screen==1) { CarBrandCol_Cou--; if(CarBrandCol_Cou<1) CarBrandCol_Cou=5; car_col_fun(CarBrandCol_Cou); } else if(col_screen==3) { comfirmation_flag=1; lcd_fill(0); if(License_Not_SetEnable==1) lcd_text12(0,0,"无牌照",6,LCD_MODE_SET); else lcd_text12(0,0,(char *)Menu_Car_license,8,LCD_MODE_SET); lcd_text12(54,0,(char *)Menu_VechileType,6,LCD_MODE_SET); //==== 车牌号未设置===== if(License_Not_SetEnable==1) lcd_text12(96,0,(char *)"0",1,LCD_MODE_SET); else lcd_text12(96,0,(char *)Menu_VecLogoColor,4,LCD_MODE_SET); lcd_text12(0,12,"SIM卡号",7,LCD_MODE_SET); lcd_text12(43,12,(char *)Menu_sim_Code,11,LCD_MODE_SET); lcd_text12(24,23,"确定",4,LCD_MODE_INVERT); lcd_text12(72,23,"取消",4,LCD_MODE_SET); lcd_update_all(); } break; case KeyValueDown: if(col_screen==1) { CarBrandCol_Cou++; if(CarBrandCol_Cou>5) CarBrandCol_Cou=1; car_col_fun(CarBrandCol_Cou); } else if(col_screen==3) { comfirmation_flag=2; lcd_fill(0); if(License_Not_SetEnable==1) lcd_text12(0,0,"无牌照",6,LCD_MODE_SET); else lcd_text12(0,0,(char *)Menu_Car_license,8,LCD_MODE_SET); lcd_text12(54,0,(char *)Menu_VechileType,6,LCD_MODE_SET); //==== 车牌号未设置===== if(License_Not_SetEnable==1) lcd_text12(96,0,(char *)"0",1,LCD_MODE_SET); else lcd_text12(96,0,(char *)Menu_VecLogoColor,4,LCD_MODE_SET); lcd_text12(0,12,"SIM卡号",7,LCD_MODE_SET); lcd_text12(43,12,(char *)Menu_sim_Code,11,LCD_MODE_SET); lcd_text12(24,23,"确定",4,LCD_MODE_SET); lcd_text12(72,23,"取消",4,LCD_MODE_INVERT); lcd_update_all(); } break; } KeyValue=0; }
static void gsm_thread_entry(void* parameter) { u8 atd_str[25]; rt_size_t res=RT_ERROR; // finsh_init(&shell->parser); // // step 1: Init Dataflash DF_init(); APP_IOpinInit(); rt_kprintf("\r\n ---> gsm thread start !\r\n"); HardWareVerion=HardWareGet(); // step 2: process config data SysConfiguration(); // system config total_ergotic(); Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate #ifdef HMI HMI_app_init(); #endif gps_init(); //-------------------------------------- while (1) { if(GSM_Working_State()) { // 1. after power on get imsi code IMSIcode_Get(); // 2. after get imsi Comm AT initial start GSM_Module_TotalInitial(); // 3. Receivce & Process Communication Module data ---- GSM_Buffer_Read_Process(); } rt_thread_delay(20); if(GSM_Working_State()==2) { DataLink_Process(); //------------------------------------------------ if (Send_DataFlag== 1) { res=rt_device_control(&Device_GSM, query_online, NULL); if(res==RT_EOK) rt_device_write(&Device_GSM, LinkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); Send_DataFlag=0; } //监听 if(CallState==CallState_rdytoDialLis) { CallState=CallState_Dialing; memset(atd_str,0,sizeof(atd_str)); memcpy(atd_str,"ATD",3); memcpy(atd_str+3,JT808Conf_struct.LISTEN_Num,strlen((const char*)JT808Conf_struct.LISTEN_Num)); memcpy(atd_str+3+strlen((const char*)JT808Conf_struct.LISTEN_Num),";\r\n",3); rt_hw_gsm_output(atd_str); rt_kprintf("\r\n拨打%s\r\n",atd_str); } //--------- Step timer // Dial_step_Single_10ms_timer(); // TTS TTS_Data_Play(); // Get CSQ value if(GSM_CSQ_Query()==false) { if(Calling_ATA_flag==1) { rt_thread_delay(3); rt_hw_gsm_output("ATA\r\n"); //检查信号强度 if(DispContent) rt_kprintf(" 接听 ATA\r\n"); Calling_ATA_flag=0; } } // SMS Service SMS_Process(); rt_thread_delay(10); } } }
static void gsm_thread_entry(void* parameter) { u8 atd_str[25]; rt_size_t res=RT_ERROR; // finsh_init(&shell->parser); // // step 1: Init Dataflash DF_init(); APP_IOpinInit(); rt_kprintf("\r\n ---> gsm thread start !\r\n"); HardWareVerion=HardWareGet(); // step 2: process config data SysConfiguration(); // system config total_ergotic(); Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate #ifdef HMI HMI_app_init(); #endif gps_init(); Lcd_init(); //-------------------------------------- while (1) { if((GSM_PWR.result==result_success)&&(dwlcd_contr<=5)) { if(Login_Menu_Flag!=1) { Lcd_write(Big_lcd.status,LCD_PAGE,0x15); dwlcd_contr++; } else { Lcd_write(Big_lcd.status,LCD_PAGE,0x01); dwlcd_contr++; } ; } // 1. after power on get imsi code IMSIcode_Get(); // 2. after get imsi Comm AT initial start GSM_Module_TotalInitial(); // 3. Receivce & Process Communication Module data ---- GSM_Buffer_Read_Process(); rt_thread_delay(20); DataLink_Process(); //++++++++++++++++++++++++DWLCD+++++++++++++++++++++ //_485_RxHandler_01(); if(Big_lcd.RX_enable==LCD_BUSY) { Lcd_Data_Process(); Big_lcd.RX_enable=LCD_IDLE; } /* Lcd_write(Big_lcd.status,LCD_SETSPD,0); Lcd_write(Big_lcd.status,LCD_GPSNUM,Satelite_num); Lcd_write(Big_lcd.status,LCD_GSMNUM,ModuleSQ); */ if(ModuleStatus&Status_GPS ) { if(Big_lcd.RX_enable==LCD_IDLE) { if(lcd_contrl==0) { Lcd_write(Big_lcd.status,LCD_SETTIME,0); delay_ms(5); lcd_contrl++; } } } //++++++++++++++++++++++++DWLCD+++++++++++++++++++++ if(BD1_struct.Rx_enable==RT_EOK) { BD1_RxProcess(); } //------------------------------------------------ if (Send_DataFlag== 1) { res=rt_device_control(&Device_GSM, query_online, NULL); if(res==RT_EOK) rt_device_write(&Device_GSM, LinkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); Send_DataFlag=0; } //监听 if(CallState==CallState_rdytoDialLis) { CallState=CallState_Dialing; memset(atd_str,0,sizeof(atd_str)); memcpy(atd_str,"ATD",3); memcpy(atd_str+3,JT808Conf_struct.LISTEN_Num,strlen((const char*)JT808Conf_struct.LISTEN_Num)); memcpy(atd_str+3+strlen((const char*)JT808Conf_struct.LISTEN_Num),";\r\n",3); rt_hw_gsm_output(atd_str); rt_kprintf("\r\n拨打%s\r\n",atd_str); } //--------- Step timer // Dial_step_Single_10ms_timer(); // TTS TTS_Data_Play(); // Get CSQ value if(GSM_CSQ_Query()==false) { if(Calling_ATA_flag==1) { delay_ms(10); rt_hw_gsm_output("ATA\r\n"); //检查信号强度 if(DispContent) rt_kprintf(" 接听 ATA\r\n"); Calling_ATA_flag=0; } } // SMS Service SMS_Process(); } }