diff --git a/UDPclient.cbp b/UDPclient.cbp index ff84ddc..b61d665 100644 --- a/UDPclient.cbp +++ b/UDPclient.cbp @@ -36,6 +36,10 @@ + + + @@ -43,6 +47,10 @@ + + + diff --git a/UDPclient.layout b/UDPclient.layout index e481d70..c02f2e3 100644 --- a/UDPclient.layout +++ b/UDPclient.layout @@ -4,13 +4,25 @@ + + + + + + - - + + + + + + + + diff --git a/extern.c b/extern.c new file mode 100644 index 0000000..31d0094 --- /dev/null +++ b/extern.c @@ -0,0 +1,9 @@ + + +#include "extern.h" + +void fire(void) +{ + system("xte key Return"); +} + diff --git a/extern.h b/extern.h new file mode 100644 index 0000000..4302485 --- /dev/null +++ b/extern.h @@ -0,0 +1,9 @@ +#ifndef EXTERN_H_INCLUDED +#define EXTERN_H_INCLUDED + +#include + +void fire(void); + + +#endif // EXTERN_H_INCLUDED diff --git a/main.c b/main.c index a836f24..49865e4 100644 --- a/main.c +++ b/main.c @@ -22,7 +22,7 @@ #include "henglong.h" #include #include "wansview.h" - +#include "extern.h" typedef struct outtty_t { @@ -193,6 +193,7 @@ void *joystick_thread_fcn(void * arg) args->outtty = outttyloc; args->hl.ignation = (1 & (jsdata.buttons >> 2)); + args->hl.fire = (1 & (jsdata.buttons >> 1)); printf("%6d %6d %4x\n", jsdata.x, jsdata.y, jsdata.buttons); } @@ -367,6 +368,7 @@ int main(int argc, char* argv[]) henglongconf_t conf; RCdatagram_t senddata; int updown, cwccw; + int fire_old; if(2!=argc){ printf("\nThis program is intented to be run on the PC as client to control the server on the heng long tank. \n\n USAGE: UDPclient client.config\n\n Copyright (C) 2014 Stefan Helmert \n\n"); @@ -424,6 +426,7 @@ int main(int argc, char* argv[]) senddata.outtty.servo_pan = 0; senddata.outtty.servo_tilt = 0; cam_ctrl_thread_args.nul = 1; + fire_old = 0; while(1){ usleep(conf.frame_us); @@ -488,6 +491,11 @@ int main(int argc, char* argv[]) if(senddata.outtty.servo_tilt>50) senddata.outtty.servo_tilt = 50; if(senddata.outtty.servo_tilt<-50) senddata.outtty.servo_tilt = -50; + // Return-Button on Keyboard via Joystick-Fire for screenshot in Browser + if(0==fire_old & 1==joystick_thread_args.hl.fire){ + fire(); + } + fire_old = joystick_thread_args.hl.fire; n_send = sendto(sockfd, &senddata, sizeof(senddata), 0, (struct sockaddr *)&servaddr, sizeof(servaddr)); diff --git a/wansview.h b/wansview.h index 7361968..897676a 100644 --- a/wansview.h +++ b/wansview.h @@ -8,7 +8,6 @@ #include - int wvcamctrl(char* ip, int cmd); int cam_down(char* ip); int cam_up(char* ip);