Skip to content

Commit

Permalink
"fixed" breaking changes of esphom 2023.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lubeda committed Jul 19, 2023
1 parent 9858933 commit 781198d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# EspHoMaTriX version 2 (EHMTXv2)

## Warning

Sorry but there this modules is highly dependend from the esphome releases. You can expect that some breaking changes in esphome breaks my code. So This version of EspHoMaTriX is working from esphome **2023.7.0** upwards (hopefully).

## Important information

If you like this project, please donate a star on GitHub and consider [sponsoring](https://www.paypal.com/donate/?hosted_button_id=FZDKSLQ46HJTU) me!
Expand Down
4 changes: 2 additions & 2 deletions components/ehmtxv2/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,12 @@ namespace esphome
ESP_LOGI(TAG, "queue: %d empty slots", empty);
}

void EHMTX::set_default_font(display::Font *font)
void EHMTX::set_default_font(display::BaseFont *font)
{
this->default_font = font;
}

void EHMTX::set_special_font(display::Font *font)
void EHMTX::set_special_font(display::BaseFont *font)
{
this->special_font = font;
}
Expand Down
13 changes: 7 additions & 6 deletions components/ehmtxv2/EHMTX.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define EHMTX_H
#include "esphome.h"
#include "esphome/components/time/real_time_clock.h"
#include "esphome/components/animation/animation.h"

const uint8_t MAXQUEUE = 24;
const uint8_t C_RED = 240; // default
Expand Down Expand Up @@ -92,8 +93,8 @@ namespace esphome
EHMTX_Icon *icons[MAXICONS];
uint8_t gauge_value;
#endif
display::Font *default_font;
display::Font *special_font;
display::BaseFont *default_font;
display::BaseFont *special_font;
int display_rindicator;
int display_lindicator;
int display_alarm;
Expand Down Expand Up @@ -147,8 +148,8 @@ namespace esphome
void set_display_on();
void set_display_off();
void set_clock(esphome::time::RealTimeClock *clock);
void set_default_font(display::Font *font);
void set_special_font(display::Font *font);
void set_default_font(display::BaseFont *font);
void set_special_font(display::BaseFont *font);
void show_rindicator(int r = C_RED, int g = C_GREEN, int b = C_BLUE, int s = 3);
void show_lindicator(int r = C_RED, int g = C_GREEN, int b = C_BLUE, int s = 3);
void set_clock_color(int r = C_RED, int g = C_GREEN, int b = C_BLUE);
Expand Down Expand Up @@ -263,13 +264,13 @@ namespace esphome
void process();
};

class EHMTX_Icon : public display::Animation
class EHMTX_Icon : public animation::Animation
{
protected:
bool counting_up;

public:
EHMTX_Icon(const uint8_t *data_start, int width, int height, uint32_t animation_frame_count, display::ImageType type, std::string icon_name, bool revers, uint16_t frame_duration);
EHMTX_Icon(const uint8_t *data_start, int width, int height, uint32_t animation_frame_count, esphome::image::ImageType type, std::string icon_name, bool revers, uint16_t frame_duration);
std::string name;
uint16_t frame_duration;
void next_frame();
Expand Down
4 changes: 2 additions & 2 deletions components/ehmtxv2/EHMTX_icons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace esphome
{

EHMTX_Icon::EHMTX_Icon(const uint8_t *data_start, int width, int height, uint32_t animation_frame_count, display::ImageType type, std::string icon_name, bool revers, uint16_t frame_duration)
: Animation(data_start, width, height, animation_frame_count, type)
EHMTX_Icon::EHMTX_Icon(const uint8_t *data_start, int width, int height, uint32_t animation_frame_count, esphome::image::ImageType type, std::string icon_name, bool revers, uint16_t frame_duration)
: animation::Animation(data_start, width, height, animation_frame_count, type)
{
this->name = icon_name;
this->reverse = revers;
Expand Down
2 changes: 1 addition & 1 deletion components/ehmtxv2/EHMTX_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace esphome

void EHMTX_queue::draw()
{
display::Font *font = this->default_font ? this->config_->default_font : this->config_->special_font;
display::BaseFont *font = this->default_font ? this->config_->default_font : this->config_->special_font;
int8_t yoffset = this->default_font ? EHMTXv2_DEFAULT_FONT_OFFSET_Y : EHMTXv2_SPECIAL_FONT_OFFSET_Y;
int8_t xoffset = this->default_font ? EHMTXv2_DEFAULT_FONT_OFFSET_X : EHMTXv2_SPECIAL_FONT_OFFSET_X;

Expand Down
1 change: 1 addition & 0 deletions components/ehmtxv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

logging.warning(f"")
logging.warning(f"Please check the documentation and wiki https://github.com/lubeda/EspHoMaTriXv2")
logging.warning(f"This will only work with esphome >= 2023.7.0")
logging.warning(f"")

def rgb565_svg(x,y,r,g,b):
Expand Down

0 comments on commit 781198d

Please sign in to comment.