/* Fills the buffer with used material in grams Example: 15,34,-,-,- g  */
static void print_used_material_g(std::span< char > buffer, GCodeInfo &gcode)
/* Fills the buffer with used material in grams Example: 15,34,-,-,- g  */
static void print_used_material_g(std::span< char > buffer, GCodeInfo &gcode)
{
        const auto &extruder_info = gcode.get_extruder_info(extruder);
        if (extruder_info.used() && extruder_info.filament_used_g.has_value()) {
            return snprintf(item_buffer.data(), item_buffer.size(), "%1.0f", static_cast<double>(extruder_info.filament_used_g.value()));
        } else {
            return snprintf(item_buffer.data(), item_buffer.size(), "-");
        }
    });
    snprintf(buffer.data(), buffer.size(), " g");
}