Commit c3af501ea015f6fbd2d1ba13e3756e969ae0246d

Authored by 김태훈
1 parent 3fd8255a11
Exists in master and in 2 other branches fhd, fhd-demo

GUI V0.2.0

- 자동 요리 중엔 중심 온도 값이 유효할 때만 메인 보드에 중심 온도를 설정
- IP 설정이 다를 때만 새로 설정하도록 수정
app/gui/oven_control/autocook.cpp
... ... @@ -44,14 +44,9 @@ void AutoCook::startStep()
44 44 oven->setTemp(currentStep.temp);
45 45 oven->setFan(currentStep.fan);
46 46 oven->setTime(remainingTime() + 300);
47   -
  47 + oven->setInterTempEnabled(false);
48 48 if (cook.isCoreTempValid())
49   - {
50 49 oven->setInterTemp(cook.coreTemp());
51   - oven->setInterTempEnabled(true);
52   - }
53   - else
54   - oven->setInterTempEnabled(false);
55 50  
56 51 if (currentStep.dehumidification)
57 52 {
... ... @@ -80,8 +75,6 @@ void AutoCook::startStep()
80 75  
81 76 void AutoCook::nextStep()
82 77 {
83   - qDebug() << "Next Step Before" << remainingTime();
84   -
85 78 Oven *oven = Oven::getInstance();
86 79  
87 80 CookStep &currentStep = cook.steps[currentStepIndex];
... ... @@ -106,12 +99,7 @@ void AutoCook::nextStep()
106 99 oven->setTime(remainingTime() + 300);
107 100  
108 101 if (cook.isCoreTempValid())
109   - {
110 102 oven->setInterTemp(cook.coreTemp());
111   - oven->setInterTempEnabled(true);
112   - }
113   - else
114   - oven->setInterTempEnabled(false);
115 103  
116 104 stepStartTime.start();
117 105 oven->startCooking();
... ... @@ -235,6 +223,7 @@ void AutoCook::nextStep()
235 223 oven->stopHumidification();
236 224 }
237 225  
  226 + oven->setInterTempEnabled(false);
238 227 oven->stopCooking();
239 228 isWaitingDoorOpened_ = true;
240 229 }
... ... @@ -242,8 +231,6 @@ void AutoCook::nextStep()
242 231 currentStepIndex++;
243 232  
244 233 advance();
245   -
246   - qDebug() << "Next Step After" << remainingTime();
247 234 }
248 235  
249 236 bool AutoCook::advance()
... ... @@ -359,6 +346,11 @@ bool AutoCook::advance()
359 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 355 int currentCoreTemp = oven->currentInterTemp();
364 356 if (currentCoreTemp >= cook.coreTemp())
... ... @@ -413,13 +405,6 @@ bool AutoCook::advance()
413 405 CookStep &lastStep = cook.steps[cook.steps.size() - 1];
414 406  
415 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 408 if (expectedRemainingTime > 30000)
424 409 {
425 410 lastStep.time = expectedRemainingTime;
... ... @@ -428,10 +413,6 @@ bool AutoCook::advance()
428 413 else
429 414 {
430 415 int currentRemainingTime = lastStep.time - lastCoreTempIncreasedTime.elapsed();
431   -
432   - qDebug() << "lastCoreTempIncreasedTime" << lastCoreTempIncreasedTime;
433   - qDebug() << "currentRemainingTime" << currentRemainingTime;
434   -
435 416 if (currentRemainingTime > 30000)
436 417 {
437 418 lastStep.time = 30000;
... ... @@ -449,42 +430,10 @@ bool AutoCook::advance()
449 430 lastCoreTemp = currentCoreTemp;
450 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 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 666 </font>
667 667 </property>
668 668 <property name="text">
669   - <string>V0.1.12</string>
  669 + <string>V0.2.0</string>
670 670 </property>
671 671 <property name="alignment">
672 672 <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
... ...
app/gui/oven_control/system.cpp
... ... @@ -4,8 +4,17 @@
4 4 #include <fcntl.h>
5 5 #include <linux/rtc.h>
6 6  
  7 +namespace {
  8 +System::IPData setting;
  9 +}
  10 +
7 11 void System::setIP(System::IPData &data)
8 12 {
  13 + if (setting == data)
  14 + return;
  15 +
  16 + setting = data;
  17 +
9 18 QString ifconfig = QString("ifconfig eth0 %1 netmask %2 up").arg(data.address, data.netmask);
10 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 11 QString address;
12 12 QString netmask;
13 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 21 void setIP(IPData &data);
... ...