Added the ability to turn off firmware sounds

This commit is contained in:
LarsBrubaker 2021-06-11 07:26:02 -07:00
parent 99fc92c2e8
commit 3d753cfa13
6 changed files with 29 additions and 2 deletions

View file

@ -125,6 +125,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
SettingsKey.filament_density,
SettingsKey.filament_has_been_loaded,
SettingsKey.filament_runout_sensor,
SettingsKey.enable_firmware_sounds,
SettingsKey.firmware_type,
SettingsKey.first_layer_bed_temperature,
SettingsKey.g0,

View file

@ -101,6 +101,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public const string filament_diameter = nameof(filament_diameter);
public const string filament_has_been_loaded = nameof(filament_has_been_loaded);
public const string filament_runout_sensor = nameof(filament_runout_sensor);
public const string enable_firmware_sounds = nameof(enable_firmware_sounds);
public const string fill_angle = nameof(fill_angle);
public const string fill_density = nameof(fill_density);
public const string fill_pattern = nameof(fill_pattern);

View file

@ -1121,6 +1121,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
RebuildGCodeOnChange = false
},
new SliceSettingData()
{
SlicerConfigName = SettingsKey.enable_firmware_sounds,
PresentationName = "Enable Firmware Sounds".Localize(),
HelpText = "Allow M300 commands (play sound) to be sent to the firmware. Disable to turn off sounds.".Localize(),
DataEditType = DataEditTypes.CHECK_BOX,
ShowAsOverride = true,
DefaultValue = "1",
RequiredDisplayDetail = DisplayDetailRequired.Simple,
RebuildGCodeOnChange = false
},
new SliceSettingData()
{
SlicerConfigName = SettingsKey.runout_sensor_check_distance,
PresentationName = "Runout Check Distance".Localize(),

View file

@ -331,6 +331,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
SettingsKey.progress_reporting,
SettingsKey.include_firmware_updater,
SettingsKey.backup_firmware_before_update,
SettingsKey.enable_firmware_sounds,
}),
("Diagnostics", new[]
{

View file

@ -28,15 +28,20 @@ either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
public class RemoveNOPsStream : GCodeStreamProxy
{
private bool filterM300;
public override string DebugInfo => "";
public RemoveNOPsStream(PrinterConfig printer, GCodeStream internalStream)
: base(printer, internalStream)
{
filterM300 = !printer.Settings.GetValue<bool>(SettingsKey.enable_firmware_sounds);
}
public override string ReadLine()
@ -53,8 +58,16 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
return baseLine;
}
// if the line contains no actual movement information, don't' send it
var trimmedLine = baseLine.Trim();
// check if the send is a sound and if needed filter it
if (filterM300
&& trimmedLine.StartsWith("M300"))
{
return "";
}
// if the line contains no actual movement information, don't' send it
if (trimmedLine == "G1"
|| trimmedLine == "G0")
{

@ -1 +1 @@
Subproject commit d6c59b6bf47221b485e96a13d25c85cdbec4bef6
Subproject commit 481d3e349917a5ee1a4a03a66156990692a83081