Commit ea536cd1d3cecfd2e9eccbc225b305b838b9d9eb
1 parent
7c415d2f71
Exists in
master
and in
2 other branches
적재 / 조리 중 문 열림 시간 모니터링 기능 추가
Showing
4 changed files
with
251 additions
and
3 deletions
Show diff stats
app/gui/oven_control/autocookwindow.cpp
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | #include "configwindow.h" |
11 | 11 | #include "washwindow.h" |
12 | 12 | #include "mainwindow.h" |
13 | +#include "config.h" | |
14 | +#include "errorpopupdlg.h" | |
13 | 15 | |
14 | 16 | AutoCookWindow::AutoCookWindow(QWidget *parent, Cook cook) : |
15 | 17 | QMainWindow(parent), |
... | ... | @@ -27,6 +29,36 @@ AutoCookWindow::AutoCookWindow(QWidget *parent, Cook cook) : |
27 | 29 | autocook = AutoCook(this->cook); |
28 | 30 | processSelected = false; |
29 | 31 | |
32 | + config_item item = Config::getInstance()->getConfigValue(Define::config_loading_door_monitoring); | |
33 | + if (item.d8.d8_0 > 0 && item.d8.d8_0 < 4) | |
34 | + { | |
35 | + loadingMonitorLevel = item.d8.d8_0; | |
36 | + loadingMonitor1 = item.d8.d8_1 * 1000; | |
37 | + loadingMonitor2 = item.d8.d8_2 * 1000; | |
38 | + loadingMonitor3 = item.d8.d8_3 * 1000; | |
39 | + currentLoadingMonitorLevel = 0; | |
40 | + } | |
41 | + else | |
42 | + loadingMonitorLevel = 0; | |
43 | + | |
44 | + item = Config::getInstance()->getConfigValue(Define::config_cooking_door_monitoring); | |
45 | + if (item.d8.d8_0 > 0 && item.d8.d8_0 < 4) | |
46 | + { | |
47 | + cookingMonitorLevel = item.d8.d8_0; | |
48 | + cookingMonitor1 = item.d8.d8_1 * 1000; | |
49 | + cookingMonitor2 = item.d8.d8_2 * 1000; | |
50 | + cookingMonitor3 = item.d8.d8_3 * 1000; | |
51 | + currentCookingMonitorLevel = 0; | |
52 | + } | |
53 | + else | |
54 | + cookingMonitorLevel = 0; | |
55 | + | |
56 | + if (loadingMonitorLevel > 0 || cookingMonitorLevel > 0) | |
57 | + { | |
58 | + connect(&monitorTimer, SIGNAL(timeout()), SLOT(monitor())); | |
59 | + monitorTimer.start(100); | |
60 | + } | |
61 | + | |
30 | 62 | setupUi(); |
31 | 63 | |
32 | 64 | Oven *oven = Oven::getInstance(); |
... | ... | @@ -70,6 +102,8 @@ AutoCookWindow::AutoCookWindow(QWidget *parent, Cook cook) : |
70 | 102 | |
71 | 103 | AutoCookWindow::~AutoCookWindow() |
72 | 104 | { |
105 | + Oven::getInstance()->stop(); | |
106 | + | |
73 | 107 | delete ui; |
74 | 108 | } |
75 | 109 | |
... | ... | @@ -704,6 +738,114 @@ void AutoCookWindow::jumpWash() |
704 | 738 | MainWindow::jump(w); |
705 | 739 | } |
706 | 740 | |
741 | +void AutoCookWindow::monitor() | |
742 | +{ | |
743 | + Define::StepClass step = Define::classify(autocook.cook.steps[autocook.currentStepIndex].type); | |
744 | + | |
745 | + if (step == Define::PreheatClass || step == Define::CookClass) | |
746 | + { | |
747 | + if (Oven::getInstance()->door()) | |
748 | + { | |
749 | + switch (currentCookingMonitorLevel) | |
750 | + { | |
751 | + case 0: | |
752 | + cookingMonitorTime1.start(); | |
753 | + currentCookingMonitorLevel = 1; | |
754 | + break; | |
755 | + case 1: | |
756 | + if (cookingMonitorLevel >= 1 && cookingMonitorTime1.elapsed() > cookingMonitor1) | |
757 | + { | |
758 | + SoundPlayer::playError2(); | |
759 | + | |
760 | + ErrorPopupDlg *d = new ErrorPopupDlg(this, "문을 닫아주세요", "조리 중 문 열림 시간 모니터링 1단계"); | |
761 | + d->showFullScreen(); | |
762 | + | |
763 | + cookingMonitorTime2.start(); | |
764 | + currentCookingMonitorLevel = 2; | |
765 | + } | |
766 | + break; | |
767 | + case 2: | |
768 | + if (cookingMonitorLevel >= 2 && cookingMonitorTime2.elapsed() > cookingMonitor2) | |
769 | + { | |
770 | + SoundPlayer::playError2(); | |
771 | + | |
772 | + ErrorPopupDlg *d = new ErrorPopupDlg(this, "문을 닫아주세요", "조리 중 문 열림 시간 모니터링 2단계"); | |
773 | + d->showFullScreen(); | |
774 | + | |
775 | + cookingMonitorTime3.start(); | |
776 | + currentCookingMonitorLevel = 3; | |
777 | + } | |
778 | + break; | |
779 | + case 3: | |
780 | + if (cookingMonitorLevel >= 3 && cookingMonitorTime3.elapsed() > cookingMonitor3) | |
781 | + { | |
782 | + SoundPlayer::playError2(); | |
783 | + | |
784 | + ErrorPopupDlg *d = new ErrorPopupDlg(MainWindow::getInstance(), "문이 오래 열려있어 조리가 취소되었습니다", "조리 중 문 열림 시간 모니터링 3단계"); | |
785 | + d->showFullScreen(); | |
786 | + | |
787 | + MainWindow::killChild(); | |
788 | + } | |
789 | + } | |
790 | + } | |
791 | + else if (currentCookingMonitorLevel > 0) | |
792 | + { | |
793 | + currentCookingMonitorLevel = 0; | |
794 | + } | |
795 | + } | |
796 | + else if (step == Define::DoorClass) | |
797 | + { | |
798 | + if (Oven::getInstance()->door()) | |
799 | + { | |
800 | + switch (currentLoadingMonitorLevel) | |
801 | + { | |
802 | + case 0: | |
803 | + loadingMonitorTime1.start(); | |
804 | + currentLoadingMonitorLevel = 1; | |
805 | + break; | |
806 | + case 1: | |
807 | + if (loadingMonitorLevel >= 1 && loadingMonitorTime1.elapsed() > loadingMonitor1) | |
808 | + { | |
809 | + SoundPlayer::playError2(); | |
810 | + | |
811 | + ErrorPopupDlg *d = new ErrorPopupDlg(this, "문을 닫아주세요", "적재 중 문 열림 시간 모니터링 1단계"); | |
812 | + d->showFullScreen(); | |
813 | + | |
814 | + loadingMonitorTime2.start(); | |
815 | + currentLoadingMonitorLevel = 2; | |
816 | + } | |
817 | + break; | |
818 | + case 2: | |
819 | + if (loadingMonitorLevel >= 2 && loadingMonitorTime2.elapsed() > loadingMonitor2) | |
820 | + { | |
821 | + SoundPlayer::playError2(); | |
822 | + | |
823 | + ErrorPopupDlg *d = new ErrorPopupDlg(this, "문을 닫아주세요", "적재 중 문 열림 시간 모니터링 2단계"); | |
824 | + d->showFullScreen(); | |
825 | + | |
826 | + loadingMonitorTime3.start(); | |
827 | + currentLoadingMonitorLevel = 3; | |
828 | + } | |
829 | + break; | |
830 | + case 3: | |
831 | + if (loadingMonitorLevel >= 3 && loadingMonitorTime3.elapsed() > loadingMonitor3) | |
832 | + { | |
833 | + SoundPlayer::playError2(); | |
834 | + | |
835 | + ErrorPopupDlg *d = new ErrorPopupDlg(this, "문을 닫아주세요", "적재 중 문 열림 시간 모니터링 3단계"); | |
836 | + d->showFullScreen(); | |
837 | + | |
838 | + MainWindow::killChild(); | |
839 | + } | |
840 | + } | |
841 | + } | |
842 | + else if (currentLoadingMonitorLevel > 0) | |
843 | + { | |
844 | + currentLoadingMonitorLevel = 0; | |
845 | + } | |
846 | + } | |
847 | +} | |
848 | + | |
707 | 849 | void AutoCookWindow::on_selectCookButton_clicked() |
708 | 850 | { |
709 | 851 | ... | ... |
app/gui/oven_control/autocookwindow.h
... | ... | @@ -55,6 +55,26 @@ private: |
55 | 55 | |
56 | 56 | QTimer updateViewTimer; |
57 | 57 | |
58 | + int loadingMonitorLevel; | |
59 | + int loadingMonitor1; | |
60 | + int loadingMonitor2; | |
61 | + int loadingMonitor3; | |
62 | + QTime loadingMonitorTime1; | |
63 | + QTime loadingMonitorTime2; | |
64 | + QTime loadingMonitorTime3; | |
65 | + int currentLoadingMonitorLevel; | |
66 | + | |
67 | + int cookingMonitorLevel; | |
68 | + int cookingMonitor1; | |
69 | + int cookingMonitor2; | |
70 | + int cookingMonitor3; | |
71 | + QTime cookingMonitorTime1; | |
72 | + QTime cookingMonitorTime2; | |
73 | + QTime cookingMonitorTime3; | |
74 | + int currentCookingMonitorLevel; | |
75 | + | |
76 | + QTimer monitorTimer; | |
77 | + | |
58 | 78 | void setupUi(); |
59 | 79 | |
60 | 80 | private slots: |
... | ... | @@ -71,6 +91,8 @@ private slots: |
71 | 91 | void jumpConfig(); |
72 | 92 | void jumpWash(); |
73 | 93 | |
94 | + void monitor(); | |
95 | + | |
74 | 96 | void on_selectCookButton_clicked(); |
75 | 97 | void on_homeButton_clicked(); |
76 | 98 | void on_configCookButton_clicked(); | ... | ... |
app/gui/oven_control/manualcookwindow.cpp
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #include "configwindow.h" |
21 | 21 | #include "primewindow.h" |
22 | 22 | #include "washwindow.h" |
23 | +#include "errorpopupdlg.h" | |
23 | 24 | |
24 | 25 | #include <QTime> |
25 | 26 | |
... | ... | @@ -47,6 +48,25 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, Define::Mode mode) : |
47 | 48 | lastViewHumidification = false; |
48 | 49 | lastViewFan = -1; |
49 | 50 | |
51 | + Config *config = Config::getInstance(); | |
52 | + config_item item = config->getConfigValue(Define::config_cooking_door_monitoring); | |
53 | + | |
54 | + monitorLevel = item.d8.d8_0; | |
55 | + if (monitorLevel > 0 && monitorLevel < 4) | |
56 | + { | |
57 | + monitor1.setSingleShot(true); | |
58 | + monitor2.setSingleShot(true); | |
59 | + monitor3.setSingleShot(true); | |
60 | + monitor1.setInterval(item.d8.d8_1 * 1000); | |
61 | + monitor2.setInterval(item.d8.d8_2 * 1000); | |
62 | + monitor3.setInterval(item.d8.d8_3 * 1000); | |
63 | + connect(&monitor1, SIGNAL(timeout()), SLOT(onMonitor1Timeout())); | |
64 | + connect(&monitor2, SIGNAL(timeout()), SLOT(onMonitor2Timeout())); | |
65 | + connect(&monitor3, SIGNAL(timeout()), SLOT(onMonitor3Timeout())); | |
66 | + } | |
67 | + else | |
68 | + monitorLevel = 0; | |
69 | + | |
50 | 70 | connect(oven, SIGNAL(changed(Oven*)), this, SLOT(onOvenUpdated(Oven*))); |
51 | 71 | |
52 | 72 | connect(ui->humiditySlider, SIGNAL(valueChanged(int)), oven, SLOT(setHumidity(int))); |
... | ... | @@ -101,6 +121,8 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, ManualCookSetting setting) |
101 | 121 | |
102 | 122 | ManualCookWindow::~ManualCookWindow() |
103 | 123 | { |
124 | + stop(); | |
125 | + | |
104 | 126 | delete ui; |
105 | 127 | } |
106 | 128 | |
... | ... | @@ -364,9 +386,7 @@ void ManualCookWindow::onOvenUpdated(Oven *oven) |
364 | 386 | updateView(); |
365 | 387 | |
366 | 388 | if (oven->interTempEnabled() && oven->currentInterTemp() >= oven->interTemp()) |
367 | - { | |
368 | - oven->stopCooking(); | |
369 | - } | |
389 | + stop(); | |
370 | 390 | |
371 | 391 | if (repeat && !oven->cooking()) |
372 | 392 | { |
... | ... | @@ -383,6 +403,23 @@ QPushButton:pressed { background-image: url(:/images/manual_button/repeat_ov.png |
383 | 403 | oven->setInterTempEnabled(repeatSetting.coreTempEnabled); |
384 | 404 | oven->setInterTemp(repeatSetting.coreTemp); |
385 | 405 | } |
406 | + | |
407 | + if (oven->paused() && oven->door()) | |
408 | + { | |
409 | + if (monitorLevel > 0 && !monitorTriggered) | |
410 | + { | |
411 | + monitorTriggered = true; | |
412 | + monitor1.start(); | |
413 | + } | |
414 | + } | |
415 | + | |
416 | + if (monitorTriggered && !oven->door()) | |
417 | + { | |
418 | + monitorTriggered = false; | |
419 | + monitor1.stop(); | |
420 | + monitor2.stop(); | |
421 | + monitor3.stop(); | |
422 | + } | |
386 | 423 | } |
387 | 424 | |
388 | 425 | void ManualCookWindow::setOvenDefault(Define::Mode mode) |
... | ... | @@ -416,6 +453,14 @@ void ManualCookWindow::start() |
416 | 453 | s.coreTemp = oven->interTemp(); |
417 | 454 | |
418 | 455 | CookHistory::record(s); |
456 | + | |
457 | + if (monitorLevel > 0 && oven->door()) | |
458 | + { | |
459 | + monitorTriggered = true; | |
460 | + monitor1.start(); | |
461 | + } | |
462 | + else | |
463 | + monitorTriggered = false; | |
419 | 464 | } |
420 | 465 | } |
421 | 466 | |
... | ... | @@ -480,6 +525,34 @@ void ManualCookWindow::jumpWash() |
480 | 525 | MainWindow::jump(w); |
481 | 526 | } |
482 | 527 | |
528 | +void ManualCookWindow::onMonitor1Timeout() | |
529 | +{ | |
530 | + SoundPlayer::playError1(); | |
531 | + ErrorPopupDlg *d = new ErrorPopupDlg(this, "문을 닫아주세요", "조리 중 문 열림 시간 모니터링 1단계"); | |
532 | + d->showFullScreen(); | |
533 | + | |
534 | + if (monitorLevel > 1) | |
535 | + monitor2.start(); | |
536 | +} | |
537 | + | |
538 | +void ManualCookWindow::onMonitor2Timeout() | |
539 | +{ | |
540 | + SoundPlayer::playError1(); | |
541 | + ErrorPopupDlg *d = new ErrorPopupDlg(this, "문을 닫아주세요", "조리 중 문 열림 시간 모니터링 2단계"); | |
542 | + d->showFullScreen(); | |
543 | + | |
544 | + if (monitorLevel > 2) | |
545 | + monitor3.start(); | |
546 | +} | |
547 | + | |
548 | +void ManualCookWindow::onMonitor3Timeout() | |
549 | +{ | |
550 | + SoundPlayer::playError1(); | |
551 | + ErrorPopupDlg *d = new ErrorPopupDlg(MainWindow::getInstance(), "문이 오래 열려있어 조리가 취소되었습니다", "조리 중 문 열림 시간 모니터링 3단계"); | |
552 | + d->showFullScreen(); | |
553 | + close(); | |
554 | +} | |
555 | + | |
483 | 556 | void ManualCookWindow::on_steamButton_clicked() |
484 | 557 | { |
485 | 558 | setOvenDefault(Define::SteamMode); | ... | ... |
app/gui/oven_control/manualcookwindow.h
... | ... | @@ -43,6 +43,10 @@ private slots: |
43 | 43 | void jumpFavorites(); |
44 | 44 | void jumpWash(); |
45 | 45 | |
46 | + void onMonitor1Timeout(); | |
47 | + void onMonitor2Timeout(); | |
48 | + void onMonitor3Timeout(); | |
49 | + | |
46 | 50 | void on_steamButton_clicked(); |
47 | 51 | void on_combiButton_clicked(); |
48 | 52 | void on_dryheatButton_clicked(); |
... | ... | @@ -99,6 +103,13 @@ private: |
99 | 103 | bool lastViewHumidification; |
100 | 104 | int lastViewFan; |
101 | 105 | |
106 | + int monitorLevel; | |
107 | + QTimer monitor1; | |
108 | + QTimer monitor2; | |
109 | + QTimer monitor3; | |
110 | + bool monitorTriggered; | |
111 | + | |
112 | + | |
102 | 113 | ManualCookSetting repeatSetting; |
103 | 114 | bool repeat; |
104 | 115 | }; | ... | ... |