a.binder há 5 anos atrás
pai
commit
da55e9c07f

+ 29 - 15
SE/stuff/P5_Automation_can-dev-res/P5_Automation_can-dev-res.ino

@@ -89,6 +89,8 @@
 #include "__main_struct_limits.h"
 #include "_time_struct.h"
 
+
+
 #define  _ControllerID   0x101 
 #define  _Slave1_ID   0x103 
 
@@ -182,6 +184,8 @@
  #include "_ROTTARY_SW_func.h"
 #endif
 
+#include "_time_func.h"
+
 
 #include "_TASK_TYPES_func.h"
 #include "_Slave_Ports_Status_QUEUE_func.h"
@@ -237,17 +241,6 @@
 #include "config_Slave_Ports_LOCAL_init.h"
 
 
-ARDUINO_FUNCT_INIT_RESULT_T ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init = 
-         _Slave_Ports_LOCAL_init(
-                 Slave_Ports_Status_A ,
-                 Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
-                  Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_TABLE_A,
-                                    Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_T_TO_DELETE_A,
-                                    Slave_Ports_Status_T_ARDUINO_ARRAY_ASSOC_TABLE_S_Port_ID_A,
-                 DISPLAY_A , DISPLAY_T_ARDUINO_ATTR_ARRAY_A
-                 //, DISPLAY_PHYSICAL_CHAR_A
-            );
-
 
 void setup() {
     Serial.begin(115200);
@@ -268,8 +261,9 @@ void setup() {
 
  
 //todo PCINT service
-#include "_PCINT_setup.h"
-
+#if defined(HAS__PCINT_setup)
+    #include "_PCINT_setup.h"
+#endif
 
 
 #if defined(HAS_ROTTARY_SW)
@@ -322,12 +316,32 @@ void setup() {
 
 void loop() {
  
+#if defined(HAS__PCINT_setup)
   #include "_PCINT_loop.h"
+#endif 
+
+  ARDUINO_FUNCT_INIT_RESULT_T ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init ;
+
+if(ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init == true ){
+        }  else { 
+                
+                ARDUINO_FUNCT_INIT_RESULT_T ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init = 
+                         _Slave_Ports_LOCAL_init(
+                                 Slave_Ports_Status_A ,
+                                 Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
+                                  Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_TABLE_A,
+                                                    Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_T_TO_DELETE_A,
+                                                    Slave_Ports_Status_T_ARDUINO_ARRAY_ASSOC_TABLE_S_Port_ID_A,
+                                 DISPLAY_A , DISPLAY_T_ARDUINO_ATTR_ARRAY_A
+                                 //, DISPLAY_PHYSICAL_CHAR_A
+                            );
+            }
 
   time = millis();
   Serial.println("Time: " );
   
-  
+    #include "__main_loop_top.h"
+
   
    Slave_Ports_Status__DISPLAY_TARGET(
          Slave_Ports_Status_A ,
@@ -339,7 +353,7 @@ void loop() {
         DISPLAY_pos_seq_A_NEXT + DISPLAY_pos_seq_A_IMMEDIATE,
         "336 PORTS:",
         DISPLAY_TARGET_DISPLAY128,
-       0,
+       millis(),
         0
      );
 

+ 10 - 3
SE/stuff/P5_Automation_can-dev-res/_DISPLAY_func.h

@@ -147,9 +147,16 @@ void DISPLAY__print_IMMEDIATE(
                 DISPLAY_A[i].DISPLAY_pos_id_A = 0 ;
                 //DISPLAY_A[i].DISPLAY_array16_A = DISPLAY_array16_AA   ;
                 DISPLAY_A[i].DISPLAY_TARGET_A  = DISPLAY_TARGET_A ; 
-                DISPLAY_A[i].time_seq_id_A = time_seq_id_A ;
-                DISPLAY_A[i].time_min_run_A = time_min_run_A ;
-                    
+                    if(time_seq_id_A == 0 ) {
+                        DISPLAY_A[i].time_seq_id_A = millis() ;
+                    } else {
+                       DISPLAY_A[i].time_seq_id_A = time_seq_id_A ;
+                    }
+                if(time_min_run_A == 0) {
+                        DISPLAY_A[i].time_min_run_A = DISPLAY_A[i].time_seq_id_A + ARDUINO_time_seq_id_A_INCREMENT;
+                } else {
+                        DISPLAY_A[i].time_min_run_A = time_min_run_A ;
+                }
                 ARDUINO_ATTR_ARRAY_S__commit_added_element(
                 DISPLAY_T_ARDUINO_ATTR_ARRAY_A , i); 
                

+ 2 - 0
SE/stuff/P5_Automation_can-dev-res/_TASK_TYPES_struct.h

@@ -8,6 +8,8 @@ const TASK_TYPE_T TASK_TYPE_T_request_confirm_Exp_state = 0x02 ;
 const TASK_TYPE_T TASK_TYPE_T_request_set_new_Exp_state = 0x03 ;
 const TASK_TYPE_T TASK_TYPE_T_Slave_Ports_broadcast____ = 0x04 ;
 const TASK_TYPE_T TASK_TYPE_T_Slave_Ports_set_I2C______ = 0x05 ;
+const TASK_TYPE_T TASK_TYPE_T_DISPLAY_queue_pop________ = 0x06 ;
+
 
 
 

+ 0 - 0
SE/stuff/P5_Automation_can-dev-res/__main_loop_top.h


+ 5 - 0
SE/stuff/P5_Automation_can-dev-res/__main_struct.h

@@ -3,6 +3,8 @@ typedef bool ARDUINO_FUNCT_INIT_RESULT_T ;
 typedef int ARDUINO_ARRAY_INDEX_T ; //for controll arrays behaviour
 typedef int ARDUINO_ARRAY_ATTR_T ; //for controll arrays behaviour
 
+typedef  int ARDUINO_ARRAY_PRIMARY_KET_T ; 
+
 typedef ARDUINO_ARRAY_ATTR_T ARDUINO_ARRAY_INDEX_CURRENT_T ; //porzadkowo do przegladania co jest biezacym pointerem
 typedef ARDUINO_ARRAY_ATTR_T ARDUINO_ARRAY_INDEX_LAST_T ; //porzadkowo co jest ostatnim elementem
 
@@ -49,8 +51,11 @@ const ARDUINO_ARRAY_INDEX_CURRENT_T ARDUINO_ARRAY_INDEX_CURRENT_INIT = 0 ;  //
 const ARDUINO_ARRAY_INDEX_LAST_T ARDUINO_ARRAY_INDEX_LAST_INIT = 0 ;
 const ARDUINO_ARRAY_INDEX_NEXT_T ARDUINO_ARRAY_INDEX_NEXT_INIT = 1;
 
+const int ARDUINO_time_seq_id_A_INCREMENT = 1000 ; 
+
 const ARDUINO_ARRAY_INDEX_T ARDUINO_ATTR_ARRAY_S_INDEX = ARDUINO_ARRAY_INDEX_FIRST ;
 
+//const ARDUINO_FUNCT_INIT_RESULT_T ARDUINO_FUNCT_INIT_RESULT_T_
 
 //#define membersof(x) (sizeof(x) / sizeof(x[0]))
 

+ 7 - 2
SE/stuff/P5_Automation_can-dev-res/__main_struct_funct.h

@@ -1,5 +1,6 @@
 //PROTOTYPES HOW TO USE ORDER ELEMENTS
 
+
 void ARDUINO_ARRAY_INDEX_TABLE__SYNC_CURRENT( //when added to main table - do it
 //MAIN_TABLE_T, MAIN_TABLE_A,
 //optional ARDUINO_ARRAY_ASSOC_TABLE_S ARDUINO_ARRAY_ASSOC_TABLE_A,
@@ -14,16 +15,20 @@ ARDUINO_ATTR_ARRAY_S* ARDUINO_ATTR_ARRAY_A
 
 
 
-void ARDUINO_ARRAY_ASSOC_TABLE_INIT(
+void ARDUINO_ARRAY_ASSOC_TABLE_commit_added_element(
+    ARDUINO_ATTR_ARRAY_S &ARDUINO_ATTR_ARRAY_A , 
     ARDUINO_ARRAY_ASSOC_TABLE_S* ARDUINO_ARRAY_ASSOC_TABLE_A,
     ARDUINO_ARRAY_INDEX_T* ARDUINO_ARRAY_INDEX_A,
-    ARDUINO_ARRAY_INDEX_CURRENT_T* ARDUINO_ARRAY_INDEX_CURRENT_A
+    ARDUINO_ARRAY_PRIMARY_KET_T ARDUINO_ARRAY_PRIMARY_KET_A
 ) {
 
 
 }
 
 
+
+
+
 void ARDUINO_ATTR_ARRAY_S__commit_added_element(
     ARDUINO_ATTR_ARRAY_S &ARDUINO_ATTR_ARRAY_A , 
     ARDUINO_ARRAY_INDEX_CURRENT_T ARDUINO_ARRAY_INDEX_CURRENT_A //current index

+ 6 - 0
SE/stuff/P5_Automation_can-dev-res/_time_func.h

@@ -0,0 +1,6 @@
+
+
+void ARDUINO_time_seq_id_F(time_seq_id_T &time_seq_id_A , time_seq_id_T &time_A  ) {
+    time_seq_id_A = time_A ;
+}
+

+ 6 - 1
SE/stuff/P5_Automation_can-dev-res/_time_struct.h

@@ -1,2 +1,7 @@
 typedef long time_seq_id_T;
-typedef time_seq_id_T time_min_run_T;
+typedef time_seq_id_T time_min_run_T;
+
+
+
+time_seq_id_T *time_seq_id_A ; 
+

+ 19 - 1
SE/stuff/P5_Automation_can-dev-res/config_Slave_Ports_LOCAL_init.h

@@ -34,6 +34,24 @@ ARDUINO_FUNCT_INIT_RESULT_T _Slave_Ports_LOCAL_init(Slave_Ports_Status_T* Slave_
                                 I2C_driver_Adafruit_PWMServoDriver ,//int I2C_driver
                                 IS_Local_TRUE 
                                 );
+                  Slave_Ports_Status_add_port(
+                                Slave_Ports_Status_A ,
+                                Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
+                                    Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_TABLE_A,
+                                    Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_T_TO_DELETE_A,
+                                    Slave_Ports_Status_T_ARDUINO_ARRAY_ASSOC_TABLE_S_Port_ID_A,
+                                1,  // int  Port_ID,
+                                Active_ControllerID ,  //int  _Slave_ID,
+                                PortTypes_P2M_EXP_I2C , //int  PortTypes,
+                                0x00 ,  //int  Address,
+                                2 , //int  LocalPort,
+                                Exp_state_OFF, //int  Exp_state,
+                                Exp_state_ttl_TO_REFRESH, //int  Exp_state_ttl,
+                                Broadcast_state_TO_REFRESH, //int  Broadcast_state,
+                                I2C_port_DEFAULT, //int I2C_port,
+                                I2C_driver_Adafruit_PWMServoDriver ,//int I2C_driver
+                                IS_Local_TRUE 
+                                );
                                 
                     /*    DISPLAY__print_ANY(
                     DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
@@ -49,7 +67,7 @@ ARDUINO_FUNCT_INIT_RESULT_T _Slave_Ports_LOCAL_init(Slave_Ports_Status_T* Slave_
                           DISPLAY_pos_seq_A_NEXT ,
                           "#50 Added ports ",//DISPLAY_array16_A
                           DISPLAY_TARGET_DISPLAY128,
-                          0, //time_seq_id_A,
+                          millis(), //time_seq_id_A,
                            0 //time_min_run_A =
                  );