Merge pull request #187 from gregory-diaz/Emergency_Stop_Dev

Emergency stop dev
This commit is contained in:
Lars Brubaker 2015-02-25 18:21:23 -08:00
commit f4317b55c9
9 changed files with 56 additions and 4 deletions

View file

@ -12,6 +12,7 @@ using MatterHackers.VectorMath;
using MatterHackers.MatterControl;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
using MatterHackers.MatterControl.PrinterCommunication;
@ -25,6 +26,7 @@ namespace MatterHackers.MatterControl.ActionBar
Button connectPrinterButton;
Button disconnectPrinterButton;
Button selectActivePrinterButton;
Button emergencyStopButton;
ConnectionWindow connectionWindow;
bool connectionWindowIsOpen = false;
@ -86,9 +88,6 @@ namespace MatterHackers.MatterControl.ActionBar
disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
disconnectPrinterButton.Cursor = Cursors.Hand;
// Bind connect button states to active printer state
this.SetConnectionButtonVisibleState(null);
selectActivePrinterButton = new PrinterSelectButton();
selectActivePrinterButton.HAnchor = HAnchor.ParentLeftRight;
selectActivePrinterButton.Cursor = Cursors.Hand;
@ -100,13 +99,27 @@ namespace MatterHackers.MatterControl.ActionBar
{
selectActivePrinterButton.Margin = new BorderDouble(0, 6, 6, 3);
}
string emergencyStopText = "Emergency Stop".Localize().ToUpper();
emergencyStopButton = actionBarButtonFactory.Generate(emergencyStopText, "e_stop4.png");
if (ApplicationController.Instance.WidescreenMode)
{
emergencyStopButton.Margin = new BorderDouble(0, 0, 3, 3);
}
else
{
emergencyStopButton.Margin = new BorderDouble(6, 0, 3, 3);
}
// Bind connect button states to active printer state
this.SetConnectionButtonVisibleState(null);
actionBarButtonFactory.invertImageLocation = true;
this.AddChild(connectPrinterButton);
this.AddChild(disconnectPrinterButton);
this.AddChild(selectActivePrinterButton);
this.AddChild(emergencyStopButton);
//this.AddChild(CreateOptionsMenu());
}
@ -121,6 +134,7 @@ namespace MatterHackers.MatterControl.ActionBar
selectActivePrinterButton.Click += new EventHandler(onSelectActivePrinterButton_Click);
connectPrinterButton.Click += new EventHandler(onConnectButton_Click);
disconnectPrinterButton.Click += new EventHandler(onDisconnectButtonClick);
emergencyStopButton.Click += new EventHandler(emergencyStopButton_Click);
base.AddHandlers();
}
@ -150,6 +164,12 @@ namespace MatterHackers.MatterControl.ActionBar
}
}
void emergencyStopButton_Click(object sender, EventArgs mouseEvent)
{
PrinterConnectionAndCommunication.Instance.RebootBoard();
}
void ConnectToActivePrinter()
{
PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
@ -234,6 +254,7 @@ namespace MatterHackers.MatterControl.ActionBar
}
}
void SetConnectionButtonVisibleState(object state)
{
@ -253,11 +274,12 @@ namespace MatterHackers.MatterControl.ActionBar
// Ensure connect buttons are locked while long running processes are executing to prevent duplicate calls into said actions
connectPrinterButton.Enabled = communicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect;
disconnectPrinterButton.Enabled = communicationState != PrinterConnectionAndCommunication.CommunicationStates.Disconnecting;
emergencyStopButton.Visible = PrinterConnectionAndCommunication.Instance.PrinterIsConnected && ActiveSliceSettings.Instance.HasEmergencyStop();
}
void onPrinterStatusChanged(object sender, EventArgs e)
{
UiThread.RunOnIdle(SetConnectionButtonVisibleState);
UiThread.RunOnIdle(SetConnectionButtonVisibleState);
}
}
}

View file

@ -233,6 +233,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return GetActiveValue("has_fan") == "1";
}
public bool HasEmergencyStop()
{
return GetActiveValue("has_emergency_stop") == "1";
}
public bool HasHardwareLeveling()
{
return GetActiveValue("has_hardware_leveling") == "1";

View file

@ -211,6 +211,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
new NotPassedItem("", "has_heated_bed"),
new NotPassedItem("", "has_sd_card_reader"),
new NotPassedItem("", "z_can_be_negative"),
new NotPassedItem("", "has_emergency_stop"),
//retractionOnExtruderSwitch=14.5
new MapItem("retractionOnExtruderSwitch", "retract_length_tool_change"),

BIN
StaticData/Icons/e_stop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

View file

@ -52,6 +52,7 @@ has_fan = 1
has_hardware_leveling = 0
has_heated_bed = 1
has_sd_card_reader = 0
has_emergency_stop = 1
heat_extruder_before_homing = 0
infill_acceleration = 0
infill_every_layers = 1

View file

@ -239,6 +239,7 @@ Advanced
has_hardware_leveling
has_heated_bed
has_sd_card_reader
has_emergency_stop
extruder_count
heat_extruder_before_homing
extruders_share_temperature

View file

@ -413,6 +413,13 @@
"DataEditType": "HARDWARE_PRESENT",
"ExtraSettings": "bed_temperature,first_layer_bed_temperature"
},
{
"SlicerConfigName": "has_emergency_stop",
"PresentationName": "Enable Emergency Stop",
"HelpText": "Make the emergency stop option available during print.",
"DataEditType": "HARDWARE_PRESENT",
"ExtraSettings": ""
},
{
"SlicerConfigName": "infill_acceleration",
"PresentationName": "Infill",

View file

@ -3128,3 +3128,18 @@ Translated:This gcode will be inserted into the output right after the temperatu
English:GCode file too big to load for '{0}'.
Translated:GCode file too big to load for '{0}'.
English:Emergency Stop
Translated:Emergency Stop
English:Immediately kills connection to printer
Translated:Immediately kills connection to printer
English:Make the emergency stop option available during print.
Translated:Make the emergency stop option available during print.
English:Enable Emergency Stop
Translated:Enable Emergency Stop
English:Stop
Translated:Stop