+ const QString text = conv_threshold_cb_->currentText();
+ if (!regex.exactMatch(text))
+ return; // String doesn't match the regex
+
+ QStringList tokens = regex.capturedTexts();
+
+ // For now, we simply assume that the unit is volt without modifiers
+ const double thr = tokens.at(1).toDouble();
+
+ // Only restart the conversion if the threshold was updated
+ if (base_->set_conversion_option("threshold_value", thr))
+ delayed_conversion_starter_.start();
+ }
+
+ if (conv_type == SignalBase::A2LConversionBySchmittTrigger && use_custom_thr) {
+ // Not one of the preset values, try to parse the combo box text
+ // Note: Regex loosely based on
+ // https://txt2re.com/index-c++.php3?s=0.1V/0.2V&2&14&-22&3&15
+ QString re1 = "([+-]?\\d*[\\.,]?\\d*)"; // Float value
+ QString re2 = "([a-zA-Z]*)"; // SI unit
+ QString re3 = "\\/"; // Forward slash, not captured
+ QString re4 = "([+-]?\\d*[\\.,]?\\d*)"; // Float value
+ QString re5 = "([a-zA-Z]*)"; // SI unit
+ QRegExp regex(re1 + re2 + re3 + re4 + re5);
+
+ const QString text = conv_threshold_cb_->currentText();
+ if (!regex.exactMatch(text))
+ return; // String doesn't match the regex
+
+ QStringList tokens = regex.capturedTexts();
+
+ // For now, we simply assume that the unit is volt without modifiers
+ const double low_thr = tokens.at(1).toDouble();
+ const double high_thr = tokens.at(3).toDouble();
+
+ // Only restart the conversion if one of the options was updated
+ bool o1 = base_->set_conversion_option("threshold_value_low", low_thr);
+ bool o2 = base_->set_conversion_option("threshold_value_high", high_thr);
+ if (o1 || o2)
+ delayed_conversion_starter_.start();