a.binder 5 tahun lalu
induk
melakukan
c78c8bebfd

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

@@ -169,6 +169,16 @@
    <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.struct.write_neuron.lcd_menu.xsl" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.lcd_menu.xsl"/>
+   <property  name="automation_driven.submodule.struct.write_neuron.lcd_menu.xsd" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.lcd_menu.xsd"/>
+   <property  name="automation_driven.submodule.struct.write_neuron.lcd_menu.h" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.lcd_menu.h"/>
+   
+   
+   <property  name="automation_driven.submodule.struct.write_neuron.scenario.xsl" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.scenario.xsl"/>
+   <property  name="automation_driven.submodule.struct.write_neuron.scenario.xsd" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.scenario.xsd"/>
+   <property  name="automation_driven.submodule.struct.write_neuron.scenario.h" location="${automation_driven.submodule.basedir}/automation_driven.submodule.struct.write_neuron.scenario.h"/>
+   
+   
    
    
    

+ 92 - 0
SE/schema/WPS_Functions/automation_driven/build_automation_driven.xml

@@ -76,6 +76,98 @@
    </target>
    
    
+   <target name="automation_driven.submodule.xsd__struct_write_neuron.lcd_menu"
+      description="to generate lcd menu from assoc obj" >
+      <echo>#80 generating from ${automation_driven.submodule.struct.write_neuron.lcd_menu.xsd} </echo>
+      <xslt basedir="${automation_driven.submodule.basedir}"
+         destdir="${automation_driven.submodule.temp}"
+         force="true"
+         in="${automation_driven.submodule.struct.write_neuron.lcd_menu.xsd}"
+         out="${automation_driven.submodule.struct.write_neuron.lcd_menu.h}"
+         style="${automation_driven.submodule.struct.write_neuron.lcd_menu.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.lcd_menu.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="automation_driven.submodule.xsd__struct_write_neuron.scenario"
+      description="to generate scenario menu from assoc obj" >
+      <echo>#80 generating from ${automation_driven.submodule.struct.write_neuron.lcd_menu.xsd} </echo>
+      <xslt basedir="${automation_driven.submodule.basedir}"
+         destdir="${automation_driven.submodule.temp}"
+         force="true"
+         in="${automation_driven.submodule.struct.write_neuron.scenario.xsd}"
+         out="${automation_driven.submodule.struct.write_neuron.scenario.h}"
+         style="${automation_driven.submodule.struct.write_neuron.scenario.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.scenario.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">

+ 13 - 18
SE/stuff/p5_neuron/Simulated_potential_show_lcd.h

@@ -1,5 +1,4 @@
 
- unsigned long Simulated_potential_show_lcd_t = 0 ;
 
 
 
@@ -17,7 +16,7 @@ void show_p0_neuron_title( ) {
         }
     }
     //if_show_p0_neuron_title = 1 ;
-    lcd.print(F(" ")); lcd.print(NEURON_A_INDEX_NEXT);
+   
 }
 
 
@@ -26,25 +25,21 @@ void Simulated_potential_show_lcd( ) {
  
  if(Simulated_potential_show_lcd_t < millis()) {
         Simulated_potential_show_lcd_t = millis() + Simulated_potential_show_lcd_latency ;
-       
-               
+        SPL();
+        lcd_menu();
+        //SPFT2(level,(( NEURON_A[0].Simulated_potential - NEURON_A[0].Reset_potential ) / ( NEURON_A[0].Firing_threshold -  NEURON_A[0].Reset_potential )) * 10 );
+        //SPFT2(level,(( NEURON_A[1].Simulated_potential - NEURON_A[1].Reset_potential ) / ( NEURON_A[1].Firing_threshold -  NEURON_A[1].Reset_potential )) * 10 );
+        //SPFT2(debug,NEURON_A[0].Capacitance);
+       // SPFT2(level,NEURON_A[1].Simulated_potential);
+       /*        
             for(int i=0; i<19;i++) {
                 if(NEURON_A[i].if_used == 1  ) {
                     lcd.setCursor(i,2);
                     byte level = (( NEURON_A[i].Simulated_potential - NEURON_A[i].Reset_potential ) / ( NEURON_A[i].Firing_threshold -  NEURON_A[i].Reset_potential )) * 10 ;
                     if(level >9) level = 0;
+                    Serial.print(i);SPFT2(level,level);
                     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");
-                    */
+                  
                 }
             }
        
@@ -55,11 +50,11 @@ void Simulated_potential_show_lcd( ) {
          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("    "));
-         
+         lcd.print(round(analogRead(AnalogSensorRR_PIN)/10 * AnalogSensorRR_calibrate_ratio)); lcd.print(F(" "));
+         lcd.print(NEURON_A_INDEX_NEXT);  lcd.print(F(" ")); 
          show_p0_neuron_title();
 
-         
+         */
          
     }
 

+ 134 - 62
SE/stuff/p5_neuron/neuron-conf.h

@@ -1,66 +1,142 @@
 
+int PORT_to_NEURON_A_INDEX_NEXT = 0 ;
+int NEURON_A_INDEX_NEXT = 0 ; 
+int Current_synapse_A_INDEX_NEXT = 0 ;
+int Coordinate_Y_current_max = 30 ;
+int Coordinate_X_current_max = 10 ;
 
+int NEURON_TO_PORT_A_INDEX_NEXT = 0 ;
 
-bool set_conf() {
 
-    NEURON_A[0].Label[0] =  'A'  ; NEURON_A[0].Label[1] =  '\0'  ;
-    NEURON_A[0].if_used = 1 ; 
-    NEURON_A[0].if_modified = 1 ; 
-    NEURON_A[0].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 1 + 15 ;
-    NEURON_A[0].Coordinate_Y = 10 ;
-    NEURON_A[0].Coordinate_Z = 0 ;
+int Coordinate_X_assign() {
     
-    NEURON_A[1].Label[0] = 'B' ; NEURON_A[1].Label[1] =  '\0'  ;
-    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 ;
+    if(DISPLAY_PHYS_A[0].X > 300 and DISPLAY_PHYS_A[0].Y > 220) {
+            if(Coordinate_X_current_max + 30 < DISPLAY_PHYS_A[0].X ) {
+                Coordinate_X_current_max += 25 ;
+                return Coordinate_X_current_max;
+            } else {
+                Coordinate_X_current_max = 15;
+                Coordinate_Y_current_max += 50 ;
+                  return Coordinate_X_current_max;
+            }
+    } else {
+        
+            if(Coordinate_X_current_max + 15 < DISPLAY_PHYS_A[0].X ) {
+                Coordinate_X_current_max += 15 ;
+                return Coordinate_X_current_max;
+            } else {
+                Coordinate_X_current_max = 5;
+                Coordinate_Y_current_max += 15 ;
+                  return Coordinate_X_current_max;
+            }
+    }
+}
 
+
+int Coordinate_Y_assign() {
+    return Coordinate_Y_current_max ;
+}
+
+
+   
+     
+
+
+
+#include "config_Slave_Ports_LOCAL_neuron_config.h"
+
+
+bool NEURON_A_reset() {
+    NEURON_A_INDEX_NEXT = 0 ;
+    Coordinate_Y_current_max = 30 ; //0
+    NEURON_A[NEURON_A_INDEX_NEXT].Label[0] =  'A'  ; NEURON_A[NEURON_A_INDEX_NEXT].Label[1] =  '\0'  ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_used = 1 ; 
+    NEURON_A[NEURON_A_INDEX_NEXT].if_modified = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Resistance = 50 ; 
+    //NEURON_A[NEURON_A_INDEX_NEXT].Capacitance = 2;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 1  ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Y = 10 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Z = 0 ;
+    NEURON_A_INDEX_NEXT++ ;
+    //1 life
+    NEURON_A[NEURON_A_INDEX_NEXT].Label[0] = 'B' ; NEURON_A[NEURON_A_INDEX_NEXT].Label[1] =  '\0'  ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_used = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_modified = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Resistance = 50 ;
+    //NEURON_A[NEURON_A_INDEX_NEXT].Capacitance = 2;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_X =  DISPLAY_PHYS_A[0].X / 7 * 2 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Y = 10 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Z = 0 ;
+    NEURON_A_INDEX_NEXT ++ ;
+    //2
+    NEURON_A[NEURON_A_INDEX_NEXT].Label[0] = 'C' ; NEURON_A[NEURON_A_INDEX_NEXT].Label[1] =  '\0'  ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_used = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_modified = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Resistance = 50 ;
+    //NEURON_A[NEURON_A_INDEX_NEXT].Capacitance = 2;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 3 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Y = 10 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Z = 0 ;
+    NEURON_A_INDEX_NEXT ++ ;
+    //3
+    NEURON_A[NEURON_A_INDEX_NEXT].Label[0] = 'D' ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_used = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_modified = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Resistance = 50 ;
+    //NEURON_A[NEURON_A_INDEX_NEXT].Capacitance = 2;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 4 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Y = 10 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Z = 0 ;
+    NEURON_A_INDEX_NEXT++ ;
+    //4
+    NEURON_A[NEURON_A_INDEX_NEXT].Label[0] = 'E' ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_used = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_modified = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Resistance = 50 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 5 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Y = 10 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Z = 0 ;
+    NEURON_A_INDEX_NEXT++ ;
+    //5
+    NEURON_A[NEURON_A_INDEX_NEXT].Label[0] = 'F' ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_used = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_modified = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Resistance = 50 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 6 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Y = 10 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Z = 0 ;
+    NEURON_A_INDEX_NEXT ++ ;
+    //6
+    NEURON_A[NEURON_A_INDEX_NEXT].Label[0] = 'S' ;    NEURON_A[NEURON_A_INDEX_NEXT].Label[1] = '\0' ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_used = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_modified = 1 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 0 + 15 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Y = 30 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].Coordinate_Z = 0 ;
+    NEURON_A[NEURON_A_INDEX_NEXT].if_is_output = 1 ;
+
+    NEURON_A_INDEX_NEXT ++ ;
+    //NEURON_A_reset_LOCAL();
+   
     
-    NEURON_A[2].Label[0] = 'C' ; NEURON_A[2].Label[1] =  '\0'  ;
-    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[0] = '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[0] = '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[0] = '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_reset_LOCAL();
+}
+
+
+bool Current_synapse_A_reset() {
+    Current_synapse_A_INDEX_NEXT = 0 ;
     
+     Current_synapse_A_reset_LOCAL();
+}
+
+bool set_conf() {
+    PORT_to_NEURON_A_INDEX_NEXT = 0 ;
     
-    NEURON_A[6].Label[0] = 'S' ;    NEURON_A[6].Label[1] = '\0' ;
-    NEURON_A[6].if_used = 1 ;
-    NEURON_A[6].if_modified = 1 ;
-    NEURON_A[6].Coordinate_X = DISPLAY_PHYS_A[0].X / 7 * 0 + 15 ;
-    NEURON_A[6].Coordinate_Y = 30 ;
-    NEURON_A[6].Coordinate_Z = 0 ;
+    NEURON_A_reset() ;
+    Current_synapse_A_reset() ;
+    //   #include "automation_driven.submodule.struct.write_neuron.scenario.h"
+
     
-     //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 ;
     
 }
 
