Skip to content

Commit

Permalink
Merge pull request letscontrolit#5186 from tonhuisman/feature/P096-ad…
Browse files Browse the repository at this point in the history
…d-default-font-setting

[P096] Add default font setting
  • Loading branch information
TD-er authored Jan 1, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents ab77ad9 + 8ff5364 commit dba4d7b
Showing 3 changed files with 18 additions and 10 deletions.
7 changes: 7 additions & 0 deletions src/_P096_eInk.ino
Original file line number Diff line number Diff line change
@@ -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

20 changes: 10 additions & 10 deletions src/src/PluginStructs/P096_data_struct.cpp
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions src/src/PluginStructs/P096_data_struct.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dba4d7b

Please sign in to comment.