|
|
@@ -62,7 +62,7 @@
|
|
|
|
|
|
int i;
|
|
|
for(i=ARDUINO_ARRAY_INDEX_FIRST;i <= (ARDUINO_ARRAY_INDEX_FIRST + Slave_Ports_Status_T_ARDUINO_ATTR_ARRAY_A.ARDUINO_ARRAY_COUNT_A) ;i++) {
|
|
|
- if(Slave_Ports_Status_A[i].PortTypes | PortTypes_I2C) {
|
|
|
+ if(Slave_Ports_Status_A[i].PortTypes & PortTypes_I2C) { //BIN TEST
|
|
|
if(Slave_Ports_Status_A[i].Exp_state_ttl == Exp_state_ttl_TO_REFRESH ) {
|
|
|
#ifdef DEBUG
|
|
|
if(DEBUG > 4) {
|
|
|
@@ -124,11 +124,17 @@
|
|
|
if(Slave_Ports_Status_A[i].Exp_state | Exp_state_ERROR ) Serial.print(" [ | ERR ] ");
|
|
|
if(Slave_Ports_Status_A[i].Exp_state & Exp_state_ERROR ) Serial.print(" [ & ERR ] ");
|
|
|
if(Slave_Ports_Status_A[i].Exp_state | Exp_state_OFF ) Serial.print(" [ | OFF ] ");
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF ) Serial.print(" [ & OFF ] ");
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF ) Serial.print(" [ & OFF ] ");
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state == Exp_state_OFF ) Serial.print(" [ = OFF ] ");
|
|
|
+ //if !( ( z & care_bits ) ^ match_bits )
|
|
|
if (!( ( Slave_Ports_Status_A[i].Exp_state & Exp_state_SET ) ^ Exp_state_SET )) Serial.print(" [ ^ SET ] ");
|
|
|
if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000000 ) ^ Exp_state_SET )) Serial.print(" [ + SET ] ");
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B11111111 ) ^ Exp_state_SET )) Serial.print(" [ # SET ] ");
|
|
|
if (!( ( Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF ) ^ Exp_state_OFF )) Serial.print(" [ ^ OFF ] ");
|
|
|
if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000000 ) ^ Exp_state_OFF )) Serial.print(" [ + OFF ] ");
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B11111111 ) ^ Exp_state_OFF )) Serial.print(" [ # OFF ] ");
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B11111110 ) ^ B00000001 )) Serial.print(" [ < OFF ] ");
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000001 ) ^ B11111110 )) Serial.print(" [ > OFF ] ");
|
|
|
#endif
|
|
|
|
|
|
// Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
@@ -136,15 +142,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
- if(Slave_Ports_Status_A[i].PortTypes | PortTypes_SERVO) {
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state | Exp_state_ON) {
|
|
|
+ if(Slave_Ports_Status_A[i].PortTypes & PortTypes_SERVO) {
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state & Exp_state_ON) {
|
|
|
|
|
|
Adafruit_PWMServoDriver_A[I2C_INDEX_DRIVER_A].Adafruit_PWMServoDriver_V.setPWM(Slave_Ports_Status_A[i].LocalPort, 0, map(90, 0, 180, SERVOMIN, SERVOMAX));
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_SET;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_SET; //TODO TEST
|
|
|
Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
- } else if(Slave_Ports_Status_A[i].Exp_state | Exp_state_OFF) {
|
|
|
+ } else if(Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF) {
|
|
|
Adafruit_PWMServoDriver_A[I2C_INDEX_DRIVER_A].Adafruit_PWMServoDriver_V.setPWM(Slave_Ports_Status_A[i].LocalPort, 0, map(0, 0, 180, SERVOMIN, SERVOMAX));
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_SET;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_SET; //TODO TEST
|
|
|
Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
}
|
|
|
} else {
|
|
|
@@ -152,22 +158,24 @@
|
|
|
if(Slave_Ports_Status_A[i].Exp_state == Exp_state_ON ) {
|
|
|
Adafruit_PWMServoDriver_A[I2C_INDEX_DRIVER_A].Adafruit_PWMServoDriver_V.setPWM(Slave_Ports_Status_A[i].LocalPort, 3000, 3000);
|
|
|
Serial.print("#77 I2C_driver Exp_state [ON]"); Serial.print(Slave_Ports_Status_A[i].Exp_state); Serial.println("] ");
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_SET;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_SET; //TODO BITTEST
|
|
|
Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
} else if(Slave_Ports_Status_A[i].Exp_state == Exp_state_OFF ){
|
|
|
Adafruit_PWMServoDriver_A[I2C_INDEX_DRIVER_A].Adafruit_PWMServoDriver_V.setPWM(Slave_Ports_Status_A[i].LocalPort, 0, 0);
|
|
|
Serial.print("#77 I2C_driver Exp_state [OFF]"); Serial.print(Slave_Ports_Status_A[i].Exp_state); Serial.println("] ");
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_SET;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_SET; //TODO BITTEST
|
|
|
} else if(Slave_Ports_Status_A[i].Exp_state == Exp_state_BLINK ){
|
|
|
+ Serial.print("#168 I2C_driver [Exp_state_ERROR] before]"); Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Exp_state)); Serial.println("] after [");
|
|
|
Adafruit_PWMServoDriver_A[I2C_INDEX_DRIVER_A].Adafruit_PWMServoDriver_V.setPWM(Slave_Ports_Status_A[i].LocalPort, 0,2000);
|
|
|
// delay(1000);
|
|
|
Adafruit_PWMServoDriver_A[I2C_INDEX_DRIVER_A].Adafruit_PWMServoDriver_V.setPWM(Slave_Ports_Status_A[i].LocalPort, 0,1000);
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_ERROR;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_ERROR; //TODO BITTEST
|
|
|
+ Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Exp_state)); Serial.println("] ");
|
|
|
Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
} else {
|
|
|
|
|
|
Serial.print("#7555 unsupp I2C_driver Exp_state "); Serial.print(Slave_Ports_Status_A[i].Exp_state); Serial.println("] ");
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_SET + Exp_state_ERROR;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_SET | Exp_state_ERROR; //TODO BITTEST
|
|
|
Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
}
|
|
|
}
|
|
|
@@ -179,17 +187,20 @@
|
|
|
Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Exp_state)); Serial.print("] Broadcast_state[");
|
|
|
Serial.print(BIN8_to_STRING(Slave_Ports_Status_A[i].Broadcast_state)); Serial.println("] ");
|
|
|
Serial.print("#170 Exp_state[ ");
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state | Exp_state_SET ) Serial.print(" [ | SET ] ");
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state & Exp_state_SET ) Serial.print(" [ & SET ] ");
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state | Exp_state_ERROR ) Serial.print(" [ | ERR ] ");
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state & Exp_state_ERROR ) Serial.print(" [ & ERR ] ");
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state | Exp_state_OFF ) Serial.print(" [ | OFF ] ");
|
|
|
- if(Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF ) Serial.print(" [ & OFF ] ");
|
|
|
- if (!( ( Slave_Ports_Status_A[i].Exp_state & Exp_state_SET ) ^ Exp_state_SET )) Serial.print(" [ ^ SET ] ");
|
|
|
- if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000000 ) ^ Exp_state_SET )) Serial.print(" [ + SET ] ");
|
|
|
- if (!( ( Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF ) ^ Exp_state_OFF )) Serial.print(" [ ^ OFF ] ");
|
|
|
- if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000000 ) ^ Exp_state_OFF )) Serial.print(" [ + OFF ] ");
|
|
|
-
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state | Exp_state_SET ) Serial.print(" [ | SET ] ");//blad
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state & Exp_state_SET ) Serial.print(" [ & SET ] ");//opcjonalnie set
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state | Exp_state_ERROR ) Serial.print(" [ | ERR ] ");//blad
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state & Exp_state_ERROR ) Serial.print(" [ & ERR ] "); //opcjonalnie err
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state | Exp_state_OFF ) Serial.print(" [ | OFF ] ");//blad
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF ) Serial.print(" [ & OFF ] "); //dziala opcjonalnie off
|
|
|
+ if(Slave_Ports_Status_A[i].Exp_state == Exp_state_OFF ) Serial.print(" [ = OFF ] "); //dziala only off
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & Exp_state_SET ) ^ Exp_state_SET )) Serial.print(" [ ^ SET ] ");//opcjonalnie ste
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000000 ) ^ Exp_state_SET )) Serial.print(" [ + SET ] "); //not working
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & Exp_state_OFF ) ^ Exp_state_OFF )) Serial.print(" [ ^ OFF ] ");//opcjonalnie off
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000000 ) ^ Exp_state_OFF )) Serial.print(" [ + OFF ] "); //not working
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B11111111 ) ^ Exp_state_OFF )) Serial.print(" [ # OFF ] ");//only off
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B11111110 ) ^ B00000001 )) Serial.print(" [ < OFF ] "); //not working
|
|
|
+ if (!( ( Slave_Ports_Status_A[i].Exp_state & B00000001 ) ^ B11111110 )) Serial.print(" [ > OFF ] "); //not working
|
|
|
|
|
|
|
|
|
//if ((Slave_Ports_Status_A[i].Exp_state & Exp_state_SET) == (x & 0x0f)) {
|
|
|
@@ -203,7 +214,7 @@
|
|
|
|
|
|
} else {
|
|
|
Serial.print("#6699 UNPLANNED I2C_driver ADDRES "); Serial.print(Slave_Ports_Status_A[i].Address); Serial.println("] ");
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_SET + Exp_state_ERROR;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_SET | Exp_state_ERROR; //TODO BITTEST
|
|
|
Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
}
|
|
|
|
|
|
@@ -211,7 +222,7 @@
|
|
|
|
|
|
} else {
|
|
|
Serial.print("#61122 I2C_driver unsupported "); Serial.print(Slave_Ports_Status_A[i].I2C_driver); Serial.println("] ");
|
|
|
- Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state + Exp_state_SET + Exp_state_ERROR;
|
|
|
+ Slave_Ports_Status_A[i].Exp_state = Slave_Ports_Status_A[i].Exp_state | Exp_state_SET | Exp_state_ERROR; //TODO BITTEST
|
|
|
Slave_Ports_Status_A[i].Exp_state_ttl = Exp_state_ttl_IS_ACTIVE ;
|
|
|
}
|
|
|
|