Commit Graph

5837 Commits

Author SHA1 Message Date
Yuri D'Elia
7d82cd641e Rename ADC callback 2022-07-25 17:30:22 +02:00
Yuri D'Elia
bcd8496113 Introduce a new set of temperature values for the PID regulation
*_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)
2022-07-25 17:30:22 +02:00
Yuri D'Elia
c1051e046c Remove private declaration 2022-07-25 17:30:22 +02:00
Yuri D'Elia
65cf8e541a Isolate current/target temperature in pid_heater/bed functions 2022-07-25 17:30:22 +02:00
Yuri D'Elia
0933f01a7f temperature: Do not expose check_min/max_temp 2022-07-25 17:30:22 +02:00
Yuri D'Elia
9e826afee9 Switch regulation interval to 270ms 2022-07-25 17:30:22 +02:00
Yuri D'Elia
c6d0494cbc Split temperature management into it's own ISR
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).
2022-07-25 17:30:21 +02:00
Yuri D'Elia
2ca16a06cd Rename tp_init to soft_pwm_init for consistency 2022-07-25 17:30:21 +02:00
Yuri D'Elia
b56d31b5b3 Improve comment 2022-07-25 17:30:21 +02:00
Yuri D'Elia
38b3e53f67 Syntax/comment cleanup 2022-07-25 17:30:21 +02:00
Yuri D'Elia
932fcbb33f Simplify soft_pwm_isr even further
Isolate the PWM management into soft_pwm_core
2022-07-25 17:30:21 +02:00
Yuri D'Elia
dfd8fee712 Isolate babystep to a separate function 2022-07-25 17:30:21 +02:00
Yuri D'Elia
bd28007312 Rename check_fans>readFanTach manageFans>checkFans 2022-07-25 17:30:21 +02:00
Yuri D'Elia
383319dbac Rename temperature_isr to soft_pwm_isr 2022-07-25 17:30:21 +02:00
Yuri D'Elia
16b9acf8bc Decouple temperature ISR from ADC readings
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.
2022-07-25 17:30:21 +02:00
Yuri D'Elia
e87188e7e3 Ensure ADC and thermistor tables use the same oversampling
The current code assumes that values are directly comparable
2022-07-25 17:30:21 +02:00
Yuri D'Elia
2535d072c4 Do not recursively enter temperature_isr
Disable the interrupt source instead, which avoids the added latency of
reentering the isr in the first place.
2022-07-25 17:30:21 +02:00
Yuri D'Elia
82e221e3c7 Remove ADC pullup checks
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.
2022-07-25 17:30:21 +02:00
Yuri D'Elia
306f77ccbd Disable IR_SENSOR due to the injected ADC read for now
This is already reimplemented in the newer fsensor implementation
2022-07-25 17:30:21 +02:00
Yuri D'Elia
13163e9fbf Move millis_nc to system_timer.h 2022-07-18 17:53:27 +02:00
Yuri D'Elia
f8de274db3 Split fan checks out of temperature.cpp 2022-07-18 17:53:27 +02:00
Alex Voinea
8e72470afc
Merge pull request #3435 from leptun/MK3_variant_hotend_name
Use correct filament type in variant files
2022-07-15 15:57:53 +03:00
Alex Voinea
46a9cf6239
Merge pull request #3529 from leptun/sd_menu_fixes
SD menu fixes
2022-07-15 15:55:26 +03:00
Alex Voinea
510c874619 Fix scrolling timing issue when the menu is rendering very slowly 2022-07-15 15:46:01 +03:00
Alex Voinea
8bb451129d Remove compiler bug workaround
These lines had to be done like that because gcc 5.4.0 would throw a segmentation fault when linking. With gcc 7.3.0, this is no longer an issue
2022-07-15 15:46:01 +03:00
Alex Voinea
ae1815dc52 When over the SD limit, continue from the last sorted file
This gives a significant speed boost when just above the sorting limit, while only costing 2 bytes of ram
2022-07-15 15:46:01 +03:00
Alex Voinea
a96e60c241 Do not call lcd_update after presorting 2022-07-15 15:45:34 +03:00
Alex Voinea
3a5bc0462a Do not call lcd_update recursively when running presort with many files 2022-07-15 15:45:34 +03:00
Alex Voinea
3c579bf738 Fix fullscreen message lcd_update handling 2022-07-15 15:45:34 +03:00
Alex Voinea
2059e40596
Merge pull request #3054 from espr14/insert_sort
File: use insert sort
2022-07-15 15:44:04 +03:00
Alex Voinea
49fb27bb28
Merge pull request #3504 from gudnimg/gudni_printer_smodel_check
Simplify `printer_smodel_check()`
2022-07-12 21:53:23 +03:00
Alex Voinea
39dfa96167
Merge pull request #3542 from wavexx/default_beep_freq_2
M300: do not set a default frequency if S is not set
2022-07-12 20:39:31 +03:00
Alex Voinea
3ed3f87db6 Prevent beeps when P is 0 2022-07-12 09:57:56 +03:00
Yuri D'Elia
2a9869ce2d M300: do not set a default frequency if S is not set
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
2022-07-11 15:18:56 +02:00
3d-gussner
1db9735654
Merge pull request #3520 from 3d-gussner/MK3_build_v108
Use PF-build-env 1.0.8
2022-07-05 17:21:04 +02:00
Alex Voinea
56bc2f1a0c
Merge pull request #3495 from wavexx/extrude_min_temp
Replace EXTRUDE_MINTEMP with the configurable extrude_min_temp
2022-07-05 12:02:26 +02:00
Alex Voinea
9466945532
Merge pull request #3461 from wavexx/fan_selfcheck_test
Fix/optimize fan selftest
2022-07-05 11:32:57 +02:00
Alex Voinea
19b494a554 Make the fan thresholds configurable 2022-07-05 09:02:47 +02:00
3d-gussner
4903270ffa Use PF-build-env 1.0.8 2022-07-04 20:46:46 +02:00
Yuri D'Elia
a8244dc2bd
Merge pull request #3455 from wavexx/stop_raise_higher
Stop raise higher
2022-07-04 20:05:23 +02:00
3d-gussner
6271f17340
Merge pull request #3442 from gudnimg/fix-M701-doc
Add documentation for M701, M203, M201 parameters
2022-07-04 18:51:31 +02:00
Alex Voinea
253b14def1 Clamp Z movements to machine limits 2022-07-04 18:26:14 +02:00
Yuri D'Elia
44fce0696b Make the stop raising distance configurable (Z_CANCEL_LIFT) 2022-07-04 18:21:59 +02:00
Yuri D'Elia
2c41857cb5 Raise Z 5cm after stopping
Check if Z axis has been homed and, if so, raise Z at least 5cm after
stopping so that the steel sheet can be comfortably removed.
2022-07-04 18:21:59 +02:00
Alex Voinea
61b8dbbab5 Disable sorting speedtest 2022-07-04 18:06:54 +02:00
Alex Voinea
e79e15b12f Use the sd cache for positions even when not sorting 2022-07-04 18:06:54 +02:00
Alex Voinea
d9d3d68217 Remove postponed sorting of elements
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
2022-07-04 18:06:54 +02:00
Alex Voinea
c100df7ba3 Remove quicksort, shellsort and add performance benchmark 2022-07-04 18:06:54 +02:00
Alex Voinea
cac2b9ae40 Implement timer elapsed function
also fix build
2022-07-04 18:05:49 +02:00
Alex Voinea
490754a0f0 Fix build 2022-07-04 18:05:49 +02:00