a.binder 5 jaren geleden
bovenliggende
commit
27f416e923

+ 51 - 9
SE/stuff/P5_Automation_can-dev-res/P5_Automation_can-dev-res.ino

@@ -76,13 +76,21 @@
  */
 
 
+#define DEBUG 5 //Debug level
 
-
+#include "__main_struct.h"
+#include "__main_struct_funct.h"
+#include "__main_struct_limits.h"
+#include "_time_struct.h"
 
 #define  _ControllerID   0x101 
 #define  _Slave1_ID   0x103 
 
 #include "config_Active_ControllerID.h"
+
+#if defined(HAS_TFT_ILI9163C)
+    #include "_TFT_ILI9163C_config.h"
+#endif
 //#include "Active_ControllerID_0x103.h"
 //#define Active_ControllerID _ControllerID 
 //#define Active_ControllerID _Slave1_ID 
@@ -116,17 +124,17 @@
   //LiquidCrystal lcd(4, 6, 10, 11, 12, 13);
   //LiquidCrystal lcd(4, 6, 53, 51, 50, 52  );
   #include "_LCD1602_struct.h"
-  #include "_LCD1602_init.h"
+ // #include "_LCD1602_init.h"
 #endif
 
 
 #if defined(HAS_TFT_ILI9163C)
-  #include "_TFT_ILI9163C_init.h"
-
+  #include "_TFT_ILI9163C_struct.h"
 #endif
 
 
 
+
 //BEGIN CAN
 
 
@@ -146,11 +154,18 @@
  #include "_Slave_Ports_Status_struct.h"
  #include "_Slave_Ports_Protocol_CAN_struct.h"
  
-
-    Slave_Ports_Status_T  Slave_Ports_Status_A[100];
-    Slave_Ports_Status_add_port_count_T lave_Ports_Status_add_port_count_A = 0;
-    
+ #if defined(HAS_TFT_ILI9163C)
+  #include "_TFT_ILI9163C_func.h"
+ #endif   
     
+#include "_DISPLAY_func.h"
+
+#if defined(HAS_LCD1602)
+  #include "_LCD1602_func.h"
+  //#include "_LCD1602_init.h"
+#endif
+
+
 #include "_TASK_TYPES_func.h"
 #include "_Slave_Ports_Status_QUEUE_func.h"
 #include "_Slave_Ports_Protocol_CAN_func.h"
@@ -171,6 +186,15 @@
  
  
  
+#if defined(HAS_LCD1602)
+  #include "_LCD1602_init.h"
+#endif
+
+#if defined(HAS_TFT_ILI9163C)
+  #include "_TFT_ILI9163C_init.h"
+#endif
+
+ 
 #include "_DISPLAY_init.h"
 
 
@@ -194,6 +218,16 @@
 
 #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,
+                 DISPLAY_A , DISPLAY_T_ARDUINO_ATTR_ARRAY_A
+                 //, DISPLAY_PHYSICAL_CHAR_A
+            );
+
+
 void setup() {
     Serial.begin(115200);
 // _LCD_print_queue.push(1);
@@ -273,7 +307,15 @@ void loop() {
       #include "_ControllerID_loop1.h"  //todo make default
   
   #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,
+                    "123456789012345678901" 
+        );     
   delay(5000);
   
 }

+ 9 - 9
SE/stuff/P5_Automation_can-dev-res/_CAN_setup.h

@@ -8,8 +8,8 @@
     #endif
     #if defined(HAS_TFT_ILI9163C)
       delay(LCDtim);  
-      display.setCursor(0,20); 
-      display.print("MCP2515 Init Okay!!\r\n");
+      DISPLAY_DEV.setCursor(0,20); 
+      DISPLAY_DEV.print("MCP2515 Init Okay!!\r\n");
       delay(LCDtim); 
     #endif
   } else { 
@@ -24,11 +24,11 @@
       #endif
       #if defined(HAS_TFT_ILI9163C)
         delay(LCDtim);  
-        display.setCursor(0,20); 
-        display.print(LCDarray1);
+        DISPLAY_DEV.setCursor(0,20); 
+        DISPLAY_DEV.print(LCDarray1);
         delay(LCDtim); 
-         display.setCursor(0,50); 
-         display.print(LCDarray2);
+         DISPLAY_DEV.setCursor(0,50); 
+         DISPLAY_DEV.print(LCDarray2);
          delay(LCDtim); 
       #endif
   }
@@ -47,9 +47,9 @@
          #endif
          #if defined(HAS_TFT_ILI9163C)
           delay(LCDtim);  
-          display.setCursor(0,30); 
-          display.print(LCDarray1); display.print(" ");
-          display.print(LCDarray2);
+          DISPLAY_DEV.setCursor(0,30); 
+          DISPLAY_DEV.print(LCDarray1); DISPLAY_DEV.print(" ");
+          DISPLAY_DEV.print(LCDarray2);
 
           delay(LCDtim); 
          #endif

+ 84 - 0
SE/stuff/P5_Automation_can-dev-res/_DISPLAY_func.h

@@ -0,0 +1,84 @@
+//_DISPLAY_func.h
+
+/* #if defined(HAS_TFT_ILI9163C)
+                                    delay(LCDtim);  
+                                    DISPLAY_DEV.setCursor(0,60); 
+                                    DISPLAY_DEV.print(LCDarray1); DISPLAY_DEV.print(" "); DISPLAY_DEV.print(LCDarray2);
+                              #endif
+                              */
+                              
+                              
+//void _DISPLAY_print
+
+
+void DISPLAY__print_ANY(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){
+              
+              
+                 Serial.print("#20 DsplY:[ "); Serial.print(DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A); //[ARDUINO_ATTR_ARRAY_S_INDEX]
+                Serial.print("] # MaxY:["); Serial.print(DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_Y_CHARS_A); //[ARDUINO_ATTR_ARRAY_S_INDEX]
+                 Serial.println("] ");
+                 #if defined(HAS_TFT_ILI9163C)
+                            Serial.print(" [HAS_TFT_ILI9163C] ");
+                 #endif
+                     #if defined(DEBUG)
+                            Serial.print(" [DEBUG] ");
+                    #endif 
+                Serial.println("] "); 
+              
+                //todo position current   
+                //todo positions max
+                    #if defined(HAS_TFT_ILI9163C)
+                            DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_A, DISPLAY_array16_A) ;
+                    #else 
+                
+                        Serial.println(DISPLAY_array16_A);
+                  
+                    #endif
+                     
+                
+        }
+
+
+
+void DISPLAY__print_IMMEDIATE(
+    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) {
+        if(DISPLAY_TARGET_A | DISPLAY_TARGET_ANY){
+                                DISPLAY__print_ANY(DISPLAY_T_ARDUINO_ATTR_ARRAY_A, DISPLAY_PHYSICAL_CHAR_A, DISPLAY_pos_seq_A, DISPLAY_array16_A);     
+          }
+
+}
+
+ void DISPLAY__print(
+        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(DISPLAY_pos_seq_A | DISPLAY_pos_seq_A_IMMEDIATE){
+                           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 = ");
+                
+                    }
+}
+
+        
+        
+        
+        
+
+
+
+

+ 18 - 0
SE/stuff/P5_Automation_can-dev-res/_DISPLAY_init.h

@@ -1,2 +1,20 @@
 int LCDtim = 250 ;//the value of delay time
 
