Hi again!
Rewrote most of the code and now I got a very weird problem.
All my bool values will not become false. I Have most of them on false from the start and that works fine. When I update them they become true and that is also fine. The problem occurs when I try to set them to false. It doesn't work, it won't store 0 (od1 = 0) in the Dv value. Tried many solutions and switched command numbers for the set if's.
This is for all my digital outputs, none of them will be set to 0 again.
full code:
[code:1]
/* Reset */
if(I1 == 99 && d1 == 1){
od1 = 0; /*Polish off*/
od2 = 0; /*Running off*/
OI1 = 0; /*Buffer*/
OI2 = 1; /*Buffer Size*/
OI3 = 0; /*Produced*/
}
else{
int v = I1 - 600;
/* Polish ON */
if(v == 1 && d1 == 1){
od1 = 1;
}
else if(v == 2 && d1 == 1){
od1 = 0;
}
else{
od1 = d2;
}
/* Running */
if(v == 3 && d1 == 1){
od2 = 1;
}
else if(v == 4 && d1 == 1){
od2 = 0;
}
else{
od2 = d3;
}
/* Buffer Inc */
if(v == 5 && d1 == 1){
OI1 = I2 + 1;
}
else if(v == 6 && d1 == 1){
OI1 = I2 - 1;
}
else{
OI1 = I2;
}
/* Buffer Size Inc */
if(v == 7 && d1 == 1){
OI2 = I3 + 1;
}
else if(v == 8 && d1 == 1){
OI2 = I3 - 1;
}
else{
OI2 = I3;
}
/* Produced */
if(v == 9 && d1 == 1){
OI3 = I4 + 1;
}
else{
OI3 = I4;
}
}[/code:1]
also tried:
[code:1]
else{
int v = I1 - 600;
/* Polish ON */
if(v == 1 && d1 == 1){
od1 = 1;
}
if(v == 2 && d1 == 1){
od1 = 0;
}
//---
else{
int v = I1 - 600;
/* Polish ON */
if(v == 1 && d1 == 1){
od1 = 0;
}
if(v == 2 && d1 == 1){
od1 = 1;
}
[/code:1]