diff --git a/sketch_ino.cpp b/sketch_ino.cpp index 2e69b3d..f4d9f2f 100644 --- a/sketch_ino.cpp +++ b/sketch_ino.cpp @@ -200,6 +200,78 @@ void Board::loop() { } } } + }else if (menu->getId() == 7){ + Keyboard::saisie = true ; + sleep(4); + if ( (&bus!=NULL)&&!(bus.isEmptyRegister(2))) { + bus.requestFrom(2, inputBuf, 150); + if (inputBuf[0] != '\0') { + input = ""; + for (int j = 0; inputBuf[j] != '\0'; ++j) { + input += inputBuf[j]; + } //TODO vérifier que chiffres + if (stoi(input) >= temperature->getThresholdLow()){ + temperature->setThresholdHigh(stoi(input)); + menu->menuBack(); + } else { + cout << "booooo" << endl; + } + } + } + }else if (menu->getId() == 8){ + Keyboard::saisie = true ; + sleep(4); + if ( (&bus!=NULL)&&!(bus.isEmptyRegister(2))) { + bus.requestFrom(2, inputBuf, 150); + if (inputBuf[0] != '\0') { + input = ""; + for (int j = 0; inputBuf[j] != '\0'; ++j) { + input += inputBuf[j]; + } + if (stoi(input) <= temperature->getThresholdHigh()){ + temperature->setThresholdLow(stoi(input)); + menu->menuBack(); + } else { + cout << "booooo" << endl; + } + } + } + }else if (menu->getId() == 9){ + Keyboard::saisie = true ; + sleep(4); + if ( (&bus!=NULL)&&!(bus.isEmptyRegister(2))) { + bus.requestFrom(2, inputBuf, 150); + if (inputBuf[0] != '\0') { + input = ""; + for (int j = 0; inputBuf[j] != '\0'; ++j) { + input += inputBuf[j]; + } + if (stoi(input) >= pressure->getThresholdLow()){ + pressure->setThresholdHigh(stoi(input)); + menu->menuBack(); + } else { + cout << "booooo" << endl; + } + } + } + }else if (menu->getId() == 10){ + Keyboard::saisie = true ; + sleep(4); + if ( (&bus!=NULL)&&!(bus.isEmptyRegister(2))) { + bus.requestFrom(2, inputBuf, 150); + if (inputBuf[0] != '\0') { + input = ""; + for (int j = 0; inputBuf[j] != '\0'; ++j) { + input += inputBuf[j]; + } + if (stoi(input) <= pressure->getThresholdHigh()){ + pressure->setThresholdLow(stoi(input)); + menu->menuBack(); + } else { + cout << "booooo" << endl; + } + } + } } cpt++;