Ejemplo n.º 1
0
static void timetick( unsigned int systick )
{
	static uint8_t	offset = 0;
	uint32_t		sec;
	uint8_t			buf[64];
	uint8_t			i,j;
	void * pmsg;
/*发生状态改变*/
#ifdef bitter
	if((ctrlbit_printer_3v3_on|ctrlbit_buzzer)^ctrlbit_status)
	{
		showinfo();
		ctrlbit_status=(ctrlbit_printer_3v3_on|ctrlbit_buzzer);
	}
#endif	

	offset++;
	if( offset >= 20 )
	{
		offset	= 0;
		sec		= systick / 100;
		sprintf( buf, "%02d:%02d  %04d", sec / 60, sec % 60, Frequency);
		lcd_asc0608( 0, 0, buf, LCD_MODE_SET );
		if( sec & 0x01 ) /*输出控制*/
		{
			GPIO_SetBits( GPIOB, GPIO_Pin_1 );
		}else
		{
			GPIO_ResetBits( GPIOB, GPIO_Pin_1 );
		}
		showinfo();
	}

	
}
Ejemplo n.º 2
0
/*显示状态信息*/
static void showinfo(void)
{
	char buf[32];

	lcd_asc0608(122-6*6,0,"042710",LCD_MODE_INVERT);
	if( gps_fixed_sec )
	{
		sprintf( buf, "%02d:%02d", gps_fixed_sec / 60, gps_fixed_sec % 60 );
		lcd_asc0608( 0, 8, buf, LCD_MODE_SET );
	}

	if(card_status==IC_READ_OK)
	{
		lcd_bitmap( 122 - 6*4, 24, &bmp_res_iccard_insert, LCD_MODE_SET );
	}
	else if(card_status==IC_READ_ERR)
	{
		lcd_bitmap( 122 - 6*4, 24, &bmp_res_iccard_err, LCD_MODE_SET );
	}
	else
	{
		lcd_bitmap( 122 - 6*4, 24, &bmp_res_iccard_empty, LCD_MODE_SET );
	}

	
	if(rtc_ok)
	{
		lcd_asc0608( 0, 24, "RTC", LCD_MODE_SET );
	}
	
	if(gsm_csq!=0xff)
	{
		if(gsm_csq_min>gsm_csq) gsm_csq_min=gsm_csq;
		if(gsm_csq_max<gsm_csq) gsm_csq_max=gsm_csq;
		sprintf(buf,"%02d[%02d-%02d]",gsm_csq,gsm_csq_min,gsm_csq_max);
		lcd_asc0608(122-6*9,16,buf,LCD_MODE_SET);
	}

	if(gprs_ok_past_sec)
	{
		sprintf( buf, "%02d:%02d GPRS",gprs_ok_past_sec/60,gprs_ok_past_sec%60);
		lcd_asc0608( 0,16, buf, LCD_MODE_SET );
	}
	if(mems_status==SUCCESS)
	{
		lcd_asc0608( 30,24,"MEMS", LCD_MODE_SET );
	}
	lcd_update( 0, 31 );
}
Ejemplo n.º 3
0
static void display( void )
{
	uint16_t			pic_page_start; /*每四个图片记录为一个page*/
	uint8_t				buf[32], buf_time[16];
	uint16_t			i;
	MYTIME				t;
	TypeDF_PackageHead	* pcurrhead;

	lcd_fill( 0 );
	switch( scr_mode )
	{
		case SCR_PHOTO_MENU:
			pos &= 0x01;
			lcd_text12( 5, 4, "1.图片记录", 10, 3 - pos * 2 );
			lcd_text12( 5, 18, "2.拍照上传", 10, pos * 2 + 1 );
			break;
		case SCR_PHOTO_SELECT_ITEM:
			if( pic_count ) /*有图片*/
			{
				if( pos >= pic_count )
				{
					pos = 0;
				}
				if( pos < 0 )
				{
					pos = pic_count - 1;
				}
				pic_page_start = pos & 0xFFFC; /*每4个1组*/
				for( i = pic_page_start; i < pic_page_start + 4; i++ )
				{
					if( i >= pic_count )
					{
						break;
					}

					pcurrhead	= (TypeDF_PackageHead*)( pHead + i * sizeof( TypeDF_PackageHead ) );
					t			= pcurrhead->Time;

					sprintf( buf, "%02d>%02d-%02d-%02d %02d:%02d:%02d",
					         i+1, YEAR( t ), MONTH( t ), DAY( t ), HOUR( t ), MINUTE( t ), SEC( t ));
					if( i == pos )
					{
						lcd_asc0608( 0, 8 * ( i & 0x03 ), buf, LCD_MODE_INVERT );
					} else
					{
						lcd_asc0608( 0, 8 * ( i & 0x03 ), buf, LCD_MODE_SET );
					}
				}
			}else /*没有图片*/
			{
				lcd_text12( 25, 12, "没有图片记录", 12, LCD_MODE_SET );
			}
			break;
		case SCR_PHOTO_SELECT_DETAILED:/*显示图片详细信息*/
			pcurrhead	= (TypeDF_PackageHead*)( pHead + pos * sizeof( TypeDF_PackageHead ) );
			t			= pcurrhead->Time;
			
			sprintf( buf, "%02d-%02d-%02d %02d:%02d:%02d",
					 YEAR( t ), MONTH( t ), DAY( t ), HOUR( t ), MINUTE( t ), SEC( t ));
			lcd_asc0608( 0, 0, buf, LCD_MODE_SET );

			sprintf(buf,"chn=%d trig=%d del=%d",pcurrhead->Channel_ID,pcurrhead->TiggerStyle,pcurrhead->State);
			lcd_asc0608( 0, 8, buf, LCD_MODE_SET );
			sprintf(buf,"size=%d",pcurrhead->Len-64);
			lcd_asc0608( 0, 16, buf, LCD_MODE_SET );
			lcd_asc0608(70,24,"usb",LCD_MODE_SET);
			lcd_asc0608(104,24,"rep",LCD_MODE_SET);
		
			break;
		case SCR_PHOTO_TAKE:
			lcd_text12( 20, 12, "拍照上传中...", 12, LCD_MODE_SET );
			break;
	}
	lcd_update_all( );
}
Ejemplo n.º 4
0
static void msg( void *plcdmsg )
{
	LCD_MSG		* plcd_msg = (LCD_MSG* )plcdmsg;
	char		ch,buf[100];
	uint32_t	i;
	void *pmsg;

	if( plcd_msg->id == LCD_MSG_ID_GPS )
	{
		if( ( gps_fixed_sec == 0 ) && ( plcd_msg->info.gps_rmc.gps_av == 'A' ) )
		{
			gps_fixed_sec = rt_tick_get( ) * 10 / 1000;
			test_flag|=TEST_BIT_GPS;
			sprintf( buf, "%02d:%02d", gps_fixed_sec / 60, gps_fixed_sec % 60 );
			lcd_asc0608( 0, 8, buf, LCD_MODE_SET );
			i=sprintf(buf,"AT%%TTS=2,3,5,\"475053D2D1B6A8CEBB\"\r\n",ch+0x30);
			buf[i]=0;
			pmsg=rt_malloc(i+1);
			if(pmsg!=RT_NULL)
			{
				memcpy(pmsg,buf,i+1);
				rt_mb_send(&mb_tts,(rt_uint32_t)pmsg);
			}	
		}
		year=plcd_msg->info.gps_rmc.year;
		month=plcd_msg->info.gps_rmc.month;
		day= plcd_msg->info.gps_rmc.day;
		hour= plcd_msg->info.gps_rmc.hour;
		minute= plcd_msg->info.gps_rmc.minitue;
		sec= plcd_msg->info.gps_rmc.sec;

		time_set(hour,minute,sec);

		date_set(year,month,day);

		sprintf( buf, "%c%02d-%02d %02d:%02d:%02d",
		         plcd_msg->info.gps_rmc.gps_av,month,day,hour,minute,sec );
		lcd_asc0608( 122 - 6 * 15, 8, buf, LCD_MODE_SET );
	}
	if( plcd_msg->id == LCD_MSG_ID_GSM )
	{
		if( plcd_msg->info.payload[0] == 1 ) /*通话*/
		{
			rt_kprintf( "\r\nIncoming Call" );
			pscr = &scr_2_call;
			pscr->show( &scr_1_idle );
		}
	}
	if(plcd_msg->id == LCD_MSG_ID_GPRS)
	{
		gprs_ok_past_sec=rt_tick_get()/100;
		test_flag|=TEST_BIT_GPRS;

	}

	if(plcd_msg->id == LCD_MSG_ID_MEMS)
	{
		mems_status=plcd_msg->info.payload[0];

	}	
	if(plcd_msg->id == LCD_MSG_ID_CAM)
	{
		ch=plcd_msg->info.payload[0];
		switch(ch)
		{
			case 1: test_flag|=TEST_BIT_CAM1; break;
			case 2: test_flag|=TEST_BIT_CAM2; break;
			case 3: test_flag|=TEST_BIT_CAM3; break;
			case 4: test_flag|=TEST_BIT_CAM4; break;

		}
		if(plcd_msg->info.payload[1]==SUCCESS)
		{
			i=sprintf(buf,"AT%%TTS=2,3,5,\"C5C4D5D5%02xD5FDB3A3\"\r\n",ch+0x30);
			cam_ch[ch-1]=0x30+ch;
			lcd_asc0608( 122 - 6*8-4, 24, cam_ch, LCD_MODE_SET );
		}
		else
		{
			i=sprintf(buf,"AT%%TTS=2,3,5,\"C5C4D5D5%02xD2ECB3A3\"\r\n",ch+0x30);
		}
		buf[i]=0;
		pmsg=rt_malloc(i+1);
		if(pmsg!=RT_NULL)
		{
			memcpy(pmsg,buf,i+1);
			rt_mb_send(&mb_tts,(rt_uint32_t)pmsg);
		}		

	}
	if(plcd_msg->id == LCD_MSG_ID_ICCARD)
	{
		iccard_beep_timeout=10;
		card_status=plcd_msg->info.payload[0];
		if(card_status==IC_PLUG_OUT)
		{
			i=sprintf(buf,"AT%%TTS=2,3,5,\"4943BFA8B0CEB3F6\"\r\n\0");/*IC卡拔出*/
			pmsg=rt_malloc(i);
			if(pmsg!=RT_NULL)
			{
				memcpy(pmsg,buf,i);
				rt_mb_send(&mb_tts,(rt_uint32_t)pmsg);
			}
		}
		if(card_status==IC_READ_OK)
		{
			i=sprintf(buf,"AT%%TTS=2,3,5,\"4943BFA8D5FDB3A3\"\r\n\0"); /*IC卡正常*/
			pmsg=rt_malloc(i);
			if(pmsg!=RT_NULL)
			{
				memcpy(pmsg,buf,i);
				rt_mb_send(&mb_tts,(rt_uint32_t)pmsg);
			}
		}
		
		if(card_status==IC_READ_ERR)
		{
			i=sprintf(buf,"AT%%TTS=2,3,5,\"4943BFA8B4EDCEF3\"\r\n\0"); /*IC卡错误*/
			pmsg=rt_malloc(i);
			if(pmsg!=RT_NULL)
			{
				memcpy(pmsg,buf,i);
				rt_mb_send(&mb_tts,(rt_uint32_t)pmsg);
			}
		}
		test_flag|=TEST_BIT_ICCARD;
	}

	if(plcd_msg->id == LCD_MSG_ID_RTC)
	{
		memset(buf,0,32);
		if(plcd_msg->info.payload[0]==SUCCESS)
		{
			i=sprintf(buf,"AT%%TTS=2,3,5,\"525443D5FDB3A3\"\r\n",ch+0x30);
			test_flag|=TEST_BIT_RTC;
			rtc_ok=1;
		}
		else
		{
			i=sprintf(buf,"AT%%TTS=2,3,5,\"525443D2ECB3A3\"\r\n",ch+0x30);
		}
		rt_kprintf("\r\nRTC len=%d\r\n",i);
		buf[i]=0;
		pmsg=rt_malloc(i+1);
		if(pmsg!=RT_NULL)
		{
			memcpy(pmsg,buf,i+1);
			rt_mb_send(&mb_tts,(rt_uint32_t)pmsg);
		}			
		
	}

	if(plcd_msg->id == LCD_MSG_ID_CSQ)
	{
		gsm_csq=plcd_msg->info.payload[0];
		rt_kprintf("\r\ncsq=%d",gsm_csq);

	}

	if(test_flag==TEST_BIT_ALL)
	{
		i=sprintf(buf,"AT%%TTS=2,3,5,\"B2E2CAD4CDEAB3C9\"\r\n");
		buf[i]=0;
		pmsg=rt_malloc(i+1);
		if(pmsg!=RT_NULL)
		{
			memcpy(pmsg,buf,i+1);
			rt_mb_send(&mb_tts,(rt_uint32_t)pmsg);
		}
	}

	showinfo();
	
}