Browse Source

neuron test

a.binder 5 years ago
parent
commit
732e7395be

+ 7 - 0
SE/schema/WPS_Functions/automation_driven/build.automation_driven.PRODUCT.submodule.xml

@@ -165,6 +165,13 @@
    <property  name="automation_driven.submodule.struct.write.xsl" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write.xsl"/>
    
    
+   
+   <property  name="automation_driven.submodule.struct.write_neuron.xsd" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.xsd"/>
+   <property  name="automation_driven.submodule.struct.write_neuron.h" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.h"/>
+   
+   
+   
+   
    <property name="automation_driven.submodule.xsd__struct_files_fix_default.xml" location="${automation_driven.submodule.basedir}/automation_driven.submodule.xsd__struct_files_fix_default.xml"/>
    <property  name="automation_driven.submodule.xsd__struct_files_fix_default.xsl" location="${automation_driven.submodule.basedir}/automation_driven.submodule.xsd__struct_files_fix_default.xsl"/>
   

+ 61 - 5
SE/schema/WPS_Functions/automation_driven/build_automation_driven.xml

@@ -27,6 +27,56 @@
    
    <extension-point name="default.default" depends="default"/>
    <extension-point name="default" depends="PRODUCT.PRODUCT,INSTALL.INSTALL"/>
+   
+   
+   <target name="automation_driven.submodule.xsd__struct_write_neuron"
+      description="to initially generate h " >
+      <echo>#42 generating from ${automation_driven.submodule.struct.write.xsd} </echo>
+      <xslt basedir="${automation_driven.submodule.basedir}"
+         destdir="${automation_driven.submodule.temp}"
+         force="true"
+         in="${automation_driven.submodule.struct.write_neuron.xsd}"
+         out="${automation_driven.submodule.struct.write_neuron.h}"
+         style="${automation_driven.submodule.struct.write.xsl}"> <!-- ${automation_driven.submodule.struct.h} -->
+         <factory name="net.sf.saxon.TransformerFactoryImpl">
+            <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+            <!--<attribute name="http://saxon.sf.net/feature/initialTemplate"
+               value="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.submodule.struct.xsd}read.xml"/>-->
+            <attribute name="http://saxon.sf.net/feature/initialMode"
+               value="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.submodule.struct.xsd}write.h"/>
+            <attribute name="http://saxon.sf.net/feature/dtd-validation-recoverable"
+               value="true"/>
+         </factory>
+         <param name="build_complexType_dir" expression="${build_complexType.local}"/>
+         <param name="detect_resource_type.local" expression="${detect_resource_type.local}"/>
+         <param name="detect_objects_parent_relations.xml" expression="${detect_objects_parent_relations.xml}"/>
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.xsd}basedir"
+            expression="${automation_driven.basedir}"/>
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.xsd}repository"
+            expression="${automation_driven.repository}"/>
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.xsd}temp"
+            expression="${automation_driven.temp}"/>
+         
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.submodule.xsd}basedir"
+            expression="${automation_driven.submodule.basedir}"/>
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.submodule.xsd}repository"
+            expression="${automation_driven.submodule.repository}"/>
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.submodule.xsd}temp"
+            expression="${automation_driven.submodule.temp}"/>
+         
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.submodule.struct.xsd}h"
+            expression="${automation_driven.submodule.struct.h}"/>
+         
+         <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.submodule.namespaces.xsd}xsd"
+            expression="${automation_driven.submodule.namespaces.xsd}"/>
+         
+         <classpath location="/opt/local/share/java/saxon9he.jar"/>
+         <xmlcatalog refid="dita-ot.dtd.catalog"/>
+      </xslt>
+   </target>
+   
+   
+   
    <target name="xsl-test"
            description="test usage of default xslt template for module">
       <xslt basedir="${automation_driven.basedir}"
@@ -420,7 +470,7 @@
    </target>
    
    
-   <target name="NamespaceBinding.xml" description="To generate config for NamespaceBinding.xml for use in SimpleSchema for related features etc - correctly use namespace prefix and url for API requests">
+   <target name="NamespaceBinding.xml" depends="procesy5_system_schema.xml_complete" description="To generate config for NamespaceBinding.xml for use in SimpleSchema for related features etc - correctly use namespace prefix and url for API requests">
       <parallel threadcount="2">
          <sequential>
             <!--<exec executable="say"   failifexecutionfails="false">
@@ -462,7 +512,7 @@
       </parallel>
    </target>
    
-   <target name="element_complexType.xml.single"   description="SINGLE generate list of elements and Complextype to generate flat and tr_map">
+   <target name="element_complexType.xml.single" depends="procesy5_system_schema.xml_complete"   description="SINGLE generate list of elements and Complextype to generate flat and tr_map">
       <parallel threadcount="2">
          <sequential>
             <!--<exec executable="say"   failifexecutionfails="false">
@@ -582,7 +632,7 @@
       </parallel>
    </target>
    
-   <target name="build_tr_map.xml.single" depends="element_complexType.xml.single" description="we generate all tr_map for all known elements and complexType in schema in parallel">
+   <target name="build_tr_map.xml.single" depends="build_element_complexType.xml.single.task" description="we generate all tr_map for all known elements and complexType in schema in parallel">
       <parallel threadcount="2">
          <sequential>
             <!--<sleep seconds="2"/>-->
@@ -768,8 +818,12 @@
    </target>
    
    
-   <target name="build_detect_objects_parent_relations.single" depends="NamespaceBinding.xml, build_detect_resource_type.xml.single.task"   description="we generate detect resources parent relations -to dir detect_resource_type "> <!-- R save_build_properties,read_build_properties, -->
-      
+   <target name="build_detect_objects_parent_relations.single" 
+      depends="NamespaceBinding.xml, build_detect_resource_type.xml.single.task"
+      description="we generate detect resources parent relations -to dir detect_resource_type "> <!-- R save_build_properties,read_build_properties, -->
+      <!-- 
+         depends="NamespaceBinding.xml, build_detect_resource_type.xml.single.task"
+      -->
       <parallel threadcount="2">
          <sequential>
             <!--<exec executable="say"  failifexecutionfails="false">
@@ -888,6 +942,8 @@
                value="true"/>
          </factory>
          <param name="build_complexType_dir" expression="${build_complexType.local}"/>
+         <param name="detect_resource_type.local" expression="${detect_resource_type.local}"/>
+         <param name="detect_objects_parent_relations.xml" expression="${detect_objects_parent_relations.xml}"/>
          <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.xsd}basedir"
             expression="${automation_driven.basedir}"/>
          <param name="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/automation_driven/automation_driven.xsd}repository"

+ 28 - 3
SE/schema/default_db_xml_cache.public/build_ant_universal_by_xsl_match.xsl

@@ -301,10 +301,10 @@
     </xsl:template>
     
     
-    <xsl:template mode="build_tr_map.xml" match="build_cache[@name='build_complexType__simpleType']">
+    <!--<xsl:template mode="build_tr_map.xml" match="build_cache[@name='build_complexType__simpleType']">
         <xsl:comment>#270 bypassed @name="<xsl:value-of select="@name"/>"</xsl:comment>
         <xsl:message>#270 bypassed @name="<xsl:value-of select="@name"/>"</xsl:message>
-    </xsl:template>
+    </xsl:template>-->
     
     <xsl:template mode="build_tr_map.xml" match="build_cache">
         <xsl:param name="count"/>
@@ -347,7 +347,17 @@
                                 </factory>
                                 <param name="parent_type" expression="{with-param/@select}"/>
                             </xsl:when>
-                            <xsl:when test="@name='build_complexType_group'">
+                            <xsl:when test="@name='build_complexType__simpleType'">
+                                <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                                    <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                                    <attribute name="http://saxon.sf.net/feature/initialMode">
+                                        <xsl:attribute name="value" select="'{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_translate_map.xsd}go_recurse_from_root_by_build_element.root'"/>
+                                    </attribute>
+                                </factory>
+                                <param name="parent_type" expression="{with-param/@select}"/>
+                            </xsl:when>
+                            
+                            <xsl:when test="@name='build_complexType__group'">
                                 <factory name="net.sf.saxon.TransformerFactoryImpl">    
                                     <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
                                     <attribute name="http://saxon.sf.net/feature/initialMode">
@@ -708,6 +718,21 @@
                 <xsl:message> #238-B saving to <xsl:value-of select="concat(@system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename/text(),'.complete')"/> suppressed generating <xsl:value-of select="with-param/@name"/> because of  unparsed-text-available(<xsl:value-of select="@system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename"/>)</xsl:message>
                 <xsl:result-document href="{concat(@system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename,'.complete')}"><complete/></xsl:result-document>
             </xsl:when>
