From 58a8bd00b0c2ad870727aa09628d769a384b2f35 Mon Sep 17 00:00:00 2001 From: koennecke Date: Mon, 27 Feb 2017 09:56:00 +0100 Subject: [PATCH 1/2] Write proposalID to TASP data files --- tasscan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasscan.c b/tasscan.c index 5a5bc1a..c0f628e 100644 --- a/tasscan.c +++ b/tasscan.c @@ -272,6 +272,11 @@ static int TASHeader(pScanData self) pTAS->tasPar[BX]->fVal, pTAS->tasPar[BY]->fVal, pTAS->tasPar[BZ]->fVal); + sVar = FindCommandData(pServ->pSics, "ProposalID", "SicsVariable"); + if (sVar != NULL) { + fprintf(self->fd,"PARAM: ProposalID=%s\n",sVar->text); + } + /* * write mupad stuff if available */ From ec94ba7e438d825a00142bcd4d3155550bbd90c7 Mon Sep 17 00:00:00 2001 From: koennecke Date: Mon, 3 Apr 2017 11:39:52 +0200 Subject: [PATCH 2/2] Fixed epicsadpater to deal with waveform char strings --- epicsadapter.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/epicsadapter.c b/epicsadapter.c index 55c68e8..3c0ce97 100644 --- a/epicsadapter.c +++ b/epicsadapter.c @@ -10,6 +10,7 @@ #include #include #include +#undef INLINE /* already defined bz tcl.h, breaks EPICS includes */ #include #include #include @@ -123,7 +124,11 @@ static void epicsDataCallback(struct event_handler_args args) switch(priv->node->value.dataType){ case HIPTEXT: free(priv->node->value.v.text); - priv->node->value.v.text = strdup((char *)args.dbr); + if(args.type == DBR_STRING){ + priv->node->value.v.text = strdup((char *)args.dbr); + } else if(args.type == DBR_CHAR) { + priv->node->value.v.text = strndup((char *)args.dbr,args.count); + } break; case HIPINT: priv->node->value.v.intValue = *(int *)args.dbr; @@ -162,7 +167,11 @@ static int epicsSubscribePV(void *message, void *userData) priv = (pEpicsPriv)message; switch(priv->node->value.dataType){ case HIPTEXT: - subType = DBR_STRING; + if(ca_field_type(priv->pvchid) == DBR_CHAR){ + subType = DBR_CHAR; + } else { + subType = DBR_STRING; + } break; case HIPINT: case HIPINTAR: @@ -381,7 +390,9 @@ static void EpicsWriteFunc(void *param) goto cleanup; cleanup: - SCDeleteConnection(wp->pCon); + if(wp->pCon != NULL){ + SCDeleteConnection(wp->pCon); + } ReleaseHdbValue(&wp->v); free(wp); free(pv);