Compare commits

..

4 Commits

8 changed files with 26 additions and 14 deletions

View File

@ -832,7 +832,7 @@ lockCallback(StreamIoStatus status)
case StreamIoSuccess:
break;
case StreamIoTimeout:
debug("%s: length, within %ld ms, device seems to be busy\n",
debug("%s: Cannot lock device within %ld ms, device seems to be busy\n",
name(), lockTimeout);
flags &= ~BusOwner;
finishProtocol(LockTimeout);

View File

@ -180,6 +180,7 @@ public:
#ifndef EPICS_3_13
extern "C" {
epicsExportAddress(int, streamDebug);
epicsExportAddress(int, streamError);
}
#endif

View File

@ -23,6 +23,7 @@
#include <stdio.h>
int streamDebug = 0;
int streamError = 0;
extern "C" {
#ifdef _WIN32
__declspec(dllexport)
@ -74,6 +75,7 @@ void StreamError(int line, const char* file, const char* fmt, ...)
void StreamVError(int line, const char* file, const char* fmt, va_list args)
{
char timestamp[40];
if (!streamError) return; // Error logging disabled
StreamPrintTimestampFunction(timestamp, 40);
#ifdef va_copy
if (StreamDebugFile)

View File

@ -28,6 +28,7 @@
#endif
extern int streamDebug;
extern int streamError;
extern void (*StreamPrintTimestampFunction)(char* buffer, int size);
void StreamError(int line, const char* file, const char* fmt, ...)

View File

@ -23,7 +23,7 @@
#define STREAM_MAJOR 2
#define STREAM_MINOR 7
#define STREAM_PATCHLEVEL 7
#define STREAM_PATCHLEVEL 8
#if defined(__vxworks) || defined(vxWorks)
#include <vxWorks.h>

View File

@ -55,11 +55,14 @@ static long readData (dbCommon *record, format_t *format)
ai->rval = rval;
if (ai->linr == menuConvertNO_CONVERSION)
{
/* allow more bits than 32 */
/* allow integers with more than 32 bits */
double val;
if (format->type == DBF_ULONG)
ai->val = (unsigned long)rval;
val = (unsigned long)rval;
else
ai->val = rval;
val = rval;
if (ai->aslo != 0.0 && ai->aslo != 1.0) val *= ai->aslo;
ai->val = val + ai->aoff;
return DO_NOT_CONVERT;
}
return OK;

View File

@ -46,11 +46,14 @@ static long readData (dbCommon *record, format_t *format)
ao->rval = rval;
if (ao->linr == menuConvertNO_CONVERSION)
{
/* allow more bits than 32 */
/* allow integers with more than 32 bits */
double val;
if (format->type == DBF_ULONG)
ao->val = (unsigned long)rval;
val = (unsigned long)rval;
else
ao->val = rval;
val = rval;
if (ao->aslo != 0.0 && ao->aslo != 1.0) val *= ao->aslo;
ao->val = val + ao->aoff;
return DO_NOT_CONVERT;
}
return OK;
@ -63,20 +66,21 @@ static long writeData (dbCommon *record, format_t *format)
{
aoRecord *ao = (aoRecord *) record;
double val = (INIT_RUN ? ao->val : ao->oval) - ao->aoff;
if (ao->aslo != 0.0 && ao->aslo != 1.0) val /= ao->aslo;
switch (format->type)
{
case DBF_DOUBLE:
{
double val = (INIT_RUN ? ao->val : ao->oval) - ao->aoff;
if (ao->aslo != 0.0 && ao->aslo != 1.0) val /= ao->aslo;
return streamPrintf (record, format, val);
}
case DBF_ULONG:
{
if (ao->linr == menuConvertNO_CONVERSION)
{
/* allow more bits than 32 */
return streamPrintf (record, format, (unsigned long)(INIT_RUN ? ao->val : ao->oval));
/* allow integers with more than 32 bits */
return streamPrintf (record, format, (unsigned long)val);
}
return streamPrintf (record, format, (unsigned long)ao->rval);
}
@ -84,8 +88,8 @@ static long writeData (dbCommon *record, format_t *format)
{
if (ao->linr == menuConvertNO_CONVERSION)
{
/* allow more bits than 32 */
return streamPrintf (record, format, (long)(INIT_RUN ? ao->val : ao->oval));
/* allow integers with more than 32 bits */
return streamPrintf (record, format, (long)val);
}
return streamPrintf (record, format, (long)ao->rval);
}

View File

@ -2,6 +2,7 @@ if (@ARGV[0] == "-3.13") {
shift;
} else {
print "variable(streamDebug, int)\n";
print "variable(streamError, int)\n";
print "registrar(streamRegistrar)\n";
}
print "driver(stream)\n";