+            <xsl:when test="@system_cache__appinfo:document-uri-full = 'http://www.w3.org/1999/XSL/Transform'">
+                <echo> #238-C suppressed generating <xsl:value-of select="with-param/@name"/> because of  xs: prefix</echo>
+                <xsl:message> #238-C suppressed type of  xs: prefix  </xsl:message>
+                <xsl:result-document href="{concat(@system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename,'.complete')}"><complete/></xsl:result-document>
+            </xsl:when>
+            <xsl:when test="@system_cache__appinfo:document-uri-full = 'http://biuro.biall-net.pl/p5/schema/types'">
+                <echo> #238-D suppressed generating <xsl:value-of select="with-param/@name"/> because of  http://biuro.biall-net.pl/p5/schema/types</echo>
+                <xsl:message> #238-D suppressed type of  http://biuro.biall-net.pl/p5/schema/types </xsl:message>
+                <xsl:result-document href="{concat(@system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename,'.complete')}"><complete/></xsl:result-document>
+            </xsl:when>
+            <xsl:when test="contains(@system_cache__appinfo:document-uri-full,'http://') or contains(@system_cache__appinfo:document-uri-full,'https://')">
+                <echo> #238-E suppressed generating <xsl:value-of select="with-param/@name"/> because of  http://</echo>
+                <xsl:message> #238-E suppressed type of http:// </xsl:message>
+                <xsl:result-document href="{concat(@system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename,'.complete')}"><complete/></xsl:result-document>
+            </xsl:when>
             <xsl:otherwise><xsl:comment>#240 not exists <xsl:value-of select="@system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename"/></xsl:comment>
                 <sequential>
                     <!--<tempfile property="{with-param/@select}{with-param/@name}" deleteonexit="yes"><xsl:attribute name="destdir" select="'${detect_resource_type.local}'"/></tempfile>-->

+ 4 - 4
SE/schema/default_db_xml_cache.public/get_all_xsd.xsl

@@ -1104,10 +1104,10 @@
                                     <xsl:message terminate="yes">#952 ERROR WITH @targetNamespace="<xsl:value-of select="parent::*/@targetNamespace "/>"; @system_cache__appinfo:document-uri-full="<xsl:value-of select="../.././@system_cache__appinfo:document-uri-full"/>" </xsl:message>
                                 </xsl:when>
                             </xsl:choose>
-                            <with-param name="element" select="{parent::*/namespace::*[ . = ../@targetNamespace and not(name()='')]/name()}:{$complexType_or_element_name186}"/>
+                            <with-param name="simpleType" select="{parent::*/namespace::*[ . = ../@targetNamespace and not(name()='')]/name()}:{$complexType_or_element_name186}"/>
                             <system_cache__appinfo:element-filename><xsl:value-of select="system_cache__appinfo:element-filename('build_complexType__simpleType',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename>
                             <system_cache__appinfo:element-filename-prefixed><xsl:value-of select="system_cache__appinfo:element-filename-prefixed('build_complexType__simpleType',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename-prefixed>
-                            <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_element_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
+                            <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_simpleType_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
                             <p5_tr_map:element-filename-prefixed><xsl:value-of select="p5_tr_map:element-filename-prefixed(concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename-prefixed>
                             <system_cache__appinfo:targetNamespace><xsl:value-of select="../@targetNamespace"/></system_cache__appinfo:targetNamespace>
                             <system_cache__appinfo:name><xsl:value-of select="@name"/></system_cache__appinfo:name>
@@ -1139,10 +1139,10 @@
                                     <xsl:message terminate="yes">#952 ERROR WITH @targetNamespace="<xsl:value-of select="parent::*/@targetNamespace "/>"; @system_cache__appinfo:document-uri-full="<xsl:value-of select="../.././@system_cache__appinfo:document-uri-full"/>" </xsl:message>
                                 </xsl:when>
                             </xsl:choose>
-                            <with-param name="element" select="{parent::*/namespace::*[ . = ../@targetNamespace and not(name()='')]/name()}:{$complexType_or_element_name186}"/>
+                            <with-param name="group" select="{parent::*/namespace::*[ . = ../@targetNamespace and not(name()='')]/name()}:{$complexType_or_element_name186}"/>
                             <system_cache__appinfo:element-filename><xsl:value-of select="system_cache__appinfo:element-filename('build_complexType__group',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename>
                             <system_cache__appinfo:element-filename-prefixed><xsl:value-of select="system_cache__appinfo:element-filename-prefixed('build_complexType__group',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename-prefixed>
-                            <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_element_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
+                            <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_group_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
                             <p5_tr_map:element-filename-prefixed><xsl:value-of select="p5_tr_map:element-filename-prefixed(concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename-prefixed>
                             <system_cache__appinfo:targetNamespace><xsl:value-of select="../@targetNamespace"/></system_cache__appinfo:targetNamespace>
                             <system_cache__appinfo:name><xsl:value-of select="@name"/></system_cache__appinfo:name>

+ 18 - 0
SE/schema/default_db_xml_cache.public/p5_tr_map/element-filename.xsl

@@ -34,15 +34,27 @@
             <xsl:when test="$objectType='go_recurse_from_root_by_build_element_cache'">
                 <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/element-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
             </xsl:when>
+            <xsl:when test="$objectType='go_recurse_from_root_by_build_simpleType_cache'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/simpleType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
+            <xsl:when test="$objectType='go_recurse_from_root_by_build_group_cache'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/group-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
             <xsl:when test="$objectType='element'">
                 <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/element-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
             </xsl:when>
+            <xsl:when test="$objectType='group'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/group-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
             <xsl:when test="$objectType='go_recurse_from_root_by_build_complexType_cache'">
                 <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/complexType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
             </xsl:when>
             <xsl:when test="$objectType='complexType'">
                 <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/complexType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
             </xsl:when>
+            <xsl:when test="$objectType='simpleType'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/simpleType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
             <xsl:otherwise><xsl:message terminate="yes">#833 unknown type $objectType=<xsl:value-of select="$objectType"/></xsl:message></xsl:otherwise>
         </xsl:choose>
     </xsl:function>
@@ -60,6 +72,12 @@
             <xsl:when test="$objectType='go_recurse_from_root_by_build_complexType_cache'">
                 <xsl:value-of select="concat($default_db.instance.xml.symlink,'/p5_tr_map/complexType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
             </xsl:when>
+            <xsl:when test="$objectType='go_recurse_from_root_by_build_group_cache'">
+                <xsl:value-of select="concat($default_db.instance.xml.symlink,'/p5_tr_map/group-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
+            <xsl:when test="$objectType='go_recurse_from_root_by_build_simpleType_cache'">
+                <xsl:value-of select="concat($default_db.instance.xml.symlink,'/p5_tr_map/simpleType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
             <xsl:otherwise><xsl:message terminate="yes">#833 unknown type $objectType=<xsl:value-of select="$objectType"/></xsl:message></xsl:otherwise>
         </xsl:choose>
     </xsl:function>

+ 47 - 14
SE/schema/default_db_xml_cache/build_complexType.xsl

@@ -309,7 +309,7 @@
                         <xsl:when test="$namespace_uri_param and count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd_default_db)/schema[@targetNamespace = $namespace_uri_param]/element[@name = $element])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                             <xsl:message terminate="yes">90: ERROR not found or too many elements with name:<xsl:value-of select="$element"/>; on @tNS:<xsl:value-of select="$namespace_uri_param"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $namespace_uri_param]/element[@name = $element])"/></xsl:message>
                         </xsl:when>
-                        <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd_default_db)/schema[@targetNamespace=$namespace_uri_param]/namespace::node()[.=$namespace_uri_param]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                        <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd_default_db)/schema[@targetNamespace=$namespace_uri_param]/namespace::node()[.=$namespace_uri_param]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
                     </xsl:choose>
                 </xsl:variable>
                 <xsl:message>98:build_element $prefix:<xsl:value-of select="$prefix"/></xsl:message>
@@ -414,7 +414,7 @@
                         <xsl:when test="$namespace_uri_param and count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd_default_db)/schema[@targetNamespace = $namespace_uri_param]/group[@name = $element])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                             <xsl:message terminate="yes">90: ERROR not found or too many elements with name:<xsl:value-of select="$element"/>; on @tNS:<xsl:value-of select="$namespace_uri_param"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $namespace_uri_param]/group[@name = $element])"/></xsl:message>
                         </xsl:when>
-                        <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd_default_db)/schema[@targetNamespace=$namespace_uri_param]/namespace::node()[.=$namespace_uri_param]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                        <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd_default_db)/schema[@targetNamespace=$namespace_uri_param]/namespace::node()[.=$namespace_uri_param]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
                     </xsl:choose>
                 </xsl:variable>
                 <xsl:message>98b:build_element group $prefix:<xsl:value-of select="$prefix"/></xsl:message>
@@ -536,7 +536,7 @@
                         <xsl:when test="$namespace_uri_param and count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $namespace_uri_param]/complexType[@name = $complexType])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                             <xsl:message terminate="yes">90: ERROR not found or too many elements with name:<xsl:value-of select="$complexType"/>; on @tNS:<xsl:value-of select="$namespace_uri_param"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $namespace_uri_param]/complexType[@name = $complexType])"/></xsl:message>
                         </xsl:when>
