1-phase PV router
Loading...
Searching...
No Matches
7-Segment Display Feature

Functions for managing the 7-segment display. More...

Files

file  utils_display.h
 7-segments display functions
 

Functions

void configureValueForDisplay (const bool _EDD_isActive, const uint16_t _ValueToDisplay, const bool _diversionEnabled=false, const bool _loadForced=false)
 Configures the value for display on a 7-segment display.
 
void displayForced ()
 Displays "FORC" on the 7-segment display for forced load override.
 
void displayOff ()
 Displays "OFF" on the 7-segment display.
 
void initializeDisplay ()
 Initializes the display for hardware-driven 7-segment displays.
 
void initializeDisplayHW ()
 Initializes the display for hardware-driven 7-segment displays.
 
void initializeDisplaySW ()
 Initializes the display for software-driven 7-segment displays.
 
void refresh7SegDisplay ()
 Refreshes the display by updating the active digit and its segments.
 
void update7SegmentHWDisplay ()
 Updates the 7-segment display for the next digit (hardware-driven).
 
void update7SegmentSWDisplay ()
 Updates the 7-segment display for the next digit (software-driven).
 

Detailed Description

Functions for managing the 7-segment display.

This group handles the initialization and updates of the 7-segment display. It is used to show numeric data such as power levels, energy consumption, or system status in a simple and clear format.

Features:

Note
The 7-segment display is an alternative to the OLED display for simpler visual feedback.

Function Documentation

◆ configureValueForDisplay()

void configureValueForDisplay ( const bool _EDD_isActive,
const uint16_t _ValueToDisplay,
const bool _diversionEnabled = false,
const bool _loadForced = false )
inline

Configures the value for display on a 7-segment display.

This function controls what is shown on the 7-segment display based on the system state. It handles multiple display modes:

  • "FORC" when a load is in forced override mode
  • "OFF" when diversion is disabled
  • "Walking dots" when energy display is not active
  • Energy values with appropriate decimal point placement
Parameters
_EDD_isActiveA boolean indicating whether the energy display is active.
_ValueToDisplayThe energy value to be displayed (16-bit unsigned integer).
_diversionEnabledA boolean indicating if diversion is enabled (default=true).
_loadForcedA boolean indicating if a load is in forced override mode (default=false).

Display precedence order:

  1. Forced load status (shows "FOrC")
  2. Diversion enabled status (shows "OFF")
  3. Energy display inactive (shows walking dots)
  4. Energy value display

For energy value display:

  • Values up to 9999 show with decimal point after first digit (e.g., 1.234)
  • Values above 9999 are divided by 10 and shown with decimal point after second digit (e.g., 12.34)

7

Definition at line 413 of file utils_display.h.

References charsForDisplay, displayForced(), displayOff(), divmod10(), divu10(), noOfDigitLocations, SEG, SEG_HW, and TYPE_OF_DISPLAY.

Referenced by loop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ displayForced()

void displayForced ( )
inline

Displays "FORC" on the 7-segment display for forced load override.

This function configures the display to show "FORC" when a load is overridden. Uses the existing '0' character definition for 'O' to save memory.

7

Definition at line 372 of file utils_display.h.

References charsForDisplay, SEG, SEG_HW, and TYPE_OF_DISPLAY.

Referenced by configureValueForDisplay().

Here is the caller graph for this function:

◆ displayOff()

void displayOff ( )
inline

Displays "OFF" on the 7-segment display.

This function configures the display to show "OFF" when diversion is disabled. It displays the text right-aligned on the 4-digit display. Uses the existing '0' character definition for 'O' to save memory.

7

Definition at line 350 of file utils_display.h.

References charsForDisplay, SEG, SEG_HW, and TYPE_OF_DISPLAY.

Referenced by configureValueForDisplay().

Here is the caller graph for this function:

◆ initializeDisplay()

void initializeDisplay ( )
inline

Initializes the display for hardware-driven 7-segment displays.

This function determines the type of display (hardware-driven or software-driven) and calls the appropriate initialization function.

7

Definition at line 329 of file utils_display.h.

References initializeDisplayHW(), initializeDisplaySW(), SEG, SEG_HW, and TYPE_OF_DISPLAY.

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeDisplayHW()

void initializeDisplayHW ( )
inline

Initializes the display for hardware-driven 7-segment displays.

