This commit is contained in:
meelstorm
2025-09-29 09:31:57 +02:00
parent 87c1145744
commit 1aecb79ade
16 changed files with 110 additions and 16 deletions

View File

@@ -128,7 +128,7 @@ public abstract class BaseRecognitionControl: IRecognitionControl
SessionEnded = DateTime.Now
});
_loadingService.StopLoading($"Stopping {_settings.CameraName}");
IsPaused=false; // ensure paused is reset
}
public void Pause()
@@ -141,6 +141,8 @@ public abstract class BaseRecognitionControl: IRecognitionControl
IsPaused = false;
}
int _errorsInSequence = 0;
private async Task Loop(CancellationToken token)
{
@@ -149,7 +151,7 @@ public abstract class BaseRecognitionControl: IRecognitionControl
{
if (IsPaused)
{
await Task.Delay(100, token);
await Task.Delay(100, token).ConfigureAwait(false);
continue;
}
@@ -165,6 +167,18 @@ public abstract class BaseRecognitionControl: IRecognitionControl
Thread.Sleep(_settings.MinimumProcessingTime - (int)processed.Value.processingTime.Milliseconds);
}
if (processed.Value.errorNames.Length > 0)
{
_errorsInSequence++;
if (_errorsInSequence >= _settings.ErrorsInSequenceAlarm)
{
ErrorsInSequenceAlarm(new ErrorsInSequenceEvent(){Errors = _errorsInSequence});
}
}
else
{
_errorsInSequence = 0;
}
var processingResult = new ImageProcessedEvent()
{
@@ -188,6 +202,7 @@ public abstract class BaseRecognitionControl: IRecognitionControl
}
public event Action<ImageProcessedEvent> ImageProcessed = delegate { };
public event Action<SessionStartedEvent>? SessionStarted = delegate { };
public event Action<SessionEndedEvent>? SessionEnded = delegate { };
public event Action<SessionStartedEvent> SessionStarted = delegate { };
public event Action<SessionEndedEvent> SessionEnded = delegate { };
public event Action<ErrorsInSequenceEvent> ErrorsInSequenceAlarm = delegate { };
}