up
This commit is contained in:
@@ -420,7 +420,14 @@ func (c *Client) GetStatus() (*Status, error) {
|
|||||||
return &Status{Connected: false}, nil
|
return &Status{Connected: false}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.lastStatus, nil
|
// Check if device is actually alive
|
||||||
|
// If no antennas and all values are default, device is probably off
|
||||||
|
status := *c.lastStatus
|
||||||
|
if len(status.Antennas) == 0 || (status.PortA != nil && status.PortA.Source == "" && status.PortB != nil && status.PortB.Source == "") {
|
||||||
|
status.Connected = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return &status, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAntenna sets the antenna for a specific port
|
// SetAntenna sets the antenna for a specific port
|
||||||
|
|||||||
@@ -164,6 +164,12 @@ func (c *Client) pollLoop() {
|
|||||||
// Mark as connected
|
// Mark as connected
|
||||||
status.Connected = true
|
status.Connected = true
|
||||||
|
|
||||||
|
// Check if device is actually alive (not just TCP connected)
|
||||||
|
// If voltage is 0 and temperature is 0, device is probably off
|
||||||
|
if status.Voltage == 0 && status.Temperature == 0 {
|
||||||
|
status.Connected = false
|
||||||
|
}
|
||||||
|
|
||||||
// Peak hold logic - keep highest power for 1 second
|
// Peak hold logic - keep highest power for 1 second
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if c.lastStatus != nil {
|
if c.lastStatus != nil {
|
||||||
|
|||||||
@@ -163,6 +163,12 @@ func (c *Client) pollLoop() {
|
|||||||
// Mark as connected
|
// Mark as connected
|
||||||
status.Connected = true
|
status.Connected = true
|
||||||
|
|
||||||
|
// Check if device is actually alive
|
||||||
|
// If all frequencies are 0, device is probably off
|
||||||
|
if status.FreqA == 0 && status.FreqB == 0 && status.PowerForward == 0 {
|
||||||
|
status.Connected = false
|
||||||
|
}
|
||||||
|
|
||||||
// Peak hold logic - keep highest power for 1 second
|
// Peak hold logic - keep highest power for 1 second
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if c.lastStatus != nil {
|
if c.lastStatus != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user