Blame view

app/gui/oven_control/oven.cpp 16.3 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
3
  #include "oven.h"
  
  #include <QtDebug>
fd8461350   김태훈   오븐 기능 추가 및 수정
4
  #include <QTime>
8c2952457   김태훈   응용 프로그램 추가
5
  #include <cmath>
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
6
  #include "soundplayer.h"
fd8461350   김태훈   오븐 기능 추가 및 수정
7
  Oven *Oven::instance = 0;
8c2952457   김태훈   응용 프로그램 추가
8
9
10
  Oven::Oven(QObject *parent) : QObject(parent)
  {
      interface = NULL;
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
11
12
13
      currentHumidity_ = 0;
      currentTemp_ = 0;
      currentInterTemp_ = 0;
8c2952457   김태훈   응용 프로그램 추가
14
      cookingTimer.setSingleShot(true);
fd8461350   김태훈   오븐 기능 추가 및 수정
15
      connect(&cookingTimer, SIGNAL(timeout()), SLOT(stopCooking()));
8c2952457   김태훈   응용 프로그램 추가
16
c598b01b2   김태훈   GUI 업데이트
17
      damperTimer.setSingleShot(true);
fd8461350   김태훈   오븐 기능 추가 및 수정
18
      connect(&damperTimer, SIGNAL(timeout()), SLOT(closeDamper()));
c598b01b2   김태훈   GUI 업데이트
19
8c2952457   김태훈   응용 프로그램 추가
20
      humidificationTimer.setSingleShot(true);
fd8461350   김태훈   오븐 기능 추가 및 수정
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
      connect(&humidificationTimer, SIGNAL(timeout()), SLOT(stopHumidification()));
  
      damperRepeatRuntimeTimer.setSingleShot(true);
      connect(&damperRepeatRuntimeTimer, SIGNAL(timeout()), SLOT(idleRepeatDamper()));
  
      damperRepeatDelayTimer.setSingleShot(true);
      connect(&damperRepeatDelayTimer, SIGNAL(timeout()), SLOT(runRepeatDamper()));
  
      humidificationRepeatRuntimeTimer.setSingleShot(true);
      connect(&humidificationRepeatRuntimeTimer, SIGNAL(timeout()), SLOT(idleRepeatHumidification()));
  
      humidificationRepeatDelayTimer.setSingleShot(true);
      connect(&humidificationRepeatDelayTimer, SIGNAL(timeout()), SLOT(runRepeatHumidification()));
  
      isInterTempValid_ = false;
  
      humidificationRepeat = false;
      damperRepeat = false;
8c2952457   김태훈   응용 프로그램 추가
39
40
41
42
43
44
45
46
47
48
49
  }
  
  void Oven::setInterface(OvenInterface *interface)
  {
      if (this->interface)
          this->interface->disconnect();
  
      this->interface = interface;
      connect(interface, SIGNAL(doorOpened()), this, SLOT(onDoorOpened()));
      connect(interface, SIGNAL(doorClosed()), this, SLOT(onDoorClosed()));
  }
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
50
  void Oven::setMode(Define::Mode mode)
8c2952457   김태훈   응용 프로그램 추가
51
52
53
54
  {
      if (setMode_(mode))
          emit changed(this);
  }
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
55
  bool Oven::setMode_(Define::Mode mode)
8c2952457   김태훈   응용 프로그램 추가
56
57
58
  {
      switch (mode)
      {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
59
60
61
      case Define::DryMode:
      case Define::SteamMode:
      case Define::CombiMode:
8c2952457   김태훈   응용 프로그램 추가
62
63
64
65
66
67
68
69
          break;
      default:
          return false;
      }
  
      if (mode != mode_)
      {
          mode_ = mode;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
70
          interface->setMode(mode);
dedc5eee3   김태훈   프로토콜 변경 반영
71
8c2952457   김태훈   응용 프로그램 추가
72
73
74
75
76
          return true;
      }
  
      return false;
  }
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
77
  void Oven::setDefault(Define::Mode mode)
