Example #1
0
 public function extrude($extruder = NULL, $value = NULL, $speed = NULL)
 {
     if (is_null($extruder) || is_null($value) || is_null($speed) || (int) $value == 0 || (int) $speed == 0) {
         $this->output->set_status_header(403);
         return;
     } else {
         $cr = 0;
         $this->load->helper(array('printerstate', 'errorcode'));
         $cr = PrinterState_setExtruder($extruder);
         if ($cr == ERROR_OK) {
             $cr = PrinterState_move('E', (int) $value, (int) $speed);
         }
         if ($cr == ERROR_OK) {
             $this->output->set_status_header(200);
             return;
         }
     }
     $this->output->set_status_header(403);
     return;
 }
Example #2
0
 public function move()
 {
     $cr = 0;
     $abb_axis = $this->input->get('a');
     $distance_axis = $this->input->get('v');
     $this->load->helper('printerstate');
     if ($abb_axis) {
         if ($distance_axis === FALSE) {
             $cr = ERROR_MISS_PRM;
         } else {
             $cr = PrinterState_move($abb_axis, (double) $distance_axis);
         }
     } else {
         $cr = ERROR_MISS_PRM;
     }
     $this->_return_cr($cr);
     return;
 }
Example #3
0
 public function level($point = NULL)
 {
     $cr = 0;
     $array_cmd = array();
     if (is_null($point)) {
         $this->output->set_status_header(403);
         return;
     }
     $this->load->helper(array('printerstate', 'errorcode'));
     $cr = PrinterState_relativePositioning(FALSE);
     if ($cr != ERROR_OK) {
         $point = 'error';
     }
     switch ($point) {
         case 'step1':
             $array_cmd = array('X' => 79, 'Y' => 75);
             break;
         case 'step2':
             $array_cmd = array('X' => 35, 'Y' => 150);
             break;
         case 'step3':
             $array_cmd = array('X' => 124, 'Y' => 150);
             break;
         default:
             $this->output->set_status_header(403);
             return;
             break;
             // never reach here
     }
     foreach ($array_cmd as $axis => $value) {
         $cr = PrinterState_move($axis, $value, 2000);
         if ($cr != ERROR_OK) {
             $this->output->set_status_header(403);
             return;
         }
     }
     $this->output->set_status_header(200);
     return;
 }
Example #4
0
function PrinterState_extrude($value = PRINTERSTATE_VALUE_DEFAULT_EXTRUD)
{
    if ($value == 0) {
        return ERROR_WRONG_PRM;
    }
    return PrinterState_move('E', $value);
}