Public Access
Refresh effect per page
Pages choose their own refresh effect (or the Hardware setting), used when the page appears and for its own changes. Schedule blocks that switch instantly and rules still switch instantly. The ESP32 sends page effects to the Nano with a new no-save flag (E ...,2), so page switches don't wear the Nano's EEPROM. Page format 7 (version 6 pages are converted). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6b946e17c
commit
a904615c51
29 files changed
+152
-17
No files matched your search
@@ -161,6 +161,8 @@ const char *validatePage(const DynamicPage &page)
|
||||
return "Too many time slots";
|
||||
if (page.element_count > PAGE_ELEMENTS)
|
||||
return "Too many elements";
|
||||
if (page.effect != PAGE_EFFECT_DEFAULT && page.effect >= PAGE_EFFECT_COUNT)
|
||||
return "Unknown refresh effect";
|
||||
|
||||
for (int i = 0; i < page.slot_count; i++)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,9 @@ const int ELEMENT_ENTITY_SIZE = 65;
|
||||
const int ELEMENT_ATTRIBUTE_SIZE = 33;
|
||||
const int ELEMENT_MAP_SIZE = 64;
|
||||
const char DEGREE_SIGN = 127;
|
||||
// DynamicPage::effect: the refresh effect of the Hardware settings
|
||||
const uint8_t PAGE_EFFECT_DEFAULT = 255;
|
||||
const uint8_t PAGE_EFFECT_COUNT = 10; // DRIVE_EFFECT_COUNT (checked in logic/settings.cpp)
|
||||
|
||||
enum class ElementType : uint8_t
|
||||
{
|
||||
@@ -184,6 +187,10 @@ struct DynamicPage
|
||||
PageSlot slots[PAGE_SLOTS];
|
||||
uint8_t element_count = 0;
|
||||
PageElement elements[PAGE_ELEMENTS];
|
||||
// Added in page format 7 (keep new fields at the end, see display/page_store.cpp).
|
||||
// The refresh effect while the page is shown (switching to it and its own changes):
|
||||
// PAGE_EFFECT_DEFAULT or a DRIVE_EFFECT_* number of logic/settings.h
|
||||
uint8_t effect = PAGE_EFFECT_DEFAULT;
|
||||
};
|
||||
|
||||
// Back to an empty page with the defaults, without `page = DynamicPage()`: that can put a
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "logic/bitmap_format.h"
|
||||
|
||||
static_assert(PAGE_EFFECT_COUNT == DRIVE_EFFECT_COUNT, "pages choose from the same effects");
|
||||
|
||||
static bool terminated(const char *text, int size)
|
||||
{
|
||||
return memchr(text, '\0', size) != nullptr;
|
||||
|
||||
Reference in new issue
Block a user