esp-idf-lib/devtools/spec/person_list.rb

Wed, 12 Apr 2023 16:23:02 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 12 Apr 2023 16:23:02 +0200
changeset 24
74609f70411e
parent 1
1c9894662795
permissions
-rw-r--r--

Reduced I2C master speed from 400 to 100 Khz. Hope to get power-on init for BMP280 more reliable. Added warnings for I2C devices that are missing. Some logmessages reduced to debug log messages. Added extra 10 mSec delays before read shunt voltage in the INA219 task. Removed and reduced log levels in the MQTT task. Show received data events. Remove WiFi total time debug logging, it's ok now.

# frozen_string_literal: true

require "yaml"

class PersonList
  # path to `persons.yml`
  def initialize(arg)
    @path = File.expand_path(arg)
  end

  attr_reader :path

  def load_file
    File.read(path)
  end

  def parse
    YAML.safe_load(load_file)
  end

  def metadata
    return @metadata if @metadata

    @metadata = parse
  end

  def all
    metadata
  end

  def lookup(name)
    metadata.select { |g| g["name"] == name }
  end
end

mercurial