+
+
+
+
+    DISPLAY_T  DISPLAY_A[ARDUINO_ARRAY_INDEX_LIMIT_DISPLAY] = {} ;
+    DISPLAY_T_ARDUINO_ATTR_ARRAY_T DISPLAY_T_ARDUINO_ATTR_ARRAY_A[ARDUINO_ATTR_ARRAY_S_INDEX] = { 
+        {    ARDUINO_ARRAY_INDEX_CURRENT_INIT ,
+             ARDUINO_ARRAY_INDEX_LAST_INIT ,
+             ARDUINO_ARRAY_COUNT_T_INIT ,
+             ARDUINO_ARRAY_INDEX_LIMIT_PORTS}
+    };
+    DISPLAY_ARDUINO_ARRAY_INDEX_TABLE_T        DISPLAY_ARDUINO_ARRAY_INDEX_TABLE_A[ARDUINO_ARRAY_INDEX_LIMIT_DISPLAY]        = {};
+    DISPLAY_ARDUINO_ARRAY_INDEX_T_TO_DELETE_T  DISPLAY_ARDUINO_ARRAY_INDEX_T_TO_DELETE_A[ARDUINO_ARRAY_INDEX_T_TO_DELETE_S_LIMIT]  = {};  
+   
+    
+    
+    
+    

+ 66 - 11
SE/stuff/P5_Automation_can-dev-res/_DISPLAY_struct.h

@@ -1,20 +1,75 @@
 
 
-typedef  char LCDarray16_T[16] ;
+typedef  char DISPLAY_array16_T[16] ;
 
 
-typedef  int LCD_pos_seq_T ; //reqiested position in LCD
-    #define  LCD_pos_seq_A_NEXT 0x01
+ typedef int DISPLAY_PHYSICAL_X_PX_T ;
+ typedef int DISPLAY_PHYSICAL_Y_PX_T ;
 
-typedef  int LCD_pos_id_T ; //reqiested position id in LCD
+
+ typedef int DISPLAY_PHYSICAL_X_CHARS_T ;
+ typedef int DISPLAY_PHYSICAL_Y_CHARS_T ;
+
+ typedef int DISPLAY_CURSOR_X_CHARS_T ;
+ typedef int DISPLAY_CURSOR_Y_CHARS_T ;
+ 
+ 
+  typedef int DISPLAY_textsize_T ;
+  typedef DISPLAY_textsize_T DISPLAY_textsize_x_T ;
+  typedef DISPLAY_textsize_T DISPLAY_textsize_y_T ;
+
+
+
+
+
+typedef  int DISPLAY_pos_seq_T ; //reqiested position in LCD
+    const DISPLAY_pos_seq_T DISPLAY_pos_seq_A_EXACT            = B00000001;
+    const DISPLAY_pos_seq_T DISPLAY_pos_seq_A_NEXT             = B00000010;
+    const DISPLAY_pos_seq_T DISPLAY_pos_seq_A_IMMEDIATE        = B00000100;
+    const DISPLAY_pos_seq_T DISPLAY_pos_seq_A_QUEUE            = B00001000;
+    const DISPLAY_pos_seq_T DISPLAY_pos_seq_A_ATTIME           = B00010000;
+    const DISPLAY_pos_seq_T DISPLAY_pos_seq_A_INVALIDAFTER     = B00100000;
+typedef  int DISPLAY_pos_id_T ; //reqiested position id in LCD
 
  
+typedef int DISPLAY_TARGET_T ;
 
- struct _DISPLAY_LCD {
+ struct DISPLAY_S {
       int _queue_id ; //current queue task
-       LCD_pos_seq_T LCD_pos_seq_A = LCD_pos_seq_A_NEXT;
-       LCD_pos_id_T LCD_pos_id_A;
-       LCDarray16_T LCDarray16_A ; 
-       long time_seq_id;
-       long time_min_run;
-    } ;
+       DISPLAY_pos_seq_T DISPLAY_pos_seq_A = DISPLAY_pos_seq_A_NEXT;
+       DISPLAY_pos_id_T DISPLAY_pos_id_A;
+       DISPLAY_array16_T DISPLAYDarray16_A ;
+       DISPLAY_TARGET_T DISPLAY_TARGET_A ; 
+       time_seq_id_T time_seq_id_A;
+       time_min_run_T time_min_run_A;
+    } ;
+    
+typedef struct DISPLAY_S DISPLAY_T ;
+    
+ 
+ struct DISPLAY_PHYSICAL_CHAR_S {
+ 
+           DISPLAY_PHYSICAL_X_PX_T DISPLAY_PHYSICAL_X_PX_A ;
+           DISPLAY_PHYSICAL_Y_PX_T DISPLAY_PHYSICAL_Y_PX_A ;
+           DISPLAY_PHYSICAL_X_CHARS_T DISPLAY_PHYSICAL_X_CHARS_A;
+           DISPLAY_PHYSICAL_Y_CHARS_T DISPLAY_PHYSICAL_Y_CHARS_A;
+           DISPLAY_CURSOR_X_CHARS_T DISPLAY_CURSOR_X_CHARS_A;
+           DISPLAY_CURSOR_Y_CHARS_T DISPLAY_CURSOR_Y_CHARS_A ;
+           DISPLAY_textsize_x_T DISPLAY_textsize_x_A;
+           DISPLAY_textsize_y_T DISPLAY_textsize_y_A;
+ } ;
+ 
+ 
+ const DISPLAY_TARGET_T  DISPLAY_TARGET_CONSOLE      = B00000001 ;
+ const DISPLAY_TARGET_T  DISPLAY_TARGET_LCD16        = B00000010 ;
+ const DISPLAY_TARGET_T  DISPLAY_TARGET_DISPLAY128   = B00000100 ;
+ const DISPLAY_TARGET_T  DISPLAY_TARGET_ALL          =            DISPLAY_TARGET_CONSOLE + DISPLAY_TARGET_LCD16 + DISPLAY_TARGET_DISPLAY128 ;
+ const DISPLAY_TARGET_T  DISPLAY_TARGET_ANY          = B00001000 + DISPLAY_TARGET_CONSOLE + DISPLAY_TARGET_LCD16 + DISPLAY_TARGET_DISPLAY128 ;
+ 
+ 
+ 
+ typedef struct ARDUINO_ATTR_ARRAY_S DISPLAY_T_ARDUINO_ATTR_ARRAY_T[1]; //todo test if working
+
+ 
+typedef struct ARDUINO_ARRAY_INDEX_TABLE_S         DISPLAY_ARDUINO_ARRAY_INDEX_TABLE_T ; //DEFAULT INDEX TABLE
+typedef struct ARDUINO_ARRAY_INDEX_T_TO_DELETE_S   DISPLAY_ARDUINO_ARRAY_INDEX_T_TO_DELETE_T;

+ 266 - 0
SE/stuff/P5_Automation_can-dev-res/_LCD1602_func.h

