diff --git a/src/_P096_eInk.ino b/src/_P096_eInk.ino index 3f0489f93e..ed1a02db8c 100644 --- a/src/_P096_eInk.ino +++ b/src/_P096_eInk.ino @@ -355,6 +355,10 @@ boolean Plugin_096(uint8_t function, struct EventStruct *event, String& string) AdaGFXFormTextPrintMode(F("_mode"), P096_CONFIG_FLAG_GET_MODE); + # if ADAGFX_FONTS_INCLUDED + AdaGFXFormDefaultFont(F("deffont"), P096_CONFIG_DEFAULT_FONT); + # endif // if ADAGFX_FONTS_INCLUDED + AdaGFXFormFontScaling(F("_fontscale"), P096_CONFIG_FLAG_GET_FONTSCALE); { @@ -439,6 +443,9 @@ boolean Plugin_096(uint8_t function, struct EventStruct *event, String& string) P096_CONFIG_WIDTH = getFormItemInt(F("_width")); P096_CONFIG_HEIGHT = getFormItemInt(F("_height")); # endif // if !P096_USE_EXTENDED_SETTINGS + # if ADAGFX_FONTS_INCLUDED + P096_CONFIG_DEFAULT_FONT = getFormItemInt(F("deffont")); + # endif // if ADAGFX_FONTS_INCLUDED # if P096_USE_EXTENDED_SETTINGS diff --git a/src/src/PluginStructs/P096_data_struct.cpp b/src/src/PluginStructs/P096_data_struct.cpp index 134898cf71..8d4b348cf3 100644 --- a/src/src/PluginStructs/P096_data_struct.cpp +++ b/src/src/PluginStructs/P096_data_struct.cpp @@ -154,7 +154,11 @@ bool P096_data_struct::plugin_init(struct EventStruct *event) { _fgcolor, _bgcolor, true, - _textBackFill); + _textBackFill + # if ADAGFX_FONTS_INCLUDED + , P096_CONFIG_DEFAULT_FONT + # endif // if ADAGFX_FONTS_INCLUDED + ); # if P096_USE_EXTENDED_SETTINGS if (nullptr != gfxHelper) { @@ -283,7 +287,7 @@ bool P096_data_struct::plugin_read(struct EventStruct *event) { gfxHelper->setColumnRowMode(bitRead(P096_CONFIG_FLAGS, P096_CONFIG_FLAG_USE_COL_ROW)); // Restore column mode int16_t curX, curY; gfxHelper->getCursorXY(curX, curY); // Get current X and Y coordinates, - UserVar.setFloat(event->TaskIndex, 0, curX); // and put into Values + UserVar.setFloat(event->TaskIndex, 0, curX); // and put into Values UserVar.setFloat(event->TaskIndex, 1, curY); eInkScreen->display(); @@ -357,11 +361,9 @@ bool P096_data_struct::plugin_write(struct EventStruct *event, const String& str success = true; } else if (equals(arg1, F("inv"))) { - String arg2 = parseString(string, 3); - int32_t nArg2; + const int nArg2 = event->Par2; - if (validIntFromString(arg2, nArg2) && - (nArg2 >= 0) && + if ((nArg2 >= 0) && (nArg2 <= 1)) { eInkScreen->invertDisplay(nArg2); eInkScreen->display(); @@ -371,11 +373,9 @@ bool P096_data_struct::plugin_write(struct EventStruct *event, const String& str else if (equals(arg1, F("rot"))) { ///control?cmd=epdcmd,rot,0 // not working to verify - String arg2 = parseString(string, 3); - int32_t nArg2; + const int nArg2 = event->Par2; - if (validIntFromString(arg2, nArg2) && - (nArg2 >= 0)) { + if ((nArg2 >= 0)) { eInkScreen->setRotation(nArg2 % 4); eInkScreen->display(); success = true; diff --git a/src/src/PluginStructs/P096_data_struct.h b/src/src/PluginStructs/P096_data_struct.h index d3f52f7ea8..9f6a796287 100644 --- a/src/src/PluginStructs/P096_data_struct.h +++ b/src/src/PluginStructs/P096_data_struct.h @@ -27,6 +27,7 @@ # define P096_CONFIG_ROTATION PCONFIG(1) // Rotation # define P096_CONFIG_WIDTH PCONFIG(2) // Display width # define P096_CONFIG_HEIGHT PCONFIG(3) // Display height +# define P096_CONFIG_DEFAULT_FONT PCONFIG(4) // Default font # define P096_CONFIG_COLORS PCONFIG_ULONG(3) // 2 Colors fit in 1 long