This function configures the necessary pin modes and initial states for hardware-driven 7-segment displays. It sets up the decimal point line, control lines for the 74HC4543 7-segment display driver, the enable line, and the control lines for the 74HC138 2-to-4 demultiplexer.

Key operations include:

  • Configuring the IO drivers for the 4-digit display.
  • Setting the pin mode for the decimal point line.
  • Setting up the control lines for the 74HC4543 7-segment display driver.
  • Setting up the enable line for the 74HC4543 7-segment display driver.
  • Setting up the control lines for the 74HC138 2-to-4 demultiplexer.

7

Definition at line 106 of file utils_display.h.

References decimalPointLine, digitLocationLine, digitSelectionLine, DRIVER_CHIP_DISABLED, enableDisableLine, i, noOfDigitLocationLines, noOfDigitSelectionLines, and setPinState().

Referenced by initializeDisplay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeDisplaySW()

void initializeDisplaySW ( )
inline

Initializes the display for software-driven 7-segment displays.

Configures the necessary pin modes and initial states for software-driven 7-segment displays. This includes setting up the segment drive pins and digit selector pins, disabling all digit selector pins, and turning off all segment drive pins initially.

Key operations include:

  • Configuring the pin modes for segment drive pins.
  • Configuring the pin modes for digit selector pins.
  • Disabling all digit selector pins.
  • Turning off all segment drive pins.

7

Definition at line 240 of file utils_display.h.

References DIGIT_DISABLED, digitSelectorPin, i, noOfDigitLocations, noOfSegmentsPerDigit, OFF, segmentDrivePin, and setPinState().

Referenced by initializeDisplay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refresh7SegDisplay()

void refresh7SegDisplay ( )
inline

Refreshes the display by updating the active digit and its segments.

This function manages the display of digits on a 7-segment display. It determines which digit is currently active and updates the display to show the next digit when the current digit's display time has expired. The logic differs based on the type of display hardware.

For DisplayType::SEG_HW:

  • Updates the hardware-driven 7-segment display by disabling the driver chip, setting up the next digit, and enabling the driver chip.

For DisplayType::SEG:

  • Updates the software-driven 7-segment display by deactivating the current digit, setting up the next digit, and activating the corresponding digit-enable line.

7

Definition at line 493 of file utils_display.h.

References MAX_DISPLAY_TIME_COUNT, SEG, SEG_HW, TYPE_OF_DISPLAY, update7SegmentHWDisplay(), and update7SegmentSWDisplay().

Referenced by processRawSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update7SegmentHWDisplay()

void update7SegmentHWDisplay ( )
inline

Updates the 7-segment display for the next digit (hardware-driven).

This function handles the process of updating the 7-segment display by:

  • Disabling the driver chip and decimal point line.
  • Determining the next digit location to activate.
  • Setting up the digit location and character to display.
  • Enabling the driver chip for the new digit.
Note
This function assumes the use of hardware-driven 7-segment displays (DisplayType::SEG_HW).

7

Definition at line 141 of file utils_display.h.

References charsForDisplay, decimalPointLine, digitLocationLine, digitLocationMap, digitSelectionLine, digitValueMap, DRIVER_CHIP_DISABLED, DRIVER_CHIP_ENABLED, enableDisableLine, noOfDigitLocationLines, noOfDigitLocations, noOfDigitSelectionLines, and setPinState().

Referenced by refresh7SegDisplay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update7SegmentSWDisplay()

void update7SegmentSWDisplay ( )
inline

Updates the 7-segment display for the next digit (software-driven).

This function handles the process of updating the 7-segment display for configurations without additional driver chips. It deactivates the current digit, determines the next digit to activate, sets up the segment drivers for the new digit, and activates the corresponding digit-enable line.

Key operations include:

  • Deactivating the currently active digit.
  • Determining the next digit location to activate.
  • Setting up the segment drivers for the character to be displayed.
  • Activating the digit-enable line for the new active location.
Note
This function assumes the use of software-driven 7-segment displays (DisplayType::SEG).

7

Definition at line 285 of file utils_display.h.

References charsForDisplay, DIGIT_DISABLED, DIGIT_ENABLED, digitSelectorPin, noOfDigitLocations, noOfSegmentsPerDigit, segMap, segmentDrivePin, and setPinState().

Referenced by refresh7SegDisplay().

Here is the call graph for this function:
Here is the caller graph for this function: