Commit b96424a8 authored by claes's avatar claes

Integer IO and integer signals implemented

parent b8d15cff
......@@ -2153,12 +2153,24 @@ create_active_io ()
sts = gdh_CreateObject("pwrNode-active-io-dv", pwr_cClass_DvArea,
4000 * sizeof(((pwr_sClass_DvArea*)0)->Value[0]),
&oid, pwr_cNObjid, 0, pwr_cNObjid);
sts = gdh_CreateObject("pwrNode-active-io-ii", pwr_cClass_IiArea,
4000 * sizeof(((pwr_sClass_IiArea*)0)->Value[0]),
&oid, pwr_cNObjid, 0, pwr_cNObjid);
sts = gdh_CreateObject("pwrNode-active-io-io", pwr_cClass_IoArea,
4000 * sizeof(((pwr_sClass_IoArea*)0)->Value[0]),
&oid, pwr_cNObjid, 0, pwr_cNObjid);
sts = gdh_CreateObject("pwrNode-active-io-iv", pwr_cClass_IvArea,
4000 * sizeof(((pwr_sClass_IvArea*)0)->Value[0]),
&oid, pwr_cNObjid, 0, pwr_cNObjid);
sts = gdh_CreateObject("pwrNode-active-io-dv_init", pwr_cClass_IvArea,
4000 * sizeof(((pwr_sClass_IvArea*)0)->Value[0]),
&oid, pwr_cNObjid, 0, pwr_cNObjid);
sts = gdh_CreateObject("pwrNode-active-io-av_init", pwr_cClass_IvArea,
4000 * sizeof(((pwr_sClass_IvArea*)0)->Value[0]),
&oid, pwr_cNObjid, 0, pwr_cNObjid);
sts = gdh_CreateObject("pwrNode-active-io-iv_init", pwr_cClass_IvArea,
4000 * sizeof(((pwr_sClass_IvArea*)0)->Value[0]),
&oid, pwr_cNObjid, 0, pwr_cNObjid);
}
static void
......
......@@ -658,8 +658,10 @@ load_backup ()
pwr_tObjid oid;
pwr_sClass_AvArea *avp;
pwr_sClass_DvArea *dvp;
pwr_sClass_IvArea *ivp;
pwr_sClass_IvArea *iavp;
pwr_sClass_IvArea *idvp;
pwr_sClass_IvArea *iivp;
pwr_tStatus sts;
int i;
pwr_sClass_IOHandler *iop;
......@@ -718,6 +720,30 @@ load_backup ()
return;
}
sts = gdh_NameToObjid("pwrNode-active-io-iv", &oid);
if (EVEN(sts)) {
errh_Error("gdh_NameToObjid(pwrNode-active-io-iv, &oid), %m", sts);
return;
}
sts = gdh_ObjidToPointer(oid, (void *) &ivp);
if (EVEN(sts)) {
errh_Error("gdh_ObjidToPointer(oid, (void *) &ivp), %m", sts);
return;
}
sts = gdh_NameToObjid("pwrNode-active-io-iv_init", &oid);
if (EVEN(sts)) {
errh_Error("gdh_NameToObjid(pwrNode-active-io-iv_init, &oid), %m", sts);
return;
}
sts = gdh_ObjidToPointer(oid, (void *) &iivp);
if (EVEN(sts)) {
errh_Error("gdh_ObjidToPointer(oid, (void *) &iivp), %m", sts);
return;
}
for (i = 0; i < iop->AvCount; i++) {
pwr_tFloat32 *ifp = gdh_TranslateRtdbPointer(iavp->Value[i]);
avp->Value[i]= *ifp;
......@@ -728,6 +754,11 @@ load_backup ()
dvp->Value[i] = *ibp;
}
for (i = 0; i < iop->IvCount; i++) {
pwr_tInt32 *iip = gdh_TranslateRtdbPointer(iivp->Value[i]);
ivp->Value[i] = *iip;
}
sts = bck_LoadBackup();
if (EVEN(sts)) {
errh_Error("bck_LoadBackup, %m", sts);
......@@ -743,4 +774,9 @@ load_backup ()
pwr_tBoolean *ibp = gdh_TranslateRtdbPointer(idvp->Value[i]);
*ibp = dvp->Value[i];
}
for (i = 0; i < iop->IvCount; i++) {
pwr_tInt32 *iip = gdh_TranslateRtdbPointer(iivp->Value[i]);
*iip = ivp->Value[i];
}
}
......@@ -556,3 +556,115 @@ void pispeed_exec(
object->ActVal = (object->PulsIn - piold) * object->Gain *
object->TimFact / *object->ScanTime;
}
/**
DtoMask
funktion: Assamble digital signals to integer bitmask
@aref dtomask DtoMask
*/
void DtoMask_exec(
plc_sThread *tp,
pwr_sClass_DtoMask *object)
{
int i;
pwr_tBoolean *d, **dp;
pwr_tInt32 val = 0;
pwr_tInt32 m = 1;
d = &object->d1;
dp = &object->d1P;
for ( i = 0; i < 32; i++) {
*d = **dp;
if ( *d)
val |= m;
d += 2;
dp += 2;
m = m << 1;
}
object->Mask = val;
}
/**
MaskToD
funktion: Deassamble integer bitmask to digital signals
@aref masktod MaskToD
*/
void MaskToD_exec(
plc_sThread *tp,
pwr_sClass_MaskToD *object)
{
int i;
pwr_tInt32 m = 1;
pwr_tBoolean *d;
d = &object->od1;
object->Mask = *object->MaskP;
for ( i = 0; i < 32; i++) {
if ( object->Mask & m)
*d = TRUE;
else
*d = FALSE;
d++;
m = m << 1;
}
}
/**
DtoEnum
funktion: Select enumeration value from digital inputs
@aref dtoenum DtoEnum
*/
void DtoEnum_exec(
plc_sThread *tp,
pwr_sClass_DtoEnum *object)
{
int i;
pwr_tBoolean *d, **dp;
pwr_tInt32 val = object->DefaultValue;
d = &object->d0;
dp = &object->d0P;
for ( i = 0; i < 32; i++) {
*d = **dp;
if ( *d) {
val = object->EnumValues[i];
break;
}
d += 2;
dp += 2;
}
object->Enum = val;
}
/**
EnumToD
funktion: Identify enumeration value.
@aref enumtod EnumToD
*/
void EnumToD_exec(
plc_sThread *tp,
pwr_sClass_EnumToD *object)
{
int i;
pwr_tBoolean *d;
d = &object->od0;
object->Enum = *object->EnumP;
for ( i = 0; i < 32; i++) {
if ( object->Enum == object->EnumValues[i])
*d = TRUE;
else
*d = FALSE;
d++;
}
}
......@@ -61,3 +61,15 @@ typedef struct {
pwr_tFloat32 ActualValue;
} plc_sClass_Av;
typedef struct {
pwr_tInt32 ActualValue;
} plc_sClass_Ii;
typedef struct {
pwr_tInt32 ActualValue;
} plc_sClass_Io;
typedef struct {
pwr_tInt32 ActualValue;
} plc_sClass_Iv;
......@@ -128,27 +128,43 @@
if ( in ) ut = false;
/**
STOIP
Store into integer parameter
StoIp
Store integer parameter
@aref stoip StoIp
*/
#define stoip_exec(ut,in) \
#define StoIp_exec(ut,in) \
ut = in;
/**
CSTOIP
Store conditionally into integer parameter
CStoIp
Store conditionally integer parameter
@aref cstoip CStoIp
*/
#define cstoip_exec(ut,in,cond) \
#define CStoIp_exec(ut,in,cond) \
if ( cond ) ut = in;
/**
GETIP
Get Integer parameter as real value
@aref getip GetIp
StoAtoIp
Store analog value into integer parameter
@aref stoatoip StoAtoIp
*/
#define getip_exec(object,in) \
#define StoAtoIp_exec(ut,in) \
ut = in > 0 ? in + 0.5 : in - 0.5;
/**
CStoAtoIp
Store conditionally analog value into integer parameter
@aref cstoatoip CStoAtoIp
*/
#define CStoAtoIp_exec(ut,in,cond) \
if ( cond ) ut = in > 0 ? in + 0.5 : in - 0.5;
/**
GetIpToA
Get Integer parameter as an analog value
@aref getiptoa GetIpToA
*/
#define GetIpToA_exec(object,in) \
object->ActVal = in;
/**
......@@ -200,6 +216,67 @@
rawvalue->RawValue = in; \
absvalue->RawValue = in;
/**
StoIo
Store integer output
@aref stoio StoIo
*/
#define stoio_exec(obj,in) \
obj->ActualValue = in;
/**
CStoIo
store conditionally into integer output
@aref cstoio CStoIo
*/
#define cstoio_exec(obj,in,cond) \
if ( cond ) obj->ActualValue = in;
/**
StoIv
Store integer value
@aref stoiv StoIv
*/
#define stoiv_exec(obj,in) \
obj->ActualValue = in;
/**
CStoIv
store conditionally into integer value
@aref cstoiv CStoIv
*/
#define cstoiv_exec(obj,in,cond) \
if ( cond ) obj->ActualValue = in;
/**
StoIi
store integer input (Simulate)
@aref stoii StoIi
*/
#define stoii_exec(obj,in) \
obj->ActualValue = in;
/**
CStoIi
store conditionally into integer input (Simulate)
@aref cstoii CStoIi
*/
#define cstoii_exec(obj,in,cond) \
if ( cond ) obj->ActualValue = in;
/**
AtoI
@aref atoi AtoI
*/
#define AtoI_exec(obj,in) \
obj->ActVal = in > 0 ? in + 0.5 : in - 0.5;
/**
ItoA
@aref itoa ItoA
*/
#define ItoA_exec(obj,in) \
obj->ActVal = in;
......
......@@ -5510,12 +5510,17 @@ int rtt_debug_object_add(
case pwr_cClass_Av:
case pwr_cClass_Ai:
case pwr_cClass_Ao:
case pwr_cClass_Ii:
case pwr_cClass_Io:
case pwr_cClass_Iv:
strcpy( parname, "ActualValue");
break;
case pwr_cClass_ChanDi:
case pwr_cClass_ChanDo:
case pwr_cClass_ChanAi:
case pwr_cClass_ChanAo:
case pwr_cClass_ChanIi:
case pwr_cClass_ChanIo:
sts = gdh_ObjidToName ( objid, objname, sizeof(objname), cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
strcat( objname, ".SigChanCon");
......
......@@ -676,6 +676,46 @@ static pwr_tStatus dataa_A8( dataa_ctx dataactx, char *line, char *pos,
sprintf( out, "(*(%s->AIn8P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I1( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn1P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I2( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn2P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I3( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn3P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I4( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn4P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I5( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn5P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I6( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn6P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I7( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn7P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_I8( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(*(%s->IIn8P))", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_od1( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutD1)", var);
......@@ -756,6 +796,46 @@ static pwr_tStatus dataa_OA8( dataa_ctx dataactx, char *line, char *pos,
sprintf( out, "(%s->OutA8)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI1( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI1)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI2( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI2)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI3( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI3)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI4( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI4)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI5( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI5)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI6( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI6)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI7( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI7)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
static pwr_tStatus dataa_OI8( dataa_ctx dataactx, char *line, char *pos,
char *out, int *incr, char *var) {
sprintf( out, "(%s->OutI8)", var);
*incr = strlen(out);
return GSX__SUCCESS; }
/*************************************************************************
*
......@@ -949,6 +1029,22 @@ static int dataa_aliasdef( dataa_ctx dataactx, char *line)
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_A7);
else if ( !strcmp( out_str[0], "A8"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_A8);
else if ( !strcmp( out_str[0], "I1"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I1);
else if ( !strcmp( out_str[0], "I2"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I2);
else if ( !strcmp( out_str[0], "I3"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I3);
else if ( !strcmp( out_str[0], "I4"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I4);
else if ( !strcmp( out_str[0], "I5"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I5);
else if ( !strcmp( out_str[0], "I6"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I6);
else if ( !strcmp( out_str[0], "I7"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I7);
else if ( !strcmp( out_str[0], "I8"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_I8);
else if ( !strcmp( out_str[0], "od1"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_od1);
else if ( !strcmp( out_str[0], "od2"))
......@@ -981,6 +1077,22 @@ static int dataa_aliasdef( dataa_ctx dataactx, char *line)
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OA7);
else if ( !strcmp( out_str[0], "OA8"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OA8);
else if ( !strcmp( out_str[0], "OI1"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI1);
else if ( !strcmp( out_str[0], "OI2"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI2);
else if ( !strcmp( out_str[0], "OI3"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI3);
else if ( !strcmp( out_str[0], "OI4"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI4);
else if ( !strcmp( out_str[0], "OI5"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI5);
else if ( !strcmp( out_str[0], "OI6"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI6);
else if ( !strcmp( out_str[0], "OI7"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI7);
else if ( !strcmp( out_str[0], "OI8"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_OI8);
else if ( !strcmp( out_str[0], "ODa1"))
dataa_add_item( dataactx, out_str[1], "A", "A", &dataa_ODa1);
else if ( !strcmp( out_str[0], "ODa2"))
......@@ -1032,6 +1144,14 @@ dataa_t_item template_items[100] = {
{"A6", "A","A", &dataa_A6, 0, 0},
{"A7", "A","A", &dataa_A7, 0, 0},
{"A8", "A","A", &dataa_A8, 0, 0},
{"I1", "A","A", &dataa_I1, 0, 0},
{"I2", "A","A", &dataa_I2, 0, 0},
{"I3", "A","A", &dataa_I3, 0, 0},
{"I4", "A","A", &dataa_I4, 0, 0},
{"I5", "A","A", &dataa_I5, 0, 0},
{"I6", "A","A", &dataa_I6, 0, 0},
{"I7", "A","A", &dataa_I7, 0, 0},
{"I8", "A","A", &dataa_I8, 0, 0},
{"ODa1", "A","A", &dataa_ODa1, 0, 0},
{"ODa2", "A","A", &dataa_ODa2, 0, 0},
{"ODa3", "A","A", &dataa_ODa3, 0, 0},
......@@ -1052,6 +1172,14 @@ dataa_t_item template_items[100] = {
{"OA6", "A","A", &dataa_OA6, 0, 0},
{"OA7", "A","A", &dataa_OA7, 0, 0},
{"OA8", "A","A", &dataa_OA8, 0, 0},
{"OI1", "A","A", &dataa_OI1, 0, 0},
{"OI2", "A","A", &dataa_OI2, 0, 0},
{"OI3", "A","A", &dataa_OI3, 0, 0},
{"OI4", "A","A", &dataa_OI4, 0, 0},
{"OI5", "A","A", &dataa_OI5, 0, 0},
{"OI6", "A","A", &dataa_OI6, 0, 0},
{"OI7", "A","A", &dataa_OI7, 0, 0},
{"OI8", "A","A", &dataa_OI8, 0, 0},
{""}};
/*************************************************************************
......
This diff is collapsed.
This diff is collapsed.
......@@ -42,7 +42,9 @@ typedef enum {
goen_eGraphIndex_StoAgeneric = 34,
goen_eGraphIndex_StoDgeneric = 35,
goen_eGraphIndex_GetSgeneric = 36,
goen_eGraphIndex_StoSgeneric = 37
goen_eGraphIndex_StoSgeneric = 37,
goen_eGraphIndex_GetIgeneric = 38,
goen_eGraphIndex_StoIgeneric = 39
} goen_eGraphIndex;
static float f_pinlength = GOEN_F_PINLENGTH;
......@@ -392,6 +394,7 @@ int goen_create_nodetype_m4(
case goen_eGraphIndex_GetAgeneric:
case goen_eGraphIndex_GetDgeneric:
case goen_eGraphIndex_GetSgeneric:
case goen_eGraphIndex_GetIgeneric:
{
f_width = GOEN_F_GRID * 4;
f_height = GOEN_F_GRID;
......@@ -407,6 +410,9 @@ int goen_create_nodetype_m4(
else if ( graph_index == goen_eGraphIndex_GetSgeneric)
flow_AddText( nc, "GetS", f_strlength, 0.5 * f_strheight,
flow_eDrawType_TextHelveticaBold, GOEN_F_TEXTSIZE);
else if ( graph_index == goen_eGraphIndex_GetIgeneric)
flow_AddText( nc, "GetI", f_strlength, 0.5 * f_strheight,
flow_eDrawType_TextHelveticaBold, GOEN_F_TEXTSIZE);
else
flow_AddText( nc, "GetD", f_strlength, 0.5 * f_strheight,
flow_eDrawType_TextHelveticaBold, GOEN_F_TEXTSIZE);
......@@ -415,6 +421,7 @@ int goen_create_nodetype_m4(
case goen_eGraphIndex_StoAgeneric:
case goen_eGraphIndex_StoDgeneric:
case goen_eGraphIndex_StoSgeneric:
case goen_eGraphIndex_StoIgeneric:
{
f_width = GOEN_F_GRID * 4;
f_height = GOEN_F_GRID;
......@@ -430,6 +437,9 @@ int goen_create_nodetype_m4(
else if ( graph_index == goen_eGraphIndex_StoSgeneric)
flow_AddText( nc, "StoS", f_strlength, 0.5 * f_strheight,
flow_eDrawType_TextHelveticaBold, GOEN_F_TEXTSIZE);
else if ( graph_index == goen_eGraphIndex_StoIgeneric)
flow_AddText( nc, "StoI", f_strlength, 0.5 * f_strheight,
flow_eDrawType_TextHelveticaBold, GOEN_F_TEXTSIZE);
else
flow_AddText( nc, "StoD", f_strlength, 0.5 * f_strheight,
flow_eDrawType_TextHelveticaBold, GOEN_F_TEXTSIZE);
......
......@@ -727,6 +727,12 @@ int gsx_auto_create(
if ( EVEN(sts)) return sts;
*destpoint = 0;
break;
case pwr_eType_Int32:
sts = gre_create_node( foectx->grectx, pwr_cClass_GetIgeneric,
x, y, dest);
if ( EVEN(sts)) return sts;
*destpoint = 0;
break;
case pwr_eType_String:
sts = gre_create_node( foectx->grectx, pwr_cClass_GetSgeneric,
x, y, dest);
......@@ -754,6 +760,12 @@ int gsx_auto_create(
if ( EVEN(sts)) return sts;
*destpoint = 0;
break;
case pwr_eType_Int32:
sts = gre_create_node( foectx->grectx, pwr_cClass_StoIgeneric,
x, y, dest);
if ( EVEN(sts)) return sts;
*destpoint = 0;
break;
case pwr_eType_String:
sts = gre_create_node( foectx->grectx, pwr_cClass_StoSgeneric,
x, y, dest);
......
......@@ -374,11 +374,17 @@ PalItemClass::PalItemClass( Pal *pal, char *item_name,
case pwr_cClass_GetAv:
case pwr_cClass_GetAi:
case pwr_cClass_GetAo:
case pwr_cClass_GetSv:
case pwr_cClass_GetIi:
case pwr_cClass_GetIo:
case pwr_cClass_GetIv:
pixmap = pal->pixmap_get;
break;
case pwr_cClass_GetAp:
case pwr_cClass_GetDp:
case pwr_cClass_getip:
case pwr_cClass_GetIpToA:
case pwr_cClass_GetIp:
case pwr_cClass_GetSp:
case pwr_cClass_GetData:
pixmap = pal->pixmap_getp;
break;
......@@ -386,12 +392,20 @@ PalItemClass::PalItemClass( Pal *pal, char *item_name,
case pwr_cClass_stodp:
case pwr_cClass_setdp:
case pwr_cClass_resdp:
case pwr_cClass_stoip:
case pwr_cClass_StoAtoIp:
case pwr_cClass_StoIp:
case pwr_cClass_cstoao:
case pwr_cClass_cstoav:
case pwr_cClass_cstoai:
case pwr_cClass_cstoip:
case pwr_cClass_CStoAtoIp:
case pwr_cClass_CStoIp:
case pwr_cClass_cstoio:
case pwr_cClass_cstoii:
case pwr_cClass_cstoiv:
case pwr_cClass_cstoap:
case pwr_cClass_cstosv:
case pwr_cClass_cstosp:
case pwr_cClass_stosp:
pixmap = pal->pixmap_stop;
break;
case pwr_cClass_Text: pixmap = pal->pixmap_text; break;
......
......@@ -88,9 +88,9 @@ static char class_name[90][80] = {
{"Pos3p"},
{"Inc3p"},
{"WindowSubstep"},
{"StoIp"},
{"CStoIp"},
{"GetIp"},
{"StoAtoIp"},
{"CStoAtoIp"},
{"GetIpToA"},
{"ExternRef"},
{"Text"},
{"$LibHier"},
......@@ -4990,7 +4990,7 @@ static void cnv_from_neted( vldh_t_node n)
case pwr_cClass_cstoao:
case pwr_cClass_cstoap:
case pwr_cClass_cstoav:
case pwr_cClass_cstoip:
case pwr_cClass_CStoAtoIp:
case pwr_cClass_GetAi:
case pwr_cClass_GetAo:
case pwr_cClass_GetAp:
......@@ -5000,7 +5000,7 @@ static void cnv_from_neted( vldh_t_node n)
case pwr_cClass_GetDo:
case pwr_cClass_GetDp:
case pwr_cClass_GetDv:
case pwr_cClass_getip:
case pwr_cClass_GetIpToA:
case pwr_cClass_GetPi:
case pwr_cClass_resdo:
case pwr_cClass_resdp:
......@@ -5014,7 +5014,7 @@ static void cnv_from_neted( vldh_t_node n)
case pwr_cClass_stodo:
case pwr_cClass_stodp:
case pwr_cClass_stodv:
case pwr_cClass_stoip:
case pwr_cClass_StoAtoIp:
case pwr_cClass_ASup:
case pwr_cClass_and:
case pwr_cClass_DSup:
......@@ -5076,7 +5076,7 @@ static void cnv_from_neted( vldh_t_node n)
case pwr_cClass_GetDo:
case pwr_cClass_GetDp:
case pwr_cClass_GetDv:
case pwr_cClass_getip:
case pwr_cClass_GetIpToA:
case pwr_cClass_GetPi:
case pwr_cClass_BodyText:
case pwr_cClass_Document:
......@@ -5109,7 +5109,7 @@ static void cnv_to_neted( vldh_t_node n)
case pwr_cClass_cstoao:
case pwr_cClass_cstoap:
case pwr_cClass_cstoav:
case pwr_cClass_cstoip:
case pwr_cClass_CStoAtoIp:
case pwr_cClass_GetAi:
case pwr_cClass_GetAo:
case pwr_cClass_GetAp:
......@@ -5119,7 +5119,7 @@ static void cnv_to_neted( vldh_t_node n)
case pwr_cClass_GetDo:
case pwr_cClass_GetDp:
case pwr_cClass_GetDv:
case pwr_cClass_getip:
case pwr_cClass_GetIpToA:
case pwr_cClass_GetPi:
case pwr_cClass_resdo:
case pwr_cClass_resdp:
......@@ -5133,7 +5133,7 @@ static void cnv_to_neted( vldh_t_node n)
case pwr_cClass_stodo:
case pwr_cClass_stodp:
case pwr_cClass_stodv:
case pwr_cClass_stoip:
case pwr_cClass_StoAtoIp:
case pwr_cClass_ASup:
case pwr_cClass_and:
case pwr_cClass_DSup:
......@@ -5194,7 +5194,7 @@ static void cnv_to_neted( vldh_t_node n)
case pwr_cClass_GetDo:
case pwr_cClass_GetDp:
case pwr_cClass_GetDv:
case pwr_cClass_getip:
case pwr_cClass_GetIpToA:
case pwr_cClass_GetPi:
case pwr_cClass_BodyText:
case pwr_cClass_Document:
......
......@@ -1159,6 +1159,12 @@ int wb_vrepwbl::load_files( const char *file_spec)
while( ODD(sts)) {
ifstream s(found_file);
if ( strchr( found_file, '#')) {
// Ignore files with '#'
sts = dcli_search_file( (char *)file_spec, found_file, DCLI_DIR_SEARCH_NEXT);
continue;
}
if ( file_cnt >= WBL_FILEMAX)
return 0;
......@@ -1206,6 +1212,7 @@ int wb_vrepwbl::load_files( const char *file_spec)
bool wb_vrepwbl::registerObject( pwr_tOix oix, ref_wblnode node)
{
#if 0
cout << "RegObj: " << oix << " " << node->name() << endl;
......
......@@ -459,6 +459,14 @@ pwr_tStatus wsx_CheckSigChanCon(
if ( con_class != pwr_cClass_ChanCo)
class_error = 1;
break;
case pwr_cClass_Io:
if ( con_class != pwr_cClass_ChanIo)
class_error = 1;
break;
case pwr_cClass_Ii:
if ( con_class != pwr_cClass_ChanIi)
class_error = 1;
break;
}
if ( class_error)
......
......@@ -2625,6 +2625,9 @@ int GeValueInput::action( grow_tObject object, glow_tEvent event)
return 1;
switch ( event->event) {
case glow_eEvent_MB1Down:
grow_SetClickSensitivity( dyn->graph->grow->ctx, glow_mSensitivity_MB1Click);
break;
case glow_eEvent_MB1Click:
if ( !(dyn->total_action_type & ge_mActionType_InputFocus)) {
grow_SetObjectInputFocus( object, 1);
......@@ -6887,7 +6890,6 @@ void GeSlider::open( ifstream& fp)
int GeSlider::connect( grow_tObject object, glow_sTraceData *trace_data)
{
int attr_type, attr_size;
int inverted;
char parsed_name[120];
int sts;
......@@ -6895,10 +6897,17 @@ int GeSlider::connect( grow_tObject object, glow_sTraceData *trace_data)
size = 4;
p = 0;
db = dyn->graph->parse_attr_name( attribute, parsed_name,
&inverted, &attr_type, &attr_size);
&inverted, &attr_type, &size);
if ( strcmp( parsed_name,"") == 0)
return 1;
switch ( attr_type) {
case pwr_eType_Float32:
case pwr_eType_Int32:
break;
default:
return 1;
}
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&p, &subid, size);
if ( EVEN(sts)) return sts;
......@@ -6973,9 +6982,16 @@ int GeSlider::scan( grow_tObject object)
glow_eDirection direction;
if ( !first_scan) {
switch ( attr_type) {
case pwr_eType_Float32:
if ( fabs( old_value - *p) < FLT_EPSILON)
// No change since last time
return 1;
case pwr_eType_Int32:
if ( *(pwr_tInt32 *)p == (pwr_tInt32) old_value)
return 1;
default: ;
}
}
else
first_scan = 0;
......@@ -6985,9 +7001,18 @@ int GeSlider::scan( grow_tObject object)
if ( min_pos != max_pos) {
if ( dyn->graph->current_slider != object &&
max_value != min_value) {
float value = *p;
float value;
double pos_x, pos_y;
switch ( attr_type) {
case pwr_eType_Float32:
value = *p;
break;
default:
value = (float) (*(pwr_tInt32 *)p);
break;
}
switch ( direction) {
case glow_eDirection_Down:
pos_y = (max_value - value) / (max_value - min_value) *
......@@ -7101,7 +7126,15 @@ int GeSlider::action( grow_tObject object, glow_tEvent event)
value = min_value;
dyn->graph->parse_attr_name( attribute, parsed_name, &inverted, &attr_type, &attr_size);
switch ( attr_type) {
case pwr_eType_Float32:
sts = gdh_SetObjectInfo( parsed_name, &value, sizeof(value));
break;
default: {
pwr_tInt32 ivalue = (pwr_tInt32) (value > 0 ? value + 0.5 : value - 0.5);
sts = gdh_SetObjectInfo( parsed_name, &ivalue, sizeof(ivalue));
}
}
if ( EVEN(sts)) printf("Slider error: %s\n", attribute);
}
break;
......
......@@ -1654,6 +1654,7 @@ class GeSlider : public GeDynElem {
int inverted;
bool first_scan;
pwr_tFloat32 old_value;
int attr_type;
GeSlider( GeDyn *e_dyn) :
GeDynElem(e_dyn, (ge_mDynType)0, ge_mActionType_Slider,
......
......@@ -45,6 +45,7 @@ typedef struct {
static int graph_attr_float32( Graph *graph, pwr_sAttrRef *attrref);
static int graph_attr_boolean( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_ix( Graph *graph, pwr_tObjid objid);
static int graph_object_ax( Graph *graph, pwr_tObjid objid);
static int graph_object_dx( Graph *graph, pwr_tObjid objid);
static int graph_object_chanxx( Graph *graph, pwr_tObjid objid);
......@@ -57,11 +58,16 @@ static graph_sObjectFunction graph_object_functions[] = {
{ pwr_cClass_Av, &graph_object_ax},
{ pwr_cClass_Ai, &graph_object_ax},
{ pwr_cClass_Ao, &graph_object_ax},
{ pwr_cClass_Iv, &graph_object_ix},
{ pwr_cClass_Ii, &graph_object_ix},
{ pwr_cClass_Io, &graph_object_ix},
{ pwr_cClass_Dv, &graph_object_dx},
{ pwr_cClass_Di, &graph_object_dx},
{ pwr_cClass_Do, &graph_object_dx},
{ pwr_cClass_ChanAi, &graph_object_chanxx},
{ pwr_cClass_ChanAo, &graph_object_chanxx},
{ pwr_cClass_ChanIi, &graph_object_chanxx},
{ pwr_cClass_ChanIo, &graph_object_chanxx},
{ pwr_cClass_ChanDi, &graph_object_chanxx},
{ pwr_cClass_ChanDo, &graph_object_chanxx},
{ pwr_cClass_pid, &graph_object_PID},
......@@ -385,6 +391,96 @@ static int graph_object_ax( Graph *graph, pwr_tObjid objid)
return 1;
}
//
// Object graph for Ii, Io and Iv
//
typedef struct {
char object_name[120];
graph_sObjectTrend td;
} graph_sObjectIx;
static void graph_object_ix_scan( Graph *graph)
{
graph_sObjectIx *od = (graph_sObjectIx *)graph->graph_object_data;
graph->trend_scan( &od->td);
}
static void graph_object_ix_close( Graph *graph)
{
free( graph->graph_object_data);
}
static int graph_object_ix( Graph *graph, pwr_tObjid objid)
{
pwr_sAttrRef attrref;
int sts;
grow_tObject object;
graph_sObjectIx *od;
pwr_tClassId classid;
pwr_tObjid sigchancon;
pwr_tClassId chan_classid;
char classname[40];
char chan_name[120];
char cmd[200];
od = (graph_sObjectIx *) calloc( 1, sizeof(graph_sObjectIx));
graph->graph_object_data = (void *) od;
graph->graph_object_close = graph_object_ix_close;
sts = gdh_GetObjectClass( objid, &classid);
if ( EVEN(sts)) return sts;
// Display object name in item "ObjectName"
sts = gdh_ObjidToName( objid, od->object_name,
sizeof(od->object_name), cdh_mNName);
if ( EVEN(sts)) return sts;
// Find field for object name
sts = grow_FindObjectByName( graph->grow->ctx, "ObjectName", &object);
if ( ODD(sts))
{
GeDyn *dyn;
grow_GetUserData( object, (void **)&dyn);
dyn->set_p( (void *) od->object_name);
}
sts = graph->trend_init( &od->td, objid);
// Register scan function
graph->graph_object_scan = graph_object_ix_scan;
// Add command to open channel graph
sts = gdh_ClassAttrToAttrref( classid, ".SigChanCon", &attrref);
if ( ODD(sts))
{
attrref.Objid = objid;
sts = gdh_GetObjectInfoAttrref( &attrref, (void *)&sigchancon, sizeof(sigchancon));
if ( EVEN(sts)) return sts;
sts = gdh_ObjidToName( sigchancon, chan_name, sizeof(chan_name),
cdh_mNName);
if ( ODD(sts))
{
sts = gdh_GetObjectClass( sigchancon, &chan_classid);
if ( EVEN(sts)) return sts;
sts = gdh_ObjidToName( cdh_ClassIdToObjid( chan_classid),
classname, sizeof(classname), cdh_mName_object);
if ( EVEN(sts)) return sts;
cdh_ToLower( classname, classname);
sprintf( cmd, "ope gr pwr_c_%s/ins=%s/nam=\"%s\"",
classname, chan_name, chan_name);
sts = graph->set_button_command( "OpenChannel", cmd);
}
}
return 1;
}
//
// Object graph for Di, Do and Dv
//
......
......@@ -95,12 +95,17 @@ int xnav_get_trace_attr( pwr_tObjid objid, char *attr)
case pwr_cClass_Av:
case pwr_cClass_Ai:
case pwr_cClass_Ao:
case pwr_cClass_Ii:
case pwr_cClass_Io:
case pwr_cClass_Iv:
strcpy( attr, "ActualValue");
break;
case pwr_cClass_ChanDi:
case pwr_cClass_ChanDo:
case pwr_cClass_ChanAi:
case pwr_cClass_ChanAo:
case pwr_cClass_ChanIi:
case pwr_cClass_ChanIo:
sts = gdh_ObjidToName ( objid, objname, sizeof(objname), cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
strcat( objname, ".SigChanCon");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment