make efficient use of available display area
fix calculation of the text baselines, using getAscent() in favor of getMaxCharHeight(), which includes ascent and descent. this moves the first text up and allows to insert margin between the lines until the display area is fully utilized. on large displays, if the small diagram is selected, keep the first line rather low to avoid collision with the diagram y-axis label. in this mode, there is still more space between the text lines as before, allowing for improved readability.
This commit is contained in:
parent
21ec72f4c0
commit
25a66a1722
@ -67,11 +67,19 @@ void DisplayGraphicClass::init(Scheduler& scheduler, const DisplayType_t type, c
|
||||
|
||||
void DisplayGraphicClass::calcLineHeights()
|
||||
{
|
||||
uint8_t yOff = 0;
|
||||
bool diagram = (_isLarge && _diagram_mode == DiagramMode_t::Small);
|
||||
// the diagram needs space. we need to keep
|
||||
// away from the y-axis label in particular.
|
||||
uint8_t yOff = (diagram?7:0);
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
setFont(i);
|
||||
yOff += (_display->getMaxCharHeight());
|
||||
yOff += _display->getAscent();
|
||||
_lineOffsets[i] = yOff;
|
||||
yOff += ((!_isLarge || diagram)?2:3);
|
||||
// the descent is a negative value and moves the *next* line's
|
||||
// baseline. the first line never uses a letter with descent and
|
||||
// we need that space when showing the small diagram.
|
||||
yOff -= ((i == 0 && diagram)?0:_display->getDescent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -166,12 +166,12 @@ void WebApiDeviceClass::onDeviceAdminPost(AsyncWebServerRequest* request)
|
||||
config.Led_Single[i].Brightness = min<uint8_t>(100, config.Led_Single[i].Brightness);
|
||||
}
|
||||
|
||||
Display.setDiagramMode(static_cast<DiagramMode_t>(config.Display.Diagram.Mode));
|
||||
Display.setOrientation(config.Display.Rotation);
|
||||
Display.enablePowerSafe = config.Display.PowerSafe;
|
||||
Display.enableScreensaver = config.Display.ScreenSaver;
|
||||
Display.setContrast(config.Display.Contrast);
|
||||
Display.setLanguage(config.Display.Language);
|
||||
Display.setDiagramMode(static_cast<DiagramMode_t>(config.Display.Diagram.Mode));
|
||||
Display.Diagram().updatePeriod();
|
||||
|
||||
WebApi.writeConfig(retMsg);
|
||||
|
||||
@ -120,12 +120,12 @@ void setup()
|
||||
pin.display_clk,
|
||||
pin.display_cs,
|
||||
pin.display_reset);
|
||||
Display.setDiagramMode(static_cast<DiagramMode_t>(config.Display.Diagram.Mode));
|
||||
Display.setOrientation(config.Display.Rotation);
|
||||
Display.enablePowerSafe = config.Display.PowerSafe;
|
||||
Display.enableScreensaver = config.Display.ScreenSaver;
|
||||
Display.setContrast(config.Display.Contrast);
|
||||
Display.setLanguage(config.Display.Language);
|
||||
Display.setDiagramMode(static_cast<DiagramMode_t>(config.Display.Diagram.Mode));
|
||||
Display.setStartupDisplay();
|
||||
MessageOutput.println("done");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user