2121#include < string>
2222#include < regex>
2323
24- // #define USE_ESP32
25- // #define EHMTXv2_ADV_BOOT
26- // #define EHMTXv2_ADV_BOOT_MODE_0
2724
2825#ifdef USE_ESP32
2926 #ifdef EHMTXv2_ADV_BOOT
@@ -304,7 +301,7 @@ namespace esphome::ehmtx
304301
305302#ifdef EHMTXv2_LTINDICATOR
306303/* *
307- * @brief * @brief hides the left top indicator
304+ * @brief hides the left top indicator
308305 *
309306 */
310307 void EHMTX::hide_ltindicator ()
@@ -316,7 +313,7 @@ namespace esphome::ehmtx
316313
317314#ifdef EHMTXv2_LCINDICATOR
318315/* *
319- * @brief * @brief hides the left center indicator
316+ * @brief hides the left center indicator
320317 *
321318 */
322319 void EHMTX::hide_lcindicator ()
@@ -328,7 +325,7 @@ namespace esphome::ehmtx
328325
329326#ifdef EHMTXv2_LBINDICATOR
330327/* *
331- * @brief * @brief hides the left bottom indicator
328+ * @brief hides the left bottom indicator
332329 *
333330 */
334331 void EHMTX::hide_lindicator ()
@@ -550,7 +547,6 @@ namespace esphome::ehmtx
550547 if (array.size () > 256 ) {
551548 return ;
552549 }
553- // extract the values
554550 uint16_t i = 0 ;
555551 for (JsonVariant v : array)
556552 {
@@ -601,7 +597,6 @@ namespace esphome::ehmtx
601597 if (array.size () > 256 ) {
602598 return ;
603599 }
604- // extract the values
605600 uint16_t i = 0 ;
606601 for (JsonVariant v : array)
607602 {
@@ -668,7 +663,6 @@ namespace esphome::ehmtx
668663 if (array.size () > 64 ) {
669664 return ;
670665 }
671- // extract the values
672666 uint16_t i = 0 ;
673667 for (JsonVariant v : array)
674668 {
@@ -725,7 +719,6 @@ namespace esphome::ehmtx
725719 if (array.size () > 64 ) {
726720 return ;
727721 }
728- // extract the values
729722 uint16_t i = 0 ;
730723 for (JsonVariant v : array)
731724 {
@@ -818,7 +811,7 @@ namespace esphome::ehmtx
818811 }
819812 else
820813 {
821- screen->sbitmap [real_count] = Color (127 , 255 , icon, 5 ); // int16_t 32767 = uint8_t(127,255)
814+ screen->sbitmap [real_count] = Color (127 , 255 , icon, 5 );
822815 real_count++;
823816 }
824817 }
@@ -1187,8 +1180,6 @@ namespace esphome::ehmtx
11871180 }
11881181 }
11891182 }
1190- else
1191- {
11921183 }
11931184 }
11941185
@@ -1278,9 +1269,6 @@ namespace esphome::ehmtx
12781269 hit = 0 ;
12791270 ESP_LOGD (TAG , " oldest queue element is first: %d/%d" , hit, queue_count);
12801271 }
1281- else
1282- {
1283- // Queue is empty
12841272 }
12851273 this ->queue[hit]->status ();
12861274
@@ -1491,7 +1479,7 @@ namespace esphome::ehmtx
14911479 }
14921480 #endif
14931481
1494- // todo nur bei animationen
1482+
14951483 if (this ->queue [this ->screen_pointer ]->mode == MODE_BITMAP_STACK_SCREEN && this ->queue [this ->screen_pointer ]->sbitmap != NULL )
14961484 {
14971485 for (uint8_t i = 0 ; i < this ->queue [this ->screen_pointer ]->icon ; i++)
@@ -1506,7 +1494,7 @@ namespace esphome::ehmtx
15061494 this ->icons [this ->queue [this ->screen_pointer ]->icon ]->set_frame (0 );
15071495 }
15081496 this ->next_action_time = this ->queue [this ->screen_pointer ]->last_time + this ->queue [this ->screen_pointer ]->screen_time_ ;
1509- // Todo switch for Triggers
1497+
15101498 if (this ->queue [this ->screen_pointer ]->mode == MODE_CLOCK )
15111499 {
15121500 for (auto *t : on_next_clock_triggers_)
@@ -1632,7 +1620,7 @@ namespace esphome::ehmtx
16321620 }
16331621 else
16341622 {
1635- this ->next_action_time = ts + 15000 ; // come back in 15 Seconds
1623+ this ->next_action_time = ts + 15000 ;
16361624 for (auto *t : on_empty_queue_triggers_)
16371625 {
16381626 ESP_LOGD (TAG , " on_empty_queue trigger" );
@@ -1647,7 +1635,7 @@ namespace esphome::ehmtx
16471635 }
16481636 }
16491637
1650- // blend handling
1638+
16511639#ifdef EHMTXv2_BLEND_STEPS
16521640 if ((this ->ticks_ <= EHMTXv2_BLEND_STEPS) && (this ->brightness_ >= 50 ) && (this ->queue_count () > 1 ))
16531641 {
@@ -1827,7 +1815,7 @@ namespace esphome::ehmtx
18271815 ESP_LOGI (TAG , " replace_time_date %s" , b ? ESPHOME_F (" on" ) : ESPHOME_F (" off" ));
18281816 }
18291817
1830- std::string EHMTX::replace_time_date (std::string time_date) // Replace Time Date Strings / Trip5
1818+ std::string EHMTX::replace_time_date (std::string time_date)
18311819 {
18321820 std::string replace_from_string = EHMTXv2_REPLACE_TIME_DATE_FROM;
18331821 std::string replace_to_string = EHMTXv2_REPLACE_TIME_DATE_TO;
@@ -2461,7 +2449,7 @@ namespace esphome::ehmtx
24612449 if (array.size () > 72 ) {
24622450 return ;
24632451 }
2464- // extract the 24 color values
2452+
24652453 uint8_t red = 0 ;
24662454 uint8_t gre = 0 ;
24672455 uint8_t blu = 0 ;
@@ -2677,7 +2665,7 @@ namespace esphome::ehmtx
26772665 {
26782666 if (this ->show_day_of_week )
26792667 {
2680- auto dow = this ->clock ->now ().day_of_week - 1 ; // SUN = 0
2668+ auto dow = this ->clock ->now ().day_of_week - 1 ;
26812669
26822670 Color accent_color = esphome::display::COLOR_OFF ;
26832671 if (this ->weekday_accent && this ->brightness_ < 50 )
@@ -2788,7 +2776,7 @@ namespace esphome::ehmtx
27882776 {
27892777 if (output.find (" %" ) != std::string::npos)
27902778 {
2791- if (this ->replace_time_date_active && output == " %p" ) // check for replace active
2779+ if (this ->replace_time_date_active && output == " %p" )
27922780 {
27932781 output = this ->clock ->now ().strftime (output);
27942782 output = this ->replace_time_date (output);
@@ -2800,7 +2788,7 @@ namespace esphome::ehmtx
28002788 else
28012789 {
28022790 #ifdef EHMTXv2_FLIP_FLOP
2803- if (output == " %I" && h > 12 ) // check for 12-hour clock
2791+ if (output == " %I" && h > 12 )
28042792 {
28052793 h = h - 12 ; // Switch to 12-hour clock
28062794 }
@@ -2838,7 +2826,7 @@ namespace esphome::ehmtx
28382826 bool step = false ;
28392827 uint8_t y = ystep / EHMTXv2_FLIP_FLOP_SPEED;
28402828
2841- if (i == 0 ) // Hours
2829+ if (i == 0 )
28422830 {
28432831 if (h != hours)
28442832 {
@@ -2868,7 +2856,7 @@ namespace esphome::ehmtx
28682856 this ->display ->printf (x, ypos, font, c_, display::TextAlign::BASELINE_LEFT , " %s" , parts.at (i).c_str ());
28692857 }
28702858 }
2871- else if (i == 2 ) // Minutes
2859+ else if (i == 2 )
28722860 {
28732861 if (m != minutes)
28742862 {
@@ -2898,7 +2886,7 @@ namespace esphome::ehmtx
28982886 this ->display ->printf (x, ypos, font, c_, display::TextAlign::BASELINE_LEFT , " %s" , parts.at (i).c_str ());
28992887 }
29002888 }
2901- else if (i == 4 ) // Seconds
2889+ else if (i == 4 )
29022890 {
29032891 if (s != seconds)
29042892 {
@@ -2976,7 +2964,7 @@ namespace esphome::ehmtx
29762964 {
29772965 if (output.find (" %" ) != std::string::npos)
29782966 {
2979- if (this ->replace_time_date_active && (output == " %a" || output == " %A" || output == " %b" || output == " %B" )) // check for replace active
2967+ if (this ->replace_time_date_active && (output == " %a" || output == " %A" || output == " %b" || output == " %B" ))
29802968 {
29812969 output = this ->clock ->now ().strftime (output);
29822970 output = this ->replace_time_date (output);
@@ -3207,10 +3195,10 @@ namespace esphome::ehmtx
32073195
32083196 int32_t EHMTX::GetTextBounds (esphome::display::BaseFont *font, const char *buffer)
32093197 {
3210- int x = 0 ; // A pointer to store the returned x coordinate of the upper left corner in.
3211- int y = 0 ; // A pointer to store the returned y coordinate of the upper left corner in.
3212- int width = 0 ; // A pointer to store the returned text width in.
3213- int height = 0 ; // A pointer to store the returned text height in.
3198+ int x = 0 ;
3199+ int y = 0 ;
3200+ int width = 0 ;
3201+ int height = 0 ;
32143202 this ->display ->get_text_bounds (0 , 0 , buffer, font, esphome::display::TextAlign::TOP_LEFT , &x, &y, &width, &height);
32153203 return width;
32163204 }
0 commit comments