Commit Graph

3114 Commits

Author SHA1 Message Date
DRracer
f1bde1a039
Merge pull request #2724 from wavexx/max_ambient
Implement MIN/MAX AMBIENT safety checks
2020-08-05 08:52:55 +02:00
Yuri D'Elia
a2c7dcbbf8 Fix indentation 2020-08-04 13:14:35 +02:00
Yuri D'Elia
a8ce9358e5 Avoid redundant temperature error strings
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
2020-08-01 17:47:42 +02:00
Yuri D'Elia
e1c79c342d Re-introduce redundant disable_heaters() calls
Partially revert 285b505c73a54e9af01816e3a614de73ad181851 so that
we ensure heaters are disabled ASAP in case of potential bugs
in the max_*_error functions.
2020-08-01 17:47:20 +02:00
Yuri D'Elia
a60ed81a35 Implement MIN/MAX AMBIENT safety checks
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.
2020-08-01 17:38:10 +02:00
Yuri D'Elia
3336db7954 Add some important notes about thermistor ADC handling 2020-08-01 17:36:43 +02:00
Yuri D'Elia
65f25b0d7e Remove redundant disable_heater() calls in max/min_temp handling
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.
2020-08-01 17:36:43 +02:00
Yuri D'Elia
942fca5b66 Remove useless assignment
target_temperature_bed is already reset by disable_heaters() in Stop()
2020-08-01 17:36:43 +02:00
Yuri D'Elia
87bc5a78b6 Remove bogus comment (BED_MINTEMP *is* implemented) 2020-08-01 17:36:43 +02:00
Yuri D'Elia
feafc5e5ab Alternative schedule for LA ticks
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.
2020-07-29 19:14:48 +02:00
Yuri D'Elia
a08ca19ade Make flow correction optional, disabled by default
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.
2020-07-20 14:33:45 +02:00
Yuri D'Elia
9b8f642b28 Account for flow adjustments in LA
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.
2020-07-19 17:41:38 +02:00
Yuri D'Elia
c54474f2db Guard against planning/numerical errors in short segments
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.
2020-07-16 18:54:00 +02:00
Yuri D'Elia
fb5f09da6d Fix incorrect precedence for retraction phase
The logic was inverted, causing the fastest isr to always retract
instead of counter-balance the acceleration properly.
2020-07-16 18:53:53 +02:00
Yuri D'Elia
c08f37da96 Use nominal rate for phase calculations
The local interval calculated by advance_spread() might oscillate too
much in narrow intervals.
2020-07-12 17:15:47 +02:00
Yuri D'Elia
f1efce7e52 Handle LA termination with double/quad stepping properly
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).
2020-06-23 16:51:54 +02:00
Yuri D'Elia
50a09824fd Avoid scheduling useless eISR ticks
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.
2020-06-23 15:24:16 +02:00
Yuri D'Elia
1206fc3164 Avoid useless cast 2020-06-22 15:34:34 +02:00
Yuri D'Elia
a36efcb347 Remove cumulative error in segments without cruising (take 4)
Avoid sqrt when possible
2020-06-22 15:03:49 +02:00
Yuri D'Elia
173aa2deba Fix bogus timer check preventing fast LA steps to be scheduled
Simplify and fix the broken timer check when scheduling advance ticks.
This dates back to the original LA15 PR, an old bug...
2020-06-22 00:54:50 +02:00
Yuri D'Elia
51a539608c Reset LA_phase at each trapezoid stage
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.
2020-06-22 00:19:47 +02:00
Yuri D'Elia
7c140bc497 Remove cumulative error in segments without cruising (take 3)
Remove another division by precomputing the division directly in
adv_comp.
2020-06-21 16:32:22 +02:00
Yuri D'Elia
753e651af3 Remove cumulative error in segments without cruising (take 2)
Reduce per-trapezoid calculations
2020-06-21 16:32:22 +02:00
Yuri D'Elia
15548958e9 Remove cumulative error in segments without cruising (take 1)
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.
2020-06-21 16:32:22 +02:00
Marek Běl
45e182911d
Merge pull request #2748 from mkbel/detect_superpinda
Detect superPINDA PFW-1107
2020-06-16 14:07:12 +02:00
Marek Bel
9838be8512 Do not compile, if PINDA temperature compensation start point is lower than PINDA_MINTEMP. Document. 2020-06-16 02:03:14 +02:00
Marek Bel
d5feed1f6a Refactor: Remove if(true) condition, redundant break statement and decrease indentation. 2020-06-16 01:20:17 +02:00
Marek Bel
40ffea64ab Do not compile temperature compensation code for PINDAv1 if PINDA_THERMISTOR macro is defined.
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.
2020-06-16 01:09:40 +02:00
Marek Bel
d398aa1e3f Skip PINDA_THERMISTOR block in PINDA probe temperature calibration if PINDA_THERMISTOR is not detected.
Costs 1328B of FLASH, something must be wrong.
2020-06-16 00:44:59 +02:00
Marek Bel
23cc22bc22 Move has_temperature_compensation() into temperature.cpp.
No change in FLASH usage.
2020-06-16 00:41:21 +02:00
Marek Bel
bdf53387b1 Disable temperature compensation and temperature calibration menu if superPINDA is detected.
Even though functionality was added, 20B of flash memory has been saved.
2020-06-16 00:19:06 +02:00
Marek Bel
bbe9e3b4ea Remove temp_cal_active variable.
This saves 18B of FLASH and 1B of RAM memory. This variable was duplicate to EEPROM variable of the same name.
2020-06-11 20:00:55 +02:00
Marek Bel
fca4015667 Remove st_current_init() call from lcd_temp_calibration_set().
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)
2020-06-11 19:38:40 +02:00
Marek Běl
750af103ff
Merge pull request #2727 from mkbel/fix_unused_function
Unused function warning fix.
2020-06-08 15:25:11 +02:00
Marek Běl
971504f395
Merge pull request #2728 from mkbel/fix_unused_variable
Fix compiler warning unused variable kill_message.
2020-06-08 15:09:19 +02:00
Marek Bel
f6df3f2394 Unused function warning fix.
(cherry picked from commit 54e2b6a829a221cc3abbff3a39ca7d3cafed3a09)
Pick only unused function warning fix.
2020-06-08 15:04:26 +02:00
Marek Bel
200696c764 Fix compiler warning unused variable kill_message.
(cherry picked from commit 54e2b6a829a221cc3abbff3a39ca7d3cafed3a09)
Pick only unused kill_message.
2020-06-08 14:27:58 +02:00
Marek Bel
5648f3fef0 Fix compiler warning enumeration value 'ONE_TO_FALL' not handled in switch. 2020-06-08 13:07:19 +02:00
DRracer
183b102b6c
Document the RPM condition 2020-06-05 16:37:21 +02:00
Alex Voinea
1bf5635459
Trigger fan error during selftest for altfan 2020-06-05 17:17:33 +03:00
D.R.racer
7e41524101 PC-blend preheat temperatures #define typo
A typo slipped through in PR#2711, not even the compiler caught it
(obviously, it is #define to be stringized):
PCB_PREHEAT... -> PC_PREHEAT
2020-06-03 18:05:37 +02:00
D.R.racer
fe72ba7a9d Add PC-blend preheat preset 2020-06-03 17:45:55 +02:00
3d-gussner
d1865fc59a
MK3s IR sensor improvement (#2698)
* 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>
2020-06-03 16:14:56 +02:00
DRracer
233e66900f
Merge pull request #2670 from wavexx/la10c_jerk_tune
Increase E-jerk LA10->15 flattened zone
2020-06-03 15:50:57 +02:00
Alex Voinea
751f810dd7
ALTFAN implementation (#2692)
* ALTFAN implementation

* Use CRITICAL_SECTION macros

* Use uint16_t instead of unsigned int

* Add forgotten CRITICAL_SECTION

* Documentation
2020-06-01 17:58:15 +02:00
DRracer
eb44ee0f57
Code size optimization: 2KB down (#2687)
* 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
2020-06-01 17:51:28 +02:00
Alex Voinea
c84aef3a28
Handle second serial port correctly 2020-05-27 17:40:14 +03:00
Alex Voinea
b1e446ef97
Remember the serial characters during Optiboot initialization 2020-05-27 13:50:02 +03:00
Alex Voinea
e985d17bd1
Document code 2020-05-27 10:16:44 +03:00
Alex Voinea
f11ab17746
Fix warning 2020-05-27 09:59:17 +03:00