@@ -0,0 +1,266 @@
+
+
+void LCD_print_background_add(_LCD_print_bufforT* _LCD_print_buffors, int screenID, int cursor1, int cursor2, char character ,long time_seq_id, long time_min_run ) {
+  //time_seq_id - used to maintain single display context
+  //time_max - used to how much time to keep in displayed text
+ // Serial.println("  runned LCD_print_background_screen_add bbuf:  ");
+     // Serial.print(sizeof(_LCD_print_buffors));
+       Serial.print("CB:");
+      int curr_buf_ind;
+      int i ;
+       for(i=1;i<=100;i++) {
+          if(_LCD_print_buffors[i].screenID<=0) {
+            Serial.print("i<=0[");   Serial.print(i);   Serial.print("]");  
+            curr_buf_ind = i; 
+            //if(_LCD_print_buffors[i + 1].screenID<=0)
+            break;
+          }
+       }
+              Serial.print(curr_buf_ind);   Serial.print(".  ");
+//char b = character.charAt(0); 
+   Serial.print(" added lcd buf at ind "); Serial.println(curr_buf_ind );
+   int b_ascii_value = character;
+_LCD_print_buffors[curr_buf_ind] = { screenID , cursor1 , cursor2, b_ascii_value, time_seq_id , time_min_run} ;
+/*
+     _LCD_print_buffors[screenID].screenID=screenID ;
+     _LCD_print_buffors[screenID].cursor1=cursor1 ;
+     _LCD_print_buffors[screenID].cursor2=cursor2 ;
+     _LCD_print_buffors[screenID].character=b_ascii_value ;
+     _LCD_print_buffors[screenID].time_seq_id=time_seq_id ;
+     _LCD_print_buffors[screenID].time_min_run=time_min_run ;
+     */
+}
+
+
+void LCD_print_background_screen_add(_LCD_print_screensT* _LCD_print_screens, int screenID,long time_seq_id, long time_min_run, char LCDarray1, char LCDarray2 ) {
+  //time_seq_id - used to maintain single display context
+  //time_max - used to how much time to keep in displayed text
+  
+     _LCD_print_screens[screenID].screenID=screenID ;
+     _LCD_print_screens[screenID].time_seq_id=time_seq_id ;
+     _LCD_print_screens[screenID].time_min_run=time_min_run ;
+     _LCD_print_screens[screenID].LCDarray1=LCDarray1 ;
+     _LCD_print_screens[screenID].LCDarray2=LCDarray2 ;
+   Serial.print(" added to screen a1  "); Serial.println(String(LCDarray1) );
+ 
+    //  unsigned char LCDarray2buf[16];
+    //   LCDarray2.toCharArray(LCDarray2buf, 15);
+  /*
+                                     for ( int positionCounter1 = 0;
+                                        positionCounter1 < 24; positionCounter1++)
+                                            {
+                                              LCD_print_background_add( _LCD_print_buffors,            screenID,           positionCounter1,           0,              LCDarray1[positionCounter1],              time_seq_id,              time_min_run);
+                                              Serial.print("A.");
+                                            }
+                                         
+                                     for ( int positionCounter2 = 0;
+                                        positionCounter2 < 24; positionCounter2++)
+                                            {
+                                            LCD_print_background_add( _LCD_print_buffors,            screenID,           positionCounter2,           1,              LCDarray2[positionCounter2],              time_seq_id,              time_min_run);
+                                            }
+         Serial.print(" :");
+        Serial.print(sizeof(_LCD_print_buffors));
+       Serial.print(" :");
+       */
+}
+
+
+//  _LCD_print_bufforT  _LCD_print_bufforss[] = {  0 , 0, "T", 10000, 50000 } ;
+
+
+void LCD_print_background(int cursor1, int cursor2, int character ,long time_seq_id, long time_min_run ) {
+  //time_seq_id - used to maintain single display context
+  //time_max - used to how much time to keep in displayed text
+}
+
+
+ 
+
+void _LCD_print_screens_list(_LCD_print_screensT* _LCD_print_screens ) {
+ int i;
+
+
+   Serial.print("sizeof(_LCD_print_screens): ");
+    Serial.println(sizeof(_LCD_print_screens));
+ for(i=0;i<=10;i++) { //sizeof(_LCD_print_buffors)
+          Serial.print(" $i[");
+          Serial.print(i);
+
+          Serial.print("] screenID: ");
+          Serial.print(_LCD_print_screens[i].screenID);
+
+
+           String str((char*) _LCD_print_screens[i].LCDarray1);
+
+          Serial.print(" LCDarray1 ph: ");
+          Serial.println( str);
+
+
+          Serial.print(" LCDarray1 len: ");
+          Serial.println( sizeof(str));
+         
+         
+          Serial.print(" LCDarray1: ");
+          Serial.println( Serial.println((char*) _LCD_print_screens[i].LCDarray1) );
+     
+           Serial.print(" LCDarray2: ");
+          Serial.write(_LCD_print_screens[i].LCDarray2);
+
+           Serial.print(" time_seq_id: ");
+           
+          Serial.write( _LCD_print_screens[i].time_seq_id );
+          
+
+       
+           Serial.print(" time_seq_id: ");
+          Serial.println(_LCD_print_screens[i].time_seq_id);
+
+        
+
+      
+        }
+      
+}
+
+
+void _LCD_print_buffors_list(_LCD_print_bufforT* _LCD_print_buffors, int LCDtim ) {
+ int i;
+   Serial.print("sizeof(_LCD_print_buffors): ");
+    Serial.println(sizeof(_LCD_print_buffors));
+ for(i=0;i<=100;i++) { //sizeof(_LCD_print_buffors)
+          Serial.print(" $i[");
+          Serial.print(i);
+
+          Serial.print("] _LCD_print_buffors screenID: ");
+          Serial.print(_LCD_print_buffors[i].screenID);
+          
+          Serial.print(" cursor1: ");
+          Serial.print(_LCD_print_buffors[i].cursor1);
+           Serial.print(" cursor2: ");
+          Serial.print(_LCD_print_buffors[i].cursor2);
+
+           Serial.print(" character: ");
+           
+          Serial.write( _LCD_print_buffors[i].character );
+          
+
+       
+           Serial.print(" time_seq_id: ");
+          Serial.print(_LCD_print_buffors[i].time_seq_id);
+
+          Serial.print(" time_min_run: ");  
+          Serial.println(_LCD_print_buffors[i].time_min_run);
+
+      
+        }
+        lcd.setCursor(0,0); 
+       lcd.print("print_buffors");  // Print a message to the LCD.
+        lcd.setCursor(0,1); 
+         lcd.print(String( _LCD_print_buffors[0].character)); 
+          lcd.print(" , "); 
+           lcd.print(String( _LCD_print_buffors[1].character)); 
+         delay(LCDtim * 5);
+}
+
+void LCD_print(String LCDarray1, String LCDarray2 ,int LCDtim) {
+
+      delay(LCDtim);   
+      unsigned char LCDarray1buf[16];
+      LCDarray1.toCharArray(LCDarray1buf, 16);
+ 
+      unsigned char LCDarray2buf[16];
+       LCDarray2.toCharArray(LCDarray2buf, 16);
+
+     // lcd.setCursor(0,0); 
+     // lcd.print(LCDarray1);
+     // lcd.setCursor(0,1); 
+     // lcd.print(LCDarray1);
+
+                                        lcd.setCursor(16,0); 
+ 
+                                         for ( int positionCounter1 = 0;
+                                        positionCounter1 <= 24 ;//LCDarray1.length(); // 24;
+                                        positionCounter1++)
+                                            {
+                                              lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
+                                              if(positionCounter1 >= LCDarray1.length())  lcd.print(" ");
+                                              else lcd.print(LCDarray1[positionCounter1]);  // Print a message to the LCD.
+                                              delay(LCDtim);  //wait for 250 microseconds
+                                              if(positionCounter1==10) delay(LCDtim *7 ); 
+                                            }
+                                          //  lcd.clear();  //Clears the LCD screen and positions the cursor in the upper-left corner.
+
+
+
+
+                                          
+                                          lcd.setCursor(16,1); 
+                                         for ( int positionCounter2 = 0;
+                                        positionCounter2 <= 24;//LCDarray2.length();//24; 
+                                        positionCounter2++)
+                                            {
+                                              lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
+                                              if(positionCounter2 >= LCDarray2.length())  lcd.print(" "); 
+                                              else lcd.print(LCDarray2[positionCounter2]);  // Print a message to the LCD.
+                                              delay(LCDtim);  //wait for 250 microseconds
+                                               if(positionCounter2==10) delay(LCDtim *7 );
+                                            }
+                                            delay(LCDtim  * 5);  //wait for 250 microseconds
+                                          //  lcd.clear();  //Clears the LCD screen and positions the cursor in the upper-left corner.
+                                           
+
+      
+      delay(LCDtim);   
+
+      
+
+/*
+
+struct record
+{
+   int bookId;
+   int qtyInStock;
+
+};
+typedef struct record Record;
+
+void sold(int id, Record* records) {
+  int i;
+  for(i=0;i<3;i++) {
+    if(records[i].bookId == id) {
+      records[i].qtyInStock--;
+    }
+  }
+}
+*/
+/*
+void updateId(int id, int new_id, Record* records) {
+  int i;
+  for(i=0;i<3;i++) {
+    if(records[i].bookId == id) {
+        records[i].bookid = new_id;
+    }
+  }
+}
+*/
+/*
+void updateQty(int id, int new_qty, Record* records) {
+  int i;
+  for(i=0;i<3;i++) {
+    if(records[i].bookId == id) {
+        records[i].qtyInStock = new_qty;
+    }
+  }
+}
+*/
+
+
+}           
+                            
+String make_str16(String str){
+    for(int i = 0; i < (16 - str.length()); i++)
+        str += ' ';  
+    return str;
+}
+                
+                     

+ 1 - 266
SE/stuff/P5_Automation_can-dev-res/_LCD1602_init.h

@@ -6,269 +6,4 @@ Queue<int> _LCD_print_queue = Queue<int>(5);
  _LCD_print_bufforT _LCD_print_buffors[1];
  _LCD_print_screensT _LCD_print_screens[10];
 
-
-
-void LCD_print_background_add(_LCD_print_bufforT* _LCD_print_buffors, int screenID, int cursor1, int cursor2, char character ,long time_seq_id, long time_min_run ) {
-  //time_seq_id - used to maintain single display context
-  //time_max - used to how much time to keep in displayed text
- // Serial.println("  runned LCD_print_background_screen_add bbuf:  ");
-     // Serial.print(sizeof(_LCD_print_buffors));
-       Serial.print("CB:");
-      int curr_buf_ind;
-      int i ;
-       for(i=1;i<=100;i++) {
-          if(_LCD_print_buffors[i].screenID<=0) {
-            Serial.print("i<=0[");   Serial.print(i);   Serial.print("]");  
-            curr_buf_ind = i; 
-            //if(_LCD_print_buffors[i + 1].screenID<=0)
-            break;
-          }
-       }
-              Serial.print(curr_buf_ind);   Serial.print(".  ");
-//char b = character.charAt(0); 
-   Serial.print(" added lcd buf at ind "); Serial.println(curr_buf_ind );
-   int b_ascii_value = character;
-_LCD_print_buffors[curr_buf_ind] = { screenID , cursor1 , cursor2, b_ascii_value, time_seq_id , time_min_run} ;
-/*
-     _LCD_print_buffors[screenID].screenID=screenID ;
-     _LCD_print_buffors[screenID].cursor1=cursor1 ;
-     _LCD_print_buffors[screenID].cursor2=cursor2 ;
-     _LCD_print_buffors[screenID].character=b_ascii_value ;
-     _LCD_print_buffors[screenID].time_seq_id=time_seq_id ;
-     _LCD_print_buffors[screenID].time_min_run=time_min_run ;
-     */
-}
-
-
-void LCD_print_background_screen_add(_LCD_print_screensT* _LCD_print_screens, int screenID,long time_seq_id, long time_min_run, char LCDarray1, char LCDarray2 ) {
-  //time_seq_id - used to maintain single display context
-  //time_max - used to how much time to keep in displayed text
-  
-     _LCD_print_screens[screenID].screenID=screenID ;
-     _LCD_print_screens[screenID].time_seq_id=time_seq_id ;
-     _LCD_print_screens[screenID].time_min_run=time_min_run ;
-     _LCD_print_screens[screenID].LCDarray1=LCDarray1 ;
-     _LCD_print_screens[screenID].LCDarray2=LCDarray2 ;
-   Serial.print(" added to screen a1  "); Serial.println(String(LCDarray1) );
- 
-    //  unsigned char LCDarray2buf[16];
-    //   LCDarray2.toCharArray(LCDarray2buf, 15);
-  /*
-                                     for ( int positionCounter1 = 0;
-                                        positionCounter1 < 24; positionCounter1++)
-                                            {
-                                              LCD_print_background_add( _LCD_print_buffors,            screenID,           positionCounter1,           0,              LCDarray1[positionCounter1],              time_seq_id,              time_min_run);
-                                              Serial.print("A.");
-                                            }
-                                         
-                                     for ( int positionCounter2 = 0;
-                                        positionCounter2 < 24; positionCounter2++)
-                                            {
-                                            LCD_print_background_add( _LCD_print_buffors,            screenID,           positionCounter2,           1,              LCDarray2[positionCounter2],              time_seq_id,              time_min_run);
-                                            }
-         Serial.print(" :");
-        Serial.print(sizeof(_LCD_print_buffors));
-       Serial.print(" :");
-       */
-}
-
-
-//  _LCD_print_bufforT  _LCD_print_bufforss[] = {  0 , 0, "T", 10000, 50000 } ;
-
-
-void LCD_print_background(int cursor1, int cursor2, int character ,long time_seq_id, long time_min_run ) {
-  //time_seq_id - used to maintain single display context
-  //time_max - used to how much time to keep in displayed text
-}
-
-
- 
-
-void _LCD_print_screens_list(_LCD_print_screensT* _LCD_print_screens ) {
- int i;
-
-
-   Serial.print("sizeof(_LCD_print_screens): ");
-    Serial.println(sizeof(_LCD_print_screens));
- for(i=0;i<=10;i++) { //sizeof(_LCD_print_buffors)
-          Serial.print(" $i[");
-          Serial.print(i);
-
-          Serial.print("] screenID: ");
-          Serial.print(_LCD_print_screens[i].screenID);
-
-
-           String str((char*) _LCD_print_screens[i].LCDarray1);
-
-          Serial.print(" LCDarray1 ph: ");
-          Serial.println( str);
-
-
-          Serial.print(" LCDarray1 len: ");
-          Serial.println( sizeof(str));
-         
-         
-          Serial.print(" LCDarray1: ");
-          Serial.println( Serial.println((char*) _LCD_print_screens[i].LCDarray1) );
-     
-           Serial.print(" LCDarray2: ");
-          Serial.write(_LCD_print_screens[i].LCDarray2);
-
-           Serial.print(" time_seq_id: ");
-           
-          Serial.write( _LCD_print_screens[i].time_seq_id );
-          
-
-       
-           Serial.print(" time_seq_id: ");
-          Serial.println(_LCD_print_screens[i].time_seq_id);
-
-        
-
-      
-        }
-      
-}
-
-
-void _LCD_print_buffors_list(_LCD_print_bufforT* _LCD_print_buffors, int LCDtim ) {
- int i;
-   Serial.print("sizeof(_LCD_print_buffors): ");
-    Serial.println(sizeof(_LCD_print_buffors));
- for(i=0;i<=100;i++) { //sizeof(_LCD_print_buffors)
-          Serial.print(" $i[");
-          Serial.print(i);
-
-          Serial.print("] _LCD_print_buffors screenID: ");
-          Serial.print(_LCD_print_buffors[i].screenID);
-          
-          Serial.print(" cursor1: ");
-          Serial.print(_LCD_print_buffors[i].cursor1);
-           Serial.print(" cursor2: ");
-          Serial.print(_LCD_print_buffors[i].cursor2);
-
-           Serial.print(" character: ");
-           
-          Serial.write( _LCD_print_buffors[i].character );
-          
-
-       
-           Serial.print(" time_seq_id: ");
-          Serial.print(_LCD_print_buffors[i].time_seq_id);
-
-          Serial.print(" time_min_run: ");  
-          Serial.println(_LCD_print_buffors[i].time_min_run);
-
-      
-        }
-        lcd.setCursor(0,0); 
-       lcd.print("print_buffors");  // Print a message to the LCD.
-        lcd.setCursor(0,1); 
-         lcd.print(String( _LCD_print_buffors[0].character)); 
-          lcd.print(" , "); 
-           lcd.print(String( _LCD_print_buffors[1].character)); 
-         delay(LCDtim * 5);
-}
-
-void LCD_print(String LCDarray1, String LCDarray2 ,int LCDtim) {
-
-      delay(LCDtim);   
-      unsigned char LCDarray1buf[16];
-      LCDarray1.toCharArray(LCDarray1buf, 16);
- 
-      unsigned char LCDarray2buf[16];
-       LCDarray2.toCharArray(LCDarray2buf, 16);
-
-     // lcd.setCursor(0,0); 
-     // lcd.print(LCDarray1);
-     // lcd.setCursor(0,1); 
-     // lcd.print(LCDarray1);
-
-                                        lcd.setCursor(16,0); 
- 
-                                         for ( int positionCounter1 = 0;
-                                        positionCounter1 <= 24 ;//LCDarray1.length(); // 24;
-                                        positionCounter1++)
-                                            {
-                                              lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
-                                              if(positionCounter1 >= LCDarray1.length())  lcd.print(" ");
-                                              else lcd.print(LCDarray1[positionCounter1]);  // Print a message to the LCD.
-                                              delay(LCDtim);  //wait for 250 microseconds
-                                              if(positionCounter1==10) delay(LCDtim *7 ); 
-                                            }
-                                          //  lcd.clear();  //Clears the LCD screen and positions the cursor in the upper-left corner.
-
-
-
-
-                                          
-                                          lcd.setCursor(16,1); 
-                                         for ( int positionCounter2 = 0;
-                                        positionCounter2 <= 24;//LCDarray2.length();//24; 
-                                        positionCounter2++)
-                                            {
-                                              lcd.scrollDisplayLeft();  //Scrolls the contents of the display one space to the left.
-                                              if(positionCounter2 >= LCDarray2.length())  lcd.print(" "); 
-                                              else lcd.print(LCDarray2[positionCounter2]);  // Print a message to the LCD.
-                                              delay(LCDtim);  //wait for 250 microseconds
-                                               if(positionCounter2==10) delay(LCDtim *7 );
-                                            }
-                                            delay(LCDtim  * 5);  //wait for 250 microseconds
-                                          //  lcd.clear();  //Clears the LCD screen and positions the cursor in the upper-left corner.
-                                           
-
-      
-      delay(LCDtim);   
-
-      
-
-/*
-
-struct record
-{
-   int bookId;
-   int qtyInStock;
-
-};
-typedef struct record Record;
-
-void sold(int id, Record* records) {
-  int i;
-  for(i=0;i<3;i++) {
-    if(records[i].bookId == id) {
-      records[i].qtyInStock--;
-    }
-  }
-}
-*/
-/*
-void updateId(int id, int new_id, Record* records) {
-  int i;
-  for(i=0;i<3;i++) {
-    if(records[i].bookId == id) {
-        records[i].bookid = new_id;
-    }
-  }
-}
-*/
-/*
-void updateQty(int id, int new_qty, Record* records) {
-  int i;
-  for(i=0;i<3;i++) {
-    if(records[i].bookId == id) {
-        records[i].qtyInStock = new_qty;
-    }
-  }
-}
-*/
-
-
-}           
-                            
-String make_str16(String str){
-    for(int i = 0; i < (16 - str.length()); i++)
-        str += ' ';  
-    return str;
-}
-                
-                                      
+                 

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

@@ -12,11 +12,11 @@ if(!digitalRead(CAN_INTpin))                    // If pin 2 is low, read receive
               lcd.print(" Data: ");
              #endif
          /*     #if defined(HAS_TFT_ILI9163C)
-             display.setCursor(0,40); 
-              display.print("ID: ");
-              display.print(CANrxId, HEX);
-              display.setCursor(0,50); 
-              display.print(" Data: ");
+             DISPLAY_DEV.setCursor(0,40); 
+              DISPLAY_DEV.print("ID: ");
+              DISPLAY_DEV.print(CANrxId, HEX);
+              DISPLAY_DEV.setCursor(0,50); 
+              DISPLAY_DEV.print(" Data: ");
              #endif
              */
             for(int i = 0; i<CANlen; i++)           // Print each byte of the data
@@ -28,7 +28,7 @@ if(!digitalRead(CAN_INTpin))                    // If pin 2 is low, read receive
                     lcd.print("0");
                  #endif
             //     #if defined(HAS_TFT_ILI9163C)
-            //        display.print("0");
+            //        DISPLAY_DEV.print("0");
             //     #endif
               }
               Serial.print(CANrxBuf[i], HEX);
@@ -38,8 +38,8 @@ if(!digitalRead(CAN_INTpin))                    // If pin 2 is low, read receive
                   lcd.print(" ");
                #endif
         //       #if defined(HAS_TFT_ILI9163C)
-        //          display.print(CANrxBuf[i], HEX);
-        //          display.print(" ");
+        //          DISPLAY_DEV.print(CANrxBuf[i], HEX);
+        //          DISPLAY_DEV.print(" ");
         //       #endif
 
              //  if(_Slave_Ports_queue_task_type_LIST[i]) {

+ 37 - 25
SE/stuff/P5_Automation_can-dev-res/_Slave_Ports_Status_func.h

@@ -1,37 +1,37 @@
 
  void Slave_Ports_Status_add_port(
- Slave_Ports_Status_T* Slave_Ports_Status_A , Slave_Ports_Status_add_port_count_T* Slave_Ports_Status_add_port_count_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,
  
                 int  Port_ID,
                 int  _Slave_ID,
                 PortTypes_T  PortTypes,
                 int  Address,
                 int  LocalPort,
-                int  Exp_state,
-                int  Exp_state_ttl,
-                int  Broadcast_state,
+                Exp_state_T  Exp_state,
+                Exp_state_ttl_T  Exp_state_ttl,
+                Broadcast_state_T  Broadcast_state,
                 int I2C_port,
                 //int I2C_driver
-                int I2C_driver
+                I2C_driver_T I2C_driver, 
+                IS_Local_T IS_Local_A
                 )
 {
-        int i = Slave_Ports_Status_add_port_count_A ;
-    if(Slave_Ports_Status_add_port_count_A == 0) {
-      Slave_Ports_Status_add_port_count_A ++;
-     Slave_Ports_Status_A[i].Port_ID=0x00;
-     Slave_Ports_Status_A[i]._Slave_ID=0x00;
-     Slave_Ports_Status_A[i].PortTypes=0x00;
-     Slave_Ports_Status_A[i].Address=0x00;
-     Slave_Ports_Status_A[i].LocalPort=0x00;
-     Slave_Ports_Status_A[i].Exp_state=0x00;
-     Slave_Ports_Status_A[i].Exp_state_ttl=0x00;
-     Slave_Ports_Status_A[i].Broadcast_state=0x00;
-     Slave_Ports_Status_A[i].I2C_port=0x00;
-     Slave_Ports_Status_A[i].I2C_driver=0x00;
-     Slave_Ports_Status_add_port_count_A ++;
-     
-   
-   
+        int i = Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A.ARDUINO_ARRAY_COUNT_A ;
+                if(Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A.ARDUINO_ARRAY_COUNT_A == 0) {
+                 Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A.ARDUINO_ARRAY_COUNT_A ++;
+                          Slave_Ports_Status_A[i].Port_ID=0x00;
+                          Slave_Ports_Status_A[i]._Slave_ID=0x00;
+                          Slave_Ports_Status_A[i].PortTypes=0x00;
+                          Slave_Ports_Status_A[i].Address=0x00;
+                          Slave_Ports_Status_A[i].LocalPort=0x00;
+                          Slave_Ports_Status_A[i].Exp_state=0x00;
+                          Slave_Ports_Status_A[i].Exp_state_ttl=0x00;
+                          Slave_Ports_Status_A[i].Broadcast_state=0x00;
+                          Slave_Ports_Status_A[i].I2C_port=0x00;
+                          Slave_Ports_Status_A[i].I2C_driver=0x00;
+                          Slave_Ports_Status_A[i].IS_Local_A=IS_Local_FALSE;
+                 Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A.ARDUINO_ARRAY_COUNT_A ++;   
     }
     
     Slave_Ports_Status_A[i + 1].Port_ID = Port_ID ;
@@ -44,8 +44,20 @@
     Slave_Ports_Status_A[i + 1].Broadcast_state = Broadcast_state ;
     Slave_Ports_Status_A[i + 1].I2C_port = I2C_port ;
     Slave_Ports_Status_A[i + 1].I2C_driver = I2C_driver ;
-  //  Slave_Ports_Status_A[Slave_Ports_Status_add_port_count_A + 1].I2C_driver = I2C_driver_F(I2C_driver) ;
+  //  Slave_Ports_Status_A[Slave_Ports_Status_T_ARDUINO_ARRAY_COUNT_A + 1].I2C_driver = I2C_driver_F(I2C_driver) ;
 
-    Slave_Ports_Status_add_port_count_A ++;
+    Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A.ARDUINO_ARRAY_COUNT_A ++;
   
-}
+}
+
+
+ void Slave_Ports_Status__DISPLAY_TARGET(
+        Slave_Ports_Status_T* Slave_Ports_Status_A ,
+        Port_ID_T  Port_ID ,
+        DISPLAY_TARGET_T DISPLAY_TARGET_A
+  )
+   {
+   }  
+   
+   
+ 

+ 21 - 3
SE/stuff/P5_Automation_can-dev-res/_Slave_Ports_Status_struct.h

@@ -57,9 +57,27 @@ const IS_Local_T IS_Local_TRUE = true ;
 
 typedef struct Slave_Ports_Status_S Slave_Ports_Status_T;
 
-typedef int Slave_Ports_Status_add_port_count_T;
-typedef Slave_Ports_Status_add_port_count_T Slave_Ports_Status_add_port_count_A ;
+typedef struct ARDUINO_ATTR_ARRAY_S Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_T;
 
 
-//#endif
+typedef struct ARDUINO_ARRAY_INDEX_TABLE_S         Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_TABLE_T ; //DEFAULT INDEX TABLE
+typedef struct ARDUINO_ARRAY_INDEX_T_TO_DELETE_S   Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_T_TO_DELETE_T;
+typedef struct ARDUINO_ARRAY_ASSOC_TABLE_S         Slave_Ports_Status_T_ARDUINO_ARRAY_ASSOC_TABLE_S_Port_ID_T ;//ASSOC FIELD Port_ID TO INDEX OF ARRAY
 
+
+
+//void ARDUINO_ARRAY_INDEX_TABLE_INIT(
+    Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_TABLE_T        Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_TABLE_A[ARDUINO_ARRAY_INDEX_LIMIT_PORTS]        = {};
+    Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_T_TO_DELETE_T  Slave_Ports_Status_T_ARDUINO_ARRAY_INDEX_T_TO_DELETE_A[ARDUINO_ARRAY_INDEX_T_TO_DELETE_S_LIMIT]  = {};  
+   
+//);
+
+
+    Slave_Ports_Status_T  Slave_Ports_Status_A[ARDUINO_ARRAY_INDEX_LIMIT_PORTS] = {};
+    
+    Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_T  Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A =  //[ARDUINO_ATTR_ARRAY_S_INDEX] 
+        {    ARDUINO_ARRAY_INDEX_CURRENT_INIT ,
+             ARDUINO_ARRAY_INDEX_LAST_INIT ,
+             ARDUINO_ARRAY_COUNT_T_INIT ,
+             ARDUINO_ARRAY_INDEX_LIMIT_PORTS }
+    ;

+ 4 - 4
SE/stuff/P5_Automation_can-dev-res/_Slave_Ports_broadcast_func.h

@@ -61,8 +61,8 @@
                                  #endif
                                 //  #if defined(HAS_TFT_ILI9163C)
                                 //    delay(LCDtim);  
-                                //    display.setCursor(0,60); 
-                               //     display.print(LCDarray1); display.print(" "); display.print(LCDarray2);
+                                //    DISPLAY_DEV.setCursor(0,60); 
+                               //     DISPLAY_DEV.print(LCDarray1); DISPLAY_DEV.print(" "); DISPLAY_DEV.print(LCDarray2);
                                //   #endif
 
                                       delay(5000);   // send data per 100ms
@@ -134,8 +134,8 @@
                           #endif
                                   #if defined(HAS_TFT_ILI9163C)
                                     delay(LCDtim);  
-                                    display.setCursor(0,60); 
-                                    display.print(LCDarray1); display.print(" "); display.print(LCDarray2);
+                                    DISPLAY_DEV.setCursor(0,60); 
+                                    DISPLAY_DEV.print(LCDarray1); DISPLAY_DEV.print(" "); DISPLAY_DEV.print(LCDarray2);
                                   #endif
                           delay(5000);   // send data per 100ms
 

+ 13 - 0
SE/stuff/P5_Automation_can-dev-res/_TFT_ILI9163C_config.h

@@ -0,0 +1,13 @@
+ #define TFT_ILI9163C_CSpin 7 // __CSpin // 53 // 10 //  chip select
+
+  #define TFT_ILI9163C_DCpin 8 // A0   data/command pin.   sometimes called DC, RS, ...
+
+  #define TFT_ILI9163C__RSTpin 9 //reset pin.   you must connect.   (or pullup)
+  //#define __SDA 51 //11 //+ bidirectional data pin.   Connect to MOSI
+  //#define __SCK 52 //13 //+ clock.   sometimes called SCLK, SCL, ...
+  
+  
+  
+  #include <SPI.h>
+  #include <Adafruit_GFX.h>
+  #include <TFT_ILI9163C.h>

+ 127 - 0
SE/stuff/P5_Automation_can-dev-res/_TFT_ILI9163C_func.h

@@ -0,0 +1,127 @@
+//   DISPLAY_DEV.setCursor(0,60); 
+//   DISPLAY_DEV.print(LCDarray1); DISPLAY_DEV.print(" "); DISPLAY_DEV.print(LCDarray2);
+
+
+ TFT_ILI9163C DISPLAY_DEV = TFT_ILI9163C(TFT_ILI9163C_CSpin, TFT_ILI9163C_DCpin, TFT_ILI9163C__RSTpin);
+
+//defineScrollArea
+//scroll
+//startPushData(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
+//	void 		pushData(uint16_t color);
+//	void 		endPushData();
+//fillRect(int16_t x, int16_t y, int16_t w, int16_t h,uint16_t color),
+//				setRotation(uint8_t r),
+//drawPixel(int16_t x, int16_t y, uint16_t color),
+//				drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
+//				drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
+
+/*
+ 
+void TFT_ILI9163C_BASE::defineScrollArea(uint16_t tfa, uint16_t bfa){
+    tfa += __OFFSET ;
+    int16_t vsa = _GRAMHEIGH - tfa - bfa;
+    if (vsa >= 0) {
+        writecommand(CMD_VSCLLDEF);
+        writedata16(tfa);
+        writedata16(vsa);
+        writedata16(bfa);
+    }
+}
+ 
+void TFT_ILI9163C_BASE::scroll(uint16_t ssa) {
+    if (ssa <= _TFTHEIGHT) {
+        writecommand(CMD_VSSTADRS);
+        writedata16(ssa + __OFFSET);
+    }
+}
+ 
+  
+  int16_t getCursorX(void) const { return cursor_x; }
+
+    @brief      Get text cursor Y location
+    @returns    Y coordinate in pixels
+  int16_t getCursorY(void) const { return cursor_y; };
+  
+  
+  write - 
+
+
+  tft.fillScreen();
+  unsigned long start = micros();
+  tft.setCursor(0, 0);
+  tft.setTextColor(WHITE);  
+  tft.setTextSize(1);
+  tft.println("Hello World!");
+  tft.setTextColor(YELLOW); 
+  tft.setTextSize(2);
+  tft.println(1234.56);
+  tft.setTextColor(RED);    
+  tft.setTextSize(3);
+  tft.println(0xDEAD, HEX);
+  tft.println();
+  tft.setTextColor(GREEN);
+  tft.setTextSize(4);
+  tft.println("Hello");
+  return micros() - start;
+
+*/
+
+void DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A) { 
+    if(DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A + 1 > DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_Y_CHARS_A) {//[ARDUINO_ATTR_ARRAY_S_INDEX]
+        DISPLAY_DEV.setCursor(0,0);
+         DISPLAY_DEV.clearScreen();
+           
+         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]
+    }
+    
+     #if defined(DEBUG)
+                Serial.print("#83 Dspl Y:["); Serial.print(DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A); //[ARDUINO_ATTR_ARRAY_S_INDEX]
+                Serial.print("] #MaxY:["); Serial.print(DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_Y_CHARS_A); //[ARDUINO_ATTR_ARRAY_S_INDEX]
+                Serial.println("] "); 
+            #endif
+}
+
+
+
+
+
+
+void  DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A, 
+                                DISPLAY_array16_T DISPLAY_array16_A) {
+                                DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_A) ; 
+                                
+                                 #if defined(DEBUG)
+                                     Serial.print("#34 arr16"); Serial.print(DISPLAY_array16_A);
+                                     Serial.print("#34 sizeof"); Serial.print(sizeof(DISPLAY_array16_A));
+                                     
+                                     Serial.println("] "); 
+                                 #endif
+                                //String message(DISPLAY_array16_A);
+                                //int parts =  ceil( message.length() / DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A ) ;
+                                int substr_begin = 0 ;
+                                int substr_end = 0 ;
+                                int i;
+                                
+                               /* for(i = 1 ; i<= parts; i++) {
+                                    //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));
+                                       #if defined(DEBUG)
+                                             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("] "); 
+                                         #endif
+                                        substr_begin = substr_end + 1;
+                                        if( parts > 1)  DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_A) ; 
+                                } */
+            }
+            
+            
+            

