]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/commitdiff
gio: Let transform function set pin param to the same value as pin_name
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 4 Oct 2015 20:04:18 +0000 (22:04 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 4 Oct 2015 20:04:18 +0000 (22:04 +0200)
It is better for the user if she sees only the popup with pin names rather
than the edit box. If the pin does not exist in the popup list, block
initialization code takes care of this case.

rpp/blocks/rpp_block_transform.m

index f1d66bf48f2ed1a569f0057bd2ba7f0ca70f28fb..aaf6d59d96eeef89276fcd1d83b70fe953dbfdf6 100644 (file)
@@ -33,19 +33,21 @@ function [outData] = update_gio_pin_name(instanceData)
     port_type_idx = find(strcmp(ParameterNames, 'port_type'));
     pin_number_idx = find(strcmp(ParameterNames, 'pin_number'));
 
-    if (~ismember('pin', ParameterNames))
-        instanceData(end+1).Name = 'pin';
-        instanceData(end).Value = '---';
-    end
-
     if (~ismember('pin_name', ParameterNames) && ...
         ~isempty(port_type_idx) && ...
         ~isempty(pin_number_idx)),
 
+        pin_name = sprintf('%s%s', ...
+                           instanceData(port_type_idx).Value, ...
+                           instanceData(pin_number_idx).Value);
+
         instanceData(end+1).Name = 'pin_name';
-        instanceData(end).Value = sprintf('%s%s', ...
-                                          instanceData(port_type_idx).Value, ...
-                                          instanceData(pin_number_idx).Value);
+        instanceData(end).Value = pin_name;
+
+        if (~ismember('pin', ParameterNames))
+            instanceData(end+1).Name = 'pin';
+            instanceData(end).Value = pin_name;
+        end
 
         % Delete old parameters to avoid warnings
         instanceData(arrayfun(@(x) strcmp(x.Name, 'port_type'), instanceData)) = [];