Adjusted signal strength drops.

This commit is contained in:
flash 2024-02-29 21:55:29 +00:00
parent 20ea388c24
commit 4adf3d80a1

View file

@ -416,7 +416,9 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } };
}, 'Clear Logs');
const pingIndicator = new MamiPingIndicator;
const pingToggle = Umi.UI.Toggles.Add('ping', undefined, 'Ready!');
const pingToggle = Umi.UI.Toggles.Add('ping', {
click: () => alert(pingToggle.title),
}, 'Ready!');
pingToggle.appendChild(pingIndicator.getElement());
console.log(pingIndicator);
@ -614,16 +616,15 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } };
Umi.Server.watch('ping:long', long => {
if(dumpEvents) console.log('ping:long', long);
pingToggle.title = 'Taking longer than 2 seconds';
pingToggle.title = '+2000ms';
pingIndicator.setStrength(0);
});
Umi.Server.watch('ping:recv', recv => {
if(dumpEvents) console.log('ping:recv', recv);
let strength = 3;
if(recv.diff > 45) --strength;
if(recv.diff > 30) --strength;
if(recv.diff > 15) --strength;
if(recv.diff > 1000) --strength;
if(recv.diff > 250) --strength;
pingToggle.title = `${recv.diff.toLocaleString()}ms`;
pingIndicator.setStrength(strength);