- Adapted indenation to new agreed upon system
- Fixed bad status in poldi zug driver
This commit is contained in:
224
amorscan.c
224
amorscan.c
@@ -18,123 +18,119 @@
|
||||
#include "nxamor.h"
|
||||
#include "amorscan.h"
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int AmorHeader(pScanData self)
|
||||
{
|
||||
return WriteAmorHeader(self->pFile, self->pCon);
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int AmorPoints(pScanData self, int iP)
|
||||
{
|
||||
/* write only at last scan point */
|
||||
if((iP+1) >= self->iNP)
|
||||
{
|
||||
return WriteAmorScan(self->pFile,self->pCon,self);
|
||||
static int AmorHeader(pScanData self)
|
||||
{
|
||||
return WriteAmorHeader(self->pFile, self->pCon);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int AmorPoints(pScanData self, int iP)
|
||||
{
|
||||
/* write only at last scan point */
|
||||
if ((iP + 1) >= self->iNP) {
|
||||
return WriteAmorScan(self->pFile, self->pCon, self);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int AmorCollect(pScanData self, int iP)
|
||||
{
|
||||
pVarEntry pVar = NULL;
|
||||
void *pDings;
|
||||
int i, iRet, status;
|
||||
float fVal;
|
||||
char pStatus[512], pItem[20];
|
||||
char pHead[512];
|
||||
CountEntry sCount;
|
||||
|
||||
assert(self);
|
||||
assert(self->pCon);
|
||||
|
||||
/* prepare output header */
|
||||
sprintf(pHead, "%-5.5s", "NP");
|
||||
sprintf(pStatus, "%-5d", iP);
|
||||
|
||||
/* loop over all scan variables */
|
||||
status = 1;
|
||||
for (i = 0; i < self->iScanVar; i++) {
|
||||
DynarGet(self->pScanVar, i, &pDings);
|
||||
pVar = (pVarEntry) pDings;
|
||||
if (pVar) {
|
||||
fVal = pVar->pInter->GetValue(pVar->pObject, self->pCon);
|
||||
AppendScanVar(pVar, fVal);
|
||||
sprintf(pItem, " %-9.9s", pVar->Name);
|
||||
strcat(pHead, pItem);
|
||||
sprintf(pItem, " %-9.3f", fVal);
|
||||
strcat(pStatus, pItem);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int AmorCollect(pScanData self, int iP)
|
||||
{
|
||||
pVarEntry pVar = NULL;
|
||||
void *pDings;
|
||||
int i, iRet, status;
|
||||
float fVal;
|
||||
char pStatus[512], pItem[20];
|
||||
char pHead[512];
|
||||
CountEntry sCount;
|
||||
}
|
||||
|
||||
assert(self);
|
||||
assert(self->pCon);
|
||||
|
||||
/* prepare output header */
|
||||
sprintf(pHead,"%-5.5s","NP");
|
||||
sprintf(pStatus,"%-5d",iP);
|
||||
|
||||
/* loop over all scan variables */
|
||||
status = 1;
|
||||
for(i = 0; i < self->iScanVar; i++)
|
||||
{
|
||||
DynarGet(self->pScanVar,i,&pDings);
|
||||
pVar = (pVarEntry)pDings;
|
||||
if(pVar)
|
||||
{
|
||||
fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon);
|
||||
AppendScanVar(pVar,fVal);
|
||||
sprintf(pItem," %-9.9s",pVar->Name);
|
||||
strcat(pHead,pItem);
|
||||
sprintf(pItem," %-9.3f",fVal);
|
||||
strcat(pStatus,pItem);
|
||||
}
|
||||
}
|
||||
|
||||
/* store counter data */
|
||||
/* monitors */
|
||||
for(i = 1; i < 10; i++)
|
||||
{
|
||||
sCount.Monitors[i-1] = GetMonitor((pCounter)self->pCounterData,i,
|
||||
/* store counter data */
|
||||
/* monitors */
|
||||
for (i = 1; i < 10; i++) {
|
||||
sCount.Monitors[i - 1] = GetMonitor((pCounter) self->pCounterData, i,
|
||||
self->pCon);
|
||||
}
|
||||
if( self->iChannel != 0 && self->iChannel != -10 )
|
||||
{
|
||||
sCount.Monitors[self->iChannel - 1] =
|
||||
GetCounts((pCounter)self->pCounterData,
|
||||
self->pCon);
|
||||
}
|
||||
/* counter1 */
|
||||
strcat(pHead,"Counter1 ");
|
||||
sCount.lCount = GetCounts((pCounter)self->pCounterData,self->pCon);
|
||||
sprintf(pItem," %-14ld",sCount.lCount);
|
||||
strcat(pStatus,pItem);
|
||||
|
||||
/*
|
||||
WARNING
|
||||
Assignements have to be checked when the Schlumpfes are
|
||||
ready putting the counter box together.
|
||||
*/
|
||||
|
||||
/* counter2 */
|
||||
strcat(pHead,"Counter2 ");
|
||||
sCount.Monitors[0] = GetMonitor((pCounter)self->pCounterData,
|
||||
1,self->pCon);
|
||||
sprintf(pItem," %-14ld",sCount.Monitors[0]);
|
||||
strcat(pStatus,pItem);
|
||||
|
||||
/* monitors */
|
||||
sCount.Monitors[3] = GetMonitor((pCounter)self->pCounterData,
|
||||
2,self->pCon);
|
||||
sCount.Monitors[4] = GetMonitor((pCounter)self->pCounterData,
|
||||
3,self->pCon);
|
||||
|
||||
/* get time */
|
||||
sCount.fTime = GetCountTime((pCounter)self->pCounterData,
|
||||
self->pCon);
|
||||
strcat(pHead,"Monitor1 ");
|
||||
sprintf(pItem," %-11ld",sCount.Monitors[3]);
|
||||
strcat(pStatus,pItem);
|
||||
strcat(pHead,"Monitor2 ");
|
||||
sprintf(pItem," %-11ld",sCount.Monitors[4]);
|
||||
strcat(pStatus,pItem);
|
||||
strcat(pHead,"Time ");
|
||||
sprintf(pItem," %-5.1f",sCount.fTime);
|
||||
strcat(pStatus,pItem);
|
||||
|
||||
/* write progress */
|
||||
strcat(pHead,"\n");
|
||||
strcat(pStatus,"\n");
|
||||
SCWrite(self->pCon,pHead,eLog);
|
||||
SCWrite(self->pCon,pStatus,eLog);
|
||||
|
||||
/* stow away */
|
||||
DynarReplace(self->pCounts,self->iCounts,&sCount,sizeof(CountEntry));
|
||||
self->iCounts++;
|
||||
return 1;
|
||||
}
|
||||
if (self->iChannel != 0 && self->iChannel != -10) {
|
||||
sCount.Monitors[self->iChannel - 1] =
|
||||
GetCounts((pCounter) self->pCounterData, self->pCon);
|
||||
}
|
||||
/* counter1 */
|
||||
strcat(pHead, "Counter1 ");
|
||||
sCount.lCount = GetCounts((pCounter) self->pCounterData, self->pCon);
|
||||
sprintf(pItem, " %-14ld", sCount.lCount);
|
||||
strcat(pStatus, pItem);
|
||||
|
||||
/*
|
||||
WARNING
|
||||
Assignements have to be checked when the Schlumpfes are
|
||||
ready putting the counter box together.
|
||||
*/
|
||||
|
||||
/* counter2 */
|
||||
strcat(pHead, "Counter2 ");
|
||||
sCount.Monitors[0] = GetMonitor((pCounter) self->pCounterData,
|
||||
1, self->pCon);
|
||||
sprintf(pItem, " %-14ld", sCount.Monitors[0]);
|
||||
strcat(pStatus, pItem);
|
||||
|
||||
/* monitors */
|
||||
sCount.Monitors[3] = GetMonitor((pCounter) self->pCounterData,
|
||||
2, self->pCon);
|
||||
sCount.Monitors[4] = GetMonitor((pCounter) self->pCounterData,
|
||||
3, self->pCon);
|
||||
|
||||
/* get time */
|
||||
sCount.fTime = GetCountTime((pCounter) self->pCounterData, self->pCon);
|
||||
strcat(pHead, "Monitor1 ");
|
||||
sprintf(pItem, " %-11ld", sCount.Monitors[3]);
|
||||
strcat(pStatus, pItem);
|
||||
strcat(pHead, "Monitor2 ");
|
||||
sprintf(pItem, " %-11ld", sCount.Monitors[4]);
|
||||
strcat(pStatus, pItem);
|
||||
strcat(pHead, "Time ");
|
||||
sprintf(pItem, " %-5.1f", sCount.fTime);
|
||||
strcat(pStatus, pItem);
|
||||
|
||||
/* write progress */
|
||||
strcat(pHead, "\n");
|
||||
strcat(pStatus, "\n");
|
||||
SCWrite(self->pCon, pHead, eLog);
|
||||
SCWrite(self->pCon, pStatus, eLog);
|
||||
|
||||
/* stow away */
|
||||
DynarReplace(self->pCounts, self->iCounts, &sCount, sizeof(CountEntry));
|
||||
self->iCounts++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int ConfigureAmor(pScanData self)
|
||||
{
|
||||
self->WriteHeader = AmorHeader;
|
||||
self->WriteScanPoints = AmorPoints;
|
||||
self->CollectScanData = AmorCollect;
|
||||
return 1;
|
||||
}
|
||||
int ConfigureAmor(pScanData self)
|
||||
{
|
||||
self->WriteHeader = AmorHeader;
|
||||
self->WriteScanPoints = AmorPoints;
|
||||
self->CollectScanData = AmorCollect;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user