mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-04 20:44:02 -06:00
docs: Note 'config' object shouldn't be accessed after initial load
Update Code_Overview.md to note that the config object should not be stored after the "config loading phase". Remove a few inadvertent cases where a 'config' object was stored in module member variables. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
4d4b9684a5
commit
d120a313b7
4 changed files with 6 additions and 4 deletions
|
@ -286,6 +286,11 @@ The following may also be useful:
|
|||
during the `load_config()` or "connect event" phases. Use either
|
||||
`raise config.error("my error")` or `raise printer.config_error("my
|
||||
error")` to report the error.
|
||||
* Do not store a reference to the `config` object in a class member
|
||||
variable (nor in any similar location that may persist past initial
|
||||
module loading). The `config` object is a reference to a "config
|
||||
loading phase" class and it is not valid to invoke its methods after
|
||||
the "config loading phase" has completed.
|
||||
* Use the "pins" module to configure a pin on a micro-controller. This
|
||||
is typically done with something similar to
|
||||
`printer.lookup_object("pins").setup_pin("pwm",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue