Ejemplo n.º 1
0
 public function stop()
 {
     $this->load->helper('printerstate');
     PrinterState_stopPrinting();
     $this->output->set_header('Location: /extrusion_control');
     return;
 }
Ejemplo n.º 2
0
 public function stop()
 {
     $this->load->helper('printerstate');
     PrinterState_stopPrinting();
     $this->output->set_header('Location: /zeepronterface');
     return;
 }
Ejemplo n.º 3
0
function Printer_stopPrint()
{
    // 	$stats_info = array();
    $CI =& get_instance();
    $CI->load->helper('corestatus');
    // check if we are in canceling / printing in json file
    $cr = CoreStatus_checkInIdle($status_current);
    if ($cr == FALSE) {
        if ($status_current == CORESTATUS_VALUE_CANCEL) {
            // in canceling
            return TRUE;
        } else {
            if ($status_current != CORESTATUS_VALUE_PRINT) {
                // in other status
                $CI->load->helper('printerlog');
                PrinterLog_logError('no printing / canceling status when calling canceling', __FILE__, __LINE__);
                return FALSE;
            } else {
                // in printing
                // 			$CI->load->helper(array('printlist', 'printerstate', 'zimapi'));
                $CI->load->helper(array('printerstate', 'zimapi'));
                // change end print script if we cancel printing to not generate timelapse
                if (file_exists($CI->config->item('temp') . PRINTER_FN_END_PRINT) && file_exists(ZIMAPI_FILEPATH_ENDCANCEL)) {
                    copy(ZIMAPI_FILEPATH_ENDCANCEL, $CI->config->item('temp') . PRINTER_FN_END_PRINT);
                    chmod($CI->config->item('temp') . PRINTER_FN_END_PRINT, 0775);
                }
                // 			//stats info
                // 			$stats_info = PrinterState_prepareStatsPrintLabel();
                // 			PrinterLog_statsPrint(PRINTERLOG_STATS_ACTION_CANCEL, $stats_info);
                // call stop printing gcode status
                $cr = PrinterState_stopPrinting();
                if ($cr != ERROR_OK) {
                    // log error here
                    $CI->load->helper('printerlog');
                    PrinterLog_logError('stop gcode failed', __FILE__, __LINE__);
                    return FALSE;
                }
                // set status in cancelling
                if (!CoreStatus_setInCanceling()) {
                    $CI->load->helper('printerlog');
                    PrinterLog_logError('can not set status in cancel', __FILE__, __LINE__);
                    return FALSE;
                }
                // 			// start to call printing of a special model to reset printer
                // 			$cr = Printer_printFromModel(ModelList_codeModelHash(PRINTLIST_MODEL_CANCEL), TRUE);
                // 			if ($cr == ERROR_OK) {
                // 				return TRUE;
                // 			}
                // 			else {
                // 				// log error here
                // 				$CI->load->helper('printerlog');
                // 				PrinterLog_logError('start printing canceling model failed', __FILE__, __LINE__);
                // 				return FALSE;
                // 			}
                return TRUE;
            }
        }
    } else {
        // in idle
        $CI->load->helper('printerlog');
        PrinterLog_logError('in idle when calling canceling', __FILE__, __LINE__);
        return FALSE;
    }
    return FALSE;
    // never reach here
}