mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge pull request #247 from jquatier/ui-text-width
UI Text Width - minor improvement
This commit is contained in:
commit
1f06d22bde
10 changed files with 30 additions and 8 deletions
|
|
@ -144,7 +144,7 @@ void UITask::renderCurrScreen() {
|
|||
// version info
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->setTextSize(1);
|
||||
int textWidth = strlen(_version_info) * 5; // Assuming each character is 5 pixels wide
|
||||
uint16_t textWidth = _display->getTextWidth(_version_info);
|
||||
_display->setCursor((_display->width() - textWidth) / 2, 22);
|
||||
_display->print(_version_info);
|
||||
} else { // home screen
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ void UITask::renderCurrScreen() {
|
|||
// version info
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->setTextSize(1);
|
||||
int versionWidth = strlen(_version_info) * 6;
|
||||
uint16_t versionWidth = _display->getTextWidth(_version_info);
|
||||
_display->setCursor((_display->width() - versionWidth) / 2, 22);
|
||||
_display->print(_version_info);
|
||||
|
||||
// node type
|
||||
const char* node_type = "< Repeater >";
|
||||
int nodeTypeWidth = strlen(node_type) * 6;
|
||||
_display->setCursor((_display->width() - nodeTypeWidth) / 2, 35);
|
||||
uint16_t typeWidth = _display->getTextWidth(node_type);
|
||||
_display->setCursor((_display->width() - typeWidth) / 2, 35);
|
||||
_display->print(node_type);
|
||||
} else { // home screen
|
||||
// node name
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ void UITask::renderCurrScreen() {
|
|||
// version info
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->setTextSize(1);
|
||||
int versionWidth = strlen(_version_info) * 6;
|
||||
uint16_t versionWidth = _display->getTextWidth(_version_info);
|
||||
_display->setCursor((_display->width() - versionWidth) / 2, 22);
|
||||
_display->print(_version_info);
|
||||
|
||||
// node type
|
||||
const char* node_type = "< Room Server >";
|
||||
int nodeTypeWidth = strlen(node_type) * 6;
|
||||
_display->setCursor((_display->width() - nodeTypeWidth) / 2, 35);
|
||||
const char* node_type = "< Repeater >";
|
||||
uint16_t typeWidth = _display->getTextWidth(node_type);
|
||||
_display->setCursor((_display->width() - typeWidth) / 2, 35);
|
||||
_display->print(node_type);
|
||||
} else { // home screen
|
||||
// node name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue