コード例 #1
0
ファイル: printerstate.php プロジェクト: Jaesin/zim-web
 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;
 }
コード例 #2
0
ファイル: zimapi_helper.php プロジェクト: Jaesin/zim-web
function ZimAPI_checkCameraInBlock()
{
    $data_json = array();
    $CI =& get_instance();
    $CI->load->helper(array('corestatus', 'printerstate'));
    // check we are in printing, and not in heating
    $data_json = PrinterState_checkStatusAsArray(FALSE);
    if (is_array($data_json) && $data_json[PRINTERSTATE_TITLE_STATUS] == CORESTATUS_VALUE_PRINT && isset($data_json[PRINTERSTATE_TITLE_EXTEND_PRM][PRINTERSTATE_TITLE_EXT_OPER]) && $data_json[PRINTERSTATE_TITLE_EXTEND_PRM][PRINTERSTATE_TITLE_EXT_OPER] != PRINTERSTATE_VALUE_PRINT_OPERATION_HEAT) {
        // 		$status_current = NULL;
        // check we are in printing of normal model which has timelapse
        //TODO union two verification of timelapse into 1 (preparePrint function in printer helper and this function)
        // 		CoreStatus_checkInIdle($status_current, $data_json);
        CoreStatus_getStatusArray($data_json);
        if (isset($data_json[CORESTATUS_TITLE_PRINTMODEL]) && in_array($data_json[CORESTATUS_TITLE_PRINTMODEL], array(CORESTATUS_VALUE_MID_PRIME_R, CORESTATUS_VALUE_MID_PRIME_L, CORESTATUS_VALUE_MID_CALIBRATION))) {
            return FALSE;
        } else {
            $CI->load->helper('printerlog');
            PrinterLog_logMessage('ignore all camera requests in printing non-heating phase');
        }
        return TRUE;
    }
    return FALSE;
}
コード例 #3
0
ファイル: printdetail.php プロジェクト: Jaesin/zim-web
 public function status_ajax()
 {
     $template_data = array();
     // 		$printing_status = '';
     $ret_val = 0;
     $data_status = array();
     $time_remain = NULL;
     $time_passed = NULL;
     $temper_l = 0;
     $temper_r = 0;
     $temper_b = 0;
     $finish_hint = NULL;
     $hold_temper = 'false';
     // 		$status_current = NULL;
     $array_status = array();
     $reload_player_times = 0;
     $bicolor = $this->config->item('nb_extruder') >= 2;
     $heat_bed = $this->config->item('heat_bed');
     $this->load->helper(array('printer', 'timedisplay'));
     $this->load->library('parser');
     $this->lang->load('printdetail', $this->config->item('language'));
     $this->lang->load('timedisplay', $this->config->item('language'));
     $ret_val = Printer_checkPrintStatus($data_status);
     if ($ret_val == FALSE) {
         $this->load->helper('corestatus');
         $ret_val = CoreStatus_setInIdle();
         if ($ret_val == FALSE) {
             // log internal error
             $this->load->helper('printerlog');
             PrinterLog_logError('can not set idle after printing', __FILE__, __LINE__);
         }
         if ($this->config->item('simulator')) {
             // just set temperature for simulation
             $this->load->helper('printerstate');
             PrinterState_setExtruder('r');
             PrinterState_setTemperature(20);
             PrinterState_setExtruder('l');
             PrinterState_setTemperature(20);
             PrinterState_setExtruder('r');
         }
         $this->output->set_status_header(202);
         return;
     }
     // treat time remaining for display
     if (isset($data_status['print_remain'])) {
         $time_remain = TimeDisplay__convertsecond($data_status['print_remain'], t('Time remaining: '), t('under calculating'));
     } else {
         $time_remain = t('Time remaining: ') . t('in_progress');
     }
     $time_passed = TimeDisplay__convertsecond($data_status['print_tpassed'], t('time_elapsed'));
     // 		CoreStatus_checkInIdle($status_current, $array_status);
     CoreStatus_getStatusArray($array_status);
     if (isset($array_status[CORESTATUS_TITLE_PRINTMODEL]) && !in_array($array_status[CORESTATUS_TITLE_PRINTMODEL], array(CORESTATUS_VALUE_MID_PRIME_L, CORESTATUS_VALUE_MID_PRIME_R, CORESTATUS_VALUE_MID_CALIBRATION))) {
         $reload_player_times = $data_status['print_inPhase'];
     }
     if ($data_status['print_percent'] == 100) {
         if (isset($array_status[CORESTATUS_TITLE_PRINTMODEL]) && in_array($array_status[CORESTATUS_TITLE_PRINTMODEL], array(CORESTATUS_VALUE_MID_PRIME_L, CORESTATUS_VALUE_MID_PRIME_R))) {
             $finish_hint = t('in_finish_prime');
         } else {
             $finish_hint = t('in_finish');
         }
         $hold_temper = 'true';
     } else {
         // 			$hold_temper = 'false';
         $temper_l = $data_status['print_temperL'];
         $temper_r = $data_status['print_temperR'];
         $temper_b = $data_status['print_temperB'];
     }
     // parse the ajax part
     $template_data = array('percent_title' => t('percent_title'), 'value_percent' => $data_status['print_percent'], 'print_remain' => $time_remain, 'print_passed' => $time_passed, 'hold_temper' => $hold_temper, 'print_temperL' => $bicolor ? t('Temperature of the left extruder: %d °C', array($temper_l)) : NULL, 'print_temperR' => $bicolor ? t('Temperature of the right extruder: %d °C', array($temper_r)) : t('print_temper_msg_mono', array($temper_r)), 'print_temperB' => $heat_bed ? t('print_temper_msg_bed', array($temper_b)) : NULL, 'value_temperL' => $bicolor ? $temper_l : 'null', 'value_temperR' => $temper_r, 'value_temperB' => $heat_bed ? $temper_b : 'null', 'in_finish' => $finish_hint, 'reload_player' => $reload_player_times);
     $this->parser->parse('printdetail/status_ajax', $template_data);
     $this->output->set_content_type('text/plain; charset=UTF-8');
     return;
 }
コード例 #4
0
ファイル: corestatus_helper.php プロジェクト: Jaesin/zim-web
function CoreStatus__setInStatus($value_status, $data_array = array())
{
    global $CFG;
    global $PRINTER;
    $state_file = $CFG->config['conf'] . CORESTATUS_FILENAME_WORK;
    $data_json = array();
    $fp = NULL;
    if (!CoreStatus_getStatusArray($data_json)) {
        return FALSE;
    }
    // change status
    $data_json[CORESTATUS_TITLE_STATUS] = $value_status;
    foreach ($data_array as $key => $value) {
        $data_json[$key] = $value;
    }
    // assign global variable (initialization is done in getStatusArray, so no need to verify existance)
    $PRINTER[CORESTATUS_KEY_GLOBAL_VAR] = $data_json;
    // write json file
    $fp = fopen($state_file, 'w');
    if ($fp) {
        fwrite($fp, json_encode($data_json));
        fclose($fp);
    } else {
        return FALSE;
    }
    return TRUE;
}
コード例 #5
0
function PrinterState_prepareStatsPrintLabel()
{
    $status_array = array();
    $filament_used = array();
    $stats_info = array();
    $CI =& get_instance();
    $CI->load->helper(array('printerlog', 'corestatus'));
    CoreStatus_getStatusArray($status_array);
    if (isset($status_array[CORESTATUS_TITLE_PRINTMODEL])) {
        $stats_info[PRINTERLOG_STATS_MODEL] = $status_array[CORESTATUS_TITLE_PRINTMODEL];
    }
    if (ERROR_OK != PrinterState_getConsumption($filament_used)) {
        $filament_used = array();
    }
    foreach (array(CORESTATUS_TITLE_P_TEMPER_L => array('l', PRINTERLOG_STATS_FILA_TYPE_L, PRINTERLOG_STATS_FILA_COLOR_L, PRINTERLOG_STATS_FILA_TEMPER_L, PRINTERLOG_STATS_FILA_USED_L), CORESTATUS_TITLE_P_TEMPER_R => array('r', PRINTERLOG_STATS_FILA_TYPE_R, PRINTERLOG_STATS_FILA_COLOR_R, PRINTERLOG_STATS_FILA_TEMPER_R, PRINTERLOG_STATS_FILA_USED_R)) as $check_key => $assign_key) {
        $json_cartridge = array();
        if (isset($status_array[$check_key]) && ERROR_OK == PrinterState_getCartridgeAsArray($json_cartridge, $assign_key[0])) {
            $stats_info[$assign_key[1]] = $json_cartridge[PRINTERSTATE_TITLE_MATERIAL];
            $stats_info[$assign_key[2]] = $json_cartridge[PRINTERSTATE_TITLE_COLOR];
            $stats_info[$assign_key[3]] = $status_array[$check_key];
        }
        if (isset($filament_used[$assign_key[0]])) {
            $stats_info[$assign_key[4]] = $filament_used[$assign_key[0]];
        }
    }
    return $stats_info;
}