led 多次发送

master
lxw 1 month ago
parent 57b887b832
commit 1efb1b54ab

@ -251,9 +251,21 @@ public class LedClient
public static bool SendMsgByKey(string key) public static bool SendMsgByKey(string key)
{ {
Log.Info($"send by {key}"); Log.Info($"send by {key}");
int count = 0;
if (Dictionary.TryGetValue(key, out var bytes)) if (Dictionary.TryGetValue(key, out var bytes))
{ {
return InnerSend(bytes);
while (!InnerSend(bytes))
{
Thread.Sleep(100);
count++;
if (count > 10)
{
return false;
}
}
return true;
} }
return false; return false;

Loading…
Cancel
Save