3 #if defined(USE_OLED_SPI) || defined(USE_OLED_I2C) || defined(USE_OLED_SPI_SMALL) || defined(HAS_TFT_SCREEN)
5 void Screen::nullCallback(int updateType
) {}
6 void (*Screen::updatecallback
)(int updateType
) = &nullCallback
;
9 #ifdef Regulatory_Domain_ISM_2400
10 const char *Screen::rate_string
[RATE_MAX_NUMBER
] = {
17 const char *Screen::rate_string
[RATE_MAX_NUMBER
] = {
25 const char *Screen::power_string
[POWER_MAX_NUMBER
] = {
36 const char *Screen::ratio_string
[RATIO_MAX_NUMBER
] = {
47 const char *Screen::powersaving_string
[POWERSAVING_MAX_NUMBER
] = {
52 const char *Screen::smartfan_string
[SMARTFAN_MAX_NUMBER
] = {
58 const char *Screen::main_menu_line_1
[] = {
68 const char *Screen::main_menu_line_2
[] = {
78 void Screen::doMainMenuPage(int action
)
80 int index
= main_menu_page_index
;
81 if(action
== USER_ACTION_UP
)
85 if (index
== MAIN_MENU_SMARTFAN_INDEX
) index
--;
88 if (index
== MAIN_MENU_POWERSAVING_INDEX
) index
--;
91 if(action
== USER_ACTION_DOWN
)
95 if (index
== MAIN_MENU_POWERSAVING_INDEX
) index
++;
98 if (index
== MAIN_MENU_SMARTFAN_INDEX
) index
++;
101 if(index
< MAIN_MENU_RATE_INDEX
)
103 index
= MAIN_MENU_UPDATEFW_INDEX
;
105 if(index
> MAIN_MENU_UPDATEFW_INDEX
)
107 index
= MAIN_MENU_RATE_INDEX
;
109 main_menu_page_index
= index
;
111 updateMainMenuPage();
114 void Screen::doPageBack()
116 if(current_page_index
== PAGE_MAIN_MENU_INDEX
)
120 else if((current_page_index
== PAGE_SUB_RATE_INDEX
) ||
121 (current_page_index
== PAGE_SUB_POWER_INDEX
) ||
122 (current_page_index
== PAGE_SUB_RATIO_INDEX
) ||
123 (current_page_index
== PAGE_SUB_POWERSAVING_INDEX
) ||
124 (current_page_index
== PAGE_SUB_SMARTFAN_INDEX
))
126 current_page_index
= PAGE_MAIN_MENU_INDEX
;
127 doMainMenuPage(USER_ACTION_NONE
);
129 else if(current_page_index
== PAGE_SUB_BIND_INDEX
)
131 current_page_index
= PAGE_MAIN_MENU_INDEX
;
132 doMainMenuPage(USER_ACTION_NONE
);
134 else if(current_page_index
== PAGE_SUB_BINDING_INDEX
)
136 current_page_index
= PAGE_SUB_BIND_INDEX
;
137 updateSubBindConfirmPage();
138 updatecallback(USER_UPDATE_TYPE_EXIT_BINDING
);
140 current_screen_status
= SCREEN_STATUS_WORK
;
142 else if(current_page_index
== PAGE_SUB_UPDATEFW_INDEX
)
144 current_page_index
= PAGE_MAIN_MENU_INDEX
;
145 doMainMenuPage(USER_ACTION_NONE
);
146 updatecallback(USER_UPDATE_TYPE_EXIT_WIFI
);
150 void Screen::doPageForward()
152 if(current_page_index
== PAGE_MAIN_MENU_INDEX
)
154 if((main_menu_page_index
== MAIN_MENU_RATE_INDEX
) ||
155 (main_menu_page_index
== MAIN_MENU_POWER_INDEX
) ||
156 (main_menu_page_index
== MAIN_MENU_RATIO_INDEX
) ||
157 (main_menu_page_index
== MAIN_MENU_POWERSAVING_INDEX
) ||
158 (main_menu_page_index
== MAIN_MENU_SMARTFAN_INDEX
))
160 current_page_index
= main_menu_page_index
;
161 updateSubFunctionPage();
163 else if(main_menu_page_index
== MAIN_MENU_UPDATEFW_INDEX
)
165 current_page_index
= PAGE_SUB_UPDATEFW_INDEX
;
166 updateSubWIFIModePage();
168 else if(main_menu_page_index
== MAIN_MENU_BIND_INDEX
)
170 current_page_index
= PAGE_SUB_BIND_INDEX
;
171 updateSubBindConfirmPage();
174 else if((current_page_index
== PAGE_SUB_RATE_INDEX
) ||
175 (current_page_index
== PAGE_SUB_POWER_INDEX
) ||
176 (current_page_index
== PAGE_SUB_RATIO_INDEX
) ||
177 (current_page_index
== PAGE_SUB_POWERSAVING_INDEX
) ||
178 (current_page_index
== PAGE_SUB_SMARTFAN_INDEX
))
180 current_page_index
= PAGE_MAIN_MENU_INDEX
;
181 doMainMenuPage(USER_ACTION_NONE
);
183 else if(current_page_index
== PAGE_SUB_BIND_INDEX
)
185 current_page_index
= PAGE_SUB_BINDING_INDEX
;
186 updateSubBindingPage();
190 void Screen::doValueConfirm()
192 if(current_page_index
== PAGE_SUB_RATE_INDEX
)
194 updatecallback(USER_UPDATE_TYPE_RATE
);
196 else if(current_page_index
== PAGE_SUB_POWER_INDEX
)
198 updatecallback(USER_UPDATE_TYPE_POWER
);
200 else if(current_page_index
== PAGE_SUB_RATIO_INDEX
)
202 updatecallback(USER_UPDATE_TYPE_RATIO
);
204 else if(current_page_index
== PAGE_SUB_SMARTFAN_INDEX
)
206 updatecallback(USER_UPDATE_TYPE_SMARTFAN
);
208 else if(current_page_index
== PAGE_SUB_POWERSAVING_INDEX
)
210 updatecallback(USER_UPDATE_TYPE_POWERSAVING
);
216 void Screen::doUserAction(int action
)
218 if(action
== USER_ACTION_LEFT
)
222 else if(action
== USER_ACTION_RIGHT
)
226 else if(action
== USER_ACTION_CONFIRM
)
232 doValueSelection(action
);
236 void Screen::activeScreen()
238 doMainMenuPage(USER_ACTION_NONE
);
240 current_screen_status
= SCREEN_STATUS_WORK
;
241 current_page_index
= PAGE_MAIN_MENU_INDEX
;
244 void Screen::doValueSelection(int action
)
246 if(current_page_index
== PAGE_MAIN_MENU_INDEX
)
248 doMainMenuPage(action
);
250 else if(current_page_index
== PAGE_SUB_RATE_INDEX
)
252 doRateValueSelect(action
);
254 else if(current_page_index
== PAGE_SUB_POWER_INDEX
)
256 doPowerValueSelect(action
);
258 else if(current_page_index
== PAGE_SUB_RATIO_INDEX
)
260 doRatioValueSelect(action
);
262 else if(current_page_index
== PAGE_SUB_POWERSAVING_INDEX
)
264 doPowerSavingValueSelect(action
);
266 else if(current_page_index
== PAGE_SUB_SMARTFAN_INDEX
)
268 doSmartFanValueSelect(action
);
272 void Screen::nextIndex(int &index
, int action
, int min
, int max
)
274 if(action
== USER_ACTION_UP
)
278 if(action
== USER_ACTION_DOWN
)
293 void Screen::setInWifiMode()
295 current_screen_status
= SCREEN_STATUS_WORK
;
296 main_menu_page_index
= MAIN_MENU_UPDATEFW_INDEX
;
297 current_page_index
= PAGE_SUB_UPDATEFW_INDEX
;
298 updateSubWIFIModePage();