mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 06:33:51 +00:00
Updates for 1.13 (#546)
* Update CI matcher * Check Executable bit * Quicklint * Updates * Allow pm1.0 and pm10.0 for PMS5003ST Fixes https://github.com/esphome/feature-requests/issues/225 * PowerSupplyRequester * Lint * Include debug data in generated main.cpp * Updates * Auto-select bit_depth * Updates
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import light, power_supply
|
||||
from esphome.const import CONF_OUTPUT_ID, CONF_NUM_LEDS, CONF_RGB_ORDER, CONF_MAX_REFRESH_RATE, \
|
||||
CONF_POWER_SUPPLY
|
||||
from esphome.components import light
|
||||
from esphome.const import CONF_OUTPUT_ID, CONF_NUM_LEDS, CONF_RGB_ORDER, CONF_MAX_REFRESH_RATE
|
||||
from esphome.core import coroutine
|
||||
|
||||
fastled_base_ns = cg.esphome_ns.namespace('fastled_base')
|
||||
@@ -24,8 +23,6 @@ BASE_SCHEMA = light.ADDRESSABLE_LIGHT_SCHEMA.extend({
|
||||
cv.Required(CONF_NUM_LEDS): cv.positive_not_null_int,
|
||||
cv.Optional(CONF_RGB_ORDER): cv.one_of(*RGB_ORDERS, upper=True),
|
||||
cv.Optional(CONF_MAX_REFRESH_RATE): cv.positive_time_period_microseconds,
|
||||
|
||||
cv.Optional(CONF_POWER_SUPPLY): cv.use_id(power_supply.PowerSupply),
|
||||
}).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
||||
@@ -37,10 +34,6 @@ def new_fastled_light(config):
|
||||
if CONF_MAX_REFRESH_RATE in config:
|
||||
cg.add(var.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE]))
|
||||
|
||||
if CONF_POWER_SUPPLY in config:
|
||||
var_ = yield cg.get_variable(config[CONF_POWER_SUPPLY])
|
||||
cg.add(var.set_power_supply(var_))
|
||||
|
||||
yield light.register_light(var, config)
|
||||
cg.add_library('FastLED', '3.2.0')
|
||||
yield var
|
||||
|
||||
@@ -33,27 +33,6 @@ void FastLEDLightOutput::loop() {
|
||||
this->mark_shown_();
|
||||
|
||||
ESP_LOGVV(TAG, "Writing RGB values to bus...");
|
||||
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
if (this->power_supply_ != nullptr) {
|
||||
bool is_on = false;
|
||||
for (int i = 0; i < this->num_leds_; i++) {
|
||||
if (bool(this->leds_[i])) {
|
||||
is_on = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_on && !this->has_requested_high_power_) {
|
||||
this->power_supply_->request_high_power();
|
||||
this->has_requested_high_power_ = true;
|
||||
}
|
||||
if (!is_on && this->has_requested_high_power_) {
|
||||
this->power_supply_->unrequest_high_power();
|
||||
this->has_requested_high_power_ = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
this->controller_->showLeds();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/components/light/addressable_light.h"
|
||||
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
#include "esphome/components/power_supply/power_supply.h"
|
||||
#endif
|
||||
|
||||
#define FASTLED_ESP8266_RAW_PIN_ORDER
|
||||
#define FASTLED_ESP32_RAW_PIN_ORDER
|
||||
#define FASTLED_RMT_BUILTIN_DRIVER true
|
||||
@@ -30,10 +26,6 @@ class FastLEDLightOutput : public Component, public light::AddressableLight {
|
||||
/// Set a maximum refresh rate in µs as some lights do not like being updated too often.
|
||||
void set_max_refresh_rate(uint32_t interval_us) { this->max_refresh_rate_ = interval_us; }
|
||||
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
void set_power_supply(power_supply::PowerSupply *power_supply) { this->power_supply_ = power_supply; }
|
||||
#endif
|
||||
|
||||
/// Add some LEDS, can only be called once.
|
||||
CLEDController &add_leds(CLEDController *controller, int num_leds) {
|
||||
this->controller_ = controller;
|
||||
@@ -242,10 +234,6 @@ class FastLEDLightOutput : public Component, public light::AddressableLight {
|
||||
int num_leds_{0};
|
||||
uint32_t last_refresh_{0};
|
||||
optional<uint32_t> max_refresh_rate_{};
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
power_supply::PowerSupply *power_supply_{nullptr};
|
||||
bool has_requested_high_power_{false};
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace fastled_base
|
||||
|
||||
Reference in New Issue
Block a user