Thu, 06 Apr 2023 20:53:06 +0200
Set the new measured deep sleep current consumption. This is half of the Wemos D1 system.
1
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | # frozen_string_literal: true |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | require "yaml" |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | class PersonList |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | # path to `persons.yml` |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | def initialize(arg) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | @path = File.expand_path(arg) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | end |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | attr_reader :path |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | def load_file |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | File.read(path) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | end |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | def parse |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | YAML.safe_load(load_file) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | end |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | def metadata |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | return @metadata if @metadata |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | @metadata = parse |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | end |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | def all |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | metadata |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | end |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | def lookup(name) |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | metadata.select { |g| g["name"] == name } |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | end |
1c9894662795
Added esp-idf-lib for a lot of sensors. Added the basic design for the BMP280 task.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | end |