8c2952457   김태훈   응용 프로그램 추가
78
79
80
81
  {
      setMode_(mode);
      switch (mode)
      {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
82
      case Define::DryMode:
8c2952457   김태훈   응용 프로그램 추가
83
84
85
          setHumidity_(0);
          setTemp_(160);
          break;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
86
      case Define::SteamMode:
8c2952457   김태훈   응용 프로그램 추가
87
88
89
          setHumidity_(100);
          setTemp_(100);
          break;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
90
      case Define::CombiMode:
8c2952457   김태훈   응용 프로그램 추가
91
92
93
94
95
96
97
          setHumidity_(50);
          setTemp_(100);
          break;
      }
  
      setTime(0);
      setInterTempEnabled_(false);
c598b01b2   김태훈   GUI 업데이트
98
      setInterTemp_(minInterTemp());
8c2952457   김태훈   응용 프로그램 추가
99
100
101
102
103
104
105
      setFan_(4);
  
      cooking_ = false;
      preheating_ = false;
      cooldown_ = false;
      damper_ = false;
      humidification_ = false;
8c2952457   김태훈   응용 프로그램 추가
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
      door_ = interface->door();
      paused_ = false;
  
      emit changed(this);
  }
  
  void Oven::setHumidity(int percentage)
  {
      if (setHumidity_(percentage))
          emit changed(this);
  }
  
  bool Oven::setHumidity_(int percentage)
  {
      if (percentage < 0 || percentage > 100)
          return false;
  
      if (percentage != humidity_)
      {
          humidity_ = percentage;
          interface->setHumidity(percentage);
  
          return true;
      }
  
      return false;
  }
  
  void Oven::setTemp(int celsius)
  {
      if (setTemp_(celsius))
          emit changed(this);
  }
  
  bool Oven::setTemp_(int celsius)
  {
      if (celsius < minTemp() || celsius > maxTemp())
          return false;
  
      if (celsius != temp_)
      {
          temp_ = celsius;
          interface->setTemp(celsius);
  
          return true;
      }
  
      return false;
  }
  
  int Oven::time()
  {
      int left = cookingTimer.remainingTime();
      int interval = cookingTimer.interval();
      if (left > interval)
          left = interval;
  
      if (cooking())
          return ceil(left / 1000.0);
  
      return time_;
  }
  
  void Oven::setTime(int secs)
  {
      time_ = secs;
      cookingTimer.setInterval(secs * 1000);
  }
  
  void Oven::setInterTempEnabled(bool enabled)
  {
      if (setInterTempEnabled_(enabled))
          emit changed(this);
  }
  
  bool Oven::setInterTempEnabled_(bool enabled)
  {
      if (interTempEnabled_ != enabled)
      {
          interTempEnabled_ = enabled;
366850165   김태훈   연동 시험 결과 반영
186
187
188
          if (interTempEnabled_)
              interface->setInterTemp(interTemp_);
          else
05f2a7552   김태훈   image 관리 구조 변경
189
              interface->setInterTemp(0);
366850165   김태훈   연동 시험 결과 반영
190
8c2952457   김태훈   응용 프로그램 추가
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
          return true;
      }
  
      return false;
  }
  
  void Oven::setInterTemp(int celsius)
  {
      if (setInterTemp_(celsius))
          emit changed(this);
  }
  
  bool Oven::setInterTemp_(int celsius)
  {
      if (celsius < minInterTemp() || celsius > maxInterTemp())
          return false;
  
      if (celsius != interTemp_)
      {
          interTemp_ = celsius;
366850165   김태훈   연동 시험 결과 반영
211
212
          if (interTempEnabled_)
              interface->setInterTemp(celsius);
8c2952457   김태훈   응용 프로그램 추가
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
  
          return true;
      }
  
      return false;
  }
  
  void Oven::setFan(int speed)
  {
      if (setFan_(speed))
          emit changed(this);
  }
  
  bool Oven::setFan_(int speed)
  {
      if (speed < minFan() || speed > maxFan())
          return false;
  
      if (speed == fan_)
          return false;
c598b01b2   김태훈   GUI 업데이트
233
      int rpm = 0;
8c2952457   김태훈   응용 프로그램 추가
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
      switch (speed)
      {
      case 1:
          rpm = 500;
          break;
      case 2:
          rpm = 725;
          break;
      case 3:
          rpm = 950;
          break;
      case 4:
          rpm = 1175;
          break;
      case 5:
          rpm = 1400;
          break;
      }
  
      fan_ = speed;
      interface->setFan(rpm);
  
      return true;
  }
fd8461350   김태훈   오븐 기능 추가 및 수정
258
259
260
261
  bool Oven::isInterTempValid()
  {
      return isInterTempValid_ && interTempValidTime.elapsed() > 3000;
  }
2bfd3a050   김태훈   환경 설정 대응
262
263
264
265
266
267
268
269
270
271
272
273
  int Oven::msecs()
  {
      int left = cookingTimer.remainingTime();
      int interval = cookingTimer.interval();
      if (left > interval)
          left = interval;
  
      if (cooking())
          return left;
  
      return time_ * 1000;
  }
8c2952457   김태훈   응용 프로그램 추가
274
275
  bool Oven::cookingStartable()
  {
c598b01b2   김태훈   GUI 업데이트
276
      if (/*door() || */cooking() || time() <= 0)
8c2952457   김태훈   응용 프로그램 추가
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
          return false;
  
      return true;
  }
  
  bool Oven::preheatingStartable()
  {
      if (door())
          return false;
  
      return true;
  }
  
  bool Oven::cooldownStartable()
  {
      return true;
  }
  
  bool Oven::damperOpenable()
  {
      return true;
  }
  
  bool Oven::humidificationStartable()
  {
      return true;
  }
  
  void Oven::stop()
  {
      if (cooking())
          stopCooking();
  
      if (preheating())
          stopPreheating();
c598b01b2   김태훈   GUI 업데이트
312
313
      if (damper())
          closeDamper();
8c2952457   김태훈   응용 프로그램 추가
314
315
316
317
318
      if (cooldown())
          stopCooldown();
  
      if (humidification())
          stopHumidification();
8c2952457   김태훈   응용 프로그램 추가
319
320
321
322
  }
  
  void Oven::startCooking()
  {
99b8066f4   김태훈   V0.1.1
323
      if (!cooking())
8c2952457   김태훈   응용 프로그램 추가
324
      {
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
325
326
327
328
329
330
331
332
333
334
          if (door())
          {
              paused_ = true;
          }
          else
          {
              paused_ = false;
  
              if (preheating())
                  stopPreheating();
8c2952457   김태훈   응용 프로그램 추가
335
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
336
337
              if (cooldown())
                  stopCooldown();
8c2952457   김태훈   응용 프로그램 추가
338
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
339
340
341
342
              cooking_ = true;
              cookingTimer.start();
              interface->startCooking();
          }
8c2952457   김태훈   응용 프로그램 추가
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
  
          emit changed(this);
      }
  }
  
  void Oven::stopCooking()
  {
      if (cooking())
      {
          if (time() > 0)
          {
              paused_ = true;
              setTime(time());
              cookingTimer.stop();
          }
          else
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
359
360
          {
              SoundPlayer::playStop();
8c2952457   김태훈   응용 프로그램 추가
361
              setTime(0);
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
362
          }
8c2952457   김태훈   응용 프로그램 추가
363
364
365
366
367
368
369
370
371
372
373
374
  
          cooking_ = false;
          interface->stopCooking();
  
          emit changed(this);
      }
  }
  
  void Oven::startPreheating()
  {
      if (preheatingStartable())
      {
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
375
376
          if (cooking())
              stopCooking();
8c2952457   김태훈   응용 프로그램 추가
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
          preheating_ = true;
          interface->startPreheating();
  
          emit changed(this);
      }
  }
  
  void Oven::stopPreheating()
  {
      if (preheating())
      {
          preheating_ = false;
          interface->stopPreheating();
  
          emit changed(this);
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
392
393
394
  
          if (paused())
              startCooking();
8c2952457   김태훈   응용 프로그램 추가
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
      }
  }
  
  void Oven::startCooldown()
  {
      if (cooldownStartable())
      {
          if (cooking())
              stopCooking();
  
          cooldown_ = true;
          interface->startCooldown();
  
          emit changed(this);
      }
  }
  
  void Oven::stopCooldown()
  {
      if (cooldown())
      {
          cooldown_ = false;
          interface->stopCooldown();
  
          emit changed(this);
  
          if (paused())
              startCooking();
      }
  }