@@ -69,16 +145,12 @@ int AA_Delay_global_sequence_level = 0 ; //to maitain next sequence ordered
 
 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 = 3 ;
-const int action_button_input_Time_constant = 2 ;
+//const int action_button_input_Maximum_current = 3 ;
+//const int action_button_input_Time_constant = 2 ;
 
-const int neuron_Resting_Potenial_latency = 10 ; 
+//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 
@@ -87,8 +159,8 @@ const int neuron_Resting_Potenial_latency_test_print = 5000 ;
 
 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_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
 

+ 155 - 28
SE/stuff/p5_neuron/p5_neuron.ino

@@ -6,8 +6,24 @@ 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
-        
+     //   #define TFT_ILI9163C_CSpin Port7 // 7 // __CSpin // 53 // 10 //  chip select
+   
+
+#include "__main_struct.h" //lite #include "___main/__main_struct.h"
+
+#include "progmem.h"
+
+#include "__main_struct_limits.h"
+#include "_PortTypes_struct.h"
+#include "_Port_Exp_state_ttl_struct.h"
+#include "_Port_Broadcast_state_struct.h"
+#include "_PortStates_struct.h"
+#include "_Port_I2C_driver_struct.h"
+#include "config_Active_ControllerID.h"
+#include "config_Slave_Ports_LOCAL_config.h" //lite
+
+
+     
         
 #if ! defined(TFT_ILI9163C_DCpin)
   #define TFT_ILI9163C_DCpin Port8 //8 // A0   data/command pin.   sometimes called DC, RS, ...
