1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-03 04:30:19 +00:00

Added mechanism to estimate the marshaled size of a control.

This commit is contained in:
MartinMueller2003
2024-02-29 16:32:04 -05:00
parent 6dcaf55c84
commit f472dc1158
2 changed files with 20 additions and 4 deletions

View File

@ -89,12 +89,20 @@ public:
void onWsEvent(String& cmd, String& data);
inline bool ToBeDeleted() { return _ToBeDeleted; }
inline bool NeedsSync(uint32_t lastControlChangeID) {return (false == _ToBeDeleted) && (lastControlChangeID < ControlChangeID);}
void SetControlChangedId(uint32_t value) {ControlChangeID = value;}
void SetControlChangedId(uint32_t value) {ControlChangeID = value; EstimateMarshaledSize();}
uint32_t GetEstimatedMarshaledSize() {return EstimatedMarshaledSize;}
private:
bool _ToBeDeleted = false;
uint32_t ControlChangeID = 0;
uint32_t EstimatedMarshaledSize = 0;
String OldValue = emptyString;
// multiplier for converting a typical controller label and value to a Json object
#define JsonMarshalingRatio 6
// estimated number of bytes for the fixed portion of a control rendered as Json
#define MarshalingOverhead 90
void EstimateMarshaledSize();
};
#define UI_TITLE ControlType::Title