-
Notifications
You must be signed in to change notification settings - Fork 3
/
printingscreen.h
136 lines (103 loc) · 3.29 KB
/
printingscreen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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
#ifndef NEWSCREEN_H
#define NEWSCREEN_H
#include "screen.h"
#include <lvstyle.hpp>
#include <lvslot.hpp>
class LVImage;
class LVLabel;
class LVButton;
class PrintingScreen : public Screen
{
LV_OBJECT
enum PrintingState : uint8_t
{
PS_Printing,
PS_Paused,
PS_Stoped,
PS_Finished,
PS_RemotePrinting,
};
protected:
char m_printFileName[30]; //!< 打印文件名
bool m_showQuestionMark = false; //!< 轴位置不清楚时显示 ???
ScreenTask * m_queryTask = nullptr; //!< 位置查询任务
PrintingState m_printingState = PS_Finished; //!< 打印状态
uint8_t m_printintProcess = 0; //!< 打印进度
uint32_t m_lastOneProgressPercentElapsedTime = 0; //!< 最后打印完成1%的耗时 s
uint32_t m_lastProgressPercentTime = 0; //!< 最后打印进度变化的时间 s
LVImage * m_imgBack = nullptr;
LVLabel * m_labTitle = nullptr;
LVLabel * m_labFile = nullptr;
LVButton * m_butPause = nullptr;
LVImage * m_imgPause = nullptr;
LVButton * m_butStop = nullptr;
LVImage * m_imgHeatEnd = nullptr;
LVLabel * m_labHeatEnd = nullptr;
LVImage * m_imgHeatBed = nullptr;
LVLabel * m_labHeatBed = nullptr;
LVImage * m_imgFan = nullptr;
LVLabel * m_labFan = nullptr;
LVLabel * m_labRate = nullptr;
LVLabel * m_labFlow = nullptr;
LVLabel * m_labTimeKeep = nullptr;
LVLabel * m_labTimeEstimate = nullptr;
LVBar * m_barProgress = nullptr;
LVLabel * m_labProcess = nullptr;
LVLabel * m_labXPos = nullptr;
LVLabel * m_labYPos = nullptr;
LVLabel * m_labZPos = nullptr;
LVLabel * m_labSpeed = nullptr;
LVStyle styleButRed;
LVStyle styleButGreen;
LVStyle styleButBlue;
LVStyle styleProcessBar;
LVStyle styleProcessIndic;
LVSlot m_slotPrintingEvent; //!< 打印事件槽
public:
PrintingScreen();
~PrintingScreen();
void printMesgFunc(uint32_t retId);
lv_res_t onButPauseClicked(struct _lv_obj_t * obj);
lv_res_t onButStopClicked(struct _lv_obj_t * obj);
lv_res_t onButBackClicked (struct _lv_obj_t * obj);
void PrintingStart();
void printingStop();
void pringingPause();
void printingResume();
void pringingFinish();
void remotePrinting();
bool isRemotePrinting();
bool isPrintingFinished();
void resetPrintingState();
void updatePrintCtrlButton();
LVLabel *labFile();
/**
* @brief 设置打印文件名
* @param name 打印的文件名
*/
void setPrintFileName(const char * name);
/**
* @brief 设置打印进度
* @param value
*/
void setPrintintProcess(uint16_t value);
void setPrintingElapsedTime(uint32_t value);
void setPrintingEstimatedTime(uint32_t value);
// Screen interface
protected:
virtual void onLangChanged() override;
virtual bool initScreen() override;
virtual void beforeCleanScreen() override;
virtual void afterCleanScreen() override;
virtual bool beforeShow() override;
/**
* @brief 处理打印事件
* @param signal
*/
void onPrintingEvent(LVSignal *signal);
void onPrintingStarted(LVSignal * signal);
void onPrintingPaused(LVSignal * signal);
void onPrintingStopped(LVSignal * signal);
void onRemotePrinting(LVSignal * signal);
};
#endif // NEWSCREEN_H