timex_datalink_client 0.4.0 → 0.4.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
  SHA256:
3
- metadata.gz: 499c12fec3a8fae40770efc4173421e0a996b999a98a19a7e9ec64295628d757
4
- data.tar.gz: 29b1bec826b2d5a2c25f7d7c9e47405760a2c08526e04f7f84084587dfec44c5
3
+ metadata.gz: '082ddc8969ac82b8858b2f68fd9c8f34b7f53b46eccc407200615eba75b00821'
4
+ data.tar.gz: 99ae5a09d43fe26bf849808be2bceb18350d1c97e8fce962ee2a367a07a12677
5
5
  SHA512:
6
- metadata.gz: 1278164bd72754ee49ad9d26b7cf3a953de3f164e6bb19a42a30a34528ed012b6d967f605aeb244b6554ca29541312edec4b4d2730c1fadfa38b9946d862e76e
7
- data.tar.gz: ad536dfbf0e894b5474be3fc36c4c8b0387cdc47e7134c58c98e7c6978ac004a78b20c4f54059e63d8cc3accda0e7b2f60199920be8bdbe128d98afa62798727
6
+ metadata.gz: 13adc215949a1c2af60c9d65da0e5ad8b780e27bf4f1009cc29ff85f7ffab3f9b912ae7f8cab1b785c14de28ece73036335eff2f7f85b78da9e2ca0e16e63eaa
7
+ data.tar.gz: 43a8a73d8e9194295e83f7794e4b0c86d90b0b04b236b1f8b6779a267d33a6cc3af2de9b45efbab5112fa1dd26a4858a7a3c6755f49c6636e90782d5a49e6ce8
@@ -4,22 +4,23 @@ class TimexDatalinkClient
4
4
  class Helpers
5
5
  module CharEncoders
6
6
  CHARS = "0123456789abcdefghijklmnopqrstuvwxyz !\"#$%&'()*+,-./:\\;=@?_|<>[]"
7
+ EEPROM_CHARS = "0123456789abcdefghijklmnopqrstuvwxyz !\"#$%&'()*+,-./:\\;=@?_|<>["
8
+ PHONE_CHARS = "0123456789cfhpw "
9
+ INVALID_CHAR = " "
7
10
 
8
11
  EEPROM_TERMINATOR = 0x3f
9
12
 
10
- PHONE_CHARS = "0123456789cfhpw "
11
-
12
13
  def chars_for(string_chars, char_map: CHARS, length: nil, pad: false)
13
14
  formatted_chars = string_chars.downcase[0..length.to_i - 1]
14
15
  formatted_chars = formatted_chars.ljust(length) if pad
15
16
 
16
17
  formatted_chars.each_char.map do |char|
17
- char_map.index(char)
18
+ char_map.index(char) || char_map.index(INVALID_CHAR)
18
19
  end
19
20
  end
20
21
 
21
22
  def eeprom_chars_for(string_chars)
22
- chars = chars_for(string_chars, length: 31).append(EEPROM_TERMINATOR)
23
+ chars = chars_for(string_chars, char_map: EEPROM_CHARS, length: 31).append(EEPROM_TERMINATOR)
23
24
 
24
25
  packed_int = chars.each_with_index.sum do |char, index|
25
26
  char << (6 * index)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TimexDatalinkClient
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timex_datalink_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxwell Pray
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-09 00:00:00.000000000 Z
11
+ date: 2022-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crc
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.0.9
83
- description: Write data to Timex Datalink watches with an optical sensor
83
+ description:
84
84
  email: synthead@gmail.com
85
85
  executables: []
86
86
  extensions: []
@@ -106,7 +106,7 @@ files:
106
106
  - lib/timex_datalink_client/time.rb
107
107
  - lib/timex_datalink_client/version.rb
108
108
  - lib/timex_datalink_client/wrist_app.rb
109
- homepage: https://github.com/synthead/timex_datalink_client
109
+ homepage: https://github.com/synthead/timex_datalink_client/tree/v0.4.1
110
110
  licenses:
111
111
  - MIT
112
112
  metadata: {}
@@ -128,5 +128,5 @@ requirements: []
128
128
  rubygems_version: 3.3.7
129
129
  signing_key:
130
130
  specification_version: 4
131
- summary: Library for optical Timex Datalink watches
131
+ summary: Write data to Timex Datalink devices with an optical sensor
132
132
  test_files: []