public void togglePause() {
		
		if(state.sdprint){
			//Execute commands to pause
			if(state.pause){
				state.pause=false; //Continue and resume
				addToPrintQueue(GCodeFactory.getGCode("M24",-24), false);
			}else{
				addToPrintQueue(GCodeFactory.getGCode("M25",-25), false);
				try {
					Thread.sleep(1000); //wait for printqueue to execute command before toggle pause
				} catch (InterruptedException e) {
				}
				state.pause=true;
			}
			
		}else{
			state.pause = !state.pause;
		}
		if (state.pause) {
			if(state.debug){
				cons.appendText(showDebugData());
			}
			cons.appendText("Pause at line "+ state.lineidx);
			//Move to 0:0 on pause, set a recoverypoint to return to last coord when continue
			if(homexypause){
				//cons.appendText(state.lastgcode.toString());
				setRecoverPoint();
				if(state.activeExtr == 0){
				//	cons.appendText("Pause Extr0");
					addToPrintQueue(GCodeFactory.getGCode("G1 X0 Y0", -128), true);
				}else{
					//assume that the extruder offset prevents us from moving to 0:0
				//	cons.appendText("Pause Extr1");
					addToPrintQueue(GCodeFactory.getGCode("G1 X25 Y25", -128), true);
				}
			}

		} else {
			cons.appendText("Continue");
		}
		if(state.printing){
			 if(state.pause){
				 cons.updateState(States.PAUSED,States.NONE , -1);
			 }else{
				 cons.updateState(States.PRINTING,States.NONE , -1);
			 }
		}
	}