a.binder пре 5 година
родитељ
комит
06ee448399

+ 6 - 6
SE/stuff/P5_Automation_can-dev-res/P5_Automation_can-dev-res.ino

@@ -81,8 +81,8 @@
 //#define HAS_ROTTARY_SW
 #define HAS__PCINT_setup //to allow interrupts
 
-
-#define DEBUG 1 //Debug level
+//Debug level
+#define DEBUG 5 
 
 #include "__main_struct.h"
 #include "__main_struct_funct.h"
@@ -367,14 +367,14 @@ void loop() {
  
 
   time = millis();
-  Serial.print("Time: " );   Serial.println(time);
 
   
     #include "__main_loop_top.h"
     
     
     if(ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A <= ARDUINO_LOOP_LATENCY_COUNTER_INIT ) {
-                
+                  Serial.print("Time: " );   Serial.println(time);
+
                 Serial.print("#331_L1 main loop top   ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init  ");
                 Serial.println(ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init);
               
@@ -392,8 +392,8 @@ void loop() {
                        DISPLAY_A ,
                          DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
                          DISPLAY_PHYSICAL_CHAR_A, 
-                    DISPLAY_pos_seq_A_NEXT + DISPLAY_pos_seq_A_IMMEDIATE,
-                    "336 PORTS:",
+                    DISPLAY_pos_seq_A_NEXT + DISPLAY_pos_seq_A_IMMEDIATE ,
+                    "PORTS:",
                     DISPLAY_TARGET_DISPLAY128,
                    millis(),
                     millis() + ARDUINO_time_seq_id_A_INCREMENT

+ 2 - 2
SE/stuff/P5_Automation_can-dev-res/_DISPLAY_func.h

@@ -45,7 +45,7 @@ void DISPLAY__print_ANY(DISPLAY_T_ARDUINO_ATTR_ARRAY_T &DISPLAY_T_ARDUINO_ATTR_A
                 //todo position current   
                 //todo positions max
                     #if defined(HAS_TFT_ILI9163C)
-                            DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_A, DISPLAY_array16_A) ;
+                            DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_A, DISPLAY_array16_A, DISPLAY_pos_seq_A) ;
                     #else 
                 
                         Serial.println(DISPLAY_array16_A);
@@ -83,7 +83,7 @@ void DISPLAY__print_IMMEDIATE(
                                                    Serial.println("]  ");
                                                 }
                                            #endif
-                            DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_A, DISPLAY_array16_A) ;
+                            DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_A, DISPLAY_array16_A,DISPLAY_pos_seq_A) ;
                     #else 
                 
                         Serial.println(DISPLAY_array16_A);

+ 1 - 0
SE/stuff/P5_Automation_can-dev-res/_DISPLAY_struct.h

@@ -29,6 +29,7 @@ typedef  int DISPLAY_pos_seq_T ; //reqiested position in LCD
     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;
+    const DISPLAY_pos_seq_T DISPLAY_pos_seq_A_CLEARSCREEN      = B01000000;
 typedef  int DISPLAY_pos_id_T ; //reqiested position id in LCD
 
  

+ 3 - 1
SE/stuff/P5_Automation_can-dev-res/_I2C_driver_Adafruit_PWMServoDriver_setup.h

@@ -6,4 +6,6 @@
 
 
 Adafruit_PWMServoDriver_0X40.begin();//Adafruit_PWMServoDriver_0X40
-Adafruit_PWMServoDriver_0X40.setPWMFreq(PortTypes_PWM_FREQ_DEFAULT);
+Adafruit_PWMServoDriver_0X40.setPWMFreq(PortTypes_PWM_FREQ_DEFAULT);
+
+     Adafruit_PWMServoDriver_0X40.setPWM(3, 1024, 2500);

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

@@ -4,7 +4,7 @@
     
      Serial.print("#550 CLK_AAdafruit_PWMServoDriver: #[");  Serial.print(encoderPos);  Serial.println(" ] ");   
      //Adafruit_PWMServoDriver_0X40.setPWM(1, 0, map(encoderPos, 0, 180, SERVOMIN, SERVOMAX));
-     Adafruit_PWMServoDriver_0X40.setPWM(2, encoderPos * 5, encoderPos * 5);
+     Adafruit_PWMServoDriver_0X40.setPWM(2, encoderPos * 5, encoderPos * 50);
 
 
 

+ 34 - 9
SE/stuff/P5_Automation_can-dev-res/_Slave_Ports_Status_func.h

@@ -133,7 +133,7 @@
                           DISPLAY_A ,
                           DISPLAY_T_ARDUINO_ATTR_ARRAY_A , 
                           DISPLAY_PHYSICAL_CHAR_A, 
-                           DISPLAY_pos_seq_A,
+                           DISPLAY_pos_seq_A + DISPLAY_pos_seq_A_CLEARSCREEN,
                             DISPLAY_array16_AAT,
                             DISPLAY_TARGET_A,
                            time_seq_id_A,
