Prusa-firmware: Add custom G-code to toggle high-power mode & silent mode

Created on 13 Mar 2017  路  7Comments  路  Source: prusa3d/Prusa-Firmware

An idea for a very minor enhancement I had this evening: a way to toggle the firmware's silent mode remotely.

Currently, we can switch between high power-mode and silent mode mid-print via the LCD screen, even while printing from USB.

Is there a way this functionality could be replicated via a custom G-code command? (if it isn't already there but I just haven't searched enough)
I.e. sending Mnnn 1 to switch to silent mode & Mnnn 0 to revert to high-power mode. (where nnn is the number for the chosen M-command)

This would make it possible for users to switch between these modes remotely, i.e. via a machine running Pronterface or an Octoprint server, or even as a scheduled task.

Semi-related: The Reprap wiki describes M913 (only used in reprapfirmware) as a means to set stepper motor currents to percentages of their normal values, describing motor noise reduction as a possible application.

Most helpful comment

This works perfectly from control software like Octoprint:

  • M907 X540 Z830 E500 for high power mode
  • M907 X270 Z830 E450 for silent mode
    Thanks.

All 7 comments

Currently it is possible to use M907 gcode in our firmware. Example:
M907 X540 Z830 E500
Current is in mA and X sets both X and Y stepper currents (they are the same).

Neat. In Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h I find the following values defined at lines 163 & 164

#define DEFAULT_PWM_MOTOR_CURRENT  {270, 830, 450} // {XY,Z,E}
#define DEFAULT_PWM_MOTOR_CURRENT_LOUD  {540, 830, 500} // {XY,Z,E}

Which are used in Firmware/Marlin_main.cpp#L1957

I might be asking the obvious, but I take it the loud PWM motor current values are the high power-mode & the regular values are the silent mode?

This approach seems better than actually toggling silent mode (in the EEPROM), as no writes need to be done & upon a restart of the microcontroller it runs at the mode set in the EEPROM again.

Yes, you are right about the currents. DEFAULT_PWM_MOTOR_CURRENT_LOUD is for high power mode and DEFAULT_PWM_MOTOR_CURRENT is for silent mode.

Thanks. I'll give it a try this evening & then close the issue.

This works perfectly from control software like Octoprint:

  • M907 X540 Z830 E500 for high power mode
  • M907 X270 Z830 E450 for silent mode
    Thanks.

@JohnnyricoMC
could we issue the mode related G-Codes you mentioned using something like cron so we automatically switch profiles during night/daytime. that would be awesome!

I'm not sure if it's safe to send commands via an external tool when something else is already sending the printer commands. In the case of Octoprint you could set up cronjobs to send API calls to your instance: http://docs.octoprint.org/en/master/api/printer.html#send-an-arbitrary-command-to-the-printer

Was this page helpful?
0 / 5 - 0 ratings