Skip to content

Commit

Permalink
update 2023.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
langerma committed Dec 27, 2023
1 parent a2301fd commit 650f00f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion components/obegraensad_panel/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
CONF_PAGES,
CONF_CONTRAST,
)
from esphome.const import __version__ as ESPHOME_VERSION

DEPENDENCIES = []

Expand Down Expand Up @@ -38,7 +39,8 @@
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])

await cg.register_component(var, config)
if cv.Version.parse(ESPHOME_VERSION) < cv.Version.parse("2023.12.0"):
await cg.register_component(var, config)
await display.register_display(var, config)

cg.add(var.set_pins(
Expand Down
11 changes: 8 additions & 3 deletions components/obegraensad_panel/obegraensad-panel.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "esphome/core/defines.h"
#include "esphome/core/version.h"
#include "esphome/core/component.h"
#include "esphome/components/display/display_buffer.h"

Expand All @@ -9,8 +11,11 @@
namespace esphome {
namespace obegraensadpanel {

class Panel : public PollingComponent,
public display::DisplayBuffer {
#if ESPHOME_VERSION_CODE >= VERSION_CODE(2023, 12, 0)
class Panel : public display::DisplayBuffer {
#else
class Panel : public PollingComponent, public display::DisplayBuffer {
#endif // VERSION_CODE(2023, 12, 0)
public:
int p_latch;
int p_clock;
Expand All @@ -23,7 +28,7 @@ class Panel : public PollingComponent,
}

float get_setup_priority() const override { return setup_priority::PROCESSOR; }

display::DisplayType get_display_type() override { return display::DisplayType::DISPLAY_TYPE_BINARY; }

void data(uint8_t value);
Expand Down

0 comments on commit 650f00f

Please sign in to comment.