@@ -18,20 +34,10 @@ Servo myservo;
 #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);
@@ -54,8 +60,8 @@ Servo myservo;
   // #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 ;
+        DISPLAY_PHYS_A[0].X = 320 ; 
+        DISPLAY_PHYS_A[0].Y = 240 ;
     }
     bool DISPLAY_PHYS_A_set_init = DISPLAY_PHYS_A_set();
 #endif
@@ -103,18 +109,51 @@ Servo myservo;
      #include "_PCINT_init.h"
 #endif
 
-
+//#include "config_Slave_Ports_LOCAL_init.h"
+#include "automation_driven.submodule.struct.write_neuron_override.h"
 
 #include "neuron-conf.h"
+#include "config_Slave_Ports_LOCAL_neuron_config.h"  
+
 #include "neuron_Input_func.h"
 #include "neuron_Stress_func.h"
 #include "neuron_Attract_func.h"
-
+#include "neuron_PORT_to_NEURON_func.h"
 #include "neuron_Resting_Potenial_func.h"
 
+
+
+#include "_TASK_TYPES_struct.h"
+
+bool neuron_print_ROTTARY_Coordinate_Y_SHIFT_flag = 0 ;
+
+
+#include "automation_driven.submodule.struct.write_neuron.lcd_menu.h"
+
 #include "Simulated_potential_show_lcd.h"
-#include "neuron_print.h"
+
+#include "_time_struct.h"
+
+
+#if  defined(HAS_ADKeyboard)
+    #include "ADKeyboard.h"
+#endif
+
+
+ #if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
+    #include "neuron_print.h"
+ #endif
 // bool if_show_p0_neuron_title = 0 ;
+#include "TASK_TYPE_T_Get_Ports_Status_INPUT_A___.h"
+#include "_Slave_Ports_Status_func_add_lite.h"
+
+#if Active_ControllerID == 0x14 
+    #include "0x14/config_Slave_Ports_LOCAL_0x14_init.h"
+#elif Active_ControllerID == 0x38
+     #include "0x38/config_Slave_Ports_LOCAL_0x38_init.h"
+#else
+    #error not set  correct Active_ControllerID    
+#endif
 
 
 
@@ -133,12 +172,44 @@ void action_button_input( ) {
     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);
+        
+            if(IOKey == 11) {//11 l 
+                lcd_menu__action_button_input__left() ;
+            } else if(IOKey == 12) { //12 up
+                lcd_menu__action_button_input__up() ;
+            } else if(IOKey == 13) {  //13 fire
+                lcd_menu__action_button_input__toggle() ;
+            } else if(IOKey == 14) { //14 dol
+                lcd_menu__action_button_input__down();
+            } else if(IOKey == 15) { //15 r
+                lcd_menu__action_button_input__right() ;
+            } else  {
+                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,neuron_Logic_A[0].action_button_input_Time_constant , neuron_Logic_A[0].action_button_input_Maximum_current, 0 );
+                Serial.print(F(" ")); Serial.print(NEURON_A[i].Simulated_potential);
+            }
         } else  lcd.print(" ");
     }
