Commit acc325d8 authored by Claes Sjofors's avatar Claes Sjofors

Profinet configurator, module name restrictions removed

parent 9b6f43bf
...@@ -169,6 +169,7 @@ int pndevice_save_cb( void *sctx) ...@@ -169,6 +169,7 @@ int pndevice_save_cb( void *sctx)
if ( EVEN(sts)) goto return_now; if ( EVEN(sts)) goto return_now;
// Do a temporary rename all module object to avoid name collisions // Do a temporary rename all module object to avoid name collisions
#if 0
for ( sts = ldh_GetChild( ctx->ldhses, ctx->aref.Objid, &oid); for ( sts = ldh_GetChild( ctx->ldhses, ctx->aref.Objid, &oid);
ODD(sts); ODD(sts);
sts = ldh_GetNextSibling( ctx->ldhses, oid, &oid)) { sts = ldh_GetNextSibling( ctx->ldhses, oid, &oid)) {
...@@ -180,6 +181,7 @@ int pndevice_save_cb( void *sctx) ...@@ -180,6 +181,7 @@ int pndevice_save_cb( void *sctx)
sts = ldh_ChangeObjectName( ctx->ldhses, oid, name); sts = ldh_ChangeObjectName( ctx->ldhses, oid, name);
if ( EVEN(sts)) goto return_now; if ( EVEN(sts)) goto return_now;
} }
#endif
for ( unsigned int i = 1; i < ctx->attr->attrnav->dev_data.slot_data.size(); i++) { for ( unsigned int i = 1; i < ctx->attr->attrnav->dev_data.slot_data.size(); i++) {
GsdmlSlotData *slot = ctx->attr->attrnav->dev_data.slot_data[i]; GsdmlSlotData *slot = ctx->attr->attrnav->dev_data.slot_data[i];
...@@ -204,11 +206,13 @@ int pndevice_save_cb( void *sctx) ...@@ -204,11 +206,13 @@ int pndevice_save_cb( void *sctx)
sizeof(name), &size); sizeof(name), &size);
if ( EVEN(sts)) goto return_now; if ( EVEN(sts)) goto return_now;
#if 0
if ( strcmp( name, mname) != 0) { if ( strcmp( name, mname) != 0) {
// Change name // Change name
sts = ldh_ChangeObjectName( ctx->ldhses, slot->module_oid, mname); sts = ldh_ChangeObjectName( ctx->ldhses, slot->module_oid, mname);
if ( EVEN(sts)) goto return_now; if ( EVEN(sts)) goto return_now;
} }
#endif
// Check that sibling position is right // Check that sibling position is right
sts = ldh_GetPreviousSibling( ctx->ldhses, slot->module_oid, &prev); sts = ldh_GetPreviousSibling( ctx->ldhses, slot->module_oid, &prev);
...@@ -231,8 +235,13 @@ int pndevice_save_cb( void *sctx) ...@@ -231,8 +235,13 @@ int pndevice_save_cb( void *sctx)
} }
} }
else { else {
// New class, delete current object // New class, delete current object, reuse the name
sts = ldh_ObjidToName( ctx->ldhses, slot->module_oid,
ldh_eName_Object, mname, sizeof(mname), &size);
if ( EVEN(sts)) goto return_now;
sts = ldh_DeleteObjectTree( ctx->ldhses, slot->module_oid, 0); sts = ldh_DeleteObjectTree( ctx->ldhses, slot->module_oid, 0);
if ( EVEN(sts)) goto return_now;
} }
} }
} }
...@@ -826,8 +835,23 @@ pwr_tStatus pndevice_init( device_sCtx *ctx) ...@@ -826,8 +835,23 @@ pwr_tStatus pndevice_init( device_sCtx *ctx)
ctx->attr->attrnav->dev_data.slot_data[idx]->module_oid = module_oid; ctx->attr->attrnav->dev_data.slot_data[idx]->module_oid = module_oid;
} }
if ( corrupt) { if ( corrupt) {
ctx->attr->wow->DisplayError( "Configuration corrupt", corrupt = 0;
"Configuration of module objects doesn't match device configuration");
// Not standard module names, get slot number from object order instead
idx = 1;
for ( sts = ldh_GetChild( ctx->ldhses, ctx->aref.Objid, &module_oid);
ODD(sts);
sts = ldh_GetNextSibling( ctx->ldhses, module_oid, &module_oid)) {
if ( idx >= ctx->attr->attrnav->dev_data.slot_data.size()) {
corrupt = 1;
break;
}
ctx->attr->attrnav->dev_data.slot_data[idx]->module_oid = module_oid;
idx++;
}
if ( corrupt)
ctx->attr->wow->DisplayError( "Configuration corrupt",
"Configuration of module objects doesn't match device configuration");
} }
return 1; return 1;
} }
......
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