a.binder 5 yıl önce
ebeveyn
işleme
1e587ce311

+ 22 - 3
SE/stuff/P5_Automation_can-dev-res/P5_Automation_can-dev-res.ino

@@ -322,6 +322,23 @@ void loop() {
 
   time = millis();
   Serial.println("Time: " );
+  
+  
+  
+   Slave_Ports_Status__DISPLAY_TARGET(
+         Slave_Ports_Status_A ,
+         Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
+          0 ,
+           DISPLAY_A ,
+             DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
+             DISPLAY_PHYSICAL_CHAR_A, 
+        DISPLAY_pos_seq_A_NEXT + DISPLAY_pos_seq_A_IMMEDIATE,
+        "336 DISPLAYDarray16_A  comment init",
+        DISPLAY_TARGET_DISPLAY128,
+       0,
+        0
+     );
+                
  // Serial.println(time);
       #include "_SlaveID_loop1.h" //todo PCINT
       #include "_ControllerID_loop1.h"  //todo make default
@@ -329,14 +346,16 @@ void loop() {
   #include "__main_loop_end.h"
   // DISPLAY_DEV.setCursor(10,10);
   //   DISPLAY_DEV.print(" Test307");
-  
+  /*
   DISPLAY__print_ANY(
                     DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
                     DISPLAY_PHYSICAL_CHAR_A,
                     DISPLAY_pos_seq_A_NEXT,
                     "123456789012345678901234567890" 
-        );     
-  delay(5000);
+        );     */
+        
+  delay(10000);
+  
   
 }
 

+ 15 - 8
SE/stuff/P5_Automation_can-dev-res/_CAN_setup.h

@@ -1,10 +1,15 @@
  //if(CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
   if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
+     /* TODO 
      LCDarray1="MCP2515 Init Okay";
      LCDarray2="500KBPS 16MHZ";
-   Serial.print(LCDarray1 + LCDarray2);
+     Serial.print(LCDarray1 + LCDarray2);
+     */
+   
     #if defined(HAS_LCD1602)
+     /* TODO
       LCD_print(LCDarray1, LCDarray2, LCDtim/5);
+      */
     #endif
     #if defined(HAS_TFT_ILI9163C)
       /* TODO   delay(LCDtim);  
@@ -14,14 +19,15 @@
       */ 
     #endif
   } else { 
-     LCDarray1 = "MCP2515 Init Failed";
+    /* TODO LCDarray1 = "MCP2515 Init Failed";
      LCDarray2 = "CAN_CSpin: "; 
      LCDarray2.concat(CAN_CSpin);  
      LCDarray2.concat("CAN_INTpin: ");
      LCDarray2.concat(CAN_INTpin);    
     Serial.print(LCDarray1);
+    */
       #if defined(HAS_LCD1602)
-          LCD_print(LCDarray1, LCDarray2, LCDtim / 2 ) ;
+          //LCD_print(LCDarray1, LCDarray2, LCDtim / 2 ) ;
       #endif
         /* TODO 
       #if defined(HAS_TFT_ILI9163C)
@@ -37,13 +43,14 @@
   }
 
 
-       #if Active_ControllerID == _Slave1_ID 
+//       #if Active_ControllerID == _Slave1_ID 
         #include "_SlaveID_setup.h"
-       #elif Active_ControllerID == _ControllerID
-          LCDarray1 = "Master Module       ";
+//       #elif Active_ControllerID == _ControllerID
+  /*       TODO  LCDarray1 = "Master Module       ";
           LCDarray2 = "enabling remotes        ";
-       #endif
-        Serial.println("");
+          */
+      // #endif
+    //    Serial.println("");
          #if defined(HAS_LCD1602)
            /* TODO 
           LCD_print(LCDarray1, LCDarray2, LCDtim / 5 ) ;

+ 43 - 1
SE/stuff/P5_Automation_can-dev-res/_DISPLAY_func.h

@@ -61,8 +61,39 @@ void DISPLAY__print_IMMEDIATE(
      DISPLAY_pos_seq_T DISPLAY_pos_seq_A,
      DISPLAY_array16_T DISPLAY_array16_A,
       DISPLAY_TARGET_T DISPLAY_TARGET_A) {
-        if(DISPLAY_TARGET_A | DISPLAY_TARGET_ANY){
+        
+        if(DISPLAY_TARGET_A | DISPLAY_TARGET_DISPLAY128){
+        
+                    #if defined(HAS_TFT_ILI9163C)
+                                #if defined(DEBUG)
+                                                    String message(DISPLAY_array16_A);
+                                                   Serial.print("#69A DISPLAY__print_IMMEDIATE [DEBUG] to HAS_TFT_ILI9163C  Len["); Serial.print( message.length());
+                                                     Serial.print("] XM["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A);
+                                                     Serial.print("] YM["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_Y_CHARS_A);
+                                                     Serial.print("] YC["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A);
+                                                    Serial.print("] YF["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_y_A);
+                                                   Serial.println("]  ");
+                                           #endif
+                            DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_A, DISPLAY_array16_A) ;
+                    #else 
+                
+                        Serial.println(DISPLAY_array16_A);
+                  
+                    #endif
+                             //   DISPLAY__print_ANY(DISPLAY_T_ARDUINO_ATTR_ARRAY_A, DISPLAY_PHYSICAL_CHAR_A, DISPLAY_pos_seq_A, DISPLAY_array16_A);     
+          } else if(DISPLAY_TARGET_A | DISPLAY_TARGET_ANY){
+                                        #if defined(DEBUG)
+                                                   Serial.print("#69B DISPLAY__print_IMMEDIATE [DEBUG] to DISPLAY__print_ANY  Seq["); Serial.print(DISPLAY_pos_seq_A , BIN);
+                                                    Serial.print("] Target["); Serial.print(DISPLAY_TARGET_A , BIN);
+                                                   Serial.println("]  ");
+                                           #endif
                                 DISPLAY__print_ANY(DISPLAY_T_ARDUINO_ATTR_ARRAY_A, DISPLAY_PHYSICAL_CHAR_A, DISPLAY_pos_seq_A, DISPLAY_array16_A);     
+          } else {
+                              #if defined(DEBUG)
+                                        Serial.print("#68 DISPLAY__print_IMMEDIATE [DEBUG]  else  Seq["); Serial.print(DISPLAY_pos_seq_A , BIN);
+                                         Serial.print("] Target["); Serial.print(DISPLAY_TARGET_A , BIN);
+                                        Serial.println("]  ");
+                                #endif  
           }
 
 }
@@ -80,9 +111,20 @@ void DISPLAY__print_IMMEDIATE(
                 {
                 
                     if(DISPLAY_pos_seq_A | DISPLAY_pos_seq_A_IMMEDIATE){
+                            #if defined(DEBUG)
+                                        Serial.print("#84 DISPLAY__print to DISPLAY__print_IMMEDIATE [DEBUG]  else  Seq["); Serial.print(DISPLAY_pos_seq_A , BIN);
+                                        Serial.print("] Target["); Serial.print(DISPLAY_TARGET_A , BIN); 
+                                        
+                                        Serial.println("]  ");
+                                #endif  
                            DISPLAY__print_IMMEDIATE(DISPLAY_T_ARDUINO_ATTR_ARRAY_A, DISPLAY_PHYSICAL_CHAR_A, DISPLAY_pos_seq_A,  DISPLAY_array16_A,  DISPLAY_TARGET_A);
                                      // Serial.print("#28 running _Slave_Ports_ttl_decrement = ");
                 
+                    } else {
+                          #if defined(DEBUG)
+                                 Serial.print("#88 DISPLAY__print [DEBUG]  else  "); Serial.print(DISPLAY_pos_seq_A , BIN);
+                                 Serial.println("]  ");
+                         #endif    
                     }
 }
 

+ 1 - 1
SE/stuff/P5_Automation_can-dev-res/_SlaveID_loop1.h

@@ -1,7 +1,7 @@
 if(!digitalRead(CAN_INTpin))                    // If pin 2 is low, read receive buffer
           {
             CAN0.readMsgBuf(&CANrxId, &CANlen, CANrxBuf); // Read data: len = data length, buf = data byte(s)
-            Serial.print("ID: ");
+            Serial.print("# read ID: ");
             Serial.print(CANrxId, HEX);
             Serial.print(" Data: ");
              #if defined(HAS_LCD1602)

+ 4 - 1
SE/stuff/P5_Automation_can-dev-res/_SlaveID_setup.h

@@ -1,5 +1,8 @@
-LCDarray1 = "Slave Module ";
+
+
+        /*LCDarray1 = "Slave Module ";
         LCDarray2 = "enabling filters";
+        */
         //CAN0.init_Mask(0,0,0x010F0000);                // Init first mask...
         //CAN0.init_Filt(0,0,0x01000000);                // Init first filter...
         //CAN0.init_Filt(1,0,0x01010000);                // Init second filter...

+ 5 - 5
SE/stuff/P5_Automation_can-dev-res/_Slave_Ports_Status_QUEUE_struct.h

@@ -8,8 +8,8 @@ typedef int QUEUE_ID_T ;
       QUEUE_ID_T QUEUE_ID_A ; //current queue task
        TASK_TYPE_T TASK_TYPE_A ; 
         TASK_PORT_ASSOC_T TASK_PORT_ASSOC_A; //todo link
-       long time_seq_id;
-       long time_min_run;
+       time_seq_id_T time_seq_id;
+       time_min_run_T time_min_run;
     } ;
     
     
