File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -289,6 +289,24 @@ func (c *Conn) SetFrequency(ctx context.Context, frequency Frequency) error {
289289 Band Switch
290290*/
291291
292+ var rigBand = map [bandplan.BandName ]string {
293+ bandplan .Band160m : "0" ,
294+ bandplan .Band80m : "1" ,
295+ bandplan .Band60m : "2" ,
296+ bandplan .Band40m : "3" ,
297+ bandplan .Band30m : "4" ,
298+ bandplan .Band20m : "5" ,
299+ bandplan .Band17m : "6" ,
300+ bandplan .Band15m : "7" ,
301+ bandplan .Band12m : "8" ,
302+ bandplan .Band10m : "9" ,
303+ }
304+
305+ // BandSelect switches to the given band on the connected radio and the currently selected VFO.
306+ func (c * Conn ) BandSelect (ctx context.Context , band bandplan.BandName ) error {
307+ return c .Set (ctx , "set_level" , "BAND_SELECT" , rigBand [band ])
308+ }
309+
292310// BandUp switches to the next band upwards on the connected radio and the currently selected VFO.
293311func (c * Conn ) BandUp (ctx context.Context ) error {
294312 return c .Set (ctx , "vfo_op" , "BAND_UP" )
@@ -309,6 +327,12 @@ func (c *Conn) SwitchToBand(ctx context.Context, band bandplan.Band) error {
309327 return nil
310328 }
311329
330+ err = c .BandSelect (ctx , band .Name )
331+ if err == nil {
332+ return nil
333+ }
334+ log .Printf ("hamlib: cannot switch to band with BAND_SELECT, using BAND_UP/BAND_DOWN instead: %v" , err )
335+
312336 var direction int
313337 if currentFrequency > band .FrequencyRange .To {
314338 direction = - 1
You can’t perform that action at this time.
0 commit comments