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.

lcdprint.cpp 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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. /**
  23. * lcdprint.cpp
  24. */
  25. #include "../inc/MarlinConfigPre.h"
  26. #if HAS_SPI_LCD
  27. #include "lcdprint.h"
  28. #include "../core/language.h"
  29. /**
  30. * lcd_put_u8str_ind_P
  31. * Print a string with an index substituted within it
  32. */
  33. lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const uint8_t ind, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
  34. uint8_t *p = (uint8_t*)pstr;
  35. lcd_uint_t n = maxlen;
  36. for (; n; n--) {
  37. wchar_t ch;
  38. p = get_utf8_value_cb(p, read_byte_rom, &ch);
  39. if (!ch) break;
  40. if (ch == '=' || ch == '~' || ch == '*') {
  41. if (ch == '*') { lcd_put_wchar('E'); n--; }
  42. // lcd_put_int(ind); n--; if (ind >= 10) n--;
  43. // if (ind >= 0)
  44. {
  45. lcd_put_wchar(ind + ((ch == '=') ? '0' : LCD_FIRST_TOOL));
  46. n--;
  47. }
  48. // else if (ind == -1) { PGM_P const b = GET_TEXT(MSG_BED); lcd_put_u8str_P(b); n -= utf8_strlen_P(b); }
  49. // else if (ind == -2) { PGM_P const c = GET_TEXT(MSG_CHAMBER); lcd_put_u8str_P(c); n -= utf8_strlen_P(c); }
  50. if (n) n -= lcd_put_u8str_max_P((PGM_P)p, n);
  51. break;
  52. }
  53. lcd_put_wchar(ch);
  54. }
  55. return n;
  56. }
  57. #endif // HAS_SPI_LCD