Skip to content

Commit

Permalink
Merge pull request #46 from landonr/remove_register_component
Browse files Browse the repository at this point in the history
Fix compilation for esphome >= 2023.12.0
  • Loading branch information
landonr authored Dec 10, 2023
2 parents b176f38 + 1513eb4 commit 83f82c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/tdisplays3/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ async def to_code(config):
cg.add_library("TFT_eSPI", None)

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_dimensions(config[CONF_WIDTH], config[CONF_HEIGHT]));

Expand Down
5 changes: 5 additions & 0 deletions components/tdisplays3/t_display_s3.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "esphome/core/defines.h"
#include "esphome/core/version.h"
#include "TFT_eSPI.h"

#include "esphome/components/display/display_buffer.h"
Expand All @@ -9,7 +10,11 @@
namespace esphome {
namespace tdisplays3 {

#if ESPHOME_VERSION_CODE >= VERSION_CODE(2023, 12, 0)
class TDisplayS3 : public display::DisplayBuffer {
#else
class TDisplayS3 : public PollingComponent, public display::DisplayBuffer {
#endif // VERSION_CODE(2023, 12, 0)
public:
void dump_config() override;
void setup() override;
Expand Down

0 comments on commit 83f82c6

Please sign in to comment.