working tx inhibit

This commit is contained in:
2026-01-12 22:07:54 +01:00
parent 2bec98a080
commit 51e08d9463
2 changed files with 132 additions and 4 deletions

View File

@@ -126,6 +126,26 @@ func (dm *DeviceManager) Initialize() error {
dm.flexRadio.SetFrequencyChangeCallback(func(freqMHz float64) {
dm.handleFrequencyChange(freqMHz)
})
// Set callback to check if transmit is allowed (based on Ultrabeam motors)
dm.flexRadio.SetTransmitCheckCallback(func() bool {
// Get current Ultrabeam status
ubStatus, err := dm.ultrabeam.GetStatus()
if err != nil || ubStatus == nil {
// If we cannot get status, allow transmit (fail-safe)
return true
}
// Block transmit if motors are moving
motorsMoving := ubStatus.MotorsMoving != 0
if motorsMoving {
log.Printf("FlexRadio PTT check: Motors moving (bitmask=%d) - BLOCKING", ubStatus.MotorsMoving)
} else {
log.Printf("FlexRadio PTT check: Motors stopped - ALLOWING")
}
return !motorsMoving
})
}
// Initialize Solar data client