major update, individual box control, fans, and more
This commit is contained in:
parent
a9179ad1f2
commit
4d84d3a40d
448
Greenhouse.ino
448
Greenhouse.ino
@ -147,7 +147,8 @@ word pinA15 = A15;
|
||||
#define TS_MAXY 900
|
||||
|
||||
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 333);
|
||||
|
||||
boolean fani = false;
|
||||
boolean fano = false;
|
||||
String outtext = "";
|
||||
String oldtext = "";
|
||||
boolean fastboot = false;
|
||||
@ -159,11 +160,20 @@ boolean s1, s2, s3, s4;
|
||||
String outtext2 = "";
|
||||
int linecount = 0;
|
||||
int brightness = 255;
|
||||
int uda[] = {200, 30, 100, 20, 300};
|
||||
int uda[] = {200, 30, 20, 20, 300};
|
||||
int sla[] = {10, 90, 300, 280};
|
||||
int go = true;
|
||||
int trange[] = {60, 100}
|
||||
int hrange[] = {30, 70}
|
||||
int trange[] = {60, 100};
|
||||
int hrange[] = {55, 85};
|
||||
boolean b1[] = {true, false};
|
||||
boolean b2[] = {true, false};
|
||||
boolean b3[] = {true, false};
|
||||
boolean b4[] = {true, false};
|
||||
int ud1[] = {200, 50, uda[2], 20, 300};
|
||||
int ud2[] = {200, 50, uda[2], 20, 300};
|
||||
int ud3[] = {200, 50, uda[2], 20, 300};
|
||||
int ud4[] = {200, 50, uda[2], 20, 300};
|
||||
int dispbox = 0;
|
||||
|
||||
void setup(void) {
|
||||
batteryupd.Every(10000, checkBat);
|
||||
@ -184,7 +194,11 @@ void setup(void) {
|
||||
pinMode(35, INPUT_PULLUP);
|
||||
pinMode(36, INPUT_PULLUP);
|
||||
pinMode(37, INPUT_PULLUP);
|
||||
|
||||
|
||||
|
||||
// FAN pins
|
||||
pinMode(30, OUTPUT); // IN
|
||||
pinMode(31, OUTPUT); // OUT
|
||||
setTime(0);
|
||||
Serial.begin(9600);
|
||||
dht.begin();
|
||||
@ -216,7 +230,7 @@ void setup(void) {
|
||||
}
|
||||
clearLog();
|
||||
printFastCText("Booting GreenhouseOS...");
|
||||
printFastCText("Version: 0.2.3");
|
||||
printFastCText("Version: 0.3.0");
|
||||
printFastCText("");
|
||||
delay(250);
|
||||
if(!didDraw) {
|
||||
@ -276,42 +290,56 @@ void setup(void) {
|
||||
//drawButton(160, 20, 160, 110, "Stats", "ILI9341_GREEN");
|
||||
upd = false;
|
||||
}
|
||||
const int sec = 1000;
|
||||
const int mins = 1000 * 60;
|
||||
const int hr = 1000 * 60 * 60;
|
||||
long screenoff;
|
||||
const long sec = 1000;
|
||||
const long mins = 1000 * 60;
|
||||
const long hr = 1000 * 60 * 60;
|
||||
void loop(void) {
|
||||
TSPoint p = ts.getPoint();
|
||||
if (p.z > ts.pressureThreshhold) {
|
||||
p.x = map(p.x, TS_MINX, TS_MAXX, tft.height(), 0);
|
||||
p.y = map(p.y, TS_MINY, TS_MAXY, tft.width(), 0);
|
||||
Serial.print("X = "); Serial.print(320 - p.y);
|
||||
Serial.print("\tY = "); Serial.print(p.x);
|
||||
Serial.print("\tPressure = "); Serial.println(p.z);
|
||||
int x = 320 - p.y;
|
||||
int y = p.x;
|
||||
if(y < 130 && y > 50 && menu == 1) {
|
||||
sla[3] = x - 10;
|
||||
if(sla[3] < 0) sla[3] = 0;
|
||||
if(sla[3] > 280) sla[3] = 280;
|
||||
if (screenoff < millis() && screenoff != 0) {
|
||||
analogWrite(6, map(sla[3], 0, 280, 25, 255));
|
||||
drawSlider(sla);
|
||||
screenoff = 0;
|
||||
delay(250);
|
||||
}
|
||||
else {
|
||||
screenoff = 0;
|
||||
p.x = map(p.x, TS_MINX, TS_MAXX, tft.height(), 0);
|
||||
p.y = map(p.y, TS_MINY, TS_MAXY, tft.width(), 0);
|
||||
int x = 320 - p.y;
|
||||
int y = p.x;
|
||||
if(y < 130 && y > 50 && menu == 1) {
|
||||
sla[3] = x - 10;
|
||||
if(sla[3] < 0) sla[3] = 0;
|
||||
if(sla[3] > 280) sla[3] = 280;
|
||||
analogWrite(6, map(sla[3], 0, 280, 25, 255));
|
||||
drawSlider(sla);
|
||||
}
|
||||
if(menu == 3) {
|
||||
updUD(uda);
|
||||
|
||||
}
|
||||
if (x < 160 && y < 130) {
|
||||
button(0, 0);
|
||||
}
|
||||
if (x > 160 && y < 130) {
|
||||
button(1, 0);
|
||||
}
|
||||
if (x < 160 && y > 130) {
|
||||
button(0, 1);
|
||||
}
|
||||
if (x > 160 && y > 130) {
|
||||
button(1, 1);
|
||||
}
|
||||
}
|
||||
if(menu == 3) {
|
||||
updUD(uda);
|
||||
}
|
||||
else {
|
||||
if(screenoff < millis() && screenoff != 0) {
|
||||
analogWrite(6, 0);
|
||||
}
|
||||
if (x < 160 && y < 130) {
|
||||
button(0, 0);
|
||||
else if(screenoff == 0) {
|
||||
screenoff = millis() + 60000;
|
||||
}
|
||||
if (x > 160 && y < 130) {
|
||||
button(1, 0);
|
||||
}
|
||||
if (x < 160 && y > 130) {
|
||||
button(0, 1);
|
||||
}
|
||||
if (x > 160 && y > 130) {
|
||||
button(1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
if ((batteryupd.m_milliseconds - millis() + batteryupd.m_lastRunTimestamp) / (sec / 4) == 0 && menu == 2) {
|
||||
upd = true;
|
||||
@ -337,7 +365,7 @@ void loop(void) {
|
||||
if (menu == 2) {
|
||||
//debug = true;
|
||||
//printFastCText("pressed");
|
||||
drawButton(0, 20, 320, 220, "", ILI9341_WHITE);
|
||||
tft.fillRect(0, 20, 320, 220, ILI9341_WHITE);
|
||||
float h = dht.readHumidity();
|
||||
// Read temperature as Celsius (the default)
|
||||
float t = dht.readTemperature();
|
||||
@ -351,18 +379,70 @@ void loop(void) {
|
||||
txt += f;
|
||||
txt += " degrees";
|
||||
displayText(2, 53, false, txt, 4);
|
||||
txt = (water.m_milliseconds - millis() + water.m_lastRunTimestamp) / 60000 + 1; // ceil instead of float
|
||||
txt = (water.m_milliseconds - millis() + water.m_lastRunTimestamp) / 60000 + 1; // ceil instead of floor
|
||||
txt += " minutes until water";
|
||||
displayText(2, 76, false, txt, 4);
|
||||
// moisture, temperature, next cycle, how much water, power usage, sensor connections
|
||||
drawButton(160, 130, 160, 110, "Back", ILI9341_BLUE);
|
||||
if(fani) {
|
||||
drawButton(2, 100, 157, 35, "Intake Fan", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(2, 100, 157, 35, "Intake Fan", ILI9341_RED);
|
||||
}
|
||||
if(fano) {
|
||||
drawButton(161, 100, 157, 35, "Exhaust Fan", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(161, 100, 157, 35, "Exhaust Fan", ILI9341_RED);
|
||||
}
|
||||
drawButton(160, 130, 160, 110, "Back", ILI9341_BLUE);
|
||||
drawButton(0, 130, 160, 110, "", ILI9341_WHITE);
|
||||
if(b1[0]) {
|
||||
drawButton(5, 135, 70, 45, "1", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(5, 135, 70, 45, "1", ILI9341_RED);
|
||||
}
|
||||
if(b2[0]) {
|
||||
drawButton(85, 135, 70, 45, "2", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(85, 135, 70, 45, "2", ILI9341_RED);
|
||||
}
|
||||
if(b3[0]) {
|
||||
drawButton(5, 190, 70, 45, "3", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(5, 190, 70, 45, "3", ILI9341_RED);
|
||||
}
|
||||
if(b4[0]) {
|
||||
drawButton(85, 190, 70, 45, "4", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(85, 190, 70, 45, "4", ILI9341_RED);
|
||||
}
|
||||
}
|
||||
if (menu == 3) {
|
||||
drawButton(0, 20, 320, 220, "", ILI9341_WHITE);
|
||||
tft.fillRect(0, 20, 320, 220, ILI9341_WHITE);
|
||||
drawButton(160, 130, 160, 110, "Back", ILI9341_BLUE);
|
||||
drawUD(uda);
|
||||
if(b1[0]) {
|
||||
drawButton(5, 135, 70, 45, "1", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(5, 135, 70, 45, "1", ILI9341_RED);
|
||||
}
|
||||
if(b2[0]) {
|
||||
drawButton(85, 135, 70, 45, "2", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(85, 135, 70, 45, "2", ILI9341_RED);
|
||||
}
|
||||
if(b3[0]) {
|
||||
drawButton(5, 190, 70, 45, "3", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(5, 190, 70, 45, "3", ILI9341_RED);
|
||||
}
|
||||
if(b4[0]) {
|
||||
drawButton(85, 190, 70, 45, "4", ILI9341_GREEN);
|
||||
} else {
|
||||
drawButton(85, 190, 70, 45, "4", ILI9341_RED);
|
||||
}
|
||||
displayText(15, 45, false, "Water amount:", 4);
|
||||
drawButton(5, 100, 20, 20, "Intake", ILI9341_RED);
|
||||
|
||||
}
|
||||
upd = false;
|
||||
}
|
||||
@ -376,49 +456,6 @@ void loop(void) {
|
||||
printFastCText(txtin.substring(0, txtin.length() - 1));
|
||||
|
||||
}
|
||||
unsigned long mil = millis();
|
||||
/*String tmp = "[";
|
||||
if(mil / 1000 < 10) {
|
||||
tmp += " ";
|
||||
}
|
||||
else if(mil / 1000 < 100) {
|
||||
tmp += " ";
|
||||
}
|
||||
else if(mil / 1000 < 1000) {
|
||||
tmp += " ";
|
||||
}
|
||||
else if(mil / 1000 < 10000) {
|
||||
tmp += " ";
|
||||
}
|
||||
else if(mil / 1000 < 100000) {
|
||||
tmp += " ";
|
||||
}
|
||||
else if(mil / 1000 < 1000000) {
|
||||
tmp += " ";
|
||||
}
|
||||
tmp += mil / 1000;
|
||||
tmp += ".";
|
||||
|
||||
if(mil % 1000 < 10) {
|
||||
tmp += "00";
|
||||
}
|
||||
else if(mil % 1000 < 100) {
|
||||
tmp += "0";
|
||||
}
|
||||
tmp += mil % 1000;
|
||||
tmp += "]";*/
|
||||
//printFastCText(tmp);
|
||||
//tft.scrollTo(320);
|
||||
/*if(mil % 20000 < 500) {
|
||||
getMoisture();
|
||||
delay(500);
|
||||
//tft.scrollTo(480);
|
||||
//tft.setAddrWindow(320, 0, 320, 240);
|
||||
upd = true;
|
||||
}*/
|
||||
|
||||
// change upd to true if screen update needed
|
||||
|
||||
batteryupd.Update();
|
||||
water.Update();
|
||||
}
|
||||
@ -461,7 +498,31 @@ void checkBat() {
|
||||
if (digitalRead(35) == 0) drawButton(140, 2, 16, 16, "", ILI9341_ORANGE);
|
||||
if (digitalRead(36) == 0) drawButton(140, 2, 16, 16, "", ILI9341_YELLOW);
|
||||
if (digitalRead(37) == 0) drawButton(140, 2, 16, 16, "", ILI9341_GREEN);
|
||||
|
||||
|
||||
float h = dht.readHumidity();
|
||||
float f = dht.readTemperature(true);
|
||||
|
||||
if (f > trange[1]) {
|
||||
fani = true;
|
||||
fano = true;
|
||||
digitalWrite(31, HIGH);
|
||||
digitalWrite(30, HIGH);
|
||||
} else {
|
||||
if (h > hrange[1]) {
|
||||
fano = true;
|
||||
digitalWrite(31, HIGH);
|
||||
} else {
|
||||
fano = false;
|
||||
digitalWrite(31, LOW);
|
||||
}
|
||||
if (h < hrange[0]) {
|
||||
fani = true;
|
||||
digitalWrite(30, HIGH);
|
||||
} else {
|
||||
fani = false;
|
||||
digitalWrite(30, LOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int checkPin(byte pin, int count) {
|
||||
@ -481,9 +542,13 @@ void runWater() {
|
||||
digitalWrite(7, HIGH);
|
||||
delay(1000);
|
||||
getMoisture();
|
||||
if(s1 && map(soil1.touchRead(0), 0, 1023, 0, 100) <= 50) {
|
||||
if(s1 && map(soil1.touchRead(0), 0, 1023, 0, 100) <= 50 && b1[0]) {
|
||||
int td = 50 - map(soil1.touchRead(0), 0, 1023, 0, 100);
|
||||
td *= 5;
|
||||
if(b1[1]) {
|
||||
td *= 5 * ud1[2] / 100.0;
|
||||
} else {
|
||||
td *= 5 * uda[2] / 100.0;
|
||||
}
|
||||
String out = "[ INFO ] Running water on box 1 for ";
|
||||
out += td / 10.0;
|
||||
out += " sec.";
|
||||
@ -492,9 +557,13 @@ void runWater() {
|
||||
delay(td * 100);
|
||||
digitalWrite(2, HIGH);
|
||||
}
|
||||
if(s2 && map(soil2.touchRead(0), 0, 1023, 0, 100) <= 50) {
|
||||
if(s2 && map(soil2.touchRead(0), 0, 1023, 0, 100) <= 50 && b2[0]) {
|
||||
int td = 50 - map(soil2.touchRead(0), 0, 1023, 0, 100);
|
||||
td *= 5;
|
||||
if(b2[1]) {
|
||||
td *= 5 * ud2[2] / 100.0;
|
||||
} else {
|
||||
td *= 5 * uda[2] / 100.0;
|
||||
}
|
||||
String out = "[ INFO ] Running water on box 2 for ";
|
||||
out += td / 10.0;
|
||||
out += " sec.";
|
||||
@ -503,9 +572,13 @@ void runWater() {
|
||||
delay(td * 100);
|
||||
digitalWrite(3, HIGH);
|
||||
}
|
||||
if(s3 && map(soil3.touchRead(0), 0, 1023, 0, 100) <= 50) {
|
||||
if(s3 && map(soil3.touchRead(0), 0, 1023, 0, 100) <= 50 && b3[0]) {
|
||||
int td = 50 - map(soil3.touchRead(0), 0, 1023, 0, 100);
|
||||
td *= 5;
|
||||
if(b3[1]) {
|
||||
td *= 5 * ud3[2] / 100.0;
|
||||
} else {
|
||||
td *= 5 * uda[2] / 100.0;
|
||||
}
|
||||
String out = "[ INFO ] Running water on box 3 for ";
|
||||
out += td / 10.0;
|
||||
out += " sec.";
|
||||
@ -514,9 +587,13 @@ void runWater() {
|
||||
delay(td * 100);
|
||||
digitalWrite(4, HIGH);
|
||||
}
|
||||
if(s4 && map(soil4.touchRead(0), 0, 1023, 0, 100) <= 50) {
|
||||
if(s4 && map(soil4.touchRead(0), 0, 1023, 0, 100) <= 50 && b4[0]) {
|
||||
int td = 50 - map(soil4.touchRead(0), 0, 1023, 0, 100);
|
||||
td *= 5;
|
||||
if(b4[1]) {
|
||||
td *= 5 * ud4[2] / 100.0;
|
||||
} else {
|
||||
td *= 5 * uda[2] / 100.0;
|
||||
}
|
||||
String out = "[ INFO ] Running water on box 4 for ";
|
||||
out += td / 10.0;
|
||||
out += " sec.";
|
||||
@ -764,7 +841,7 @@ void scrollAddress(uint16_t vsp) {
|
||||
}
|
||||
|
||||
void drawButton(int x, int y, int w, int h, char* text, word color) {
|
||||
tft.fillRect(x, y, w, h, ILI9341_BLACK);
|
||||
//tft.fillRect(x, y, w, h, ILI9341_BLACK);
|
||||
tft.setTextFont(4);
|
||||
tft.fillRect(x, y, w, h, color);
|
||||
tft.drawCentreString(text, x + w/2, y + h/2 - 15, 4);
|
||||
@ -822,6 +899,57 @@ void button(int x, int y) {
|
||||
if (x == 1 && y == 1) {
|
||||
menu = 0;
|
||||
upd = true;
|
||||
updBoxMenu(1);
|
||||
updBoxMenu(2);
|
||||
updBoxMenu(3);
|
||||
updBoxMenu(4);
|
||||
}
|
||||
TSPoint p = ts.getPoint();
|
||||
p.x = map(p.x, TS_MINX, TS_MAXX, tft.height(), 0);
|
||||
p.y = map(p.y, TS_MINY, TS_MAXY, tft.width(), 0);
|
||||
if(touch(0, 130, 80, 55, p)) {
|
||||
updBoxMenu(1);
|
||||
drawBoxMenu(1);
|
||||
}
|
||||
if(touch(80, 130, 80, 55, p)) {
|
||||
updBoxMenu(2);
|
||||
drawBoxMenu(2);
|
||||
}
|
||||
if(touch(0, 185, 80, 55, p)) {
|
||||
updBoxMenu(3);
|
||||
drawBoxMenu(3);
|
||||
}
|
||||
if(touch(80, 185, 80, 55, p)) {
|
||||
updBoxMenu(4);
|
||||
drawBoxMenu(4);
|
||||
}
|
||||
}
|
||||
// skip 4 lol, oops
|
||||
else if (menu == 5) {
|
||||
if (x == 1 && y == 0) {
|
||||
updBoxMenu(dispbox);
|
||||
}
|
||||
if (x == 1 && y == 1) {
|
||||
menu = 3;
|
||||
upd = true;
|
||||
}
|
||||
if (x == 0 && y == 1) {
|
||||
if(dispbox == 1) {
|
||||
b1[0] = !b1[0];
|
||||
drawBoxMenu(1);
|
||||
}
|
||||
if(dispbox == 2) {
|
||||
b2[0] = !b2[0];
|
||||
drawBoxMenu(2);
|
||||
}
|
||||
if(dispbox == 3) {
|
||||
b3[0] = !b3[0];
|
||||
drawBoxMenu(3);
|
||||
}
|
||||
if(dispbox == 4) {
|
||||
b4[0] = !b4[0];
|
||||
drawBoxMenu(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
delay(250);
|
||||
@ -873,7 +1001,7 @@ void updUD(int data[]) {
|
||||
xt = 320 - p.y;
|
||||
yt = p.x;
|
||||
if (xt >= x + 70 && xt <= x + 110) {
|
||||
if (yt <= y + 15 && yt >= y - 20 && d < data[4]) {
|
||||
if (yt <= y + 15 && yt >= y - 30 && d < data[4]) {
|
||||
// UP
|
||||
data[2] += 20;
|
||||
d += 20;
|
||||
@ -883,7 +1011,7 @@ void updUD(int data[]) {
|
||||
tft.fillRect(x, y + 15, 70, 25, ILI9341_WHITE);
|
||||
tft.drawString(out.c_str(), x, y + 15, 4);
|
||||
}
|
||||
else if (yt >= y + 15 && yt <= y + 50 && d > data[3]) {
|
||||
else if (yt >= y + 15 && yt <= y + 60 && d > data[3]) {
|
||||
// DOWN
|
||||
data[2] -= 20;
|
||||
d -= 20;
|
||||
@ -897,6 +1025,134 @@ void updUD(int data[]) {
|
||||
}
|
||||
}
|
||||
|
||||
boolean touch(int x, int y) {
|
||||
if(
|
||||
boolean touch(int x, int y, int w, int h, TSPoint p) {
|
||||
int xt = 320 - p.y;
|
||||
int yt = p.x;
|
||||
if(xt >= x && xt <= x + w && yt >= y && yt <= y + h) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void drawBoxMenu(int box) {
|
||||
dispbox = box;
|
||||
if(box == 0) {
|
||||
menu = 4;
|
||||
upd = true;
|
||||
return;
|
||||
}
|
||||
menu = 5;
|
||||
tft.fillRect(0, 20, 320, 220, ILI9341_WHITE);
|
||||
if (box == 1) {
|
||||
if(!b1[0]) {
|
||||
displayText(15, 35, false, "Plant Box 1 Disabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Enable", ILI9341_GREEN);
|
||||
}
|
||||
if(b1[0]) {
|
||||
displayText(15, 35, false, "Plant Box 1 Enabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Disable", ILI9341_RED);
|
||||
}
|
||||
drawButton(160, 130, 160, 110, "Back", ILI9341_BLUE);
|
||||
drawUD(ud1);
|
||||
displayText(15, 65, false, "Water amount:", 4);
|
||||
}
|
||||
if (box == 2) {
|
||||
if(!b2[0]) {
|
||||
displayText(15, 35, false, "Plant Box 2 Disabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Enable", ILI9341_GREEN);
|
||||
}
|
||||
if(b2[0]) {
|
||||
displayText(15, 35, false, "Plant Box 2 Enabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Disable", ILI9341_RED);
|
||||
}
|
||||
drawButton(160, 130, 160, 110, "Back", ILI9341_BLUE);
|
||||
drawUD(ud2);
|
||||
displayText(15, 65, false, "Water amount:", 4);
|
||||
}
|
||||
if (box == 3) {
|
||||
if(!b3[0]) {
|
||||
displayText(15, 35, false, "Plant Box 3 Disabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Enable", ILI9341_GREEN);
|
||||
}
|
||||
if(b3[0]) {
|
||||
displayText(15, 35, false, "Plant Box 3 Enabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Disable", ILI9341_RED);
|
||||
}
|
||||
drawButton(160, 130, 160, 110, "Back", ILI9341_BLUE);
|
||||
drawUD(ud3);
|
||||
displayText(15, 65, false, "Water amount:", 4);
|
||||
}
|
||||
if (box == 4) {
|
||||
if(!b4[0]) {
|
||||
displayText(15, 35, false, "Plant Box 4 Disabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Enable", ILI9341_GREEN);
|
||||
}
|
||||
if(b4[0]) {
|
||||
displayText(15, 35, false, "Plant Box 4 Enabled", 4);
|
||||
drawButton(0, 130, 160, 110, "Disable", ILI9341_RED);
|
||||
}
|
||||
drawButton(160, 130, 160, 110, "Back", ILI9341_BLUE);
|
||||
drawUD(ud4);
|
||||
displayText(15, 65, false, "Water amount:", 4);
|
||||
}
|
||||
}
|
||||
|
||||
void updBoxMenu(int box) {
|
||||
if(box == 0) {
|
||||
return;
|
||||
}
|
||||
if (box == 1) {
|
||||
if(!b1[1]) {
|
||||
ud1[2] = uda[2];
|
||||
updUD(ud1);
|
||||
if(ud1[2] != uda[2]) {
|
||||
b1[1] = true;
|
||||
}
|
||||
} else {
|
||||
updUD(ud1);
|
||||
if(ud1[2] == uda[2]) {
|
||||
b1[1] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (box == 2) {
|
||||
if(!b2[1]) {
|
||||
ud2[2] = uda[2];
|
||||
updUD(ud2);
|
||||
if(ud2[2] != uda[2]) {
|
||||
b2[1] = true;
|
||||
}
|
||||
} else {
|
||||
updUD(ud2);
|
||||
if(ud2[2] == uda[2]) {
|
||||
b2[1] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (box == 3) {
|
||||
if(!b3[1]) {
|
||||
ud3[2] = uda[2];
|
||||
updUD(ud3);
|
||||
if(ud3[2] != uda[2]) {
|
||||
b3[1] = true;
|
||||
}
|
||||
} else {
|
||||
updUD(ud3);
|
||||
if(ud3[2] == uda[2]) {
|
||||
b3[1] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (box == 4) {
|
||||
if(!b4[1]) {
|
||||
ud4[2] = uda[2];
|
||||
updUD(ud4);
|
||||
if(ud4[2] != uda[2]) {
|
||||
b4[1] = true;
|
||||
}
|
||||
} else {
|
||||
updUD(ud4);
|
||||
if(ud4[2] == uda[2]) {
|
||||
b4[1] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user