prusa3d / Prusa-Firmware

Firmware for Original Prusa i3 3D printer by PrusaResearch
GNU General Public License v3.0
1.99k stars 1.05k forks source link

Add max acceleration mm per s2, feedrates and jerk save and restor du… #4657

Closed 3d-gussner closed 2 months ago

3d-gussner commented 2 months ago

…ring power panic

Thanks to @wavexx in #2456

github-actions[bot] commented 2 months ago

All values in bytes. Δ Delta to base

Target ΔFlash ΔSRAM Used Flash Used SRAM Free Flash Free SRAM
MK3S_MULTILANG 304 0 247762 5653 6190 2539
MK3_MULTILANG 328 0 247064 5662 6888 2530
gudnimg commented 2 months ago

Using eeprom_update_block instead of four 4x eeprom_update_float will save a lot of flash. It’s not faster though, I wonder how much time all of these EEPROM writes add to the power panic.

Quick look at the datasheet for ATmega2560 gives typical EEPROM write time 3.3ms. 60 bytes is ~200ms… assuming its 3.3ms per byte 🤔

3d-gussner commented 2 months ago

It’s not faster though, I wonder how much time all of these EEPROM writes add to the power panic. Quick look at the datasheet for ATmega2560 gives typical EEPROM write time 3.3ms. 60 bytes is ~200ms… assuming its 3.3ms per byte 🤔

Tested on MK404

Also these values are stored with M500 in eeprom, so as long the print profiles don't change a lot I expect not a big increase of time needed while power panic.

Also checked the PrusaSlicer-settings and the Machine limits values didn't change as far I can tell.

Another test with multiple changes in the gcode setting different jerk, accel and feedrates increased to UVLO - end 180 (on MK404 not real printer)

If we want to save these values we need to deal with the time delay when these settings are different to previous eeprom values.

The eeprom_update still costs some ms as it has to read the eeprom and verify if it changed.

@gudnimg Thanks for the hint with eeprom_update_block_notify saved 800 bytes of flash.

gudnimg commented 2 months ago

Also these values are stored with M500 in eeprom, so as long the print profiles don't change a lot I expect not a big increase of time needed while power panic.

Thats a good point. I forgot yesterday that the update functions only do EEPROM write if the value has changed 👍

3d-gussner commented 2 months ago

PR looks good to me, just some minor typos that need fixing

@gudnimg Thanks for the review, fixed the typos