Commit Graph

7407 Commits

Author SHA1 Message Date
D.R.racer ffb6a2ae0c Generalize description of MMU MCU power errors
as requested in Prusa-Error-Codes PR#97

There will be more separate sources of MCU power errors in the future and reporting each of them separately doesn't make much sense
- especially when the only thing a user can do about it is to check the connectors.

So based on this, the error title has changed a bit (we are not using the full text description in 8bit FW)

Also, update perform the related changes in PO files + add (machine generated) translations.
2023-07-20 12:32:30 +02:00
Guðni Már Gilbert 03e7ff1983 power panic: optimise incrementing EEPROM statistics
Change in memory:
Flash: -26 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 2cd5ab2349 power panic: add readable flags and optimise ISR(INT4_vect)
Add more readable names for the EEPROM_UVLO values

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 4dc5d97ca9 power panic: remove unused EEPROM_UVLO_Z_MICROSTEPS
It isn't very helpful IMO to have unused code during power panic
it just complicates things.

Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert d5125c6b1e power panic: refactor log output on recovery
Use M114 to print coordinates for all axis. We save
a lot of memory by reusing the M114 code

Change in memory:
Flash: -184 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 005f9f0d24 power panic: Fix an error in saved position
planner_abort_hard() calls planner_reset_position() which
will set current_position vector to the machine position.
We want to save this position when there is no position already saved
(i.e. when there is no partial back-up or a saved print in RAM)

When a power outage comes, the printer is in the middle of a gcode move.
And at the moment a gcode is executed by the planner, the planner will update
current_position vector to the final destination vector. This means current_position
vector is invalidated during a power outage and so we must check what the
actual machine position is instead and save it.

This was working correctly before, this commit only fixes the regression
in my pull request.

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 5ee7ba84e3 fix build 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert fa843a4a9b power panic: implement partial back up in RAM
A partial backup is needed in scenarios where the extruder may be
parked after a print is saved. For example during a blocking wait for the user in M600
Or during a MMU error screen.

A sudden power panic at this point would previously save the parked position
into EEPROM. When the print is recovered it would print in mid air.
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 10ed195531 power panic: use saved position consistently
1) current_position[Z_AXIS] is not always correct. saved_pos[Z_AXIS]
    should always represent the correct resume position for the Z-axis
2) Use the saved position to fetch the Z-offset value from
    the mesh bed leveling grid. In case the extruder is parked during
    power panic, the previous code may extract the wrong mesh
    bed leveling offset (due to extruder being located at different
    X and Y axis coordinates)
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 392c46c7ad power panic: pull INT4 string into PROGMEM
Change in memory:
Flash: -4 bytes
SRAM 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 6d902d6437 power panic: store saved_fan_speed in EEPROM
fanSpeed may have an outdated value
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 44bedcd941 power panic: cleanup: remove commented code 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 62a3d179f0 optimisation: read/write EEPROM_UVLO_SAVED_START_POSITION block
I verified via printf that sizeof(saved_start_position) = 16 (i.e. 4 float values)
We simply want to write 16 bytes to address
EEPROM_UVLO_SAVED_START_POSITION

Change in memory:
Flash: -160 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 6ccd12c7e8 power panic: re-use saved_pos
This allows us to restore the position of all axis saved in RAM

If the extruder had been parked to the side for example
due to filament runout. Then the original position (before parking)
should now be restored

Change in memory:
Flash: +40 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 97c27525d4 power panic: re-use saved_extruder_relative_mode
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert a2ac513794 power panic: re-use target temps from RAM
If a print has been saved to RAM such as during a filament runout,
do not overwrite these saved values if a sudden
power panic appears.

Additionally, change the saved types to be the same as power panic when saving to RAM:
- Bed target temperature is uint8_t (0 to 255) instead of float
- Extruder target temperature is uint16_t instead of float

Doing this change allows us to re-use the same global variables and
avoid creating local variables during power panic.

Change in memory:
Flash: -246 bytes
SRAM: -5 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert b65c500f25 power panic: Add comments about conserving power 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert a45e432030 power panic: Re-use code to save feedrate, segment index, and start position
Saves ~80B of Flash
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 67403603ed power panic: Re-use saving print file state
This also adds the Gcode position into EEPROM
for Octoprint/PrusaLink prints.
Though the recovery part doesn't support that yet.
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 2902fcaa71 power panic: Add two functions
These functions should be able to be re-used during a power panic

- save_print_file_state
- restore_print_file_state

No functional change at the moment.
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 526a1dcc63 power panic: Move code into a separate file 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 5295bfa040 Remove dead macro timer02_set_pwm0
It looks like it was removed here
https://github.com/prusa3d/Prusa-Firmware/pull/1979
4 years ago

No change in memory
2023-07-14 14:28:14 +02:00
Guðni Már Gilbert b6572066f4 optimisation: compare uint16_t against uint16_t
We're assigning step_rate with the 16-bit value of final_rate
I would expect the comparison to be 16-bit also then.

Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
2023-07-13 11:11:45 +02:00
RoboMagus 2d461572dd Fix command parameters offset 2023-07-13 11:05:29 +02:00
RoboMagus 4450dbe4dd Update serial echo macro to print from PGM 2023-07-13 11:05:29 +02:00
RoboMagus d9e6dd4efe Update usage comment 2023-07-13 11:05:29 +02:00
RoboMagus 5baa74a425 Add M118 Gcode support 2023-07-13 11:05:29 +02:00
3d-gussner 7f95c54305 Move `Language update` to first row 2023-07-13 10:08:09 +02:00
Guðni Már Gilbert 6784c6919b cleanup: remove TMC2130 ifdef in lcd_selfcheck_axis
This function is no longer included in the firmware
when using TMC2130

Also removed commented code
2023-07-13 10:06:21 +02:00
Guðni Már Gilbert 70ae3353ce MMU: Disable E-motor after Try-load-unload
The filament is never in the nozzle at this point so there
should be no oozing.

When a single material MMU print, I can hear audible noise
from the motor after executing Tx code. After some timeout
(while the heaters still heating up) I can hear the firmware
disable the E-motor. But we can safely disable it immediately
after the try-load-unload sequence.

Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-07-13 10:04:20 +02:00
Guðni Már Gilbert 06c42bf85f MMU: Remove a call to Enable_E0
The planner enables the E-motor automatically
No need to do it manually

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-07-13 10:04:20 +02:00
Guðni Már Gilbert 4abdb0225d PFW-1527 FILAMENT_EJECTED should not increment fail statistic
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-07-13 10:01:27 +02:00
Guðni Már Gilbert 434386e6cc Log event when planner is aborted
It may be useful to see if any moves are lost

Change in memory:
Flash: +32 bytes
SRAM: 0 bytes
2023-07-13 10:00:16 +02:00
Guðni Már Gilbert f13d657c7e Remove Marlin.h include in backlight.h
Also removed it from sound.cpp, only include what is really required
2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 749360db0f Remove mesh bed leveling include 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 34ef9665cd Remove two ultralcd includes 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 9cc9af14bd Remove unnecessary la10compat include 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert b0ff5f45f3 Cleanup language.h includes
Remove a few redundant language.h includes

Also remove language.h include from cmdqueue.h to prevent including language.h unnecessarily

Fix missing message.h includes in a few files
2023-07-13 09:57:52 +02:00
Guðni Már Gilbert ee074eb548 Remove eeprom.h include in SpoolJoin header 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 37a73e91c6 Remove MMU2 include in stepper.cpp
Nothing is used from the MMU class in this file
2023-07-13 09:57:52 +02:00
Alex Voinea e91ee4a5db Change uint8_t* cast to long* 2023-07-13 09:54:33 +02:00
Alex Voinea 8149853fc9 Optimize `st_set_position()` for speed and size
flash: -186
SRAM: 0
time: x0.45
2023-07-13 09:54:33 +02:00
Guðni Már Gilbert ef4efc22c3 PFW-1528 Intercept register 0x14
This commit syncs the 8-bit firmware with the 32-bit

Change in memory:
Flash: +56 bytes
SRAM: 0 bytes
2023-07-13 08:00:11 +02:00
3d-gussner 079e4c9112
Merge pull request #4254 from 3d-gussner/MK3_UPDATE_DOXYGEN_PO
Update doxygen and po files
2023-06-29 10:38:12 +02:00
3d-gussner 9421785190 Update doxygen and po files 2023-06-29 08:23:13 +02:00
3d-gussner 7c7cbe62ca
Merge pull request #4251 from 3d-gussner/MK3_REVO_HF_60W_MMU3
Update REVO HF 60W to MMU3
2023-06-29 06:38:44 +02:00
3d-gussner 3ddd691f44 Update REVO HF 60W to MMU3 2023-06-28 17:15:14 +02:00
3d-gussner b872b59bd9
Merge pull request #4246 from 3d-gussner/MK3_REVO_HF_60W
Add REVO High Flow 60W variant
2023-06-28 09:14:45 +02:00
3d-gussner 10e2357cc5 Change MMU2 to MMU3 2023-06-27 11:41:09 +02:00
3d-gussner 136ef9696d Do not check MMU version with `M862.3` for MK3|MK3S 2023-06-27 11:41:09 +02:00