OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
PixelControlNotification Class Reference

Notifications using pixel control. More...

#include <SimWheelTypes.hpp>

Public Member Functions

 PixelControlNotification (PixelControlNotification &other)=delete
 
void operator= (const PixelControlNotification &)=delete
 
virtual void pixelControl_OnStart ()
 Called just once after initialization.
 
virtual void pixelControl_OnBitePoint (uint8_t bitePoint)
 Notify a change in current bite point.
 
virtual void pixelControl_OnConnected ()
 Notify device is connected.
 
virtual void pixelControl_OnBLEdiscovering ()
 Notify device is in discovery mode.
 
virtual void pixelControl_OnSaveSettings ()
 Notify that user settings have been saved to flash memory.
 
virtual void pixelControl_OnLowBattery ()
 Notify low battery.
 
- Public Member Functions inherited from AbstractUserInterface
 AbstractUserInterface (const AbstractUserInterface &)=delete
 
AbstractUserInterfaceoperator= (const AbstractUserInterface &)=delete
 
virtual uint16_t getStackSize ()
 Get the stack size required by this user interface.
 
virtual void onTelemetryData (const TelemetryData *pTelemetryData)
 Notify new telemetry data.
 

Static Public Member Functions

static PixelControlNotificationgetInstance ()
 Get the singleton instance.
 

Protected Member Functions

uint8_t getPixelCount (PixelGroup group)
 Get the count of pixels in a pixel group.
 
void set (PixelGroup group, uint8_t pixelIndex, uint8_t red, uint8_t green, uint8_t blue)
 Set the color of a single pixel.
 
void setAll (PixelGroup group, uint8_t red, uint8_t green, uint8_t blue)
 Set the color of all pixels in a group.
 
void shiftToNext (PixelGroup group)
 Shift all pixel colors to the next pixel index.
 
void shiftToPrevious (PixelGroup group)
 Shift all pixel colors to the previous pixel index.
 
virtual bool renderBatteryLevel (PixelGroup group, bool colorGradientOrPercentage, uint32_t barColor=0x00ACFA70)
 Macro to render the current battery SoC.
 
- Protected Member Functions inherited from AbstractUserInterface
uint32_t frameTimer (uint32_t &timerVariable, uint32_t elapsedTimeMs, uint32_t timeLimitMs)
 Simple timer.
 

Protected Attributes

bool notConnectedYet = true
 Flag to indicate host connection.
 

Additional Inherited Members

- Public Attributes inherited from AbstractUserInterface
bool requiresPowertrainTelemetry = false
 Set to true to receive and use powertrain telemetry data.
 
bool requiresECUTelemetry = false
 Set to true to receive and use ECU telemetry data.
 
bool requiresRaceControlTelemetry = false
 Set to true to receive and use race control telemetry data.
 
bool requiresGaugeTelemetry = false
 Set to true to receive and use telemetry data for gauges.
 

Detailed Description

Notifications using pixel control.

Note
All methods are called in a separate low-priority thread

Definition at line 1247 of file SimWheelTypes.hpp.

Constructor & Destructor Documentation

◆ PixelControlNotification()

PixelControlNotification::PixelControlNotification ( )
inlineprotected

Definition at line 1263 of file SimWheelTypes.hpp.

◆ ~PixelControlNotification()

virtual PixelControlNotification::~PixelControlNotification ( )
inlineprotectedvirtual

Definition at line 1264 of file SimWheelTypes.hpp.

Member Function Documentation

◆ getInstance()

static PixelControlNotification * PixelControlNotification::getInstance ( )
inlinestatic

Get the singleton instance.

Returns
PixelControlNotification* Singleton instance

Definition at line 1357 of file SimWheelTypes.hpp.

◆ getPixelCount()

uint8_t PixelControlNotification::getPixelCount ( PixelGroup group)
protected

Get the count of pixels in a pixel group.

Parameters
groupPixel group
Returns
uin8_t The count of pixels or zero if the group was not configured.

◆ pixelControl_OnBitePoint()

virtual void PixelControlNotification::pixelControl_OnBitePoint ( uint8_t bitePoint)
virtual

Notify a change in current bite point.

Parameters
bitePointLast known bite point.

◆ pixelControl_OnBLEdiscovering()

virtual void PixelControlNotification::pixelControl_OnBLEdiscovering ( )
virtual

Notify device is in discovery mode.

Note
Not called in the USB implementation.

◆ pixelControl_OnConnected()

virtual void PixelControlNotification::pixelControl_OnConnected ( )
virtual

Notify device is connected.

Note
Called in a low priority thread.

◆ pixelControl_OnLowBattery()

virtual void PixelControlNotification::pixelControl_OnLowBattery ( )
virtual

Notify low battery.

Note
Called at timed intervals while the low battery condition persists.

◆ renderBatteryLevel()

virtual bool PixelControlNotification::renderBatteryLevel ( PixelGroup group,
bool colorGradientOrPercentage,
uint32_t barColor = 0x00ACFA70 )
protectedvirtual

Macro to render the current battery SoC.

Note
Does nothing if there is no battery. Pixels are rendered, but not shown yet.
Parameters
groupA group of pixels
colorGradientOrPercentageIf true, show SoC as a color gradient from green to red If false, show SoC as a percentage bar
barColorPacked RGB color to use in the percentage bar.
Returns
True if there is a battery.
False if there is no battery.

◆ set()

void PixelControlNotification::set ( PixelGroup group,
uint8_t pixelIndex,
uint8_t red,
uint8_t green,
uint8_t blue )
protected

Set the color of a single pixel.

Note
Not displayed immediately
Non-existing pixels will be ignored
Parameters
groupThe group to which the pixel is a member
pixelIndexIndex of the pixel in the LED strip (zero-based)
redRed component of the pixel color
greenGreen component of the pixel color
blueBlue component of the pixel color

◆ setAll()

void PixelControlNotification::setAll ( PixelGroup group,
uint8_t red,
uint8_t green,
uint8_t blue )
protected

Set the color of all pixels in a group.

Parameters
groupA group of pixels
redRed component of the pixel color
greenGreen component of the pixel color
blueBlue component of the pixel color

◆ shiftToNext()

void PixelControlNotification::shiftToNext ( PixelGroup group)
protected

Shift all pixel colors to the next pixel index.

Parameters
groupA group of pixels

◆ shiftToPrevious()

void PixelControlNotification::shiftToPrevious ( PixelGroup group)
protected

Shift all pixel colors to the previous pixel index.

Parameters
groupA group of pixels

Member Data Documentation

◆ notConnectedYet

bool PixelControlNotification::notConnectedYet = true
protected

Flag to indicate host connection.

Note
True on startup or connection loss. False after a connection is established. For read only. Do not overwrite.

Definition at line 1275 of file SimWheelTypes.hpp.


The documentation for this class was generated from the following file: