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

planner/stepper: simplify ultralcd.h include into lcd.h #4748

Closed
wants to merge 5 commits into from

Conversation

gudnimg
Copy link
Collaborator

@gudnimg gudnimg commented Aug 8, 2024

Move UserECoolEnabled() from ultralcd.cpp into eeprom.cpp since this function has nothing to do with LCD specifically.
To avoid including Prusa_farm.h into epprom.cpp, simply replace farm_mode variable by reading the farm mode from EEPROM directly. This change allows us to remove FarmOrUserECool() function.

The goal is to avoid including ultralcd.h in general since it is a nightmare to unit test as is. Including lcd.h is less of a problem than ultralcd.h


TODO:

  • Unify SILENT_MODE_* and TMC2130_MODE_* preprocessor symbols. From EEPROM perspective these are the same.

Something like this:

// On TMC2130 printers we have either Normal or Stealth mode.
// On non-TMC2130 printers we have Normal (Power), Stealth (Silent), and Auto mode.
enum StepperMode : uint8_t {
  NORMAL = 0,
  STEALTH = 1,
  AUTO = 2,
};

Copy link

github-actions bot commented Aug 8, 2024

All values in bytes. Δ Delta to base

Target ΔFlash ΔSRAM Used Flash Used SRAM Free Flash Free SRAM
MK3S_MULTILANG -92 -1 247644 5652 6308 2540
MK3_MULTILANG -102 -1 246948 5661 7004 2531

@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 8, 2024

I opened another can of worms. Marking as draft for now :) Need to review and do some further cleanup

@gudnimg gudnimg marked this pull request as draft August 8, 2024 16:49
Move UserECoolEnabled from ultralcd.cpp into eeprom.cpp since this function
has nothing to do with LCD specifically.
To avoid including Prusa_farm.h into epprom.cpp, simply replace farm_mode variable by
reading the Farm mode from EEPROM directly. This change allows us to remove
FarmOrUserECool() function.

The goal is to avoid including ultralcd.h in general since it is a nightmare to unit test as is.
stepper_cached_mode is then later updated in change_power_mode_live
@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 10, 2024

I will split this PR into two. The changes to the stealth mode caching need to be reviewed thoroughly. I will open a separate PR with only the changes to stealth mode when I find time.

@gudnimg gudnimg closed this Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant