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.

M430.cpp 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../../inc/MarlinConfig.h"
  23. #if HAS_POWER_MONITOR
  24. #include "../../../feature/power_monitor.h"
  25. #include "../../../MarlinCore.h"
  26. #include "../../gcode.h"
  27. /**
  28. * M430: Enable/disable current LCD display
  29. * With no parameters report the system current draw (in Amps)
  30. *
  31. * I[bool] - Set Display of current on the LCD
  32. * V[bool] - Set Display of voltage on the LCD
  33. * W[bool] - Set Display of power on the LCD
  34. */
  35. void GcodeSuite::M430() {
  36. bool do_report = true;
  37. #if HAS_WIRED_LCD
  38. #if ENABLED(POWER_MONITOR_CURRENT)
  39. if (parser.seen('I')) { power_monitor.set_current_display(parser.value_bool()); do_report = false; }
  40. #endif
  41. #if ENABLED(POWER_MONITOR_VOLTAGE)
  42. if (parser.seen('V')) { power_monitor.set_voltage_display(parser.value_bool()); do_report = false; }
  43. #endif
  44. #if HAS_POWER_MONITOR_WATTS
  45. if (parser.seen('W')) { power_monitor.set_power_display(parser.value_bool()); do_report = false; }
  46. #endif
  47. #endif
  48. if (do_report) {
  49. SERIAL_ECHOLNPGM(
  50. #if ENABLED(POWER_MONITOR_CURRENT)
  51. "Current: ", power_monitor.getAmps(), "A"
  52. TERN_(POWER_MONITOR_VOLTAGE, " ")
  53. #endif
  54. #if ENABLED(POWER_MONITOR_VOLTAGE)
  55. "Voltage: ", power_monitor.getVolts(), "V"
  56. #endif
  57. #if HAS_POWER_MONITOR_WATTS
  58. " Power: ", power_monitor.getPower(), "W"
  59. #endif
  60. );
  61. }
  62. }
  63. #endif // HAS_POWER_MONITOR