Skip to content

Commit

Permalink
2024.6.1: Add **flip_flop_speed** (optional, int): Set flip_flop_cloc…
Browse files Browse the repository at this point in the history
…k speed. (default: 2, range 1..10).
  • Loading branch information
andrewjswan committed Jun 6, 2024
1 parent 2e77138 commit c150e21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,8 @@ ehmtxv2:

**flip_flop_clock** (optional, boolean): Enables or disables flip_flop_clock clock mode. (default: false), works only in **advanced_clock** mode.

**flip_flop_speed** (optional, int): Set flip_flop_clock speed. (default: 2, range 1..10), works only in **advanced_clock** mode.

**advanced_bitmap** (optional, boolean): Enables or disables advanced bitmap mode. (default: false) [More info](#advanced-bitmap-mode)

**default_font_yoffset** (optional, pixel): yoffset the text is aligned BASELINE_LEFT, the baseline defaults to `6`
Expand Down
4 changes: 2 additions & 2 deletions components/ehmtxv2/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2608,7 +2608,7 @@ namespace esphome

#ifdef EHMTXv2_FLIP_FLOP
bool step = false;
uint8_t y = ystep / 2;
uint8_t y = ystep / EHMTXv2_FLIP_FLOP_SPEED;

if (i == 0) // Hours
{
Expand Down Expand Up @@ -2708,7 +2708,7 @@ namespace esphome
if (step)
{
ystep++;
if (ystep == 16)
if (ystep == 8 * EHMTXv2_FLIP_FLOP_SPEED)
{
hours = h;
minutes = m;
Expand Down
7 changes: 7 additions & 0 deletions components/ehmtxv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def rgb565_888(v565):
CONF_VERTICAL = "vertical_scroll"
CONF_CLOCK = "advanced_clock"
CONF_FLIP_FLOP = "flip_flop_clock"
CONF_FLIP_FLOP_SPEED = "flip_flop_speed"
CONF_BITMAP = "advanced_bitmap"
CONF_BOOTLOGO = "boot_logo"
CONF_BOOTLOGOMODE = "boot_logo_mode"
Expand Down Expand Up @@ -173,6 +174,9 @@ def rgb565_888(v565):
cv.Optional(
CONF_FLIP_FLOP, default=False
): cv.boolean,
cv.Optional(
CONF_FLIP_FLOP_SPEED, default="2"
): cv.templatable(cv.int_range(min=1, max=10)),
cv.Optional(
CONF_BITMAP, default=False
): cv.boolean,
Expand Down Expand Up @@ -616,6 +620,9 @@ def thumbnails(frames):
if config[CONF_CLOCK] and config[CONF_FLIP_FLOP]:
cg.add_define("EHMTXv2_FLIP_FLOP")
logging.info(f"[X] Flip Flop clock mode")
if config[CONF_FLIP_FLOP_SPEED]:
cg.add_define("EHMTXv2_FLIP_FLOP_SPEED", config[CONF_FLIP_FLOP_SPEED])
logging.info(f"[X] Flip Flop Speed " + str(config[CONF_FLIP_FLOP_SPEED]))

if config[CONF_BITMAP]:
cg.add_define("EHMTXv2_ADV_BITMAP")
Expand Down

0 comments on commit c150e21

Please sign in to comment.