added fire button screenshot
This commit is contained in:
parent
a81f7afcf9
commit
8b1ec58829
|
@ -36,6 +36,10 @@
|
|||
<Add option="-pthread" />
|
||||
</Linker>
|
||||
<Unit filename="client.config" />
|
||||
<Unit filename="extern.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="extern.h" />
|
||||
<Unit filename="henglong.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
@ -43,6 +47,10 @@
|
|||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="wansview.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="wansview.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
|
|
|
@ -4,13 +4,25 @@
|
|||
<File name="client.config" open="1" top="0" tabpos="4">
|
||||
<Cursor position="114" topLine="0" />
|
||||
</File>
|
||||
<File name="extern.c" open="1" top="0" tabpos="7">
|
||||
<Cursor position="0" topLine="0" />
|
||||
</File>
|
||||
<File name="extern.h" open="1" top="1" tabpos="8">
|
||||
<Cursor position="94" topLine="0" />
|
||||
</File>
|
||||
<File name="henglong.c" open="1" top="0" tabpos="2">
|
||||
<Cursor position="804" topLine="0" />
|
||||
</File>
|
||||
<File name="henglong.h" open="1" top="0" tabpos="3">
|
||||
<Cursor position="564" topLine="0" />
|
||||
</File>
|
||||
<File name="main.c" open="1" top="1" tabpos="1">
|
||||
<Cursor position="7317" topLine="179" />
|
||||
<File name="main.c" open="1" top="0" tabpos="1">
|
||||
<Cursor position="274" topLine="0" />
|
||||
</File>
|
||||
<File name="wansview.c" open="1" top="0" tabpos="5">
|
||||
<Cursor position="1540" topLine="35" />
|
||||
</File>
|
||||
<File name="wansview.h" open="1" top="0" tabpos="6">
|
||||
<Cursor position="342" topLine="0" />
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
void fire(void)
|
||||
{
|
||||
system("xte key Return");
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef EXTERN_H_INCLUDED
|
||||
#define EXTERN_H_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void fire(void);
|
||||
|
||||
|
||||
#endif // EXTERN_H_INCLUDED
|
10
main.c
10
main.c
|
@ -22,7 +22,7 @@
|
|||
#include "henglong.h"
|
||||
#include <linux/joystick.h>
|
||||
#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 <stefan.helmert@gmx.net>\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));
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
int wvcamctrl(char* ip, int cmd);
|
||||
int cam_down(char* ip);
|
||||
int cam_up(char* ip);
|
||||
|
|
Loading…
Reference in New Issue