feat: For steppir & Ultrabeam,possibility to change each element length
This commit is contained in:
@@ -10752,6 +10752,9 @@ type motorAntenna interface {
|
||||
// frequency and has no individual-element command).
|
||||
Elements() []int
|
||||
SetElement(num, lengthMm int) error
|
||||
// ReadElements queries the controller for the current element lengths on demand
|
||||
// (Ultrabeam CMD_READ_BANDS); SteppIR returns an error.
|
||||
ReadElements() ([]int, error)
|
||||
}
|
||||
|
||||
// ubAdapter / steppirAdapter wrap each concrete client to the shared interface,
|
||||
@@ -10765,7 +10768,8 @@ func (a ubAdapter) SetFrequency(k, d int) error { return a.c.SetFrequency(k, d)
|
||||
func (a ubAdapter) SetDirection(d int) error { return a.c.SetDirection(d) }
|
||||
func (a ubAdapter) Retract() error { return a.c.Retract() }
|
||||
func (a ubAdapter) LastSetKHz() int { return a.c.LastSetKHz() }
|
||||
func (a ubAdapter) SetElement(n, mm int) error { return a.c.ModifyElement(n, mm) }
|
||||
func (a ubAdapter) SetElement(n, mm int) error { return a.c.ModifyElement(n, mm) }
|
||||
func (a ubAdapter) ReadElements() ([]int, error) { return a.c.ReadElements() }
|
||||
func (a ubAdapter) Elements() []int {
|
||||
if st, err := a.c.GetStatus(); err == nil && st != nil {
|
||||
return st.ElementLengths
|
||||
@@ -10792,6 +10796,9 @@ func (a steppirAdapter) Elements() []int { return nil } // SteppIR:
|
||||
func (a steppirAdapter) SetElement(_, _ int) error {
|
||||
return fmt.Errorf("individual element control is not available on the SteppIR")
|
||||
}
|
||||
func (a steppirAdapter) ReadElements() ([]int, error) {
|
||||
return nil, fmt.Errorf("individual element control is not available on the SteppIR")
|
||||
}
|
||||
func (a steppirAdapter) Status() motorStatus {
|
||||
st, err := a.c.GetStatus()
|
||||
if err != nil || st == nil {
|
||||
@@ -11119,6 +11126,15 @@ func (a *App) MotorSetElement(num, lengthMm int) error {
|
||||
return a.motorAnt.SetElement(num, lengthMm)
|
||||
}
|
||||
|
||||
// MotorReadElements queries the controller for the current element lengths (mm),
|
||||
// so the operator adjusts from the real values instead of blind. Ultrabeam only.
|
||||
func (a *App) MotorReadElements() ([]int, error) {
|
||||
if a.motorAnt == nil {
|
||||
return nil, fmt.Errorf("antenna not connected — enable it in Settings → Antenna")
|
||||
}
|
||||
return a.motorAnt.ReadElements()
|
||||
}
|
||||
|
||||
// SetUltrabeamDirection switches the antenna pattern: 0=normal, 1=180°,
|
||||
// 2=bidirectional (re-issues the current frequency with the new direction).
|
||||
func (a *App) SetUltrabeamDirection(direction int) error {
|
||||
|
||||
Reference in New Issue
Block a user