@@ -19,7 +19,7 @@ typedef int QUEUE_ID_T ;
 
 
 
-
+/*
 
  struct _Slave_Ports_queue_tasksS {
   int queueID;
@@ -29,7 +29,7 @@ typedef int QUEUE_ID_T ;
                  0x03  request_set_new_Exp_state,
                  0x04 
                   }
-  */
+  
   int _Slave_Port_link; //todo link
  long time_seq_id;
  long time_min_run;
@@ -39,4 +39,4 @@ typedef struct _Slave_Ports_queue_tasksS _Slave_Ports_queue_tasksT;
 
 
 
-
+*/

+ 87 - 1
SE/stuff/P5_Automation_can-dev-res/_Slave_Ports_Status_func.h

@@ -53,10 +53,96 @@
 
  void Slave_Ports_Status__DISPLAY_TARGET(
         Slave_Ports_Status_T* Slave_Ports_Status_A ,
+        Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_T &Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
         Port_ID_T  Port_ID ,
-        DISPLAY_TARGET_T DISPLAY_TARGET_A
+        DISPLAY_T* DISPLAY_A ,
+        DISPLAY_T_ARDUINO_ATTR_ARRAY_T* DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
+        DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A, 
+        DISPLAY_pos_seq_T DISPLAY_pos_seq_A,
+        DISPLAY_array16_T DISPLAY_array16_A,
+        DISPLAY_TARGET_T DISPLAY_TARGET_A,
+        time_seq_id_T time_seq_id_A,
+        time_min_run_T time_min_run_A
   )
    {
+   
+   
+   
+                #if defined(DEBUG)
+                            Serial.print("#72 Port_Dspl[DEBUG] #C["); Serial.print(Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A.ARDUINO_ARRAY_COUNT_A);
+                             Serial.print("] XM["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A);
+                             Serial.print("] YM["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_Y_CHARS_A);
+                             Serial.print("] YC["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A);
+                             Serial.print("] YF["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_y_A);
+                             
+                             
+                            Serial.println("]  ");
+                    #endif    
+   
+        String message ;
+             DISPLAY__print(
+                          DISPLAY_A ,
+                          DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
+                          DISPLAY_PHYSICAL_CHAR_A, 
+                           DISPLAY_pos_seq_A,
+                            DISPLAY_array16_A,
+                            DISPLAY_TARGET_A,
+                           time_seq_id_A,
+                           time_min_run_A
+                          ); 
+        int i;
+        for(i=ARDUINO_ARRAY_INDEX_FIRST ; i <= ARDUINO_ARRAY_INDEX_LIMIT_PORTS; i++) {
+          
+                
+        
+            if(Slave_Ports_Status_A[i].Port_ID > 0) {
+            
+                #if defined(DEBUG)
+                            Serial.print("#68 Port_Dspl[DEBUG]  i "); Serial.print(i);
+                            Serial.println("]  ");
+                    #endif    
+                DISPLAY_array16_A="";
+                 message = "" ;
+                 message.concat("+P #")  ; 
+                 message.concat(i);
+                 message.concat(" ID[");
+                 message.concat(Slave_Ports_Status_A[i].Port_ID )  ; 
+                 message.concat(" ?");
+                  message.toCharArray(DISPLAY_array16_A, message.length());
+                  DISPLAY__print(
+                   DISPLAY_A ,
+                   DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
+                   DISPLAY_PHYSICAL_CHAR_A, 
+                    DISPLAY_pos_seq_A,
+                     DISPLAY_array16_A,
+                     DISPLAY_TARGET_A,
+                    time_seq_id_A,
+                    time_min_run_A
+                   ); 
+                   delay(100);
+                   message = "" ; DISPLAY_array16_A="";
+                 message.concat(Slave_Ports_Status_A[i].Exp_state )  ;
+                 message.concat(" T");
+                 message.concat(Slave_Ports_Status_A[i].Exp_state_ttl )  ;
+                 message.concat(" B[");
+                 message.concat(Slave_Ports_Status_A[i].Broadcast_state )  ;
+                 message.concat(" ");
+                 message.toCharArray(DISPLAY_array16_A, message.length());             
+                
+                 DISPLAY__print(
+                   DISPLAY_A ,
+                   DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
+                   DISPLAY_PHYSICAL_CHAR_A, 
+                    DISPLAY_pos_seq_A,
+                     DISPLAY_array16_A,
+                     DISPLAY_TARGET_A,
+                    time_seq_id_A,
+                    time_min_run_A
+                   ); 
+               delay(100);
+            }
+        }
+   
    }  
    
    

