Skip to content

Commit

Permalink
Warn and fix large endingTimeout value in the IrWidget.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengtmartensson committed Nov 14, 2022
1 parent 8829f15 commit 692b9b9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/harctoolbox/guicomponents/IrWidgetBean.java
Expand Up @@ -34,6 +34,10 @@ public final class IrWidgetBean extends SerialHardwareBean {

private int captureMaxSize;
private int endingTimeout;
/**
* Maximal endingTimeout that is accepted.
*/
public static final int MAX_ENDING_TIMEOUT = 500;

public IrWidgetBean() {
this(null);
Expand Down Expand Up @@ -70,9 +74,14 @@ public void setCaptureMaxSize(int captureMaxSize) {
}

public void setEndingTimeout(int endingTimeout) {
this.endingTimeout = endingTimeout;
if (endingTimeout > MAX_ENDING_TIMEOUT) {
guiUtils.warning("The endingTimeout " + endingTimeout + " is larger than the maximally allowed for the IrWidget, " + MAX_ENDING_TIMEOUT + ". Instead, " + MAX_ENDING_TIMEOUT + " will be used.");
this.endingTimeout = MAX_ENDING_TIMEOUT;
} else
this.endingTimeout = endingTimeout;

if (hardware != null)
((IrWidget) hardware).setEndingTimeout(endingTimeout);
((IrWidget) hardware).setEndingTimeout(this.endingTimeout);
}

@Override
Expand Down

0 comments on commit 692b9b9

Please sign in to comment.