public function printmodel_temp() { $cr = 0; $model_calibration = FALSE; $mid = $this->input->get('id'); $exchange_extruder = 0; $array_temper = array(); // check model id, and then send it to print command $this->load->helper(array('printer', 'printlist', 'corestatus')); $this->get_extra_info($array_temper, $exchange_extruder); if ($mid) { if (strpos($mid, CORESTATUS_VALUE_MID_PREFIXGCODE) === 0) { $gid = (int) substr($mid, strlen(CORESTATUS_VALUE_MID_PREFIXGCODE) - 1); $this->printgcode_temp($gid); return; } if ($mid == ModelList_codeModelHash(PRINTLIST_MODEL_CALIBRATION)) { // $this->output->set_header('Location: /printdetail/printcalibration'); // return; $model_calibration = TRUE; } $this->set_led(); $cr = Printer_printFromModel($mid, $model_calibration, $exchange_extruder, $array_temper); if ($cr != ERROR_OK) { if ($model_calibration) { $this->output->set_header('Location: /printmodel/detail?id=calibration'); } else { $this->output->set_header('Location: /printmodel/listmodel'); } return; } } else { $this->output->set_header('Location: /printmodel/listmodel'); return; } if ($model_calibration) { // $this->output->set_header('Location: /printdetail/status?id=calibration'); $this->output->set_header('Location: /printdetail/status?id=' . CORESTATUS_VALUE_MID_CALIBRATION); } else { $this->output->set_header('Location: /printdetail/status?id=' . $mid); } return; }
public function preslicedprint() { $mid = ''; $cr = 0; //return code $exchange_extruder = $this->input->get('filament'); $this->load->helper('printer'); $exchange_extruder = $exchange_extruder == 'crossover' ? TRUE : FALSE; $mid = $this->input->get('id'); //return false if missing if ($mid) { //TODO need well defined whether it is a calibration or not $cr = Printer_printFromModel($mid, FALSE, $exchange_extruder); } else { $cr = ERROR_MISS_PRM; } if ($cr == ERROR_OK) { // ALREADY FIXED BY CORESTATUS HELPER // change status file to indicate we are in printing now, // but think another condition: // when we have finished printing, how can we know that? // arcontrol client return directly, and will not infect file system with json file. // perhaps we have to lance a thread of PHP to check print status by arcontrol // time by time util the printing is finished? // if not, we will rely on the client to check status, // that means we force the client only accessing check print status page when we are in printing. // in that way, we can know when the printing is finished, and then change the status in json file } $this->_return_cr($cr); return; }
function ModelList_print($id_model, $exchange_extruder = FALSE, $array_temper = array()) { $ret_val = 0; $model_calibration = FALSE; if ($id_model == ModelList_codeModelHash(PRINTLIST_MODEL_CALIBRATION)) { $model_calibration = TRUE; } $CI =& get_instance(); $CI->load->helper('printer'); $ret_val = Printer_printFromModel($id_model, $model_calibration, $exchange_extruder, $array_temper); return $ret_val; }