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.
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 used to be a single stage where an extruder reversal could occur,
but since PR #2591 reversals can happen up to two times per trapezoid.
Reset LA_phase when ADV_INIT is set, since it is re-inizialized only
when needed a few lines afterward. This improves performance by avoiding
to check the phase continuosly to the end of the trapezoid.
Likewise, always set ADV_INIT during the first cruising step, also to
force a LA_phase reset.
PR #2591 made LA compression always account for retractions instead of
discarding the current compression steps. While this fixed overextrusion
in short segments followed by wipes, it uncovered another issue in how
the compression steps are spread during the trapezoid calculations
leading to gaps in segments followed by retractions (as highlighted by
/some/ prints in #2693).
LA1.5 always computes the required target compression steps for a
segment at nominal speed. Because of how the extra steps are allocated
using multiples of the accelerating frequency, if the segment is
truncated before cruising is reached, an additional cycle of steps can
be inserted before deceleration starts. Deceleration is also not
guaranteed to be symmetric where up to _two_ cycles can be skipped
depending on the stepping cycle, leading to a situation where a
symmetric acceleration/deceleration block will lead up to a cycle of
accumulated compression.
While forcing an the extra step during deceleration is possible by
tweaking the error term (eISR_Err), this doesn't guarantee balance in
all cases. The underlying issue is that the function is aiming a
compression which cannot be reached (nominal speed), and not at the
effective max speed reached in the trapezoid, thus moving the average
result higher over time.
We fix this by calculating the effective maximum speed (and compression)
reached during the trapezoid, which stops compression on the required
cycle irregardless of the error term, balancing the result.
This is the first unoptimized POC: this is not for production: a lot of
calculations are redundand and could work directly in steps/s^2.
This saves nearly all of additional FLASH usage of previous commit. It is only 70B worse than if no skipping is done in temperature compensation gcode G76.
There is no known purpose of this call.
lcd_temp_calibration_set() is switching on/off pinda temperature compensation from LCD settings menu (this is called "Temp. cal." on LCD).
st_current_init() does nothing on Einsy board, it enables and sets motor current selecting outputs on Rambo board (it used to be called digipot in history)
* Update EEPROM_FSENSOR_PCB documentation
* Update IR sensor check
* Rename IR messags and add UNKNOWN state
* Update code to use new messages
* To be continued
* Move fsensor related things from ultralcd.h to fsensor.h
* Use defined Thresholds
* IR sensor auto detection "0.3 or older" and "0.4 or newer" when trigger status changes.
Typo fixes
Doxygen documentation
* Cleanup spaces
* Revert PF-build.sh changes
* re-add space in messages
* revert doxygen snytax
* Remove double _Undef
* Fix indentation and doxygen syntax
* Fix indentation
* Better message handling
* Fix indentation
* Fix indentation
* More indentation fixwa
* Extract common code into manage_inactivity_IR_ANALOG_Check
Saves ~60B of code
* Revert indentation changes on fsensor.cpp
* Keep the selftest IR sensor part disabled
Everything shall happen at runtime
* Fix indentation fsensor_update
* Fix another misleading indentation in fsensor_update
Co-authored-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Co-authored-by: D.R.racer <drracer@drracer.eu>
* Combine repeated calls into functions with much less parameters -> 2KB
down.
* Save some bytes by removing unnecessary 1-character strings: "x" -> 'x'
used in SERIAL_xxx printing macros.
This is also saves some CPU cycles
* Fix compilation for MK25S and MK3
* Copy surrounding indentation
* Fix compilation for a rare HW setup
* rename mesh_planXX_buffer_line back to mesh_plan_buffer_line
* Remove active_extruder from remaining plan_buffer_line_destinationXYZE
calls and one more fix of indentation
Increase the flattened response in the e-jerk conversion from the 1-4.5
region to 0.3-4.5 (same slope). This brings a 0.3 LA10 e-jerk to a 3.45
LA15 equivalent.
This will better handle the legacy Pretty PETG/CFPETG v3 profiles.
* Add and update missing translations
- updated in Firmware/ files the missing `c=xx` column and `r=yy` rows.
- added missing translations to lang/lang_en*.txt
Everyone is developing and adding messages to serial and especially to LCD PLEASE add `//// c=xx` or `//// c=xx r=yy` comments.
Preparing translations files without that information is a pain in the ... and takes way more time for somebody else
to review to code as it would take you.
* No need to have `MSG_abcde` again in comments `////` in `messages.c`
* German translation
* Missed a space
* Use the same format as somewhere else
* French translation.
I am not a native French speaking person, so please excuse my mistakes I may have done.
* Spanish translation.
I am not a native Spanish speaking person, so please excuse my mistakes I may have done.
* CZ translation
* Fix typos
* Another fix
It is
Dimmwert and not Dim Wert
* Fix issues reported by `lang-check.py`
* Add "difficult" messages containing `%`
* Updated MSG and German translation
* removed a translation as it breaks the language selection
* No need to wait until any-key is pressed
* No need to wait any-key is pressed
* Fixed two LF issues
* Updated PO files
ready to be send to translators
* Add missing italian translations
* Improve some existing italian translations
* More italian fixes
* More italian fixes
* Add exceptions in editorconfig for po files to avoid recoding
* Fix typo
Thanks @DRracer for pointing out
* Italian translation by @wavexx
* Update po/new/*.po files
* Update after merging MK3 branch
* Update French translation and some c=xx comments
Big thanks to @awenelo @carlin57 for helping with the french translations and their comments.
* Update po files after French translation
* Fixed most `lang-check.py` reported translation errors for Czech and German.
Two Czech have to be reviewed as these are too long.
One German is correct as it is shown in c=20 r=2 but is 1 char longer than this to split the message.
One German translation seams to be to long but have to review the actual max length
* Fix `lang-check.py` Spanish translation errors
There have been quite lot TOO long messages,
Can't imagine that nobody every complained about that.
* Fix `lang-check.py` Italian translations errors
* Update not_tran and not_used files after fixing several translations
* Some more error fixes and update of `po` files
* Polish translation
* Czech updated
* Fix typo
* no need to translate `\x00` if it is the same
* Polish: Runouts->Koniec
* Polish: Runouts->Konce f ... hopefully the last change
* Added MK2.5/s auto power mode to eeprom doxygen
* Final updates.
- Compiled all versions with multi-languages
- Compiled all versions with EN_ONLY
- updated all /lang/po/Firmware*.* files
* Add crlf attributes for po files
As done for editorconfig, this similarly forces git to handle
po files consistently in DOS format.
* Further improvent of IT translations
* Updated translation
Added cleanup to PF-build.sh
* remove lang/not_tran* and lang/not_used mistakenly added into the PR
Co-authored-by: DRracer <drracer@seznam.cz>
Co-authored-by: Yuri D'Elia <wavexx@thregr.org>
Co-authored-by: D.R.racer <drracer@drracer.eu>
As pointed out by @leptun, with MMUs the combination of old/new filament
profiles in the same print is a likely scenario as we transition towards
LA1.5. Reset the detection state also with K0.
Move la10c_reset into finishAndDisableStepper, which is called in both
via lcd_print_stop() and indirectly via M84, saving some space.
M84 is checked-for to determine a complete file, so it's a superior
candidate to G80 (which some people avoid due to MBL issues).
Allow the LA 1.5 MAX value to be configured in Configuration_adv.h.
Define a customizable LA10<>15 detection threshold in function of the
above limit.
Clamp the result of of the LA10->15 return value to always
respect the new LA_K_MAX.
* MK3S IR sensor detection and safe operational range fix
* debug, change of fsensor_IR_check behavior
* more doc + disable debug print voltage
* fix displaying MSG_04_OR_NEWER and MSG_03.... kudos to @ovariludovit
* better handling of fsensor not responding scenario
Handle uniformly compression & decompression at any stage of the
trapezoid.
Compared to before, this now enables LA compression also in the cruising
step (handling the converse of a chained wipe), as well as decompression
during acceleration.
Both of these can happen as a result of jerk moves, but are incredibly
rare. This is mostly needed to allow rapid decompression directly at the
acceleration step during travels between a retraction&deretraction.
We also check for the pressure level in a single place, reducing code
size as well as disabling LA earlier when not needed for the rest of the
block.
Perform the check one step earlier, avoiding 32bit overflow for very low
compression factors.
Fixes#2566 (although for K15 to have effect the conversion probably
needs to be adjusted on the low end)
LA assumes all the nozzle pressure is released at the end of each
extrusion, which makes calculating the required pressure advance during
travels and retracts not normally necessary.
This is not always true in our planner, since the E axis is explicitly
ignored when not in use, but also due to E-jerk allowing a non-linear
jump in speed. And since the compression factor is currently tied by XYZ
axes and not independently calculated, this can result in a wrong
estimation of final pressure in several conditions.
To avoid overburdening the planner, change the underlying assumptions
about backpressure:
1) Pressure is no longer lost when LA is disabled: if a retract is
followed by an unretract of the same length, the pressure will be likely
maintained entirely. This also holds true during travels, as long as the
retract length can overcome all the backpressure (which is the case in
all but the most noodly materials)
2) Pressure is released as soon as possible during travels: we now
enable LA also during travels, but under the sole condition of undoing
excess pressure.
We do that by checking for backpressure at the start of any segment
without an acceleration phase that doesn't have any E-steps (a result
which can happen due to the above). If pressure is not nominal, we run
the extruder in reverse at maximum jerk as long as the segment allows
us, since proper acceleration would be prohibitive at this stage. As the
pressure difference resulting by the above is still _very_ low, any wipe
or short travel will be able to equalize the nozzle pressure *before*
extrusion is resumed, avoiding ooze.
In the current code we initialize the LA state on-demand already at the
right step, which makes keeping track of the tick position no longer
necessary.
Make the advance ISR almost stateless by removing the last vestiges of
the original implementation and introduce a single target pressure. This
will be needed later in order to trigger the LA isr inside the cruising
phase.
I forgot to change also the
- `#ifdef DEBUG_DCODE_3` to `#if defined DEBUG_DCODE3 || defined DEBUG_DCODES`
- `#ifdef DEBUG_DCODE_5` to `#if defined DEBUG_DCODE5 || defined DEBUG_DCODES`
in the `Dcodes.h` file which I added to `Dcodes.cpp`.
Due to this issue the "Debug" version fails during compiling.
Sorry for that.
* Fix missing (hex) in D5 code
* Make ALL D-codes available for DEBUG mode
until now D3 and D5 needed to be defined separately
* Forgot to modify Marlin_main
Some EEPROM allocations do not use the hole allocated space:
- EEPROM_FARM_NUMBER is only numeric 000-999 and only uses 2 bytes to store the Farm number BUT allocated 3 bytes. Added EEPROM_FREE_NR1 as free space that can be used
- EEPROM_CRASH_DET just changes 1 byte to save it status [on/off] but allocated 5 bytes. Added EEPROM_FREE_NR2 to EEPROM_FREE_NR5 as free space that can be used
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.
Just after setting up the w2m matrix, call "clamp_to_software_endstops"
on the current_position (initially [0,0,0]) to move it to the effective
minimal position, which is usually [0,0,non-zero] due to MIN_Z and the
negative probe offset.
This is required to calculate correctly the first relative move:
planning X+10 would unexpectedly calculate a Z shift otherwise.
Tune the "soft" filament recheck to be more in-line with the latest
changes. Relax the thresholds so that a poorly tracking filament
that managed to trigger a recheck can still pass as long as /some/
motion is detected.
Hide the unused fsensor_oq_result() behind the FSENSOR_QUALITY define,
which is likely broken currently anyway.
Cleanup and simplify all the OQ defines.
When doing a PAT9125 "soft check", use two different speeds between
retraction and extrusion. This increases the chances that we can
track the surface.
Depending on the filament surface and moving speed, the PAT9125 sensor
can stop being able to track movement.
In such cases, instead of triggering false errors and/or relying on
previous states, read and use the exposure data off the sensor and
increase error counts only for poorly exposed images instead, which
is a good indicator of a far-away (or missing!) tracking surface.
Rewrite the logic behind the "chunking"/error count behind the PAT9125.
Basic idea: check the _direction_ of movement returned by the optical
sensor and compare it to the direction of the stepper. To avoid doing
this continuosly (and because the optical sensor doesn't necessarily
have the accuracy to track small distances), do so in chunks.
Each time a chunk doesn't match the expected direction, increase the
error count.
Several improvements were done to the previous code:
- Increase the chunk window: this ensures that a filament with
poor response returns an usable direction, while also moving the
average return values from the sensor in the middle of the 12 bits
available for maximum effectiveness.
- Since the returned values are more reliable, reduce the error count
(1.25mm*4 = ~5mm before runout detection)
- Track _both_ positive and negative movement, although only trigger
errors during extrusion (necessary due to several assumptions made
in the mmu/unloading code)
- Do not reset the counters for each block: accumulate distances
correctly, allowing detection of any block lenght.
When the error count is cleared, the cumulative deltas as well as the
segment lenght which is kept inside the stepper isr need to be reset.
Introduce a helper function fsensor_reset_err_cnt to clear all the
required variables in one place which can be used in most cases
(the only exceptions being quality measument).
Introduce a new function st_reset_fsensor to also clear the segment
lenght within the isr.
- Hide all prototypes related to PAT9125 to force all callers
to check for the proper sensor, since the handling differences
are substantial
- Remove unneeded lenght accounting from the stepper isr as as
consequence.
- Keep detailed soft failure counts for the MK3 on the "last print
failures" status screen, but fix build on variants without a PAT9125
by fixing the lcd stats function.
The filament sensor "chunk lenght" needs to be updated every time the
E axis resolution is changed in order to trigger at the same distance.
Introduce a new function fsensor_set_axis_steps_per_unit() and use
it consistent during init, in M92 and M350.
When upgrading K values of a LA1.0 print, also adjust E-jerk settings
(<2) if permissible according to current accell limits. The same is also
true when jerk is set mid-print via 'M205 E'.
Existing values are always restored when switching to another
compatibility mode.
TODO: Since this is stateful, we will need to save the current print
mode / acceleration and jerk in the eeprom for this to survive a power
panic (see prusa3d#2456).
When calculating the advance tick interval, be sure to check for integer
overflow. Very low step rates can result in values exceeding uint16_t
causing premature LA tick delivery.
An overflow resulting in zero would also block in an infinite loop
within advance_spread().
Even though such rates are worthless in terms of compensation and often
result in 0 extra ticks as well, do not disable LA for the block (as
doing so would reset the count for short segments) and do not check for
zero in multiple paces either.
Saturate the interval instead, delaying any further tick to the next
block.
M24 was always cleaning the last print failstats. But because M24 is
used to restore a print after power failure (by setting the seek
offset), it would also reset the stats incorrectly after resuming.
Check for the file index position and reset the stats only when a print
is started from the beginning of the file.
Apply the same logic to M32 and similarly handle the LA10->15 conversion
(do not re-apply the adjustment for a resumed print).
There is a chance that current_block can be NULL despite
the queue being non-empty. This can happen early after a block has been
queued, but before the isr has picked it up for processing, and/or when
the current block is at the last step and is being discarded.
Check for current_block directly to avoid this race.
Both during early init and in uvlo_tiny, display "POWER PANIC DETECTED"
if enough charge is left.
This is not worth doing in regular uvlo_, as we want to give full
priority to the X motor
If power has been lost during startup already a falling edge would be
skipped, causing the print to continue and lose its state without
being able to save again.
Check for a low line after arming the interrupt and simply wait
for reset.
Do not allow uvlo_tiny() to trigger before the previous print has
already been recovered.
A quick repeated power failure could cause uvlo_tiny to overwrite
the Z position before it has been correctly recovered.
enable/disable_z behave differently when PSU_Delta is defined.
During powerpanic and kill however we do *really* need to save energy
and poweroff the motors.
Rename enable/disable_z as poweron/poweroff_z and define some aliases so
that we can use the low-level function where needed.
Use 2 bytes to store extruder temperature during UVLO.
Re-use the storage of EEPROM_UVLO_TINY_Z_MICROSTEPS which has been freed
by previous changes.
Fixes#2303
- In both uvlo_ and uvlo_tiny, calculate Z usteps properly and adjust
the Z position to a true fullstep before disabling the motor. This
avoids shifs during recovery.
- In uvlo_tiny, instead of moving up indefinitely, adjust Z just
once using the smallest move possible (new def UVLO_TINY_Z_AXIS_SHIFT)
- Perform all the uvlo/recovery processing in physical coordinates
and MBL off: there should be no automatic Z movement!
- Disable heaters in both handlers to conserve more power.
- Add timing information to uvlo_tiny too.
- During recovery, to switch between physical and logical positioning
introduce a new "PRUSA MBL" gcode as most of the procedure is
enqueued, and no existing gcode was available.
There is frequently plenty of power left during a PP. Take advantage of
it by moving the extruder to either side of the axis to detach
completely the nozzle from the print.
Re-enable Z during this move to avoid losing the current step.
When the printer is connected to a USB host during a PP (and the host
does not lose power), the rambo can linger for longer, sometimes for
long enough to recover the print state. Drain some more power.
If the motors are off-phase, this is more likely to "bump" them to an
incorrect/reverse full-step, doing worse.
We need to ensure the motors are already positioned on a fullstep
during power panic instead.
Remove the PSU_DELTA exception: Z _always_ needs to be powered here.
Also clear the UVLO flag when using lcd_print_stop. This prevents an
aborted print which has been cancelled while unparking (just prior to
recover) to come back again at the next startup.
- Initially restore the last E position from the eeprom in any case, not
just when using absolute mode (although unnecessary: since it will be
reset later), fixing a possible unitialized position and crash during
recovery (thanks to @leptun)
- Remove useless extra calls to put the extruder in relative mode:
the extruder already starts in relative mode and is later switched to
absolute.
- Replace incorrect calls to STRINGIFY with sprintf_P
- Retract after pressure has been restored in uvlo_tiny, to be
consistent with a regular uvlo (remove the bogus double unretract
as a result).
- Set the real E position prior to the panic *after* the retraction,
using the now-fixed G92.