return false;
}
+ qDebug() << kernelEff->u.condition[0].center << kernelEff->u.condition[0].deadband << kernelEff->u.condition[1].center << kernelEff->u.condition[1].deadband;
+
int ret = uploadEffect(kernelEff);
if (ret < 0) {
QMessageBox::critical(nullptr, "FFB Device", "Effect could not have been uploaded, error code: " + QString::number(ret));
struct input_event evt;
evt.type = EV_FF;
evt.code = kernelEff->id;
- evt.value = 1;
+ evt.value = m_effects[idx]->parameters()->repeat;
ret = write(c_fd, &evt, sizeof(struct input_event));
if (ret != sizeof(struct input_event)) {
if (!GlobalSettings::GS()->doSanityChecks)
return true;
+ if (params->repeat < 1) {
+ reportError("Effect must be played back at least once.");
+ return false;
+ }
+
if (!checkBoundsInclusive(params->direction, 0, 0xFFFF)) {
reportError("Direction out of bounds.");
return false;
FFBEffectParameters::FFBEffectParameters() :
direction(0),
+ repeat(1),
replayDelay(0),
replayLength(0)
{
return ok;
}
+bool FFBEffectParameters::repeatFromString(const QString& repeat)
+{
+ bool ok;
+ this->repeat = repeat.toInt(&ok);
+
+ return ok;
+}
+
bool FFBEffectParameters::replayDelayFromString(const QString& replayDelay)
{
bool ok;
virtual ~FFBEffectParameters();
bool directionFromString(const QString& direction);
+ bool repeatFromString(const QString& repeat);
bool replayDelayFromString(const QString& replayDelay);
bool replayLengthFromString(const QString& replayLength);
int direction;
+ int repeat;
int replayDelay;
int replayLength;
};
QMessageBox::warning(this, res_inputFormatErrCap, "Invalid data in field \"direction\"");
return false;
}
+ if (!params->repeatFromString(ui->qle_repeat->text())) {
+ QMessageBox::warning(this, res_inputFormatErrCap, "Invalid data in field \"Replay\"");
+ return false;
+ }
if (!params->replayDelayFromString(ui->qle_replayDelay->text())) {
QMessageBox::warning(this, res_inputFormatErrCap, "Invalid data in field \"Replay delay\"");
return false;
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="ql_repeat">
+ <property name="text">
+ <string>Repeat:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="qle_repeat">
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>