コード例 #1
0
void Printer::handle_rr_more (rr_dev dev)
{
  if (printing && gcode_iter) {
    time_t time_used = time(NULL) - gcode_iter->time_started;
    if (time_used != lasttimeshown) { // show once a second
      int n_buffered = rr_dev_buffered_lines(device);
      int donelines = gcode_iter->m_cur_line - n_buffered;
      if (donelines < 100) gcode_iter->time_started = time(NULL); 
      //int tot_lines = gcode_iter->m_line_count;
      // done by view
      // if (tot_lines>0) { 
      // 	if (donelines > 30) {
      // 	  m_view->get_view_progress()->update (donelines, false);
      // 	}
      // }
      if (lastdonelines > 0) // don't stop the progress bar
	m_view->showCurrentPrinting(lastdonelines);
      lastdonelines = donelines;
      lasttimeshown = time_used;
    }
    while (rr_dev_write_more (device) && !gcode_iter->finished()) {
      std::string line = gcode_iter->next_line_stripped();
      if (line.length() > 0 && line[0] != ';') {
	rr_dev_enqueue_cmd (device, RR_PRIO_NORMAL, line.data(), line.size());
      }
    }

    if (gcode_iter->finished())
    {
      set_printing (false);
      m_view->showCurrentPrinting(0);
      //m_view->get_view_progress()->stop (_("Printed"));
    }
  }
}
コード例 #2
0
ファイル: printer.cpp プロジェクト: Alkaponj/repsnapper
void Printer::Pause()
{
  set_printing (false);
#if IOCHANNEL
  if (!IsConnected()) return;
#else
  if (device==NULL) return;
  rr_dev_set_paused (device, RR_PRIO_NORMAL, 1);
#endif
}
コード例 #3
0
ファイル: printer.cpp プロジェクト: Alkaponj/repsnapper
void Printer::Continue()
{
  set_printing (true);
#if IOCHANNEL
  if (!IsConnected()) return;
  rr_serial->start_printing();
#else
  if (device==NULL) return;
  rr_dev_set_paused (device, RR_PRIO_NORMAL, 0);
#endif
}
コード例 #4
0
void Printer::Stop()
{  
  if (device==NULL) return;

  set_printing (false);
  //assert(m_model != NULL);
  
  if (!rr_dev_is_connected (device)) {
    alert (_("Not connected to printer.\nCannot stop printing"));
    return;
  }
  rr_dev_reset (device);
}
コード例 #5
0
void Printer::Print()
{
  if (device==NULL) return;
  if (!rr_dev_is_connected (device)) {
    alert (_("Not connected to printer.\nCannot start printing"));
    return;
  }

  assert(m_model != NULL);

  delete (gcode_iter);
  gcode_iter = m_model->gcode.get_iter();
  set_printing (true);

  rr_dev_reset (device);
  rr_dev_set_paused (device, RR_PRIO_NORMAL, 0);
}
コード例 #6
0
void Printer::Continue()
{
  set_printing (true);
  if (device==NULL) return;
  rr_dev_set_paused (device, RR_PRIO_NORMAL, 0);
}
コード例 #7
0
void Printer::Pause()
{
  set_printing (false);
  if (device==NULL) return;
  rr_dev_set_paused (device, RR_PRIO_NORMAL, 1);
}