Beispiel #1
0
void getIR_test(struct RAWcmd_* cmd) {

	unsigned char x;
	
	struct ir_raw_ capture;
	
	lcd_fill(0);
	draw_string(0,0,"Beide Fernbedienungen\neinander gegenüber\nlegen, so dass die Infra-\nrotschnittstellen direkt\nzueinander liegen.\nAbstand 2-10cm\nAnzulernene Taste drücken.", 3, DRAW_PUT);
	x=captureIR(&capture);
	lcd_fill(0);
	draw_numU(90,16,x,0, 3, DRAW_PUT);
	debug_print_capture(&capture);
		
	clear_cmd(cmd);
	x = analyzeIR(&capture, cmd);
	
	//debug_print_cmd(cmd);
	
	draw_numU(90,24,x,0, 3, DRAW_PUT);
	
	if(x)
		draw_string(97,24,"FAIL", 3, DRAW_PUT);
	else
		draw_string(97,24,"OK", 3, DRAW_PUT);
	
}
Beispiel #2
0
void debug_print_cmd(struct RAWcmd_* cmd) {

	unsigned char x;
	unsigned char ro;
	unsigned char co;
	
	x= 0;
	ro = 0;
	co = 0;
	
	while((x < cmd->CMDlen[0]) && (ro < 20)) {
		draw_hexC(co++ * 14,ro * 8,cmd->data[cmd->CMDstart[0]+ x++], 3, DRAW_PUT);
		if(co > 4) {
			ro++;
			co = 0;
		}
	}
	x=0;
	co = 0;
	ro++;
	while((x < cmd->CMDlen[1]) && (ro < 20)) {
		draw_hexC(co++ * 14,ro * 8,cmd->data[cmd->CMDstart[1]+ x++], 3, DRAW_PUT);
		if(co > 4) {
			ro++;
			co = 0;
		}
	}
	x=0;
	co = 0;
	ro++;
	while((x < cmd->CMDlen[2]) && (ro < 20)) {
		draw_hexC(co++ * 14,ro * 8,cmd->data[cmd->CMDstart[2]+ x++], 3, DRAW_PUT);
		if(co > 4) {
			ro++;
			co = 0;
		}
	}

	draw_numU(90,8,cmd->tval,0, 3, DRAW_PUT);
	
	for (x = 0; x < 16; x++) {
		draw_numU(75,20+(x*8),cmd->pulselen[x],0, 3, DRAW_PUT);
	}
}
Beispiel #3
0
void draw_b(unsigned char x, unsigned char y)
{	
	unsigned char w;
	
	if(!(is_drawing))
	{
		if(bat_state & BAT_DEBUG)
		{
			draw_block(4,0,108,24,3,DRAW_ERASE);
			draw_numU(4,0,bat_min>>2,0,3,DRAW_PUT);
			draw_numU(32,0,bat_max>>2,0,3,DRAW_PUT);
			draw_numU(4,8,(bat_max>>2)-(bat_min>>2),0,3,DRAW_PUT);
	
			draw_numU(60,0,bat_min,0,3,DRAW_PUT);
			draw_numU(88,0,bat_max,0,3,DRAW_PUT);
			draw_numU(60,8,bat_max-bat_min,0,3,DRAW_PUT);
			if((bat_state & BAT_NORMAL))
				draw_string(4,16,"Bat.Operation",3,DRAW_PUT);
			if((bat_state & BAT_CHARGE))
				draw_string(4,16,"Charging",3,DRAW_PUT);
			if((bat_state & BAT_CHARGE_DONE))
				draw_string(4,16,"Done Charging",3,DRAW_PUT);
		}

		if (bat_min<0x320)
			w = 0;
		else if (bat_min>0x380)
			w = 12;
		else
			w = (bat_min-0x320)/8;
		
		draw_block(x+1,y+1,12,5,3,DRAW_ERASE);
		draw_rect(x,y,14,7,1,3,DRAW_PUT);
		draw_vline(x+14,y+2,3,3,DRAW_PUT);

		if(w>0)	
			draw_block(x+1,y+1,w,5,2,DRAW_PUT);
	
		if(w<12)
			draw_block(x+1+w,y+1,12-w,5,0,DRAW_PUT);
	}
Beispiel #4
0
void debug_print_capture(struct ir_raw_* capture) {

	unsigned short space;
	unsigned short sum;
	unsigned char x;
	unsigned char ro;
	unsigned char co;
	
	space=32000;
	for (x=4; (x < capture->count);x++) {
		unsigned short y;
		sum = 0;
		for (y = x-4; y < x; y++) {
			sum += capture->widetable[1].value[(capture->data[y]) & 0x0f];
		}
		y = capture->widetable[1].value[(capture->data[x]) & 0x0f];
		if ((sum < y) && (y < space))
			space=y;
	}
	
	x= 0;
	ro = 0;
	co = 0;
	while((x <= capture->count) && (ro < 20)) {
		draw_hexC(co++ * 14,ro * 8,capture->data[x], 3, DRAW_PUT);
		if((capture->widetable[1].value[capture->data[x++] & 0x0f] >= space) || (co > 5)) {
			ro++;
			co = 0;
		}
	}
	
	draw_numU(90,8,capture->pulsetime,0, 3, DRAW_PUT);
	
	for (x = 0; x < capture->widetable[1].count; x++) {
		draw_numU(90,36+(x*8),capture->widetable[1].value[x],0, 3, DRAW_PUT);
	}
}