+    #elif defined(HAS_ADKeyboard)
+      if(IOKey == 1) {
+          lcd_menu__action_button_input__right() ;
+      } else if(IOKey == 2) {
+           lcd_menu__action_button_input__down();
+      } else if(IOKey == 3) {
+          lcd_menu__action_button_input__up() ;
+      } else if(IOKey == 4) {
+         lcd_menu__action_button_input__left() ;
+      } else if(IOKey == 5) {
+          lcd_menu__action_button_input__toggle() ;
+      } 
+        
     #endif
 }
 
@@ -147,6 +218,14 @@ void action_button_input( ) {
 
 
 
+#if defined(HAS_HCSR04)
+    #include "HC-SR04.h" 
+#endif
+
+
+
+
+
 void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
     Serial.begin(115200);
      lcd.init();                      // Print a message to the LCD.
@@ -155,14 +234,19 @@ void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
     //lcd.print("debug neuron ");
     #if defined(HAS_TFT_HX8357)
       DISPLAY_DEV.init();
-      #else
+      DISPLAY_DEV.setRotation(1);
+    #elif defined(HAS_TFT_ILI9163C)
      DISPLAY_DEV.begin();
     #endif
+    
+    
+     #if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
      //   DISPLAY_DEV.setRotation(2);
         DISPLAY_DEV.fillScreen(BLACK);//DISPLAY_DEV.clearScreen();
         DISPLAY_DEV.setCursor(0,0);
     
-    
+   #endif
+
         
         #if defined(HAS__PCINT_setup)
             #include "_PCINT_setup.h" //empty
@@ -174,14 +258,26 @@ void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
         #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);  
+ */
+    TASK_TYPE_T_Get_Ports_Status_INPUT_A___SETUP();
+    #if defined(PWM_Servo_PIN)
+        myservo.attach(PWM_Servo_PIN); 
+        myservo.write(90);
+    #endif   
+    #if defined(HAS_HCSR04)
+         pinMode(HCSR04_trigPin, OUTPUT); // Sets the trigPin as an OUTPUT
+         pinMode(HCSR04_echoPin, INPUT); // Sets the echoPin as an INPUT
+    #endif
+    
+    
+    #if defined(HAS_ADKeyboard)
+     //   pinMode(ADKeyboard_PIN, INPUT_PULLUP) ; 
+    #endif
  }
  
  
@@ -218,12 +314,21 @@ void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
                                         
   //  if(if_show_p0_neuron_title == 0) show_p0_neuron_title() ;
   //  Serial.print(F("R"));
+  
+   #if defined(HAS_HCSR04)
+    HCSR04_input();
+   #endif
+  
+    neuron_PORT_to_NEURON();
+    neuron_Resting_Potenial_input();
     neuron_Resting_Potenial();
   //  Serial.print(F("C"));
     Simulated_potential_show_lcd();
   //  Serial.print(F("P"));
+   #if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
     neuron_print();
-    
+   #endif
+    TASK_TYPE_T_Get_Ports_Status_INPUT_A___LOOP();
 
     #if defined(HAS_W5IOKeypad)
      //   Serial.print(F("K"));
@@ -238,6 +343,28 @@ void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
             Serial.print(F("A"));
             action_button_input();
          }
+    #elif  defined(HAS_ADKeyboard)
+        
+        
+        if(ADKeyboard_get_key_t > millis()) {
+        } else if(ADKeyboard_get_key()>0 and ADKeyboard_get_key_delay_t < millis()) {
+            ADKeyboard_get_key_delay_t = millis() + 100 ;
+        } else {
+                     IOKey=ADKeyboard_get_key();
+                        if(IOKey == 0) {
+                         IOKey_last = IOKey ;
+                         } else if(IOKey_last == IOKey and IOKey != 0) {
+                             
+                         }  else { 
+                             ADKeyboard_get_key_t = millis() + 300 ;
+                             IOKey_last = IOKey ;
+                             Serial.println(IOKey);
+                             Serial.print(F(" A "));
+                             SPFT2(input,analogRead(ADKeyboard_PIN));
+                             action_button_input();
+                 
+                 }
+              }
     #endif
    // delay(100);
  }