@@ -152,13 +152,15 @@
             if(Slave_Ports_Status_A[i].Port_ID > 0) {
             
                 #if defined(DEBUG)
+                        if(DEBUG > 2) {
                             Serial.print("#68 Port_Dspl[DEBUG]  i "); Serial.print(i);
                             Serial.println("]  ");
+                            }
                     #endif    
                   message = "";
-                 message.concat(":")  ; 
+                 //message.concat(":")  ; 
                  message.concat(i);
-                 message.concat("#");
+                 message.concat(".");
                  message.concat(Slave_Ports_Status_A[i].Port_ID )  ; 
                  message.concat(" ");
                  // message.toCharArray(DISPLAY_array16_AA, message.length());
@@ -174,12 +176,35 @@
                    ); 
                    delay(100);
                   // DISPLAY_array16_AA = 0 ;*/
-                   message2 = message  ; message2.concat("E:");
-                 message2.concat(Slave_Ports_Status_A[i].Exp_state )  ;
-                 message2.concat(" T:");
-                 message2.concat(Slave_Ports_Status_A[i].Exp_state_ttl )  ;
-                 message2.concat(" B:");
-                 message2.concat(Slave_Ports_Status_A[i].Broadcast_state )  ;
+                   message2 = message  ; message2.concat(" ");//E:
+                   
+                   if(Slave_Ports_Status_A[i].Exp_state & Exp_state_ERROR ) {
+                    message2 = message  ;  message2.concat(" ERR ");//E:
+                    } else {
+                   if(Slave_Ports_Status_A[i].Exp_state | Exp_state_ON ) message2 = message  ;     message2.concat(" ON  ");//E:
+                   if(Slave_Ports_Status_A[i].Exp_state | Exp_state_OFF ) message2 = message  ;    message2.concat(" OFF ");//E:
+                   }
+                   
+                     if(Slave_Ports_Status_A[i].Exp_state_ttl & Exp_state_ttl_TO_REFRESH ) {
+                         message2.concat(" R ");// B:
+                      } else {
+                        message2.concat(" "); //T:
+                        message2.concat(Slave_Ports_Status_A[i].Exp_state_ttl )  ;
+                        message2.concat(" "); //T:
+                    }
+                    if(Slave_Ports_Status_A[i].Broadcast_state & Broadcast_state_TO_REFRESH ) {
+                         message2.concat(" R ");// B:
+                    } else {
+                        message2.concat(" ");// B:
+                         message2.concat(Slave_Ports_Status_A[i].Broadcast_state )  ;
+                         message2.concat(" ");// B:
+                    }
+                    
+                     if(Slave_Ports_Status_A[i].IS_Local_A == IS_Local_TRUE) {
+                         message2.concat(" L ");// B:
+                    } else if(Slave_Ports_Status_A[i].IS_Local_A == IS_Local_FALSE) {
+                         message2.concat(" R ");// B:
+                    } 
                  //message2.concat(" ");
                  message2.toCharArray(DISPLAY_array16_AB, message2.length());             
                 

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

@@ -66,7 +66,16 @@ void TFT_ILI9163C_BASE::scroll(uint16_t ssa) {
 
 */
 
-void DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A) { 
+void DISPLAY_DEV__CURSOR__clearScreen(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A) { 
+         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]
+}
+
+
+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();
@@ -101,7 +110,9 @@ void DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR
 
 
 void  DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A, 
-                                DISPLAY_array16_T DISPLAY_array16_A) {
+                                DISPLAY_array16_T DISPLAY_array16_A , 
+                                DISPLAY_pos_seq_T DISPLAY_pos_seq_A
+                                ) {
                                 DISPLAY_DEV__CURSOR__NEWLINE(DISPLAY_PHYSICAL_CHAR_A) ; 
                                // DISPLAY_DEV.print(DISPLAY_array16_A);
                                //  unsigned char LCDarray1buf[16];
@@ -109,7 +120,7 @@ void  DISPLAY_DEV_CTRL__println(DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A
                                  
                                   String message(DISPLAY_array16_A);
                                 
-                                 
+                                if(DISPLAY_pos_seq_A & DISPLAY_pos_seq_A_CLEARSCREEN) DISPLAY_DEV__CURSOR__clearScreen(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 ++; 

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

@@ -3,7 +3,7 @@ ARDUINO_FUNCT_INIT_RESULT_T ARDUINO_FUNCT_INIT_RESULT__Slave_Ports_LOCAL_init ;
 
 
 
-ARDUINO_LOOP_LATENCY_T                  ARDUINO_LOOP_LATENCY__MAIN_A = 10 ; //EVERY 10 LOOPS INIT THIS LATENCY
+ARDUINO_LOOP_LATENCY_T                  ARDUINO_LOOP_LATENCY__MAIN_A = 100 ; //EVERY 10 LOOPS INIT THIS LATENCY
 ARDUINO_LOOP_LATENCY_COUNTER_T  ARDUINO_LOOP_LATENCY_COUNTER__MAIN_A = ARDUINO_LOOP_LATENCY_COUNTER_INIT ; //WILL decrement
 
 

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

@@ -1,7 +1,7 @@
 //#define Active_ControllerID _ControllerID 
 #define Active_ControllerID _Slave1_ID 
 
-//#define HAS_TFT_ILI9163C 
+#define HAS_TFT_ILI9163C 
 // #define HAS_LCD1602 
 #define HAS_ROTTARY_SW