Commit Graph

111 Commits

Author SHA1 Message Date
DRracer
baaa372a56
Rephrase texts for fsensor detection and cleanup (#2630)
* Rephrase texts for fsensor detection and cleanup

* fsensor msgs only for MK3S
2020-04-24 19:46:54 +02:00
Alex Voinea
f13269d8a9
Code cleanup 2020-03-30 16:50:50 +03:00
DRracer
65228a046e
Merge pull request #2520 from MRprusa3d/PFW-x001bPR
FS PCB auto-detect
2020-03-26 17:36:18 +01:00
D.R.racer
34ac2917ae fix. warning "Macro expansion producing 'defined' has undefined
behavior"
update screen layout comments
2020-03-26 14:40:47 +01:00
Yuri D'Elia
9e45b5d41e Improve PAT9125 filament / optical quality checks
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.
2020-02-06 18:27:44 +01:00
Yuri D'Elia
bd0544fe9e FS: Use two different speeds when checking for runout
When doing a PAT9125 "soft check", use two different speeds between
retraction and extrusion. This increases the chances that we can
track the surface.
2020-02-06 15:27:22 +01:00
Yuri D'Elia
3be859ece9 FS: Improve reliability on speeds with poor optical tracking
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.
2020-02-06 15:27:22 +01:00
Yuri D'Elia
3af35844e1 Remove redundant check (always trigger the fsensor isr)
Since fsensor_st_block_chunk is already called on fsensor_chunk_size
boundaries, there's no need to check a second time.
2020-02-06 14:39:04 +01:00
Yuri D'Elia
1eddc40ed4 Comment existing code 2020-02-06 14:39:04 +01:00
Yuri D'Elia
e84f82a675 Rewrite filament sensor PAT9125 error handling
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.
2020-02-06 14:37:46 +01:00
Yuri D'Elia
5c4235b886 Correctly reset the PAT9125 filament counters
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.
2020-02-05 16:21:27 +01:00
Yuri D'Elia
6fbd632c84 Isolate all PAT9125-specific code, fix build on !MK3 variants
- 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.
2020-02-05 16:20:12 +01:00
Yuri D'Elia
d47363d85a Update the filament axis resolution when E resolution is changed
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.
2020-02-05 16:20:12 +01:00
Yuri D'Elia
ce74b746f1 FS: Trigger a runout with repeated soft-failures (clog?) 2020-02-05 16:20:12 +01:00
Yuri D'Elia
8fb8ff4bf4 Include fsensor recovery stats in the last print stats 2020-02-05 16:20:12 +01:00
Yuri D'Elia
e8ce5e140e FS: Detect runout earlier 2020-02-05 16:20:12 +01:00
DRracer
1b7677c768
Merge pull request #2394 from wavexx/fsensor_no_recursion
Avoid more recursive behavior in fsensor_update
2020-01-30 14:18:07 +01:00
Yuri D'Elia
186f881600 Avoid calling fsensor_update() one level earlier
Move the common checks between filament sensors out of fsensor_update().

Disable the runout check if a saved state is already present (this check
was missing in the PAT9125 variant) as this is currently not supported.

Note that the CHECK_FSENSOR looks completely redundant besides
e_active().
2019-12-29 22:08:44 +01:00
Yuri D'Elia
bd80ee88a0 Set the IN_HANDLER busy state while checking the filament 2019-12-29 21:27:42 +01:00
Yuri D'Elia
97170ed68d Do not call process_commands() within fsensor_update()
Plan moves directly to reduce the required stack size.
2019-12-27 19:37:20 +01:00
Yuri D'Elia
fe4c00fb8a Lift the extruder when checking for the filament
This avoids leaving marks on the print
2019-12-27 19:35:08 +01:00
Yuri D'Elia
301d64042b Set fsensor_watch_runout earlier to prevent re-entry
Do not set/clear fsensor_watch_runout within fsensor_oq_meassure_start
which is used outside of fsensor_update where it could have a different
starting value.

Set it within fsensor_stop_and_save_print to immediately prevent
re-entry.
2019-12-27 19:34:36 +01:00
Yuri D'Elia
5122f79a39 Merge remote-tracking branch 'upstream/MK3' into MK3_LA15 2019-12-04 17:27:23 +01:00
Yuri D'Elia
6ecff003b7 Fix M600 insertion by the filament sensor
Remove incorrect usage of stop_and_save_print combined with the
fsensor_recovert internal instruction which would result in a
broken sequence of events and/or broken stack.

Re-use the now safe stop/recover functions in the same spot
(fsensor_checkpoint_stream) to effectively cut a hole in the current
gcode stream to insert an M600 instruction, which removes all
recursive behavior without the need of extra state variables.
2019-11-28 17:13:37 +01:00
MRprusa3d
011468598e IR sensor gen. II
disconnected PCB detection
2019-09-16 00:43:37 +02:00
Yuri D'Elia
18b8dc89e5 Merge remote-tracking branch 'upstream/MK3' into MK3_LA15 2019-08-04 17:06:34 +02:00
Marek Bel
ab4e789688 Partially revert "aeed49a Fix filament runout on optical filament sensors"
Revert plan move to filament change position before enqued M600.
This was workaround to problem that restore_print_from_ram_and_continue() did 3s heating pause before resuming print. This problem will be fixed properly in restore_print_from_ram_and_continue() in next commit.

Save 166B of FLASH.
2019-07-15 17:22:39 +02:00
Marek Bel
6717590631 Merge branch 'MK3' into MK3_LA15 2019-06-13 15:39:50 +02:00
DRracer
aeed49a80e Fix filament runout on optical filament sensors
Reworked the IR variant accordingly
Some code-size optimization in related functions
2019-06-05 18:33:41 +02:00
Yuri D'Elia
84009e1e8e Do a full fsensor_update() when initializing the sensor
This correctly populates the "extruder info" details even when
the menu is entered for the first time after starting a print.
2019-06-03 17:32:57 +02:00
Yuri D'Elia
d2432056bd Elide fsensor_st_block_begin, saving some cycles/bytes 2019-06-03 17:32:43 +02:00
Yuri D'Elia
5cd0177389 Cleanup fsensor_st_block_begin 2019-06-02 18:17:59 +02:00
Yuri D'Elia
b4bf79297f Remove unneeded includes from fsensor 2019-06-02 01:08:03 +02:00
Yuri D'Elia
c50b1c0351 Rework the filament counter logic
- Move direction checks out of fsensor: fsensor_counter is now
  always in the same direction as e_steps
- Check the filament chunk after e_steps have been physically done,
  using the real e_step count so far
2019-06-01 22:08:00 +02:00
DRracer
9cb0bc7bcf Fix MINTEMP errors and fsensor runout 2019-05-24 08:46:44 +02:00
MRprusa3d
20a03d703d G-code unification
"FSENSOR_RECOVER" ->-> "PRUSA fsensor_recover"
2019-03-05 13:36:13 +01:00
PavelSindler
9926468c91 Merge remote-tracking branch 'upstream/MK3' into variants 2019-01-30 17:26:45 +01:00
PavelSindler
83510ed489 check_for_ir_sensor 2019-01-28 17:27:16 +01:00
Robert Pelnar
eea755496b Conditional translation for SYSTEM_TIMER_2 because we want to have posibility to switch between old/new implementation.
Timing functions (millis, micros and delay) replaced in whole source, defined in Marlin.h.
This commit enables original implementation (SYSTEM_TIMER_2 undefined)
Verified with passed complete wizard process.
2019-01-27 22:48:51 +01:00
PavelSindler
6b1cf99066 conditional compilation updated 2019-01-24 16:14:02 +01:00
PavelSindler
da2c963893 conditional compilation improved: fsensor_autoload_check_stop() and fsensor_autoload_check_start(); M600 "filament not responding" error on printers with ir sensor fixed 2019-01-24 16:00:52 +01:00
PavelSindler
e0c1e4a02d version which should on all printer versions: autoload, selftest, filament detection, filament sensors initialization, filament menus 2019-01-24 01:12:30 +01:00
Robert Pelnar
6157c3ab32 New filament sensor 2018-12-06 15:41:53 +01:00
PavelSindler
0e65790218 removed redundant code 2018-11-21 19:49:19 +01:00
PavelSindler
74a7341005 mmu: FINDA disabled by damaged/disconnected PAT9125 hotfix 2018-11-21 19:27:55 +01:00
Robert Pelnar
d886ba1100 Fix PFW657 - filament runout detection is not working after autoload disabled from menu. 2018-11-13 14:05:15 +01:00
MRprusa3d
fd45dd64dc Bed PowerMonitor III 2018-11-08 03:32:00 +01:00
MRprusa3d
4ae857136d Bed PowerMonitor II 2018-11-07 13:38:39 +01:00
MRprusa3d
18a8ae5b8f Bed PowerMonitor
bed power monitoring correction
2018-11-01 20:55:42 +01:00
PavelSindler
a9317b4d36 upstream/MK3 merge 2018-10-25 21:46:32 +02:00