fd8461350   김태훈   오븐 기능 추가 및 수정
425
  void Oven::startHumidification(int secs)
8c2952457   김태훈   응용 프로그램 추가
426
427
428
  {
      if (humidificationStartable())
      {
fd8461350   김태훈   오븐 기능 추가 및 수정
429
430
          if (humidificationRepeat)
          {
8c2952457   김태훈   응용 프로그램 추가
431
fd8461350   김태훈   오븐 기능 추가 및 수정
432
433
434
435
436
437
438
439
440
          }
          else
          {
              humidification_ = true;
              humidificationTimer.start(secs * 1000);
              interface->startHumidification();
  
              emit changed(this);
          }
8c2952457   김태훈   응용 프로그램 추가
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
      }
  }
  
  void Oven::stopHumidification()
  {
      if (humidification())
      {
          humidification_ = false;
          if (humidificationTimer.isActive())
              humidificationTimer.stop();
  
          interface->stopHumidification();
  
          emit changed(this);
      }
  }
fd8461350   김태훈   오븐 기능 추가 및 수정
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
  void Oven::repeatHumidification(int runtime, int delay, int count)
  {
      humidificationRepeatInfinitely = count == 0;
      humidificationRepeatRuntime = runtime * 1000;
      humidificationRepeatDelay = delay * 1000;
      humidificationRepeatCount = count;
  
      if (humidificationRepeat)
      {
          if (humidificationRepeatPaused)
          {
              if (humidificationRepeatPausedOnRuntime)
                  humidificationRepeatRemainingTime = humidificationRepeatRuntime;
              else
                  humidificationRepeatRemainingTime = humidificationRepeatDelay;
          }
          else
          {
              runRepeatHumidification();
          }
      }
      else
      {
          humidificationRepeat = true;
  
          if (humidification())
          {
              humidificationRepeatPaused = true;
              humidificationRepeatPausedOnRuntime = false;
              humidificationRepeatRemainingTime = humidificationRepeatDelay;
          }
          else
          {
              humidificationRepeatPaused = false;
              humidificationRepeatRemainingTime = 0;
              runRepeatHumidification();
          }
      }
  }
  
  void Oven::stopRepeatHumidification()
  {
      if (!humidificationRepeat)
          return;
  
      humidificationRepeat = false;
  
      humidificationRepeatRuntimeTimer.stop();
      humidificationRepeatDelayTimer.stop();
  
      if (humidification())
          stopHumidification();
  }
  
  void Oven::pauseRepeatHumidification()
  {
      if (!humidificationRepeat)
          return;
  
      humidificationRepeatPaused = true;
  
      if (humidificationRepeatRuntimeTimer.isActive())
      {
          humidificationRepeatPausedOnRuntime = true;
          humidificationRepeatRemainingTime = humidificationRepeatRuntimeTimer.remainingTime();
          humidificationRepeatRuntimeTimer.stop();
      }
      else
      {
          humidificationRepeatPausedOnRuntime = false;
          humidificationRepeatRemainingTime = humidificationRepeatDelayTimer.remainingTime();
          humidificationRepeatDelayTimer.stop();
      }
  }
  
  void Oven::resumeRepeatHumidification()
  {
      if (!humidificationRepeat || !humidificationRepeatPaused)
          return;
  
      humidificationRepeatPaused = false;
  
      if (humidificationRepeatPausedOnRuntime)
      {
          humidificationRepeatRuntimeTimer.start(humidificationRepeatRemainingTime);
  
          humidification_ = true;
          interface->startHumidification();
          emit changed(this);
      }
      else
      {
          humidificationRepeatDelayTimer.start(humidificationRepeatRemainingTime);
      }
  }
  
  void Oven::runRepeatHumidification()
  {
      if (humidificationRepeatInfinitely || humidificationRepeatCount-- > 0)
      {
          humidificationRepeatRuntimeTimer.start(humidificationRepeatRuntime);
  
          humidification_ = true;
          interface->startHumidification();
          emit changed(this);
      }
  }
  
  void Oven::idleRepeatHumidification()
  {
      humidificationRepeatDelayTimer.start(humidificationRepeatDelay);
  
      humidification_ = false;
      interface->stopHumidification();
      emit changed(this);
  }
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
573
  void Oven::openDamper(int secs)
