[P104] Add font with Cyrillic characters in high-ASCII area

This commit is contained in:
Ton Huisman
2026-02-04 15:50:44 +01:00
parent e91f7f98e2
commit b17769acae
4 changed files with 492 additions and 134 deletions
+78 -63
View File
@@ -72,56 +72,60 @@
// Display of the selected zone is suspended until all provided dots are drawn. No quotes are needed around
// the coordinate set.
//
// History:
// 2025-04-03 tonhuisman: Set character spacing correctly when changing fonts
// 2023-10-15 tonhuisman: Code improvements, now using NR_ELEMENTS macro instead of multiple #ifdefs and increments
// Re-enable use of settings-version V3 after some more testing
// 2023-10-08 tonhuisman: Disable use of settings-version V3 for backward compatibility
// 2023-08-15 tonhuisman: Implement Extended CustomTaskSettings, and use that to significantly improve saving the settings on LittleFS by
// a) only storing the settings-version (V3) in regular CustomTaskSettings file, and the rest in the Extended
// CustomTaskSettings file, by using the offset as a starting location for the data elements
// b) Combine storing the size and the data-block in a single save action
// Apply toStringNoZero() converter to reduce the settings-data to be saved
// 2023-08-13 tonhuisman: Add Dot subcommand for pixel-drawing in a zone. Can be applied on any type of zone (so can be overwritten by the
// original content when that's updated...)
// Set default Hardware type to FC16, as that's the most used for modules found on Aliexpress
// 2023-03-07 tonhuisman: Parse text to display without trimming off leading and trailing spaces
// 2022-08-12 tonhuisman: Remove [DEVELOPMENT] tag
// 2021-10-03 tonhuisman: Add Inverted option per zone
// 2021-09 tonhuisman: Minor improvements, attempts to fix stack failures
// 2021-08-08 tonhuisman: Reworked loading & saving the settings from A huge fixed size pre-allocated block to dynamic allocation
// and saving/loading per zone. That should sove the numerous stack related crashes.
// 2021-08-07 tonhuisman: Review feedback: several small improvements and corrections
// 2021-07-18 tonhuisman: Small optimizations and improvements
// 2021-07-14 tonhuisman: Fix some bugs in font selection, add Text reverse content type to improve usability of Vertical font
// 2021-07-12 tonhuisman: Reduce number of reconfiguration during command handling, will be applied the next time content is displayed
// update/correct some documentation
// 2021-07-08 tonhuisman: Several bugfixes: settings defaults, fix brightness to enable 0 value, simplify storing the zone settings
// 2021-06-29-2021-07-03: Add Actions column to insert before/after zone or delete a zone, order the zones either in numeric order
// tonhuisman: or in display order ('upside-down'), fixed many bugs, refactored bar-graph method, other improvements
// All optional at compile-time by P104_USE_ZONE_ACTIONS and P104_USE_ZONE_ORDERING
// Disabled P104_DEBUG_DEV by default
// 2021-06-28 tonhuisman: Bugfixes during testing, re-enable subcommands for ESP8266 display build
// 2021-06-27 tonhuisman: Implement 'barType' option for Bar-graph, bugfixes, bugfixes, bugfixes
// 2021-06-26 tonhuisman: Implement 'direction' option for Bar-graph, bugfixes
// 2021-06-26 tonhuisman: Add update command for updating one or all zones, restart repeat timer if content is updated by command, bugfixes
// 2021-06-24 tonhuisman: Add min/max range with negative minimal value support and zero-point indication if possible
// 2021-06-23 tonhuisman: Add Bar-graph option and bar command (initial feature, options to implement) guarded with P104_USE_BAR_GRAPH
// 2021-06-22 tonhuisman: Add Bar-graph initial code-infrastructure
// 2021-06-21 tonhuisman: Add options for 'formatting' time & date, will be disabled on memory-tight configs guarded by
// P104_USE_DATETIME_OPTIONS
// Introduced guard P104_ADD_SETTINGS_NOTES to disable some addFormNotes() to further reduce code size
// 2021-06-19 tonhuisman: Implement repeat delay, add settxt command, add command reference (above), bug fixing, some source reorganization
// Webform_Load now works on current settings if the plugin is active, instead of last stored settings
// Disabled most commands a some fonts to make the build fit in the ESP8266 display configuration
// 2021-06-18 tonhuisman: Implement PLUGIN_WRITE commands
// Implement several fonts extracted from MD_Parola examples (Vertical, Extended ASCII, Full Double Height, Arabic,
// Greek, Katakana) (NB: Vertical isn't working as expected yet) Will be disabled when flash memory is tight
// 2021-06-16 tonhuisman: Implement Clock and Date (once per second)
// 2021-06-13 tonhuisman: First working version, many improvemnts to make, like command handling, repeat timer implementaation
// 2021-05 tonhuisman: Store and retrieve settings for max 8 (ESP82xx) or 16 (ESP32) zones
// 2021-04 tonhuisman: Pickup and rework to get it working with ESPEasy
// 2021-03 rixtyan : Initial plugin setup, partially based on P073 MAX7219 LED display
/** History/Changelog:
* 2026-02-04 tonhuisman: Add ASCII font with Cyrillic extension characters
* Reformat sources with updated Uncrustify settings, use block-comment for History/Changelog
* 2025-04-03 tonhuisman: Set character spacing correctly when changing fonts
* 2023-10-15 tonhuisman: Code improvements, now using NR_ELEMENTS macro instead of multiple #ifdefs and increments
* Re-enable use of settings-version V3 after some more testing
* 2023-10-08 tonhuisman: Disable use of settings-version V3 for backward compatibility
* 2023-08-15 tonhuisman: Implement Extended CustomTaskSettings, and use that to significantly improve saving the settings on LittleFS by
* a) only storing the settings-version (V3) in regular CustomTaskSettings file, and the rest in the Extended
* CustomTaskSettings file, by using the offset as a starting location for the data elements
* b) Combine storing the size and the data-block in a single save action
* Apply toStringNoZero() converter to reduce the settings-data to be saved
* 2023-08-13 tonhuisman: Add Dot subcommand for pixel-drawing in a zone. Can be applied on any type of zone (so can be overwritten by the
* original content when that's updated...)
* Set default Hardware type to FC16, as that's the most used for modules found on Aliexpress
* 2023-03-07 tonhuisman: Parse text to display without trimming off leading and trailing spaces
* 2022-08-12 tonhuisman: Remove [DEVELOPMENT] tag
* 2021-10-03 tonhuisman: Add Inverted option per zone
* 2021-09 tonhuisman: Minor improvements, attempts to fix stack failures
* 2021-08-08 tonhuisman: Reworked loading & saving the settings from A huge fixed size pre-allocated block to dynamic allocation
* and saving/loading per zone. That should sove the numerous stack related crashes.
* 2021-08-07 tonhuisman: Review feedback: several small improvements and corrections
* 2021-07-18 tonhuisman: Small optimizations and improvements
* 2021-07-14 tonhuisman: Fix some bugs in font selection, add Text reverse content type to improve usability of Vertical font
* 2021-07-12 tonhuisman: Reduce number of reconfiguration during command handling, will be applied the next time content is displayed
* update/correct some documentation
* 2021-07-08 tonhuisman: Several bugfixes: settings defaults, fix brightness to enable 0 value, simplify storing the zone settings
* 2021-06-29-2021-07-03: Add Actions column to insert before/after zone or delete a zone, order the zones either in numeric order
* tonhuisman: or in display order ('upside-down'), fixed many bugs, refactored bar-graph method, other improvements
* All optional at compile-time by P104_USE_ZONE_ACTIONS and P104_USE_ZONE_ORDERING
* Disabled P104_DEBUG_DEV by default
* 2021-06-28 tonhuisman: Bugfixes during testing, re-enable subcommands for ESP8266 display build
* 2021-06-27 tonhuisman: Implement 'barType' option for Bar-graph, bugfixes, bugfixes, bugfixes
* 2021-06-26 tonhuisman: Implement 'direction' option for Bar-graph, bugfixes
* 2021-06-26 tonhuisman: Add update command for updating one or all zones, restart repeat timer if content is updated by command, bugfixes
* 2021-06-24 tonhuisman: Add min/max range with negative minimal value support and zero-point indication if possible
* 2021-06-23 tonhuisman: Add Bar-graph option and bar command (initial feature, options to implement) guarded with P104_USE_BAR_GRAPH
* 2021-06-22 tonhuisman: Add Bar-graph initial code-infrastructure
* 2021-06-21 tonhuisman: Add options for 'formatting' time & date, will be disabled on memory-tight configs guarded by
* P104_USE_DATETIME_OPTIONS
* Introduced guard P104_ADD_SETTINGS_NOTES to disable some addFormNotes() to further reduce code size
* 2021-06-19 tonhuisman: Implement repeat delay, add settxt command, add command reference (above), bug fixing, some source reorganization
* Webform_Load now works on current settings if the plugin is active, instead of last stored settings
* Disabled most commands a some fonts to make the build fit in the ESP8266 display configuration
* 2021-06-18 tonhuisman: Implement PLUGIN_WRITE commands
* Implement several fonts extracted from MD_Parola examples (Vertical, Extended ASCII, Full Double Height, Arabic,
* Greek, Katakana) (NB: Vertical isn't working as expected yet) Will be disabled when flash memory is tight
* 2021-06-16 tonhuisman: Implement Clock and Date (once per second)
* 2021-06-13 tonhuisman: First working version, many improvemnts to make, like command handling, repeat timer implementaation
* 2021-05 tonhuisman: Store and retrieve settings for max 8 (ESP82xx) or 16 (ESP32) zones
* 2021-04 tonhuisman: Pickup and rework to get it working with ESPEasy
* 2021-03 rixtyan : Initial plugin setup, partially based on P073 MAX7219 LED display
*/
# define PLUGIN_104
# define PLUGIN_ID_104 104
@@ -132,12 +136,13 @@
# include "src/PluginStructs/P104_data_struct.h"
boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string) {
boolean success = false;
switch (function) {
case PLUGIN_DEVICE_ADD: {
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
auto& dev = Device[++deviceCount];
dev.Number = PLUGIN_ID_104;
dev.Type = DEVICE_TYPE_SPI;
@@ -146,23 +151,27 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
break;
}
case PLUGIN_SET_DEFAULTS: {
case PLUGIN_SET_DEFAULTS:
{
CONFIG_PORT = -1;
P104_CONFIG_HARDWARETYPE = static_cast<int>(MD_MAX72XX::moduleType_t::FC16_HW);
break;
}
case PLUGIN_GET_DEVICENAME: {
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_104);
break;
}
case PLUGIN_GET_DEVICEGPIONAMES: {
case PLUGIN_GET_DEVICEGPIONAMES:
{
event->String1 = formatGpioName_output(F("CS"));
break;
}
case PLUGIN_WEBFORM_LOAD: {
case PLUGIN_WEBFORM_LOAD:
{
int8_t spi_pins[3];
Settings.getSPI_pins(spi_pins);
int pinnr = -1;
@@ -213,7 +222,8 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
break;
}
case PLUGIN_WEBFORM_SAVE: {
case PLUGIN_WEBFORM_SAVE:
{
P104_data_struct *P104_data = static_cast<P104_data_struct *>(getPluginTaskData(event->TaskIndex));
P104_CONFIG_ZONE_COUNT = getFormItemInt(F("zonecount"));
@@ -244,7 +254,8 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
break;
}
case PLUGIN_INIT: {
case PLUGIN_INIT:
{
uint8_t numDevices = P104_CONFIG_TOTAL_UNITS;
if (numDevices == 0) { // fallback value
@@ -283,7 +294,8 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
break;
}
case PLUGIN_EXIT: {
case PLUGIN_EXIT:
{
P104_data_struct *P104_data = static_cast<P104_data_struct *>(getPluginTaskData(event->TaskIndex));
if ((nullptr == P104_data) || (nullptr == P104_data->P)) {
@@ -298,7 +310,8 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
break;
}
case PLUGIN_WRITE: {
case PLUGIN_WRITE:
{
P104_data_struct *P104_data = static_cast<P104_data_struct *>(getPluginTaskData(event->TaskIndex));
if (nullptr != P104_data) {
@@ -308,7 +321,8 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
break;
}
case PLUGIN_TEN_PER_SECOND: {
case PLUGIN_TEN_PER_SECOND:
{
P104_data_struct *P104_data = static_cast<P104_data_struct *>(getPluginTaskData(event->TaskIndex));
if ((nullptr != P104_data) && (nullptr != P104_data->P)) {
@@ -319,7 +333,8 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
break;
}
case PLUGIN_ONCE_A_SECOND: {
case PLUGIN_ONCE_A_SECOND:
{
P104_data_struct *P104_data = static_cast<P104_data_struct *>(getPluginTaskData(event->TaskIndex));
if ((nullptr != P104_data) && (nullptr != P104_data->P)) {
+108 -45
View File
@@ -117,6 +117,7 @@ bool P104_data_struct::begin() {
- ...
- Max. allowed total custom settings size = 4096
*/
/**************************************
* loadSettings
*************************************/
@@ -337,57 +338,73 @@ void P104_data_struct::configureZones() {
P->setCharSpacing(currentZone, P104_NORMAL_CHAR_SPACING); // Set default font spacing
switch (it->font) {
switch (it->font)
{
# ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
case P104_DOUBLE_HEIGHT_FONT_ID: {
case P104_DOUBLE_HEIGHT_FONT_ID:
{
P->setFont(currentZone, numeric7SegDouble);
P->setCharSpacing(currentZone, P104_DOUBLE_CHAR_SPACING); // double spacing as well
break;
}
# endif // ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
# ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
case P104_FULL_DOUBLEHEIGHT_FONT_ID: {
case P104_FULL_DOUBLEHEIGHT_FONT_ID:
{
P->setFont(currentZone, BigFont);
P->setCharSpacing(currentZone, P104_DOUBLE_CHAR_SPACING); // double spacing as well
break;
}
# endif // ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
# ifdef P104_USE_VERTICAL_FONT
case P104_VERTICAL_FONT_ID: {
case P104_VERTICAL_FONT_ID:
{
P->setFont(currentZone, _fontVertical);
break;
}
# endif // ifdef P104_USE_VERTICAL_FONT
# ifdef P104_USE_EXT_ASCII_FONT
case P104_EXT_ASCII_FONT_ID: {
case P104_EXT_ASCII_FONT_ID:
{
P->setFont(currentZone, ExtASCII);
break;
}
# endif // ifdef P104_USE_EXT_ASCII_FONT
# ifdef P104_USE_ARABIC_FONT
case P104_ARABIC_FONT_ID: {
case P104_ARABIC_FONT_ID:
{
P->setFont(currentZone, fontArabic);
break;
}
# endif // ifdef P104_USE_ARABIC_FONT
# ifdef P104_USE_GREEK_FONT
case P104_GREEK_FONT_ID: {
case P104_GREEK_FONT_ID:
{
P->setFont(currentZone, fontGreek);
break;
}
# endif // ifdef P104_USE_GREEK_FONT
# ifdef P104_USE_KATAKANA_FONT
case P104_KATAKANA_FONT_ID: {
case P104_KATAKANA_FONT_ID:
{
P->setFont(currentZone, fontKatakana);
break;
}
# endif // ifdef P104_USE_KATAKANA_FONT
# ifdef P104_USE_CYRILLIC_EXT_FONT
case P104_CYRILLIC_EXT_FONT_ID:
{
P->setFont(currentZone, font_cyr_ext);
break;
}
# endif // ifdef P104_USE_CYRILLIC_EXT_FONT
// Extend above this comment with more fonts if/when available,
// case P104_DEFAULT_FONT_ID: and default: clauses should be the last options.
// This should also make sure the default font is set if a no longer available font was selected
case P104_DEFAULT_FONT_ID:
default: {
default:
{
P->setFont(currentZone, nullptr); // default font
break;
}
@@ -789,6 +806,7 @@ void P104_data_struct::displayBarGraph(uint8_t zone,
# endif // ifdef P104_USE_BAR_GRAPH
# ifdef P104_USE_DOT_SET
void P104_data_struct::displayDots(uint8_t zone,
const P104_zone_struct& zstruct,
const String & dots) {
@@ -841,7 +859,8 @@ void P104_data_struct::displayDots(uint8_t zone,
bool isAnimationAvailable(uint8_t animation, bool noneIsAllowed = false) {
textEffect_t selection = static_cast<textEffect_t>(animation);
switch (selection) {
switch (selection)
{
case PA_NO_EFFECT:
{
return noneIsAllowed;
@@ -988,6 +1007,7 @@ enum class p104_subcommands_e {
specialeffect, // subcommand: specialeffect,<zone>,<effect> (0..3)
speed, // subcommand: speed,<zone>,<speed_ms> (0..P104_MAX_SPEED_PAUSE_VALUE)
# endif // ifdef P104_USE_COMMANDS
};
/*******************************************************
@@ -1038,7 +1058,8 @@ bool P104_data_struct::handlePluginWrite(taskIndex_t taskIndex,
// subcommands are processed in the same order as they are presented in the UI
for (auto it = zones.begin(); it != zones.end() && !success; ++it) {
if ((it->zone == zoneIndex)) { // This zone
switch (subcommands_e) {
switch (subcommands_e)
{
case p104_subcommands_e::clear:
// subcommand: clear,<zone>
{
@@ -1186,6 +1207,9 @@ bool P104_data_struct::handlePluginWrite(taskIndex_t taskIndex,
# ifdef P104_USE_KATAKANA_FONT
|| (value4 == P104_KATAKANA_FONT_ID)
# endif // ifdef P104_USE_KATAKANA_FONT
# ifdef P104_USE_CYRILLIC_EXT_FONT
|| (value4 == P104_CYRILLIC_EXT_FONT_ID)
# endif // ifdef P104_USE_CYRILLIC_EXT_FONT
)
{
reconfigure = (it->font != value4);
@@ -1407,7 +1431,8 @@ void P104_data_struct::getDate(char *psz,
# ifdef P104_USE_DATETIME_OPTIONS
if (showYear) {
switch (dateFmt) {
switch (dateFmt)
{
case P104_DATE_FORMAT_US:
d = node_time.month();
m = node_time.day();
@@ -1474,7 +1499,8 @@ uint8_t P104_data_struct::getDateTime(char *psz,
# ifdef P104_USE_DATETIME_OPTIONS
switch (dateFmt) {
switch (dateFmt)
{
case P104_DATE_FORMAT_US:
d = node_time.month();
m = node_time.day();
@@ -1500,6 +1526,7 @@ uint8_t P104_data_struct::getDateTime(char *psz,
}
# if defined(P104_USE_NUMERIC_DOUBLEHEIGHT_FONT) || defined(P104_USE_FULL_DOUBLEHEIGHT_FONT)
void P104_data_struct::createHString(String& string) {
const uint16_t stringLen = string.length();
@@ -1545,7 +1572,8 @@ bool P104_data_struct::handlePluginOncePerSecond(struct EventStruct *event) {
redisplay = false;
if (P->getZoneStatus(it->zone - 1)) { // Animations done?
switch (it->content) {
switch (it->content)
{
case P104_CONTENT_TIME: // time
case P104_CONTENT_TIME_SEC: // time sec
{
@@ -2128,6 +2156,9 @@ bool P104_data_struct::webform_load(struct EventStruct *event) {
# ifdef P104_USE_KATAKANA_FONT
, F("Katakana (7)")
# endif // ifdef P104_USE_KATAKANA_FONT
# ifdef P104_USE_CYRILLIC_EXT_FONT
, F("Cyrillic ext. (8)")
# endif // ifdef P104_USE_CYRILLIC_EXT_FONT
};
const int fontOptions[] = {
P104_DEFAULT_FONT_ID
@@ -2152,6 +2183,9 @@ bool P104_data_struct::webform_load(struct EventStruct *event) {
# ifdef P104_USE_KATAKANA_FONT
, P104_KATAKANA_FONT_ID
# endif // ifdef P104_USE_KATAKANA_FONT
# ifdef P104_USE_CYRILLIC_EXT_FONT
, P104_CYRILLIC_EXT_FONT_ID
# endif // ifdef P104_USE_CYRILLIC_EXT_FONT
};
constexpr int fontCount = NR_ELEMENTS(fontTypes);
@@ -2555,25 +2589,39 @@ bool P104_data_struct::webform_save(struct EventStruct *event) {
P104_zone_struct::P104_zone_struct(uint8_t _zone)
: text(F("\"\"")), zone(_zone) {}
bool P104_zone_struct::getIntValue(uint8_t offset, int32_t& value) const
{
switch (offset) {
case P104_OFFSET_SIZE: value = size; break;
switch (offset)
{
case P104_OFFSET_SIZE: value = size;
break;
case P104_OFFSET_TEXT: return false;
case P104_OFFSET_CONTENT: value = content; break;
case P104_OFFSET_ALIGNMENT: value = alignment; break;
case P104_OFFSET_ANIM_IN: value = animationIn; break;
case P104_OFFSET_SPEED: value = speed; break;
case P104_OFFSET_ANIM_OUT: value = animationOut; break;
case P104_OFFSET_PAUSE: value = pause; break;
case P104_OFFSET_FONT: value = font; break;
case P104_OFFSET_LAYOUT: value = layout; break;
case P104_OFFSET_SPEC_EFFECT: value = specialEffect; break;
case P104_OFFSET_OFFSET: value = offset; break;
case P104_OFFSET_BRIGHTNESS: value = brightness; break;
case P104_OFFSET_REPEATDELAY: value = repeatDelay; break;
case P104_OFFSET_INVERTED: value = inverted; break;
case P104_OFFSET_CONTENT: value = content;
break;
case P104_OFFSET_ALIGNMENT: value = alignment;
break;
case P104_OFFSET_ANIM_IN: value = animationIn;
break;
case P104_OFFSET_SPEED: value = speed;
break;
case P104_OFFSET_ANIM_OUT: value = animationOut;
break;
case P104_OFFSET_PAUSE: value = pause;
break;
case P104_OFFSET_FONT: value = font;
break;
case P104_OFFSET_LAYOUT: value = layout;
break;
case P104_OFFSET_SPEC_EFFECT: value = specialEffect;
break;
case P104_OFFSET_OFFSET: value = offset;
break;
case P104_OFFSET_BRIGHTNESS: value = brightness;
break;
case P104_OFFSET_REPEATDELAY: value = repeatDelay;
break;
case P104_OFFSET_INVERTED: value = inverted;
break;
default:
return false;
@@ -2583,22 +2631,37 @@ bool P104_zone_struct::getIntValue(uint8_t offset, int32_t& value) const
bool P104_zone_struct::setIntValue(uint8_t offset, int32_t value)
{
switch (offset) {
case P104_OFFSET_SIZE: size = value; break;
switch (offset)
{
case P104_OFFSET_SIZE: size = value;
break;
case P104_OFFSET_TEXT: return false;
case P104_OFFSET_CONTENT: content = value; break;
case P104_OFFSET_ALIGNMENT: alignment = value; break;
case P104_OFFSET_ANIM_IN: animationIn = value; break;
case P104_OFFSET_SPEED: speed = value; break;
case P104_OFFSET_ANIM_OUT: animationOut = value; break;
case P104_OFFSET_PAUSE: pause = value; break;
case P104_OFFSET_FONT: font = value; break;
case P104_OFFSET_LAYOUT: layout = value; break;
case P104_OFFSET_SPEC_EFFECT: specialEffect = value; break;
case P104_OFFSET_OFFSET: offset = value; break;
case P104_OFFSET_BRIGHTNESS: brightness = value; break;
case P104_OFFSET_REPEATDELAY: repeatDelay = value; break;
case P104_OFFSET_INVERTED: inverted = value; break;
case P104_OFFSET_CONTENT: content = value;
break;
case P104_OFFSET_ALIGNMENT: alignment = value;
break;
case P104_OFFSET_ANIM_IN: animationIn = value;
break;
case P104_OFFSET_SPEED: speed = value;
break;
case P104_OFFSET_ANIM_OUT: animationOut = value;
break;
case P104_OFFSET_PAUSE: pause = value;
break;
case P104_OFFSET_FONT: font = value;
break;
case P104_OFFSET_LAYOUT: layout = value;
break;
case P104_OFFSET_SPEC_EFFECT: specialEffect = value;
break;
case P104_OFFSET_OFFSET: offset = value;
break;
case P104_OFFSET_BRIGHTNESS: brightness = value;
break;
case P104_OFFSET_REPEATDELAY: repeatDelay = value;
break;
case P104_OFFSET_INVERTED: inverted = value;
break;
default:
return false;
+45 -26
View File
@@ -25,23 +25,24 @@
// # endif // if defined(PLUGIN_SET_MAX) || defined(PLUGIN_BUILD_CUSTOM) || ((defined(PLUGIN_DISPLAY_A_COLLECTION) ||
// defined(PLUGIN_DISPLAY_B_COLLECTION)) && defined(ESP32))
# endif // ifdef ESP32
# define P104_USE_FULL_DOUBLEHEIGHT_FONT // Enables the use of a full (lower ascii only) set double height font
# define P104_USE_VERTICAL_FONT // Enables the use of a vertical font
# define P104_USE_EXT_ASCII_FONT // Enables the use of an extended ascii font
# define P104_USE_ARABIC_FONT // Enables the use of a Arabic font (see usage in MD_Parola examples)
# define P104_USE_GREEK_FONT // Enables the use of a Greek font (see usage in MD_Parola examples)
# define P104_USE_KATAKANA_FONT // Enables the use of a Katakana font (see usage in MD_Parola examples)
# define P104_USE_COMMANDS // Enables the use of all commands, not just clear, txt, settxt and update
# define P104_USE_DATETIME_OPTIONS // Enables extra date/time options
# define P104_USE_BAR_GRAPH // Enables the use of Bar-graph feature
# define P104_USE_ZONE_ACTIONS // Enables the use of Actions per zone (New above/New below/Delete)
# define P104_USE_ZONE_ORDERING // Enables the use of Zone ordering (Numeric order (1..n)/Display order (n..1))
# define P104_USE_DOT_SET // Enables the use of Dot-set feature
# define P104_USE_FULL_DOUBLEHEIGHT_FONT // Enables the use of a full (lower ascii only) set double height font
# define P104_USE_VERTICAL_FONT // Enables the use of a vertical font
# define P104_USE_EXT_ASCII_FONT // Enables the use of an extended ascii font
# define P104_USE_ARABIC_FONT // Enables the use of an Arabic font (see usage in MD_Parola examples)
# define P104_USE_GREEK_FONT // Enables the use of a Greek font (see usage in MD_Parola examples)
# define P104_USE_KATAKANA_FONT // Enables the use of a Katakana font (see usage in MD_Parola examples)
# define P104_USE_CYRILLIC_EXT_FONT // Enables the use of an ASCII font with Cyrillic extended characters
# define P104_USE_COMMANDS // Enables the use of all commands, not just clear, txt, settxt and update
# define P104_USE_DATETIME_OPTIONS // Enables extra date/time options
# define P104_USE_BAR_GRAPH // Enables the use of Bar-graph feature
# define P104_USE_ZONE_ACTIONS // Enables the use of Actions per zone (New above/New below/Delete)
# define P104_USE_ZONE_ORDERING // Enables the use of Zone ordering (Numeric order (1..n)/Display order (n..1))
# define P104_USE_DOT_SET // Enables the use of Dot-set feature
# define P104_ADD_SETTINGS_NOTES // Adds some notes on the Settings page
# define P104_ADD_SETTINGS_NOTES // Adds some notes on the Settings page
# if FEATURE_EXTENDED_CUSTOM_SETTINGS && defined(ESP32) && defined(USE_LITTLEFS)
# define P104_FEATURE_STORAGE_V3 1 // Only enable saving in storage for ESP32
# define P104_FEATURE_STORAGE_V3 1 // Only enable saving in storage for ESP32
# else // if FEATURE_EXTENDED_CUSTOM_SETTINGS && defined(ESP32) && defined(USE_LITTLEFS)
# define P104_FEATURE_STORAGE_V3 0
# endif // if FEATURE_EXTENDED_CUSTOM_SETTINGS && defined(ESP32) && defined(USE_LITTLEFS)
@@ -69,6 +70,9 @@
# ifdef P104_USE_KATAKANA_FONT
# undef P104_USE_KATAKANA_FONT
# endif // ifdef P104_USE_KATAKANA_FONT
# ifdef P104_USE_CYRILLIC_EXT_FONT
# undef P104_USE_CYRILLIC_EXT_FONT
# endif // ifdef P104_USE_CYRILLIC_EXT_FONT
// # ifdef P104_USE_COMMANDS
// # undef P104_USE_COMMANDS
// # endif // ifdef P104_USE_COMMANDS
@@ -85,7 +89,8 @@
# undef P104_DEBUG_DEV
# endif // ifdef P104_DEBUG_DEV
# define P104_MEDIUM_ANIMATIONS
# endif // if (defined(PLUGIN_DISPLAY_A_COLLECTION) || defined(PLUGIN_DISPLAY_B_COLLECTION)) && defined(ESP8266) && !defined(LIMIT_BUILD_SIZE)
# endif // if (defined(PLUGIN_DISPLAY_A_COLLECTION) || defined(PLUGIN_DISPLAY_B_COLLECTION)) && defined(ESP8266) &&
// !defined(LIMIT_BUILD_SIZE)
// # define P104_MINIMAL_ANIMATIONS // disable most animations
// # define P104_MEDIUM_ANIMATIONS // disable some complex animations
@@ -140,6 +145,9 @@
# ifdef P104_USE_KATAKANA_FONT
# undef P104_USE_KATAKANA_FONT
# endif // ifdef P104_USE_KATAKANA_FONT
# ifdef P104_USE_CYRILLIC_EXT_FONT
# undef P104_USE_CYRILLIC_EXT_FONT
# endif // ifdef P104_USE_CYRILLIC_EXT_FONT
# endif // ifdef LIMIT_BUILD_SIZE
# if defined(P104_USE_TOOLTIPS) && !FEATURE_TOOLTIPS
@@ -317,6 +325,13 @@ const uint8_t P104_DOUBLE_CHAR_SPACING = 2; // Character spacing for double-heig
# include "../Static/Fonts/P104_font_katakana.h"
# endif // ifdef P104_USE_KATAKANA_FONT
# ifdef P104_USE_CYRILLIC_EXT_FONT
# define P104_CYRILLIC_EXT_FONT_ID 8
# include "../Static/Fonts/P104_font_cyr_ext.h"
# endif // ifdef P104_USE_CYRILLIC_EXT_FONT
struct P104_zone_struct {
P104_zone_struct() = delete; // Not used, so leave out explicitly
P104_zone_struct(uint8_t _zone);
@@ -350,6 +365,7 @@ struct P104_zone_struct {
int32_t& value) const;
bool setIntValue(uint8_t offset,
int32_t value);
};
# ifdef P104_USE_BAR_GRAPH
@@ -363,7 +379,9 @@ struct P104_bargraph_struct {
uint8_t graph;
uint8_t barType = 0u;
uint8_t direction = 0u;
};
# endif // ifdef P104_USE_BAR_GRAPH
struct P104_data_struct : public PluginTaskData_base {
@@ -379,20 +397,17 @@ struct P104_data_struct : public PluginTaskData_base {
void loadSettings();
bool webform_load(struct EventStruct *event);
bool webform_save(struct EventStruct *event);
String getError() {
return error;
}
void configureZones();
String getError() { return error; }
void setZones(uint16_t _zones) {
expectedZones = _zones;
}
void configureZones();
bool handlePluginWrite(taskIndex_t taskIndex,
const String& string);
bool handlePluginOncePerSecond(struct EventStruct *event);
void checkRepeatTimer(uint8_t z);
void setZones(uint16_t _zones) { expectedZones = _zones; }
bool handlePluginWrite(taskIndex_t taskIndex,
const String& string);
bool handlePluginOncePerSecond(struct EventStruct *event);
void checkRepeatTimer(uint8_t z);
MD_Parola *P = nullptr;
@@ -490,9 +505,13 @@ private:
struct {
uint16_t P104_dataSize;
char P104_data[P104_SETTINGS_BUFFER_V2 + 1];
};
uint8_t P104_storeThis[P104_SETTINGS_BUFFER_V2 + 1 + sizeof(uint16_t)]{};
};
};
#endif // ifdef USES_P104
+261
View File
@@ -0,0 +1,261 @@
#pragma once
MD_MAX72XX::fontType_t font_cyr_ext[] PROGMEM = // ASCII with Cyrillic extension
{
0, // 0 - 'Unused'
0, // 1 - 'Unused'
0, // 2 - 'Unused'
0, // 3 - 'Unused'
0, // 4 - 'Unused'
0, // 5 - 'Unused'
0, // 6 - 'Unused'
0, // 7 - 'Unused'
0, // 8 - 'Unused'
0, // 9 - 'Unused'
0, // 10 - 'Unused'
0, // 11 - 'Unused'
0, // 12 - 'Unused'
0, // 13 - 'Unused'
0, // 14 - 'Unused'
0, // 15 - 'Unused'
0, // 16 - 'Unused'
0, // 17 - 'Unused'
0, // 18 - 'Unused'
0, // 19 - 'Unused'
0, // 20 - 'Unused'
0, // 21 - 'Unused'
0, // 22 - 'Unused'
0, // 23 - 'Unused'
0, // 24 - 'Unused'
0, // 25 - 'Unused'
0, // 26 - 'Unused'
0, // 27 - 'Unused'
0, // 28 - 'Unused'
0, // 29 - 'Unused'
0, // 30 - 'Unused'
0, // 31 - 'Unused'
2, 0, 0, // 32 - 'Space'
1, 95, // 33 - '!'
3, 7, 0, 7, // 34 - '"'
5, 20, 127, 20, 127, 20, // 35 - '#'
5, 36, 42, 127, 42, 18, // 36 - '$'
5, 35, 19, 8, 100, 98, // 37 - '%'
5, 54, 73, 86, 32, 80, // 38 - '&'
2, 4, 3, // 39
3, 28, 34, 65, // 40 - '('
3, 65, 34, 28, // 41 - ')'
5, 42, 28, 127, 28, 42, // 42 - '*'
5, 8, 8, 62, 8, 8, // 43 - '+'
2, 128, 96, // 44 - ','
5, 8, 8, 8, 8, 8, // 45 - '-'
2, 96, 96, // 46 - '.'
5, 32, 16, 8, 4, 2, // 47 - '/'
5, 62, 81, 73, 69, 62, // 48 - '0'
3, 66, 127, 64, // 49 - '1'
5, 114, 73, 73, 73, 70, // 50 - '2'
5, 33, 65, 73, 77, 51, // 51 - '3'
5, 24, 20, 18, 127, 16, // 52 - '4'
5, 39, 69, 69, 69, 57, // 53 - '5'
5, 60, 74, 73, 73, 49, // 54 - '6'
5, 65, 33, 17, 9, 7, // 55 - '7'
5, 54, 73, 73, 73, 54, // 56 - '8'
5, 70, 73, 73, 41, 30, // 57 - '9'
1, 20, // 58 - ':'
2, 128, 104, // 59 - ';'
4, 8, 20, 34, 65, // 60 - '<'
5, 20, 20, 20, 20, 20, // 61 - '='
4, 65, 34, 20, 8, // 62 - '>'
5, 2, 1, 89, 9, 6, // 63 - '?'
5, 62, 65, 93, 89, 78, // 64 - '@'
5, 124, 18, 17, 18, 124, // 65 - 'A'
5, 127, 73, 73, 73, 54, // 66 - 'B'
5, 62, 65, 65, 65, 34, // 67 - 'C'
5, 127, 65, 65, 65, 62, // 68 - 'D'
5, 127, 73, 73, 73, 65, // 69 - 'E'
5, 127, 9, 9, 9, 1, // 70 - 'F'
5, 62, 65, 65, 81, 115, // 71 - 'G'
5, 127, 8, 8, 8, 127, // 72 - 'H'
3, 65, 127, 65, // 73 - 'I'
5, 32, 64, 65, 63, 1, // 74 - 'J'
5, 127, 8, 20, 34, 65, // 75 - 'K'
5, 127, 64, 64, 64, 64, // 76 - 'L'
5, 127, 2, 28, 2, 127, // 77 - 'M'
5, 127, 4, 8, 16, 127, // 78 - 'N'
5, 62, 65, 65, 65, 62, // 79 - 'O'
5, 127, 9, 9, 9, 6, // 80 - 'P'
5, 62, 65, 81, 33, 94, // 81 - 'Q'
5, 127, 9, 25, 41, 70, // 82 - 'R'
5, 38, 73, 73, 73, 50, // 83 - 'S'
5, 3, 1, 127, 1, 3, // 84 - 'T'
5, 63, 64, 64, 64, 63, // 85 - 'U'
5, 31, 32, 64, 32, 31, // 86 - 'V'
5, 63, 64, 56, 64, 63, // 87 - 'W'
5, 99, 20, 8, 20, 99, // 88 - 'X'
5, 3, 4, 120, 4, 3, // 89 - 'Y'
5, 97, 89, 73, 77, 67, // 90 - 'Z'
3, 127, 65, 65, // 91 - '['
5, 2, 4, 8, 16, 32, // 92 - '\'
3, 65, 65, 127, // 93 - ']'
5, 4, 2, 1, 2, 4, // 94 - '^'
5, 64, 64, 64, 64, 64, // 95 - '_'
2, 3, 4, // 96 - '`'
5, 32, 84, 84, 120, 64, // 97 - 'a'
5, 127, 40, 68, 68, 56, // 98 - 'b'
5, 56, 68, 68, 68, 40, // 99 - 'c'
5, 56, 68, 68, 40, 127, // 100 - 'd'
5, 56, 84, 84, 84, 24, // 101 - 'e'
4, 8, 126, 9, 2, // 102 - 'f'
5, 24, 164, 164, 156, 120, // 103 - 'g'
5, 127, 8, 4, 4, 120, // 104 - 'h'
3, 68, 125, 64, // 105 - 'i'
4, 64, 128, 128, 122, // 106 - 'j'
4, 127, 16, 40, 68, // 107 - 'k'
3, 65, 127, 64, // 108 - 'l'
5, 124, 4, 120, 4, 120, // 109 - 'm'
5, 124, 8, 4, 4, 120, // 110 - 'n'
5, 56, 68, 68, 68, 56, // 111 - 'o'
5, 252, 24, 36, 36, 24, // 112 - 'p'
5, 24, 36, 36, 24, 252, // 113 - 'q'
5, 124, 8, 4, 4, 8, // 114 - 'r'
5, 72, 84, 84, 84, 36, // 115 - 's'
4, 4, 63, 68, 36, // 116 - 't'
5, 60, 64, 64, 32, 124, // 117 - 'u'
5, 28, 32, 64, 32, 28, // 118 - 'v'
5, 60, 64, 48, 64, 60, // 119 - 'w'
5, 68, 40, 16, 40, 68, // 120 - 'x'
5, 76, 144, 144, 144, 124, // 121 - 'y'
5, 68, 100, 84, 76, 68, // 122 - 'z'
3, 8, 54, 65, // 123 - '{'
1, 119, // 124 - '|'
3, 65, 54, 8, // 125 - '}'
5, 2, 1, 2, 4, 2, // 126 - '~'
0, // 127 - 'Unused'
5, 252, 36, 36, 36, 24, // 128 - 'р'
5, 120, 132, 132, 132, 72, // 129 - 'с'
5, 4, 4, 252, 4, 4, // 130 - 'т'
5, 76, 144, 144, 144, 124, // 131 - 'у'
5, 56, 68, 254, 68, 56, // 132 - 'ф'
5, 196, 40, 16, 40, 196, // 133 - 'х'
5, 124, 64, 64, 124, 192, // 134 - 'ц'
5, 28, 32, 32, 32, 252, // 135 - 'ч'
5, 252, 128, 252, 128, 252, // 136 - 'ш'
5, 124, 64, 124, 64, 252, // 137 - 'щ'
5, 4, 252, 144, 144, 96, // 138 - 'ъ'
5, 252, 144, 240, 0, 252, // 139 - 'ы'
4, 252, 144, 144, 96, // 140 - 'ь'
5, 72, 132, 148, 148, 120, // 141 - 'э'
5, 252, 32, 252, 132, 252, // 142 - 'ю'
5, 24, 164, 100, 36, 252, // 143 - 'я'
5, 248, 36, 34, 33, 255, // 144 - 'А'
5, 255, 137, 137, 137, 112, // 145 - 'Б'
5, 255, 137, 137, 137, 118, // 146 - 'В'
4, 255, 1, 1, 3, // 147 - 'Г'
6, 192, 126, 65, 65, 127, 192, // 148 - 'Д'
4, 255, 137, 137, 129, // 149 - 'Е'
5, 247, 8, 255, 8, 247, // 150 - 'Ж'
5, 66, 129, 137, 137, 118, // 151 - 'З'
5, 255, 32, 16, 8, 255, // 152 - 'И'
5, 254, 32, 17, 8, 254, // 153 - 'Й'
5, 255, 8, 20, 34, 193, // 154 - 'К'
5, 128, 124, 2, 1, 255, // 155 - 'Л'
5, 255, 4, 24, 4, 255, // 156 - 'М'
5, 255, 8, 8, 8, 255, // 157 - 'Н'
5, 126, 129, 129, 129, 126, // 158 - 'О'
5, 255, 1, 1, 1, 255, // 159 - 'П'
5, 255, 17, 17, 17, 14, // 160 - 'Р'
5, 126, 129, 129, 129, 66, // 161 - 'С'
5, 3, 1, 255, 1, 3, // 162 - 'Т'
5, 71, 136, 144, 144, 127, // 163 - 'У'
5, 60, 66, 255, 66, 60, // 164 - 'Ф'
5, 227, 20, 8, 20, 227, // 165 - 'Х'
5, 127, 64, 64, 127, 192, // 166 - 'Ц'
5, 15, 16, 16, 16, 255, // 167 - 'Ч'
5, 255, 128, 254, 128, 255, // 168 - 'Ш'
5, 127, 64, 126, 64, 255, // 169 - 'Щ'
5, 1, 255, 136, 136, 112, // 170 - 'Ъ'
5, 255, 132, 120, 0, 255, // 171 - 'Ы'
4, 255, 136, 136, 112, // 172 - 'Ь'
5, 66, 129, 137, 137, 126, // 173 - 'Э'
6, 255, 16, 126, 129, 129, 126, // 174 - 'Ю'
5, 142, 81, 49, 17, 255, // 175 - 'Я'
5, 96, 148, 148, 248, 128, // 176 - 'а'
4, 252, 148, 148, 96, // 177 - 'б'
4, 252, 148, 148, 104, // 178 - 'в'
4, 252, 4, 4, 12, // 179 - 'г'
5, 192, 124, 68, 124, 192, // 180 - 'д'
5, 120, 164, 164, 164, 24, // 181 - 'е'
5, 236, 16, 252, 16, 236, // 182 - 'ж'
5, 72, 132, 148, 148, 104, // 183 - 'з'
5, 252, 64, 32, 16, 252, // 184 - 'и'
5, 252, 64, 34, 16, 252, // 185 - 'й'
5, 252, 16, 40, 68, 128, // 186 - 'к'
5, 128, 240, 8, 4, 252, // 187 - 'л'
5, 252, 16, 224, 16, 252, // 188 - 'м'
5, 252, 16, 16, 16, 252, // 189 - 'н'
5, 120, 132, 132, 132, 120, // 190 - 'о'
5, 252, 4, 4, 4, 252, // 191 - 'п'
0, // 192
0, // 193
0, // 194
0, // 195
0, // 196
0, // 197
0, // 198
0, // 199
0, // 200
0, // 201
0, // 202
0, // 203
0, // 204
0, // 205
0, // 206
0, // 207
0, // 208
0, // 209
0, // 210
0, // 211
0, // 212
0, // 213
0, // 214
0, // 215
0, // 216
0, // 217
0, // 218
0, // 219
0, // 220
0, // 221
0, // 222
0, // 223
0, // 224
0, // 225
0, // 226
0, // 227
0, // 228
0, // 229
0, // 230
0, // 231
0, // 232
0, // 233
0, // 234
0, // 235
0, // 236
0, // 237
0, // 238
0, // 239
0, // 240
0, // 241
0, // 242
0, // 243
0, // 244
0, // 245
0, // 246
0, // 247
0, // 248
0, // 249
0, // 250
0, // 251
0, // 252
0, // 253
0, // 254
0, // 255
};