This commit is contained in:
2026-01-12 22:34:14 +01:00
parent 6b5508802a
commit 4f484b0091
3 changed files with 20 additions and 8 deletions

View File

@@ -335,7 +335,11 @@ func (c *Client) handleStatus(msg string) {
// Format: S0|interlock ... state=PTT_REQUESTED ...
if strings.Contains(msg, "interlock") {
if state, ok := statusMap["state"]; ok {
log.Printf("FlexRadio: Interlock state changed to: %s", state)
// Update status for UI
c.statusMu.Lock()
c.lastStatus.InterlockState = state
c.statusMu.Unlock()
if state == "PTT_REQUESTED" {
// PTT requested - we MUST respond within 500ms!
@@ -384,14 +388,13 @@ func (c *Client) createInterlock() error {
// handlePTTRequest is called when FlexRadio sends PTT_REQUESTED
// We MUST respond within 500ms with ready or not_ready
func (c *Client) handlePTTRequest() {
log.Println("FlexRadio: 🔴 PTT REQUESTED - checking if transmit allowed...")
c.interlockMu.RLock()
interlockID := c.interlockID
c.interlockMu.RUnlock()
if interlockID == "" {
log.Println("FlexRadio: ⚠️ No interlock ID, cannot respond to PTT request!")
log.Println("FlexRadio: No interlock ID, cannot respond to PTT request!")
return
}
@@ -402,12 +405,21 @@ func (c *Client) handlePTTRequest() {
}
if allowed {
log.Println("FlexRadio: ✅ Transmit ALLOWED - sending 'ready'")
cmd := fmt.Sprintf("interlock ready %s", interlockID)
c.sendCommand(cmd)
// Update status immediately for UI
c.statusMu.Lock()
c.lastStatus.InterlockState = InterlockStateReady
c.statusMu.Unlock()
} else {
log.Println("FlexRadio: Transmit BLOCKED - sending 'not_ready'")
log.Println("FlexRadio: Transmit BLOCKED - sending 'not_ready'")
cmd := fmt.Sprintf("interlock not_ready %s", interlockID)
c.sendCommand(cmd)
// Update status immediately for UI
c.statusMu.Lock()
c.lastStatus.InterlockState = InterlockStateNotReady
c.statusMu.Unlock()
}
}