+ 20 - 12
SE/stuff/P5_Automation_can-dev-res/_TFT_ILI9163C_func.h

@@ -74,10 +74,12 @@ void DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR
          DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A = 0 ; //[ARDUINO_ATTR_ARRAY_S_INDEX]
          DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_X_CHARS_A = 0 ; //[ARDUINO_ATTR_ARRAY_S_INDEX]
     } else {
+    
          DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A ++ ; //[ARDUINO_ATTR_ARRAY_S_INDEX]
          DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_X_CHARS_A = 0 ; //[ARDUINO_ATTR_ARRAY_S_INDEX]
          
          DISPLAY_DEV.setCursor(0,DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A * DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_y_A); //[ARDUINO_ATTR_ARRAY_S_INDEX]
+         DISPLAY_DEV.fillRect(0, DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A * DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_y_A, DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_PX_A , DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_y_A  ,BLUE);
     }
     
            #if defined(DEBUG)
@@ -111,6 +113,7 @@ void  DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A
                                
                                 int parts =  floor(message.length()/ DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A ) ; //( message.length() + 100)
                                 if(message.length() >= DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A and parts == 1) parts ++; 
+                                else if(parts == 0) parts = 1;
                                 int substr_begin = 0 ;
                                 int substr_end = 0 ;
                                 int i;
