diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2000-04-16 13:54:16 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2000-04-16 13:54:16 +0200 |
commit | e3fe42608da06dcaf6932472343b3f39ea1bcea3 (patch) | |
tree | 0a0faa055443d301064e7d678972ba766329685b | |
parent | 735093b8faef4f667e6a6c65f7290858286816e3 (diff) | |
download | vdr-e3fe42608da06dcaf6932472343b3f39ea1bcea3.tar.gz vdr-e3fe42608da06dcaf6932472343b3f39ea1bcea3.tar.bz2 |
Dropped dynamic repeat function
-rw-r--r-- | osm.c | 4 | ||||
-rw-r--r-- | remote.c | 20 | ||||
-rw-r--r-- | remote.h | 4 | ||||
-rw-r--r-- | tools.h | 3 |
4 files changed, 17 insertions, 14 deletions
@@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: osm.c 1.3 2000/04/15 14:04:21 kls Exp $ + * $Id: osm.c 1.4 2000/04/16 13:54:10 kls Exp $ */ #include <signal.h> @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) DvbApi.StopRecord(); DvbApi.StopReplay(); //TODO kill any remaining sub-processes! - isyslog(LOG_INFO, "exiting", Interrupted); + isyslog(LOG_INFO, "exiting"); closelog(); return 0; } @@ -4,7 +4,7 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: remote.c 1.2 2000/04/15 16:00:51 kls Exp $ + * $Id: remote.c 1.3 2000/04/16 13:54:16 kls Exp $ */ #include "remote.h" @@ -17,6 +17,9 @@ #include <unistd.h> #include "tools.h" +#define REPEATLIMIT 100 // ms +#define REPEATDELAY 250 // ms + cRcIo::cRcIo(char *DeviceName) { dp = 0; @@ -25,7 +28,6 @@ cRcIo::cRcIo(char *DeviceName) address = 0xFFFF; t = 0; firstTime = lastTime = 0; - minDelta = 0; lastCommand = 0; if ((f = open(DeviceName, O_RDWR | O_NONBLOCK)) >= 0) { struct termios t; @@ -35,8 +37,11 @@ cRcIo::cRcIo(char *DeviceName) if (tcsetattr(f, TCSAFLUSH, &t) == 0) return; } + LOG_ERROR_STR(DeviceName); close(f); } + else + LOG_ERROR_STR(DeviceName); f = -1; } @@ -48,7 +53,7 @@ cRcIo::~cRcIo() int cRcIo::ReceiveByte(bool Wait) { - // Returns the byte if one was received within 1 second, -1 otherwise + // Returns the byte if one was received within a timeout, -1 otherwise if (f >= 0) { fd_set set; struct timeval timeout; @@ -112,7 +117,6 @@ bool cRcIo::SetCode(unsigned char Code, unsigned short Address) { code = Code; address = Address; - minDelta = 200; return SendCommand(code); } @@ -157,12 +161,10 @@ bool cRcIo::GetCommand(unsigned int *Command, unsigned short *Address) // let's have a timeout to avoid getting overrun by commands int now = time_ms(); int delta = now - lastTime; - if (delta < minDelta) - minDelta = delta; // dynamically adjust to the smallest delta lastTime = now; - if (delta < minDelta * 1.3) { // if commands come in rapidly... - if (now - firstTime < 250) - return false; // ...repeat function kicks in after 250ms + if (delta < REPEATLIMIT) { // if commands come in rapidly... + if (now - firstTime < REPEATDELAY) + return false; // ...repeat function kicks in after a short delay return true; } } @@ -4,7 +4,7 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: remote.h 1.1 2000/02/19 13:36:48 kls Exp $ + * $Id: remote.h 1.2 2000/04/16 13:53:50 kls Exp $ */ #ifndef __REMOTE_H @@ -19,7 +19,7 @@ private: unsigned char dp, code, mode; unsigned short address; time_t t; - int firstTime, lastTime, minDelta; + int firstTime, lastTime; unsigned int lastCommand; bool SendCommand(unsigned char Cmd); int ReceiveByte(bool Wait = true); @@ -4,12 +4,13 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.3 2000/04/15 15:09:47 kls Exp $ + * $Id: tools.h 1.4 2000/04/16 13:54:04 kls Exp $ */ #ifndef __TOOLS_H #define __TOOLS_H +#include <errno.h> #include <stdio.h> #include <syslog.h> |