Remove `Continue?` from some mesages to save "translation space" and replace multiscreen from `Yes|No` to `Cont.|Cancel`
Remove `Print canceled.` from check messages to save again "translation sapce" and after confirming the message the Status Line shows that it has been stopped.
fix rebase issue
If either Y_DUAL_STEPPER_DRIVERS or Z_DUAL_STEPPER_DRIVERS is defined
the compilation will fail with an error message. This configuration will likely
never be fully implemented unless someone from the community steps up.
Set short length so the square is printed in the middle of the bed
Both purge lines with and without MMU end at X=202.5 to get the square in the middle of the bed
Without this the first vertical move of the new meander would be slightly longer than expected due to using absolute moves from a negative Y starting position
Keep in mind that the EEPROM addresses are in descending order. This means we
can't use eeprom_read_block() or eeprom_update_block()
Address --> Axis
3831 --> X-axis
3830 --> Y-axis
3829 --> Z-axis
3828 --> E-axis
Change in memory:
Flash: -118 bytes
SRAM: 0 bytes
Configuration->HW Setup->Checks showed `a`
MSG_FILAMENT `Filament` can only be 8 chars long and only ES and IT had `Filemanto` as translation.
But as ES the `o` in `Filamento` was overwritten by `[Estricto]` I removed the MSG_FILAMENT to be translated.
Saves few bytes.
Pull all checks needed into the function such that the caller
only needs to check the return value
Also added description for the filament_presence_check function
A new menu setting is added to configure how strict the check should be.
- None: No check is performed
- Warning (default): The user is warned about missing and is prompted to continue with Yes/No. If No is selected, the print is aborted. If no user input is given (e.g. from host printing) then the warning will expire in 30 seconds and assume the Yes option was selected
- Strict: If the filament is not detected when a print is started, it is immediately canceled.
The check is currently performed on G-codes: M24 and M75. Starting a SD print and Host print respectively.
Fixes compiler warning in test environment:
Prusa-Firmware/Firmware/eeprom.h:712:51: error: ‘size_t’ has not been declared
712 | bool eeprom_is_initialized_block(const void *__p, size_t __n);
|
The following error is raised in unit testing environment:
Prusa-Firmware/Firmware/Configuration.h:16:14: error: ‘uint16_t’ does not name a type
16 | extern const uint16_t _nPrinterType;
The fixes a scenario where:
lcd_status_screen() calls lcd_commands() upon exiting
lcd_show_fullscreen_message_and_wait_P(_T(MSG_NOZZLE_CNG_READ_HELP));
and so not allowing the user to leave the screen since it will keep being rendered endlessly.
This change only affects lcd_show_fullscreen_message_and_wait_P
This fix is no longer needed today.
LCD knob clicks / and rotation, take care of updating lcd_draw_update.
The real bug was likely lcd_show_multiscreen_message_yes_no_and_wait_P calling lcd_update(), this is fixed now since.
The 8-bit FW uses a different Fullscreen UI which doesn't show the current temperature. So, for now, keep calling WaitForHotendTargetTempBeep before showing the full-screen message.
Changing (feedrate * feedmultiply) / 6000.f
to (feedrate * feedmultiply) * (1.f / 6000.f)
Replaces the call to __divsf3 with __mulsf3 which is better
No change in memory
- Don't allow re-heating the nozzle or the MMU to unload the filament if the print was aborted by a temperature error
- Allow MMU to unload filament if there is no temperature error, and there is no fan error when Fan check is enabled
- When Fan check is disabled, the MMU may unload if there is no temperature error
Change in memory:
Flash: +14 bytes
SRAM: 0 bytes
PFW-1557
- Show warning if extruder temp is > 40 degrees
- Use fan to speed up cooldown
- Show confirmation msg
- Show nozzle diameter setting after nozzle change
lcd_show_fullscreen_message_yes_no_and_wait_P and lcd_show_multiscreen_message_yes_no_and_wait_P
are the same function. Let's drop one of them so we only have one symbol for the function.
No change in memory
Fix rebase
- No wait for heatup during host print recovery
- No extra Z lift when power panic happens during paused print
- added an extra EEPROM value
- fixed `EEPROM_LAST_ITEM`
- changed EEPROM version to 3.14.0
- Added `reset_uvlo` function
- Hide menus during recovering
- Un-/Load filament with FSensor active only show Load OR Unload depending on FS sate
- Host
- Reprint only shown when M79 timer is active
- Resume only shown when M79 timer active
- Stop print always shown when printing, paused and recovering
When the cs variable is loaded into RAM, cs.axis_ustep_resolution will always have some value and none of the 0xff values.
Change in memory:
Flash: -40 bytes
SRAM: 0 bytes
cancel_heatup is set to false inside wait_for_heater()
there is no need to do it before the function call
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
When a print is paused, card.sdprinting is set to false. Instead we can check
if the SD card has been mounted and try to close the file.
The closefile() method will check internally whether or not the file is open.
In the case of a Fan Error, the print is paused. If the nozzle is allowed to cool for a while before the print is stopped via the LCD, then the MMU will try to unload with a cold nozzle.
This can happen with ANY recoverable thermal errors.
In this commit I attempt to fix all scenarios. Including PFW-1544 where the nozzle is cooling down when the print has finished normally.
PFW-1544
PFW-1552
Change in memory:
Flash: +74 bytes
SRAM: 0 bytes
If the if statement is not true, then the st_synchronize call is not useful
The raise_z call above the if statement does not need it since it always calls st_synchronize (blocking move)
No change in memory
If the timer is expired, then the timer is stopped. This is OK since
we are starting the timer again anyway
Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
When long moves are planned and executed the USB timer can expire.
In PrusaSlicer 2.7.1 the Toolchange command (T0, T1, etc.) is sent while the USB timer is expired. This will trigger
a manual MMU unload in the firmware. Not only does this trigger a loud beep from the buzzer, but this will also significantly increase print time.
The issue only affects host prints. SD card printing does not have this issue.
Fixes#4551
The fix in this commit is the following:
If there are blocks queued while printing via host AND the USB timer is halfway expired WHILE executing a move. Then simply restart the timer to keep it alive.
Change in memory:
Flash: +62 bytes
SRAM: 0 bytes
This function is not specific to power panic. Some printer models
do not have power panic enabled.
This change fixes a build failure
No change in memory
restore_file_from_sd function now supports any
filename extension. If a print was finished (to allow reprinting) then the
EEPROM filename and extension should always be valid.
Change in memory:
Flash: -312 bytes
SRAM: 0 bytes
If a planned request is activated when the current status is finished
then the firmware must wait for the response when the request
is expecting it
An example is a register read or a register write.
manage_response not return unless the register has been read or
written. And we must see the response to know if an error should be
reported.
Step to reproduce issue:
1. Fail selector homing
2. Select 'Tune' item
3. Observe issue. In this situation you can see the value
for the previous register read is shown. Which is 0. This very timing dependent and does not always happen.
4. Repeat step 2 until the issue appears. It may take a few times.
"PRUSA uvlo" is the last g-code to be processed after the power panic
recovery. For host prints, we want to finish processing all these
g-codes and put the print in a paused state.
Currently I am using lcd_pause_print() but this may be simplified
later.
A new PrinterState is introduced PowerPanicWaitingForHost to
differentiate this paused state from the typical paused state.
In this new paused state the printer is waiting for the host to boot up
and send M79.
Once M79 is seen a new action is sent "// action:uvlo_recovery_ready"
It is up to the host software to then resume the print correctly. All
the needed information to resume the print is in EEPROM and can
be read by using the D3 g-code.
Change in memory:
Flash: +82 bytes
SRAM: 0 bytes
- Only queue M26 for SD prints
- Add M110 to set gcode_LastN for host prints
- Remove one debug log to save resource (52 bytes)
Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
If recover_print was never called, then there should be
no need to call lcd_setstatuspgm(MSG_WELCOME) since
the status line was not modified by the power panic feature.
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
Based on experience of mibehaving MMU2S units, a broader range seems to help more people in getting their unit to home properly.
Related to issue #4285
I would think that this should behave similarly as when stopping
the print via the LCD.
Changed UnconditionalSto()p to not close the SD card file
if we're using Octoprint. Then there shouldnt be any file open.
Some of the variables which were not reset:
isPrintPaused
pause_time
saved_start_position
saved_printing_type
Bed heater may be left on?
Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
- Yes/no question --> Need to fix the bug related with the filename print --> if (lcd_show_fullscreen_message_yes_no_and_wait_P(altfilename, false, LCD_LEFT_BUTTON_CHOICE)==LCD_LEFT_BUTTON_CHOICE)
Host has to send back state with `M72 S1|0` to keep printer and host in sync
Changed LCD menu messages to `Set ready` and `Set not ready`
Updated translations
For remote hosts, when the timer is stopped, then also save the statistics.
Slightly refactored save_statistics function by removing the parameters.
The function parameters are always the same.
Change in memory:
Flash: -40 bytes
SRAM: 0 bytes
I changed the code a bit so it would compile
in Prusa Firmware.
The paused duration is no longer included in the
print time statistics.
Change in memory:
Flash: -122 bytes
SRAM: 0 bytes
To handle power panic in M600 we started saving
relevant data at the start of M600 gcode.
We are currently also saving the same data within
gcode_M600 which is saved on the stack. I propose
we just use the data already saved in SRAM to reduce
stack usage.
Change in memory:
Flash: -64 bytes
SRAM: 0 bytes
When a SD file is selected to print
save the DOS 8.3 extension into EEPROM.
After a power outage, the correct file extension is then
selected instead of always assuming it's ".gco"
This allows users to recover ".g" files.
Change in memory:
Flash: +104 bytes
SRAM: 0 bytes
There is no need to read one byte at a time. We can simply
read the whole block in one go. This saves some flash memory.
Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
We can just read the whole EEPROM block since short filenames
are always null terminated. strcat_P will then apply the file extension
at the correct position.
Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
If the saved printing type was USB, then EEPROM_FILENAME
does not contain anything. The firmware should also
not be trying to open a file on a SD card which is maybe
not even mounted.
Change in memory:
Flash: +12 bytes
SRAM: 0 bytes
There is no need to restrict how often the message is rendered.
It was being restricted to render every 1 second. We don't do
this for most of the static menus. So I propose this 1 second period
be removed.
Tested on MK3S+
Change in memory:
Flash: -168 bytes
SRAM: -8 bytes
My plan is to re-use this function in M79
in a later commit. The firmware doesn't
have a dedicated parser like Marlin 2.1
so this is my attempt to not duplicate the parsing of a quoted string in G-codes
Change in memory (MK3S+ Multilang):
Flash: -50 bytes
SRAM: 0 bytes
The idea is to have the host ping the printer periodically with a M79 to
enable certain features/UI. Using the usb_timer is not a good solution
for this as it depends on seeing a 'G' character
The LCD code, or whatever code is implementing the new functionality
will need to include host.h and check whether M79_timer_get_status()
returns 0 (timer not running) or 1 (timer is running).
I created a new file for the code host.cpp which we can use to expand
host related functionality and not clutter Marlin_main.cpp further.
Change in memory:
Flash: +104 bytes
SRAM: +5 bytes
Setting this state notifies PrusaLink/PrusaConnect
that the printer is waiting for user input (attention).
Change in memory:
Flash: +12 bytes
SRAM: 0 bytes
power_on should not be modifying
EEPROM_MMU_ENABLED. The code is never
executed unless it's already been set.
Only disable EEPROM_MMU_ENABLED through Buttons::DisableMMU
Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
Using uint16_t instead of uint32_t reduces code size
and probably is quicker to execute
OCR4C register is 2 bytes on ATmega2560
It's 1 byte on ATmega32u4 and ATmega16u4
Change in memory:
Flash: -80 bytes
SRAM: 0 bytes
The command
/usr/bin/git describe --abbrev=0 --dirty=-D --broken=-B
Was returning error code 128 and no output.
In the workflow file, specifying fetch-depth = 0, will make sure
to fetch all branches and tags. This seems to fix the issue.
On my end, the default length for the abbreviated commit hash is 9 characters.
This won't fit into uint32_t (4 bytes).
Instead change FW_COMMIT_HASH into a string
and create preprocessor symbol for the string length
such that it's known at compile time.
If the string should be longer or shorter
then only FW_COMMIT_HASH_LENGTH needs to be configured on the CMake side
druk - jako proces
wydruk - jako produkt
wyładuj (zamiast rozładuj)
kanał (nie slot)
katalog (nie folder)
podręcznik (nie instrukcja)
firmware (krótsze; nie oprogramowanie układowe)
bazowanie (nie zerowanie bo zerowanie może wiele rzeczy oznaczać)
nieudane (zamiast nie powiódł się bo krótsze)
While waiting for the nozzle to reach a certain temperature, a fan error
should disable the hotend heater. If printing, it will simply pause the print.
Previously the printer would wait for the nozzle to heat up before pausing the print
and turning off the hotend heater.
We rely on LcdCommands::LongPause and must return to the top level loop to process it.
Waiting in the while loop e.g. in M190 does not make sense.
lcd_calibration_menu: Remove redundant if (!isPrintPaused). The menu
is never called unless this condition is true.
eeprom_switch_to_next_sheet: Don't show this menu if the printer
is busy doing work!
Do not allow these menus to run while a print is paused or
when we're recovering a print:
- Preload to MMU
- Load to Nozzle
- Unload filament
- Eject from MMU
- Cut filament
- Autoload filament
- Settings
- Calibration
There is a bug where if the printer is recovering a print, it run a
blocking loop to restore the extruder and bed temperatures.
But if a Fan error is triggered in this loop, then the user can't
abort the print via LCD.
If the fan error resolves on its own the 'Resume print' menu will
appear in a few seconds. But if not, then the user can't resume the print
(which is normal). But with the bug above the user can't abort the print either!
The problem is essentially isPrintPaused variable is cleared too early.
We should wait until the print is completely restored first.
Steps to reproduce:
1. Start a print
2. Pause the print
3. Wait for extruder temperature to fall at lest 180°C
4. Click 'Resume' print
5. While heating, stop the hotend fan and wait for a few seconds until an error is raised
6. Observe issue => 'Stop print' menu item is gone!
PFW-1542
The status line code is not nice, but we need to work around it
so the status line rendering works correctly
This commit mostly reapplies the code
from 3.13.2
Also fixes compiler warnings
@ingbrzy @leptun @petrubecheru @Hauzman @AttilaSVK @sarusani @Painkiller56 @vintagepc @stelgenhof
@wavexx @OS-kar @trondkla @arekm
I had to remove the French translation as it exceeds the limt. Only 53 bytes are free.
There is no problem with opening the menu during first layer
calibration. Removing this condition simplifies the code a little bit.
Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
Drop the ALPHA/BETA/custom version handling. Set the version string and
firmware date based on the current tree description which has all the
required details.
Allow to override the repository information via cmake.
Use a truncated commit hash to set the internal commit number for
compatibility.
Rebase and fix issues
- Use the HEAD commit hash as the default suffix
- Use the output of "describe" as the full version string
- Use the HEAD commit time as SOURCE_DATE_EPOCH
This fixes the undefined _T(label) reference, at the expense of a few
extra bytes.
I would argue this is worth the cost for the ability to check
translation references for the future. The warning happens because
`lang-check` cannot check a reference which is not _directly_ a catalog
entry.
We could introduce a method to suppress this warning (either a new macro
or some ///IGNORE comment), but that would mean that the additional
translation check is completely bypassed, defeating the purpose.
We can't clear eFilamentAction in every case in mFilamentItem()
mFilamentItem() can trigger a call to M701 and M702 e.g. for Autoloading
and eFilamentAction must be cleared by the gcode to prevent
the user from triggering another Autoload (which will crashe the FW)
The same applies to submenus. Now the MMU submenus clear eFilamentAction
only when the action is done.
For MMU Unload Filament item, eFilamentAction is only cleared after
the unload_filament() call is done running. This fixes an issue where
the menu item can be selected again while the first unload is still
running.
The if statement is checked in lcd_sdcard_menu()
so checking it again these functions is
redundant since it's always going to be true.
Tested on MK3S+
Change in memory:
Flash: -22 bytes
SRAM: 0 bytes
Previously these preprocessor macros were always being inlined.
By making these into a function we can control the inlining
more directly.
The number of points on the mesh is also now constant. This means
'n' can now be float at compile time. This removes one uint8_t to float
conversion.
Change in memory:
Flash: -208 bytes
SRAM: 0 bytes
Allow to set the source epoch of the build with
PROJECT_VERSION_TIMESTAMP.
When unset fetch the commit timestamp of the current HEAD automatically
instead of leaving the source as 0. This fixes the firmware DATE
information in the support menu.
If for some reason a user added a extrusion move in the firmware. Prevent FINDA runout
from triggering.
Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
temp_compensation_start() is only called when
PINDA_THERMISTOR is not defined.
Additionally make sure the retraction or unretraction cannot happen
twice in case MBL fails.
For MK3S users with MMU this extrusion move could
cause a FINDA runout event.
Change in memory:
Flash: -130 bytes
SRAM: 0 bytes
An example is when Unloading filament with MMU.
After the unload completes successfully, some menu items disappeared.
Because mFilamentBack() was not called
Change in memory:
Flash: -56 bytes
SRAM: 0 bytes
Kudos to @3d-gussner for finding the issue
Steps to reproduce:
1. reset printer
2. select Load filament
3. go back to main
4. LCD menu is very limited
5. To get all menus back select 6. Preheat
7. back to main
This commit is my proposed fix.
When eFilamentAction is equal to
FilamentAction::Load we must reset it to FilamentAction::None
when the Back button in Load Filament is selected
Change in memory:
Flash: -26 bytes
SRAM: 0 bytes
- Rename "Idler" to "Sensitivity"
- Implement ReadRegisterInner() as a way to read register in blocking contexts such as manage_response()
This allows us to show the current EEPROM value on the printer's LCD
Add a 'Tune' option to HOMING_IDLER_FAILED error
This will open a menu which allows
the user to change the stallguard threshold
from the MMU error screen
Change in memory:
Flash: +334 bytes
SRAM: +1 byte
I noticed this is how the order is in 3.13.0 and before.
I want to keep it exactly the same.
This somehow saves 2 bytes of flash. Probably compiler magic.
Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
If vSense changes at runtime due to Run current
being changed. Then we must always shift the Hold current
correctly. Whether the vSense is changing 1 -> 0 or 0 ->1
Change in memory (with TMC2130_SERVICE_CODES_M910_M918):
Flash: +76 bytes
SRAM: 0 bytes
The firmware will ensure that the Hold current can never
exceed the Run current. In this scenario we must update
the global current array so that M913 reflects the register settings.
Added a echo to serial when this truncation happens
Change in memory:
Flash: +54 bytes
SRAM: 0 bytes
After dece5d268f, running the thermal
model itself switches the printer to "active", preventing a calibration
run from the LCD to start.
Explicitly allow LcdCommands::ThermalModel in this case.
Allow the LCD menu update function to preset an initial value during the
first encoder increase from the minimal (usually zero) value.
This is useful to jump to a more sensible initial value when turning on
an heater which is currently disabled. The user is still allowed to
decrease the value after the jump, so there's no functional restriction.
If no power panic occurred during M600 we should
clear isPartialBackupAvailable to let the power panic
code know to not use the partial backup. We want the
partial backup ONLY when the extruder is parked after a print is saved.
Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
Proposal to fix some of the issues with the initial implementation
it is safer to use the status line code to print the message so
there aren't any conflicts in the LCD cursor position.
Allow inserting a byte into any position in the LCD status message
Also, add a variable to control from which index in the array
should the message start printing. This is very useful for progress
bars and messages which continually update. I think we can save some
memory by applying this to Mesh Bed Leveling later.
Change in memory:
Flash: +106 bytes
SRAM: +1 byte
Remove loading_flag and check for eFilamentAction instead which already
flags both load/unload (in addition to mmu actions).
Correctly transition from AutoLoad to Load as soon as the operation
cannot be cancelled anymore as opposed to resetting it.
Do not blidnly clear the loading_flag, check for it!
Just disallowing the SD menu while loading is being performed is not
sufficient, since the menu can be entered also by inserting card while
loading is taking place.
This is also nicer in behavior, as we allow to navigate the SD card
while loading.
All custom commands are transitory and eventually switch back to Idle
state by themselves.
It doesn't make any sense to explicitly check for Layer1Cal: any
non-idle state is active by design.
Fix this check in the main menu. This is probably incomplete (Layer1Cal
is incorrectly used in several other places).
- Always re-calculate the Vsense flag when the currents are changed
- Make sure Hold current is not larger than Run current
- Added SetCurrents() function from MMU FW
- Added MotorCurrents structure from MMU FW
- Various code size optimisations e.g. in power panic
Change in memory:
Flash: -10 bytes
SRAM: +4 bytes
move dedge preprocessing out of tmc2130_setup_chopper
We can use default_dedge_bit to initialise
the dedge bit in the chopconf constuctor later
No change in memory
Previously Z-axis would not be reset to
TMC2130_GCONF_DYNAMIC_SGSENS
in tmc2130_home_exit() when
TMC2130_STEALTH_Z is defined
Pulled configuration code into one common function
this ensures the registers are set correctly like in tmc2130_init()
Change in memory:
Flash: -206 bytes
SRAM: 0 bytes
The variable always takes a value of subtraction
between two int16_t values. It will also fit into int16_t
Change in memory:
Flash: -50 bytes:
SRAM: 0 bytes
When scrolling through menu items, the rotation event on the knob
takes care of updating the LCD by setting lcd_draw_update.
The menu code doesn't need to do it as well.
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
This is by far the simplest solution to prevent the user from sending
a Load command to the MMU when the FINDA or Filament sensor
is detecting a filament. This may even happen if the sensors are poorly positioned.
Either way a Load in this scenario will make the MMU seem to hang as the
state machine will reject the command.
We could add a full screen message to let the use know
but it would require some memory resources.
For now, just hide the menu item.
Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
Fixed printer_smodel_check for non MMU machines
Commit 136ef96 broke the compatibility check for MK3S without MMU.
May have fixed bug for older MMU machines.
Only comparing up to the length of the value from the g-code, would return equal on older MMU machines trying to run g-code sliced without the MMU.
Unfortunately if that is a feature, it will cause the different printer warning.
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.
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
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.
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)
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
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
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
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.
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
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
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
* Sync PEC `FINDA_DIDNT_GO_OFF` to `FINDA_FILAMENT_STUCK`
* Sync PEC `FSENSOR_DIDNT_GO_OFF` to `FSENSOR_FILAMENT_STUCK`
* Sync PEC `PULLEY_STALLED` to `PULLEY_CANNOT_MOVE`
* Sync PEC `SELECTOR_CANNOT_MOVE` update text
* Sync PEC `IDLER_CANNOT_MOVE` update text
* Sync PEC `PULLEY_WARNING_TMC_TOO_HOT` to `WARNING_TMC_PULLEY_TOO_HOT`
* Snyc PEC `RestartMMU` to `ResetMMU`
Also related text
* Sync PEC `SELECTOR_WARNING_TMC_TOO_HOT` to `WARNING_TMC_SELECTOR_TOO_HOT`
* Sync PEC `IDLER_WARNING_TMC_TOO_HOT` to `WARNING_TMC_IDLER_TOO_HOT`
* Sync PEC `PULLEY_TMC_OVERHEAT_ERROR` to `TMC_PULLEY_OVERHEAT_ERROR`
* Sync PEC `SELECTOR_TMC_OVERHEAT_ERROR` to `TMC_SELECTOR_OVERHEAT_ERROR`
* Sync PEC `IDLER_TMC_OVERHEAT_ERROR` to `TMC_IDLER_OVERHEAT_ERROR`
* Sync PEC `PULLEY_TMC_DRIVER_ERROR` to `TMC_PULLEY_DRIVER_ERROR`
Also releated text
* Sync PEC `SELECTOR_TMC_DRIVER_ERROR` to `TMC_SELECTOR_DRIVER_ERROR`
Also related text
* Sync PEC `IDLER_TMC_DRIVER_ERROR` to `TMC_IDLER_DRIVER_ERROR`
Also related text
* Sync PEC `PULLEY_TMC_DRIVER_RESET` to `TMC_PULLEY_DRIVER_RESET`
* Sync PEC `SELECTOR_TMC_DRIVER_RESET` to `TMC_SELECTOR_DRIVER_RESET`
* Sync PEC `IDLER_TMC_DRIVER_RESET` to `TMC_IDLER_DRIVER_RESET`
* Sync PEC `PULLEY_TMC_UNDERVOLTAGE_ERROR` to `TMC_PULLEY_UNDERVOLTAGE_ERROR`
* Sync PEC `SELECTOR_TMC_UNDERVOLTAGE_ERROR` to `TMC_SELECTOR_UNDERVOLTAGE_ERROR`
* Sync PEC `IDLER_TMC_UNDERVOLTAGE_ERROR` to `TMC_IDLER_UNDERVOLTAGE_ERROR`
* Sync PEC `PULLEY_TMC_DRIVER_SHORTED` to `TMC_PULLEY_DRIVER_SHORTED`
Also related text
* Sync PEC `SELECTOR_TMC_DRIVER_SHORTED` to `TMC_SELECTOR_DRIVER_SHORTED`
Also related text
* Sync PEC `IDLER_TMC_DRIVER_SHORTED` to `TMC_IDLER_DRIVER_SHORTED`
Also related text
* Sync PEC `PULLEY_SELFTEST_FAILED` to `MMU_PULLEY_SELFTEST_FAILED`
Also related text
* Sync PEC `SELECTOR_SELFTEST_FAILED` to `MMU_SELECTOR_SELFTEST_FAILED`
Also releated text
* Sync PEC `IDLER_SELFTEST_FAILED` to `MMU_IDLER_SELFTEST_FAILED`
Also related text
* Sync PEC fix MMU_MMU
Update MMU MCU UNDERPOWER
* Sync PEC `FIL_ALREADY_LOADED` to `FILAMENT_ALREADY_LOADED`
Also related text
* Add Prusa Error Codes check script
* Remove `:` at FINDA and FSENSOR as it is in other tiles
* Sync
FSENSOR_DIDNT_TRIGGER
MSG_DESC_SELECTOR_CANNOT_MOVE
MSG_DESC_IDLER_CANNOT_MOVE
MSG_DESC_FW_UPDATE_NEEDED
FILAMENT_ALREADY_LOADED
* Add MMU UNKOWN_ERROR PEC
bFilamentAction variable is never reset, even after
disabling the heaters.
Steps to reproduce:
1. Boot-up printer
2. Select Load to Nozzle.
3. Select PLA (215°C) target
4. Select Filament 1
5. Wait for load to be successful
6. Go to Preheat submenu and select Cooldown (last menu item)
7. Observe target temperature on the status screen is now 0°C
8. Select Load to Nozzle again.
9. Select Filament 2.
* Expected behavior target temperature IS NOT 0°C
* Actual behavior target temperature IS 0°C
Change in memory:
Flash: -26 bytes
SRAM: 0 bytes
Sync with the 32-bit side.
The ReportingRAII does not handle recursion.
Fixes an issue with the multiple calls to
BeginReport() and EndReport()
Change in memory:
Flash: +14 bytes
SRAM: 0 bytes
If the protocol reports and error and give errorCode
a value. When the error is resolved, errorCode is not reset to OK.
If the MMU is not in an error state I would expect errorCode to reflect that.
This fixes MMUCurrentErrorCode()
Change in memory:
Flash: +12 bytes
SRAM: 0 bytes
Restores 3.12 sequence which was working well before.
M600 "L" parameter now works like M702 "U" parameter.
Removed a lot of the unused parameters which were copied
from Marlin 2.
Change in memory:
Flash: +96 bytes
Code size increases a bit but keep in mind the PR
that broke the behavior "saved" 182 bytes:
https://github.com/prusa3d/Prusa-Firmware/pull/4063
So I think this code size increase is OK
Change in memory:
Flash: +84 bytes
SRAM: 0 bytes
The new code did not take into account the minus sign.
The template for menu_draw_P is removed since there is no benefit in
uint8_t version of this function since the value
is converted to two bytes anyway by lcd_printf_P.
Change in memory:
Flash: -92 bytes
SRAM: 0 bytes
If MMU slot is outside of range, then we rather the printer
not do anything. Currently it would accidentally assume
the MMU is disabled. This may have undesireable results.
No change in memory
If the remaining print time is more than 10.9 hours at 100%
then increasing the feedrate multiplier
to 101% or more will yield an unrealistic time due to overflow occuring.
Change in memory:
Flash +2 bytes
SRAM: 0 bytes
Guard the feedmultiply code with
lcd_encoder.
if lcd_encoder = 0, then there is no need to check if
feedmultiply should be updated.
Also set lcd_encoder to zero in one line to consume the rotation event.
Change in memory:
Flash: -40 bytes
SRAM: 0 bytes
Shouldn't make a difference since the array is already defined as 8B long, but I just found it weird and surprising when I noticed only 7 lines were defined
Guard the lcd_display_message_fullscreen_P call by blocks_queued(). If there are no planned moves, there is no need to render this message, it creates a weird LCD draw noticable by the user.
Change in memory:
Flash: +10 bytes
SRAM: 0 bytes
We need to call BeginReport and EndReport
otherwise the SD filename is not shown when printing
This only affects single material MMU gcodes
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
Drop the sound feedback in lcd_v2_calibration
when switching to lcd_generic_preheat_menu
If a single filament setup (no MMU) has filament loaded, it will jump
immediately to lcd_generic_preheat_menu
this created double feedback.
Let's just drop the feedback since the transition
between menus is very fast.
Change in memory:
Flash: -8 bytes
For MMU users: This happens when the user
selects a filament to load from 1 to 5
For non-MMU: this happens when clicking
the knob within 2 seconds.
Additionally fixed the code indendation
it was a mix of spaces and tabs
Changes in
lcd_implementation_drawmenu_sdfile
and
lcd_implementation_drawmenu_sddirectory
seem to save the most.
Change in memory:
Flash: -72 bytes
SRAM: 0 bytes
Initialise EEPROM_CHECK_MODE always
But if farm mode is detected, update the Check mode to Strict
Initialise EEPROM_NOZZLE_DIAMETER on farm mode.
When opening the menus this value is set automatically to
_Diameter_400 anyway so this should be fine.
No change in memory on Multilang build
There are only 3 possible values. No need to check for two of them
to rule of the last value. Instead simply check for the last value only.
Change in memory:
Flash: -16 bytes
SRAM: 0 bytes
Found these a few months ago when I was trying some other optimization. Don't want to make a PR just for this, so I'll just slide it here in this existing PR.
!variable.running() || variable.expired()
is equal to
variable.expired_cont()
The latter required less flash memory
Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
We should let EndReport set the custom message type state to Status
This will ensure the SD file name is shown correctly AFTER we've shown
the visualisation
Currently the visualisation is cut off in the middle by ReportProgressHook
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
The old implementation would fail if the message was in progmem at address 0xffff or 0x0000 (both unlikely). It would also fail if the eeprom was initialized to some other random value, which could have been dangerous when displayed as a full screen message.
- currentValue must be initialised when entering the menu
- Consume lcd_encoder value when editing an item
Change in memory:
Flash: +40 bytes
SRAM: 0 bytes
The feedback is produced due to the user clicking the knob
the menu_goto call should therefore not trigger additional feedback when
switching between menus.
No change in memory
Properly increment menu_item when the menu item is clicked so that you don't get multiple menu items clicked if in view (when the menu code is deduplicated to functions)
There is no need to check if every axis bit with each for-loop
iteration. We just need to check if a given axit bit is set.
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
lcd_encoder was int32_t (4 bytes) because of the menu code
when editing through the menus, the menus only accept
int16_t so it doesnt make sense to use int32_t.
Change in memory:
Flash: -892 bytes
SRAM: -2 bytes
This change needs to be approved of course due to it affecting UI
The affect UI is only one menu
lcd_settings_linearity_correction_menu
I doubt many users are using this menu except very advanced users.
I propose we delete the variant of menu_draw_P which was used for
uint8_t but renders them as floats.
Instead treat
uint8_t same as int16_t i.e. just render integers.
Keeping it simple :) Solve our fanSpeed problem.
Change in memory:
Flash: -140 bytes
SRAM: -2 bytes
These variables only range from 0 to 255
For the menus we currently need to convert fanSpeed to int16_t.
Change in memory:
Flash: -160 bytes
SRAM: -2 bytes
This fixes the spurious feedback when rotating the knob
because lcd_update is called much often than the interval
at which the lcd rendering is updated
Change in memory
Flash: -88 bytes
SRAM: -9 bytes
This commit adds the ability for firmware to make sounds when the
knob is clicked or rotated, when LCD updates are disabled.
The improvement here is the sound is being made with one line of code
whether or not LCD updates are enabled or disabled.
Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
Valid values range from -100 to 100. Storing this value as four bytes
(int32_t) is not efficient.
Instead we can store G80 user input temporarily as int32_t and check
if the value is within the allowed range. If it is, then we convert the
int32_t (4 bytes) to int8_t (1 byte).
Change in memory:
Flash: -78 bytes
SRAM: 0 bytes
This way doesn't add any more flash memory.
Calculating the string length or checking for a null byte
will end up increasing flash consumption overall.
This gets rid of float conversion.
We just need to check the 6th character when M862 is detected. This
character gives us the digit after the dot.
Change in memory:
Flash: -20 bytes
SRAM: 0 bytes
For non-time critical code it is more effcient to call a function
rather inlining each division operation.
Change in memory:
Flash: -122 bytes
SRAM: 0 bytes
Rename acceleration_st to acceleration_steps_per_s2 to be same as Marlin 2
Store the accelerator in local variable accel
while we are performing the limit checks.
When limit checks are done we can assign
the block it's acceleration. Especially
block->acceleration_steps_per_s2 is now only written to once, instead of direcly in the limit checks.
Change in memory:
Flash: -118 bytes
SRAM: 0 bytes
Noticed this when exploring another optimisation
By specification exactly which overloaded function to use
we save some memory
Seems to have something to do with doing arithmetic in the function argument
Change in memory:
Flash: -156 bytes
SRAM: 0 bytes
Currently we are queuing many small 2 mm E-moves until the filament
sensor triggers. We do this because we never abort any queued moves,
so making small 2 mm moves ensures we do not move the E-motor more than
2 mm past the filament sensor.
Unfortunately, when E-cool mode is enabled, the E-motor will create
audible clicking sounds (similar one hears during jam or a loose grub
screw). A workaround for this is to queue one or more very long moves.
Where very long is something of the order of hundreds of millimeters. I
have it set to 350 mm but it's just a random constant really. Keep in
mind the firmware will block too large E-moves, if I recall correctly
it was anything above > 450 mm (see PREVENT_LENGTHY_EXTRUDE)
In order to use very long moves, we must somehow stop the E-motor from
moving once the filament sensor triggers. In other words, throw away
what's left of the current E-motor move. For this simple purpose we can
use planner_abort_hard() but we must set planner_aborted to false
afterwards because the code architecture does not allow the main loop()
to run until the Toolchange command is done processing.
Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
There is no need to repeat:
lcd_update_enable(true);
lcd_update(2);
Also lcd_clear() is redundant because lcd_update(2) will clear the LCD
Change in memory:
Flash: -16 bytes
SRAM: 0 bytes
Previously when the firmware called M701/M702 manually
there was no Z lift. But after we added support for the Z
parameter we set the default to 50mm.
Change strings "M701" to "M701 Z0" and "M702" to "M702 Z0"
to restore the previous behavior from before 3.13.
Also pulled the gcodes into PROGMEM in message.cpp
along with M83 and M84 to save memory.
Change in memory:
Flash: -34 bytes
SRAM: 0 bytes
When the extruder lifts up after completing the Purge line,
the baby stepping is not allowed for a short time. This dismisses
the menu. We don't want this behavior, so only apply the Z-axis requirement
when printing.
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
Add lcd_commands_type == LcdCommands::Layer1Cal
just in case blocks_queued() is 0 for one instant between
lcd_command steps
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
Fixes an issue with running first layer calibration twice in a row.
Improvements:
Now the Z baby step menu closes automatically when first layer calibration is done.
No need to wait for a timeout or close the menu manually by setting a variable
If the baby stepping menu is open, and suddenly
the printer enters a state where baby stepping
is not allowed.
The printer will save the last value before closing the menu.
When LcdCommands != Idle, don't dismiss
the Z baby step menu. This saves 20B
Change in memory:
Flash: -130 bytes
SRAM: 0 bytes
The fact that the relationship between
machine position and pixel index is not linear
means we cannot simply rely on comparing
the previous position to the next machine position. i.e derivative of E_AXIS
Because around the max amplitude of the triangle wave
the slope will suddenly change sign and will create a deadzone
which has width 2*mm_per_pixel.
For MMU2S this is ~10mm (or two pixels).
Instead we should split the moves.
And only plan the 2nd move once we're
at the top of the triangle wave. That way we don't really care about the position delta.
Now we just calculate the current y(x)
position relative to current position and divide by mm_per_pixel.
If there is a delta measured with unit 'pixel' then that means
its time to render the next pixel.
This solution seems to work well so far on my end.
Change in memory:
Flash: +2 bytes
SRAM: 0 bytes
This fixes an issue where sometimes
not all 20 pixels are rendered.
It is better to render 1 too many pixels (sometimes), rather than rendering too few.
Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
In case we are running a retry, the firmware
should clear the old rendering before
starting on a new one
Change in memory:
Flash: +6 bytes
SRAM: 0 bytes
* M600 used 1°C threshold, which may increase the waiting time a bit
* Wizard used 3°C
Sync both to use TEMP_HYSTERESIS for consistancy
No change in memory footprint
Use 5°C threshold to be consistant with other parts
of the firmware.
Relying on 95% of the target temperature creates
a dependency on the temperature:
PLA: Target = 215°C, threshold = 10.75°C
PETG: Target = 230°C, threshold = 11.5°C
ABS: Target = 255°C, threshold = 12.75°C
ASA: Target =260°C, threshold = 13.0°C
PC: Target = 275°C, threshold = 13.75°C
My proposal is we instead use a constant
TEMP_HYSTERESIS = 5, which is consistent with
M109, and behavior when restoring print from RAM
and some of the MMU code (like unload function)
Change in memory:
Flash: +2 bytes
SRAM: 0 bytes
This commit adds the ability for the firmware to dim and wake the
backlight when LCD updates are disabled. Such as in the MMU error screen
or when rendering full screen messages which typically
disable the LCD updates to prevent the status screen from rendering.
Fixes#2777
Change in memory:
Flash: -26 bytes
SRAM: +1 byte
It may be useful to view the Sensors menu
while the toolchange loading test is taking
place. For example to see if the reading is flickering
The firmware needs to call lcd_update(0) to update the screen rendering.
Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
The following command did not work in the lang folder:
python .\update-po.py --file ./po/Firmware_cs.po
To resolve this we just extract the filename from
the path and use the constant PO_DIR to make
sure the path is always the same.
It's my understanding that we cannot use extended globbing
on Linux because
of the way I am invoking the lang-extract
script. the python script is not run through bash/shell.
We would need to perhaps use Shell = True in check_call() but
then the all the input arguments needs to be one string.
This commit was tested on Ubuntu 22.04.1 LTS
Now these commands will work:
python .\lang\update-po.py
python .\lang\update-pot.py
When current working directory is
.\Prusa-Firmware\
Previously, you'd need to call the
script within the lang folder.
Fix an issue where it does not run on Windows.
When the input argument is regex, we must first search for the files
using said regex pattern and then creating a list of files.
When opening the files, the encoding needs to be utf-8.
Model UV as power-invariant, so that scaling P doesn't change the
intercept location (that is, the zero point remains at the same
temperature even for more powerful heaters).
NOTE: It's not clear to me whether this is generally true (couldn't
find a datasheet from the same heater in diffent power variants
showing the efficiency loss)
- Expose TEMP_MODEL_fS and TEMP_MODEL_LAG as D and L respectively,
initializing the default values based on the previous hard-coded
values.
- Always round L to the effective sample lag to future-proof model
upgrades or changes (the stored value _is_ the effective value).
- Introduce UV as a new linear term for PTC heaters, defaulting
to an identity for model backward-compatibility.
On printers without the MMU no error screen should occur and no attempts of communication with the MMU should be performed -> EEPROM_MMU_ENABLED should default to 0.
PFW-1418
Use "echo:" for thermal model error reporting to avoid octoprint
automatically sending a M112 kill.
Keep using "error:" instead for other thermal errors (MAXTEMP/etc).
This should allow resuming a thermal mode pause with the default
octoprint settings.
This is an 80% solution to PFW-1488 which should be somewhat compatible with the existing languages/translations infrastructure.
I don't see a point in extending the infrastructure a great deal to support some compile-time replacement in order to patch just MSG_DESC_FW_UPDATE_NEEDED.
Related PR: https://github.com/prusa3d/Prusa-Firmware/pull/3993
Main changes:
* setAllTargetHotends() is removed
* setTargetHotendSafe() is removed
* Extruder parameter on setTargetHotend() is dropped
Change in memory:
Flash: -192 bytes
SRAM: 0 bytes
The general idea is to keep platform specific implementation away from the MMU state machines as much as we can.
That would enable unit testing the top level MMU state machine and integration into other project as well (if needed).
The function adds a bit of overhead compared to code_value()
I suspect this function is a relic of the past.
Change in memory:
Flash: -82 bytes
SRAM: 0 bytes
Add `tml_decode` to decode a TML trace from a serial log file into a
parsable tab-separated table.
`tml_decode` also doubles a simple no-frills plotting utility.
Restructure the README for better readability.
During calibration model warnings are possible/normal. This is
apparently leading some into thinking the hotend might be faulty
and abort the calibration with a hard reset.
Disable warnings/beeps during calibration.
Rely on the error threshold only.
It may seem counterintuitive to disable the E-motor, but it gets enabled in the planner whenever the E-motor is to move.
The idea behind disbling the E-motor when it won't be needed for some time is to save power and lower the heat of the motor.
Therefore it is especially important to disable the motor before the printer pauses a print due to some MMU error screen.
Used lcd_print_pad_P is some obvious places. We can probably use
this function in more places to further save flash memory
Change in memory:
Flash: -268 bytes
SRAM: 0 bytes
Because this error is not an MMU error but a printer one, the existing infrastructure has been bent to support such a scenario.
During testing it turned out, that some machines fail to draw the error screen due to previous internal states.
This PR resets the internal states so that the conditions for drawing the error screen are met.
During thermal errors all fans are set to full speed.
When the print is resumed or stopped *and* the thermal error is gone,
also restore the autofan state.
Fixes#3893
Running `M310 A` should set the TM calibration bit status if the
autotune procedure was successful.
Partially addresses #3891 and #3890, since running `M310 A F0` should
*still* count as valid calibration data and is not something that can be
replicated by using the LCD (which enforces self-test).
This fixes#3891 without having to set the calibration bit, meaning
that if the model is later re-enabled without a real calibration, a
prompt is shown as expected.
Alert messages are intended to persist above "info" messages, thus
preventing further calibration status updates to be shown (such as
thermal model calibration).
Just set the message as a regular status message.
Fixes#3892
It was only enabled when multiple extruders are enabled
The firmware doesn't support it
and even if the M218 gcode could be used, the code does not compile
Disabling the model during a warn/error condition will also stop
updating the warning/error flag, keeping the printer in an error state.
Clear all flags as well when changing model settings.
Follow Marlin's behavior and simply insert a delay for the requested
duration when using M300 S0.
When S is not specified, use the default tone instead.
Fixes#3856
This PR tries to address the 3 different startup scenarios for 1st layer calibration with the MMU:
- 1st lay cal started with correct filament already loaded in the nozzle - we should continue, but skip the first 58mm (first 2 g-codes in the hard coded sequence) of purge line extrusion
- 1st lay cal started with other filament already loaded in the nozzle - we should unload and then issue a toolchange with no extra unload
- 1st lay cal started without loaded filament - we should just do a toolchange with no extra unload
PFW-1457
This is a prototype implementation of having the ability to show an MMU error screen even for printer's errors (during an MMU operation).
Also, the retry count of unloads after failed load the extruder tube is now limited to ~3 attempts.
Technically, since this very error is not an MMU's one (MMU is just fine at this stage) but a printer's one I tried to hack the existing error-reporting infrastructure to handle such a case.
The original idea of this approach was suggested by @vintagePC
Instead of checking for explicit versions, resume the wizard if some
(new) wizard is missing.
This handles both the old SELFTEST check, the new thermal model
and any future check in the same fashion.
Update the eeprom FW version as soon as migration is complete, to avoid
resetting the CALIBRATION_V2 variable at each reset.
Do not implicitly reset the calibration steps for WizState::Run: do this
only for the menu action.
- Handle the conversion from the V1 calibration status to the V2 bitmap
for all past FW versions.
- Allow to run the wizard in "Restore" mode (for example during upgrade
or service prep) to complete any missing steps.
- Fix service prep to use the above feature by clearing the appropriate
calibration bits.
- Remove exceptions for FW 3.2.0.4 which can now be handled cleanly.
Simplify status tracking:
- S::Restore to continue to the next logical wizard item
- S::Finish for a successful failure
- S::Failed to exit while showing a failure
- Move calibration status/declarations to util.h
- Allows to query the status of each step independently without assuming
any order
- Allows to extend the calibration with new steps transparently
- Generalize force_selftest_if_fw_version() so we can check when upgrading
between arbitrary FW versions.
- Do not call update_current_firmware_version_to_eeprom() prematurely
when forcing self-test (if a reset happens before self-test completes,
the check would be incorrectly skipped on the next run).
Expect these to be always at the start of the command (which is now
stripped of the extra line number), reducing the number of corner cases
due to these not following the g-code spec.
Instead of reading and checking if a character is a whitespace
just print it out onto the LCD. This makes the code a bit less
complex. Whether there is a whitespace character, we always end
up reading from program space, so I doubt this has much performance
impact.
Change in memory:
Flash: -38 bytes
SRAM: 0 bytes
- Use ALL_MULTILANG and VARIANT_MULTILANG instead of VARIANT_Multilang
- Use ALL_ENGLISH and VARIANT_ENGLISH instead of VARIANT_En-only
- Rename the intermediate VARIANT_Multilang_* targets to VARIANT_lang_*
to avoid confusion
The Extra Loading Distance is configurable by the user.
We need to compensate the hardcoded sequence
such that it does not extrude too much or
too little. Currently the firmware
extrudes too little.
The issue is very apparent with a cold extruder. For example when starting a single color print with the MMU. I can hear grinding in the extruder gears at the very end of the sequence. This means the sequence is too long and we are
likely pushing the filament too far into the extruder.
The purpose of the test is to check if the filament is actually
present in the PTFE tube. My proposal is we reduce the length
of the test to only cover the *length* of the PTFE tube.
This will also reduce printing time a little bit.
Fixes issue where First Layer Cal. triggers an unload before any
filament is loaded
The purpose of this if() statement is to handle the case where
a user or developer is sending T-codes to the printer directly
via Serial. Such as when one first sends T0 and then T4.
And unload must be triggered in-between, we can do this automatically
if FINDA detect filament.
Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
If there is no running print, and the printer is Stopped, add a new
"Acknowledge error" menu entry to unlock the printer.
This simply calls lcd_print_stop(), which is identical in behavior to a
thermal error with a running print.
Set a menu block for fatal thermal errors instead of abusing
lcd_return_to_status() to kick the user out of the menus.
This now allows a thermal model error to be recoverable through menu
access.
We allow resuming from the LCD via start print and resume print,
it makes sense to clear the error on stop too.
For this reason distinguish whether the action is performed
automatically or manually (ie: interactively).
The error is only cleared when the command is run interactively.
Use an unversioned root to store dependencies, so that they can be cached more easily.
Do not re-download archives if the build environment has already been set up.
Attempt to cache dependencies with the travis cache. This avoids
redownloading avr-gcc for each stage of the pipeline.
This /might/ improve the download failures we're seeing recently,
although the travis cache is also networked.
The printer shouldn't continue endlessly asking for a version if an old MMU is detected.
Also if the protocol is supposed to be turned off, it
shouldn't be sending S0 queries.
In M600 and M702, the Z-lift is taken care of outside this function
so it makes no sense to have a Z-lift within unload_filament()
Only exception to this is in the wizard, there I moved the Z-lift to
happen before we start heating the nozzle.
Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
Ensure that fan checks are reset and use the new speed at each step of
the calibration.
This also gives extra time to the fan to ramp-up from a cold start,
when a fancheck could previously start right *after* the speed change.
Should fix#3791
Since M310 cannot change the heaters, allowing M310 S0 (and changing
parameters) allows to recover a usb-controlled printer which has been
locked-out due to bad model settings.
This prevents the ability to run gcode from the SD card.
In a thermal error with faulty values, and without serial access, this
is the only way to process an M310 instruction and recover.
- Correctly sequence the enqueued commands in order to check for the
real calibration result.
- Perform autocalibration with self-check enabled.
- Only save/continue the wizard if autocalibration succeeds.
- Ensures repeated autotune attempts with self-check can't succeed due
to different starting conditions.
- Allows for a simpler workflow during selftest and wizard if autotune
fails.
Provide average calibrated values for all fan levels for MK3/MK3S
variants and enable the model by default.
This ensures the calibration step is not skipped unless explicitly
disabled.
Force-clear fan values during autotune to restore the previous
calibration behavior, as fan resistance levels can be too big and
prevent the autotune-with-selfcheck to fail.
The cmake build system is effectively on-par (and a lot better in most
areas) compared to the old build system.
There's no need to warn developers anymore.
The option SECONDARY_LANGUAGES is no longer being used.
cmake always allows en/multilang for all selected variants
by using the appropriate target now (ALL_ENGLISH).
If during a paused print, the preheat is canceled, keep the bed target temperature
Display bed temperatures only if bed is also heated
Remove not needed variables nTargetOld and nTargetBedOld from the mFilamentItem function
Define new Setting "HeatBedOnLoad" [Yes/No]
There is no need to manually track the cursor position.
We can use the menu API:
MENU_BEGIN()
...
// menu items in between here
...
MENU_END()
Change in memory:
Flash: -116 bytes
SRAM: 0 bytes
Simplify the rendering to cover more scenarios:
"[nr.]>?"
"?>?"
Both of these indicate there is a bug in the firmware.
Currently these are not handled and result in the status screen being corrupted.
This is because we are trying to write a 3 digit number
where there is not space on the LCD for it.
Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
It's only used when MESH_BED_LEVELING is not defined. According to
the configuration files, all printers supported use MESH_BED_LEVELING.
So I think we are safe in removing this dead code.
The firmware saves the current fanspeed before parking,
and the fanspeed is restored after unparking. The problem is the fan
was never actually paused.
Fixes#3670
This code was introduced with v3.8.0 but was always disabled.
I propose the code be removed since it has not been enabled
for 3 years since its introduction.
We only need to check if the MMU is enabled once,
no need to do it in every submenu.
This way we save little bit of flash memory.
Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
We can use lcd_print_pad to determine
whether the end of the file name was reached
lcd_print_pad now returns the last character pointed to.
If the end of the string was reached, it will be the null delimeter which
evaluates to "false" in an if statment (same as NULL).
Else "true" means the end of the string was not reached.
Change in memory:
Flash: -42 bytes
SRAM: 0 bytes
ON_MENU_ENTER runs code within the brackets only once
after a new menu is entered.
For the tool change menu, this allows us to display the data and
read from EEPROM only once.
Fixes#3715
When a long-press is triggered, the LCD inactivity timer
needs to be restarted. This is done with lcd_timeoutToStatus.start()
This also fixes situations where a long-press is triggered, and the timer
times out immediately (because it was not reset properly)
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
So in an ideal scenario, the newest file is first. This of course breaks as soon as a file is deleted/renamed/moved, but it should at least be fixed now compared to before where the direction could be influenced by a disabled setting
Add the following macro targets to check translations:
- check_lang: check all languages for all variants
- check_lang_[variant]: check all languages for [variant]
- check_lang_[lang]: check all variants against [lang]
- check_lang_[variant]_[lang]: check a single variant/language
For example:
- ninja check_lang: check *everything*
- ninja check_de: check German in all variants
- ninja check_MK3S-EINSy10a: check all languages in the MK3S
- ninja check_MK3S-EINSy10a_de: check German in the MK3S
This piece just changes the default extra load length on the MK3 side.
The same needs to be done on the MMU side but:
- the MMU exposes its register for this (so we can change the extra load distance by writing into the register via G-code)
- the printer shall probably set this value on its own after line up of MMU communication
In Idle and Command mode it is now possible to specify a list of registers which shall be periodically read from the MMU.
To keep the code and RAM size down registers are intentionally separated into 8bit and 16bit sets.
Adding a register into the set is just a matter of parametrization, there is no need to change the state machines anymore.
I had a crash when producing an error screen and printer was unhomed.
Extruder was located at the far right side, and immediately crashed when attempting to park.
Rewrite cmake rules for reproducibility and move them inside a separate
module.
The new rules are cleaner and can operate on multi-directory projects
transparently.
If you generate a multicolor gcode file with PrusaSlicer, the purge
line gcode will look like this.
This reduces clicking sounds from the extruder, filament extrusion is reduced by 6mm.
Include the new cmake-based build in travis.
Split the build into 3 stages: cmake, legacy and tests.
cmake: new cmake-based build (*all* variants, including english only)
legacy: old build.sh based build (using arduino-builder)
tests: cmake tests (not terribly useful at the moment)
Instead of including Configuration_prusa.h directly, include
Configuration_var which then includes the proper variant file though a
preprocessor macro.
This allows to keep the existing build system intact, but also redefine
at compile time the final header without having to make copies on the
file system.
- Work-around SOURCE flags being reset for each project when setting the
random-seed property by calling a support function.
- Likewise, set correct flags for reproducibility when creating archives.
- Strip source prefix paths from debug info
This should set the EPOCH using the last git commit date when available,
but it's not currently implemented. Just set the EPOCH to be 0 for now.
Removes a missing return warning.
Looks like we don't handle overflow at the moment and in all surrounding
code, so let's remove the return value for now.
This generates a warning under -Wextra, since in most cases a const
value doesn't prevent buggy code (as copies are allowed) while
preventing some optimizations (such as move operations) to take place.
Consume any pending LCD click after the temperature model calibration.
Since we're already in the status menu, the usual consume action is not
done automatically here.
The current code forces any warning to return the user to the status
screen in order to show the message.
Thermal anomaly warnings can repeat at very short intervals, making menu
navigation (to pause/tune the print) impossible.
We now check if the message to be displayed is the same and only force a
kickback for new messages.
This partially reverts https://github.com/prusa3d/Prusa-Firmware/pull/3600
since we need the string to be null terminated for ease of comparison.
We pad the status line at display time instead using the new
lcd_print_pad() function which achieves the same effect.
In ultralcd_init() do not use lcd_setstatuspgm() to initialize the
welcome message.
The internal call to lcd_finishstatus() requires the serial to be
already available. Split the function into lcd_padstatus() to pre-pad
the string and save some space.
Fix regression introduced in fc10ca3146.
Accept incoming serial commands without line numbers (assumed to be
injected by the host), but do not reset the last line count when doing
so.
Now that lcd_status_message is now initialised correctly at boot-up,
this for-loop is no longer required. Now lcd_status_message is
only set in lcd_updatestatus() which always calls lcd_finishstatus()
lcd_finishstatus() makes sure the message does not exceed 20 characters
Saves 34 bytes of flash
static variables are automatically zero initialised. Now that the
status line message is initialised in ultralcd_init(), we don't
need to set the variable in global scope.
Saves 22 bytes of flash and 1 byte of SRAM
Since mmu_loop() is called in the main loop() function
when the MMU is disabled, we need to utilise the
MMU protocol layer to prevent FINDA runout from happening
if MMU is disabled.
We also need to keep in mind we probably can't trigger
a FINDA runout in the middle of a Q0 query.
So my solution now is to wait for the "Finished" state
and check if the FINDA is off during printing.
When "Finished" state appears, the FINDA value should be up
to date.
During first layer calibration we have the live Z baby step menu
on the LCD and the user can tune their Z offset live.
Once the first layer calibration is done, we want to exit the menu
immediately. For this purpose it is much more efficient to
call lcd_return_to_status(). There is no visual difference
on the LCD for the user.
Change in memory footprint:
Flash: -34 bytes
SRAM: -1 byte
We want to move the Z-axis after the XY move is done.
raise_z cannot be used here because it relies
on current_position[] for all axis.
It is actually 10 bytes cheaper to use the previous method
because syncing current_position with lastpos is surprisingly expensive
Don't render full screen for Loading Filament X
this is already done in load_filament_to_nozzle
so no need to do it twice
Change in memory:
Flash: -54 bytes
SRAM: 0 bytes
This fixes an issue where the assumed slot to use is unknown and
the printer will hang on loading filament 100.
Another good thing is this is an old user feature request which
we have in our 3.12 milestone.
Change in memory:
Flash: +14 bytes
SRAM: -1 bytes
If the endstops kick in, then st_get_position_mm shows the actual travel distance. current_position[Z-AXIS] does not get updated correctly thus we cannot use it when unhomed.
current_position[Z-AXIS] is later set to Z_MAX_POS,
we cannot use that either to calculate the travel distance
Removed the "plan" parameter.
We were incorrectly returning from the function if the printer was homed,
but plan = false. This would leave current_position with an incorrect value
If the printer is homed => finish the move and return the travel distance
If the printer is not homed => rely on end stop to prevent damage,
return travel distance even if the endstop stopped the move.
The current unload sequence does not give good results.
The Marlin 2 sequence looks good on my end. This can be later
used to improve M600
Added all the constants from Marlin 2
* Created a new function raise_z() which will move the Z axis by some
X millimeters. If plan = false, the function will return the
actual travel distance since the move is blocking.
* raise_z_above() is refactored to call raise_z()
Now the M701 and M702 will move the Z-axis relatively, and also
when done, revert the Z axis position when done.
This is a similar behavior as in Marlin 2.
It is only used when the MMU is disabled. With the MMU we use a defined ramming sequence.
When the MMU is disabled I borrowed the usages from Marlin 2.
The L parameter only defines the length for the "fast" load length.
Default value is 70mm, same as M600
- remove virtual methods (we only have one fsensor implementation at a time)
- comment out some of the debugging texts
- remove volatile and replace them with proper synchronized access to relevant variables
Don't start moving the E-motor immediately
Instead of starting the E-motor move when the load to extruder starts,
we can start when we are loading to the fsensor. At that stage
the MMU has changed from a fast load to a slow load.
Because it looks like the communication drop outs are caused by some electrical issues and we can loose even a byte from the version response, which is deadly for future operation.
When a Progress report is started, we set the CustomMsg to MMUProgress.
But there was an issue where, once the reported "Progress" action was done.
We did not reset the CustomMsg to Status. So if we are printing from the
SD card, the file name is not displayed on the LCD.
Communication timeout and Protocol Errors are now distinguished.
In case of a Protocol Error, the printer waits for heartBeatTimeout to allow filling up the input UART buffer (we expect the MMU still produces some bytes).
Once the timeout elapsed, the input UART buffer is cleared and a new Start Sequence is initiated.
Fix the unload procedure when the user has paused a print
then stopped the print after the temperature has reached below 175°C
Now the E-motor will move as expected
This is a draft PR showing the potential 3x retry implementation on the printer's side.
It is much less code and looks more reliable than the same functionality in the MMU FW.
Still, more work needs to be done:
- [ ] Button is sent to the MMU even before returning from the parking position
- [ ] Then the button is sent again
- [ ] Then the printer runs out of retryAttempts
We need to find a better spot to check for "automatic" retry and issuing of the buttons
* Fix MK3S buttons being processed too slowly
After a button is selected on the MK3S MMU error screen, we need to process it before asking for another MMU Query.
Because the MMU Query will make the Error screen return and overwrite the status screen
* Add back CheckUserInput for ButtonPushed event
When a FSENSOR error happens, the first step for the MK3S should be to stop any loading by stopping the E-motor.
From this point, the buttons should determine what the MK3S does next.
* FSENSOR_DIDNT_TRIGGER
* FSENSOR_DIDNT_GO_OFF
The Done button does not Move the E-motor because it
expects the user to have manually resolved the problem
Also if the filament is in the gears, we cannot pull the filament out.
In this case the Retry button is more suited as it will unload the filament.
lcd_encoder_diff would be set to 0 if lcd_update_enable(true)
is called outside ReportErrorHookMonitor
This would put enc_dif out of sync with lcd_encoder_diff and could cause false rotation triggering
It turned out the runout is caused by the ramming sequence in the G-code, which is interpreted before the actual MMU command gets into processing.
The frequency of these errors/runouts differed one machine from another and was really hard to track down.
Therefore - once the MMU is enabled (active and running) we'll disable filament runout handling caused by the printer's filament sensor.
There are still printers which suffer from spurious runouts for no reason.
For testing purposes, runout will be disabled until the real cause is found.
The following situation is now fixed, steps:
1. Load filament through LCD
2. Load to nozzle through LCD
3. Before filament reaches Fsensor => turn off the printer
4. Wait a few seconds and then turn the printer on again
5. Start a print through the SD card
6. Printer will unload and then re-load the filament
Previously in step 6, the printer would start a print without any
filament loaded.
- Dependent on current MMU error being processed
- Includes rename of LEFT_BUTTON_CHOICE -> LCD_LEFT_BUTTON_CHOICE (and right, middle as well) to avoid confusion with MMU buttons' ordering
To render the thermometer and degree symbols
the CGRAM table will instead swap out
the feedrate and clock symbol when
lcd_set_custom_characters_nextpage()
is called.
- We need to take into account additional 35mm move by the MMU.
- While the fsensor is not triggered, reduce the extruder movement each step from 20mm to 5mm. This should help reduce the variance in the filaments position before we run the final load to nozzle sequence.
- Fixed a bug where the feed rate was 60x higher than intended
- Adjusted the sequence via trial and error. The sequence where the filament has not exited the nozzle is 35mm shorter than the previous implementation
- I reduced the feed rate slightly (by 1mm/s) on the fast load sequence
- combined lcd_show_three_choices_prompt_P and lcd_show_two_choices_prompt_P into one function called lcd_show_choices_prompt_P
- Removed third_col parameter
- Added an enum to make the button selection result more readable
- Rename lcd_show_multiscreen_message_two_choices_and_wait_P to lcd_show_multiscreen_message_with_choices_and_wait_P
- Move MMU error screen from ReportError() to ReportErrorHook()
- Fix the menu selection to work for menus with either two choices or three choices
- The buttons shown on the MMU error menu are now determined by the definition of btnOperation[]
getFilamentPresent returns the state of the IO pin of the sensor.
So we should use AT_FSENSOR instead of IN_NOZZLE
since the fsensor does not know if the filament is actually in the nozzle.
Such that:
MMU2:E=32766ErrorTitleTextDescription
Becomes:
MMU2:E=32766 ErrorTitle TextDescription
Also simplified the process of combining ErrorTitle and TextDescription
into the msg buffer by using snprintf. This is saver since we only
use dstSize in one place instead of two.
This could cause the printer to crash. The Serial Stream would show
a garbled string.
Also included in this commit:
* The buffer size is increased from 64 bytes to 192 bytes. We need to
take into account the length of the ErrorTitle and ErrorDescription.
* Fix overwrite in ErrorCode message buffer.
When snprintf() if called we need to read the return value to see how
many bytes were written. Then when we call strncpy_P() through
TranslateProgress(), we need to tell the code to start writing
at byte 'len', or &msg[len]. Also we need to update the byte size
which strncpy_P() is allowed to write (64 - len).
This could cause the printer to crash. The Serial Stream would show
a garbled string and the same corruption would appear on the Status
Screen's status line.
makes the code a bit shorter as well, because the compiler can be sure
that the variables are not accessed from the outside of the
fsensor.cpp compilation unit.
Update fw-build.sh
- Output used space of each translation (easier to troubleshoot)
- Read config.h max size per translation
- output variant .map files (easier to troubleshoot and finding missing/unused messages)
This message is never actually shown on the LCD (it's immediately
overwritten by other content). It also include g-code in a translatable
string, which is not a good idea. It's also otherwise identical to
MSG_V2_CALIBRATION, which we should have used.
Just remove it and save some space in the process.
__loc_pri_end is inclusive and needs to be accounted for in
get_lang_symbols().
This was incorrectly excluding the last translatable string from the map
file.
Having the original PRINTER_ACTIVE macro copied at multiple spots doesn't make sense.
Refactoring it into a non-inline function saved ~400 bytes of code.
It should be safe in terms of performance, all occurrences are at non-time critical spots.
Add an additional parameter to control the position of second choice
prompt position (while defaulting to the old).
This allows Yes/No prompts to be equally spaced.
Modify lcd_show_multiscreen_message_two_choices_and_wait_P to also
handle single-screen or empty (no-clear) prompts, making other functions
redundant. Saves 76 bytes.
Change existing functions to simply call
lcd_show_multiscreen_message_two_choices_and_wait_P with the correct
arguments.
This changes the prompt of existing Yes/No messages: the previous prompt
would use the last two lines of the LCD, while the new prompt is using
just the last line of the LCD instead.
Translation do not require updates, since the Yes/No translation was
already the same in both implementations.
Allow running the model checking during autotuning, with the only
exception being the parameter estimation stage where we alter the same
value which is used by the checker (done to conserve memory/code).
With previous changes the model checker will disable/enable itself when
passing through an unavailable R vector entry, allowing to start the
calibration by checking only the stages where the part fan is disabled.
The C/R0 values should be stable enough to provide a fail-safe mechanism
for printers of the same variant right from the factory.
Instead of assuming the model state is always valid, allow NAN values to
pass-through the various check/estimation stages.
This allows running the model checker with incomplete parameters (for
example, missing entries in the R vector) and resume automatically.
flash: -22
RAM: 0
menu_lcd_lcdupdate_func() takes care of starting lcd_timeoutToStatus if the knob is clicked.
When the knob is clicked we only want to back out of the menu.
This changes makes the menus slightly more conistant behind the scenes.
flash: -8
RAM: 0
When the menu is entered and left the function
menu_lcd_lcdupdate_func() takes care of resetting the timer.
Currently the firmware will reset the timer twice when the lcd_babystep_z menu is entered. This commit fixes that.
Split the planner sync code out of planner_abort_hard() so that we can
independently resync the planner position from the counters.
This is needed in xyzcal as we directly modify the stepper counters
(bypassing both planner and stepper).
Call this new function instead of planner_abort_hard() when leaving, so
that motion can resume in the middle of the gcode_M45 instruction.
We already disable the heaters upon entering, and the new temperature
isr doesn't perform any direct movement until we return to the main
loop.
This allows us to remove direct control of the soft_pwm interrupt from
the header, which is dangerous.
printer_smodel_check was incorrectly substituting the final " with a
null in the command to simplify the model string comparison, but in
doing so was also corrupting the next pop from the cmdqueue.
We can modify the current strchr_pointer as long as we *don't* change
it's length. This can cause an incorrect extra read from the queue,
resulting in the last command to be completely ignored.
cmdqueue will run commands when EOF is reached without returning to the
main loop, which is already incorrect.
However, since it needs to ensure the queue is empty, an st_synchronize
call can result in a re-entrant call to get_command, which will
reprocess EOF again. Even if we removed st_synchronize, another command
could be picked by an unsuspecting manage_inactivity() somewhere else.
Short-circuit EOF processing by closing the file early and checking for
the file state early in get_command.
This should fix#3549
Call this variable menu_block_mask instead. We don't need to know the
exact reason of why we're locking the menu.
We will be able to reuse this to prevent menu entry during more
activities in a cleaner way than testing for each condition as it's
currently done for both menu entry and longpress.
This allows us to use "M310 B0 W0.01" as a way to report the current
error continuosly on the serial without 1) more code and 2) without
preventing regular usage.
Use OCTOPRINT_ASK_* for the present form of actions. In these cases the
host will perform the pausing manouvers for us.
Use OCTOPRINT_* instead for the past tense forms when we are in charge.
Also always emit the action, whether we are or not sd-printing. This is
due to the new Stopped handling behaving correctly in either case.
If the user accepted to resume, do not wait for bed temperature when
recovering. This only adds a pointless delay when recovering a short
pause and doesn't really improve the recovery quality after a long
pause.
Do not allow resuming until all thermal and fan errors are clear.
Call the appropriate resume function when resuming a printing depending
on the saved_print state (is saved_print is available, then we always
need to resume from the saved state even when printing via usb).
Clear the Stopped state when resuming, so that commands can be accepted
again.
Ensure we never fall into the boundary values provided by the min/max
limits.
Save/restore the initial guess value, so that a convergence failure
restores the initial model state.
Force processing of the pause and stop "parking" commands _after_ the
main loop completes.
This was/is currently done in lcd_commands, which is a poor place to
continue processing, since it can be called already within an aborted
command. This requires checking for planner_aborted before any action
can be performed.
After calling planner_abort_hard() no motion command can be
scheduled until we return to the main loop since the call can
potentially be scheduled inside a nested process_command call.
Despite previous fixes, bugs keep creeping in due to nested calls not
being obvious to detect at all.
Stop allowing motion _completely_ for the entire processing loop by
default. That is, instead of aborting the current plan_buffer_line call,
abort the entire command until we can actually schedule motion safely
again.
This benefits handling of pretty much all g/m-codes, since this flag
(now "planner_aborted" for clarity) becomes a general "command aborted"
call.
This also now ensures that the flag prevents _any_ new block (including
blocks partially planned while servicing an interrupt) are scheduled
after planner_abort_hard is called.
There are only two exceptions where it's safe to resume in this context:
- Within uvlo_, where we never return to the main processing loop
- When we're intentionally scheduling a new process_command loop for a
MK3 filament recheck (which is *bad*)
Handle those two cases as exceptions.
Do not inhibit motion when Stopped is set.
We actually do need to move to move away the extruder from the bed, and
setting Stopped breaks it without adding any sort of security (M*
commands, such as M600 could still perform moves and still pass
through, while M104 would still set heaters).
During a hard error the internal queue is cleared (and sd file closed,
if any), so no new "unforeseen" command can be read.
Handle "Stopped" instead as a flag to inhibit serial processing and
automatically switch to "paused for user" state. While in this state
simply drop any input without incrementing the processed gcode line
number, behaving as-if the last command was still being processed.
This allows "Stopped" to correctly handle a printer-initiated paused
state and recover as expected by requesting a resend when resuming.
Add a new LCD_MESSAGE_INFO priority which can be overridden by regular
status updates, but only if a certain amount of time has passed.
Assign a time stamp to all message updates, so that the time since the
last update can be determined. Also switch the message type to Status,
so that the message always becomes visibile.
Always show status or info messages when printing via SD if the message
is recent enough.
Remove useless repeated calls to disable heaters and turn on the fans,
since this is done at a higher level.
Avoid repeating messages on the serial. Do it just once.
Make a critical alert sound unconditionally.
Break out of the autotuning if a thermal error condition is detected and
attempt to restore a safe initial state irregardless of the error
handlers.
Also error out if the estimation fails to converge.
Calibrate C/R values via univariate minimization using golden section.
This is done in several passes:
- Bootstrap C by setting an initial high R value
- Calibrate R at the requested working temperature
- Cooldown
- Refine C to the final value
- Estimate R losses for a subset of fan speeds
- Interpolate remaining values to speed-up the process
This results in robust values which are tailored to the current
filtering constants, and avoid having to sample for an extended
time to reach the required resolution.
The refining pass could avoid cooldown if the recording buffer was at
least twice as large, so that we could record both the heating and the
steady-state, saving _considerable_ time.
This currently bypasses the ConfigurationStore, which doesn't fit the
malin model nicely.
temp_model is using it's own private copy directly.
But maybe we should change this in the future.
- Allow all parameters to be changed at runtime through M310
- Move the model prototypes into a separate temp_model.h header
- Allow the checked to be enabled/disabled at runtime
- Introduce a warning threshold
When triggering a thermal error, allow higher-priority errors to
override the initial error source.
This allows a fatal error such as maxtemp to trigger to a full stop even
if thermal runaway has already been triggered.
Reorder error types according to their priority.
Do not overwrite the error source if the error flag is already set.
As checks are performed in priority order, this ensures min/maxtemp
user-level handlers are triggered even if the thermal model can detect
an issue in the same cycle.
This restores MAXTEMP handling, which was simply shadowed.
Setting pid_tuning_finished can result in the heaters stuck to full
power. As a result, we need to ensure that when PID management is
disabled, heaters are also.
Use pid_tuning_finished as a flag to prevent automatic PID management.
As a result, set the default start-up state to true and adjust the
dependent code accordingly.
- Flag the error condition from the temp_mgr_isr
- Handle the error state from the user code
Currently only handles min/maxtemp and relays the error to the original
handler (which is a poor fit for the current design).
Split off setIsrTargetTemperatures and temp_mgr_pid() so that we can
propagate the target temperatures instantaneously down the pid/pwm chain
during emergencies.
This reduces the amount of code in disable_heater() itself, making it
a bit more maintenable.
The bed still isn't disabled on-the-spot yet, due to the heatbed_pwm
automaton. To be improved later.
*_temperature_raw: buffer for the ADC ISR (read by temp ISR)
*_temperature_isr: latest temperatures for PID regulation (copied from
_raw values)
*_temperature: latest temperature for user code
The flow:
- ADC ISR (async)
- perform oversampling
- call ADC callback: copy to _raw (async)
- temp ISR (timer)
- convert to C (_isr values)
- user code (async)
- check temp_meas_ready
- call updateTemperature()
- copy from _isr to current
- syncronize target temperatures
This removes PINDA value averaging (if needed, should be re-implemented
by averaging in user code where needed)
Use a new low-priority "temp_mgr_isr" running at constant rate for
temperature management.
This is done so that the temperatures are sampled at a constant
independent interval *and* with reduced jitter. Likewise for actual
PID management.
This will require further adjustment for the min/max/runaway display,
which cannot be done directly into this function anymore (the code will
need to disable heaters but flag for display to be handled in
manage_heaters).
Read from ADC as fast as possible using the ADC interrupt to get
more accurate instantaneous readings.
Decouple the temperature_isr from the adc reading interval, so that
the two can run independently for future use.
Setting pullups on the ADC should trigger the model-based check, making
this redundant and wasteful.
Keep the DEBUG_PULLUP_CRASH menu so that we can verify this behavior in
the future.
Fallback to use the default HIGH value if a frequency has not been
specified.
This makes the tone of "M300" and "M300 P<x>" identical as a result.
Supersedes #3339
Now that the position is a uint16_t instead of uint32_t, it is simpler to just sort the positions in place without using the uint8_t indices. Also, this approach is considerably lighter on the stack usage and it also removes a delay after the sorting happens
Ability to get the english (original) variant of a translated message. Helpful for serial messages where translations must be prohibited for compatibility.
Remove the first serial message, which cannot be displayed since serial
is not available yet.
Move both the serial message and display after
serial/temperature/planner is setup, so that we can use
lcd_show_fullscreen_message_and_wait_P properly.
* lang: Add a PO language extractor with FW metadata support
Implement a straight-to-po language extractor which supports our custom
language requirements:
- _i/_I/ISTR for text string definitions
- _T for catalog translations (with back-reference support)
- //// EOL comments with:
- MSG_ catalog entry name identifiers
- c=X r=Y annotations for screen dimensioning checks
- Crude support for commented lines
All source locations are correctly referenced in the PO, with the
metadata colleted in the comment for further processing.
Several checks are implemented already during extraction:
- Correct catalog name assignment (no duplicates)
- Metadata checks for each entry
Further checks will be implemented by directly checking the translated PO file.
Requires "polib" and "regex" python modules.
* lang: Adapt lang-check to work directly on PO/POT files
* lang: Allow lang-extract to generate stable (pre-sorted) output directly
* lang: Further extend lang-extract consistency/error checking
- Do not parse inside preprocessor conditionals
- Distinguish between references and definitions
- Warn about missing references and definitions
* lang: lang-extract: warn about incorrect PROGMEM assignments
Check that ISTR is used along with PROGMEM_I1 in an attempt to spot
useless translated catalogs.
* lang: lang-extract: Improved handling of same-line translations
Correctly reference metadata on same-line translations.
* lang: lang-extract: Handle _O as a cat-ref
https://github.com/prusa3d/Prusa-Firmware/pull/3434
* lang: lang-extract: Warn about unused catalog definitions
* lang: lang-extract: Allow propagating translation comments via //
The definition:
code //// definition [// comment]
will check [definition] as before, but blindly accumulate // comment.
The comment is then re-appended back into the PO files for translators
with the form:
definition
comment
comment...
* lang: Fix incorrect display definitions
* lang: lang-extract: Check source encoding/charmap
* lang: Translate the degree symbol
* lang: Unbreak/cleanup DEBUG_SEC_LANG
* lang: Improve meaning of comment
* lang: Split charset conversions into an aux lib for future use
* lang: Implement lang-map.py to extract the translation symbol map
- Extracts the translatable symbol map for further use
- Computes a stable "language signature" from the map itself
- Optionally patches the binary update the symbols
* lang: Check for translation recoding problems
* lang: Implement a transliteration map to post-process translations
TRANS_CHARS is now used to replace unavailable symbols to the source
encoding, only while producing the language catalog.
* lang: Handle/check character replacements in lang-check
Filter the translation through TRANS_CHARS, so that the preview and
length check are performed correctly for expanding replacements such as
'ß' to 'ss'.
* lang: Implement lang-build.py to generate the final language catalog
* Cleanup .gitignore
* lang: Drop txt language files
* lang: Remove outdated translation scripts and obsolete docs
* lang: Update build scripts for new infrastructure
* lang: [no] Integrate accents from po/new/no.po
We now support accents natively
* lang: Remove redundant directory po/new/
* lang: Fix encoding of LCD characters in PO files
* lang: [hr] Fix wrapping in MSG_CRASH_DET_ONLY_IN_NORMAL
* lang: Sort and reformat PO files for further massaging
* lang: Switch to developer (dot) comments for PO metadata
* lang: Allow the IGNORE annotation to skip extraction
* lang: Fix missing/broken language metadata in sources
* lang: Add update-pot.sh and regenerate po/Firmware.pot
* lang: Add update-po.sh and refresh all PO files
* lang: Add summary documentation about the new translation workflow
* Add more ignored files
* CI: Add new required dependencies to travis
* lang: lang-build: Improve warning message
"referenced" was really meaning that data is being duplicated.
* lang: Respect the language order as defined in config.sh
This correctly splits normal and community-made entries during language
selection.
* lang: More typos in the documentation
* lang: Check for the maximum size of each language
Each table needs to fit within LANG_SIZE_RESERVED
* lang: Properly align _SEC_LANG to page boundaries
... instead of relying on _SEC_LANG_TABLE to calculate the offset
* lang: Build support for dual-language hex files
Detect the printer type by checking the current variant type.
On printers with no xflash (MK2*), generate one hex file for each
additional language file by patching the built-in secondary language
table during the build process
* lang: Mention lang-patchsec.py
* lang: Use color() instead of tput for clarity
* lang: Allow disabling terminal colors with NO_COLOR/TERM=dumb
* lang: Consistent use of redirection in config.sh
* lang: Stricter variant-type check for xflash support
* lang: Output size stats when building double-language hex files
* lang: Respect NO_COLOR in lang-check.py
* lang: Check for repeated/incorrect annotations
Catch errors such as "c=1 c=2"
* lang: Correct MSG_SLIGHT_SKEW/MSG_SEVERE_SKEW annotations
* lang: [it] Improve MSG_*_SKEW translation
* lang: Use INTLHEX instead of OUTHEX_P/S for configuration
We already have OUTHEX which is the compiled firmware.
Use INTLHEX for the final internationalized firmware, which is less
confusing. Also, assume it being a prefix for all generated hex
files, which reduces the number of variables set.
* lang: Move lang_map to lib.io for further use
* lang: lang-check: Accept a firmware map file to suppress unused string warnings
* lang: Use the map file to reduce useless warnings during fw-build
* lang: lang-check: Also suppress unused empty annotations
* lang: Fix MSG_MOVE_CARRIAGE_TO_THE_TOP_Z annotation
Refresh pot file
* lang: lang-check: Do not warn about same-word translations by default
Do not warn when one-word translations such as "No" result in "No" also
in other languages, since this is common in latin languages.
Allow to re-enable the warning with --warn-same
* lang: lang-build: Handle same-source/translation efficiently
* lang: [it] Explicitly add On/Off/Reset/Wizard to suppress warnings
Instead of displaying a warning, supress the warning and explicitly
translate each entry using english (which is the common/acceptable
word in these cases).
* lang: [it] Suppress more warnings
* lang: lang-check: Add intermediate "suggest" warning category
Warnings in the "suggest" category as shown as [S] as based on pure
speculation from the checking tool, such as the translation being
significantly shorter than the original.
As a result, they can be suppressed with --no-suggest
* lang: Return translation status from lang-check
- 0 if the translation only contains suggestions
- 1 if the translation contains warnings or errors
Check for the exit status in fw-build.sh, but do nothing at the moment
except printing a non-fatal error.
* lang: Remove "trim_trailing_whitespace=false" for po files
PO files got cleaned up/rewritten. We can now ensure they stay
consistent.
* lang: [sv] Re-integrate changes from 70c73cb
* lang: [no] Reintegrate changes from @pkg2000
Everywhere MINTEMP is checked, use the configurable value set by M302,
not an hardcoded value.
EXTRUDE_MINTEMP is now used only as the initial default value.
Reduce the precision of extrude_min_temp to an integer to reduce the
generated code size (constant folding did in fact do the same previously
anyway). Having tenths of degrees is not necessary for this feature.
There is a potential for 2*8 bytes of extra sparse eeprom space, plus a
few bytes saved if we remove the update calls, so add a notice that
these values are currently only written-to, but never actually used.
Restricting the MK404 build to gcc-7 is not a good idea, since gcc-7 is
already not available in several newer distributions.
Just pick the current gcc version.
Current gcc 10 versions build MK404 correctly.
The max/min temperature check were incorrectly using
HEATER_AMBIENT_RAW_*_TEMP (non-existing) instead of the correct
AMBIENT_RAW_*_TEMP (this is not a heater afterall).
This doesn't change the current behavior, since the check defaulted to
the correct path for the MK3+ configuration anyway.
Changes based on @trondkla feedback. exceptions to his suggestions have been discussed and agreed upon (most were due to char. count and linebreak limitations.) Vocabulary/wording ready. now just need to test how everything render on the screen.
If M117 is called before M601 then we would like the custom message to
be visible on the LCD screen until the print is resumed.
Change in memory: +10 bytes of flash
Fixes#3316
Make the variable static within the checkautostart function.
When the function is called for the first time autostart_stilltocheck
is set to true and will continue to live after the function is exited.
After it is set to false within checkautostart() it will continue to be
false forever.
Using static this way is more efficient than using a global variable
Saves 6 bytes of flash and 1 byte of SRAM
Changed printfan (printvifte) to Nozzle fan (dysevifte).
Wizard (Veileder) reference improved in longer text.
Cleaned up linebreaks
Bed level correct -> Planecorrection (Plankorreksjon).
few minor typos fixed and found
Warning: Gt desktop or Poedit keeps adding an extra \ , when using \x0a (Linebreak)
M123 reports both fan speeds nicely in RPM, as well as the requested PWM
for each so that we don't need to show the test "number" to distinguish
between the two in the serial output.
Rewrite the part of the fan selftest to use a shared path between hotend
and print fan.
Remove the useless 10 seconds spin-up delay for the print fan. Reduce it
to 5 seconds.
Properly wait for readings after spin-up, so that RPMs are more
reliable. Also tune the print fan threshold to a more reasonable
default. Both, in conjunction, now avoid the "swapped fan" check that
was incorrectly triggered in almost every case.
FILAMENT_RUNOUT_SUPPORT has never been supported in the MK3 branch, and
contains a ton of horrible and unmaintained code that doesn't even
compile anymore.
Since this code is currently polluting a sizable block inside the G0/G1
code block, simply get rid of it.
01234567890123456789
Temp. cal. [Off] old
PINDA cal. [Off] new
Temp. cal. 1/6 old
PINDA cal. 1/6 new
MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE
Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED
Update status line during PINDA cal.
Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`
Tried to update translations
Updated po files
01234567890123456789
Temp. cal. [Off] old
PINDA cal. [Off] new
Temp. cal. 1/6 old
PINDA cal. 1/6 new
MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE
Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED
Update status line during PINDA cal.
Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`
Tried to update translations
Updated po files
"PINDA cal status:" is always printed no matter what cal_status is so we can pull that out of the conditional statment.
cal_status is also a boolean, lets just print it directly. Its a simpler code.
Saves 32 bytes of flash and 22 bytes of SRAM
Change serial messages to PGM
I could not see any difference in the functionality when testing this locally
Changes save 818 bytes of flash memory
(I suspect this is due to dtostrf no longer being called in the firmware for MK3S?)
01234567890123456789
Temp. cal. [Off] old
PINDA cal. [Off] new
Temp. cal. 1/6 old
PINDA cal. 1/6 new
MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE
Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED
Update status line during PINDA cal.
Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`
Tried to update translations
Updated po files
01234567890123456789
Temp. cal. [Off] old
PINDA cal. [Off] new
Temp. cal. 1/6 old
PINDA cal. 1/6 new
MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE
Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED
Update status line during PINDA cal.
Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`
Tried to update translations
Updated po files
We want to set the FINDA state IF the timer has not expired.
It is helpful to see why by looking at the commit which broke
this 802b8860c8
Without this fix my FINDA sensor just shows N/A. But after this commit is works perfectly.
Explicitly show which axes are affected on the status line when a crash
has been detected.
When the crash recovery prompt is triggered, also show all axes which
have been affected during the detection interval (currently X, Y, or
both).
The timer detection has been simplified to match the MK3 optical
filament timeout handling, which makes more sense: a crash immediately
following a crash recovery prompt will trigger the prompt again. The
timer needs to properly expire in order to reset the crash count.
This helps crash detection tuning (and help users reporting issues with
crash detection) without having to monitor the serial line.
This currently abuses the MSG_CRASH_DETECTED message by prepending the
[X][Y] labels to the message, which is ok in english but might not
translate that well for all languages.
Split off yes/no lcd handling from
lcd_show_fullscreen_message_yes_no_and_wait_P into a separate function
in order to allow generic requests where the text prompt can change.
* Replace non-block space with space
Fix of some editors create non-block spaces which cause issues.
* Replace non-block space with space
Fix single language run without config.sh OK
* Update Slovak po files
* revert delete of lang/po/Firmware_sk.po
* Fix typos
Unix format for md files
code_value() is float but in some cases we can save memory when the expected output is only 1 or 2 bytes.
Changes save 182 bytes of flash memory on my end.
- Add sort of variants. Request from @leptun
- Add Arduino IDE 1.8.19 as an option
- Allow upper and lower case. Request from @TojikCZ
MK404-build.sh:
- Allow upper and lower case. Request by @TojikCZ
- Add update option to release OR devel
* _progress_scale is max 3 so it can be uint8_t
* _progress is max 6 so it can be uint8_t
* Change _delay type to uint16_t to be explicit
Changes save 102 bytes of flash memory (Arduino IDE 1.8.19)
Only one of the statements can be true: tmpx < X_MIN_POS or tmpx > X_MAX_POS.
So we can be a little bit smarter here and skip the second if statement if the first was true.
This saves 6 bytes of flash memory and potential some clock cycles
Unfortunately this increases flash usages by 212 bytes (same usage as in current release) It seems it is most memory effcient to use int16_t (int). int8_t requires more memory.
The variable is just set to 1.0 and is never modified, I also
removed the function lcd_move_menu_1mm()
Changes save 96 bytes of flash memory and 4 bytes of SRAM
- Add sort of variants. Request from @leptun
- Add Arduino IDE 1.8.19 as an option
- Allow upper and lower case. Request from @TojikCZ
MK404-build.sh:
- Allow upper and lower case. Request by @TojikCZ
- Add update option to release OR devel
I have tested on my MK3S+ because the MK404 stops working when I select the language.
Posible to be future improvemen
Co-Authored-By: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Partially revert previous change: cancelling a single loop would often
advance the gcode stream to the next wait-for loop if executed at the
beginning of an SD print, implicitly turning off the flag again.
Cancel the loop directly in UnconditionalStop() which stops the command
queue as well in an atomic way, handling this correctly.
Remove most of the duplicated code inside temp_runaway_stop(),
making it identical to the other temperature handlers.
Move the lower-level functions required to stop the entirety of the
machine into UnconditionalStop(). Reuse this function inside
lcd_print_stop().
Set the LCD alert message before calling Stop(), as done in other safety
handlers, so that the error is visible while the printer is stopping.
This also avoids other temporary status messages to appear before
the real issue is shown and/or STEALING the first CRITICAL alert
level before we do.
Use the internal lcd_status_message_level for multiple severity levels
of alert messages.
This is needed to distinguish between non-critical alerts (such as FAN
ERROR) from critical ones (any heater issue). During a failure
scenario, a critical error MUST NOT be overridden by a lower-level one.
As such LCD_STATUS_CRITICAL is currently used for all heater-related
errors that result in a safety full-stop.
Make sure to call lcd_timeoutToStatus.start() when the SD card is inserted
into the printer after it was removed beforehand.
(cherry picked from commit 6795843f15)
Saves 8 bytes of Flash memory
This call is redundant and when moving between menus
it gets called multiple times which results in waste
of clock cycles.
lcd_timeoutToStatus.start() is called from menu_lcd_lcdupdate_func()
which is enough.
- Uniformly parse D2/D21/D23 dump types.
- Add dump2bin to parse/convert a dump into metadata and binary.
- Move the parsing into it's own module in order to be shared.
The comment behind the ASM MultiU16X8toH16 was misleading.
It actually computes ((a<<8)*b)>>16, or (a*b)>>8.
Correct the comment and C reference implementation accordingly.
In PR #3093 the progmem array FW_VERSION_NR was introduced to store the
version components, however the code didn't read it properly using the
pgm_read_* functions, making version comparisons fail.
Fix the existing/unused is_provided_version_newer() and reuse it in
show_upgrade_dialog_if_version_newer().
Similarly also read/update correctly the version in the eeprom.
- Move D23 into it's own function inside Dcodes
- Correctly include a break in the switch statement
- Show the dumper status (enabled/disabled) after toggling
- Allow to generate an immediate dump via g-code using D23 E for
symmetry with D20 E
When building with GCC 4.9.2 (bundled with PF-build-env-1.0.6.*), -Os
and LTO enabled, PID_autotune gets automatically inlined into
process_commands().
Sadly, due to the massive size of process_commands(), it results in
codegen bug doing a partial stack overwrite in process_commands()
itself, manifesting as random behavior depending on the timing of
interrupts and the codepath taken inside the merged function.
Mark the function as noinline and add a note about the affected compiler
version in order to be checked again in the future.
Use newer version of MK404-build.sh instead start the program
Added _RAM-<value> and _FLASH-<value> as OUTPUT_FILE_SUFFIX if someone builds an atmega404 firmware
Added some logic if IDE 1.8.13 is used
Added some logic if Arduino_boards 1.0.4 is used
Fixed typo
Restore original `Configuration.h` and `config.h` in case of cannceled script or failed compiling during next start of this script.
use function
Improve MK404 usage
Added _RAM-<value> and _FLASH-<value> as OUTPUT_FILE_SUFFIX if someone builds an atmega404 firmware
Added some logic if IDE 1.8.13 is used
Added some logic if Arduino_boards 1.0.4 is used
Fixed typo
Instead of using a mixture of int8_t, unsigned char and (incorrectly)
int, use uint8_t consistently for indexing the current block.
This improves the performance of the wait loop in plan_buffer_line,
which currently expands all comparisons to a word for no reason.
This also extends the theoretical limit to 128 entries.
Add some static assertions to ensure BLOCK_BUFFER_SIZE is correct.
Change atmega404 board flash argument to y
Use newer version of MK404-build.sh instead start the program
MK404-build.sh
Change board_flash argument to 'y' and firmware_version to 'f
This avoids the "busy" output interleaving with regular output in very
rare scenarios.
We should focus in finding which calls are not using manage_inactivity()
properly instead of working it around.
Code running in the temperature ISR needs to be fully reentrant, which
is hard to track down.
Move autoreporting to the main processing loop. This can make the
autoreporting slower or pause at times, but removes the reentrant
restriction, which allows us to use printf_P.
This PROGMEM is currently ignored by gcc, but even if it wasn't it
wouldn't be correct since the following code is expecting to read "item"
without fetching the array itself from PROGMEM.
The longpress function is currently called within the temperature ISR,
which is bogus. Calling the longpress function at the wrong moment
can corrupt the menu buffers.
Move the call to the main loop by changing the logic slightly:
- still sample the lcd buttons inside the temperature ISR, which keeps
scrollong/pressing responsive, but...
- set a flag to indicate that longpress has been triggered instead of
calling the function directly
- call the function on the next manage_inactivity run
Combined with #3180 this removes _most_ unsafe operations out of the ISR
which can happen during a normal run (max/mintemp warnings are still an
exception).
Instead of having to guess the PC where the SP was sampled, always take
both. This allows "seamless" stack decoding for both serial and xflash
dumps, since we don't have to guess which function generated the dump.
Make the core functions (doing the sampling) be ``noinline`` as well,
so that they always have valid frame.
Save SP which is closest to the crash location, which simplifies
debugging. For serial_dump, write SP just before the dump.
For xfdump, save SP in the dump header.
This makes xfdump_dump and xfdump_full_dump_and_reset() equivalent for
stack debugging.
Now that the stack_error function is truly minimal,
we can check for stack errors much more frequently.
Also move away stack_error from ultralcd to Marlin_main.
Rename EEPROM_CRASH_ACKNOWLEDGED to EEPROM_FW_CRASH_FLAG.
Use EEPROM_FW_CRASH_FLAG to always set the last crash reason, which
simplifies handling between the online/offline variants.
Make stack_error safe, by setting the flag and restarting immediately,
so that the error can be shown after restart.
When XFLASH is not available, allow users to request _online_ crash
dumps by using D23 (since these require active user cooperation).
Once enabled, instead of just rebooting, dump memory directly to
the serial.
As similarly done with EMERGENCY_DUMP, we have two features that can be
enabled:
EMERGENCY_SERIAL_DUMP: enables dumping on crash after being requested
MENU_SERIAL_DUMP: allow triggering the same manually through the support
menu.
Create a gap between the BSS and the stack guard.
Set this gap (STACK_GUARD_MARGIN) to 32 bytes in all variants.
The gap serves two purposes:
- Detect a stack overflow earlier (falsely triggering in overtight
situations is OK!), so that we can hopefully avoid smashing
the heap and have a clean view during the dump.
- Reserve spack space itself for the stack dumping machinery,
which is going to grow the stack even further.
Remove get_stack_guard_test_value() which was unused.
As suggested by @3d-gussner, announce to the host that a dump is
available for retrieval using an action "dump_available".
Any kind of dump is announced (even if manually triggered).
To avoid reading from xflash twice, remove some duplication and return
the crash reason directly in xfdump_check_state().
If MENU_DUMP is enabled, a new entry at the end of the "Support" menu is
added that allows to dump memory for offline use.
This allows to trigger a memory dump at any moment during regular usage
(either idling or printing) and to recover the dump later even after a
hardware reset.
If EMERGENCY_DUMP is defined, crash and dump using the new xflash dump
functionality instead of just continuing with an error message.
When an emergency crash is stored, the first restart after a crash
displays a message that debug data is available and to contact support
to submit the crash for analysis.
Ensure the language data always fits the reserved space in the XFLASH.
The script *should* use the LANG_SIZE definition from "xflash_layout",
which can be obtained by preprocessing the source code.
At the moment though this step has been omitted since running
arduino-builder to preprocess the source requires extra flags passed by
build.sh. The size has been hard-coded (and it's unlikely to change
given the content size is constant for the architecture).
This requires expanding the dcode_core address type to 32bit type,
thus enlarges the D2/D3 implementation as a result.
Still allow to save all the original space if D6 is disabled, for now.
Allow to read up to 0x21ff, which is the last byte of SRAM. Set default
starting address to 0x200, which is the first true byte.
0x0-200 is mapped to register/io space and could cause issues when read
from bi-directional registers.
Farmers want to abuse a bug from the previous firmware releases
- they need to see the filename on the status screen instead of "Wait for user..."
So we won't update the message in farm mode...
Check for lcd_draw_update to see if the lcd has been altered outside the
function and redraw the screen if full.
This fixes scenarios such as #3129 where the "Card removed" message or
the SD menu is entered from outside the function's control.
This requires checking/resetting bFilamentWaitingFlag carefully to avoid
re-entering this function _twice_ (raise_z_above will run the main
loop until complete).
Scale extruder motor current linearly with speed.
49% less heating when running at low speed and standstill, 4% more torque at maximum extrusion rate (15mm^3/s), 15% more torque in high speed movements (un/retractions).
StealthChop mode is used for low speeds (below 900mm/min)
spreadCycle is used above. Transition speed is well above maximum extrusion rate of 15mm^3/s (275mm/min) so mode transition is not expected to be visible on printed surface.
StealthChop is expected to improve printed surface quality (less artifacts).
Warning you can burn extruder motor if it is not the same impedance as original Prusa i3 Extruder stepper motor. There is no current feedback in low speed so lower impedance motor can be burned by over current.
Even there is no direct current feedback, there is no risk for original motor thermal runaway, as motor resistance increases with temperature, current decreases.
Standstill peak phase current is expected to be 500 mA and linearly increase with speed to 970 mA at 900mm/min where spreadCycle constant current regulation takes over and keeps peak current at 805 mA to maximum speed possible.
As motor heating increases with current squared, lowering low speed current from 700mA to 500mA decreases heating 49% in thate mode, where motor spends most of the time.
Enable E-motor cool mode in farm mode only (and experimental menu) - the experimental menu is visible AND the EEPROM_ECOOL variable has a value of the universal answer to all problems of the universe - i.e. two conditions must be met at the start of the FW to enable the E-cool mode. If the user enables the experimental menu, sets the E-cool mode and disables the menu afterwards, on the next start of the FW the E-cool mode will be DISABLED. This is still subject to discussion how much obscure (security through obscurity) we'd like this option to have .
Additional stuff:
* Add serial debug msg to verify if E-cool mode is on
* Avoid access to E-cool mode switch on machines without TMC2130
* Do not allow only M907 E in case of E-cool mode+warn the user on the serial line that the command was skipped
Co-authored-by: D.R.racer <drracer@drracer.eu>
gcode_M600_filament_change_z_shift is almost useless, since it performs
what is already been done internally by filament_unload().
However it *does* cause the carriage to raise earlier during unload
compared to making the user wait after "press for unload".
Change it so the calculated Z height matches MIN_Z_FOR_SWAP.
This change restores the minimum extruder height for filament purge
during M600 from the current 50mm back to 27mm from FW 3.9.
We do this by introducing a new option for unload_filament() to indicate
that the unload is part of an automatic swap, and in such cases avoid
raising more than absolutely necessary (this will _also_ come in handy
to avoid the extra purge in PR #2318 during M600).
A new define MIN_Z_FOR_SWAP is introduced for this purpose.
MIN_Z_FOR_UNLOAD is still used for manual lcd unload and for M702 and
hasn't been changed.
If the printer was already being pre-heated but didn't reach the target
temperature yet and a new filament is being inserted, the LCD used to
display a "Preheating to load" message to block the loading until the
extruder is hot.
This message is currently missing, and the ">Cancel" option doesn't
display immediately either, depending on the extruder height.
This PR fixes this behavior, which was broken during an earlier update.
We now force-update LCD updates during the first (and _only_) time the
screen is setup, and push all messages _before_ the carriage is
eventually raised, so that ">Cancel" is shown immediately as well.
mesh_bed_leveling_flag and homing_flag should be set only when the
planner is empty as a consequence of #3100, since any operation executed
*while* the mbl/homing flag is set is considered part of the compound
instruction that generated it (G80, G28, G30, G76).
Failure in doing so can result in instructions just prior being lost,
since they're incorrectly discarded (assumed to be redone).
G1 ; lost ..
G80 ; .. if PP happens here
PR #2967 altered the way ``sdpos_atomic`` was set, causing issues in the
crashdetect/powerpanic recovery offset if the instruction being
recovered happens to contain a comment.
Previously ``sdpos`` was assumed to be a single byte prior to the last
read character. sdpos+1 would thus position the index to the next
instruction. With gcode-filtering in place, sdpos is left just before
the comment, while the actual read position is at the newline. This
causes to parser to resume in the middle of the comment.
Change the value returned by cardreader::get_sdpos() to always return
the last read position, as everybody expects (!!).
This avoids the +1, and correctly sets the resume position to the next
valid instruction without overhead.
Fix cmd overflow introduced in 186ce0f.
With a precision of %f being .6 and assuming a maximum (theoretical)
acceleration of 99999 we need 47 bytes including terminating byte.
Round it to 48
This is handled in the same way crash detection is handled: homing/mbl
invalidates saved_target _and_ current position.
Fixes PP recovery during MBL and homing.
At a higher level, crash detection will repeat the last gcode command.
Some commands such as G28 or G80 need to be repeated in full and require
special handling.
In such cases, do not store the saved target coordinate (which is fake
in such cases) and invalidate the saved position.
This fixes the last coordinate of the first G1 move after recovery.
We also avoid moving from the origin when the saved position is
invalidated, which is not strictly necessary, but saves some time.
Crash detection is handled at a higher level (which automatically
repeats the current command), however we still need to abort the current
command correctly.
Handle XY crashes by checking the planner status after st_synchronize().
No actual changes done in the function in this, besides break->return.
In G28, simply call the new function instead of using goto, making the
code more readable.
Also remove the senseless comments in G28 about command queuing (dating
back to when G80 was queued instead of being executed).
As done when initializing the printer from a cold start, we need to
clamp the starting position to software endstops before setting the
planner position since 0,0 is frequently out-of-bounds.
This avoids an useless move during recovery that can cause a crash:
- Initial X is set to be 0
- G1 performed by homing will clamp X>=0, resulting in a positive shift
- If X is already at max X (extruder being parked due to PP), this will
slam at X+, causing an immediate crash.
Comment out "Please, before you create a new bug report, please make sure you searched in open and closed issues and couldn't find anything that matches."
Fix capitalization on MMU upgrade
Add space before dash for Printer firmware version
Add ** for bolding at the end of MMU upgrade firmware version
Add - to MMU upgrade firmware version
Attempt to workaround the M73 C0|D0 visual issue
This is an attempt to enable alternation of time to print finish and time
to color change even in the last minute of time to color change, i.e. be
able to print "0:00C".
The proposed solution leverages the capability of the current FW to read
float values from the C|D parameter. This could have the raw benefit of
being able still to alternate this time on the LCD as "0:00C" (or
"<1min") if the slicer sends a non-zero but <1 time right before the
color change.
Co-authored-by: D.R.racer <drracer@drracer.eu>
Co-authored-by: 3d-gussner <3d.gussner@gmail.com>
A fairly mysterious situation happened recently in the MK3 branch.
After merging #3033 (change watchdogReset() into a single inline wdr instruction)
we were unable to flash languages.
Since it looked similarly suspicious like issue #2954 we started investigating deeply.
The problem was in the code as described in the comment in this PR.
Instead of resetting the encoder status when homing or leveling, simply
exit the move/liveZ menu.
When transitioning from idle->printing, axis move shouldn't be allowed
as it would insert moves during a print. This is always wrong.
The menu must be always dismissed. Instead of checking all places where
the menu could be active, automatically dimiss the menu from within
_lcd_move when homing/MBL is happening. The long-push function and the
settings menu checks if "axis move" is possible, and thus
prevent the user to re-enter the menu already.
When doing the first layer calibration, the _lcd_babystep_z is
automatically brought back after MBL has completed.
Technically we should do the same when entering/exiting the paused state
in _lcd_move. However, it's better to dismiss _any_ menu in
stop_and_save_print_to_ram/restore_print_from_ram_and_continue instead.
To be done later...
Move axis queues movements, which disrupts a normal print, homing (when
XY is combined) or MBL.
Likewise, "Disable steppers" only makes sense when the printer is fully
idle.
Only allow such actions when the printer is not active and/or in the
paused state.
Further restrict babystep insertion when the lcd_update is enabled by
toggling homing_flag when probing Z (where Z shouldn't be touched
anyway as it would disrupt the measurement)
Also reset the encoder value during mesh leveling.
The code around these calls _requires_ that the steps are immediately
processed and/or added to the subsequent planner moves.
The only part that doesn't care about immediate insertion is the
direct user-insertion though the lcd encoder.
User can en/disable the fan check during print. This is very useful in case of false positive
fan errors to let the user to decide to finish print with "faulty" fan.
It makes no sense keeping watchdogReset as a separate function which
must be called, since it only contains one instruction: "wdr".
Not only was the code larger by 32 bytes in total, but also much slower
(call+ret take 4 cycles together for no reason in this case).
Surprisingly, doing just this on FW 3.9.3 solves issue #2954 on the one
affected EINSY board, even though it makes not much sense (there must be
some other timing issue).
Another request from our Service dept. - the user shall be prevented
from skipping the intro wizard, because otherwise some preset/calibrated
features will look like not done - especially live-z calibration.
And since there are users, who send a machine to service to perform 1st
layer calibration only, they must not omit the Z-calibration at the
start after shipping.
As the `M0/M1` moved to the beginning of the parser
- parser would not be able to "find" `M1nn` command if the query was `M1` instead of `M1 `
- to be able to "stop/halt" without sending a string and display default message use gcode `M0`
- as there are no `M0nn` gcodes the parser can query `M0` without additional space needed as in `M1 `
- If `M73` `R,S,C,D` values set the LCD Info screen clock switchs between Remaining and Change time
- If Remaining time is 0 while Change time is >0 the clock switchs between Change time and actual printing time
- If Change is 0 while Remaining time is >0 the clock shows the Remaining time
- If both are 0 the clock shows the actual printing time
- `M73 C` values are shown in "Normal" mode
- `M73 D` values are shown in "Stealth" mode
- Changing the speed will try to calculate the espected times and show `?` behind `R` or `C`
- Add parameter `C` to gcode `M73`
- LCD Info screen switches to change time if last `M73` gcode contains `C` parameter
- Examples:
- `M73 P5 R120` will display on LCD ` SD 5% 02:00R ` if it is printing at 100% speed
- `M73 P5 R120 C60` will display on LCD ` SD 5% 01:00C ` if it is printing at 100% speed
Slicers can generate "Time to change/pause/user interaction" using `C<mins:0-65535>` parameter to "overwrite" the remaining print time.
To switch between time to change and remaining time just send in intervals `M73` with or without `C` parameter.
The functions find_bed_induction_sensor_point_* have conflicting
extern and inline declarations.
These are used outside of the compilation unit only, and thus there's no
point in defining them inline.
This causes a compilation failure at O1 and above, which is strangely
avoided at Os.
... looks like I've been able to reduce the code by 80B by using the
clamp999() function. There are other spots this function can be used as
well, I didn't touch those yet.
upon request from our Service dept. - it is to do the same stuff like
Shipping prep., but keep the printer's stats intact. Still, this has to
be verified and may undergo some further changes.
Acceleration settings need to be saved in UVLO, since these are often
changed/set during a print. This is especially important for travel and
retract acceleration, which is usually set once per-print.
Saving and restoring is not 100% correct.
We save the current front-end value, which might ahead of the backend
when UVLO is triggered. Print acceleration, likely the most significant,
should be saved in the block buffer to be accurate.
Acceleration needs to be restored after the UVLO Z repositioning is
performed, using an M204 command. This is correct, however we don't save
the _temporary_ max acceleration limits set via M201, which could be
higher than the saved limits (via M500). This could result in lower
clamped values compared to the original print.
Maximum acceleration/jerk/feedrate limits should _all_ be saved in UVLO
in the future.
Allow to separate extrusion and travel acceleration settings using M204,
as Marlin 1.1.x and 2.x does using M204 T.
This allows to reduce the number of instructions required during
printing, since resetting the acceleration for travel moves is no longer
required and can be done a single time during the print.
Provision for this parameter was pre-existing, but not implemented.
M204 has two forms: the lagacy format (Marlin <1.1):
M204 S[print-acc] T[retract-acc]
and the newer format:
M204 P[print-acc] R[retract-acc] T[travel-acc]
The distinction in the MK3 FW is done based on the presence of the P
parameter. If P is seen, the new format is adoped. In the new format
however, M204 T was ignored until this change.
To keep backward compatibility, M204 S[acc] will set both print and
travel acceleration, which is identical in behavior to recent versions
of Marlin.
Depending if SD or USB/host print the firmware sends
- SD print: `// action:paused` or `// action:resumed` are send to inform USB/Host
- USB/host print: `// action:pause` or `// action:resume` are send to trigger the USB/host to handle it
- USB/host must handle `// action:pause` and `// action:resume` correctly to work
- Tested with Octoprint
- It handles every thing correctly
- Any combination of Octoprint and/or LCD `pause` and `resume` working correctly
- Tested with Pronterface
- It pauses BUT doesn't send the printer in pause position, and so it is not possible to `resume` from LCD menu
- I guess some Macros can fix that.
- Repetier Host/Server documentation shows that it should work. Not tested.
Could save 56 bytes in first step and additional 38 bytes adding `MSG_PAUSE_PRINT` to messages.c/.h
Updated `lang_en*.txt`
@todo Polish translation is 19 characters long (it still fits) BUT should be corrected to 18 chars.
It was left in the code in one of the refactoring/optimization passes.
It really didn't do any harm, but was limiting the performance of the
skipping algorithm.
+ some verification code added - will be removed after successful tests
fastio relies on macros for pin definitions, so we cannot use the const
declaration in Sd2PinMap or the arduino's definition.
Declare SDA/SCL_PIN into pins.h based on the current MCU, which is
identical in all our variants.
Remove the conflicting/unused declaration in Sd2PinMap.
- Start saving instructions as the whole PR was >1KB long.
- It turned out the compiler was unable to understand the core skipping
cycle and an ASM version had to be used.
- Add seekSet aware of the G-code filter
This is an extension/optimization of PR #2956.
It uses the cached 512B block buffer to avoid heavy-weight read() in SdBaseFile.
Even though this principle allowed the AVR to skip ~600KB of data within ~5 seconds,
the impact on code base is huge, especially into well proven and long-term stable
parts like reading a file from the SD card.
The sole purpose of this PR is to show/verify the possibility of the AVR CPU
in relation to adding thumbnails into MK3 G-codes.
Moreover, this PR shall not be merged unless the missing/commented features
are restored - especially file seeking and M84 search.
PFW-1175
If there are large blocks of comments in the G-code,
the printer may get shot down by its own watchdog.
Watchdog is generally set to 4s and updated only
in manage_heaters (and some other spots in some specific cases).
So far, the code reading the file and feeding it into Marlin
cycles indefinitely until it finds valid G-code lines and fills up the
command queue.
If the block is large enough, the printer cannot read it completely
within those 4s.
A simple workaround - bail out after some consecutive empty/comment
lines to enable other parts of code do their job (especially
manage_heaters).
Tested on MK404, previous FW fails with 600KB of comment lines at the
beginning, this patch survives. The printer even draws some update
on its status screen before starting a real print.
Introduce new macros TMC2130_MINIMUM_DELAY/STEPPER_MINIMUM_DELAY for
blocking pauses.
If MINIMUM_PULSE has defined to be zero, avoid the delay call entirely.
Farmers request having the Change filament menu item always visible in
the main menu and located after the Live Adjust Z (which disappears
after the first few printed layers).
- code_seen("string") -> code_seen_P(PSTR("string")) saved >100B of RAM!
- serial print "." -> '.' saved some code
- extract commonly used string
- SERIAL_PROTOCOLLN("") -> SERIAL_PROTOCOLLN() as no argument is
necessary
Motivation:
- save some RAM joining the autoreport flags into 1 byte
- encapsulate the magic of setting bit masks/features into a class with
a stable public interface
- remove the UI and related stuff to setting a farm number (the
communication protocol must remain intact)
- remove confirmation after print finished ("Print OK")
Both requests are highly welcome, since they allow for lowering the code
size by >1KB
PFW-963, PFW-927
Prevent bad readings/issues if someone changes the bed thermistor that is "better" with lower min values and creates a custom firmware.
The firmware will now be in the range of the PINDAv2 thermistor independant from the bed thermistor (which may change and need adjustments)
- Changed DETECT_SUPERPINDA to SUPERPINDA_SUPPORT as on miniRAMo the thermistor readings below 30°C
aren't accurate egnough to determine if SUPERPINDA is connected or not
- Add LCD toggle menu Settings -> HW Setup -> SuperPINDA [Yes/No] to overwrite SuperPINDA detection
- If EEPROM_PINDA_TEMP_COMPENSTATION is empty = 0xff then detect SuperPINDA by checking thermistor
- If EEPROM_PINDA_TEMP_COMPENSTAION is 0 then forec enable for temperature compensation menues and functions
- If EEPROM_PINDA_TEMP_COMPENSATION is 1 then force disable for temperature compensation menues and functions
Check for "gawk" on Linux
Add argument to change build number automatically to current commit or define own number
Update exit numbers 1-13 for prepare build env 21-29 for prepare compiling 30-36 compiling
When unloading + preheat immediately followed by a load, the carriage is
raised first up to 20mm, then again to 50mm.
With PR #2318 it makes sense to make more space for the extra extrusion
anyway, so make them the same. This moves the carriage only once _while_
preheating, which is nice.
Preheating already raised Z to avoid scorching the PEI sheet, as does
filament loading/unloading to allow for excess material to be removed.
However, when loading/autoloading/unloading via the LCD with a cold
nozzle the preheating menu is performed before the carriage is raised,
leaving the carriage close to the sheet while heating the nozzle.
Pre-raise the carriage already while waiting, so that the subsequent
move is automagically skipped.
Set bFilamentWaitingFlag only once to perform both the LCD
initialization and raising to the appropriate height.
Should fix#2761
The wiring for the PAT9125 on RAMBo10a boards is not directly connected
to the SCL pin and requires the sw mode.
Detect this requirement by checking the definition for the SWI2C_SCL pin
in the board definition.
Remove SWI2C_SCL/SDA from the other boards to use the HW mode.
* Add missing translations
* Add missing CZ and IT translations
* Update CZ, FR, IT, ES translations
CZ thanks to @DRracer
FR thanks to Carlin Dcustom
ES tried myself
IT thanks to @wavexx
Only missing is PL
* Improve wording +change keys
* Add missing PL translations
* Fix copy paste error in Italian
fix double translations
* Make PL translation shorter
* Fix some length issues and capital letters
* Fixed again translations length issues
updated po files
* Update FR translation - thanks @awenelo
* Fix execution of lang-check.py
- Make lang-check.py executable
- Execute directly instead of specifying the python interpreter manually
("python" is no longer available on Debian, and would default to
version 2 prior to that despite being written for python 3)
* Fix permissions of translation files
Co-authored-by: D.R.racer <drracer@drracer.eu>
Co-authored-by: Yuri D'Elia <wavexx@thregr.org>
After fixing some LA15 issues, the strenght of LA15 increased.
As such, re-adjust the conversion factor so that:
Start K10 => 0.01 (previous minimum was K15)
PLA K30 => 0.05 (was 0.07, optimal 0.045-0.06)
PETG K45 => 0.08 (was 0.13, optimal 0.07-0.11 depending on material/temp)
- Only implement a single syncronous read/write function to read a byte,
since that's all we need currently
- Implement a compact IR_SENSOR probe for PAT9125
- Saves 242 bytes compared to PAT9125_SWI2C
The temperature and fsensor ISR re-enable interrupts while executing.
However, we still need to protect the epilogue of the ISR so that
the saved return address is not altered while returning.
We hoist the body of the function out of the isr in both cases for
clarity (and to avoid a stray return bypassing the lock/cli), so that
the re-entrant portion is clearly indicated.
This should fix the "STATIC MEMORY OVERWRITTEN" error messages randomly
happening when stepping at high frequency (where either isr is
preempted more frequently).
Factor-out MIN/MAXTEMP [BED/AMB] out of the error message, which is now
built at runtime instead.
Introduce two missing ultralcd functions lcd_setalertstatus and
lcd_updatestatus to handle regular strings.
246272 -> 246084 = 188 bytes saved
Partially revert 285b505c73a54e9af01816e3a614de73ad181851 so that
we ensure heaters are disabled ASAP in case of potential bugs
in the max_*_error functions.
Take advantage of the NTC thermistor found on the Einsy as an additional
safety measure, following the steps of the other MIN/MAXTEMP errors.
Introduce two configurable params AMBIENT_MINTEMP and AMBIENT_MAXTEMP
in the variant defines and set them for the MK3/MK3S to -30/+100
respectively.
AMBIENT_MINTEMP is primarily intended to catch a defective board
thermistor (to ensure MAXTEMP would be properly triggered) and thus the
trigger temperature is set just above the sensing limit and well below
the operating range.
AMBIENT_MAXTEMP is set at 100C, which is instead 20C above the maximum
recommended operating temperature of the Einsy. The NTC thermistor is
located just above the main power connector on the bottom of the board,
and could also help in detecting a faulty connection which can result in
rapid overheating of the contacts.
As for MAXTEMP, we cut power to the heaters, print fan and motors to
reduce power draw. Resume is not possible except by resetting the
printer, since the user is highly advised to inspect the board for
problems before attempting to continue.
In max/min_temp handlers remove the redundant disable_heater() call.
Handlers already need to call Stop(), which will disable all heaters
as the first step.
Fix comments in order to mention that all heaters get disabled.
Use "MAX/MINTEMP BED" correctly in both the LCD and serial.
Remove most of the original complexity from advance_spread.
Instead of accumulating time to be scheduled, plan ahead of time each
eISR tick using the next main interval + an accumulator (eISR_Err),
which keeps everything much simpler.
The distribution of the advance ticks is now using the real LA
frequency, which leaves a bit more time between the last LA tick and
the main stepper isr.
We take advantage of the accumulator to force a LA tick right after the
first main tick, which removes a +/- 1 scheduling error at higher step
rates.
When decompressing, we force 2 steps instead, so that the direction
reversal happens immediately (first tick zeros esteps, second inverts
the sign), removing another +/- 1 error at higher step rates.
If you're using flow to correct for an incorrect source diameter, which
is probably the main usage when using the LCD, then LA shouldn't be
adjusted.
It's still unclear what the effect of M221 in gcode should be regarding
overall extrusion width. If M221 means "thicker lines", then LA should
also be adjusted accordingly.
This stems from the fact that the source diameter/length needs to be
known in order to determine a compression factor which is independent of
the extrusion width, but the FW only ever sees one value currently (the
extrusion length) which combines both.
This makes it impossible for the FW to adjust for one OR the other
scenario, depending on what you expect for M221 to mean.
The e/D ratio should be calculated using the extrusion length.
As such, purify the e_D_ratio from the current extruder multiplier in
order to account correctly for flow adjustments.
Turns out for high-res curved models the numerical error and the
SLOWDOWN handling in the planner can cause enough variance in the
calculated pressure to trigger LA to continuosly, making matters worse.
Clamp LA again, but only during extrusion, so that the runaway error is
limited by the current segment length.
Add constants for the various required delays in tmc2130.h,
which will come in handy for stepper.cpp as well.
Move the delays in the _set functions and remove the pauses
from the various calling points and macros.
Note that the hard-coded pause wouldn't cut it for the stepper ISR,
but it's fine for other use cases.
Introduce new wrapper macros to tick the stepper pins.
Default to the original raising-edge stepping mode.
When using the TMC double-edge stepping mode (aka half-wave or
square-wave mode) the _LO macros become no-ops.
Calling plan_set_*_position should never be done without a sync, since
the current_position can be (and usually is) several steps ahead.
In retract() and inside the autoretract support, call st_synchronize()
prior to calling any of these functions so that we don't corrupt the
position of the backend!
When unretracting, split the Z and E moves in two steps so that the E
unretraction is not slowed down by the Z axis.
Fix the indentation of the affected code.
Before PR #2591 LA was automatically capped during cruising or
deceleration. However we now rely on reaching the current pressure state
exactly to stop. When dual/quad stepping inside the eISR we might incur
in oscillating behavior if we do not handle it correctly.
This might be the cause behind #2757
This now changes e_step_loops to be a phase-local variable, so we now
reset it each phase too (instead of per-segment).
When switching to a new trapezoid step with the right pressure, cancel
any pending eISR right away.
Similarly do not schedule another eISR if the pressure will be reached
by the end of the eISR.
This was done in the past to preserve the current LA_phase. This is not
needed anymore, since it will be reset at each trapezoid step when LA
is re-initialized.
There was an official website of Toshiba called "FlashAir Developers '', and
there was information necessary for FlashAir development, but since it closed in September 2019.
Instead, I will point an archive site for developers.
According to the reprap wiki, M46 has been assigned to display its assigned IP address, but has been disabled.
Now that Toshiba FlashAir IP address processing is working, I activate the M46 code so that I can read the IP address information via serial.
W-04 needs to use CMD17 instead of CMD48 to retrieve iSDIO register memories.
To supporting both W-03 and W-04 card, I changed the readExt() code to use CMD48 first and use CMD17 if it returned some error.
This method is from the FlashAir developer sample code.
https://flashair-developers.github.io/website/docs/tutorials/arduino/2
Now that we have the new CUSTOM_MSG states, we can use them in the M0/M1
and M117 handlers to force the user message to be displayed even when
the printer is printing from a SD card and displaying a file name.
When the printer prints from a SD card, the display of progress messages
and filename takes precedence over CUSTOM_MSG_TYPE_STATUS messages used
by M0/M1/M117. Let's introduce two new CUSTOM_MSG states, one that
overrides the SD status while waiting in M0/M1 (M0WAIT) and one that
ensures the message will be displayed in at least one screen update
(MSGUPD).
Move M0/M1 decoding before any other command. The M0/M1 message can contain
arbitrary characters and so it also can contain substrings that other
decoders trigger on, like the letter 'G'. Any such substring would cause
misdecoding of the M0/M1 and unpredictable behavior in addition to not
making the printer stop.
M117 already received the same treatment in the past, so we take the same
approach for M0/M1.
Before you create a new bug report, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page. If it does, comment there. Even if it's closed, we can reopen it based on your comment.
- type:dropdown
id:printer_model
attributes:
label:Printer model
description:Enter the printer model(s) where you encountered the issue
options:
- MK3S/+
- MK3
- MK2.5S
- MK2.5
validations:
required:true
- type:dropdown
id:mmu_model
attributes:
label:MMU model
description:Enter the MMU model(s) where you encountered the issue
multiple:false
options:
- No-MMU
- MMU3
- MMU2S
validations:
required:true
- type:input
id:firmware_version
attributes:
label:Firmware versions
description:|
If you're using a custom firmware (not downloaded from Prusa), please note that!
placeholder:'3.14.0, 3.12.0-RC1, 3.14.0 and 3.0.2...'
validations:
required:true
- type:input
id:optional_upgrades
attributes:
label:Upgrades and modifications
description:'If your printer has upgrades or was modified, please note that! If not, please write None or leave blank.'
placeholder:|
None, custom extruder/hotend (which), different frame, ...
- type:dropdown
id:printing_from
attributes:
label:Printing from...
multiple:false
options:
- SD Card
- PrusaLink
- PrusaConnect
- OctoPrint
- Other host software
validations:
required:true
- type:textarea
id:description
attributes:
label:Describe the bug
description:Write a concise description of the bug.
validations:
required:true
- type:textarea
id:reproduction
attributes:
label:How to reproduce
description:|
If you are able to reproduce the issue - meaning that you can trigger it yourself by following certain steps - please describe the step-by-step process in as much detail as possible!
- type:textarea
id:expected_behavior
attributes:
label:Expected behavior
description:|
If the printer did something unexpected, or if the procedure is missing a step that would resolve the issue, please provide a step-by-step process of how it should behave.
- type:textarea
id:files
attributes:
label:Files
description:|
Provide at least one of these (ideally as many as you can) to help developers track down the bug.
*Toupload files, compress them into a .zip file and drag them to the text area to upload.* Images and videos can be uploaded directly.
- **gcode**file
- **3mfproject** which includes the model and printer settings
- **video**or **photos** of the issue happening
**Crashdump:Do not share the file publicly**, as the crash dump contains a raw snapshot of the printer's memory and may include unencrypted sensitive information.
Please send the crash dump file to Prusa by emailing it to reports@prusa3d.com and referencing this issue. In reply to the email, you will be automatically assigned a reference code to be mentioned in the issue. Sharing this file is important and helps us investigate the bug.
The maintainers of the "Community made" feature should/will react.
Please, before you create a new "Community made" ticket, please make sure you searched in open and closed issues and couldn't find anything that matches.
- type:textarea
id:which_community
attributes:
label:Which Community made feature do you want to address?
description:Suggest an improvement of the existing functionality
title:'[ENHANCEMENT] '
labels:
- enhancement
body:
- type:markdown
attributes:
value:|
Before you create a new enhancement, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type:checkboxes
id:printer_model
attributes:
label:Printer model
description:Select the printer model(s) where you would like this enhancement
options:
- label:MK3S/+
- label:MK3
- label:MK2.5S
- label:MK2.5
validations:
required:true
- type:textarea
id:description
attributes:
label:Describe the enhancement
description:How would this enhancement improve your experience? Do you have a specific use case where this enhancemnet is especially needed?
validations:
required:true
- type:textarea
id:expected_functionality
attributes:
label:Expected functionality
description:|
Describe the way the enhancement would change existing functionality. You can also describe it in a step-by-step basis if applicable.
Before you create a new feature request, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type:checkboxes
id:printer_model
attributes:
label:Printer model
description:Select the printer model(s) where you would like this feature
options:
- label:MK3S/+
- label:MK3
- label:MK2.5S
- label:MK2.5
validations:
required:true
- type:textarea
id:description
attributes:
label:Describe the feature
description:How would this feature improve the printer? Are there specific use cases where this would be beneficial? Describe how you would use it.
validations:
required:true
- type:textarea
id:expected_functionality
attributes:
label:Expected functionality
description:|
Describe the way the feature would work. You can also describe it in a step-by-step basis if applicable.
stale-issue-message:'Thank you for your contribution to our project. This issue has not received any updates for 60 days and may be considered "stale." If this issue is still important to you, please add an update within the next 7 days to keep it open. Administrators can manually reopen the issue if necessary.'
close-issue-message:'This issue has been closed due to lack of recent activity. Please consider opening a new one if needed.'
# Don't act on things assigned to a milestone or assigned to someone.
exempt-all-milestones:true
exempt-all-assignees:true
enable-statistics:true
# Disable this and change the operations per run back to 30 when this goes live.
MESSAGE(STATUS"Configuration.h and tag match: OK (${PROJECT_VERSION}/${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})")
else()
MESSAGE(STATUS"Configuration.h and tag (not enforced): (${PROJECT_VERSION}/${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})")
**MK404 is a community 3d printer simulator created by @vintagepc**
Please checkout and support his github repository [MK404](https://github.com/vintagepc/MK404) and the [MK404 Wiki](https://github.com/vintagepc/MK404/wiki)
At this moment the `MK404-build.sh` script is only supported on Linux
- `MK404-build.sh`
- Maintainers: **@3d-gussner**
- Co-maintainers:
- Contributors:
- [X] **Active** since August 2021
- [X] **Maintained** since August 2021
### How-to use MK404-build.sh
After compiling with `PF-build.sh` you get the option to start the `MK404` simulator with the fresh compiled firmware. (Linux only at this moment)
Help `./MK404-build.sh -h`
# Translations
- see [/lang/Community_made_translations.md](https://github.com/prusa3d/Prusa-Firmware/blob/MK3/lang/Community_made_translations.md)
# Arc interpolation features
**Arc interpolation features by @FormerLurker**
Please read more about it [here](https://github.com/prusa3d/Prusa-Firmware/pull/2657) and [here](https://github.com/FormerLurker/ArcWelderPlugin)
- Maintainers: **@FormerLurker**
- Co-maintainers:
- Contributors:
- [X] **Active** since January 2023
- [X] **Maintained** since May 2020
# MeatPack
**MeatPack by @scottmudge**
Please read more about it [here](https://github.com/prusa3d/Prusa-Firmware/pull/2955), [here](https://github.com/prusa3d/Prusa-Firmware/pull/4067) and [here](https://github.com/scottmudge/OctoPrint-MeatPack/)
- Maintainers: **@scottmudge**
- Co-maintainers:
- Contributors:
- [X] **Active** since April 2023
- [X] **Maintained** since January 2021
# E3D Revo
**The E3D REVO support is a community effort thanks to these Contributors, E3D and others.**
// I wouldn't see a reason to go above 3 (=9 probing points on the bed)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to esimate the plane of the print bed
#define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_LEVELING_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER -25
#define Y_PROBE_OFFSET_FROM_EXTRUDER -29
#define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
#define Z_RAISE_BEFORE_HOMING 5 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
//If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
//The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
// You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
// #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!
//#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers timeout, it will need X and Y homing again before Z homing
// - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
// - Block Z homing only when the probe is outside bed area.
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28)
#endif
#ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range
// If you select a configuration below, this will receive a default value and does not need to be set manually
// set it manually if you have more servos than extruders and wish to manually control some
// leaving it undefined or defining as 0 will disable the servo subsystem
// If unsure, leave commented / disabled
//
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm). Used by the volumetric extrusion.
// Calibration status of the machine, to be stored into the EEPROM,
// (unsigned char*)EEPROM_CALIBRATION_STATUS
enumCalibrationStatus
{
// Freshly assembled, needs to peform a self-test and the XYZ calibration.
CALIBRATION_STATUS_ASSEMBLED=255,
// For the wizard: self test has been performed, now the XYZ calibration is needed.
CALIBRATION_STATUS_XYZ_CALIBRATION=250,
// For the wizard: factory assembled, needs to run Z calibration.
CALIBRATION_STATUS_Z_CALIBRATION=240,
// The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode.
CALIBRATION_STATUS_LIVE_ADJUST=230,
// Calibrated, ready to print.
CALIBRATION_STATUS_CALIBRATED=1,
// Legacy: resetted by issuing a G86 G-code.
// This value can only be expected after an upgrade from the initial MK2 firmware releases.
// Currently the G86 sets the calibration status to
CALIBRATION_STATUS_UNKNOWN=0,
};
// Try to maintain a minimum distance from the bed even when Z is
// unknown when doing the following operations
#define MIN_Z_FOR_LOAD 50
#define MIN_Z_FOR_UNLOAD 20
#define MIN_Z_FOR_PREHEAT 10
#define MIN_Z_FOR_LOAD 35 // lcd filament loading or autoload (values for load and unload have been unified to prevent movement between unload & load operations!)
//! @retval true Succeeded. Stored settings retrieved or default settings retrieved in case EEPROM has been erased.
//! @retval false Failed. Default settings has been retrieved, because of older version or corrupted data.
//! @retval true Succeeded. Stored settings retrieved or default settings retrieved in case EEPROM cs was empty.
//! @retval false Failed. Default settings has been retrieved, because of version mismatch
boolConfig_RetrieveSettings()
{
boolprevious_settings_retrieved=true;
charver[4]=EEPROM_VERSION;
EEPROM_readData(reinterpret_cast<uint8_t*>(EEPROM_M500_base->version),reinterpret_cast<uint8_t*>(cs.version),sizeof(cs.version),"cs.version");//read stored version
floatacceleration;//!< Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
floatretract_acceleration;//!< mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
floatminimumfeedrate;
floatmintravelfeedrate;
unsigned longminsegmenttime;
uint32_t min_segment_time_us;//!< (µs) M205 B
floatmax_jerk[4];//!< Jerk is a maximum immediate velocity change.
floatadd_homing[3];
floatzprobe_zoffset;
floatzprobe_zoffset;//!< unused
floatKp;
floatKi;
floatKd;
@ -36,8 +36,15 @@ typedef struct
boolvolumetric_enabled;
floatfilament_size[1];//!< cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
floatmax_feedrate_silent[4];//!< max speeds for silent mode
settings_init();// also sets the state to State::initializing
calcChunkSteps(cs.axis_steps_per_mm[E_AXIS]);// for jam detection
if(!pat9125_init()){
deinit();
triggerError();
;//
}
#ifdef IR_SENSOR_PIN
elseif(!READ(IR_SENSOR_PIN)){
;// MK3 fw on MK3S printer
}
#endif // IR_SENSOR_PIN
}
voidPAT9125_sensor::deinit(){
// puts_P(PSTR("fsensor::deinit()"));
;//
state=State::disabled;
filter=0;
}
boolPAT9125_sensor::update(){
switch(state){
caseState::initializing:
if(!updatePAT9125()){
break;// still not stable. Stay in the initialization state.
}
oldFilamentPresent=
getFilamentPresent();// initialize the current filament state so that we don't create a switching event right after the sensor is ready.
oldPos=pat9125_y;
state=State::ready;
break;
caseState::ready:{
updatePAT9125();
postponedLoadEvent=false;
boolevent=checkFilamentEvents();
;//
returnevent;
}break;
caseState::disabled:
caseState::error:
default:
returnfalse;
}
returnfalse;
}
#ifdef FSENSOR_PROBING
boolPAT9125_sensor::probeOtherType(){
SET_INPUT(IR_SENSOR_PIN);// input mode
WRITE(IR_SENSOR_PIN,1);// pullup
_delay_us(100);// wait for the pullup to pull the line high (might be needed, not really sure. The internal pullups are quite weak and there might be a
externintextrudemultiply;// Sets extrude multiply factor (in percent) for all extruders
externintextruder_multiply[EXTRUDERS];// sets extrude multiply factor (in percent) for each extruder individually
externfloatvolumetric_multiplier[EXTRUDERS];// reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
externfloatextruder_multiplier[EXTRUDERS];// reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
externfloatcurrent_position[NUM_AXIS];
externfloatdestination[NUM_AXIS];
externfloatmin_pos[3];
externfloatmax_pos[3];
externboolaxis_known_position[3];
extern int fanSpeed;
externint8_t lcd_change_fil_state;
externuint8_t fanSpeed;//!< Print fan speed, ranges from 0 to 255
//files auto[0-9].g on the sd card are performed in a row
//this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset
// Therefore don't remove the command from the queue in the loop() function.
boolcmdbuffer_front_already_processed=false;
// Used for temporarely preventing accidental adding of Serial commands to the queue.
// For now only check_file and the fancheck pause use this.
boolcmdqueue_serial_disabled=false;
intserial_count=0;//index of character read from serial line
booleancomment_mode=false;
boolcomment_mode=false;
char*strchr_pointer;// just a pointer to find chars in the command string like X, Y, Z, E, etc
unsignedlongTimeSent=_millis();
unsignedlongTimeNow=_millis();
longgcode_N=0;
ShortTimerserialTimeoutTimer;
longgcode_LastN=0;
longStopped_gcode_LastN=0;
uint32_tsdpos_atomic=0;
@ -91,14 +96,19 @@ bool cmdqueue_pop_front()
voidcmdqueue_reset()
{
bufindr=0;
bufindw=0;
buflen=0;
while(buflen)
{
// printf_P(PSTR("dumping: \"%s\" of type %u\n"), cmdbuffer+bufindr+CMDHDRSIZE, CMDBUFFER_CURRENT_TYPE);
ClearToSend();
cmdqueue_pop_front();
}
bufindr=0;
bufindw=0;
//commands are removed from command queue after process_command() function is finished
//reseting command queue and enqueing new commands during some (usually long running) command processing would cause that new commands are immediately removed from queue (or damaged)
//this will ensure that all new commands which are enqueued after cmdqueue reset, will be always executed
cmdbuffer_front_already_processed=true;
cmdbuffer_front_already_processed=true;
}
// How long a string could be pushed to the front of the command queue?
if(MYSERIAL.available()==RX_BUFFER_SIZE-1){//compare number of chars buffered in rx buffer with rx buffer size
@ -390,17 +368,24 @@ void get_command()
}
// start of serial line processing loop
while((MYSERIAL.available()>0&&!saved_printing)||(MYSERIAL.available()>0&&isPrintPaused)){//is print is saved (crash detection or filament detection), dont process data from serial line
while(((MYSERIAL.available()>0&&!saved_printing)||(MYSERIAL.available()>0&&printingIsPaused()))&&!cmdqueue_serial_disabled){//is print is saved (crash detection or filament detection), dont process data from serial line
if(fanSpeedSoftPwm>=MIN_PRINT_FAN_SPEED){//if we are in rage where we are doing fan check, set full PWM range for a short time to measure fan RPM by reading tacho signal without modulation by PWM signal
/// but use less bits of soft PWM - something like soft_pwm_bed >> 2
/// that may further reduce the CPU cycles required by the bed heating automaton
/// Due to the nature of bed heating the reduced PID precision may not be a major issue, however doing 8x less ISR(timer0_ovf) may significantly improve the performance
/// Due to the nature of bed heating the reduced PID precision may not be a major issue, however doing 8x less ISR(timer0_ovf) may significantly improve the performance
staticconstuint8_tslowInc=1;
ISR(TIMER0_OVF_vect)// timer compare interrupt service routine
//Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
externuint8_tlcd_draw_update;
externint32_t lcd_encoder;
externint16_t lcd_encoder;
externuint8_tlcd_encoder_bits;
// lcd_encoder_diff is updated from interrupt context and added to lcd_encoder every LCD update