Skip to content

Commit

Permalink
BaseSensorBox.ReadSensors: reduce "Status" send frequency (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsWithCA authored Dec 17, 2024
1 parent cc35c27 commit 3751dc7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions CA_DataUploaderLib/BaseSensorBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,13 @@ private async Task ReadSensors(MCUBoard board, string boxName, SensorSample.Inpu
timeBetweenReads = TimeSpan.FromMilliseconds(board.ConfigSettings.MillisecondsBetweenReads * 1.5);
if (status != _lastStatus && (status & 0x80000000) != 0) // Error?
{
LowFrequencyLogError((args, skipMessage) => LogError(args.board, $"Board responded with error status 0x{args.status:X}{skipMessage}"), (board, status));
if (_boardCustomCommands.TryGetValue(board, out var customCommandsChannel))
customCommandsChannel.Writer.TryWrite("Status");
LowFrequencyLogError((args, skipMessage) =>
{
LogError(args.board, $"Board responded with error status 0x{args.status:X}{skipMessage}");
if (_boardCustomCommands.TryGetValue(board, out var customCommandsChannel))
customCommandsChannel.Writer.TryWrite("Status");
}, (board, status));

}
_lastStatus = status;
}
Expand Down

0 comments on commit 3751dc7

Please sign in to comment.