Class to implement display on an SH1106 based OLED using the U8g2 library.
More...
#include <U8G2SH1106Display.h>
|
| | U8G2SH1106Display () |
| | Constructor for the display object.
|
| |
| void | begin () override |
| | Start the display.
|
| |
| void | clear () override |
| | Clear the display.
|
| |
| void | displayStartupScreen (const char *headerText, const char *version) override |
| | Display the startup screen.
|
| |
| void | displayProgressScreen (const char *activity, uint8_t counter) override |
| | Display progress screen for the specified activity.
|
| |
| void | displayErrorScreen (const char *errorText) override |
| | Display error screen.
|
| |
| void | displayMenuScreen (const char *menuName, BaseMenuItem *firstMenuItem, uint8_t selectedItemIndex, bool selectionChanged) override |
| | Display a menu.
|
| |
| void | displayThrottleScreen (const char *locoName, uint8_t speed, Direction direction, TrackPower trackPower, bool speedChanged, bool directionChange, bool trackPowerChanged) override |
| | Display the throttle screen.
|
| |
| bool | needsRedraw () |
| | Check if the display needs to be redrawn to prevent unnecessary redraws and flicker.
|
| |
| void | setNeedsRedraw (bool redraw) |
| | Set the redraw flag for this display.
|
| |
| bool | needsMenuRefresh () |
| | Check if the menu needs refreshing - avoids a complete redraw for menu screens.
|
| |
| void | setNeedsMenuRefresh (bool refresh) |
| | Set the refresh menu flag for this display.
|
| |
| uint8_t | getMenuItemsPerPage () |
| | Get the number of menu items to be displayed per page for this display.
|
| |
| void | setMenuItemsPerPage (uint8_t menuItemsPerPage) |
| | Set the number of menu items per page this display can handle.
|
| |
| virtual | ~DisplayInterface ()=default |
| | Destructor for the object.
|
| |
Class to implement display on an SH1106 based OLED using the U8g2 library.
◆ U8G2SH1106Display()
| U8G2SH1106Display::U8G2SH1106Display |
( |
| ) |
|
Constructor for the display object.
◆ _calculateHeaderHeight()
| uint16_t U8G2SH1106Display::_calculateHeaderHeight |
( |
| ) |
|
|
private |
Calculates the height of the header area.
- Returns
- Header height
◆ _calculateMenuFooterHeight()
| uint16_t U8G2SH1106Display::_calculateMenuFooterHeight |
( |
| ) |
|
|
private |
Calculates the height of the footer area.
- Returns
- Footer height
◆ _calculateMenuItemHeight()
| uint16_t U8G2SH1106Display::_calculateMenuItemHeight |
( |
| ) |
|
|
private |
Calculates the height of the menu item area.
- Returns
- Menu item height
◆ _calculateMenuItemsPerPage()
| uint8_t U8G2SH1106Display::_calculateMenuItemsPerPage |
( |
| ) |
|
|
private |
Calculates the number of menu items that will fit on screen.
- Returns
- Number of items that will fit on screen
◆ _clearDisplay()
| void U8G2SH1106Display::_clearDisplay |
( |
| ) |
|
|
private |
◆ _displayErrorMessage()
| void U8G2SH1106Display::_displayErrorMessage |
( |
const char * |
errorMessage | ) |
|
|
private |
Display an error message with emoji.
- Parameters
-
| errorMessage | Error message to display |
◆ _displayHeader()
| void U8G2SH1106Display::_displayHeader |
( |
const char * |
headerText | ) |
|
|
private |
Display the header text with a horizontal line separator.
- Parameters
-
| headerText | Text to display |
◆ _displayLocoDirection()
| void U8G2SH1106Display::_displayLocoDirection |
( |
Direction |
direction | ) |
|
|
private |
Update the currently selected loco's direction.
- Parameters
-
◆ _displayLocoName()
| void U8G2SH1106Display::_displayLocoName |
( |
const char * |
name | ) |
|
|
private |
Update the address of the currently selected loco.
- Parameters
-
| address | Pointer to the char array containing the name |
◆ _displayLocoSpeed()
| void U8G2SH1106Display::_displayLocoSpeed |
( |
uint8_t |
speed | ) |
|
|
private |
Update the currenty selected loco's speed.
- Parameters
-
| speed | 8 bit integer of the speed |
◆ _displayMenuFooter()
| void U8G2SH1106Display::_displayMenuFooter |
( |
| ) |
|
|
private |
Displays the horizontal line separator and Page # text.
◆ _displayMenuItems()
| uint8_t U8G2SH1106Display::_displayMenuItems |
( |
BaseMenuItem * |
firstMenuItem, |
|
|
uint8_t |
selectedItemIndex |
|
) |
| |
|
private |
Display the list of menu items, paginated by the number that will fit on screen.
- Parameters
-
| firstMenuItem | Pointer to the first menu item in the list |
| selectedItemIndex | Index of the currently selected item to highlight |
- Returns
- Current page number
◆ _displayPageNumber()
| void U8G2SH1106Display::_displayPageNumber |
( |
uint8_t |
pageNumber | ) |
|
|
private |
Displays the provided page number within the menu footer.
- Parameters
-
◆ _displayProgress()
| void U8G2SH1106Display::_displayProgress |
( |
uint8_t |
counter | ) |
|
|
private |
Display progress bar.
- Parameters
-
| counter | Current attempt counter |
◆ _displayStartupInfo()
| void U8G2SH1106Display::_displayStartupInfo |
( |
const char * |
version | ) |
|
|
private |
Display the software version below the header text.
- Parameters
-
| version | Pointer to the char array containing the version number |
◆ _displayTrackPowerState()
| void U8G2SH1106Display::_displayTrackPowerState |
( |
TrackPower |
trackPower | ) |
|
|
private |
Update the current track power status.
- Parameters
-
| trackPower | PowerOff|PowerOn|PowerUnknown |
◆ begin()
| void U8G2SH1106Display::begin |
( |
| ) |
|
|
overridevirtual |
◆ clear()
| void U8G2SH1106Display::clear |
( |
| ) |
|
|
overridevirtual |
◆ displayErrorScreen()
| void U8G2SH1106Display::displayErrorScreen |
( |
const char * |
errorText | ) |
|
|
overridevirtual |
Display error screen.
- Parameters
-
| errorText | Error text to display |
Implements DisplayInterface.
◆ displayMenuScreen()
| void U8G2SH1106Display::displayMenuScreen |
( |
const char * |
menuName, |
|
|
BaseMenuItem * |
firstMenuItem, |
|
|
uint8_t |
selectedItemIndex, |
|
|
bool |
selectionChanged |
|
) |
| |
|
overridevirtual |
Display a menu.
- Parameters
-
| menuName | Name of the menu being displayed |
| firstMenuItem | Pointer to the first menu item in the list of items |
| selectedItemIndex | Index of the currently selected item to be highlighted |
| selectionChanged | Flag if the user has changed the selection |
Implements DisplayInterface.
◆ displayProgressScreen()
| void U8G2SH1106Display::displayProgressScreen |
( |
const char * |
activity, |
|
|
uint8_t |
counter |
|
) |
| |
|
overridevirtual |
Display progress screen for the specified activity.
- Parameters
-
| activity | Text of the activity in progress |
| counter | Counter of the current attempt |
Implements DisplayInterface.
◆ displayStartupScreen()
| void U8G2SH1106Display::displayStartupScreen |
( |
const char * |
headerText, |
|
|
const char * |
version |
|
) |
| |
|
overridevirtual |
Display the startup screen.
- Parameters
-
| headerText | Header text to display |
| version | Software version to display |
Implements DisplayInterface.
◆ displayThrottleScreen()
| void U8G2SH1106Display::displayThrottleScreen |
( |
const char * |
locoName, |
|
|
uint8_t |
speed, |
|
|
Direction |
direction, |
|
|
TrackPower |
trackPower, |
|
|
bool |
speedChanged, |
|
|
bool |
directionChange, |
|
|
bool |
trackPowerChanged |
|
) |
| |
|
overridevirtual |
Display the throttle screen.
- Parameters
-
| locoName | Name of the loco currently being operated |
| speed | Current speed of the loco |
| direction | Current direction of the loco |
| trackPower | Current track power state |
| speedChanged | Flag if the speed has changed |
| directionChange | Flag if the direction has changed |
| trackPowerChanged | Flag if the track power state has changed |
Implements DisplayInterface.
◆ _defaultFont
| const uint8_t* U8G2SH1106Display::_defaultFont |
|
private |
◆ _menuFont
| const uint8_t* U8G2SH1106Display::_menuFont |
|
private |
◆ _oled
| U8G2* U8G2SH1106Display::_oled |
|
private |
◆ _speedFont
| const uint8_t* U8G2SH1106Display::_speedFont |
|
private |
◆ _throttleFont
| const uint8_t* U8G2SH1106Display::_throttleFont |
|
private |
The documentation for this class was generated from the following files: