a.binder 5 lat temu
rodzic
commit
416aecf76b

+ 33 - 8
SE/stuff/P5_Automation_can-dev-res/P5_Automation_can-dev-res.ino

@@ -76,6 +76,7 @@
  */
  */
 
 
 //#define HAS_DEBUG_ACTION_TRIG
 //#define HAS_DEBUG_ACTION_TRIG
+//#define DEBUG_I2C //to debug _Slave_Ports_I2C_POP etc
 //#define HAS_TFT_ILI9163C 
 //#define HAS_TFT_ILI9163C 
 //#define HAS_LCD1602 
 //#define HAS_LCD1602 
 //#define HAS_ROTTARY_SW
 //#define HAS_ROTTARY_SW
@@ -443,6 +444,31 @@ void setup() {  //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
 
 
   unsigned long time;
   unsigned long time;
   
   
+                
+                ARDUINO_LOOP_LATENCY_T ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END( ARDUINO_LOOP_LATENCY_T 
+                        ARDUINO_LOOP_LATENCY__MAIN_END_A)  {
+                    static ARDUINO_LOOP_LATENCY_COUNTER_T  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A = ARDUINO_LOOP_LATENCY__MAIN_END_A;
+                    
+                    if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A == 0 ) {
+                        ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A = ARDUINO_LOOP_LATENCY__MAIN_END_A;
+                          Serial.print("] COUNTER__MAIN_END_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A); Serial.print("] C["); Serial.print(ARDUINO_LOOP_LATENCY__MAIN_END_A); Serial.println("] ");
+                    } else {
+                        return ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A-- ;
+                    }
+                }
+                
+                                
+                ARDUINO_LOOP_LATENCY_T ARDUINO_LOOP_LATENCY_COUNTER__MAIN( ARDUINO_LOOP_LATENCY_T 
+                        ARDUINO_LOOP_LATENCY__MAIN_A)  {
+                    static ARDUINO_LOOP_LATENCY_COUNTER_T  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A = ARDUINO_LOOP_LATENCY__MAIN_A;
+                    
+                    if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A == 0 ) {
+                         Serial.print("] COUNTER__MAIN_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A); Serial.print("] C["); Serial.print(ARDUINO_LOOP_LATENCY__MAIN_A); Serial.println("] "); 
+                        ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A = ARDUINO_LOOP_LATENCY__MAIN_A;
+                    } else {
+                        return ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A-- ;
+                    }
+                }
 
 
 
 
 void loop() {
 void loop() {
@@ -469,13 +495,12 @@ void loop() {
     #include "___loop/__main_loop_top.h"
     #include "___loop/__main_loop_top.h"
     
     
     
     
-    if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT ) {
+    
+    
+    if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END(ARDUINO_LOOP_LATENCY__MAIN_END_A) <= ARDUINO_LOOP_LATENCY_COUNTER_INIT ) {
         #ifdef DEBUG
         #ifdef DEBUG
             #ifndef DISABLE_LOOP            
             #ifndef DISABLE_LOOP            
-                if(DEBUG_ACTION_TRIG == 1)        
-                    Serial.print("#331_L1 main loop top   ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A[");
-                     Serial.println(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A);
-                    Serial.print("] Time: " );   Serial.println(time);
+                if(DEBUG_ACTION_TRIG == 1)                            Serial.print("] Time: " );   Serial.println(time);
                  
                  
             #endif
             #endif
         #endif 
         #endif 
@@ -531,9 +556,9 @@ void loop() {
         
         
   delay(10);
   delay(10);
   if(DEBUG_ACTION_TRIG != DEBUG_LAST_ACTION_TRIG)   {
   if(DEBUG_ACTION_TRIG != DEBUG_LAST_ACTION_TRIG)   {
-        Serial.print("#534   DEBUG_ACTION_TRIG[");Serial.print(DEBUG_ACTION_TRIG);
-        Serial.print("] COUNTER__MAIN_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A);
-        Serial.print("] COUNTER__MAIN_END_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A);
+        Serial.print("#534   DEBUG_ACTION_TRIG[");Serial.print(DEBUG_ACTION_TRIG);Serial.println("] ");
+     //   Serial.print("] COUNTER__MAIN_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A);
+     //   Serial.print("] COUNTER__MAIN_END_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A);
   }
   }
   DEBUG_LAST_ACTION_TRIG = DEBUG_ACTION_TRIG ;
   DEBUG_LAST_ACTION_TRIG = DEBUG_ACTION_TRIG ;
   
   

+ 3 - 3
SE/stuff/P5_Automation_can-dev-res/___CONFIG/0x101/config_Active_ControllerID_0x101.h

@@ -7,9 +7,9 @@
 #define DEBUG_I2C_driver_Adafruit_PWMServoDriver
 #define DEBUG_I2C_driver_Adafruit_PWMServoDriver
 //#define HAS__PCINT_setup //to allow interrupts
 //#define HAS__PCINT_setup //to allow interrupts
 
 
-#define DEBUG 5 
+#//define DEBUG 5 
 
 
 //#define DISABLE_LOOP //To debug and disable any output
 //#define DISABLE_LOOP //To debug and disable any output
 
 
-
-#define HAS_DEBUG_ACTION_TRIG
+#define DEBUG_I2C
+//#define HAS_DEBUG_ACTION_TRIG

+ 5 - 4
SE/stuff/P5_Automation_can-dev-res/___loop/___loop_init.h

@@ -1,14 +1,15 @@
 
 
 
 
+//register ARDUINO_LOOP_LATENCY_COUNTER_T  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A = 0 ;// = ARDUINO_LOOP_LATENCY_COUNTER_INIT ; //WILL decrement
+//register ARDUINO_LOOP_LATENCY_COUNTER_T  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A = ARDUINO_LOOP_LATENCY_COUNTER_INIT ; //WILL DECREMENT
 
 
-register ARDUINO_LOOP_LATENCY_T      ARDUINO_LOOP_LATENCY__MAIN_A = 100 ; //EVERY 10 LOOPS INIT THIS LATENCY
-register ARDUINO_LOOP_LATENCY_COUNTER_T  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A = 0 ;// = ARDUINO_LOOP_LATENCY_COUNTER_INIT ; //WILL decrement
 
 
+static ARDUINO_LOOP_LATENCY_T      ARDUINO_LOOP_LATENCY__MAIN_A = 100 ; //EVERY 10 LOOPS INIT THIS LATENCY
 
 
 
 
 
 
-register ARDUINO_LOOP_LATENCY_T     ARDUINO_LOOP_LATENCY__MAIN_END_A = 10000 ; //EVERY 10 LOOPS INIT THIS LATENCY
-register ARDUINO_LOOP_LATENCY_COUNTER_T  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A = ARDUINO_LOOP_LATENCY_COUNTER_INIT ; //WILL DECREMENT
+
+static ARDUINO_LOOP_LATENCY_T     ARDUINO_LOOP_LATENCY__MAIN_END_A = 500 ; //EVERY 10 LOOPS INIT THIS LATENCY
 
 
 
 
 register long time;
 register long time;

+ 11 - 4
SE/stuff/P5_Automation_can-dev-res/___loop/__main_loop_end.h

@@ -1,13 +1,20 @@
 
 
-if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT )  {
+//static ARDUINO_LOOP_LATENCY_T     ARDUINO_LOOP_LATENCY__MAIN_END_A = 10000 ; //EVERY 10 LOOPS INIT THIS LATENCY
+
+
+if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END(ARDUINO_LOOP_LATENCY__MAIN_END_A) <= ARDUINO_LOOP_LATENCY_COUNTER_INIT )  {
            
            
              #ifdef DISABLE_LOOP || DEBUG
              #ifdef DISABLE_LOOP || DEBUG
                 if(DEBUG_ACTION_TRIG != DEBUG_LAST_ACTION_TRIG) { 
                 if(DEBUG_ACTION_TRIG != DEBUG_LAST_ACTION_TRIG) { 
-                 Serial.print("#4 main_loop_end  will    _Slave_Ports_queue__list");   Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A); Serial.println("] ");
+                 Serial.print("#4 main_loop_end  will    _Slave_Ports_queue__list"); 
                  }
                  }
              #endif  
              #endif  
             
             
             #ifndef DISABLE_LOOP
             #ifndef DISABLE_LOOP
+               Serial.print("#11534   DEBUG_ACTION_TRIG[");Serial.print(DEBUG_ACTION_TRIG);
+      //  Serial.print("] COUNTER__MAIN_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A);
+       
+            
              _Slave_Ports_queue__list(Slave_Ports_Status_QUEUE_A) ;
              _Slave_Ports_queue__list(Slave_Ports_Status_QUEUE_A) ;
               int _Slave_Ports_queue_count = _Slave_Ports_queue.count();
               int _Slave_Ports_queue_count = _Slave_Ports_queue.count();
               int _Slave_Ports_queue_front = _Slave_Ports_queue.front();
               int _Slave_Ports_queue_front = _Slave_Ports_queue.front();
@@ -46,7 +53,7 @@ if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT
  
  
  }
  }
  
  
- 
+ /*
 if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT )  {
 if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT )  {
     #ifndef DISABLE_LOOP
     #ifndef DISABLE_LOOP
      if(DEBUG_ACTION_TRIG != DEBUG_LAST_ACTION_TRIG) {  
      if(DEBUG_ACTION_TRIG != DEBUG_LAST_ACTION_TRIG) {  
@@ -58,7 +65,7 @@ if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT
 } else {
 } else {
     ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A ++ ;
     ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END_A ++ ;
 }
 }
-
+*/
   //_LCD_print_buffors_list(_LCD_print_buffors) ;
   //_LCD_print_buffors_list(_LCD_print_buffors) ;
   //_LCD_print_screens_list(_LCD_print_screens);
   //_LCD_print_screens_list(_LCD_print_screens);
   
   

+ 3 - 14
SE/stuff/P5_Automation_can-dev-res/___loop/__main_loop_top.h

@@ -2,10 +2,10 @@
 
 
 //ARDUINO_FUNCT_INIT_RESULT_T ARDUINO_FUNCT_INIT_RESULT_Slave_Ports_queue__add ;
 //ARDUINO_FUNCT_INIT_RESULT_T ARDUINO_FUNCT_INIT_RESULT_Slave_Ports_queue__add ;
 
 
+if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN(ARDUINO_LOOP_LATENCY__MAIN_A) <= ARDUINO_LOOP_LATENCY_COUNTER_INIT ) {
+//if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT ) {
 
 
-if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT ) {
-
-            
+            // Serial.print("] COUNTER__MAIN_END_A["); Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_END(ARDUINO_LOOP_LATENCY__MAIN_END_A));  Serial.println("] ");
             if(ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init == true ){
             if(ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init == true ){
                         #ifndef DISABLE_LOOP
                         #ifndef DISABLE_LOOP
                             #ifdef DEBUG
                             #ifdef DEBUG
@@ -76,14 +76,3 @@ if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT ) {
 
 
 
 
 }
 }
-
-if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT )  {
-    #ifndef DISABLE_LOOP
-    if(DEBUG_ACTION_TRIG != DEBUG_LAST_ACTION_TRIG)  {
-        Serial.print("#66  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A");   Serial.print(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A); Serial.println("] ");
-    }
-    #endif
-    ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A = ARDUINO_LOOP_LATENCY__MAIN_A ; 
-} else {
-    ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A -- ;
-}

+ 12 - 0
SE/stuff/P5_Automation_can-dev-res/___main/__main_trigger_struct.h

@@ -0,0 +1,12 @@
+
+#ifdef  HAS_DEBUG_ACTION_TRIG
+    static byte DEBUG_ACTION_TRIG = 1;
+    static byte DEBUG_LAST_ACTION_TRIG = 0 ; //to trigger actions and limit debug
+    
+    //volatile byte DEBUG_ACTION_TRIG = 0 ; //to trigger actions and limit debug
+    //volatile byte DEBUG_LAST_ACTION_TRIG = 0 ; //to trigger actions and limit debug
+#else
+
+    static byte DEBUG_ACTION_TRIG = 1;
+    static byte DEBUG_LAST_ACTION_TRIG = 0 ; //to trigger actions and limit debug
+#endif