Add statuswd

This commit is contained in:
2023-08-17 17:01:08 +02:00
parent 65dbe5a88b
commit 20763016d9
4 changed files with 41 additions and 4 deletions

View File

@@ -157,6 +157,19 @@ record(waveform,"$(P)Plg-Mtn${INDEX}-ErrId-Arr"){
field(TSE, "0")
}
# Axis Error Id
record(waveform,"$(P)Plg-Mtn${INDEX}-Stat-Arr"){
info(asyn:FIFO, "1000")
field(DESC, "Status wd")
field(PINI, "1")
field(DTYP, "asynInt32ArrayIn")
field(INP, "@asyn(PLUGIN.MOTION_${INDEX},$(ADDR=0),$(TIMEOUT=1000))plugin.motion_${INDEX}.statuswd_arr")
field(FTVL, "LONG")
field(NELM, "$(NELM)")
field(SCAN, "I/O Intr")
field(TSE, "0")
}
record(bo,"$(P)Plg-Mtn${INDEX}-EnaCmd-RB"){
info(asyn:READBACK,"1")
field(DESC, "Plg Enable")

View File

@@ -35,6 +35,7 @@
#define ECMC_PLUGIN_ASYN_ERROR_DATA "error_arr"
#define ECMC_PLUGIN_ASYN_BUFF_SIZE "buff_size"
#define ECMC_PLUGIN_ASYN_ELEMENTS_IN_BUFF "elem_count"
#define ECMC_PLUGIN_ASYN_STATUSWD_DATA "statuswd_arr"
#include <sstream>
@@ -216,6 +217,11 @@ ecmcMotionPlg::ecmcMotionPlg(int objIndex, // index of this object (if s
cfgDbgMode_,
ECMC_PLUGIN_ASYN_ERROR_DATA,
this);
statusWdBuffer_ = new ecmcDataBuffer<epicsInt32>(objectId_,12,
cfgArraySize_,
cfgDbgMode_,
ECMC_PLUGIN_ASYN_STATUSWD_DATA,
this);
axis_ = (ecmcAxisBase*) getAxisPointer(cfgAxisIndex_);
clearBuffers();
@@ -473,6 +479,7 @@ void ecmcMotionPlg::clearBuffers() {
atTargetBuffer_->clear();
errorIdBuffer_->clear();
xPosBuffer_->clear();
statusWdBuffer_->clear();
}
void ecmcMotionPlg::printEcDataArray(uint8_t* data,
@@ -847,6 +854,9 @@ void ecmcMotionPlg::executeMotionObject() {
atTargetBuffer_->addData(tempAxisStat->onChangeData.statusWd.attarget);
errorIdBuffer_->addData(tempAxisStat->onChangeData.error);
epicsInt32 *temp=(epicsInt32*)&(tempAxisStat->onChangeData.statusWd); // A bit nasty
statusWdBuffer_->addData(*temp);
xTime_+=xdt_;
xPosBuffer_->addData(xTime_); // Always relative within one buffer
@@ -1028,14 +1038,15 @@ void ecmcMotionPlg::writeBuffers() {
encSourceBuffer_->writeBuffer();
atTargetBuffer_->writeBuffer();
errorIdBuffer_->writeBuffer();
statusWdBuffer_->writeBuffer();
// Always write x last if triggering is needed
xPosBuffer_->writeBuffer();
}
// triggered by ecmc RT thread
void ecmcMotionPlg::switchBuffers() {
// switch in new empty buffer while data is stored in the other.
// switch in new empty buffer while data is stored in the other.
actPosBuffer_->switchBuffer();
setPosBuffer_->switchBuffer();
diffPosBuffer_->switchBuffer();
@@ -1047,5 +1058,7 @@ void ecmcMotionPlg::switchBuffers() {
encSourceBuffer_->switchBuffer();
atTargetBuffer_->switchBuffer();
errorIdBuffer_->switchBuffer();
statusWdBuffer_->switchBuffer();
xPosBuffer_->switchBuffer();
}

View File

@@ -155,6 +155,7 @@ class ecmcMotionPlg : public asynPortDriver {
ecmcDataBuffer<epicsInt8> *encSourceBuffer_;
ecmcDataBuffer<epicsInt8> *atTargetBuffer_;
ecmcDataBuffer<epicsInt32> *errorIdBuffer_;
ecmcDataBuffer<epicsInt32> *statusWdBuffer_;
bool bTriggInProgress_;
double xdt_;

View File

@@ -44,6 +44,7 @@ pvlist = [ 'BuffSze',
'EncSrc-Arr',
'AtTrg-Arr',
'ErrId-Arr',
'Stat-Arr',
'Mde-RB',
'Cmd-RB',
'Stat',
@@ -55,7 +56,8 @@ pvlist = [ 'BuffSze',
pvAnalog = ['PosAct-Arr',
'PosSet-Arr',
'PosErr-Arr',
'ErrId-Arr']
'ErrId-Arr',
'Stat-Arr']
pvBinary = ['Ena-Arr',
'EnaAct-Arr',
@@ -110,13 +112,15 @@ class ecmcMtnMainGui(QtWidgets.QDialog):
self.plotColor['PosSet-Arr']='b'
self.plotColor['PosErr-Arr']='r'
self.plotColor['ErrId-Arr']='k'
self.plotColor['Stat-Arr']='m'
self.checkboxColor={}
self.checkboxColor['PosAct-Arr']='green'
self.checkboxColor['PosSet-Arr']='blue'
self.checkboxColor['PosErr-Arr']='red'
self.checkboxColor['ErrId-Arr']='black'
self.checkboxColor['Stat-Arr']='magenta'
# Binary
self.plotColor['Ena-Arr']='b'
self.plotColor['EnaAct-Arr']='c'
@@ -476,6 +480,9 @@ class ecmcMtnMainGui(QtWidgets.QDialog):
def on_change_ErrId_Arr(self,pvname=None, value=None, char_value=None,timestamp=None, **kw):
self.pv_signal_cbs['ErrId-Arr'].data_signal.emit(value)
def on_change_Stat_Arr(self,pvname=None, value=None, char_value=None,timestamp=None, **kw):
self.pv_signal_cbs['Stat-Arr'].data_signal.emit(value)
def on_change_Mde_RB(self,pvname=None, value=None, char_value=None,timestamp=None, **kw):
self.pv_signal_cbs['Mde-RB'].data_signal.emit(value)
@@ -546,6 +553,9 @@ class ecmcMtnMainGui(QtWidgets.QDialog):
def sig_cb_ErrId_Arr(self,value):
self.addData('ErrId-Arr', value)
def sig_cb_Stat_Arr(self,value):
self.addData('Stat-Arr', value)
def sig_cb_Mde_RB(self,value):
if value < 1 or value> 2:
self.modeStr = "NO_MODE"