cycle_analyst_logger 0.3.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24b86d3ddae10152675800b27ac5f8bf912ea5ac
4
- data.tar.gz: 270d41a27b722386113154d05fc89c32740375c5
3
+ metadata.gz: 3e885a854ee604b2fcc3de0f076020ad88e30972
4
+ data.tar.gz: 938b370409f465698bbd7f2bde1706c4280b13b8
5
5
  SHA512:
6
- metadata.gz: 5401db314c8ef3b9721834c8a02005bd52041891e394c22fa8a328e52456e12ff2182a3ed836e8faf6f32b41cddac57298b6dc075e0cd9e8c6771d947de291ef
7
- data.tar.gz: b1504aef4be175e8a9226a2e0785aef2badbc6d4c15d06dd63b02c2284c2d954dac07816c6c577ffca3a0e14c727bc1cce79e7879700756b86e899eed5c9bd98
6
+ metadata.gz: ebbdd12998582bdce46f83954b3972efd2b94279d2e54386723cd75eb3e73d034b4a0a81ef59c75f775284d15242b09b7cc01678010c163811b280b4294e7eb9
7
+ data.tar.gz: d63f206c042bce110754866f846cd2b68b306741082bbcdca8eb06650a6ec8bc8ce983e069cc455fccfca97ab93f31c64b2eb9362c6e6c0389d09718460e72f7
data/.gitignore CHANGED
@@ -37,3 +37,4 @@ Gemfile.lock
37
37
 
38
38
  *.csv
39
39
  *.log
40
+ nmea.*.txt
data/Gemfile CHANGED
File without changes
File without changes
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -71,9 +71,12 @@ module CycleAnalystLogger
71
71
 
72
72
  desc 'Log the Cycle Analyst and optionally GPS and Phaserunner to a file'
73
73
  command :log do |log|
74
+ log.desc 'Disable writing raw nmea to its own file'
75
+ log.default_value false
76
+ log.switch [:disable_nmea_out]
74
77
  log.action do |global_options, options, args|
75
78
  cycle_analyst = CycleAnalyst.new(global_options)
76
- cycle_analyst.get_logs(loop_count, quiet)
79
+ cycle_analyst.get_logs(loop_count, quiet, options[:disable_nmea_out])
77
80
  end
78
81
  end
79
82
 
@@ -97,11 +97,20 @@ module CycleAnalystLogger
97
97
  # @param output_fd [File] File Descriptor of the output file to write to. Don't write to file if nil
98
98
  # @param loop_count [Integer, Symbol] Number of lines to output, or forever if :forever
99
99
  # @param quite [Boolean] Don't output to stdout if true
100
- def get_logs(loop_count, quiet)
101
- filename = "cycle_analyst.#{Time.now.strftime('%Y-%m-%d_%H-%M-%S')}.csv"
100
+ def get_logs(loop_count, quiet, disable_nmea_out)
101
+ timestamp = Time.now.strftime('%Y-%m-%d_%H-%M-%S')
102
+ filename = "cycle_analyst.#{timestamp}.csv"
102
103
  output_fd = File.open(filename, 'w')
103
104
 
104
- gps_thread = Thread.new { gps.run } if enable_gps
105
+ if enable_gps
106
+ unless disable_nmea_out
107
+ nmea_filename = "nmea.#{timestamp}.txt"
108
+ nmea_fd = File.open(nmea_filename, 'w')
109
+ else
110
+ nmea_fd = nil
111
+ end
112
+ gps_thread = Thread.new { gps.run(nmea_fd, disable_nmea_out) }
113
+ end
105
114
 
106
115
  line_number = 0
107
116
  hdr = %Q(Timestamp,#{log_header})
File without changes
@@ -41,10 +41,11 @@ module CycleAnalystLogger
41
41
  @source_decoder = NMEAPlus::SourceDecoder.new(@serial_io)
42
42
  end
43
43
 
44
- def run
44
+ def run(fd = nil, disable_nmea_out = false)
45
45
  source_decoder.each_complete_message do |message|
46
- case message.data_type
47
- when 'GNGGA'
46
+ fd.puts message.original.strip unless disable_nmea_out
47
+ case message.data_type[2..-1] # Ignore the first two letters
48
+ when 'GGA'
48
49
  pre_data[:time] = message.fix_time
49
50
  pre_data[:latitude] = message.latitude
50
51
  pre_data[:longitude] = message.longitude
@@ -55,7 +56,7 @@ module CycleAnalystLogger
55
56
  pre_data[:horizontal_dilution] = message.horizontal_dilution
56
57
  pre_data[:satellites] = message.satellites
57
58
  pre_data[:seconds_since_last_update] = message.seconds_since_last_update
58
- when 'GNVTG'
59
+ when 'VTG'
59
60
  pre_data[:speed_kmh] = message.speed_kmh
60
61
  pre_data[:speed_knots] = message.speed_knots
61
62
  pre_data[:faa_mode] = message.faa_mode
File without changes
@@ -1,3 +1,3 @@
1
1
  module CycleAnalystLogger
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
data/todo.txt CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cycle_analyst_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert J. Berger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-20 00:00:00.000000000 Z
11
+ date: 2018-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli