fldigi 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/fldigi.rb +30 -12
  2. metadata +1 -1
@@ -27,6 +27,10 @@
27
27
  #
28
28
  # Version History:
29
29
  #
30
+ # 0.0.14 - 06/28/2014 - jfrancis - Be more consistent about to_f vs.
31
+ # to_i. Also, add a function to return actual radio freq (instead of
32
+ # specified freq).
33
+ #
30
34
  # 0.0.13 - 06/11/2014 - jfrancis - A bunch of clean-up here. I almost
31
35
  # certainly broke some code with this one. I changed @freq to
32
36
  # @dial_freq to more accurately reflect what's going on, and added a
@@ -264,14 +268,14 @@ class Fldigi
264
268
  # all-purpose solution to this one, but at least it allows for
265
269
  # consistent and automated use of the library without having to do
266
270
  # the conversions in your own code.
267
- @dial_freq=@dial_freq.to_f
271
+ @dial_freq=@dial_freq.to_i
268
272
  if (@dial_freq!=@dial_freq_old or @offset!=@offset_old) and @rigctl
269
273
  @dial_freq_old=@dial_freq
270
274
  @offset_old=@offset
271
- if @dial_freq+@offset.to_f!=self.sendcmd("main.get_frequency")
272
- self.sendcmd("main.set_frequency", @dial_freq+@offset.to_f)
275
+ if @dial_freq+@offset.to_i!=self.sendcmd("main.get_frequency").to_i
276
+ self.sendcmd("main.set_frequency", @dial_freq+@offset.to_i)
273
277
  sleep 0.5
274
- if @dial_freq+@offset.to_f!=self.sendcmd("main.get_frequency")
278
+ if @dial_freq+@offset.to_i!=self.sendcmd("main.get_frequency").to_i
275
279
  return false
276
280
  end
277
281
  end
@@ -311,14 +315,22 @@ class Fldigi
311
315
  end
312
316
  end
313
317
 
314
- # Get/set the actual transmit frequency (dial frequency plus
315
- # carrier). If you don't supply a parameter, this method returns
316
- # the *actual* current transmit frequency (ie, it immediately reads
317
- # the actual carrier). If you do supply a parameter, it sets the
318
- # transmit frequency by subtracting the currently requested carrier
319
- # (ie, not the actual current carrier, but what you set @carrier to)
320
- # from the supplied frequency, then setting @dial_freq to that
321
- # value. For example, if @carrier was set to 1000 and you called
318
+ # Get/set the transmit frequency (dial frequency plus carrier). If
319
+ # you don't supply a parameter, this method returns the transmit
320
+ # frequency you most recently specified. IMPORTANT: The returned
321
+ # value may not be where the radio is currently tuned. This
322
+ # function returns what you *told* the radio to be, which could be
323
+ # different than what it's currently set to. It's entirely possible
324
+ # that the user turned the knob after you set the frequency. If you
325
+ # want to see what the radio is *actually* tuned to, use the
326
+ # radio_freq() method (below). This method does, however, go out
327
+ # and read the actual current carrier, as that tends to float around
328
+ # due to both the user clicking on the waterfall, and naturally due
329
+ # to AFC. If you do supply a parameter, it sets the transmit
330
+ # frequency by subtracting the currently requested carrier (ie, not
331
+ # the actual current carrier, but what you set @carrier to) from the
332
+ # supplied frequency, then setting @dial_freq to that value. For
333
+ # example, if @carrier was set to 1000 and you called
322
334
  # self.freq(14071000), @dial_freq would be set to 14070000. Note
323
335
  # that this only sets up all the values in the object, you still
324
336
  # have to "push" them to the radio with the self.config() method.
@@ -330,6 +342,12 @@ class Fldigi
330
342
  end
331
343
  end
332
344
 
345
+ # Read the real freq plus real carrier from the radio (contrast with
346
+ # freq() above).
347
+ def radio_freq
348
+ return (self.sendcmd("main.get_frequency").to_i+self.get_carrier()).to_i
349
+ end
350
+
333
351
  # Send the currently buffered data using the carrier, mode,
334
352
  # frequency, etc. currently configured. The current code will wait
335
353
  # up to @start_wait (10) seconds for the first character to be
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fldigi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: