mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 19:38:30 +02: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,9 +1,9 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import pins
|
||||
from esphome.components import light, power_supply
|
||||
from esphome.components import light
|
||||
from esphome.const import CONF_CLOCK_PIN, CONF_DATA_PIN, CONF_METHOD, CONF_NUM_LEDS, CONF_PIN, \
|
||||
CONF_POWER_SUPPLY, CONF_TYPE, CONF_VARIANT, CONF_OUTPUT_ID
|
||||
CONF_TYPE, CONF_VARIANT, CONF_OUTPUT_ID
|
||||
from esphome.core import CORE
|
||||
|
||||
neopixelbus_ns = cg.esphome_ns.namespace('neopixelbus')
|
||||
@@ -138,8 +138,6 @@ CONFIG_SCHEMA = cv.All(light.ADDRESSABLE_LIGHT_SCHEMA.extend({
|
||||
cv.Optional(CONF_DATA_PIN): pins.output_pin,
|
||||
|
||||
cv.Required(CONF_NUM_LEDS): cv.positive_not_null_int,
|
||||
|
||||
cv.Optional(CONF_POWER_SUPPLY): cv.use_id(power_supply.PowerSupply),
|
||||
}).extend(cv.COMPONENT_SCHEMA), validate, validate_method_pin)
|
||||
|
||||
|
||||
@@ -162,8 +160,4 @@ def to_code(config):
|
||||
|
||||
cg.add(var.set_pixel_order(getattr(ESPNeoPixelOrder, config[CONF_TYPE])))
|
||||
|
||||
if CONF_POWER_SUPPLY in config:
|
||||
var_ = yield cg.get_variable(config[CONF_POWER_SUPPLY])
|
||||
cg.add(var.set_power_supply(var_))
|
||||
|
||||
cg.add_library('NeoPixelBus', '2.4.1')
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
#error The NeoPixelBus library requires at least arduino_core_version 2.4.x
|
||||
#endif
|
||||
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
#include "esphome/components/power_supply/power_supply.h"
|
||||
#endif
|
||||
|
||||
#include "NeoPixelBus.h"
|
||||
|
||||
namespace esphome {
|
||||
@@ -54,10 +50,6 @@ enum class ESPNeoPixelOrder {
|
||||
template<typename T_METHOD, typename T_COLOR_FEATURE>
|
||||
class NeoPixelBusLightOutputBase : public Component, public light::AddressableLight {
|
||||
public:
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
void set_power_supply(power_supply::PowerSupply *power_supply) { this->power_supply_ = power_supply; }
|
||||
#endif
|
||||
|
||||
NeoPixelBus<T_COLOR_FEATURE, T_METHOD> *get_controller() const { return this->controller_; }
|
||||
|
||||
void clear_effect_data() override {
|
||||
@@ -95,27 +87,6 @@ class NeoPixelBusLightOutputBase : public Component, public light::AddressableLi
|
||||
this->mark_shown_();
|
||||
this->controller_->Dirty();
|
||||
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
if (this->power_supply_ != nullptr) {
|
||||
bool is_light_on = false;
|
||||
for (int i = 0; i < this->size(); i++) {
|
||||
if ((*this)[i].get().is_on()) {
|
||||
is_light_on = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_light_on && !this->has_requested_high_power_) {
|
||||
this->power_supply_->request_high_power();
|
||||
this->has_requested_high_power_ = true;
|
||||
}
|
||||
if (!is_light_on && this->has_requested_high_power_) {
|
||||
this->power_supply_->unrequest_high_power();
|
||||
this->has_requested_high_power_ = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
this->controller_->Show();
|
||||
}
|
||||
|
||||
@@ -135,10 +106,6 @@ class NeoPixelBusLightOutputBase : public Component, public light::AddressableLi
|
||||
NeoPixelBus<T_COLOR_FEATURE, T_METHOD> *controller_{nullptr};
|
||||
uint8_t *effect_data_{nullptr};
|
||||
uint8_t rgb_offsets_[4]{0, 1, 2, 3};
|
||||
#ifdef USE_POWER_SUPPLY
|
||||
power_supply::PowerSupply *power_supply_{nullptr};
|
||||
bool has_requested_high_power_{false};
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename T_METHOD, typename T_COLOR_FEATURE = NeoRgbFeature>
|
||||
|
||||
Reference in New Issue
Block a user