My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DGUSTxHandler.cpp 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../../inc/MarlinConfigPre.h"
  23. #if ENABLED(DGUS_LCD_UI_RELOADED)
  24. #include "DGUSTxHandler.h"
  25. #include "DGUSScreenHandler.h"
  26. #include "config/DGUS_Data.h"
  27. #include "../ui_api.h"
  28. #include "../../../module/stepper.h"
  29. #include "../../../module/printcounter.h"
  30. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  31. #include "../../../feature/pause.h"
  32. #endif
  33. #if ENABLED(SDSUPPORT)
  34. void DGUSTxHandler::SetFileControlState(int file, bool state) {
  35. DGUS_Control control;
  36. switch (file) {
  37. default: return;
  38. case 0:
  39. control = DGUS_Control::FILE0;
  40. break;
  41. case 1:
  42. control = DGUS_Control::FILE1;
  43. break;
  44. case 2:
  45. control = DGUS_Control::FILE2;
  46. break;
  47. case 3:
  48. control = DGUS_Control::FILE3;
  49. break;
  50. case 4:
  51. control = DGUS_Control::FILE4;
  52. break;
  53. }
  54. if (state) {
  55. dgus_display.EnableControl(DGUS_Screen::PRINT,
  56. DGUSDisplay::RETURN_KEY_CODE,
  57. control);
  58. }
  59. else {
  60. dgus_display.DisableControl(DGUS_Screen::PRINT,
  61. DGUSDisplay::RETURN_KEY_CODE,
  62. control);
  63. }
  64. }
  65. void DGUSTxHandler::FileType(DGUS_VP &vp) {
  66. // Batch send
  67. uint16_t data[DGUS_FILE_COUNT];
  68. for (int i = 0; i < DGUS_FILE_COUNT; i++) {
  69. if (!dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + i)) {
  70. data[i] = Swap16((uint16_t)DGUS_Data::SDType::NONE);
  71. SetFileControlState(i, false);
  72. continue;
  73. }
  74. data[i] = dgus_screen_handler.filelist.isDir() ?
  75. Swap16((uint16_t)DGUS_Data::SDType::DIRECTORY)
  76. : Swap16((uint16_t)DGUS_Data::SDType::FILE);
  77. SetFileControlState(i, true);
  78. }
  79. dgus_display.Write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_FILE_COUNT);
  80. }
  81. void DGUSTxHandler::FileName(DGUS_VP &vp) {
  82. uint8_t offset;
  83. switch (vp.addr) {
  84. default: return;
  85. case DGUS_Addr::SD_FileName0:
  86. offset = 0;
  87. break;
  88. case DGUS_Addr::SD_FileName1:
  89. offset = 1;
  90. break;
  91. case DGUS_Addr::SD_FileName2:
  92. offset = 2;
  93. break;
  94. case DGUS_Addr::SD_FileName3:
  95. offset = 3;
  96. break;
  97. case DGUS_Addr::SD_FileName4:
  98. offset = 4;
  99. break;
  100. }
  101. if (dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + offset)) {
  102. dgus_display.WriteString((uint16_t)vp.addr, dgus_screen_handler.filelist.filename(), vp.size);
  103. }
  104. else {
  105. dgus_display.WriteStringPGM((uint16_t)vp.addr, NUL_STR, vp.size);
  106. }
  107. }
  108. void DGUSTxHandler::ScrollIcons(DGUS_VP &vp) {
  109. uint16_t icons = 0;
  110. if (!dgus_screen_handler.filelist.isAtRootDir()) {
  111. icons |= (uint16_t)DGUS_Data::ScrollIcon::GO_BACK;
  112. dgus_display.EnableControl(DGUS_Screen::PRINT,
  113. DGUSDisplay::RETURN_KEY_CODE,
  114. DGUS_Control::GO_BACK);
  115. }
  116. else {
  117. dgus_display.DisableControl(DGUS_Screen::PRINT,
  118. DGUSDisplay::RETURN_KEY_CODE,
  119. DGUS_Control::GO_BACK);
  120. }
  121. if (dgus_screen_handler.filelist_offset > 0) {
  122. icons |= (uint16_t)DGUS_Data::ScrollIcon::UP;
  123. dgus_display.EnableControl(DGUS_Screen::PRINT,
  124. DGUSDisplay::RETURN_KEY_CODE,
  125. DGUS_Control::SCROLL_UP);
  126. }
  127. else {
  128. dgus_display.DisableControl(DGUS_Screen::PRINT,
  129. DGUSDisplay::RETURN_KEY_CODE,
  130. DGUS_Control::SCROLL_UP);
  131. }
  132. if (dgus_screen_handler.filelist_offset + DGUS_FILE_COUNT < dgus_screen_handler.filelist.count()) {
  133. icons |= (uint16_t)DGUS_Data::ScrollIcon::DOWN;
  134. dgus_display.EnableControl(DGUS_Screen::PRINT,
  135. DGUSDisplay::RETURN_KEY_CODE,
  136. DGUS_Control::SCROLL_DOWN);
  137. }
  138. else {
  139. dgus_display.DisableControl(DGUS_Screen::PRINT,
  140. DGUSDisplay::RETURN_KEY_CODE,
  141. DGUS_Control::SCROLL_DOWN);
  142. }
  143. dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
  144. }
  145. void DGUSTxHandler::SelectedFileName(DGUS_VP &vp) {
  146. if (dgus_screen_handler.filelist_selected < 0
  147. || !dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_selected)) {
  148. dgus_display.WriteStringPGM((uint16_t)vp.addr, NUL_STR, vp.size);
  149. return;
  150. }
  151. dgus_display.WriteString((uint16_t)vp.addr, dgus_screen_handler.filelist.filename(), vp.size);
  152. }
  153. #endif // SDSUPPORT
  154. void DGUSTxHandler::PositionZ(DGUS_VP &vp) {
  155. float position = ExtUI::isAxisPositionKnown(ExtUI::Z) ?
  156. planner.get_axis_position_mm(Z_AXIS)
  157. : 0;
  158. const int16_t data = dgus_display.ToFixedPoint<float, int16_t, 1>(position);
  159. dgus_display.Write((uint16_t)vp.addr, Swap16(data));
  160. }
  161. void DGUSTxHandler::Ellapsed(DGUS_VP &vp) {
  162. char buffer[21];
  163. duration_t(print_job_timer.duration()).toString(buffer);
  164. dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
  165. }
  166. void DGUSTxHandler::Percent(DGUS_VP &vp) {
  167. uint16_t progress;
  168. switch (vp.addr) {
  169. default: return;
  170. case DGUS_Addr::STATUS_Percent:
  171. progress = constrain(ExtUI::getProgress_percent(), 0, 100);
  172. break;
  173. case DGUS_Addr::STATUS_Percent_Complete:
  174. progress = 100;
  175. break;
  176. }
  177. dgus_display.Write((uint16_t)DGUS_Addr::STATUS_Percent, Swap16(progress));
  178. }
  179. void DGUSTxHandler::StatusIcons(DGUS_VP &vp) {
  180. uint16_t icons = 0;
  181. if (printingIsActive()) {
  182. icons |= (uint16_t)DGUS_Data::StatusIcon::PAUSE;
  183. dgus_display.EnableControl(DGUS_Screen::PRINT_STATUS,
  184. DGUSDisplay::POPUP_WINDOW,
  185. DGUS_Control::PAUSE);
  186. }
  187. else {
  188. dgus_display.DisableControl(DGUS_Screen::PRINT_STATUS,
  189. DGUSDisplay::POPUP_WINDOW,
  190. DGUS_Control::PAUSE);
  191. }
  192. if (printingIsPaused()) {
  193. icons |= (uint16_t)DGUS_Data::StatusIcon::RESUME;
  194. dgus_display.EnableControl(DGUS_Screen::PRINT_STATUS,
  195. DGUSDisplay::POPUP_WINDOW,
  196. DGUS_Control::RESUME);
  197. }
  198. else {
  199. dgus_display.DisableControl(DGUS_Screen::PRINT_STATUS,
  200. DGUSDisplay::POPUP_WINDOW,
  201. DGUS_Control::RESUME);
  202. }
  203. dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
  204. }
  205. void DGUSTxHandler::Flowrate(DGUS_VP &vp) {
  206. int16_t flowrate;
  207. switch (vp.addr) {
  208. default: return;
  209. case DGUS_Addr::ADJUST_Flowrate_CUR:
  210. #if EXTRUDERS > 1
  211. flowrate = ExtUI::getFlow_percent(ExtUI::getActiveTool());
  212. #else
  213. flowrate = ExtUI::getFlow_percent(ExtUI::E0);
  214. #endif
  215. break;
  216. #if EXTRUDERS > 1
  217. case DGUS_Addr::ADJUST_Flowrate_E0:
  218. flowrate = ExtUI::getFlow_percent(ExtUI::E0);
  219. break;
  220. case DGUS_Addr::ADJUST_Flowrate_E1:
  221. flowrate = ExtUI::getFlow_percent(ExtUI::E1);
  222. break;
  223. #endif
  224. }
  225. dgus_display.Write((uint16_t)vp.addr, Swap16(flowrate));
  226. }
  227. void DGUSTxHandler::TempMax(DGUS_VP &vp) {
  228. uint16_t temp;
  229. switch (vp.addr) {
  230. default: return;
  231. case DGUS_Addr::TEMP_Max_Bed:
  232. temp = BED_MAX_TARGET;
  233. break;
  234. case DGUS_Addr::TEMP_Max_H0:
  235. temp = HEATER_0_MAXTEMP - HOTEND_OVERSHOOT;
  236. break;
  237. #if HOTENDS > 1
  238. case DGUS_Addr::TEMP_Max_H1:
  239. temp = HEATER_1_MAXTEMP - HOTEND_OVERSHOOT;
  240. break;
  241. #endif
  242. }
  243. dgus_display.Write((uint16_t)vp.addr, Swap16(temp));
  244. }
  245. void DGUSTxHandler::StepperStatus(DGUS_VP &vp) {
  246. if (X_ENABLE_READ() == X_ENABLE_ON
  247. && Y_ENABLE_READ() == Y_ENABLE_ON
  248. && Z_ENABLE_READ() == Z_ENABLE_ON) {
  249. dgus_display.Write((uint16_t)vp.addr, Swap16((uint16_t)DGUS_Data::Status::ENABLED));
  250. }
  251. else {
  252. dgus_display.Write((uint16_t)vp.addr, Swap16((uint16_t)DGUS_Data::Status::DISABLED));
  253. }
  254. }
  255. void DGUSTxHandler::StepIcons(DGUS_VP &vp) {
  256. if (!vp.extra) return;
  257. uint16_t icons = 0;
  258. DGUS_Data::StepSize size = *(DGUS_Data::StepSize*)vp.extra;
  259. switch (size) {
  260. case DGUS_Data::StepSize::MM10:
  261. icons |= (uint16_t)DGUS_Data::StepIcon::MM10;
  262. break;
  263. case DGUS_Data::StepSize::MM1:
  264. icons |= (uint16_t)DGUS_Data::StepIcon::MM1;
  265. break;
  266. case DGUS_Data::StepSize::MMP1:
  267. icons |= (uint16_t)DGUS_Data::StepIcon::MMP1;
  268. break;
  269. case DGUS_Data::StepSize::MMP01:
  270. icons |= (uint16_t)DGUS_Data::StepIcon::MMP01;
  271. break;
  272. }
  273. dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
  274. }
  275. void DGUSTxHandler::ABLDisableIcon(DGUS_VP &vp) {
  276. uint16_t data;
  277. if (ExtUI::getLevelingActive()) {
  278. data = (uint16_t)DGUS_Data::Status::ENABLED;
  279. dgus_display.EnableControl(DGUS_Screen::LEVELING_AUTOMATIC,
  280. DGUSDisplay::RETURN_KEY_CODE,
  281. DGUS_Control::DISABLE);
  282. }
  283. else {
  284. data = (uint16_t)DGUS_Data::Status::DISABLED;
  285. dgus_display.DisableControl(DGUS_Screen::LEVELING_AUTOMATIC,
  286. DGUSDisplay::RETURN_KEY_CODE,
  287. DGUS_Control::DISABLE);
  288. }
  289. dgus_display.Write((uint16_t)vp.addr, Swap16(data));
  290. }
  291. void DGUSTxHandler::ABLGrid(DGUS_VP &vp) {
  292. // Batch send
  293. int16_t data[DGUS_LEVEL_GRID_SIZE];
  294. xy_uint8_t point;
  295. int16_t fixed;
  296. for (int i = 0; i < DGUS_LEVEL_GRID_SIZE; i++) {
  297. point.x = i % GRID_MAX_POINTS_X;
  298. point.y = i / GRID_MAX_POINTS_X;
  299. fixed = dgus_display.ToFixedPoint<float, int16_t, 3>(ExtUI::getMeshPoint(point));
  300. data[i] = Swap16(fixed);
  301. }
  302. dgus_display.Write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_LEVEL_GRID_SIZE);
  303. }
  304. void DGUSTxHandler::FilamentIcons(DGUS_VP &vp) {
  305. uint16_t icons = 0;
  306. switch (dgus_screen_handler.filament_extruder) {
  307. default: return;
  308. case DGUS_Data::Extruder::CURRENT:
  309. #if EXTRUDERS > 1
  310. switch (ExtUI::getActiveTool()) {
  311. default: break;
  312. case ExtUI::E0:
  313. icons |= (uint16_t)DGUS_Data::ExtruderIcon::E0;
  314. break;
  315. case ExtUI::E1:
  316. icons |= (uint16_t)DGUS_Data::ExtruderIcon::E1;
  317. break;
  318. }
  319. break;
  320. #endif
  321. case DGUS_Data::Extruder::E0:
  322. icons |= (uint16_t)DGUS_Data::ExtruderIcon::E0;
  323. break;
  324. case DGUS_Data::Extruder::E1:
  325. icons |= (uint16_t)DGUS_Data::ExtruderIcon::E1;
  326. break;
  327. }
  328. dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
  329. }
  330. void DGUSTxHandler::BLTouch(DGUS_VP &vp) {
  331. #if ENABLED(BLTOUCH)
  332. dgus_display.EnableControl(DGUS_Screen::SETTINGS_MENU2,
  333. DGUSDisplay::RETURN_KEY_CODE,
  334. DGUS_Control::EXTRA2);
  335. dgus_display.Write((uint16_t)vp.addr, Swap16((uint16_t)DGUS_Data::Status::ENABLED));
  336. #else
  337. dgus_display.DisableControl(DGUS_Screen::SETTINGS_MENU2,
  338. DGUSDisplay::RETURN_KEY_CODE,
  339. DGUS_Control::EXTRA2);
  340. dgus_display.Write((uint16_t)vp.addr, Swap16((uint16_t)DGUS_Data::Status::DISABLED));
  341. #endif
  342. }
  343. void DGUSTxHandler::PIDIcons(DGUS_VP &vp) {
  344. uint16_t icons = 0;
  345. switch (dgus_screen_handler.pid_heater) {
  346. default: return;
  347. case DGUS_Data::Heater::BED:
  348. icons |= (uint16_t)DGUS_Data::HeaterIcon::BED;
  349. break;
  350. case DGUS_Data::Heater::H0:
  351. icons |= (uint16_t)DGUS_Data::HeaterIcon::H0;
  352. break;
  353. case DGUS_Data::Heater::H1:
  354. icons |= (uint16_t)DGUS_Data::HeaterIcon::H1;
  355. break;
  356. }
  357. dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
  358. }
  359. void DGUSTxHandler::PIDKp(DGUS_VP &vp) {
  360. float value;
  361. switch (dgus_screen_handler.pid_heater) {
  362. default: return;
  363. #if ENABLED(PIDTEMPBED)
  364. case DGUS_Data::Heater::BED:
  365. value = ExtUI::getBedPIDValues_Kp();
  366. break;
  367. #endif
  368. #if ENABLED(PIDTEMP)
  369. case DGUS_Data::Heater::H0:
  370. value = ExtUI::getPIDValues_Kp(ExtUI::E0);
  371. break;
  372. #if HOTENDS > 1
  373. case DGUS_Data::Heater::H1:
  374. value = ExtUI::getPIDValues_Kp(ExtUI::E1);
  375. break;
  376. #endif
  377. #endif
  378. }
  379. const int32_t data = dgus_display.ToFixedPoint<float, int32_t, 2>(value);
  380. dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data));
  381. }
  382. void DGUSTxHandler::PIDKi(DGUS_VP &vp) {
  383. float value;
  384. switch (dgus_screen_handler.pid_heater) {
  385. default: return;
  386. #if ENABLED(PIDTEMPBED)
  387. case DGUS_Data::Heater::BED:
  388. value = ExtUI::getBedPIDValues_Ki();
  389. break;
  390. #endif
  391. #if ENABLED(PIDTEMP)
  392. case DGUS_Data::Heater::H0:
  393. value = ExtUI::getPIDValues_Ki(ExtUI::E0);
  394. break;
  395. #if HOTENDS > 1
  396. case DGUS_Data::Heater::H1:
  397. value = ExtUI::getPIDValues_Ki(ExtUI::E1);
  398. break;
  399. #endif
  400. #endif
  401. }
  402. const int32_t data = dgus_display.ToFixedPoint<float, int32_t, 2>(value);
  403. dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data));
  404. }
  405. void DGUSTxHandler::PIDKd(DGUS_VP &vp) {
  406. float value;
  407. switch (dgus_screen_handler.pid_heater) {
  408. default: return;
  409. #if ENABLED(PIDTEMPBED)
  410. case DGUS_Data::Heater::BED:
  411. value = ExtUI::getBedPIDValues_Kd();
  412. break;
  413. #endif
  414. #if ENABLED(PIDTEMP)
  415. case DGUS_Data::Heater::H0:
  416. value = ExtUI::getPIDValues_Kd(ExtUI::E0);
  417. break;
  418. #if HOTENDS > 1
  419. case DGUS_Data::Heater::H1:
  420. value = ExtUI::getPIDValues_Kd(ExtUI::E1);
  421. break;
  422. #endif
  423. #endif
  424. }
  425. const int32_t data = dgus_display.ToFixedPoint<float, int32_t, 2>(value);
  426. dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data));
  427. }
  428. void DGUSTxHandler::BuildVolume(DGUS_VP &vp) {
  429. char buffer[vp.size];
  430. snprintf_P(buffer, vp.size, PSTR("%dx%dx%d"), X_BED_SIZE, Y_BED_SIZE, (Z_MAX_POS - Z_MIN_POS));
  431. dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
  432. }
  433. void DGUSTxHandler::TotalPrints(DGUS_VP &vp) {
  434. #if ENABLED(PRINTCOUNTER)
  435. dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(print_job_timer.getStats().totalPrints));
  436. #else
  437. UNUSED(vp);
  438. #endif
  439. }
  440. void DGUSTxHandler::FinishedPrints(DGUS_VP &vp) {
  441. #if ENABLED(PRINTCOUNTER)
  442. dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(print_job_timer.getStats().finishedPrints));
  443. #else
  444. UNUSED(vp);
  445. #endif
  446. }
  447. void DGUSTxHandler::PrintTime(DGUS_VP &vp) {
  448. #if ENABLED(PRINTCOUNTER)
  449. char buffer[21];
  450. ExtUI::getTotalPrintTime_str(buffer);
  451. dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
  452. #else
  453. dgus_display.WriteStringPGM((uint16_t)vp.addr, DGUS_MSG_UNDEF, vp.size);
  454. #endif
  455. }
  456. void DGUSTxHandler::LongestPrint(DGUS_VP &vp) {
  457. #if ENABLED(PRINTCOUNTER)
  458. char buffer[21];
  459. ExtUI::getLongestPrint_str(buffer);
  460. dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
  461. #else
  462. dgus_display.WriteStringPGM((uint16_t)vp.addr, DGUS_MSG_UNDEF, vp.size);
  463. #endif
  464. }
  465. void DGUSTxHandler::FilamentUsed(DGUS_VP &vp) {
  466. #if ENABLED(PRINTCOUNTER)
  467. char buffer[21];
  468. ExtUI::getFilamentUsed_str(buffer);
  469. dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size);
  470. #else
  471. dgus_display.WriteStringPGM((uint16_t)vp.addr, DGUS_MSG_UNDEF, vp.size);
  472. #endif
  473. }
  474. void DGUSTxHandler::WaitIcons(DGUS_VP &vp) {
  475. uint16_t icons = 0;
  476. if (printingIsPaused()
  477. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  478. && did_pause_print
  479. #endif
  480. ) {
  481. icons |= (uint16_t)DGUS_Data::WaitIcon::ABORT;
  482. dgus_display.EnableControl(DGUS_Screen::WAIT,
  483. DGUSDisplay::POPUP_WINDOW,
  484. DGUS_Control::ABORT);
  485. }
  486. else {
  487. dgus_display.DisableControl(DGUS_Screen::WAIT,
  488. DGUSDisplay::POPUP_WINDOW,
  489. DGUS_Control::ABORT);
  490. }
  491. if (dgus_screen_handler.wait_continue) {
  492. icons |= (uint16_t)DGUS_Data::WaitIcon::CONTINUE;
  493. dgus_display.EnableControl(DGUS_Screen::WAIT,
  494. DGUSDisplay::RETURN_KEY_CODE,
  495. DGUS_Control::CONTINUE);
  496. }
  497. else {
  498. dgus_display.DisableControl(DGUS_Screen::WAIT,
  499. DGUSDisplay::RETURN_KEY_CODE,
  500. DGUS_Control::CONTINUE);
  501. }
  502. dgus_display.Write((uint16_t)vp.addr, Swap16(icons));
  503. }
  504. void DGUSTxHandler::FanSpeed(DGUS_VP &vp) {
  505. uint16_t fan_speed;
  506. switch (vp.addr) {
  507. default: return;
  508. case DGUS_Addr::FAN0_Speed: fan_speed = ExtUI::getTargetFan_percent(ExtUI::FAN0); break;
  509. }
  510. dgus_display.Write((uint16_t)vp.addr, Swap16(fan_speed));
  511. }
  512. void DGUSTxHandler::Volume(DGUS_VP &vp) {
  513. const uint16_t volume = dgus_display.GetVolume();
  514. dgus_display.Write((uint16_t)vp.addr, Swap16(volume));
  515. }
  516. void DGUSTxHandler::Brightness(DGUS_VP &vp) {
  517. const uint16_t brightness = dgus_display.GetBrightness();
  518. dgus_display.Write((uint16_t)vp.addr, Swap16(brightness));
  519. }
  520. void DGUSTxHandler::ExtraToString(DGUS_VP &vp) {
  521. if (!vp.size || !vp.extra) return;
  522. dgus_display.WriteString((uint16_t)vp.addr, vp.extra, vp.size, true, false, false);
  523. }
  524. void DGUSTxHandler::ExtraPGMToString(DGUS_VP &vp) {
  525. if (!vp.size || !vp.extra) return;
  526. dgus_display.WriteStringPGM((uint16_t)vp.addr, vp.extra, vp.size, true, false, false);
  527. }
  528. #endif // DGUS_LCD_UI_RELOADED