Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PROGMEM-based text strings #1

Closed
ImpulseAdventure opened this issue Dec 26, 2016 · 1 comment
Closed

Add support for PROGMEM-based text strings #1

ImpulseAdventure opened this issue Dec 26, 2016 · 1 comment

Comments

@ImpulseAdventure
Copy link
Owner

Feature request: add support for read-only text strings located in PROGMEM (flash)

  • Enabling such a method would support optimized SRAM usage on Arduino
  • User calls with PSTR(). ElemCreateTxt() / ElemCreate() may require typecasting param with (const char *)
  • DrvDrawTxt() could use pgm_read_byte()
  • Consider creating enum (GSLC_TXT_PROGMEM with negative value) in place of buffer length to flag the string as requiring PROGMEM access versus SRAM. Change nStrBufMax params to be int16_t instead of uint16_t.

Example:

  static const char mstr[] PROGMEM = "Count:";
  pElem = gslc_ElemCreateTxt(&m_gui,GSLC_ID_AUTO,E_PG_MAIN,(gslc_tsRect){20,60,50,10},
    (const char*)mstr,GSLC_TXT_PROGMEM,E_FONT_TXT);
@ImpulseAdventure
Copy link
Owner Author

This feature has been added to GUIslice v0.8.1. From user code perspective only real change is extra call to gslc_ElemSetTxtMem().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant