dank dir kolission, dass du dich mit dem Thema beschäftigt hast.
Habs jetzt hinbekommen, indem ich mehrfach abfrage, ob ein gültiger Wert sich wiederholt (zumindest ungefähr).
Funktioniert sehr gut.
hier mal der code, ist vielleicht etwas schwierig zu durchblicken, aber vom prinzip her sollte mans verstehen.
also bis dannCode:void get_pos_pixel(void) { struct touch_position t_pos; unsigned int xmax, ymax; unsigned int prell_min, prell_max; char count; xmax = x[2] - x[0]; ymax = y[2] - y[3]; get_pos_AD(&t_pos); if((t_pos.y < y[2]) | (t_pos.x < x[2])) { get_pos_AD(&t_pos); count = 0; do{ if (count == 0) { prell_min = t_pos.x - 8; prell_max = t_pos.x + 8; } get_pos_AD(&t_pos); if (count < 0x20) { if((t_pos.x < prell_max) & (t_pos.x > prell_min)) count++; else if (count == 0) count = 0; else count--; } else { // count == 0xFF positionX = (((t_pos.x - x[0])* 0x80) / xmax); positionY = (((t_pos.y - y[3])* 0x40) / ymax); count--; } } while((t_pos.y < y[2]) | (t_pos.x < x[2])); } else{ positionX = 0x3FF; positionY = 0x3FF; } }![]()







Zitieren
Lesezeichen