-                        <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$namespace_uri_param]/namespace::node()[.=$namespace_uri_param]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                        <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)[1]/schema[@targetNamespace=$namespace_uri_param]/namespace::node()[.=$namespace_uri_param]/name())" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
                     </xsl:choose>
                 </xsl:variable>
                 <xsl:message>98:build_element $prefix:<xsl:value-of select="$prefix"/></xsl:message>
@@ -2466,7 +2466,7 @@
                         </xsl:when>
                         <xsl:when test="$targetNamespace='http://www.w3.org/2001/XMLSchema'"><xsl:value-of select="'xs'"/></xsl:when>
                         <!-- @2017-11-2 blad na CRM_PROCESS ERROR fixing ! <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>-->
-                        <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri and simpleType[@name=$name] ]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                        <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri and simpleType[@name=$name] ]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
                     </xsl:choose>
                 </xsl:variable>
                 <xsl:message>#2101B TODO save to ($prefix="<xsl:value-of select="$prefix"/>") <xsl:value-of select="system_cache__appinfo:element-filename.symlink('build_complexType__simpleType',@name,$prefix,$type_uri)"/>; ($name="<xsl:value-of select="$name"/>"); ($path="<xsl:value-of select="$path"/>");</xsl:message>
@@ -3285,7 +3285,7 @@
                 </xsl:when>
                 <xsl:when test="$type_uri='http://www.w3.org/2001/XMLSchema'"><xsl:value-of select="'xs'"/></xsl:when>
                 <!-- @2017-11-2 blad na CRM_PROCESS ERROR fixing ! <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>-->
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri][position() = 1]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:variable name="recurse">
@@ -3498,7 +3498,7 @@
                 <xsl:when test="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                     <xsl:message terminate="yes">251:b ERROR not found or too many elements with name:<xsl:value-of select="$type"/>; par.tNS:<xsl:value-of select="$targetNamespace"/>; on type_uri:<xsl:value-of select="$type_uri"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])"/></xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="$debug_level>3"><xsl:message>951c: $type:<xsl:value-of select="$type"/>; $prefix:<xsl:value-of select="$prefix"/> $type_uri:<xsl:value-of select="$type_uri"/>;</xsl:message>
@@ -3561,7 +3561,7 @@
                 <xsl:when test="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                     <xsl:message terminate="yes">331: ERROR not found or too many elements with name:<xsl:value-of select="$type"/>; on @tNS:<xsl:value-of select="$type_uri"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])"/></xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="$debug_level>3"><xsl:message terminate="no">214c: $type_uri:<xsl:value-of select="$type_uri"/>; $ref_id:<xsl:value-of select="$ref_id"/>; ../@id:<xsl:value-of select="../@id"/>;</xsl:message></xsl:if>
@@ -3620,7 +3620,7 @@
                 <xsl:when test="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                     <xsl:message terminate="yes">1746c: ERROR not found or too many elements with name:<xsl:value-of select="$type"/>; on @tNS:<xsl:value-of select="$type_uri"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])"/></xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="$debug_level&gt;3"><xsl:message terminate="no">214c: $type_uri:<xsl:value-of select="$type_uri"/>; $ref_id:<xsl:value-of select="$ref_id"/>; ../@id:<xsl:value-of select="../@id"/>;</xsl:message></xsl:if>
@@ -3689,7 +3689,7 @@
                         <xsl:attribute name="count" select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/element[@name = system_cache__appinfo:clean_object_prefix($type)])"/>
                     </system_cache__appinfo:build_complexType.error>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri and element[@name = system_cache__appinfo:clean_object_prefix($type)] ]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri and element[@name = system_cache__appinfo:clean_object_prefix($type)] ]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="string-length($prefix) &lt; 1"><xsl:message terminate="yes">#2616 error empty prefix for @id=<xsl:value-of select=".././@id"/>  </xsl:message></xsl:if>
@@ -3750,7 +3750,7 @@
                 <xsl:when test="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/group[@name = system_cache__appinfo:clean_object_prefix($type)])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                     <xsl:message terminate="yes">251:d ERROR not found or too many elements with name:<xsl:value-of select="$type"/>; par.tNS:<xsl:value-of select="$targetNamespace"/>; on type_uri:<xsl:value-of select="$type_uri"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/element[@name = system_cache__appinfo:clean_object_prefix($type)])"/></xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name())" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="substring-before($prefix,' ')">
@@ -3807,7 +3807,7 @@
                 <xsl:when test="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/simpleType[@name = system_cache__appinfo:clean_object_prefix($type)])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                     <xsl:message terminate="yes">1701: ERROR not found or too many elements with name:<xsl:value-of select="$type"/>; par.tNS:<xsl:value-of select="$targetNamespace"/>; on type_uri:"<xsl:value-of select="$type_uri"/>"; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/attribute[@name = system_cache__appinfo:clean_object_prefix($type)])"/>; (@id="<xsl:value-of select="../@id"/>")</xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="$debug_level>3"><xsl:message>1689b: @ref:<xsl:value-of select="$type"/>; $ref_id:<xsl:value-of select="$ref_id"/>; $type_uri:<xsl:value-of select="$type_uri"/>; $prefix:<xsl:value-of select="$prefix"/>;</xsl:message>
@@ -3864,7 +3864,7 @@
                         <!--@2018-05-03 this is possible bug when used ref to attribute group. detected at p5suis:group.name1 at p5dkp.comment.xsd-->
                     </xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$type_uri]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="$debug_level>3"><xsl:message>1457b: @ref:<xsl:value-of select="$type"/>; $ref_id:<xsl:value-of select="$ref_id"/>; $type_uri:<xsl:value-of select="$type_uri"/>; $prefix:<xsl:value-of select="$prefix"/>;</xsl:message>
@@ -3918,7 +3918,7 @@
                 <xsl:when test="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd.default_db_xml_cache.public)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                     <xsl:message terminate="yes">940a: ERROR not found or too many elements with name:<xsl:value-of select="$type"/>; on @tNS:<xsl:value-of select="$type_uri"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/(complexType|simpleType)[@name = system_cache__appinfo:clean_object_prefix($type)])"/></xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd.default_db_xml_cache.public)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd.default_db_xml_cache.public)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         <xsl:if test="$debug_level&gt;3">
@@ -3985,7 +3985,7 @@
                 <xsl:when test="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/attribute[@name = system_cache__appinfo:clean_object_prefix($type)])!=1" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                     <xsl:message terminate="yes">1668a: ERROR not found or too many elements with name:<xsl:value-of select="$type"/>; on @tNS:<xsl:value-of select="$type_uri"/>; count:<xsl:value-of select="count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/attribute[@name = system_cache__appinfo:clean_object_prefix($type)])"/></xsl:message>
                 </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
+                <xsl:otherwise><xsl:value-of select="($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace=$targetNamespace]/namespace::node()[.=$type_uri]/name())[1]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         
@@ -4105,6 +4105,18 @@
                 <xsl:variable name="type" select="@name" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
                 <xsl:apply-templates mode="system_cache__appinfo:only_local_elements_list.complexType.child"   xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
             </xsl:when>
+            <!-- testing 2021 -->
+            <xsl:when test="local-name()='simpleType'">
+                <xsl:variable name="type_uri" select="@system_cache__appinfo:namespace_uri" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                <xsl:variable name="type" select="@name" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                <xsl:apply-templates mode="system_cache__appinfo:only_local_elements_list.complexType.child"   xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+            </xsl:when>
+            <xsl:when test="local-name()='group'">
+                <xsl:variable name="type_uri" select="@system_cache__appinfo:namespace_uri" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                <xsl:variable name="type" select="@name" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                <xsl:apply-templates mode="system_cache__appinfo:only_local_elements_list.complexType.child"   xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+            </xsl:when>
+            
             <xsl:otherwise><xsl:message terminate="yes">#3381 context should be only element or complexType but is nam()=<xsl:value-of select="name()"/>, @id=<xsl:value-of select="@id"/></xsl:message></xsl:otherwise>
         </xsl:choose>
         <!--<system_cache__appinfo:only_local_elements_list.complexType>
@@ -4139,6 +4151,27 @@
         <xsl:apply-templates mode="system_cache__appinfo:only_local_elements_list.complexType.child" select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/complexType[@name = system_cache__appinfo:clean_object_prefix($type)]"  xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
     </xsl:template>
     
