#include "./Power.h" #include "../Static.h" #include void Power::handleConfigChange(const InputEvent& event) { const JsonObject& cfg = *event.as(); if (cfg.containsKey("power.milliamps")) { m_milliamps = cfg["power.milliamps"]; } if (cfg.containsKey("power.volts")) { m_voltage = cfg["power.volts"]; } if (cfg.containsKey("power.useBPM")) { m_useBPM = cfg["power.useBPM"]; } if (m_voltage == 0 || m_milliamps == 0) { Log.notice("power: Impossible power config: %dma @ %dv", m_milliamps, m_voltage); m_valid = false; } else { Log.notice("power: Configured to use %dma @ %dv", m_milliamps, m_voltage); m_valid = true; FastLED.setMaxPowerInVoltsAndMilliamps(m_voltage, m_milliamps); } } STATIC_ALLOC(Power); STATIC_TASK(Power);