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.

touch_registers_screen.cpp 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /******************************
  2. * touch_registers_screen.cpp *
  3. ******************************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  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. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #include "../screens.h"
  23. #ifdef FTDI_TOUCH_REGISTERS_SCREEN
  24. using namespace FTDI;
  25. using namespace Theme;
  26. #define GRID_COLS 2
  27. #define GRID_ROWS 7
  28. void TouchRegistersScreen::onRedraw(draw_mode_t) {
  29. const uint32_t T_Transform_A = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_A);
  30. const uint32_t T_Transform_B = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_B);
  31. const uint32_t T_Transform_C = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_C);
  32. const uint32_t T_Transform_D = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_D);
  33. const uint32_t T_Transform_E = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_E);
  34. const uint32_t T_Transform_F = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_F);
  35. char b[20];
  36. CommandProcessor cmd;
  37. cmd.cmd(CLEAR_COLOR_RGB(bg_color))
  38. .cmd(CLEAR(true,true,true))
  39. .tag(0);
  40. cmd.tag(0)
  41. .font(font_xsmall)
  42. .fgcolor(transformA) .button(BTN_POS(1,1), BTN_SIZE(1,1), F("TOUCH_XFORM_A"))
  43. .fgcolor(transformB) .button(BTN_POS(1,2), BTN_SIZE(1,1), F("TOUCH_XFORM_B"))
  44. .fgcolor(transformC) .button(BTN_POS(1,3), BTN_SIZE(1,1), F("TOUCH_XFORM_C"))
  45. .fgcolor(transformD) .button(BTN_POS(1,4), BTN_SIZE(1,1), F("TOUCH_XFORM_D"))
  46. .fgcolor(transformE) .button(BTN_POS(1,5), BTN_SIZE(1,1), F("TOUCH_XFORM_E"))
  47. .fgcolor(transformF) .button(BTN_POS(1,6), BTN_SIZE(1,1), F("TOUCH_XFORM_F"))
  48. .fgcolor(transformVal).button(BTN_POS(2,1), BTN_SIZE(1,1), F(""), OPT_FLAT)
  49. .fgcolor(transformVal).button(BTN_POS(2,2), BTN_SIZE(1,1), F(""), OPT_FLAT)
  50. .fgcolor(transformVal).button(BTN_POS(2,3), BTN_SIZE(1,1), F(""), OPT_FLAT)
  51. .fgcolor(transformVal).button(BTN_POS(2,4), BTN_SIZE(1,1), F(""), OPT_FLAT)
  52. .fgcolor(transformVal).button(BTN_POS(2,5), BTN_SIZE(1,1), F(""), OPT_FLAT)
  53. .fgcolor(transformVal).button(BTN_POS(2,6), BTN_SIZE(1,1), F(""), OPT_FLAT);
  54. sprintf_P(b, PSTR("0x%08lX"), T_Transform_A); cmd.text( BTN_POS(2,1), BTN_SIZE(1,1), b);
  55. sprintf_P(b, PSTR("0x%08lX"), T_Transform_B); cmd.text( BTN_POS(2,2), BTN_SIZE(1,1), b);
  56. sprintf_P(b, PSTR("0x%08lX"), T_Transform_C); cmd.text( BTN_POS(2,3), BTN_SIZE(1,1), b);
  57. sprintf_P(b, PSTR("0x%08lX"), T_Transform_D); cmd.text( BTN_POS(2,4), BTN_SIZE(1,1), b);
  58. sprintf_P(b, PSTR("0x%08lX"), T_Transform_E); cmd.text( BTN_POS(2,5), BTN_SIZE(1,1), b);
  59. sprintf_P(b, PSTR("0x%08lX"), T_Transform_F); cmd.text( BTN_POS(2,6), BTN_SIZE(1,1), b);
  60. cmd.colors(action_btn).font(font_medium)
  61. .tag(1).button(BTN_POS(2,7), BTN_SIZE(1,1), F("Back"));
  62. }
  63. bool TouchRegistersScreen::onTouchEnd(uint8_t tag) {
  64. switch (tag) {
  65. case 1: GOTO_PREVIOUS(); break;
  66. default:
  67. return false;
  68. }
  69. return true;
  70. }
  71. #endif // FTDI_TOUCH_REGISTERS_SCREEN