Skip to content

Commit

Permalink
Remove some broken windows stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias-Wandel committed Feb 17, 2020
1 parent 6a30ca8 commit a8e4a30
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 57 deletions.
5 changes: 0 additions & 5 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
#include <ctype.h> // to declare isupper(), tolower()
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#else
#include <dirent.h>
#include <unistd.h>
#endif

#include "imgcomp.h"
#include "config.h"
Expand Down
35 changes: 4 additions & 31 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,8 @@
#include <string.h>
#include <time.h>
#include <math.h>
#ifdef _WIN32
#include "readdir.h"
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define strdup(a) _strdup(a)
extern void sleep(int);
extern void usleep(int);
#define unlink(n) _unlink(n)
#define PATH_MAX _MAX_PATH
#else
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
#endif
#include <unistd.h>
#include <errno.h>

#include "imgcomp.h"
#include "config.h"
Expand Down Expand Up @@ -89,8 +78,6 @@ static time_t NextTimelapsePix;
static LastPic_t BaselinePic;

time_t LastPic_mtime;
struct timespec LastPic_mtime_ns;


//-----------------------------------------------------------------------------------
// Convert picture coordinates from 120 degree fishey lens
Expand Down Expand Up @@ -218,6 +205,7 @@ static int ProcessImage(LastPic_t * New, int DeleteProcessed)


if (Trig.DiffLevel > Sensitivity && UdpDest[0]){
// For my cap shooter experiment. Not useful for anything else.
char showx[1001];
int xs, a;
const int colwidth=120;
Expand All @@ -236,9 +224,7 @@ static int ProcessImage(LastPic_t * New, int DeleteProcessed)

GeometryConvert(&Trig);

#ifndef _WIN32
if (UdpDest[0]) SendUDP(Trig.x, Trig.y, Trig.DiffLevel, Trig.Motion);
#endif
if (UdpDest[0]) SendUDP(Trig.x, Trig.y, Trig.DiffLevel, Trig.Motion);
}

Raspistill_restarted = 0;
Expand Down Expand Up @@ -266,7 +252,6 @@ static int ProcessImage(LastPic_t * New, int DeleteProcessed)
}

if (DeleteProcessed){
//printf("Delete %s\n",LastPics[2].Name);
unlink(LastPics[2].Name);
}
return LastPics[0].IsMotion;
Expand Down Expand Up @@ -347,7 +332,6 @@ static int DoDirectoryFunc(char * Directory, int DeleteProcessed)
exit(1);
}
NewPic.mtime = (unsigned)statbuf.st_mtime;
LastPic_mtime_ns = statbuf.st_mtim;
}
LastPic_mtime = NewPic.mtime;

Expand All @@ -361,10 +345,6 @@ static int DoDirectoryFunc(char * Directory, int DeleteProcessed)

SinceMotionMs += MsPerCycle;

//if (SawMotion){
// run_blink_program();
//}

return SawMotion;
}

Expand Down Expand Up @@ -599,9 +579,7 @@ int main(int argc, char **argv)
LogFileMaintain(0);
}

#ifndef _WIN32
if (UdpDest[0]) InitUDP(UdpDest);
#endif

// Adjust region of interest to scale.
ScaleRegion(&Regions.DetectReg, ScaleDenom);
Expand Down Expand Up @@ -684,8 +662,3 @@ int main(int argc, char **argv)
return 0;
}

// Features to consider adding:
//--------------------------------------------------------
// Polling same file mode (for use with uvccapture)
// Dynamic thresholding if too much is happening?

18 changes: 2 additions & 16 deletions src/start_raspistill.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

#ifdef _WIN32
typedef int pid_t;
#define execvp(a,b)
#define fork() 1
#else
#include <unistd.h>
#include <sys/wait.h>
#endif
#include <unistd.h>
#include <sys/wait.h>

#include "imgcomp.h"
#include "jhead.h"
Expand Down Expand Up @@ -72,9 +65,6 @@ static void do_launch_program(char * cmd_string)
// Parse command line and launch.
//-----------------------------------------------------------------------------------
static int launch_raspistill(void)
#ifdef _WIN32
{ return 0; }
#else
{
pid_t pid;
int ignore;
Expand Down Expand Up @@ -112,8 +102,6 @@ static int launch_raspistill(void)
}
return 0;
}
#endif


//-----------------------------------------------------------------------------------
// Parse command line and launch.
Expand Down Expand Up @@ -225,9 +213,7 @@ int manage_raspistill(int NewImages)
// trigger signals. In this mode, it does running exposure adjustments, but
// only takes pictures when it receives a signal.
fprintf(Log,"send signal to raspistill (pid=%d)\n",raspistill_pid);
#ifndef _WIN32
kill(raspistill_pid, SIGUSR1);
#endif
}
return 0;

Expand Down
5 changes: 0 additions & 5 deletions src/timer_stepper.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,3 @@ void ReadTimer(void)
printf(" l=%d\n",longest);
}
}

// Notes:
// Calling CheckUdp adds about 650 microseconds!
// Calling uSleep adds 60 microseconds + specified time.

0 comments on commit a8e4a30

Please sign in to comment.