Commit c3af501ea015f6fbd2d1ba13e3756e969ae0246d
1 parent
3fd8255a11
Exists in
master
and in
2 other branches
GUI V0.2.0
- 자동 요리 중엔 중심 온도 값이 유효할 때만 메인 보드에 중심 온도를 설정 - IP 설정이 다를 때만 새로 설정하도록 수정
Showing
4 changed files
with
26 additions
and
63 deletions
Show diff stats
app/gui/oven_control/autocook.cpp
@@ -44,14 +44,9 @@ void AutoCook::startStep() | @@ -44,14 +44,9 @@ void AutoCook::startStep() | ||
44 | oven->setTemp(currentStep.temp); | 44 | oven->setTemp(currentStep.temp); |
45 | oven->setFan(currentStep.fan); | 45 | oven->setFan(currentStep.fan); |
46 | oven->setTime(remainingTime() + 300); | 46 | oven->setTime(remainingTime() + 300); |
47 | - | 47 | + oven->setInterTempEnabled(false); |
48 | if (cook.isCoreTempValid()) | 48 | if (cook.isCoreTempValid()) |
49 | - { | ||
50 | oven->setInterTemp(cook.coreTemp()); | 49 | oven->setInterTemp(cook.coreTemp()); |
51 | - oven->setInterTempEnabled(true); | ||
52 | - } | ||
53 | - else | ||
54 | - oven->setInterTempEnabled(false); | ||
55 | 50 | ||
56 | if (currentStep.dehumidification) | 51 | if (currentStep.dehumidification) |
57 | { | 52 | { |
@@ -80,8 +75,6 @@ void AutoCook::startStep() | @@ -80,8 +75,6 @@ void AutoCook::startStep() | ||
80 | 75 | ||
81 | void AutoCook::nextStep() | 76 | void AutoCook::nextStep() |
82 | { | 77 | { |
83 | - qDebug() << "Next Step Before" << remainingTime(); | ||
84 | - | ||
85 | Oven *oven = Oven::getInstance(); | 78 | Oven *oven = Oven::getInstance(); |
86 | 79 | ||
87 | CookStep ¤tStep = cook.steps[currentStepIndex]; | 80 | CookStep ¤tStep = cook.steps[currentStepIndex]; |
@@ -106,12 +99,7 @@ void AutoCook::nextStep() | @@ -106,12 +99,7 @@ void AutoCook::nextStep() | ||
106 | oven->setTime(remainingTime() + 300); | 99 | oven->setTime(remainingTime() + 300); |
107 | 100 | ||
108 | if (cook.isCoreTempValid()) | 101 | if (cook.isCoreTempValid()) |
109 | - { | ||
110 | oven->setInterTemp(cook.coreTemp()); | 102 | oven->setInterTemp(cook.coreTemp()); |
111 | - oven->setInterTempEnabled(true); | ||
112 | - } | ||
113 | - else | ||
114 | - oven->setInterTempEnabled(false); | ||
115 | 103 | ||
116 | stepStartTime.start(); | 104 | stepStartTime.start(); |
117 | oven->startCooking(); | 105 | oven->startCooking(); |
@@ -235,6 +223,7 @@ void AutoCook::nextStep() | @@ -235,6 +223,7 @@ void AutoCook::nextStep() | ||
235 | oven->stopHumidification(); | 223 | oven->stopHumidification(); |
236 | } | 224 | } |
237 | 225 | ||
226 | + oven->setInterTempEnabled(false); | ||
238 | oven->stopCooking(); | 227 | oven->stopCooking(); |
239 | isWaitingDoorOpened_ = true; | 228 | isWaitingDoorOpened_ = true; |
240 | } | 229 | } |
@@ -242,8 +231,6 @@ void AutoCook::nextStep() | @@ -242,8 +231,6 @@ void AutoCook::nextStep() | ||
242 | currentStepIndex++; | 231 | currentStepIndex++; |
243 | 232 | ||
244 | advance(); | 233 | advance(); |
245 | - | ||
246 | - qDebug() << "Next Step After" << remainingTime(); | ||
247 | } | 234 | } |
248 | 235 | ||
249 | bool AutoCook::advance() | 236 | bool AutoCook::advance() |
@@ -359,6 +346,11 @@ bool AutoCook::advance() | @@ -359,6 +346,11 @@ bool AutoCook::advance() | ||
359 | lastCoreTempIncreasedTime.start(); | 346 | lastCoreTempIncreasedTime.start(); |
360 | } | 347 | } |
361 | 348 | ||
349 | + if (cook.coreTemp() != oven->interTemp()) | ||
350 | + oven->setInterTemp(cook.coreTemp()); | ||
351 | + | ||
352 | + if (!oven->interTempEnabled()) | ||
353 | + oven->setInterTempEnabled(true); | ||
362 | 354 | ||
363 | int currentCoreTemp = oven->currentInterTemp(); | 355 | int currentCoreTemp = oven->currentInterTemp(); |
364 | if (currentCoreTemp >= cook.coreTemp()) | 356 | if (currentCoreTemp >= cook.coreTemp()) |
@@ -413,13 +405,6 @@ bool AutoCook::advance() | @@ -413,13 +405,6 @@ bool AutoCook::advance() | ||
413 | CookStep &lastStep = cook.steps[cook.steps.size() - 1]; | 405 | CookStep &lastStep = cook.steps[cook.steps.size() - 1]; |
414 | 406 | ||
415 | int expectedRemainingTime = (cook.coreTemp() - currentCoreTemp) * lastCoreTempChangedTime.elapsed() / (currentCoreTemp - lastCoreTemp); | 407 | int expectedRemainingTime = (cook.coreTemp() - currentCoreTemp) * lastCoreTempChangedTime.elapsed() / (currentCoreTemp - lastCoreTemp); |
416 | - | ||
417 | - qDebug() << "cook.coreTemp()" << cook.coreTemp(); | ||
418 | - qDebug() << "currentCoreTemp" << currentCoreTemp; | ||
419 | - qDebug() << "lastCoreTemp" << lastCoreTemp; | ||
420 | - qDebug() << "lastCoreTempChangedTime.elapsed()" << lastCoreTempChangedTime.elapsed(); | ||
421 | - qDebug() << "expectedRemainingTime" << expectedRemainingTime; | ||
422 | - | ||
423 | if (expectedRemainingTime > 30000) | 408 | if (expectedRemainingTime > 30000) |
424 | { | 409 | { |
425 | lastStep.time = expectedRemainingTime; | 410 | lastStep.time = expectedRemainingTime; |
@@ -428,10 +413,6 @@ bool AutoCook::advance() | @@ -428,10 +413,6 @@ bool AutoCook::advance() | ||
428 | else | 413 | else |
429 | { | 414 | { |
430 | int currentRemainingTime = lastStep.time - lastCoreTempIncreasedTime.elapsed(); | 415 | int currentRemainingTime = lastStep.time - lastCoreTempIncreasedTime.elapsed(); |
431 | - | ||
432 | - qDebug() << "lastCoreTempIncreasedTime" << lastCoreTempIncreasedTime; | ||
433 | - qDebug() << "currentRemainingTime" << currentRemainingTime; | ||
434 | - | ||
435 | if (currentRemainingTime > 30000) | 416 | if (currentRemainingTime > 30000) |
436 | { | 417 | { |
437 | lastStep.time = 30000; | 418 | lastStep.time = 30000; |
@@ -449,42 +430,10 @@ bool AutoCook::advance() | @@ -449,42 +430,10 @@ bool AutoCook::advance() | ||
449 | lastCoreTemp = currentCoreTemp; | 430 | lastCoreTemp = currentCoreTemp; |
450 | lastCoreTempChangedTime.start(); | 431 | lastCoreTempChangedTime.start(); |
451 | } | 432 | } |
452 | - | ||
453 | - | ||
454 | -// int currentCoreTemp = oven->currentInterTemp(); | ||
455 | -// if (currentCoreTemp != lastCoreTemp) | ||
456 | -// { | ||
457 | -// int remainingStepsTime = 0; | ||
458 | -// for (int idx = currentStepIndex + 1; idx < cook.steps.size(); idx++) | ||
459 | -// remainingStepsTime += cook.steps[idx].time; | ||
460 | - | ||
461 | -// int currentRemainingTime = currentStep.time - lastCoreTempTime.elapsed() + remainingStepsTime; | ||
462 | -// int expectedTime = (cook.coreTemp() - currentCoreTemp) * qAbs(lastCoreTempTime.elapsed() / (currentCoreTemp - lastCoreTemp)); | ||
463 | -// int expectedCurrentStepTime = expectedTime - remainingStepsTime; | ||
464 | - | ||
465 | -// for (int idx = currentStepIndex; idx < cook.steps.size(); idx++) | ||
466 | -// { | ||
467 | -// CookStep &step = cook.steps[idx]; | ||
468 | -// if (expectedCurrentStepTime > 0) | ||
469 | -// { | ||
470 | -// step.time = expectedCurrentStepTime; | ||
471 | -// break; | ||
472 | -// } | ||
473 | -// else | ||
474 | -// { | ||
475 | -// expectedCurrentStepTime += step.time; | ||
476 | -// step.time = 0; | ||
477 | -// } | ||
478 | -// } | ||
479 | - | ||
480 | -// lastCoreTemp = oven->currentInterTemp(); | ||
481 | -// lastCoreTempTime.start(); | ||
482 | -// stepStartTime.start(); | ||
483 | - | ||
484 | -// advance(); | ||
485 | - | ||
486 | -// return true; | ||
487 | -// } | 433 | + } |
434 | + else if (oven->interTempEnabled()) | ||
435 | + { | ||
436 | + oven->setInterTempEnabled(false); | ||
488 | } | 437 | } |
489 | } | 438 | } |
490 | case Define::InvalidClass: | 439 | case Define::InvalidClass: |
app/gui/oven_control/mainwindow.ui
@@ -666,7 +666,7 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_typ | @@ -666,7 +666,7 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_typ | ||
666 | </font> | 666 | </font> |
667 | </property> | 667 | </property> |
668 | <property name="text"> | 668 | <property name="text"> |
669 | - <string>V0.1.12</string> | 669 | + <string>V0.2.0</string> |
670 | </property> | 670 | </property> |
671 | <property name="alignment"> | 671 | <property name="alignment"> |
672 | <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set> | 672 | <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set> |
app/gui/oven_control/system.cpp
@@ -4,8 +4,17 @@ | @@ -4,8 +4,17 @@ | ||
4 | #include <fcntl.h> | 4 | #include <fcntl.h> |
5 | #include <linux/rtc.h> | 5 | #include <linux/rtc.h> |
6 | 6 | ||
7 | +namespace { | ||
8 | +System::IPData setting; | ||
9 | +} | ||
10 | + | ||
7 | void System::setIP(System::IPData &data) | 11 | void System::setIP(System::IPData &data) |
8 | { | 12 | { |
13 | + if (setting == data) | ||
14 | + return; | ||
15 | + | ||
16 | + setting = data; | ||
17 | + | ||
9 | QString ifconfig = QString("ifconfig eth0 %1 netmask %2 up").arg(data.address, data.netmask); | 18 | QString ifconfig = QString("ifconfig eth0 %1 netmask %2 up").arg(data.address, data.netmask); |
10 | QString route = QString("route del default; route add default gw %1").arg(data.gateway); | 19 | QString route = QString("route del default; route add default gw %1").arg(data.gateway); |
11 | 20 |
app/gui/oven_control/system.h
@@ -11,6 +11,11 @@ struct IPData | @@ -11,6 +11,11 @@ struct IPData | ||
11 | QString address; | 11 | QString address; |
12 | QString netmask; | 12 | QString netmask; |
13 | QString gateway; | 13 | QString gateway; |
14 | + | ||
15 | + bool operator==(const IPData &other) | ||
16 | + { | ||
17 | + return address == other.address && netmask == other.netmask && gateway == other.gateway; | ||
18 | + } | ||
14 | }; | 19 | }; |
15 | 20 | ||
16 | void setIP(IPData &data); | 21 | void setIP(IPData &data); |