8c2952457   김태훈   응용 프로그램 추가
574
  {
c598b01b2   김태훈   GUI 업데이트
575
576
577
      if (!damper())
      {
          damper_ = true;
c598b01b2   김태훈   GUI 업데이트
578
          interface->openDamper();
8c2952457   김태훈   응용 프로그램 추가
579
c598b01b2   김태훈   GUI 업데이트
580
581
          emit changed(this);
      }
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
582
583
  
      damperTimer.start(secs * 1000);
8c2952457   김태훈   응용 프로그램 추가
584
585
586
587
  }
  
  void Oven::closeDamper()
  {
c598b01b2   김태훈   GUI 업데이트
588
589
590
591
592
593
594
      if (damper())
      {
          damper_ = false;
          if (damperTimer.isActive())
              damperTimer.stop();
  
          interface->closeDamper();
8c2952457   김태훈   응용 프로그램 추가
595
c598b01b2   김태훈   GUI 업데이트
596
597
          emit changed(this);
      }
8c2952457   김태훈   응용 프로그램 추가
598
  }
fd8461350   김태훈   오븐 기능 추가 및 수정
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
  void Oven::repeatDamper(int runtime, int delay, int count)
  {
      damperRepeatInfinitely = count == 0;
      damperRepeatRuntime = runtime * 1000;
      damperRepeatDelay = delay * 1000;
      damperRepeatCount = count;
  
      if (damperRepeat)
      {
          if (damperRepeatPaused)
          {
              if (damperRepeatPausedOnRuntime)
                  damperRepeatRemainingTime = damperRepeatRuntime;
              else
                  damperRepeatRemainingTime = damperRepeatDelay;
          }
          else
          {
              runRepeatDamper();
          }
      }
      else
      {
          damperRepeat = true;
  
          if (damper())
          {
              damperRepeatPaused = true;
              damperRepeatPausedOnRuntime = false;
              damperRepeatRemainingTime = damperRepeatDelay;
          }
          else
          {
              damperRepeatPaused = false;
              damperRepeatRemainingTime = 0;
              runRepeatDamper();
          }
      }
  }
  
  void Oven::stopRepeatDamper()
  {
      if (!damperRepeat)
          return;
  
      damperRepeat = false;
  
      damperRepeatRuntimeTimer.stop();
      damperRepeatDelayTimer.stop();
  
      if (damper())
          closeDamper();
  }
  
  void Oven::pauseRepeatDamper()
  {
      if (!damperRepeat)
          return;
  
      damperRepeatPaused = true;
  
      if (damperRepeatRuntimeTimer.isActive())
      {
          damperRepeatPausedOnRuntime = true;
          damperRepeatRemainingTime = damperRepeatRuntimeTimer.remainingTime();
          damperRepeatRuntimeTimer.stop();
      }
      else
      {
          damperRepeatPausedOnRuntime = false;
          damperRepeatRemainingTime = damperRepeatDelayTimer.remainingTime();
          damperRepeatDelayTimer.stop();
      }
  }
  
  void Oven::resumeRepeatDamper()
  {
      if (!damperRepeat || !damperRepeatPaused)
          return;
  
      damperRepeatPaused = false;
  
      if (damperRepeatPausedOnRuntime)
      {
          damperRepeatRuntimeTimer.start(damperRepeatRemainingTime);
  
          damper_ = true;
          interface->closeDamper();
          emit changed(this);
      }
      else
      {
          damperRepeatDelayTimer.start(damperRepeatRemainingTime);
      }
  }
  
  void Oven::runRepeatDamper()
  {
      if (damperRepeatInfinitely || damperRepeatCount-- > 0)
      {
          damperRepeatRuntimeTimer.start(damperRepeatRuntime);
  
          damper_ = true;
          interface->openDamper();
          emit changed(this);
      }
  }
  
  void Oven::idleRepeatDamper()
  {
      damperRepeatDelayTimer.start(damperRepeatDelay);
  
      damper_ = false;
      interface->closeDamper();
      emit changed(this);
  }
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
  void Oven::setCurrentHumidity(int percentage)
  {
      if (currentHumidity() != percentage)
      {
          currentHumidity_ = percentage;
          emit changed(this);
      }
  }
  
  void Oven::setCurrentTemp(int celsius)
  {
      if (currentTemp() != celsius)
      {
          currentTemp_ = celsius;
          emit changed(this);
      }
  }
  
  void Oven::setCurrentInterTemp(int celsius)
  {
      if (currentInterTemp() != celsius)
      {
          currentInterTemp_ = celsius;
fd8461350   김태훈   오븐 기능 추가 및 수정
738
739
740
741
742
743
744
745
746
747
748
749
750
751
  
          if (isInterTempValid_)
          {
              if (currentInterTemp_ == currentTemp_)
                  isInterTempValid_ = false;
          }
          else
          {
              if (currentInterTemp_ + 20 < currentTemp_)
              {
                  isInterTempValid_ = true;
                  interTempValidTime = QTime::currentTime();
              }
          }
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
752
753
754
          emit changed(this);
      }
  }