+    <!--
+    
+    
+    <xsl:template match="simpleType[@name]" mode="system_cache__appinfo:only_local_elements_list.complexType.build_oject_install_se_ant_object" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:param name="namespace_uri_param" required="yes"/>
+        <xsl:variable name="type_uri" select="@system_cache__appinfo:namespace_uri"/>
+        <xsl:variable name="type" select="@system_cache__appinfo:extension_base"/>
+        <xsl:message>#3441-G testing 2021 $namespace_uri_param=<xsl:value-of select="$namespace_uri_param"/>; @id=<xsl:value-of select="@id"/> @name=<xsl:value-of select="@name"/>; @type=<xsl:value-of select="@type"/>  detecting system_cache__appinfo:only_local_elements_list.complexType for $type_uri=<xsl:value-of select="$type_uri"/>; $type=<xsl:value-of select="$type"/>;   </xsl:message>
+        <xsl:if test="not(count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/simpleType[@name = system_cache__appinfo:clean_object_prefix($type)]) = 1)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><xsl:message terminate="yes">#3414S not foud expected $type=<xsl:value-of select="$type"/>; simpleType in $type_uri=<xsl:value-of select="$type_uri"/>;</xsl:message></xsl:if>
+        <xsl:apply-templates mode="system_cache__appinfo:only_local_elements_list.complexType.child" select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/simpleType[@name = system_cache__appinfo:clean_object_prefix($type)]"  xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+    </xsl:template>
+    <xsl:template match="group[@name]" mode="system_cache__appinfo:only_local_elements_list.complexType.build_oject_install_se_ant_object" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:param name="namespace_uri_param" required="yes"/>
+        <xsl:variable name="type_uri" select="@system_cache__appinfo:namespace_uri"/>
+        <xsl:variable name="type" select="@system_cache__appinfo:extension_base"/>
+        <xsl:message>#3441-G testing 2021 $namespace_uri_param=<xsl:value-of select="$namespace_uri_param"/>; @id=<xsl:value-of select="@id"/> @name=<xsl:value-of select="@name"/>; @type=<xsl:value-of select="@type"/>  detecting system_cache__appinfo:only_local_elements_list.complexType for $type_uri=<xsl:value-of select="$type_uri"/>; $type=<xsl:value-of select="$type"/>;   </xsl:message>
+        <xsl:if test="not(count($procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/group[@name = system_cache__appinfo:clean_object_prefix($type)]) = 1)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><xsl:message terminate="yes">#3414S not foud expected $type=<xsl:value-of select="$type"/>; group in $type_uri=<xsl:value-of select="$type_uri"/>;</xsl:message></xsl:if>
+        <xsl:apply-templates mode="system_cache__appinfo:only_local_elements_list.complexType.child" select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema[@targetNamespace = $type_uri]/group[@name = system_cache__appinfo:clean_object_prefix($type)]"  xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+    </xsl:template>-->
+    
+    
     <xsl:template match="complexType[@name]" mode="system_cache__appinfo:only_local_elements_list.complexType.build_oject_install_se_ant_object" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
         <xsl:param name="namespace_uri_param" required="yes"/>
                 <xsl:variable name="type_uri" select="@system_cache__appinfo:namespace_uri"/>

+ 4 - 1
SE/schema/default_db_xml_cache/p5_tr_map.xsl

@@ -501,6 +501,8 @@
                     <xsl:attribute name="p5_tr_map:uuid" select="$p5_tr_map:uuid"/>
                     <xsl:attribute name="comment" select="'436 @2016-01-05 TODO powstanie blad w przetwarzaniu - elementy z grup powinny byc traktowane jako referencje i instancje lub jakos inaczej odpuszczamy simpleContent,attributeGroup,group i nizej bedziemy uzywac atrybutow jak zwyklych simpleType do PARENT'"/>
                     <xsl:attribute name="event_type" select="436"/>
+                    <xsl:attribute name="local-name" select="local-name()"/>
+                    <xsl:attribute name="local-name-name" select="@name"/>
                     <xsl:apply-templates mode="#current">
                     <!--<xsl:with-param name="parent_type" select="$parent_type"/>--> <!-- nie potrzeba dla takiego przypadku juz przekazywac typu instancji -->
                     <xsl:with-param name="ID" select="$ID"/>
@@ -2412,7 +2414,8 @@
                         <xsl:apply-templates mode="#current"/>
                     </xsl:when>
                     <xsl:when test="@event_type='494' or @event_type='4940'"> <!-- przed 2016-01-02 and not(child::node()/attribute::node()[local-name()='event_type']='494') -->
-                        <xsl:element name="system_cache__appinfo:detect_parent_complexType_with_ref_to_procesy5_table"><xsl:value-of select="concat(@system_cache__appinfo:prefix,':',@system_cache__appinfo:name)"/></xsl:element>
+                        <xsl:element name="system_cache__appinfo:detect_parent_complexType_with_ref_to_procesy5_table">
+                            <xsl:comment>#2417 @e<xsl:value-of select="@event_type"/>; </xsl:comment><xsl:value-of select="concat(@system_cache__appinfo:prefix,':',@system_cache__appinfo:name)"/></xsl:element>
                         <xsl:variable name="current" select="."/>
                         <xsl:for-each select="*[@event_type='473']">
                             <xsl:element name="system_cache__appinfo:trigger_on_insert">

+ 20 - 1
SE/schema/default_db_xml_cache/system_cache__resources_tree_generate_xsl_required_occurs_raport/detect_objects_parent_relations.xsl

@@ -207,7 +207,26 @@
                             </system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_objects_parent_relations>
                         </xsl:result-document>
                     </xsl:when>
-                    <xsl:otherwise><xsl:message terminate="yes">#661 error - should be only element or complexType </xsl:message></xsl:otherwise>
+                    <!-- testing 2021 -->
+                    <xsl:when test="@local-name='group'">
+                        <xsl:message>#791b saving <xsl:value-of select="concat($default_db.instance.xml.symlink,'/detect_resource_type/group-',system_cache__appinfo:escape_object_prefix_to_string(@name),'.xml')"/></xsl:message>
+                        <!--<xsl:if test="doc-available(concat('../default_db.instance.xml/detect_resource_type/complexType-',system_cache__appinfo:escape_object_prefix_to_string(@name),'.xml'))"><xsl:message>#794 doc  found - OK</xsl:message></xsl:if>-->
+                        <xsl:result-document href="{$default_db.instance.xml}/detect_resource_type/group-{system_cache__appinfo:escape_object_prefix_to_string(@name)}.xml">
+                            <system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_objects_parent_relations>
+                                <xsl:copy-of select="$system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type"/>
+                            </system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_objects_parent_relations>
+                        </xsl:result-document>
+                    </xsl:when>
+                    <xsl:when test="@local-name='simpleType'">
+                        <xsl:message>#791c saving <xsl:value-of select="concat($default_db.instance.xml.symlink,'/detect_resource_type/simpleType-',system_cache__appinfo:escape_object_prefix_to_string(@name),'.xml')"/></xsl:message>
+                        <!--<xsl:if test="doc-available(concat('../default_db.instance.xml/detect_resource_type/complexType-',system_cache__appinfo:escape_object_prefix_to_string(@name),'.xml'))"><xsl:message>#794 doc  found - OK</xsl:message></xsl:if>-->
+                        <xsl:result-document href="{$default_db.instance.xml}/detect_resource_type/simpleType-{system_cache__appinfo:escape_object_prefix_to_string(@name)}.xml">
+                            <system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_objects_parent_relations>
+                                <xsl:copy-of select="$system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type"/>
+                            </system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_objects_parent_relations>
+                        </xsl:result-document>
+                    </xsl:when>
+                    <xsl:otherwise><xsl:message terminate="yes">#661 error - should be only element or complexType: is @local-name:<xsl:value-of select="@local-name"/> </xsl:message></xsl:otherwise>
                 </xsl:choose>
                 <xsl:copy-of select="$system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type"/>
             </xsl:for-each>

+ 10 - 4
SE/schema/default_db_xml_cache/system_cache__resources_tree_generate_xsl_required_occurs_raport/detect_resource_type.xsl

@@ -95,7 +95,11 @@
         <!--<xsl:param name="targetNamespace" required="yes"/>-->      
              <!--<xsl:for-each select="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!-\-[ @targetNamespace != $targetNamespace ] namespace::node() = $targetNamespace   and @targetNamespace='moj_ogrodek' -\->-->
                  <xsl:message>239::detect_resource_type przetwarzam schemat:@targetNamespace:<xsl:value-of select="@targetNamespace"/>;</xsl:message>
-                 
+                 <xsl:comment>239::detect_resource_type przetwarzam schemat:@targetNamespace:<xsl:value-of select="@targetNamespace"/>;  
+                     $element:<xsl:value-of select="$element"/>; 
+                     $name:<xsl:value-of select="$name"/>;
+                     $complexType_or_element_name:<xsl:value-of select="$complexType_or_element_name"/>
+                 </xsl:comment>
                 <!-- <xsl:variable name="prefix_83" select="namespace::node()[. = $targetNamespace]/name()"/>
                  <xsl:variable name="targetNamespace_134" select="@targetNamespace"/>
                  <xsl:variable name="prefix_134" select="namespace::node()[. = $targetNamespace_134][1]/name()"/><!-\- np. test_objects -\->
@@ -162,21 +166,23 @@
 
     
     <!-- @2018-01-01 to be called by ant buld generated from get_all_xsd.xsl and translated by build_ant_universal_by_xsl_match.xsl -->
