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.

message.cpp 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /**
  2. * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. *
  18. * Contact information
  19. * -------------------
  20. *
  21. * Circuits At Home, LTD
  22. * Web : http://www.circuitsathome.com
  23. * e-mail : support@circuitsathome.com
  24. */
  25. #include "../../../inc/MarlinConfigPre.h"
  26. #if ENABLED(USB_FLASH_DRIVE_SUPPORT) && DISABLED(USE_UHS3_USB)
  27. #include "Usb.h"
  28. // 0x80 is the default (i.e. trace) to turn off set this global to something lower.
  29. // this allows for 126 other debugging levels.
  30. // TO-DO: Allow assignment to a different serial port by software
  31. int UsbDEBUGlvl = 0x80;
  32. void E_Notifyc(char c, int lvl) {
  33. if (UsbDEBUGlvl < lvl) return;
  34. USB_HOST_SERIAL.print(c
  35. #if !defined(ARDUINO) && !defined(ARDUINO_ARCH_LPC176X)
  36. , BYTE
  37. #endif
  38. );
  39. //USB_HOST_SERIAL.flush();
  40. }
  41. void E_Notify(char const * msg, int lvl) {
  42. if (UsbDEBUGlvl < lvl) return;
  43. if (!msg) return;
  44. while (const char c = pgm_read_byte(msg++)) E_Notifyc(c, lvl);
  45. }
  46. void E_NotifyStr(char const * msg, int lvl) {
  47. if (UsbDEBUGlvl < lvl) return;
  48. if (!msg) return;
  49. while (const char c = *msg++) E_Notifyc(c, lvl);
  50. }
  51. void E_Notify(uint8_t b, int lvl) {
  52. if (UsbDEBUGlvl < lvl) return;
  53. USB_HOST_SERIAL.print(b
  54. #if !defined(ARDUINO) || ARDUINO < 100
  55. , DEC
  56. #endif
  57. );
  58. //USB_HOST_SERIAL.flush();
  59. }
  60. void E_Notify(double d, int lvl) {
  61. if (UsbDEBUGlvl < lvl) return;
  62. USB_HOST_SERIAL.print(d);
  63. //USB_HOST_SERIAL.flush();
  64. }
  65. #ifdef DEBUG_USB_HOST
  66. void NotifyFailGetDevDescr() {
  67. Notify(PSTR("\r\ngetDevDescr "), 0x80);
  68. }
  69. void NotifyFailSetDevTblEntry() {
  70. Notify(PSTR("\r\nsetDevTblEn "), 0x80);
  71. }
  72. void NotifyFailGetConfDescr() {
  73. Notify(PSTR("\r\ngetConf "), 0x80);
  74. }
  75. void NotifyFailSetConfDescr() {
  76. Notify(PSTR("\r\nsetConf "), 0x80);
  77. }
  78. void NotifyFailGetDevDescr(uint8_t reason) {
  79. NotifyFailGetDevDescr();
  80. NotifyFail(reason);
  81. }
  82. void NotifyFailSetDevTblEntry(uint8_t reason) {
  83. NotifyFailSetDevTblEntry();
  84. NotifyFail(reason);
  85. }
  86. void NotifyFailGetConfDescr(uint8_t reason) {
  87. NotifyFailGetConfDescr();
  88. NotifyFail(reason);
  89. }
  90. void NotifyFailSetConfDescr(uint8_t reason) {
  91. NotifyFailSetConfDescr();
  92. NotifyFail(reason);
  93. }
  94. void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID) {
  95. Notify(PSTR("\r\nUnknown Device Connected - VID: "), 0x80);
  96. D_PrintHex<uint16_t > (VID, 0x80);
  97. Notify(PSTR(" PID: "), 0x80);
  98. D_PrintHex<uint16_t > (PID, 0x80);
  99. }
  100. void NotifyFail(uint8_t rcode) {
  101. D_PrintHex<uint8_t > (rcode, 0x80);
  102. Notify(PSTR("\r\n"), 0x80);
  103. }
  104. #endif // DEBUG_USB_HOST
  105. #endif // USB_FLASH_DRIVE_SUPPORT