Marlin
Marlin copied to clipboard
Resolve error with print info on machines without extruders
Description
When configuring a machine with no extruders (such as a CNC mill or laser cutter), if the "PRINTCOUNTER" and "LCD_INFO_MENU" are enabled, the existing marlin releases fail to build, with the following errors:
Marlin/src/lcd/menu/menu_info.cpp: In function 'void menu_info_stats()':
Marlin/src/lcd/menu/menu_info.cpp:67:22: error: 'struct printStatistics' has no member named 'filamentUsed'
, long(stats.filamentUsed / 1000)
^~~~~~~~~~~~
Marlin/src/lcd/menu/menu_info.cpp:68:25: error: 'struct printStatistics' has no member named 'filamentUsed'
, int16_t(stats.filamentUsed / 100) % 10
This commit resolves that by checking if any extruders are present before attempting to print filamentUsed.
Requirements
Only applicable when EXTRUDERS is defined as 0, and when LCD_INFO_MENU and PRINTCOUNTER are enabled. Otherwise has no effect.
Benefits
Fixes failure to build under the circumstances described above.