Files
sics/site_ansto/action.c
Ferdi Franceschini 165f1b90a4 lakeshore340_common.tcl
Lakeshore controllers will be connected to the ca5-[instrument] moxa box
Default config parameters are now available via a tc_dfltPar array
IP and socket number are now mandatory when creating an ls340 object

hrpd/.../lakeshore340.tcl
Multiple lakeshores can now be added to the hdb tree

echidna_configuration.tcl
Provide example  for configuring two lakeshores

SICS-134 reflectometer/../commands.tcl
First draft of beam/attenuator command, currently sends POS=xx (this won't work)

reflectometer/../motor_configuration.tcl
Add bat position feedback via action

sans/../motor_configuration.tcl
Renamed action parameter (aoid) to "action"

server_config.tcl
Initialise motor movecount to 500 to reduce number of position updates by a factor of 50

SICS-134 action.c
Update the beam/attenuator command feedback variable when POS changes.

SICS-134 motor_dmc2280.c
Added PLP:BAT:POS status response handler for platypus bat position updates
Only send IDLE state position updates if position change is greater than the precision.
Rename action parameter (aoid) to "action"

r2679 | ffr | 2008-08-19 15:11:55 +1000 (Tue, 19 Aug 2008) | 31 lines
2012-11-15 13:41:17 +11:00

69 lines
1.8 KiB
C

/*-------------------------------------------------------------------------
* @file ACTION OBJECT
* Currently just provides methods to set SICSVariables on status update.
* Copyright: see file Copyright.txt
*/
#include "action.h"
#include "sics.h"
#include "asyncqueue.h"
#include "nwatch.h"
#include "fsm.h"
#include "anstoutil.h"
#include "sicsvar.h"
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
static char *SV_FastShutter = "FastShutter";
static char *SV_BATPOS = "::beam::attenuator::_fb_BeamAttenuator";
static void setTextSICSVar(char *VarName, char *value) {
int privilege = 1;
pSicsVariable svText=NULL;
svText = (pSicsVariable)FindCommandData(pServ->pSics,SV_FastShutter,"SicsVariable");
if (svText != NULL)
VarSetText(svText,value,privilege);
}
/**
* @brief Update a SICS variable with the current status
*
* @param input, status from device
* @param identifier, status query identifier
*/
void AO_istatus(int input, char *identifier) {
int testVal;
if (strcasecmp(identifier, "QKK:TI1") == 0) {
testVal = 48 & input;
if (testVal == 32) { // Fast shutter open
setTextSICSVar(SV_FastShutter, "OPEN");
} else if (testVal == 16) { // Fast shutter closed
setTextSICSVar(SV_FastShutter, "CLOSED");
} else if (testVal == 48) {
setTextSICSVar(SV_FastShutter, "INBETWEEN");
} else { // 0 ie both limits activated
setTextSICSVar(SV_FastShutter, "FAULT");
}
} else if (strcasecmp(identifier, "PLP:BAT:POS") == 0) {
// Handle platypus:BAT POS
switch (input) {
case -1:
setTextSICSVar(SV_BATPOS, "OUT");
break;
case 0:
setTextSICSVar(SV_BATPOS, "IN");
break;
case 1:
setTextSICSVar(SV_BATPOS, "OSCILLATING");
default:
break;
}
}
}