+ 7 - 11
SE/stuff/P5_Automation_can-dev-res/_TFT_ILI9163C_init.h

@@ -1,17 +1,7 @@
   //#define TFT_ILI9163C_CSpin __CSpin // 53 // 10 //  chip select
 
 
-  #include <SPI.h>
-  #include <Adafruit_GFX.h>
-  #include <TFT_ILI9163C.h>
-
-  #define TFT_ILI9163C_CSpin 7 // __CSpin // 53 // 10 //  chip select
-
-  #define TFT_ILI9163C_DCpin 8 // A0   data/command pin.   sometimes called DC, RS, ...
-
-  #define TFT_ILI9163C__RSTpin 9 //reset pin.   you must connect.   (or pullup)
-  //#define __SDA 51 //11 //+ bidirectional data pin.   Connect to MOSI
-  //#define __SCK 52 //13 //+ clock.   sometimes called SCLK, SCL, ...
+ 
 
   
   // Color definitions
@@ -26,3 +16,9 @@
 
  // TFT_ILI9163C display = TFT_ILI9163C(TFT_ILI9163C_CSpin, TFT_ILI9163C_DCpin, TFT_ILI9163C__RSTpin);
  // float p = 3.1415926;
+
+
+     //DISPLAY_DEV.begin();
+     
+     
+     

+ 11 - 8
SE/stuff/P5_Automation_can-dev-res/_TFT_ILI9163C_setup.h

@@ -1,9 +1,12 @@
-TFT_ILI9163C display = TFT_ILI9163C(TFT_ILI9163C_CSpin, TFT_ILI9163C_DCpin, TFT_ILI9163C__RSTpin);
-  float p = 3.1415926;
-     display.begin();
-     display.clearScreen();
-     display.setCursor(0,0);
-     display.print(LCDarray1);
-     display.setCursor(0,10);
-     display.print(LCDarray2);
+
+  //float p = 3.1415926;
+  //  TFT_ILI9163C display = TFT_ILI9163C(TFT_ILI9163C_CSpin, TFT_ILI9163C_DCpin, TFT_ILI9163C__RSTpin);
+     DISPLAY_DEV.begin();
+     //@param  s  Desired text size. 1 is default 6x8, 2 is 12x16, 3 is 18x24, etc
+     // DISPLAY_DEV.setTextSize(DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_x_A , DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_y_A);
+     DISPLAY_DEV.clearScreen();
+     DISPLAY_DEV.setCursor(0,0);
+     DISPLAY_DEV.print(LCDarray1);
+     DISPLAY_DEV.setCursor(0,10);
+     DISPLAY_DEV.print(LCDarray2);
      delay(LCDtim); 

+ 63 - 0
SE/stuff/P5_Automation_can-dev-res/_TFT_ILI9163C_struct.h

@@ -0,0 +1,63 @@
+
+
+//typedef struct DISPLAY_PHYSICAL_CHAR_S _TFT_ILI9163C_struct
+
+   DISPLAY_PHYSICAL_X_PX_T DISPLAY_PHYSICAL_X_PX_A = 128;
+   DISPLAY_PHYSICAL_Y_PX_T DISPLAY_PHYSICAL_Y_PX_A = 128 ;
+
+
+    DISPLAY_textsize_x_T DISPLAY_textsize_x_A = 8; //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
+
+ DISPLAY_PHYSICAL_Y_CHARS_T DISPLAY_PHYSICAL_Y_CHARS_A = DISPLAY_PHYSICAL_Y_PX_A / DISPLAY_textsize_y_A ; //todo to test
+
+
+  //struct DISPLAY_PHYSICAL_CHAR_T {  DISPLAY_PHYSICAL_CHAR_S ; } DISPLAY_PHYSICAL_CHAR_A  ;
+  
+ typedef  struct DISPLAY_PHYSICAL_CHAR_S DISPLAY_PHYSICAL_CHAR_T  ;
+
+
+/*
+struct DISPLAY_PHYSICAL_CHAR_S {
+           DISPLAY_PHYSICAL_X_CHARS_T DISPLAY_PHYSICAL_X_CHARS_A;
+        } DISPLAY_PHYSICAL_CHAR_AA;
+         
+    */
+//DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A = DISPLAY_PHYSICAL_X_CHARS_A ;
+
+   
+    //DISPLAY_PHYSICAL_CHAR_T  DISPLAY_PHYSICAL_CHAR_A;
+    
+   /* struct DISPLAY_PHYSICAL_CHAR_S DISPLAY_PHYSICAL_CHAR_A[1] ;
+    
+    DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_X_CHARS_A = DISPLAY_PHYSICAL_X_CHARS_A ;
+    DISPLAY_PHYSICAL_CHAR_A.DISPLAY_PHYSICAL_Y_CHARS_A =            20 ;
+    DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_X_CHARS_A =                 0 ; 
+    DISPLAY_PHYSICAL_CHAR_A.DISPLAY_CURSOR_Y_CHARS_A =                 0 ;
+    DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_x_A =                 DISPLAY_textsize_x_A ;
+    DISPLAY_PHYSICAL_CHAR_A.DISPLAY_textsize_y_A =                 DISPLAY_textsize_y_A ;
+     */
+          
+         /* {
+                 DISPLAY_PHYSICAL_X_CHARS_A,
+                 20 ,
+                 0, 
+                 0,
+                 DISPLAY_textsize_x_A,
+                 DISPLAY_textsize_y_A
+          }
+          */
+         //DISPLAY_PHYSICAL_CHAR_T 
+        DISPLAY_PHYSICAL_CHAR_T   DISPLAY_PHYSICAL_CHAR_A =   { 
+                 DISPLAY_PHYSICAL_X_CHARS_A ,
+                 DISPLAY_PHYSICAL_Y_CHARS_A ,
+                 DISPLAY_PHYSICAL_X_CHARS_A,
+                 DISPLAY_PHYSICAL_X_CHARS_A ,
+                 0, 
+                 0,
+                 DISPLAY_textsize_x_A,
+                 DISPLAY_textsize_y_A }
+          ;
+      

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

@@ -11,6 +11,10 @@
  _Slave_Ports_queue_back,
  _Slave_Ports_queue_peek,
  LCDtim, Slave_Ports_Status_A);
+ 
+ 
+ 
+ 
 
   //_LCD_print_buffors_list(_LCD_print_buffors) ;
   //_LCD_print_screens_list(_LCD_print_screens);

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

