diff --git a/esphome/owon_b35t.h b/esphome/owon_b35t.h index 626838b..89b6cc3 100644 --- a/esphome/owon_b35t.h +++ b/esphome/owon_b35t.h @@ -493,13 +493,24 @@ class Meter { } int t = 10; int half = h / 2; - if (a) this->draw_segment_(it, x + t / 2, y, w - t, t, true, color); - if (b) this->draw_segment_(it, x + w - t, y + t / 2, t, half - t, false, color); - if (c) this->draw_segment_(it, x + w - t, y + half + t / 2, t, half - t, false, color); - if (d) this->draw_segment_(it, x + t / 2, y + h - t, w - t, t, true, color); - if (e) this->draw_segment_(it, x, y + half + t / 2, t, half - t, false, color); - if (f) this->draw_segment_(it, x, y + t / 2, t, half - t, false, color); - if (g) this->draw_segment_(it, x + t / 2, y + half - t / 2, w - t, t, true, color); + int gap = 1; + + int top_y = y; + int mid_y = y + half - t / 2; + int bot_y = y + h - t; + + int upper_v_y = top_y + t + gap; + int upper_v_h = mid_y - gap - upper_v_y; + int lower_v_y = mid_y + t + gap; + int lower_v_h = bot_y - gap - lower_v_y; + + if (a) this->draw_segment_(it, x + t / 2, top_y, w - t, t, true, color); + if (b && upper_v_h > 0) this->draw_segment_(it, x + w - t, upper_v_y, t, upper_v_h, false, color); + if (c && lower_v_h > 0) this->draw_segment_(it, x + w - t, lower_v_y, t, lower_v_h, false, color); + if (d) this->draw_segment_(it, x + t / 2, bot_y, w - t, t, true, color); + if (e && lower_v_h > 0) this->draw_segment_(it, x, lower_v_y, t, lower_v_h, false, color); + if (f && upper_v_h > 0) this->draw_segment_(it, x, upper_v_y, t, upper_v_h, false, color); + if (g) this->draw_segment_(it, x + t / 2, mid_y, w - t, t, true, color); } void draw_bargraph_(Display &it, uint16_t digits, bool active) {