firmware/src/graphics/niche/InkHUD/DisplayHealth.h
todd-herbert e6a98b1d6b
InkHUD refactoring (#6216)
* chore: todo.txt
* chore: comments
* fix: no fast refresh on VME290
Reverts a line of code which was accidentally committed
* refactor: god class
Divide the behavior from the old WindowManager class into several subclasses which each have a clear role.
* refactor: cppcheck medium warnings
Enough to pass github CI for now
* refactor: updateType selection
* refactor: don't use a setter for the shared AppletFonts
* fix: update prioritization
forceUpdate calls weren't being prioritized
* refactor: remove unhelpful logging
getTimeString is used for parsing our own time, but also the timestamps of messages. The "one time only" log printing will likely fire in unhelpful situations.
* fix: " "
* refactor: get rid of types.h file for enums
* Keep that sneaky todo file out of commits
2025-03-06 11:25:41 +01:00

53 lines
1.5 KiB
C++

#ifdef MESHTASTIC_INCLUDE_INKHUD
/*
Responsible for maintaining display health, by optimizing the ratio of FAST vs FULL refreshes
- counts number of FULL vs FAST refresh
- suggests whether to use FAST or FULL, when not explicitly specified
- periodically requests update unprovoked, if required for display health
*/
#pragma once
#include "configuration.h"
#include "InkHUD.h"
#include "graphics/niche/Drivers/EInk/EInk.h"
namespace NicheGraphics::InkHUD
{
class DisplayHealth : protected concurrency::OSThread
{
public:
DisplayHealth();
void requestUpdateType(Drivers::EInk::UpdateTypes type);
void forceUpdateType(Drivers::EInk::UpdateTypes type);
Drivers::EInk::UpdateTypes decideUpdateType();
uint8_t fastPerFull = 5; // Ideal number of fast refreshes between full refreshes
float stressMultiplier = 2.0; // How bad for the display are extra fast refreshes beyond fastPerFull?
private:
int32_t runOnce() override;
void beginMaintenance(); // Excessive debt: begin unprovoked refreshing of display, for health
int32_t endMaintenance(); // End unprovoked refreshing: debt paid
Drivers::EInk::UpdateTypes
prioritize(Drivers::EInk::UpdateTypes type1,
Drivers::EInk::UpdateTypes type2); // Determine which of two update types is more important to honor
bool forced = false;
Drivers::EInk::UpdateTypes workingDecision = Drivers::EInk::UpdateTypes::UNSPECIFIED;
float debt = 0.0; // How many full refreshes are due
};
} // namespace NicheGraphics::InkHUD
#endif