@@ -0,0 +1,52 @@
+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 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
+typedef ARDUINO_ARRAY_ATTR_T ARDUINO_ARRAY_COUNT_T ; //current count elements - porzadkowo
+
+typedef ARDUINO_ARRAY_ATTR_T  ARDUINO_ARRAY_INDEX_LIMIT_T ;
+
+typedef ARDUINO_ARRAY_INDEX_T ARDUINO_ARRAY_INDEX_TO_DELETE ; 
+
+
+struct ARDUINO_ATTR_ARRAY_S {
+    ARDUINO_ARRAY_INDEX_CURRENT_T ARDUINO_ARRAY_INDEX_CURRENT_A ;
+    ARDUINO_ARRAY_INDEX_LAST_T ARDUINO_ARRAY_INDEX_LAST_A ;
+    ARDUINO_ARRAY_COUNT_T ARDUINO_ARRAY_COUNT_A ;
+    ARDUINO_ARRAY_INDEX_LIMIT_T ARDUINO_ARRAY_INDEX_LIMIT_A;
+};
+
+
+
+struct ARDUINO_ARRAY_INDEX_T_TO_DELETE_S {
+    ARDUINO_ARRAY_INDEX_TO_DELETE ARDUINO_ARRAY_INDEX_TO_DELETE_A ;
+};
+
+struct ARDUINO_ARRAY_INDEX_TABLE_S { //to controll elements - like deletion etc
+   ARDUINO_ARRAY_INDEX_T ARDUINO_ARRAY_INDEX_A ;
+};
+
+
+struct ARDUINO_ARRAY_ASSOC_TABLE_S {  //to associate and cache
+   ARDUINO_ARRAY_INDEX_T ARDUINO_ARRAY_INDEX_A ; //indexed name of sth
+};
+
+
+
+
+
+const ARDUINO_ARRAY_INDEX_T  ARDUINO_ARRAY_INDEX_CORRUPT = 0  ; //for controll arrays behaviour
+const ARDUINO_ARRAY_INDEX_T  ARDUINO_ARRAY_INDEX_FIRST = 1  ; //for controll arrays behaviour
+
+const ARDUINO_ARRAY_COUNT_T ARDUINO_ARRAY_COUNT_T_INIT = 0 ; //current count elements - porzadkowo
+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_T ARDUINO_ATTR_ARRAY_S_INDEX = ARDUINO_ARRAY_INDEX_FIRST ;
+
+
+

+ 56 - 0
SE/stuff/P5_Automation_can-dev-res/__main_struct_funct.h

@@ -0,0 +1,56 @@
+//PROTOTYPES HOW TO USE ORDER ELEMENTS
+
+/*void ARDUINO_ARRAY_INDEX_TABLE_INIT(
+//MAIN_TABLE_T, MAIN_TABLE_A,
+//optional ARDUINO_ARRAY_ASSOC_TABLE_S ARDUINO_ARRAY_ASSOC_TABLE_A,
+ARDUINO_ARRAY_INDEX_TABLE_S* ARDUINO_ARRAY_INDEX_TABLE_A,
+ARDUINO_ARRAY_COUNT_T* ARDUINO_ARRAY_COUNT_A,
+ARDUINO_ARRAY_INDEX_CURRENT_T* ARDUINO_ARRAY_INDEX_CURRENT_A,
+ARDUINO_ARRAY_INDEX_LAST_T* ARDUINO_ARRAY_INDEX_LAST_A,
+ARDUINO_ARRAY_INDEX_T_TO_DELETE_S* ARDUINO_ARRAY_INDEX_T_TO_DELETE_A,  
+ARDUINO_ARRAY_INDEX_LIMIT_T* ARDUINO_ARRAY_INDEX_LIMIT_A
+
+//ASSOC TABLE
+
+) {
+
+
+}
+
+
+*/
+
+void ARDUINO_ARRAY_ASSOC_TABLE_INIT(
+    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
+) {
+
+
+}
+
+
+
+
+
+void ARDUINO_ARRAY_COUNT(
+ARDUINO_ARRAY_INDEX_TABLE_S* ARDUINO_ARRAY_INDEX_TABLE_A,
+ARDUINO_ARRAY_INDEX_T_TO_DELETE_S* ARDUINO_ARRAY_INDEX_T_TO_DELETE_A, 
+ARDUINO_ARRAY_INDEX_CURRENT_T* ARDUINO_ARRAY_INDEX_CURRENT_A,
+ARDUINO_ARRAY_INDEX_LAST_T* ARDUINO_ARRAY_INDEX_LAST_A,
+ARDUINO_ARRAY_COUNT_T* ARDUINO_ARRAY_COUNT_A
+) {
+
+
+}
+
+;
+
+
+void ARDUINO_ARRAY_DELETE(
+ARDUINO_ARRAY_INDEX_TABLE_S* ARDUINO_ARRAY_INDEX_TABLE_A,
+ARDUINO_ARRAY_INDEX_T_TO_DELETE_S* ARDUINO_ARRAY_INDEX_T_TO_DELETE_A,
+ARDUINO_ARRAY_ASSOC_TABLE_S* ARDUINO_ARRAY_ASSOC_TABLE_A
+);
+
+

+ 9 - 0
SE/stuff/P5_Automation_can-dev-res/__main_struct_limits.h

@@ -0,0 +1,9 @@
+const ARDUINO_ARRAY_INDEX_LIMIT_T  ARDUINO_ATTR_ARRAY_S_LIMIT = 1 ;
+
+const ARDUINO_ARRAY_INDEX_LIMIT_T  ARDUINO_ARRAY_INDEX_T_TO_DELETE_S_LIMIT = 5 ;
+
+
+const ARDUINO_ARRAY_INDEX_LIMIT_T  ARDUINO_ARRAY_INDEX_LIMIT_PORTS = 100 ;
+const ARDUINO_ARRAY_INDEX_LIMIT_T  ARDUINO_ARRAY_INDEX_LIMIT_DISPLAY = 10 ;
+
+

+ 20 - 5
SE/stuff/P5_Automation_can-dev-res/config_Slave_Ports_LOCAL_init.h

@@ -1,11 +1,16 @@
-void _Slave_Ports_LOCAL_init(Slave_Ports_Status_T* Slave_Ports_Status_A ,
-                Slave_Ports_Status_add_port_count_T* Slave_Ports_Status_add_port_count_A) {
 
+ARDUINO_FUNCT_INIT_RESULT_T _Slave_Ports_LOCAL_init(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_T*  DISPLAY_A ,  DISPLAY_T_ARDUINO_ATTR_ARRAY_T* DISPLAY_T_ARDUINO_ATTR_ARRAY_A
+                //,*DISPLAY_PHYSICAL_CHAR_A //DISPLAY_PHYSICAL_CHAR_T 
+                ) {
 
-                
+   //DISPLAY_T_ARDUINO_ATTR_ARRAY_A[ARDUINO_ATTR_ARRAY_S_INDEX].ARDUINO_ARRAY_INDEX_CURRENT_INIT ++;
+Serial.println("#4 _Slave_Ports_LOCAL_init");
+      
                   Slave_Ports_Status_add_port(
                                 Slave_Ports_Status_A ,
-                                Slave_Ports_Status_add_port_count_A,
+                                Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A,
                                 1,  // int  Port_ID,
                                 Active_ControllerID ,  //int  _Slave_ID,
                                 PortTypes_P2M_EXP_I2C , //int  PortTypes,
@@ -15,7 +20,17 @@ void _Slave_Ports_LOCAL_init(Slave_Ports_Status_T* Slave_Ports_Status_A ,
                                 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
+                                I2C_driver_Adafruit_PWMServoDriver ,//int I2C_driver
+                                IS_Local_TRUE 
                                 );
+                                
+                    DISPLAY__print_ANY(
+                    DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
+                    DISPLAY_PHYSICAL_CHAR_A,
+                    DISPLAY_pos_seq_A_NEXT,
+                    "#4 _Slave_Ports_LOCAL_init"
+        );             
+                                
+    return true ;
 
 }