5
0
Fork 0
mirror of https://github.com/TheTesla/HengLongUDPclient.git synced 2025-07-01 12:56:14 +02:00

client sends a structure, now with right, left, pan, tilt

This commit is contained in:
Stefan Helmert 2014-02-05 06:43:14 +01:00
parent 8b56939b21
commit 3b507ff03c
10 changed files with 118 additions and 40 deletions

View file

@ -45,6 +45,11 @@ void inithenglong(henglong_t* henglong)
henglong->recoil = 0;
henglong->clisel = 0;
henglong->servoff = 0;
henglong->tilt_up = 0;
henglong->tilt_down = 0;
henglong->pan_left = 0;
henglong->pan_right = 0;
}
@ -58,6 +63,34 @@ int event2data(henglong_t* henglong, struct input_event event)
henglong->servoff = 0;
}
}
if(17==event.code){
if(event.value){
henglong->tilt_up = 1;
}else{
henglong->tilt_up = 0;
}
}
if(31==event.code){
if(event.value){
henglong->tilt_down = 1;
}else{
henglong->tilt_down = 0;
}
}
if(30==event.code){
if(event.value){
henglong->pan_left = 1;
}else{
henglong->pan_left = 0;
}
}
if(32==event.code){
if(event.value){
henglong->pan_right = 1;
}else{
henglong->pan_right = 0;
}
}
if(2<=event.code && 11>=event.code){
if(event.value){
henglong->clisel = (event.code - 1) % 10;