-    <xsl:template match="element[@name=$complexType_or_element_name and local-name()=$name]|complexType[@name=$complexType_or_element_name and local-name()=$name]" mode="system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template match="element[@name=$complexType_or_element_name and local-name()=$name]|complexType[@name=$complexType_or_element_name and local-name()=$name]|simpleType[@name=$complexType_or_element_name and local-name()=$name]|group[@name=$complexType_or_element_name and local-name()=$name]" mode="system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <!--<xsl:param name="targetNamespace" required="yes"/>-->
         <xsl:param name="system_cache__appinfo:document-uri" select="../.././@system_cache__appinfo:document-uri"/> <!-- required when partially made from ant parallel build -->
             <xsl:variable name="complexType_or_element_name186">
                 <xsl:choose>
                     <xsl:when test="local-name()='element'"><xsl:value-of select="@name"/></xsl:when>
                     <xsl:when test="local-name()='complexType'"><xsl:value-of select="@name"/></xsl:when>
-                    <xsl:otherwise><xsl:message terminate="yes">#391 it should work only for element or complexType</xsl:message></xsl:otherwise>
+                    <xsl:when test="local-name()='simpleType'"><xsl:value-of select="@name"/></xsl:when>
+                    <xsl:when test="local-name()='group'"><xsl:value-of select="@name"/></xsl:when>
+                    <xsl:otherwise><xsl:message terminate="yes">#391 it should work only for element or complexType: local-name=<xsl:value-of select="local-name()"/></xsl:message></xsl:otherwise>
                 </xsl:choose>
             </xsl:variable>
         <xsl:variable name="element-filename" select="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename($system_cache__appinfo:document-uri, .././@targetNamespace,local-name(),@name)"/> <!-- select="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename(../.././@system_cache__appinfo:document-uri-orig, .././@targetNamespace,local-name(),@name)" -->
         <xsl:comment>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="../@targetNamespace"/>; @name:<xsl:value-of select="@name"/>; prefix=<xsl:value-of select="system_cache__appinfo:prefix_from_targetNamespace($system_cache__appinfo:vrtfNamespaces,.././@targetNamespace)"/>;</xsl:comment>
         <xsl:message>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="../@targetNamespace"/>; @name:<xsl:value-of select="@name"/>; prefix=<xsl:value-of select="system_cache__appinfo:prefix_from_targetNamespace($system_cache__appinfo:vrtfNamespaces,.././@targetNamespace)"/>;;</xsl:message>
         <xsl:message>#109 saving to=<xsl:value-of select="$element-filename"/>; element system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type_list.cache</xsl:message>
-        
+        <xsl:comment>#109 saving to=<xsl:value-of select="$element-filename"/>; element system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type_list.cache</xsl:comment>
         
        <!-- <xsl:result-document href="{$element-filename}">-->
           <system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type_list.cache xsl:xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/resources_tree_generate_xsl_require_occurs_raport">

+ 2 - 1
SE/stuff/p5_automation_lite/p5_automation_lite.ino

