public function changecartridge_ajax() { $template_data = array(); $body_page = NULL; $ret_val = 0; $abb_cartridge = $this->input->post('abb_cartridge'); $need_filament = $this->input->post('need_filament'); $id_model = $this->input->post('mid'); $next_phase = $this->input->post('next_phase'); $code_miss_cartridge = $abb_cartridge == 'r' ? ERROR_MISS_RIGT_CART : ERROR_MISS_LEFT_CART; $code_low_filament = $abb_cartridge == 'r' ? ERROR_LOW_RIGT_FILA : ERROR_LOW_LEFT_FILA; $code_miss_filament = $abb_cartridge == 'r' ? ERROR_MISS_RIGT_FILA : ERROR_MISS_LEFT_FILA; $low_hint = FALSE; $change_able = TRUE; // treat input data if (!$abb_cartridge && !in_array($abb_cartridge, array('l', 'r'))) { if (isset($_SERVER['HTTP_REFERER'])) { $this->output->set_header('Location: ' . $_SERVER['HTTP_REFERER']); } else { $this->output->set_header('Location: /'); } return; } if ($need_filament) { $need_filament = (int) $need_filament; } else { $need_filament = 0; } $this->load->helper(array('corestatus')); // detect status switch ($next_phase) { case PRINTERSTATE_CHANGECART_UNLOAD_F: // we call the page: wait unload filament, need checking status (first status page) $status_current = ''; $array_status = array(); // block any sending command to arduino when in unloading wait time if (CoreStatus_checkInIdle($status_current, $array_status) == FALSE) { if (in_array($status_current, array(CORESTATUS_VALUE_UNLOAD_FILA_L, CORESTATUS_VALUE_UNLOAD_FILA_R))) { if (!$this->_deal_with_unloading_wait_time($abb_cartridge, $array_status)) { $this->_display_changecartridge_in_unload_filament($abb_cartridge); break; } } else { if (in_array($status_current, array(CORESTATUS_VALUE_LOAD_FILA_L, CORESTATUS_VALUE_LOAD_FILA_R))) { $this->_display_changecartridge_in_load_filament(); break; } } } if (PrinterState_getFilamentStatus($abb_cartridge)) { // have filament $status_correct = $abb_cartridge == 'r' ? CORESTATUS_VALUE_UNLOAD_FILA_R : CORESTATUS_VALUE_UNLOAD_FILA_L; $status_changed = $abb_cartridge == 'r' ? CORESTATUS_VALUE_LOAD_FILA_R : CORESTATUS_VALUE_LOAD_FILA_L; if (CoreStatus_checkInIdle($status_current, $array_status)) { // in idle $ret_val = PrinterState_getTemperature($temp_data, 'e', $abb_cartridge); if ($ret_val != ERROR_OK) { $this->load->helper('printerlog'); PrinterLog_logError('can not get temperature: ' . $abb_cartridge, __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } else { $this->_display_changecartridge_wait_unload_filament($abb_cartridge, $id_model, $temp_data > PRINTERSTATE_VALUE_MAXTEMPER_BEFORE_UNLOAD); } } else { if ($status_current == $status_correct) { // in busy (normally only unloading is possible) $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_UNLOAD; if (array_key_exists(CORESTATUS_TITLE_FILA_MAT, $array_status) && $array_status[CORESTATUS_TITLE_FILA_MAT] == PRINTERSTATE_DESP_MATERIAL_PVA) { $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_UNLOAD_PVA; } if (!CoreStatus_checkInWaitTime($timeout_check)) { //TODO test me // already passed the timeout of changement // change status into idle $ret_val = CoreStatus_setInIdle(); if ($ret_val == FALSE) { $this->load->helper('printerlog'); PrinterLog_logError('can not set idle after unloading filament', __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } $this->_display_changecartridge_error_unloading(); break; } $this->_display_changecartridge_in_unload_filament($abb_cartridge); } else { if ($status_current == $status_changed) { // in busy (but in idle, status is changed in real) $ret_val = CoreStatus_setInIdle(); if ($ret_val == FALSE) { $this->load->helper('printerlog'); PrinterLog_logError('can not set idle after unloading filament', __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } } else { // in other busy status $this->load->helper('printerlog'); PrinterLog_logError('error status when changing filament', __FILE__, __LINE__); $this->_display_changecartridge_error_status($status_current); // $this->output->set_status_header(202); // disable checking } } } } else { // no filament $status_correct = $abb_cartridge == 'r' ? CORESTATUS_VALUE_LOAD_FILA_R : CORESTATUS_VALUE_LOAD_FILA_L; $status_changed = $abb_cartridge == 'r' ? CORESTATUS_VALUE_UNLOAD_FILA_R : CORESTATUS_VALUE_UNLOAD_FILA_L; if (CoreStatus_checkInIdle($status_current, $array_status)) { $ret_val = PrinterState_checkFilament($abb_cartridge, $need_filament); if ($ret_val == $code_miss_filament) { // have cartridge, enough filament $this->_display_changecartridge_wait_load_filament(TRUE, $id_model, $abb_cartridge); } else { if ($ret_val == $code_low_filament) { // have cartridge, low filament $this->_display_changecartridge_remove_cartridge(TRUE); } else { if ($ret_val == $code_miss_cartridge) { // no cartridge // raise the platform for first loading ajax page if (ERROR_OK != PrinterState_raisePlatform()) { $this->output->set_header('Location: /'); return; } $this->_display_changecartridge_insert_cartridge(); } else { // error status $this->load->helper('printerlog'); PrinterLog_logError('error checkfilament return status when changing filament (in starting)', __FILE__, __LINE__); $this->_display_changecartridge_remove_cartridge(); } } } } else { if ($status_current == $status_correct) { $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_LOAD; if (array_key_exists(CORESTATUS_TITLE_FILA_MAT, $array_status) && $array_status[CORESTATUS_TITLE_FILA_MAT] == PRINTERSTATE_DESP_MATERIAL_PVA) { $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_LOAD_PVA; } // in busy (normally only loading is possible) if (!CoreStatus_checkInWaitTime($timeout_check)) { // already passed the timeout of changement // change status into idle $ret_val = CoreStatus_setInIdle(); if ($ret_val == FALSE) { $this->load->helper('printerlog'); PrinterLog_logError('can not set idle after loading filament', __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } $this->_display_changecartridge_error_loading(); break; } $this->_display_changecartridge_in_load_filament(); } else { if ($status_current == $status_changed) { // in busy (but in idle, status is changed in real) $ret_val = CoreStatus_setInIdle(); if ($ret_val == FALSE) { $this->load->helper('printerlog'); PrinterLog_logError('can not set idle after loading filament', __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } } else { // in other busy status $this->load->helper('printerlog'); PrinterLog_logError('error status when changing filament', __FILE__, __LINE__); $this->_display_changecartridge_error_status($status_current); // $this->output->set_status_header(202); // disable checking } } } } break; case PRINTERSTATE_CHANGECART_REMOVE_C: // we call the page: in unload filament // $status_current = NULL; $array_status = array(); // CoreStatus_checkInIdle($status_current, $array_status); CoreStatus_getStatusArray($array_status); if (!$this->_deal_with_unloading_wait_time($abb_cartridge, $array_status)) { $this->_display_changecartridge_in_unload_filament($abb_cartridge); break; } if (PrinterState_getFilamentStatus($abb_cartridge)) { // have filament $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_UNLOAD; if (array_key_exists(CORESTATUS_TITLE_FILA_MAT, $array_status) && $array_status[CORESTATUS_TITLE_FILA_MAT] == PRINTERSTATE_DESP_MATERIAL_PVA) { $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_UNLOAD_PVA; } if (!CoreStatus_checkInWaitTime($timeout_check)) { // already passed the timeout of changement // change status into idle $ret_val = CoreStatus_setInIdle(); if ($ret_val == FALSE) { $this->load->helper('printerlog'); PrinterLog_logError('can not set idle after unloading filament', __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } $this->_display_changecartridge_error_unloading(); break; } $this->_display_changecartridge_in_unload_filament($abb_cartridge); } else { // no filament $ret_val = CoreStatus_setInIdle(); if ($ret_val == FALSE) { $this->load->helper('printerlog'); PrinterLog_logError('can not set idle after unloading filament', __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } $this->_display_changecartridge_remove_cartridge(); } break; case PRINTERSTATE_CHANGECART_REINST_C: // we use switch breakdown to continue the treatement $low_hint = TRUE; case PRINTERSTATE_CHANGECART_INSERT_C: // we call the page: remove / reinsert cartridge $temp_data = NULL; $ret_val = PrinterState_checkFilament($abb_cartridge, $need_filament, $temp_data, FALSE); if ($ret_val == $code_miss_cartridge) { // no cartridge $this->_display_changecartridge_insert_cartridge(); } else { if ($ret_val == $code_low_filament) { // have cartridge, low filament $this->_display_changecartridge_remove_cartridge(TRUE); } else { if ($ret_val == $code_miss_filament) { // have cartridge, no filemant $this->_display_changecartridge_remove_cartridge($low_hint); } else { // error status $this->load->helper('printerlog'); PrinterLog_logError('error checkfilament return status when changing filament (in removing)', __FILE__, __LINE__); $this->_display_changecartridge_remove_cartridge(); } } } break; case PRINTERSTATE_CHANGECART_LOAD_F: // we call the page: insert cartridge $temp_data = NULL; $ret_val = PrinterState_checkFilament($abb_cartridge, $need_filament, $temp_data, FALSE); if ($ret_val == $code_miss_filament) { //TODO added a new temporary page here, need to remove when not needed // $this->_display_changecartridge_wait_load_filament(FALSE); // if ($temp_data[PRINTERSTATE_TITLE_CARTRIDGE] == PRINTERSTATE_DESP_CARTRIDGE_REFILL) { // $this->_display_changecartridge_write_cartridge($abb_cartridge, PRINTERSTATE_CHANGECART_WAIT_F, $need_filament); // } // else { // $this->_display_changecartridge_wait_load_filament(FALSE); // } $this->_display_changecartridge_write_cartridge($abb_cartridge, PRINTERSTATE_CHANGECART_WAIT_F, $need_filament); //TODO a new filament quantity verification system // turn off RFID power after changing $ret_val = PrinterState_setRFIDPower(FALSE); if ($ret_val != ERROR_OK) { $this->load->helper('printerlog'); PrinterLog_logError('error in turning off RFID power', __FILE__, __LINE__); } } else { if ($ret_val == $code_low_filament) { $this->_display_changecartridge_remove_cartridge(TRUE); } else { if ($ret_val == $code_miss_cartridge) { // no cartridge $this->_display_changecartridge_insert_cartridge(); } else { // error status $this->load->helper('printerlog'); PrinterLog_logError('error checkfilament return status when changing filament (in inserting)', __FILE__, __LINE__); $this->_display_changecartridge_remove_cartridge(); } } } break; case PRINTERSTATE_CHANGECART_WAIT_F: // we use switch breakdown to continue the treatement $change_able = FALSE; case PRINTERSTATE_CHANGECART_WAIT_F_C: // we call the page: wait load filament / change cartridge if (CoreStatus_checkInIdle()) { // in idle $this->_display_changecartridge_wait_load_filament($change_able, $id_model, $abb_cartridge); } else { // in busy (normally only loading is possible) $this->_display_changecartridge_in_load_filament(); } break; case PRINTERSTATE_CHANGECART_NEED_P: // we call the page: in load filament // $status_current = NULL; $array_status = array(); $offset_check = PRINTERSTATE_VALUE_OFFSET_TO_CHECK_LOAD; // CoreStatus_checkInIdle($status_current, $array_status); CoreStatus_getStatusArray($array_status); if (array_key_exists(CORESTATUS_TITLE_FILA_MAT, $array_status) && $array_status[CORESTATUS_TITLE_FILA_MAT] == PRINTERSTATE_DESP_MATERIAL_PVA) { $offset_check = PRINTERSTATE_VALUE_OFFSET_TO_CHECK_LOAD_PVA; } // wait the time for arduino before checking filament when loading filament if (CoreStatus_checkInWaitTime($offset_check)) { $this->_display_changecartridge_in_load_filament(); break; } if (PrinterState_getFilamentStatus($abb_cartridge)) { // have filament $ret_val = CoreStatus_setInIdle(); if ($ret_val == FALSE) { $this->load->helper('printerlog'); PrinterLog_logError('can not set idle after loading filament', __FILE__, __LINE__); $this->output->set_status_header(202); // disable checking } $this->_display_changecartridge_need_prime($abb_cartridge, $id_model); } else { // no filament $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_LOAD; if (array_key_exists(CORESTATUS_TITLE_FILA_MAT, $array_status) && $array_status[CORESTATUS_TITLE_FILA_MAT] == PRINTERSTATE_DESP_MATERIAL_PVA) { $timeout_check = PRINTERSTATE_VALUE_TIMEOUT_TO_CHECK_LOAD_PVA; } if (!CoreStatus_checkInWaitTime($timeout_check)) { // already passed the timeout of changement CoreStatus_setInIdle(); //TODO need test and error control here $this->_display_changecartridge_error_loading(); break; } $this->_display_changecartridge_in_load_filament(); } break; default: break; } $this->output->set_content_type('text/plain; charset=UTF-8'); return; }
public function get() { $parameter = NULL; $cr = 0; $display = NULL; $api_prm = NULL; $this->load->helper(array('printerstate', 'zimapi')); $parameter = $this->input->get('p'); //return false if missing if ($parameter) { switch ($parameter) { case PRINTERSTATE_PRM_EXTRUDER: $cr = PrinterState_getExtruder($display); //$abb_extruder break; case PRINTERSTATE_PRM_TEMPER: // check which temperature we want $has_e = $this->input->get('e'); $has_h = $this->input->get('h'); $has_v = $this->input->get('v'); if ($has_e === FALSE && $has_h === FALSE) { $cr = ERROR_MISS_PRM; } else { if (!($has_e === FALSE) && !($has_h === FALSE)) { $cr = ERROR_WRONG_PRM; } else { if (!($has_e === FALSE) && !($has_v === FALSE)) { // refuse getting data not existed for mono extruder if ($has_v == 'l' && $this->config->item('nb_extruder') == 1) { $cr = ERROR_WRONG_PRM; } else { if (in_array($has_v, array('l', 'r'))) { // $tmp_array = PrinterState_getExtruderTemperaturesAsArray(); // $cr = ERROR_OK; // $display = ($has_v == 'l') // ? $tmp_array[PRINTERSTATE_LEFT_EXTRUD] // : $tmp_array[PRINTERSTATE_RIGHT_EXTRUD]; $cr = PrinterState_getTemperature($display, 'e', $has_v); } else { $cr = ERROR_WRONG_PRM; } } } else { $api_prm = $has_e === FALSE ? 'h' : 'e'; $cr = PrinterState_getTemperature($display, $api_prm); } } } break; case PRINTERSTATE_PRM_CARTRIDGE: $api_prm = $this->input->get('v'); // refuse getting data not existed for mono extruder if ($api_prm == 'l' && $this->config->item('nb_extruder') == 1) { $cr = ERROR_WRONG_PRM; } else { $cr = PrinterState_getCartridge($display, $api_prm); } break; case PRINTERSTATE_PRM_INFO: //TODO need add SSO account $cr = ERROR_OK; $display = PrinterState_getInfo(); break; case 'render': $this->_return_under_construction(); return; break; case PRINTERSTATE_PRM_ACCELERATION: $cr = PrinterState_getAcceleration($display); break; case PRINTERSTATE_PRM_SPEED_MOVE: case PRINTERSTATE_PRM_SPEED_EXTRUDE: $cr = PrinterState_getSpeed($display); break; case PRINTERSTATE_PRM_COLDEXTRUSION: $value = NULL; $cr = PrinterState_getColdExtrusion($value); if ($cr == ERROR_OK) { if ($value == TRUE) { $display = 'on'; } else { $display = 'off'; } } break; case PRINTERSTATE_PRM_FILAMENT: $value = NULL; $api_prm = $this->input->get('v'); // refuse getting data not existed for mono extruder if ($api_prm == 'l' && $this->config->item('nb_extruder') == 1) { $cr = ERROR_WRONG_PRM; } else { if ($api_prm) { $cr = ERROR_OK; $value = PrinterState_getFilamentStatus($api_prm); if ($value == TRUE) { $display = 'true'; } else { $display = 'false'; } } else { $cr = ERROR_MISS_PRM; } } break; case PRINTERSTATE_PRM_ENDSTOP: $status = NULL; $abb_endstop = $this->input->get('axis'); $cr = PrinterState_getEndstop($abb_endstop, $status); if ($cr == ERROR_OK) { $display = $status ? 'on' : 'off'; } break; case PRINTERSTATE_PRM_STRIPLED: $value = NULL; $cr = PrinterState_getStripLedStatus($value); if ($cr == ERROR_OK) { if ($value == TRUE) { $display = 'on'; } else { $display = 'off'; } } break; case PRINTERSTATE_PRM_HEADLED: $value = NULL; $cr = PrinterState_getTopLedStatus($value); if ($cr == ERROR_OK) { if ($value == TRUE) { $display = 'on'; } else { $display = 'off'; } } break; case PRINTERSTATE_PRM_OFFSET: $value = NULL; $axis = $this->input->get('axis'); if ($axis) { $cr = PrinterState_getOffset($axis, $value); if ($cr == ERROR_OK) { $display = $value; } } else { $cr = ERROR_MISS_PRM; } break; case PRINTERSTATE_PRM_POSITION: $cr = PrinterState_getPosition($display); break; case ZIMAPI_PRM_CAPTURE: $path_capture = ''; $password = $this->input->get('password'); if (!ZimAPI_checkCameraPassword($password)) { $cr = ERROR_WRONG_PWD; break; } $this->load->helper('file'); if (ZimAPI_cameraCapture($path_capture)) { $this->output->set_content_type(get_mime_by_extension($path_capture))->set_output(@file_get_contents($path_capture)); return; } else { $cr = ERROR_INTERNAL; } break; case ZIMAPI_PRM_VIDEO_MODE: if (ZimAPI_checkCamera($display)) { $cr = ERROR_OK; } else { $cr = ERROR_INTERNAL; } break; case ZIMAPI_PRM_PRESET: if (ZimAPI_getPreset($display)) { $cr = ERROR_OK; } else { $cr = ERROR_INTERNAL; } break; case ZIMAPI_PRM_UPGRADE: if (ZimAPI_getUpgradeMode($display)) { $cr = ERROR_OK; } else { $cr = ERROR_INTERNAL; } if ($display != 'off') { $display = 'on'; } break; case ZIMAPI_PRM_PROXY: if (ZimAPI_getTromboning()) { $display = 'on'; } else { $display = 'off'; } $cr = ERROR_OK; break; case ZIMAPI_PRM_SSH: $status_current = NULL; if (ZimAPI_getSSH($status_current)) { $cr = ERROR_OK; if ($status_current) { $display = 'on'; } else { $display = 'off'; } } else { $cr = ERROR_INTERNAL; } break; case ZIMAPI_PRM_STATS: if (ZimAPI_getStatistic()) { $display = 'on'; } else { $display = 'off'; } $cr = ERROR_OK; break; default: $cr = ERROR_WRONG_PRM; break; } } else { $cr = ERROR_MISS_PRM; } if ($cr != ERROR_OK) { $display = $cr . " " . t(MyERRMSG($cr)); } $this->output->set_status_header($cr, $display); // http_response_code($cr); $this->output->set_content_type(RETURN_CONTENT_TYPE); // echo $display; $this->load->library('parser'); $this->parser->parse('plaintxt', array('display' => $display)); return; }
public function insert($abb_cartridge = '') { $ret_val = 0; $display = NULL; $parameter = ''; $output = array(); $arcontrol_fullpath = $this->config->item('arcontrol_c'); $this->load->helper('printerstate'); switch (strtolower($abb_cartridge)) { case 'l': $parameter = ' -isctl'; break; case 'r': $parameter = ' -isctr'; break; default: $display = 'wrong cartridge'; break; } if ($this->config->item('simulator') == FALSE) { $display = 'just for simulator'; } if (is_null($display)) { $ret_val = PrinterState_getFilamentStatus(strtolower($abb_cartridge)); if ($ret_val == FALSE) { exec($arcontrol_fullpath . $parameter, $output, $ret_val); if ($ret_val == ERROR_NORMAL_RC_OK) { $display = 'ok'; } else { $display = 'internal command error'; } } else { $display = 'filament status error'; } } $this->output->set_content_type('txt_u'); // echo $display; $this->load->library('parser'); $this->parser->parse('plaintxt', array('display' => $display)); return; }
public function filament_ajax($side) { $this->load->library('parser'); $this->load->helper('printerstate'); $this->lang->load('manage/filament_ajax', $this->config->item('language')); $json_cartridge = array(); $ret_val = PrinterState_getCartridgeAsArray($json_cartridge, $side); if ($ret_val != ERROR_MISS_LEFT_CART && $ret_val != ERROR_MISS_RIGT_CART) { $action = PrinterState_getFilamentStatus($side) ? t('loaded_action') : t('unloaded_action'); $initial = intval($json_cartridge['initial']); $used = intval($json_cartridge['used']); $template_data = array('visibility' => "visible", 'color' => $json_cartridge['color'], 'material' => "<br />" . strtoupper($json_cartridge['material']) . "<br />", 'length' => number_format(round(($initial - $used) / 1000, 2, PHP_ROUND_HALF_DOWN), 2), 'length_text' => t('length_text'), 'action' => $action); $this->parser->parse('manage/manage_filament_ajax', $template_data); } else { $template_data = array('visibility' => "hidden", 'color' => "#FFFFFF", 'material' => "", 'length' => "", 'length_text' => "", 'action' => t('insert_action') . "<br /><br /><br /><br />"); $this->parser->parse('manage/manage_filament_ajax', $template_data); } $this->output->set_status_header(202); return; }
function PrinterState_unloadFilament($abb_filament) { $CI =& get_instance(); $output = array(); $array_cartridge = array(); $command = $CI->config->item('siteutil'); $ret_val = 0; $temper_unload = PRINTERSTATE_TEMPER_MAX_E; $is_pva = FALSE; $ret_val = PrinterState_getCartridgeAsArray($array_cartridge, $abb_filament); if ($ret_val != ERROR_OK) { PrinterLog_logError('read cartridge error when unloading', __FILE__, __LINE__); return ERROR_INTERNAL; } // fix temperature according to filament type switch ($array_cartridge[PRINTERSTATE_TITLE_MATERIAL]) { case PRINTERSTATE_DESP_MATERIAL_PLA: $temper_unload = PRINTERSTATE_VALUE_FILAMENT_PLA_LOAD_TEMPER; break; case PRINTERSTATE_DESP_MATERIAL_ABS: $temper_unload = PRINTERSTATE_VALUE_FILAMENT_ABS_LOAD_TEMPER; break; case PRINTERSTATE_DESP_MATERIAL_PVA: $temper_unload = PRINTERSTATE_VALUE_FILAMENT_PVA_LOAD_TEMPER; $is_pva = TRUE; break; default: PrinterLog_logError('unknown filament type in unloading', __FILE__, __LINE__); return ERROR_INTERNAL; break; // never reach here } if ($is_pva) { $command .= PRINTERSTATE_UNLOAD_FILA_PVA; } else { $command .= PRINTERSTATE_UNLOAD_FILAMENT; } $command .= $abb_filament . ' ' . $temper_unload; $CI->load->helper('detectos'); if ($CI->config->item('simulator') == FALSE && !DectectOS_checkWindows()) { // $command .= ' > ' . PRINTERSTATE_FILE_RESPONSE . ' &'; $command .= ' &'; } else { $command = 'start /B ' . $command; } // check already unloaded if (PrinterState_getFilamentStatus($abb_filament) == FALSE) { return ERROR_LOADED_UNLOAD; } // change status json file $ret_val = CoreStatus_setInUnloading($abb_filament, $array_cartridge[PRINTERSTATE_TITLE_MATERIAL]); if ($ret_val == FALSE) { return ERROR_INTERNAL; } pclose(popen($command, 'r')); // only for windows arcontrol client PrinterLog_logArduino($command); // we can't log return output when using this solution return ERROR_OK; }