@@ -122,7 +125,7 @@ void  DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A
                                      Serial.print("] #34 String["); Serial.print(message);
                                      Serial.print("] #34 frag"); Serial.print( message.substring(2, 5));
                                      Serial.print("] parts["); Serial.print( parts);
-                                     Serial.print("] XC["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A);
+                                     Serial.print("] yC["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A);
                                      Serial.println("] "); 
                                      }
                                  #endif
@@ -133,20 +136,25 @@ void  DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A
                                     //myString.substring(from, to)
                                     substr_end = substr_begin + DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A ;
                                     DISPLAY_DEV.print(message.substring(substr_begin, substr_end));
-                                       /*BUG TODO ERROR IF UNCOMMENTED
+                                       /*BUG TODO ERROR IF UNCOMMENTED*/
                                        #if defined(DEBUG)
-                                        if(DEBUG > 4) {  
-                                             // Serial.print("#112 msg part["); Serial.print(i);
-                                            // Serial.print("]  beg["); Serial.print(substr_begin);
-                                            // Serial.print("]  end["); Serial.print(substr_end);
-                                            // Serial.print("]  frag["); Serial.print(message.substring(substr_begin, substr_end));
-                                             //Serial.println("a] ");
-                                             } 
+                                       if(DEBUG > 6) {  
+                                              Serial.print("#112 msg part["); Serial.print(i);
+                                             Serial.print("]  beg["); Serial.print(substr_begin);
+                                             Serial.print("]  end["); Serial.print(substr_end);
+                                             Serial.print("]  frag["); Serial.print(message.substring(substr_begin, substr_end));
+                                             Serial.print("] yC["); Serial.print( DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A);
+                                             Serial.println("] ");
+                                            } 
                                          #endif
-                                         */
+                                         
                                         substr_begin = substr_end + 1;
-                                        if( parts >= 1 and not(i == parts))
-                                         DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_A) ; 
+                                        if( parts >= 1 and not(parts == i)) {
+                                            
+                                             DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_A) ;
+                                        } //else if(i == parts) {
+                                          //  DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_A) ;
+                                       // }
                                 } 
                                 /*BUG TODO ERROR IF UNCOMMENTED
                                 // Serial.end();    // Ends the serial communication once all data is received

+ 1 - 1
SE/stuff/P5_Automation_can-dev-res/_TFT_ILI9163C_struct.h

@@ -8,7 +8,7 @@
 DISPLAY_CURSOR_X_CHARS_T DISPLAY_CURSOR_X_CHARS_A = 0;
 DISPLAY_CURSOR_Y_CHARS_T DISPLAY_CURSOR_Y_CHARS_A = 0;
 
-    DISPLAY_textsize_x_T DISPLAY_textsize_x_A = 7; //5 nominal
+    DISPLAY_textsize_x_T DISPLAY_textsize_x_A = 6.5; //5 nominal
     DISPLAY_textsize_y_T DISPLAY_textsize_y_A = 10; //8 nominal
 
  DISPLAY_PHYSICAL_X_CHARS_T DISPLAY_PHYSICAL_X_CHARS_A = DISPLAY_PHYSICAL_X_PX_A /  DISPLAY_textsize_x_A ; //todo to test

+ 3 - 0
SE/stuff/P5_Automation_can-dev-res/config_Slave_Ports_LOCAL_init.h

@@ -33,6 +33,9 @@ ARDUINO_FUNCT_INIT_RESULT_T _Slave_Ports_LOCAL_init(Slave_Ports_Status_T* Slave_
                     DISPLAY_PHYSICAL_CHAR_A,
                     DISPLAY_pos_seq_A_NEXT,
                     "#4 _Slave_Ports_LOCAL_init");             
+                 
+                 
+     
                     
     return true ;