threshold sans exceptions

This commit is contained in:
Cameron Bray 2020-05-27 00:06:40 +02:00
parent bcf9514dd1
commit fddb04eab5

View file

@ -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++;