8c2952457   김태훈   응용 프로그램 추가
755
756
757
758
759
760
761
762
  
  
  
  
  int Oven::maxTemp()
  {
      switch (mode())
      {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
763
      case Define::DryMode:
8c2952457   김태훈   응용 프로그램 추가
764
          return 300;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
765
      case Define::SteamMode:
8c2952457   김태훈   응용 프로그램 추가
766
          return 130;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
767
      case Define::CombiMode:
8c2952457   김태훈   응용 프로그램 추가
768
769
770
771
772
773
774
775
776
777
          return 300;
      default:
          return 0;
      }
  }
  
  int Oven::minTemp()
  {
      switch (mode())
      {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
778
      case Define::DryMode:
8c2952457   김태훈   응용 프로그램 추가
779
          return 30;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
780
      case Define::SteamMode:
8c2952457   김태훈   응용 프로그램 추가
781
          return 30;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
782
      case Define::CombiMode:
8c2952457   김태훈   응용 프로그램 추가
783
784
785
786
787
788
789
790
791
792
          return 30;
      default:
          return 0;
      }
  }
  
  int Oven::maxInterTemp()
  {
      switch (mode())
      {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
793
      case Define::DryMode:
8c2952457   김태훈   응용 프로그램 추가
794
          return 99;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
795
      case Define::SteamMode:
8c2952457   김태훈   응용 프로그램 추가
796
          return 99;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
797
      case Define::CombiMode:
8c2952457   김태훈   응용 프로그램 추가
798
799
800
801
802
803
804
805
806
807
          return 99;
      default:
          return 0;
      }
  }
  
  int Oven::minInterTemp()
  {
      switch (mode())
      {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
808
      case Define::DryMode:
8c2952457   김태훈   응용 프로그램 추가
809
          return 30;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
810
      case Define::SteamMode:
8c2952457   김태훈   응용 프로그램 추가
811
          return 30;
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
812
      case Define::CombiMode:
8c2952457   김태훈   응용 프로그램 추가
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
          return 30;
      default:
          return 0;
      }
  }
  
  int Oven::maxFan()
  {
      return 5;
  }
  
  int Oven::minFan()
  {
      return 1;
  }
  
  void Oven::onDoorOpened()
  {
      door_ = true;
  
      emit changed(this);
  
      if (cooking())
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
836
      {
8c2952457   김태훈   응용 프로그램 추가
837
          stopCooking();
fd8461350   김태훈   오븐 기능 추가 및 수정
838
839
840
  
          if (damperRepeat)
              pauseRepeatDamper();
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
841
842
          openDamper(7);
      }
8c2952457   김태훈   응용 프로그램 추가
843
844
845
846
847
848
849
  }
  
  void Oven::onDoorClosed()
  {
      door_ = false;
  
      emit changed(this);
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
850
      if (!cooldown() && paused())
8c2952457   김태훈   응용 프로그램 추가
851
          startCooking();
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
852
853
854
  
      if (damper())
          closeDamper();
fd8461350   김태훈   오븐 기능 추가 및 수정
855
856
857
  
      if (damperRepeat)
          resumeRepeatDamper();
8c2952457   김태훈   응용 프로그램 추가
858
  }