@@ -375,7 +375,8 @@ void loop() {
     register long time;
     time = millis();
     
-    
+    Slave_Ports_Protocol_CAN_message_prototype_T__SERIAL_PROXY_DEVICE__send_ack() ;
+
      if( t_timestamp < millis() ) {
         t_timestamp = millis() + 4000 ;
           

+ 407 - 0
SE/stuff/p5_automation_lite_display/p5_automation_lite_display.ino

@@ -0,0 +1,407 @@
+/*
+ 2021-01 abinder - moving to libs, and cleanup
+
+*/
+#define DISPLAY_CURSOR_Y_CHARS_DEBUG_DEF 5 //todo proportional
+#define ARDUINO_ARRAY_INDEX_LIMIT_QUEUE_DEF 4
+
+#define ARDUINO_ARRAY_INDEX_LIMIT_I2C_ARRAY_DRIVER_DEF 0//1
+#define ARDUINO_ARRAY_INDEX_LIMIT_DISPLAY_DEF 0 // 3 //todo debug
+
+#define ARDUINO_ARRAY_INDEX_LIMIT_DISPLAY_MENU_DEF 2 //todo test
+
+#define ARDUINO_ARRAY_INDEX_LIMIT_DISPLAY_MENU_ITEM_A_DEF  10 //todo debug 
+#define ARDUINO_ARRAY_INDEX_LIMIT_PORTS_DEF 0//4//3 //todo debug lite
+#define ARDUINO_ARRAY_INDEX_LIMIT_PORTS_I2C_DEF 0//2 //todo debug lite
+//#define HAS_DEBUG_ACTION_TRIG
+//#define DEBUG_I2C //to debug _Slave_Ports_I2C_POP etc
+//#define HAS_TFT_ILI9163C 
+//#define HAS_TFT_ILI9163C__ROTATED
+//#define HAS_LCD1602 
+//#define HAS_LCD1602_I2C
+
+
+
+//#define LCD1602_DISPLAY_PHYSICAL_X_CHARS_A 
+//#define LCD1602_DISPLAY_PHYSICAL_Y_CHARS_A
+//#define HAS_ROTTARY_SW
+#define ROTTARY_ENCODER_ACTION_MILLIS_MIN 250
+//#define HAS_CAN
+
+
+
+//#define DEBUG_I2C_driver_Adafruit_PWMServoDriver
+//#define DEBUG_CAN
+//#define DEBUG_QUEUE
+//#define DEBUG_QUEUE_ASSERT
+//#define DEBUG_QUEUE_WAIT 500
+//#define DEBUG_STRUCT_INIT
+//#define DEBUG_STORAGE_QUEUE_TEST 
+//#define DEBUG_ARDUINO_ATTR_ARRAY_S__commit_added_element_QUEUE
+//#define DEBUG_ARDUINO_ARRAY_INDEX_NEXT_LOCK
+//#define HAS__PCINT_setup //to allow interrupts
+//#define DEBUG_TASK_TYPE_T_Slave_Ports_broadcast____
+//#define DEBUG_TASK_TYPE_T_DISPLAY_queue_pop________
+//#define DEBUG_TASK_TYPE_T_Slave_Ports_set_I2C______
+//#define DEBUG_QUEUE_ASSERT todo not working
+//#define DEBUG_LAST_ACTION_TRIG_ENABLE
+#define DISABLE_DISPLAY__add_record 
+#define DISPLAY_array16_T_is_DISPLAY_string_T 
+#define ENABLE_DISPLAY_MENU
+#define USE_DISPLAY_string_T
+//#define USE_DISPLAY_char_PA //dev testing pointer to display
+//#define DISABLE_ANY_PRINT //when uno ?
+//#define DEBUG 3
+//#define DISABLE_LOOP
+#define DISABLE_QUEUE_REASSIGN
+//#define DEBUG_LATENCY_MARKER
+
+//ports assign config
+#define PortA0 A0  //for rottary pro mini SW
+#define PortA1 A1  //for rottary pro mini SW DT
+#define PortA2 A2  //for rottary pro mini SW CLK
+#define PortA3 A3  
+
+
+#define PortA7 A7  //
+#define PortA8 A8  //for rottary sw
+#define PortA9 A9  //for rottary sw dt
+#define PortA10 A10  //for rottary sw clk
+#define Port7 7 //for TFT_ILI9163C_CSpin 7 
+#define Port8 8 //for TFT_ILI9163C_DCpin 8  
+#define Port9 9 //for TFT_ILI9163C__RSTpin 9
+#define Port10 10 // CAN_INTpin 10
+#define Port11 11 // todo PIR LOCAL
+#define Port12 12 // todo change CAN to 12  from 53
+#define Port53 53 // #define CAN_CSpin 53  //todo change can be 12?
+
+
+#include "Wire.h"
+
+
+
+#include "progmem.h"
+
+
+#include "___CONFIG/config_Active_ControllerID.h" //there kleep id of device
+    //config active should once update id
+//EEPROM_Active_ControllerID_read_T EEPROM_Active_ControllerID_read_A = EEPROM_Active_ControllerID_read();
+
+
+
+//#define DEBUG 5 
+//#define DISABLE_LOOP //To debug and disable any output
+
+
+#include "__main_struct.h" //lite #include "___main/__main_struct.h"
+#include "__main_trigger_struct.h" //lite #include "___main/__main_trigger_struct.h"
+#include "__main_struct_funct.h" //lite #include "___main/__main_struct_funct.h"
+
+
+
+#include "__main_struct_limits.h"  /lite ___main/
+#include "_time_struct.h"
+
+//lite wyglada na niepotrzebne
+#include "_DRIVER_STATUS_struct.h" //lite
+
+ #include "__main_I2C_struc.h" //lite ___main/
+
+#include "__main_static.h" //lite ___main/
+#include "__main_auto.h" //lite ___main/
+#include "__main_register.h" //lite ___main/
+#include "__main_extern.h" //lite ___main/
+
+#include "config_Slave_Ports_LOCAL_config.h" //lite
+
+
+
+#include "_DISPLAY_struct__lite.h" //lite
+#include "_Port_ID_sruct.h"
+
+#include "_TASK_TYPES_struct.h"
+#include "_Slave_Ports_Status_QUEUE_struct.h"
+
+    
+#if defined(HAS_ROTTARY_SW)
+  #include "_ROTTARY_SW_config.h" //lite _ROTTARY_SW/
+#endif
+
+
+#if defined(HAS_ROTTARY_SW)
+  #include "_ROTTARY_SW_struct.h" //lite _ROTTARY_SW/
+#endif
+
+
+
+#if defined(HAS_TFT_ILI9163C)
+  //L#include "_TFT_ILI9163C_struct.h"
+#endif
+
+ #if defined(HAS_u8g2)
+  //L     #include "u8g2_struct.h" //too much ram
+   #endif
+  
+  
+ #if defined(HAS_u8x8)
+       #include "u8x8_struct.h"
+   #endif
+  
+
+
+#if defined(HAS__PCINT_setup)
+     #include "_PCINT/_PCINT_struct.h"  //pins MYPIN1 MYPIN2 MYPIN3
+#endif
+
+
+
+ //REMOTE PORTS DEFINITIONS
+ #include "_PortTypes_struct.h"
+ #include "_PortStates_struct.h"
+ #include "_Port_Exp_state_ttl_struct.h"
+ #include "_Port_Broadcast_state_struct.h"
+ #include "_Port_I2C_driver_struct.h"
+ //#include "_Slave_Ports_Status_struct_lite.h" // lite 
+ #include "_Slave_Ports_Status_struct.h"
+ #include "_Slave_Ports_Protocol_CAN_struct.h" //lite _CAN/
+ //#include "_Slave_Ports_Protocol_CAN_2020_struct.h" 
+   
+ 
+ #include "automation_driven.submodule.struct.write.h"
+ 
+ #if defined(HAS_TFT_ILI9163C)
+  #include "_TFT_ILI9163C_func.h"
+ #endif   
+
+#if defined(HAS_u8g2) //lite too much ram
+ //L  #include <math.h> 
+ //L  #include "u8g2.h"
+ //L U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0); 
+#endif 
+
+#if defined(HAS_u8x8)
+    #include "u8x8_func.h"
+    #include "u8x8_init.h"
+#endif
+
+ #include "_DISPLAY_DEV.h"
+ 
+
+    #include "_TASK_TYPES_func.h"
+    #include "_Slave_Ports_Status_QUEUE_add_func.h"
+    #include "_DISPLAY_add_record_func.h"
+    //#include "_DISPLAY_func.h"
+    #include "_DISPLAY_func_lite.h"
+
+
+
+#if defined(HAS_LCD1602)
+  //L#include "_LCD1602_init.h"
+#endif
+
+#if defined(HAS_LCD1602)
+  //L#include "_LCD1602_func.h"
+  //#include "_LCD1602_init.h"
+#endif
+
+
+
+void DISPLAY_MENU_SELECTOR( DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A, 
+        
+        Slave_Ports_Status_T* Slave_Ports_Status_A , 
+        Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_T &Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
+        
+        
+       // DISPLAY_MENU_ITEM_INDEX_T DISPLAY_MENU_ITEM_INDEX_A ,
+        time_seq_id_T time_seq_id_A ,
+        time_min_run_T time_min_run_A , 
+        //DISPLAY_MENU_SELECTOR_STATUS_T DISPLAY_MENU_SELECTOR_STATUS_A , //; //which mode
+        DISPLAY_MENU_SELECTOR_SWITCH_T DISPLAY_MENU_SELECTOR_SWITCH_A, 
+        DISPLAY_MENU_SELECTOR_oldEncPos_T DISPLAY_MENU_SELECTOR_oldEncPos_A , //; //values
+        DISPLAY_MENU_SELECTOR_encoderPos_T DISPLAY_MENU_SELECTOR_encoderPos_A,
+        
+        DISPLAY_MENU_SELECTOR_triggerCountOld_T DISPLAY_MENU_SELECTOR_triggerCountOld_A,
+        DISPLAY_MENU_SELECTOR_triggerCount_T DISPLAY_MENU_SELECTOR_triggerCount_A) {
+}
+
+
+
+#if defined(HAS_ROTTARY_SW)
+ #include "_ROTTARY_SW_func.h" //_ROTTARY_SW/
+#endif
+
+#include "_time_func.h"
+
+
+#include "DISPLAY_ELEMENT_TO_REFRESH.h"
+
+
+
+#include "Slave_Ports_Status__DISPLAY_TARGET.h"
+
+
+#include "TASK_TYPE_T_Set_Ports_Status_LIMITS_A__.h"
+#include "TASK_TYPE_T_Set_Ports_Status_ASSOC.h"
+ 
+
+//L #include "_CAN_func.h" //lite _CAN/
+
+
+//EOF SERIAL ##############//EOF SERIAL ##############//EOF SERIAL ##############
+#include "SERIAL__init.h"
+
+#if defined(HAS_SERIAL_PROXY_SoftwareSerial)
+    #include <SoftwareSerial.h>
+    //SoftwareSerial SERIAL_PROXY_DEVICE(SERIAL_PROXY_SoftwareSerial_rx_pin, SERIAL_PROXY_SoftwareSerial_tx_pin); // RX, TX
+    #include "SERIAL_PROXY__init.h"
+
+    #if defined(SERIAL_PROXY_DEVICE)
+        #errior when set HAS_SERIAL_PROXY_SoftwareSerial - cannot be set both hardware SERIAL_PROXY_DEVICE 
+    #endif
+#endif
+
+#if defined(HAS_SERIAL_PROXY)  
+    #include "SERIAL__struct.h"
+   // #include "SERIAL__func.h"
+#endif
+
+#if defined(HAS_SERIAL_PROXY_DISPLAY_SLAVE) 
+   #define  SoftwareSerial_SLAVE SoftwareSerial
+   #include "SERIAL_PROXY_DISPLAY_SLAVE__init.h"
+    #include "SERIAL_PROXY_DISPLAY_SLAVE__func.h"
+ #endif
+
+#if defined(HAS_SERIAL_PROXY_DISPLAY_MASTER) 
+    #define  SoftwareSerial_MASTER SoftwareSerial
+    #include "SERIAL_PROXY_DISPLAY_MASTER__init.h"
+    #include "SERIAL_PROXY_DISPLAY_MASTER__func.h"
+#endif
+
+#if defined(HAS_SERIAL_PROXY)
+  //  #define  SoftwareSerial_PROXY SoftwareSerial
+   // #include "SERIAL__struct.h"
+    #include "SERIAL_PROXY__func.h"
+
+    #include "SERIAL__func.h"
+#endif
+
+//EOF SERIAL ##############//EOF SERIAL ##############//EOF SERIAL ##############
+
+#if defined(HAS_TFT_ILI9163C)
+    #include "_TFT_ILI9163C_init.h"
+
+#endif
+
+
+
+#include "_DISPLAY_init.h"
+#if defined(HAS_SERIAL_PROXY)
+  #include "automation_driven.submodule.struct.read__communication_generated.h"
+#endif
+
+void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
+    Serial.begin(115200);
+     //Wire.begin();
+      //  scan_h();
+      SPFTFT(setup,init);
+            
+    #if defined(HAS_ROTTARY_SW)
+     #include "_ROTTARY_SW_setup.h"  //Attach interrupts //lite _ROTTARY_SW/
+    #endif
+
+        
+   #if defined(HAS_u8g2)
+       #include "u8g2__setup.h"
+   #endif
+   
+    #if defined(HAS_u8x8)
+         #include "u8x8__setup.h"
+          #if defined(HAS_SERIAL_PROXY_DISPLAY_SLAVE) 
+                   u8x8.setCursor(0,1); //DISPLAY_DEV_setCursor(0,1);
+                    u8x8.print(" connect rx to"); u8x8.print(SERIAL_PROXY_SoftwareSerial_rx_pin); //DISPLAY_DEV_print(" connect rx to"); u8x8.print(SERIAL_PROXY_SoftwareSerial_rx_pin);
+                   u8x8.setCursor(0,2); //DISPLAY_DEV_setCursor(0,2);
+                     u8x8.print(" connect tx to");u8x8.print(SERIAL_PROXY_SoftwareSerial_tx_pin);
+                     u8x8.setCursor(0,3);
+                     u8x8.print("  . ");
+                     u8x8.setCursor(0,4);
+                     
+          #endif
+   #endif
+   
+   
+#if defined(HAS_SERIAL_PROXY_SoftwareSerial) 
+     pinMode(SERIAL_PROXY_SoftwareSerial_rx_pin, INPUT);
+     pinMode(SERIAL_PROXY_SoftwareSerial_rx_pin, OUTPUT);
+     SERIAL_PROXY_DEVICE.begin(SERIAL_PROXY_SPEED);
+#endif
+
+#if defined(HAS_SERIAL_PROXY)
+    #include "SERIAL_PROXY__setup.h"
+#endif
+ 
+ 
+   
+}
+
+        
+
+unsigned long time = 0;
+#include "_LOOP_LATENCY_COUNTER.h" //lite ___loop/
+unsigned long t_timestamp = 0;
+
+
+
+void loop() {
+    register long time;
+    time = millis();
+  
+             
+       #if defined(HAS_ROTTARY_SW)
+          #include "_ROTTARY_SW_loop.h" //lite _ROTTARY_SW/
+       #endif
+   
+   
+    #ifdef DISABLE_LOOP 
+        #include "___DEBUG/___DEBUG_DISABLE_LOOP.h"
+    #endif
+   
+   
+     if( t_timestamp < millis() ) {
+        t_timestamp = millis() + 4000 ;
+         //u8x8.print("S"); //DISPLAY_DEV_print("S");
+         //Serial.print(F("D"));
+        
+    Slave_Ports_Protocol_CAN_message_prototype_T__SERIAL_PROXY_DEVICE__send_ack() ;
+        
+    Slave_Ports_Status__DISPLAY_TARGET(
+                           Slave_Ports_Status_A ,
+                           Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
+                            0 ,
+                         // DISPLAY_PHYSICAL_CHAR_A, 
+                         time,
+                          time + ARDUINO_time_seq_id_A_INCREMENT //ARDUINO_LOOP_LATENCY_DISPLAY_MENU
+                           //queue
+                          ,Slave_Ports_Status_QUEUE_A, Slave_Ports_Status_QUEUE_T_ARDUINO_ATTR_ARRAY_A ,
+                          TASK_TYPE_T__EMPTY__JUST_PASSED_ARG__,
+                          TASK_PORT_ASSOC_EMPTY
+                          //,DISPLAY_PHYSICAL_CHAR_A
+                       );
+         DISPLAY__print_menu(
+        //lite removed DISPLAY_A ,
+        //lite removed DISPLAY_T_ARDUINO_ATTR_ARRAY_A ,
+       //  DISPLAY_PHYSICAL_CHAR_A, 
+                  DISPLAY_MENU_INDEX_DEFAULT_A,  //DISPLAY_MENU_ITEM_INDEX_T DISPLAY_MENU_ITEM_INDEX_A
+                  time,time + ARDUINO_LOOP_LATENCY_DISPLAY_MENU//time_seq_id_A, (time_seq_id_A + 5000) 
+                  ,Slave_Ports_Status_A 
+                   );
+        
+       }
+      
+
+#if defined(HAS_SERIAL_PROXY)
+    #include "SERIAL_PROXY__loop.h"
+#endif
+
+       
+}
+

+ 60 - 0
SE/stuff/p5_neuron/Simulated_potential_show_lcd.h

@@ -0,0 +1,60 @@
+
+ unsigned long Simulated_potential_show_lcd_t = 0 ;
+
+
+
+
+
+void show_p0_neuron_title( ) {
+    for(int i=0; i<10;i++) {
+        if(NEURON_A[i].if_used == 1 ) {
+            lcd.setCursor(i,0);
+             lcd.print(NEURON_A[i].Label);
+            // lcd.print(i);
+            // Serial.print(NEURON_A[i].Label);
+        }
+    }
+    //if_show_p0_neuron_title = 1 ;
+    lcd.print(F(" ")); lcd.print(NEURON_A_INDEX_NEXT);
+}
+
+
+
+void Simulated_potential_show_lcd( ) {
+
+ if(Simulated_potential_show_lcd_t < millis()) {
+        Simulated_potential_show_lcd_t = millis() + Simulated_potential_show_lcd_latency ;
+       show_p0_neuron_title();
+       
+               
+            for(int i=0; i<10;i++) {
+                if(NEURON_A[i].if_used == 1  ) {
+                    lcd.setCursor(i,2);
+                    byte level = (( NEURON_A[i].Simulated_potential - NEURON_A[i].Minimum_voltage ) / ( NEURON_A[i].Firing_threshold -  NEURON_A[i].Minimum_voltage )) * 10 ;
+                    lcd.print(level) ;
+                   /* if(NEURON_A[i].Simulated_potential < -80)  lcd.print("0");
+                    else if(NEURON_A[i].Simulated_potential < -75)  lcd.print("1");
+                    else if(NEURON_A[i].Simulated_potential < -70)  lcd.print("2");
+                    else if(NEURON_A[i].Simulated_potential < -65)  lcd.print("3");
+                    else if(NEURON_A[i].Simulated_potential < -60)  lcd.print("4");
+                    else if(NEURON_A[i].Simulated_potential < -55)  lcd.print("5");
+                    else if(NEURON_A[i].Simulated_potential < -50)  lcd.print("6");
+                    else if(NEURON_A[i].Simulated_potential < -45)  lcd.print("7");
+                    else if(NEURON_A[i].Simulated_potential < -40)  lcd.print("8");
+                    else lcd.print("9");
+                    */
+                }
+            }
+       
+       
+        lcd.setCursor(0,3);   
+        lcd.print("L") ;lcd.print(int(neuron_Resting_Potenial_t_test_result)) ;  lcd.print(F("    "));
+        lcd.setCursor(5,3);
+         lcd.print(round(analogRead(AnalogSensorLL_PIN)/10 * AnalogSensorLL_calibrate_ratio)); lcd.print(F(" "));
+         lcd.print(round(analogRead(AnalogSensorLC_PIN)/10 * AnalogSensorLC_calibrate_ratio)); lcd.print(F(" "));
+         lcd.print(round(analogRead(AnalogSensorRC_PIN)/10 * AnalogSensorRC_calibrate_ratio)); lcd.print(F(" "));
+         lcd.print(round(analogRead(AnalogSensorRR_PIN)/10 * AnalogSensorRR_calibrate_ratio)); lcd.print(F("    "));
+    }
+
+
+}

+ 98 - 0
SE/stuff/p5_neuron/neuron-conf.h

@@ -0,0 +1,98 @@
+
+
+
+bool set_conf() {
+
+    NEURON_A[0].Label = "A" ;
+    NEURON_A[0].if_used = 1 ; 
+    NEURON_A[0].if_modified = 1 ; 
+    NEURON_A[0].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 1 ;
+    NEURON_A[0].Coordinate_Y = 10 ;
+    NEURON_A[0].Coordinate_Z = 0 ;
+    
+    NEURON_A[1].Label = "B" ;
+    NEURON_A[1].if_used = 1 ;
+    NEURON_A[1].if_modified = 1 ;
+    NEURON_A[1].Coordinate_X =  DISPLAY_PHYS_A[0].X / 7 * 2 ;
+    NEURON_A[1].Coordinate_Y = 10 ;
+    NEURON_A[1].Coordinate_Z = 0 ;
+
+    
+    NEURON_A[2].Label = "C" ;
+    NEURON_A[2].if_used = 1 ;
+    NEURON_A[2].if_modified = 1 ;
+    NEURON_A[2].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 3 ;
+    NEURON_A[2].Coordinate_Y = 10 ;
+    NEURON_A[2].Coordinate_Z = 0 ;
+    
+    NEURON_A[3].Label = "D" ;
+    NEURON_A[3].if_used = 1 ;
+    NEURON_A[3].if_modified = 1 ;
+    NEURON_A[3].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 4 ;
+    NEURON_A[3].Coordinate_Y = 10 ;
+    NEURON_A[3].Coordinate_Z = 0 ;
+    
+    
+    NEURON_A[4].Label = "E" ;
+    NEURON_A[4].if_used = 1 ;
+    NEURON_A[4].if_modified = 1 ;
+    NEURON_A[4].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 5 ;
+    NEURON_A[4].Coordinate_Y = 10 ;
+    NEURON_A[4].Coordinate_Z = 0 ;
+    
+    
+    NEURON_A[5].Label = "F" ;
+    NEURON_A[5].if_used = 1 ;
+    NEURON_A[5].if_modified = 1 ;
+    NEURON_A[5].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 6 ;
+    NEURON_A[5].Coordinate_Y = 10 ;
+    NEURON_A[5].Coordinate_Z = 0 ;
+    
+    
+    NEURON_A[6].Label = "S" ;
+    NEURON_A[6].if_used = 1 ;
+    NEURON_A[6].if_modified = 1 ;
+    NEURON_A[6].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 0 ;
+    NEURON_A[6].Coordinate_Y = 30 ;
+    NEURON_A[6].Coordinate_Z = 0 ;
+    
+     //synapsa od A do S
+     Current_synapse_A[0].if_used = 1;
+     Current_synapse_A[0].if_modified = 1;
+     Current_synapse_A[0].ID_NEURON = 0 ; 
+     Current_synapse_A[0].Output_Node = 6 ;
+    
+}
+
+
+bool set_conf_R = set_conf();
+
+int NEURON_A_INDEX_NEXT = 7 ; 
+int Current_synapse_A_INDEX_NEXT = 1 ;
+
+int Coordinate_Y_current_max = 30 ;
+
+
+const int action_button_input_Maximum_current = 7 ;
+const int action_button_input_Time_constant = 2 ;
+
+const int neuron_Resting_Potenial_latency = 10 ; 
+const int neuron_Resting_Potenial_latency_test_print = 5000 ;
+
+const int neuron_Refactory_period_ratio = 100 ; //to millis 
+const int Current_synapse_A_Delay_ratio = 100 ; //to millis
+
+
+const int Simulated_potential_show_lcd_latency = 1000 ;
+
+const int neuron_print_latency = 10 ;
+const int neuron_print_if_has_input_millis_delay = 500 ; //extra keep active synapse for time to show
+const int neuron_Resting_Potenial__printed__level = 1 ; //below will not refresh
+//const long neuron_Attract_min = -65 ; //parametr glowny do attract
+
+
+
+#define NEURON_A_LIMIT 20 
+#define Input_A_LIMIT 20 
+#define Current_synapse_A_LIMIT 20 
+#define Simulation_attract__x3A__calculate_A_LIMIT 10

+ 240 - 0
SE/stuff/p5_neuron/p5_neuron.ino

@@ -0,0 +1,240 @@
+#include "Arduino.h"
+#include <Servo.h>
+Servo myservo; 
+
+            
+        #define Port7 7 //for TFT_ILI9163C_CSpin 7 
+        #define Port8 8 //for TFT_ILI9163C_DCpin 8  
+        #define Port9 9 //for TFT_ILI9163C__RSTpin 9
+        #define TFT_ILI9163C_CSpin Port7 // 7 // __CSpin // 53 // 10 //  chip select
+        
+        
+#if ! defined(TFT_ILI9163C_DCpin)
+  #define TFT_ILI9163C_DCpin Port8 //8 // A0   data/command pin.   sometimes called DC, RS, ...
+#endif
+
+#if ! defined(TFT_ILI9163C__RSTpin)
+#define TFT_ILI9163C__RSTpin Port9 //9 //reset pin.   you must connect.   (or pullup)
+#endif
+
+
+#include "__main_struct.h" //lite #include "___main/__main_struct.h"
+
+#include "progmem.h"
+
+#include "__main_struct_limits.h"
+
+#include "config_Active_ControllerID.h"
+#include "config_Slave_Ports_LOCAL_config.h" //lite
+
+#include "automation_driven.submodule.struct.write_neuron.h"
+
+
+
+
+    #if defined(HAS_LCD1602_I2C)
+        #include <LiquidCrystal_I2C.h>
+        LiquidCrystal_I2C lcd(0x27,LCD1602_DISPLAY_PHYSICAL_X_CHARS_A,LCD1602_DISPLAY_PHYSICAL_Y_CHARS_A);
+    #endif
+    
+
+
+#if defined(HAS_TFT_ILI9163C)
+   #include "_TFT_ILI9163C_config.h"
+//  #include "_TFT_ILI9163C_struct.h"
+    bool DISPLAY_PHYS_A_set() {
+        DISPLAY_PHYS_A[0].X = 128 ; 
+        DISPLAY_PHYS_A[0].Y = 128 ;
+    }
+    bool DISPLAY_PHYS_A_set_init = DISPLAY_PHYS_A_set();
+
+   TFT_ILI9163C DISPLAY_DEV = TFT_ILI9163C(TFT_ILI9163C_CSpin, TFT_ILI9163C_DCpin, TFT_ILI9163C__RSTpin); //#include "_TFT_ILI9163C_func.h"
+   #elif defined(HAS_TFT_HX8357)
+   #include <TFT_HX8357.h>
+  // #error test
+   TFT_HX8357 DISPLAY_DEV = TFT_HX8357();       // Invoke custom library
+   bool DISPLAY_PHYS_A_set() {
+        DISPLAY_PHYS_A[0].X = 240 ; 
+        DISPLAY_PHYS_A[0].Y = 320 ;
+    }
+    bool DISPLAY_PHYS_A_set_init = DISPLAY_PHYS_A_set();
+#endif
+
+
+
+
+
+
+
+#if defined(HAS_W5IOKeypad)
+    #include <W5IOKeypad.h>
+#endif
+
+
+
+#if defined(HAS__PCINT_setup)
+    #include "_PCINT_struct.h"  //pins MYPIN1 MYPIN2 MYPIN3
+#endif
+
+
+
+
+#if defined(HAS_ROTTARY_SW)
+ #include "_ROTTARY_SW_config.h" //_ROTTARY_SW/
+#endif
+
+#if defined(HAS_ROTTARY_SW)
+    #include "_ROTTARY_SW_struct.h" //lite _ROTTARY_SW/
+    #else
+        int encoderPos = 0 ;
+        int oldEncPos = 0 ;
+        int triggerCount = 0 ;
+        int triggerCountOld = 0 ;
+#endif
+
+
+
+
+#if defined(HAS_ROTTARY_SW)
+ #include "_ROTTARY_SW_func.h" //lite _ROTTARY_SW/
+#endif
+
+#if defined(HAS__PCINT_setup)
+     #include "_PCINT_init.h"
+#endif
+
+
+
+#include "neuron-conf.h"
+#include "neuron_Input_func.h"
+#include "neuron_Attract_func.h"
+
+#include "neuron_Resting_Potenial_func.h"
+
+#include "Simulated_potential_show_lcd.h"
+#include "neuron_print.h"
+// bool if_show_p0_neuron_title = 0 ;
+
+
+
+#if defined(HAS_W5IOKeypad)
+    W5IOKeypad Keypad( W5IOKeypad_PIN_GND, W5IOKeypad_PIN_IO1, W5IOKeypad_PIN_IO2, W5IOKeypad_PIN_IO3, W5IOKeypad_PIN_IO4, W5IOKeypad_PIN_IO5 );
+    int IOKey = 0;
+    int IOKey_last = 0;
+#endif
+
+
+
+
+
+void action_button_input( ) {
+    #if defined(HAS_W5IOKeypad)
+    for(int i=0; i<20;i++) {
+        lcd.setCursor(i,1);
+        if(IOKey == i+1) {
+            lcd.print("+");
+            //NEURON_A[i].Simulated_potential = NEURON_A[i].Simulated_potential + ( action_button_input_Maximum_current * action_button_input_Time_constant ) / NEURON_A[i].Capacitance ;
+            neuron_Input(i,action_button_input_Time_constant,action_button_input_Maximum_current, 0 );
+            Serial.print(F(" ")); Serial.print(NEURON_A[i].Simulated_potential);
+        } else  lcd.print(" ");
+    }
+    #endif
+}
+
+
+
+
+void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
+    Serial.begin(115200);
+     lcd.init();                      // Print a message to the LCD.
+     lcd.backlight();
+     lcd.setCursor(0,0);
+    //lcd.print("debug neuron ");
+    #if defined(HAS_TFT_HX8357)
+      DISPLAY_DEV.init();
+      #else
+     DISPLAY_DEV.begin();
+    #endif
+     //   DISPLAY_DEV.setRotation(2);
+        DISPLAY_DEV.fillScreen(BLACK);//DISPLAY_DEV.clearScreen();
+        DISPLAY_DEV.setCursor(0,0);
+    
+    
+        
+        #if defined(HAS__PCINT_setup)
+            #include "_PCINT_setup.h" //empty
+        #endif
+        
+        
+        #if defined(HAS_ROTTARY_SW)
+         #include "_ROTTARY_SW_setup.h"  //Attach interrupts //lite _ROTTARY_SW/
+        #endif
+    
+    show_p0_neuron_title();
+    
+    pinMode(AnalogSensorLL_PIN, INPUT_PULLUP);
+    pinMode(AnalogSensorLC_PIN, INPUT_PULLUP); 
+    pinMode(AnalogSensorRC_PIN, INPUT_PULLUP); 
+    pinMode(AnalogSensorRR_PIN, INPUT_PULLUP);
+ 
+      myservo.attach(PWM_Servo_PIN); 
+     myservo.write(90);  
+ }
+ 
+ 
+ 
+ 
+ void loop() {
+
+      //  Serial.println(F("L"));
+
+                                            
+                                             if(triggerCount != triggerCountOld) {
+                                               
+                                                SPFTFT2(rottary,trigger,triggerCount);
+                                                   
+                                                if(triggerCountOld_t < millis()) {
+                                                    triggerCountOld_t = millis() + 500 ;
+                                                    triggerCountOld =  triggerCount ;
+                                                } else {
+                                                    SPFTFTFTFT(rottary,trigger,time,bypassed);
+                                                     triggerCountOld =  triggerCount ;
+                                                }      
+                                             
+                                             }
+                                 
+                                       
+                                        
+                                        
+                                        
+                                        
+              
+             
+                                        
+                                        
+                                        
+  //  if(if_show_p0_neuron_title == 0) show_p0_neuron_title() ;
+  //  Serial.print(F("R"));
+    neuron_Resting_Potenial();
+  //  Serial.print(F("C"));
+    Simulated_potential_show_lcd();
+  //  Serial.print(F("P"));
+    neuron_print();
+    
+
+    #if defined(HAS_W5IOKeypad)
+     //   Serial.print(F("K"));
+       IOKey=Keypad.ReadButtons();
+         if(IOKey == 0) {
+            IOKey_last = IOKey ;
+         } else if(IOKey_last == IOKey and IOKey != 0) {
+             Serial.print(F("K")); 
+         } else { 
+            IOKey_last = IOKey ;
+            Serial.println(IOKey);
+            Serial.print(F("A"));
+            action_button_input();
+         }
+    #endif
+   // delay(100);
+ }