Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023.9.1: Added accent for days of week #151

Merged
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Added `bitmap_stack`screen. Screen that allows you to display from 1 to 64 icons described in the configuration.
- Added a screen with the ability to display a progress bar, text, progress value `(-100..100)`
- `text_screen_progress(text, value, progress, lifetime, screen_time, default_font, value_color_as_progress, r, g, b)`
- Added `set_weekday_accent_on` and `set_weekday_accent_off` Turn on / off small days (accent) of the week when brightness is insufficient.

### EspHoMaTriX 2023.9.0
- Added the ability to display graph as defined in the YAML file
Expand Down Expand Up @@ -747,6 +748,8 @@ Numerous features are accessible with services from home assistant and lambdas t
|`set_today_color`|"r", "g", "b"|set the special color for today in the day of week line|
|`set_weekday_color`|"r", "g", "b"|set the default color in the day of week line|
|`set_clock_color`|"r", "g", "b"|set the default color of clock and date display|
|`set_weekday_accent_on`|none|turns on the display of small days (accent) of the week when brightness is insufficient|
|`set_weekday_accent_off`|none|turns off the display of small days (accent) of the week when brightness is insufficient|
|`del_screen`|"icon_name", “mode”|deletes the specified icon screen from the queue, the [mode](#modes) is a filter|
|`force_screen`|"icon_name", “mode”|displays the selected the specified icon screen from the queue, the [mode](#modes) is a filter|
|`full_screen`|"icon_name", "lifetime", "screen_time"|show the specified 8x32 icon as full screen|
Expand Down
27 changes: 27 additions & 0 deletions components/ehmtxv2/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace esphome
this->set_today_color();
this->set_weekday_color();
this->night_mode = false;
this->weekday_accent = false;

for (uint8_t i = 0; i < MAXQUEUE; i++)
{
Expand Down Expand Up @@ -120,6 +121,18 @@ namespace esphome
}
}

void EHMTX::set_weekday_accent_off()
{
this->weekday_accent = false;
ESP_LOGD(TAG, "weekday accent off");
}

void EHMTX::set_weekday_accent_on()
{
this->weekday_accent = true;
ESP_LOGD(TAG, "weekday accent on");
}

void EHMTX::set_today_color(int r, int g, int b)
{
this->today_color = Color((uint8_t)r , (uint8_t)g , (uint8_t)b );
Expand Down Expand Up @@ -598,6 +611,9 @@ namespace esphome
register_service(&EHMTX::set_night_mode_on, "night_mode_on");
register_service(&EHMTX::set_night_mode_off, "night_mode_off");

register_service(&EHMTX::set_weekday_accent_on, "weekday_accent_on");
register_service(&EHMTX::set_weekday_accent_off, "weekday_accent_off");

register_service(&EHMTX::del_screen, "del_screen", {"icon_name", "mode"});
register_service(&EHMTX::force_screen, "force_screen", {"icon_name", "mode"});

Expand Down Expand Up @@ -1092,6 +1108,7 @@ namespace esphome
ESP_LOGI(TAG, "status date format: %s", EHMTXv2_DATE_FORMAT);
ESP_LOGI(TAG, "status display %s", this->show_display ? F("on") : F("off"));
ESP_LOGI(TAG, "status night mode %s", this->night_mode ? F("on") : F("off"));
ESP_LOGI(TAG, "status weekday accent %s", this->weekday_accent ? F("on") : F("off"));
ESP_LOGI(TAG, "status replace time and date %s", this->replace_time_date_active ? F("on") : F("off"));

this->queue_status();
Expand Down Expand Up @@ -1766,6 +1783,7 @@ namespace esphome
this->display = disp;
this->show_display = true;
this->night_mode = false;
this->weekday_accent = false;
ESP_LOGD(TAG, "set_display");
}

Expand Down Expand Up @@ -1856,6 +1874,10 @@ namespace esphome
else
{
this->display->line(2 + i * 4, 7, i * 4 + 4, 7, this->weekday_color);
if (this->weekday_accent && this->brightness_ < 50)
{
this->display->line(i * 4 + 3, 7, i * 4 + 3, 7, this->today_color);
}
}
}
} else {
Expand All @@ -1869,6 +1891,10 @@ namespace esphome
else
{
this->display->line(10 + i * 3, 7, 11 + i * 3 , 7, this->weekday_color);
if (this->weekday_accent && this->brightness_ < 50)
{
this->display->line( (i < dow ? 11 : 10) + i * 3, 7, (i < dow ? 11 : 10) + i * 3 , 7, this->today_color);
}
}
}
}
Expand Down Expand Up @@ -1994,6 +2020,7 @@ namespace esphome
ESP_LOGCONFIG(TAG, "Weekdays: %s Count: %d", EHMTXv2_WEEKDAYTEXT, this->weekday_char_count);
ESP_LOGCONFIG(TAG, "Display: %s", this->show_display ? F("On") : F("Off"));
ESP_LOGCONFIG(TAG, "Night mode: %s", this->night_mode ? F("On") : F("Off"));
ESP_LOGCONFIG(TAG, "Weekday accent: %s", this->weekday_accent ? F("On") : F("Off"));
ESP_LOGCONFIG(TAG, "Replace Time and Date: %s", this->replace_time_date_active ? F("On") : F("Off"));
if (this->replace_time_date_active) {
ESP_LOGCONFIG(TAG, "Replace from: %s", EHMTXv2_REPLACE_TIME_DATE_FROM);
Expand Down
3 changes: 3 additions & 0 deletions components/ehmtxv2/EHMTX.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ namespace esphome
void add_icon(EHMTX_Icon *icon);
bool show_display = false;
bool night_mode = false;
bool weekday_accent = false;
uint8_t find_icon(std::string name);
uint8_t find_last_clock();
bool string_has_ending(std::string const &fullString, std::string const &ending);
Expand All @@ -179,6 +180,8 @@ namespace esphome
void set_display_off();
void set_night_mode_off();
void set_night_mode_on();
void set_weekday_accent_off();
void set_weekday_accent_on();
void set_clock(esphome::time::RealTimeClock *clock);
#ifdef USE_GRAPH
void set_graph(esphome::graph::Graph *graph);
Expand Down