mirror of
https://github.com/km4ack/patmenu2.git
synced 2025-05-16 06:40:10 -07:00
26 lines
534 B
Ruby
Executable File
26 lines
534 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
require 'gpsd_client'
|
|
require 'maidenhead'
|
|
require 'socket'
|
|
require 'json'
|
|
|
|
ft8call_port = 2237
|
|
|
|
gpsd = GpsdClient::Gpsd.new()
|
|
gpsd.start()
|
|
apicmd = {}
|
|
|
|
#print come info to the scree
|
|
#puts "Your location is being update"
|
|
|
|
# get maidenhead if gps is ready
|
|
if gpsd.started?
|
|
pos = gpsd.get_position
|
|
maid = Maidenhead.to_maidenhead(pos[:lat], pos[:lon], precision = 5)
|
|
# puts "lat = #{pos[:lat]}, lon = #{pos[:lon]}, grid = #{maid}"
|
|
puts "#{maid}"
|
|
apicmd = {:type => "STATION.SET_GRID", :value => maid}
|
|
end
|
|
|