Пример #1
0
RectRubberWidget::RectRubberWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::RectRubberWidget)
{
    ui->setupUi(this);
    ui->le_R->setText(QString::number(rectRubber.R()));
    ui->le_k->setText(QString::number(rectRubber.k()));

    connect(ui->b_Calco, SIGNAL(clicked()), this, SLOT(calcoSlot()));
    connect(ui->b_Calc, SIGNAL(clicked()), this, SLOT(calcSlot()));
    connect(ui->chb_manual, SIGNAL(clicked(bool)), this, SLOT(chbManualDefault(bool)));
}
Пример #2
0
void SFX::addFile(const char* name, int index)
{
  int slot = calcSlot(name);
  if (slot == -1) return;

  if (!m_location[slot].InUse()) {
    m_location[slot].start = index;
    m_location[slot].count = 1;
  }
  else {
    m_location[slot].count++;
  }
}
Пример #3
0
void SFX::scanFiles(uint8_t index)
{
  // First get the files,
  // then sort the files,
  // finally assign location info.
  memset(m_location, 255, sizeof(SFXLocation)*NUM_SFX_TYPES);
  m_numFilenames = 0;

  //  Serial.print("scanFiles "); Serial.println(index);
  File root = SD.open(m_dirName[index].c_str());
  while (true) {
    File entry =  root.openNextFile();
    if (!entry) {
      // no more files
      break;
    }
    if (entry.isDirectory()) {
      continue;
    }
    else {
      int slot = calcSlot(entry.name());
      if (slot >= 0 && m_numFilenames < MAX_SFX_FILES) {
        m_filename[m_numFilenames++] = entry.name();
      }
    }
    entry.close();
  }
  root.close();

  // They often come in weird order, which is a bummer.
  // Simple sort seems fast enough.
  combSort(m_filename, m_numFilenames);

  for (int i = 0; i < m_numFilenames; ++i) {
    addFile(m_filename[i].c_str(), i);
  }

  Log.p("IDLE      ").p(m_location[SFX_IDLE].start).p(" ").p(m_location[SFX_IDLE].count).eol();
  Log.p("MOTION    ").p(m_location[SFX_MOTION].start).p(" ").p(m_location[SFX_MOTION].count).eol();
  Log.p("IMPACT    ").p(m_location[SFX_IMPACT].start).p(" ").p(m_location[SFX_IMPACT].count).eol();
  Log.p("USER_TAP  ").p(m_location[SFX_USER_TAP].start).p(" ").p(m_location[SFX_USER_TAP].count).eol();
  Log.p("USER_HOLD ").p(m_location[SFX_USER_HOLD].start).p(" ").p(m_location[SFX_USER_HOLD].count).eol();
  Log.p("POWER_ON  ").p(m_location[SFX_POWER_ON].start).p(" ").p(m_location[SFX_POWER_ON].count).eol();
  Log.p("POWER_OFF ").p(m_location[SFX_POWER_OFF].start).p(" ").p(m_location[SFX_POWER_OFF].count).eol();
  readIgniteRetract();
}