Skip to content

Commit

Permalink
ensure symbols are valid in avro (#2)
Browse files Browse the repository at this point in the history
* ensure symbols are valid in avro

* symbols
  • Loading branch information
untzag authored Jul 5, 2022
1 parent d0e8742 commit 1244138
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 50 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: no-commit-to-branch
args: [-b, main]

- repo: https://github.com/psf/black
rev: 21.9b0
rev: 22.6.0
hooks:
- id: black
name: black
Expand All @@ -16,13 +16,13 @@ repos:
types: [python]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
rev: v0.961
hooks:
- id: mypy
exclude: ^docs/conf.py

- repo: https://gitlab.com/yaq/yaq-traits
rev: v2021.10.0
rev: v2022.3.0
hooks:
- id: yaq-traits-check
- id: yaq-traits-compose
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [Unreleased]

### Changed
- changed symbols to valid avro types

## [2021.10.0]

### Changed
Expand Down
4 changes: 2 additions & 2 deletions yaqd_ti/_ads1115.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ async def _measure(self):
data = self.bus.read_i2c_block_data(self.address, 0x00, 2)
v = data[0] << 8 | data[1]
if v > 128:
v = -(2 ** 16) + v
v = -(2**16) + v
v *= self.fsr
v /= 2 ** 16
v /= 2**16
v *= 2
out[key] = v
await asyncio.sleep(0.1)
Expand Down
46 changes: 23 additions & 23 deletions yaqd_ti/ads1115.avpr
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"channels": {
"name": "channels",
"symbols": [
"01",
"03",
"13",
"23",
"0",
"1",
"2",
"3"
"C01",
"C03",
"C13",
"C23",
"C0",
"C1",
"C2",
"C3"
],
"type": "enum"
},
Expand All @@ -23,11 +23,11 @@
"fsr": {
"name": "fsr",
"symbols": [
"6.144",
"4.096",
"2.048",
"1.024",
"0.512"
"V6_144",
"V4_096",
"V2_048",
"V1_024",
"V0_512"
],
"type": "enum"
},
Expand Down Expand Up @@ -92,14 +92,14 @@
"rate": {
"name": "rate",
"symbols": [
"8",
"16",
"32",
"64",
"128",
"250",
"475",
"860"
"R8",
"R16",
"R32",
"R64",
"R128",
"R250",
"R475",
"R860"
],
"type": "enum"
},
Expand Down Expand Up @@ -196,9 +196,9 @@
"response": {
"type": "map",
"values": [
"int",
"double",
"ndarray",
"int"
"ndarray"
]
}
},
Expand Down
42 changes: 21 additions & 21 deletions yaqd_ti/ads1115.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ conda-forge = "https://anaconda.org/conda-forge/yaqd-ti"
[config.channels]
type = "enum"
name = "channels"
symbols = ["01",
"03",
"13",
"23",
"0",
"1",
"2",
"3"
symbols = ["C01",
"C03",
"C13",
"C23",
"C0",
"C1",
"C2",
"C3"
]

[config.fsr]
type = "enum"
name = "fsr"
symbols = ["6.144",
"4.096",
"2.048",
"1.024",
"0.512"
symbols = ["V6_144",
"V4_096",
"V2_048",
"V1_024",
"V0_512"
]

[config.i2c_addr]
Expand All @@ -43,12 +43,12 @@ default = 72
[config.rate]
type = "enum"
name = "rate"
symbols = ["8",
"16",
"32",
"64",
"128",
"250",
"475",
"860"
symbols = ["R8",
"R16",
"R32",
"R64",
"R128",
"R250",
"R475",
"R860"
]

0 comments on commit 1244138

Please sign in to comment.