External Display component

I’m trying to write an external display component for the PDC-6X1 LCD 7 segment display, but the display is not updating with the text from my YAML

The external component is rendering OK to the physical display, because I added code in the setup to write “54321” to the display, but in my YAML I have

display:
    platform: pdc6x1
    id: my_display
    cs_pin: GPIO10
    data_pin: GPIO8
    write_pin: GPIO9
    update_interval: 1s
    lambda: |-
        it.printf("%s", "123");

which I presumed should write “123” onto the display, however the printf() function in the external component is not being called.

The update() function is being called once per second but the lamba is not being handled.

I’ve based the external component on the TM1621 display, which is also a 7 segment display, and the display.py includes the lambda config in the to_code section

    if CONF_LAMBDA in config:
        lambda_ = await cg.process_lambda(
            config[CONF_LAMBDA], [(PDC6X1DisplayRef, "it")], return_type=cg.void
        )
        cg.add(var.set_writer(lambda_))

in my class for pdc6x1 I have functions for the various printf() e.g.

uint8_t PDC6X1Display::printf(const char *format, ...)

But I’ve added


 ESP_LOGD(TAG, "printf(const char *format, ...) ");

into all the print functions but none of them are getting called.

I don’t see any errors in the log, all I see are the constant calls to update() being logged

I’m obviously missing some part of the puzzle but I’m not sure what

To update my own post…

I’m not sure what I changed, but it now appears to be partially working.

I think possibly adding

  if (this->writer_.has_value())
  {
        (*this->writer_)(*this);
  }

Inside the update() function may have been the reason, but I don’t understand what this actually does.