EthercatDevice_DmpLCD.lcdSetTextSize()

[EthercatDevice_DmpLCD_Generic]

描述

Set the font size multiplier for the text to be printed on the LCD display of the EtherCAT slave device. The default font size multiplier is 1, which corresponds to a 6 x 8 font. This means the text will be 6 pixels wide and 8 pixels tall. You can increase the font size multiplier by setting the value to 2, 3, or higher. Each increment in the font size multiplier results in a larger font. For example:

  • s = 2: 12 x 16 pixels.
  • s = 3: 18 x 24 pixels.
  • s = 4: 24 x 32 pixels.
  • ...等等

Beyond uniform scaling, fonts can also be scaled individually in width and height. This means that the font can be stretched horizontally or vertically without affecting the other dimensions. For example:

  • w = 1, h = 2: 6 x 16 pixels.
  • w = 2, h = 1: 12 x 8 pixels.
  • w = 2, h = 4: 12 x 32 pixels.
EthercatDevice_DmpLCD.lcdSetTextSize-1

衍生類別:

Class NameVendor IDProduct Code
EthercatDevice_QECR11UN010x00000bc30x0086d103
EthercatDevice_QECR00UN010x00000bc30x0086d100

語法

int lcdSetTextSize(uint8_t s);
int lcdSetTextSize(uint8_t w, uint8_t h);

參數

  • [in] uint8_t s
    The font size multiplier for the text to be printed.
  • [in] uint8_t w
    The font width multiplier for the text to be printed.
  • [in] uint8_t h
    The font height multiplier for the text to be printed.

回傳值

返回一個 錯誤代碼。如果傳回值為零,則表示該函式執行成功。

備註

This function must be called after a successful execution of EthercatMaster::begin(). This function is non-blocking and can be called within the Cyclic Callback.

範例

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR00UN01 slave;

void CyclicCallback() {
  slave.update();
}

void setup() {
  master.begin();
  slave.attach(0, master);
  slave.lcdInit(ECAT_LCD_ILI9341_1);
  master.attachCyclicCallback(CyclicCallback);
  master.start();

  slave.lcdSetTextSize(2);
  slave.lcdPrint("Hello World!\n");
  slave.lcdSetTextSize(2, 4);
  slave.lcdPrint("Hello World!\n");
}

void loop() {
  // ...
}

Please see EthercatDevice_DmpLCD_Generic 類別 for more QEC Stepper Drivers instructions and API usage.

返回頂端