Commit Graph

226 Commits

Author SHA1 Message Date
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
f8de274db3 Split fan checks out of temperature.cpp 2022-07-18 17:53:27 +02:00
Yuri D'Elia
e37435b53f Merge remote-tracking branch 'upstream/MK3_3.11.1' into mk311_sync 2022-07-04 16:14:23 +02:00
Yuri D'Elia
5b3441b2bd Fix AMBIENT_RAW_*_TEMP define names
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.
2022-04-29 16:54:39 +02:00
Alex Voinea
e3f48ead9f
Merge pull request #3440 from gudnimg/optimise-checkFanSpeed
Optimise `checkFanSpeed()` Flash use
2022-04-21 14:04:23 +02:00
Alex Voinea
b52597f1b2
Merge branch 'MK3_3.11.1' into MK3_3.10.2 2022-04-07 14:05:34 +02:00
Guðni Már Gilbert
c62c412cc3 Remove unused setting PID_ADD_EXTRUSION_RATE
Even if the setting was turned on, it doesn't do anything useful.
2022-03-30 19:03:41 +01:00
Guðni Már Gilbert
d42ef4784c Optimise checkFanSpeed()
Changes save 28 bytes of flash
2022-03-06 12:54:24 +00:00
Alex Voinea
4ec8781df2 Fix usb print timer 2022-02-13 22:52:49 +01:00
Alex Voinea
fb1c8ee0a3 Change the pullup test 2022-02-08 10:53:47 +01:00
Alex Voinea
c06ec9d05b Add pullup error test to define 2022-02-07 13:56:46 +01:00
Alex Voinea
b7806bf25f Crash if pullups get enabled on the thermistor inputs 2022-02-01 12:34:07 +01:00
Alex Voinea
67e6361ff1 Fix temperature runaway variable types (merge conflict) 2022-01-30 13:16:05 +01:00
Guðni Már Gilbert
9bf45773f9 Merge remote-tracking branch 'upstream/MK3' into rebase-testing-ground-v2 2022-01-30 11:43:16 +00:00
Guðni Már Gilbert
a940c364c9 Create enum class for heating_status variable 2022-01-30 11:39:27 +00:00
Alex Voinea
fb10b4398e Merge pull request #6 from gudnimg/gudni-PR1
Purged some `int`s for `uint8_t` when using the axis enum
2022-01-30 11:30:25 +00:00
Guðni Már Gilbert
f81db56793 temp_runaway_check() parameter _heater_id should be uint8_t
Saves 58 bytes of flash
2022-01-30 11:22:45 +00:00
Guðni Már Gilbert
261f311825 Change two arrays from int to uint8_t
__preheat_counter has max value of 16
__preheat_errors has max value of 5

Saves 58 bytes of flash memory and 4 bytes of SRAM
2022-01-30 11:22:45 +00:00
Voinea Dragos
42c393764f Adjust temperature runaway extruder count 2022-01-30 11:22:43 +00:00
DRracer
0be90dc5d1
Merge pull request #3320 from prusa3d/MK3_3.10.1
Merge MK3_3.10.1 into MK3 after release
2021-12-17 14:02:13 +01:00
Yuri D'Elia
320835a1b7 Do not cancel wait-for-temperature loops in disable_heaters()
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.
2021-12-10 01:46:20 +01:00
Yuri D'Elia
7ff117d0c4 temp_runaway_stop: remove spourious space in error message 2021-12-07 19:27:18 +01:00
Yuri D'Elia
a3915b57b9 Improve temp_runaway_stop robustness
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.
2021-12-07 19:25:34 +01:00
Yuri D'Elia
57abffda1b Update temperature-related error message to use LCD_STATUS_CRITICAL 2021-12-07 11:09:58 +01:00
Guðni Már Gilbert
e6a7abf2c1 Change temp_runaway_timer from float to uint32_t
Saves 32 bytes of flash

Also change temp_runaway_error_counter from int to
uint16_t to be specific
2021-08-06 15:08:46 +00:00
Guðni Már Gilbert
db1e5a203b Change temp_runaway_status from float to uint8_t and its enum
Saves 90 bytes of flash, and 12 bytes of SRAM
2021-08-06 15:03:35 +00:00
Guðni Már Gilbert
d853c19a21 Use fabs() instead of abs() when using floats
This saves 514 bytes of flash memory
2021-07-20 08:16:18 +02:00
Yuri D'Elia
53fcd6fc8f Work-around GCC LTO codegen bug in process_commands()
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.
2021-06-24 07:39:28 +02:00
DRracer
6188870c2e
Merge pull request #3157 from wavexx/improve_d2
Add extra debugging functions & crash analysis
2021-06-22 07:37:30 +02:00
Yuri D'Elia
f2fe57bfc0 Fix unused static declaration warnings
Guard declarations using the appropriate defines
2021-06-21 06:52:52 +02:00
Yuri D'Elia
eafdf6c216 Also move host_keepalive to manage_inactivity()
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.
2021-06-21 06:46:24 +02:00
Yuri D'Elia
050cf72e98 Move stack checking to the temperature ISR
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.
2021-06-12 15:23:33 +02:00
Yuri D'Elia
449510392d Untangle a bit some recursive include mess 2021-06-12 15:09:03 +02:00
Yuri D'Elia
019c818c05 Insert babysteps using CRITICAL_SECTION instead of cli/sei 2021-02-25 16:44:16 +01:00
Voinea Dragos
ea44d78d68 Merge branch 'MK3' into PFW-1171-EEPROM_SN 2021-01-31 17:19:00 +02:00
Voinea Dragos
698499f00d split timer0 and timer2 initialization. Move timer2 init early 2021-01-31 17:18:32 +02:00
3d-gussner
a064ce4722 Add gcode M123 Tachometer value 2021-01-10 15:15:44 +01:00
DRracer
0ed6b537a8
Merge branch 'MK3' into MK3_3.9.3 2021-01-07 13:27:51 +01:00
3d-gussner
4b510fef0a Add PINDA_TEMP_COMP variable to enable SuperPINDA toggle menu/function 2020-12-23 20:59:08 +01:00
3d-gussner
732b6e0cad Cleanup 2020-12-23 20:58:20 +01:00
3d-gussner
62c36f718b Add SuperPINDA support for MK2.5/S
- 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
2020-12-23 20:56:50 +01:00
Alex Voinea
4abf1f436a Gracefully dump the queue + fixes to fancheck 2020-11-09 21:49:56 +02:00
DRracer
772844678f
Merge pull request #2809 from leptun/PFW-1134-ALTFAN_KILLSWITCH
Pfw 1134
2020-08-20 15:42:03 +02:00
Alex Voinea
6b853a4cc3
Auto-detect ALTFAN after fw. update 2020-08-12 12:19:08 +03:00
DRracer
89ecf2ce3a
Merge pull request #2791 from wavexx/stack_protect_reentrant_isr
Fix stack smashing in temperature/fsensor ISR
2020-08-06 13:26:33 +02:00