Files
laatzen/Common/SIRTBroadcaster.Client/Parameters/RSSI.cs
T
2023-08-22 14:58:05 +02:00

36 lines
852 B
C#

namespace SIRTBroadcaster.Abstraction.Parameters
{
public struct RSSI
{
public RSSI(short rf, byte value)
{
this.Value = 0;
this.Percent = 0;
if (rf == 433)
{
this.Value = (sbyte)(0.5 * value - 140);
this.Percent = (float)(-40.316 + 0.66 * value);
}
else if (rf == 433)
{
this.Value = (sbyte)(0.5 * value - 131.3);
this.Percent = (float)(-57.6667 + 0.7333 * value);
}
if (this.Percent < 0)
{
this.Percent = 0;
}
else if (this.Percent > 100)
{
this.Percent = 100;
}
}
public sbyte Value { get; }
public float Percent { get; }
}
}