mirror of
https://github.com/esphome/esphome.git
synced 2024-12-11 16:04:54 +01:00
MAX6921: fix CI errors (round 5)
This commit is contained in:
parent
dc73791abf
commit
709137219f
4 changed files with 17 additions and 16 deletions
|
@ -129,7 +129,7 @@ void Display::setup(std::vector<uint8_t> &seg_to_out_map, std::vector<uint8_t> &
|
|||
ESP_LOGCONFIG(TAG, "Display digits: %u", this->num_digits_);
|
||||
|
||||
// setup font...
|
||||
init_font__();
|
||||
init_font_();
|
||||
|
||||
// display output buffer...
|
||||
this->out_buf_size_ = this->num_digits_ * 3;
|
||||
|
@ -229,7 +229,7 @@ void Display::dump_config() {
|
|||
*/
|
||||
bool Display::is_point_seg_only(char c) { return ((c == ',') || (c == '.')); }
|
||||
|
||||
void Display::init_font__() {
|
||||
void Display::init_font_() {
|
||||
uint8_t seg_data;
|
||||
|
||||
this->ascii_out_data_ = new uint8_t[ARRAY_ELEM_COUNT(ASCII_TO_SEG)]; // NOLINT
|
||||
|
@ -554,7 +554,7 @@ DisplayText::DisplayText() {
|
|||
int DisplayText::set_text(uint start_pos, uint max_pos, const std::string &text) {
|
||||
// check start position...
|
||||
if (start_pos >= max_pos) {
|
||||
ESP_LOGW(TAG, "Invalid start position: %u");
|
||||
ESP_LOGW(TAG, "Invalid start position: %u", start_pos);
|
||||
this->start_pos = 0;
|
||||
} else
|
||||
this->start_pos = start_pos;
|
||||
|
@ -577,12 +577,13 @@ void DisplayText::init_text_align_() {
|
|||
case TEXT_ALIGN_LEFT:
|
||||
this->start_pos = 0;
|
||||
break;
|
||||
case TEXT_ALIGN_CENTER:
|
||||
this->start_pos = ((this->max_pos + 1) - this->visible_len) / 2;
|
||||
break;
|
||||
case TEXT_ALIGN_RIGHT:
|
||||
this->start_pos = (this->max_pos + 1) - this->visible_len;
|
||||
break;
|
||||
case TEXT_ALIGN_CENTER:
|
||||
default:
|
||||
this->start_pos = ((this->max_pos + 1) - this->visible_len) / 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -638,7 +639,7 @@ void DisplayText::set_text_align(const std::string &align) {
|
|||
} else if (str_equals_case_insensitive(align, "right")) {
|
||||
text_align = TEXT_ALIGN_RIGHT;
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Invalid text align: %s", align);
|
||||
ESP_LOGW(TAG, "Invalid text align: %s", align.c_str());
|
||||
}
|
||||
} else
|
||||
ESP_LOGW(TAG, "No text align given");
|
||||
|
@ -687,7 +688,7 @@ void DisplayText::set_text_effect(const std::string &effect, uint8_t cycle_num)
|
|||
} else if (str_equals_case_insensitive(effect, "scroll_left")) {
|
||||
text_effect = TEXT_EFFECT_SCROLL_LEFT;
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Invalid text effect: %s", effect);
|
||||
ESP_LOGW(TAG, "Invalid text effect: %s", effect.c_str());
|
||||
}
|
||||
} else
|
||||
ESP_LOGW(TAG, "No text effect given");
|
||||
|
|
|
@ -118,7 +118,7 @@ class Display : public DisplayBrightness, public DisplayMode {
|
|||
int update_out_buf_();
|
||||
|
||||
private:
|
||||
void init_font__();
|
||||
void init_font_();
|
||||
};
|
||||
|
||||
} // namespace max6921
|
||||
|
|
|
@ -28,8 +28,8 @@ void MAX6921Component::setup() {
|
|||
this->load_pin_->pin_mode(gpio::FLAG_OUTPUT);
|
||||
this->disable_load_(); // disable output latch
|
||||
|
||||
this->display_ = new Display(this);
|
||||
this->display_->setup(this->seg_to_out_map__, this->pos_to_out_map__);
|
||||
this->display_ = make_unique<Display>(this);
|
||||
this->display_->setup(this->seg_to_out_map_, this->pos_to_out_map_);
|
||||
|
||||
// setup display brightness (PWM for BLANK pin)...
|
||||
if (this->display_->config_brightness_pwm(this->blank_pin_->get_pin(), 0, pwm_resolution, pwm_freq_wanted) == 0) {
|
||||
|
|
|
@ -23,7 +23,7 @@ class MAX6921Component : public PollingComponent,
|
|||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_4MHZ> {
|
||||
public:
|
||||
Display *display_;
|
||||
std::unique_ptr<Display> display_;
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override;
|
||||
uint8_t print(uint8_t pos, const char *str);
|
||||
|
@ -31,8 +31,8 @@ class MAX6921Component : public PollingComponent,
|
|||
void set_blank_pin(InternalGPIOPin *pin) { blank_pin_ = pin; }
|
||||
void set_brightness(float brightness);
|
||||
void set_load_pin(GPIOPin *load) { this->load_pin_ = load; }
|
||||
void set_seg_to_out_pin_map(const std::vector<uint8_t> &pin_map) { this->seg_to_out_map__ = pin_map; }
|
||||
void set_pos_to_out_pin_map(const std::vector<uint8_t> &pin_map) { this->pos_to_out_map__ = pin_map; }
|
||||
void set_seg_to_out_pin_map(const std::vector<uint8_t> &pin_map) { this->seg_to_out_map_ = pin_map; }
|
||||
void set_pos_to_out_pin_map(const std::vector<uint8_t> &pin_map) { this->pos_to_out_map_ = pin_map; }
|
||||
void set_writer(max6921_writer_t &&writer);
|
||||
void setup() override;
|
||||
uint8_t strftime(uint8_t pos, const char *format, ESPTime time) __attribute__((format(strftime, 3, 0)));
|
||||
|
@ -52,8 +52,8 @@ class MAX6921Component : public PollingComponent,
|
|||
optional<max6921_writer_t> writer_{};
|
||||
|
||||
private:
|
||||
std::vector<uint8_t> seg_to_out_map__; // mapping of display segments to MAX6921 OUT pins
|
||||
std::vector<uint8_t> pos_to_out_map__; // mapping of display positions to MAX6921 OUT pins
|
||||
std::vector<uint8_t> seg_to_out_map_; // mapping of display segments to MAX6921 OUT pins
|
||||
std::vector<uint8_t> pos_to_out_map_; // mapping of display positions to MAX6921 OUT pins
|
||||
};
|
||||
|
||||
} // namespace max6921
|
||||
|
|
Loading…
Reference in a new issue