Class DisplayManager

Nested Relationships

Nested Types

Class Documentation

class DisplayManager

The display manager is responsible to Manage all displays. It holds an instance to every display avaliable on the clock and manages the updating of all displays together.

Public Functions

~DisplayManager()

Destroys the Display Manager object and cause DisplayManager::getInstance to create a new object the next time it is called.

void InitSegments(uint16_t indexOfFirstLed, uint8_t ledsPerSegment, CRGB initialColor, uint8_t initBrightness = 128)

Initialize all the segment using the configuration from DisplayConfiguration.cpp.

Parameters:
  • indexOfFirstLed – Index of the first led in the string that is part of a segment (usually 0)

  • ledsPerSegment – Sets the number of LEDs that are in one segment. this will be the same for all segments

  • initialColor – Sets the initial color of all the segments. This does not switch any segments on by it’s own

  • initBrightness – Sets the initial brightness of all the segments to avoid brigness jumps during startup

void setAllSegmentColors(CRGB color)

Sets the color of all segments and updates it immediately for all segments that are currently switched on.

Parameters:

color – Color to set the LEDs to

void setHourSegmentColors(CRGB color)

Sets the color of the the segments which are displaying hours and updates it immediately for all segments that are currently switched on.

Parameters:

color – Color to set the LEDs to

void setMinuteSegmentColors(CRGB color)

Sets the color of the the segments which are displaying minutes and updates it immediately for all segments that are currently switched on.

Parameters:

color – Color to set the LEDs to

void displayRaw(uint8_t Hour, uint8_t Minute)

Displays the numbers given as they are on the respective displays.

Parameters:
  • Hour – Number to show on the hours display

  • Minute – Number to show on the minutes display

void displayTime(uint8_t hours, uint8_t minutes)

Display the time, Automatically convert between 24h and 12h formats.

Parameters:
  • hours – Hours in a range of 0 to 24

  • minutes – Hours in a range of 0 to 59

void displayTimer(uint8_t hours, uint8_t minutes, uint8_t seconds)

Display the remaining time on the timer. Always displays the highest possible output. For example: If hour is anything else than 1 minutes will be displayed in the hour spot and seconds on the minute spot on the display if possible.

Parameters:
  • hours – Hours in a range of 0 to 24

  • minutes – Hours in a range of 0 to 59

  • seconds – Seconds in a range of 0 to 59

void handle()

Has to be called cyclicly in the loop to enable live updating of the LEDs.

void setInternalLEDColor(CRGB color)

Sets the color of the interrior LEDs and displays it immediately.

void setDotLEDColor(CRGB color)

Sets the color of the seperation dot LEDs and displays it immediately.

void showLoadingAnimation()

Starts the loading animation.

void stopLoadingAnimation()

Stops the currently running animation after it is finished. This causes a looping animation to stop after its current cycle.

void waitForLoadingAnimationFinish()

Wait until the currently set complex animation is finished.

void turnAllSegmentsOff()

Turns all displays off completely, Does not affect interior lights.

void turnAllLEDsOff()

Turn off all LEDs including internal LEDs.

void displayProgress(uint32_t total)

start displaying a progress bar on the LEDs

Parameters:

total – How much progress there is to do in total

void updateProgress(uint32_t progress)

Update the progress bar.

Parameters:

progress – How much progress was done already

Pre:

DisplayManager::displayProgress has to be called once before updating the progress with this function

void delay(uint32_t timeInMs)

Use this delay instead of the Arduino delay to enable Display updates during the delay.

Parameters:

timeInMs – Delay time in ms

void setGlobalBrightness(uint8_t brightness, bool enableSmoothTransition = true)

Sets the Brightness globally for all leds.

Parameters:
  • brightness – value between 0 for lowest, and 255 for the highes brightness

  • enableSmoothTransition – If true the LEDs will transition to the new value smoothly

void flashSeparationDot(uint8_t numDots)

Calling the Flash dot animation for the appropriate segments in the middle of the clock face.

void test()

Used for testing purposes.

Public Static Functions

static DisplayManager *getInstance()

Get the instance of the DisplayManager object or create it if it was not yet instantiated.

Returns:

DisplayManager* returns the address to the DisplayManager object

static int16_t getGlobalSegmentIndex(SegmentPositions_t segmentPosition, DisplayIDs Display)

get the index of a segment in regards to it’s position on the clock face. This makes writing animations a lot easier as it will act as an abstraction layer between the animation config and the display config

Parameters:
  • segmentPosition – Position of a segment in the seven segment display

  • Display – Which display should be targeted

Returns:

int16_t index of the Segment in the #DisplayManager::SegmentPositions array

static void printAnimationInitErrors()

Debugging function which will print out any errors that occurred when using the DisplayManager::getGlobalSegmentIndex function. Especially useful for debugging weirdly behaving animations as animations will be configured before the Serial connection is up. If an error was detected by the DisplayManager::getGlobalSegmentIndex function a message will be added to a buffer which can then be printed out using this function.