Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

2023.3.3 #54

Merged
merged 7 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# Changelog

## 2023.3.3

fixed: force_screen skips imediatly to the selected screen
added: hold_time configurable

## 2023.3.2

added: hold_screen for 20 additional seconds

## 2023.3.1

added: del_screen with wildcards
changed: maximum icons to 80
fixed: skip_next
fixed: show_all_icons on boot

## 2023.3.0

Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ _Configuration variables:_

**duration** (Optional, minutes): lifetime of a screen in minutes (default=5). If not updates a screen will be removed after ```duration``` minutes

**hold_time** (Optional, seconds): extends the display time of the current screen in seconds (default=20)

**date_format** (Optional, string): formats the date display with [strftime syntax](https://esphome.io/components/time.html?highlight=strftime), defaults `"%d.%m."` (use `"%m.%d."` for the US)

**time_format** (Optional, string): formats the date display with [strftime syntax](https://esphome.io/components/time.html?highlight=strftime), defaults `"%H:%M"` (use `"%I:%M%p"` for the US)
Expand Down Expand Up @@ -584,7 +586,7 @@ switch:
id(rgb8x32)->set_display_off();
```

Service **skip**
Service **skip_screen**

If there is more than one screen in the queue, skip to the next screen.

Expand All @@ -601,6 +603,24 @@ binary_sensor:
id(rgb8x32)->skip_screen();
```

Service **hold_screen**

displays the current screen for configured ammount (see **hold_time**) (default=20) seconds longer.

e.g. on the Ulanzi TC001

```
binary_sensor:
- platform: gpio
pin:
number: $right_button_pin
inverted: true
on_press:
lambda:
id(rgb8x32)->hold_screen();
```


Service **status**

This service displays the running queue and a list of icons in the logs
Expand Down
14 changes: 13 additions & 1 deletion components/ehmtx/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace esphome
this->gauge_value = 0;
this->icon_count = 0;
this->last_clock_time = 0;
this->show_icons = false;

#ifdef USE_EHMTX_SELECT
this->select = NULL;
Expand Down Expand Up @@ -257,6 +258,12 @@ namespace esphome
this->store->move_next();
}

void EHMTX::hold_screen()
{
this->next_action_time+=this->hold_time;
this->store->hold_current(this->hold_time);
}

void EHMTX::get_status()
{
time_t ts = this->clock->now().timestamp;
Expand Down Expand Up @@ -424,7 +431,12 @@ namespace esphome
this->clock_time = t;
}

void EHMTX::set_clock_interval(uint16_t t)
void EHMTX::set_hold_time(uint16_t t)
{
this->hold_time = t;
}

void EHMTX::set_clock_interval(uint16_t t)
{
this->clock_interval = t;
}
Expand Down
7 changes: 6 additions & 1 deletion components/ehmtx/EHMTX.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const uint8_t TEXTSCROLLSTART = 8;
const uint8_t TEXTSTARTOFFSET = (32 - 8);

const uint16_t TICKINTERVAL = 1000; // each 1000ms
static const char *const EHMTX_VERSION = "Version: 2023.3.1";
static const char *const EHMTX_VERSION = "Version: 2023.3.3";
static const char *const TAG = "EHMTX";

namespace esphome
Expand Down Expand Up @@ -66,6 +66,7 @@ namespace esphome
uint16_t scroll_intervall; // ms to between scrollsteps
uint16_t anim_intervall; // ms to next_frame()
uint16_t clock_time; // seconds display of screen_time - clock_time = date_time
uint16_t hold_time; // seconds display of screen_time to extend
uint16_t clock_interval; // seconds display of screen_time - clock_time = date_time
uint16_t screen_time; // seconds display of screen
uint8_t icon_count; // max iconnumber -1
Expand All @@ -79,10 +80,12 @@ namespace esphome
void draw();
void get_status();
void skip_screen();
void hold_screen();
std::string get_current();
void set_display(addressable_light::AddressableLightDisplay *disp);
void set_screen_time(uint16_t t);
void set_clock_time(uint16_t t);
void set_hold_time(uint16_t t);
void set_clock_interval(uint16_t t);
void set_show_day_of_week(bool b);
void set_show_date(bool b);
Expand Down Expand Up @@ -135,6 +138,7 @@ namespace esphome
EHMTX_screen *find_free_screen(uint8_t icon);
void delete_screen(uint8_t icon);
bool move_next();
void hold_current(uint _sec);
EHMTX_screen *current();
void log_status();
};
Expand Down Expand Up @@ -165,6 +169,7 @@ namespace esphome
bool update_slot(uint8_t _icon);
void update_screen();
bool del_slot(uint8_t _icon);
void hold_slot(uint8_t _sec);
void set_text(std::string text, uint8_t icon, uint8_t pixel, uint16_t et);
};

Expand Down
6 changes: 6 additions & 0 deletions components/ehmtx/EHMTX_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ namespace esphome
this->update_screen();
}

void EHMTX_screen::hold_slot(uint8_t _sec)
{
this->endtime += _sec;
ESP_LOGD(TAG, "hold for %d secs", _sec);
}

void EHMTX_screen::set_text(std::string text, uint8_t icon, uint8_t pixel, uint16_t et)
{
this->text = text;
Expand Down
6 changes: 6 additions & 0 deletions components/ehmtx/EHMTX_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace esphome
if (icon_id < MAXICONS)
{
this->force_screen = icon_id;
this->move_next();
}
}

Expand Down Expand Up @@ -115,6 +116,11 @@ namespace esphome
return this->slots[this->active_slot];
}

void EHMTX_store::hold_current(uint _sec)
{
this->slots[this->active_slot]->hold_slot(_sec);
}

uint8_t EHMTX_store::count_active_screens()
{
uint8_t count = 0;
Expand Down
5 changes: 5 additions & 0 deletions components/ehmtx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def rgb565_svg(x,y,r,g,b):
CONF_ICONS = "icons"
CONF_SHOWDOW = "dayofweek"
CONF_SHOWDATE = "show_date"
CONF_HOLD_TIME = "hold_time"
CONF_DISPLAY = "display8x32"
CONF_HTML = "html"
CONF_SCROLLINTERVALL = "scroll_intervall"
Expand Down Expand Up @@ -107,6 +108,9 @@ def rgb565_svg(x,y,r,g,b):
cv.Optional(
CONF_XOFFSET, default="1"
): cv.templatable(cv.int_range(min=-32, max=32)),
cv.Optional(
CONF_HOLD_TIME, default="2"
): cv.templatable(cv.int_range(min=0, max=3600)),
cv.Optional(CONF_SCROLLINTERVALL, default="80"
): cv.templatable(cv.positive_int),
cv.Optional(
Expand Down Expand Up @@ -563,6 +567,7 @@ async def to_code(config):
cg.add(var.set_time_format(config[CONF_TIME_FORMAT]))
cg.add(var.set_date_format(config[CONF_DATE_FORMAT]))
cg.add(var.set_show_day_of_week(config[CONF_SHOWDOW]))
cg.add(var.set_hold_time(config[CONF_HOLD_TIME]))
cg.add(var.set_show_date(config[CONF_SHOWDATE]))
cg.add(var.set_font_offset(config[CONF_XOFFSET], config[CONF_YOFFSET]))

Expand Down