A concrete QSTR example

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
manseekingknowledge
Posts: 61
Joined: Sun Oct 29, 2017 5:14 pm

A concrete QSTR example

Post by manseekingknowledge » Fri Aug 02, 2019 8:11 pm

QSTR is mentioned a lot in this forum, but other than a short blurb about it under the "Storing strings in flash" section here there doesn't seem to be any concrete examples. I imported my main module and ran the command micropython.qstr_info(1) and the only thing it returned was the name of the module I imported. I guess I was expecting to see... more.

A few questions:

1.) My main module imports a lot of other modules, does micropython.qstr_info(1) run recursively, or do I need to import every single module that ever gets imported before I run micropython.qstr_info(1)?

2.) Will micropython.qstr_info(1) only ever return module names, or will it return actual strings that are in my code?

3.) Does adding QSTRs to qstrdefsport.h work if my modules are already frozen?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: A concrete QSTR example

Post by jimmo » Fri Aug 02, 2019 10:03 pm

If your modules are already frozen, then your strings have already been QSRT-ified.

manseekingknowledge
Posts: 61
Joined: Sun Oct 29, 2017 5:14 pm

Re: A concrete QSTR example

Post by manseekingknowledge » Sat Aug 03, 2019 2:59 am

jimmo wrote:
Fri Aug 02, 2019 10:03 pm
If your modules are already frozen, then your strings have already been QSRT-ified.
Good to know.

Post Reply