Commit Graph

449 Commits

Author SHA1 Message Date
Brian
faa270071d Improve BLTOUCH_HEATERS_OFF functionality
- rename to PROBING_HEATERS_OFF
 - move heater pausing functionality into thermalManager
   - add variables, pause(), ispaused(), other functions
 - add fan pausing functionality -> PROBING_FANS_OFF
 - add probing_pause() wrapper
 - move pausing into do_homing_move() and do_probe_move() to minimize quiet time and so other probe types can benefit
 - example configs
2017-05-07 16:22:08 -04:00
Scott Lahteine
6854f08d22 Shut down autotemp in disable_all_heaters 2017-05-03 20:54:26 -05:00
Scott Lahteine
2658cc707a Treat temperature as integer, when possible 2017-05-03 17:27:25 -05:00
Scott Lahteine
096b927102 Minor optimization of FILAMENT_WIDTH_SENSOR 2017-04-26 06:24:23 -05:00
Scott Lahteine
5bdb0b567d Cosmetic patches 2017-04-26 06:24:23 -05:00
Scott Lahteine
ff0018e287 Format hex values as uppercase 2017-04-21 21:42:41 -05:00
benlye
0a2f60fab4 Make spi.h inclusion conditional
spi.h is only needed if HEATER_0_USES_MAX6675 is defined, so making its inclusion conditional on HEATER_0_USES_MAX6675 being defined.
2017-04-15 16:22:42 +01:00
Scott Lahteine
7f950a80c0 Make ADC sensor reading frequency adjustable 2017-04-09 22:18:21 -05:00
Paweł Stawicki
44cdebb8f1 Add software spi support for max6675 2017-04-09 06:44:53 -05:00
Scott Lahteine
832064e4f2 Implementation changes to support 5 extruders 2017-04-07 10:46:37 -05:00
Scott Lahteine
699310d1d2 Fix: Thermal runaway if nonexistent bed's temp is set 2017-04-02 11:48:10 -05:00
Scott Lahteine
25a6bfa7ed Add and apply WITHIN macro 2017-03-31 09:27:48 -05:00
Scott Lahteine
499f9e04e1 Marlin: Temperature soft-PWM cleanup 2017-03-29 06:37:27 -05:00
Scott Lahteine
043be2856b Use "& 0x3F" instead of "% 64" 2017-03-24 04:13:50 -05:00
Stefan Brüns
6a040a6967 SOFT_PWM: Do not switch off heaters twice on pwm_count wraparound
After wraparound, pwm_count <= pwm_mask holds, thus soft_pwm_X <= pwm_count
guarantees soft_pwm_X < pwm_mask is true, and the heater will be switched
off in the first branch.
Do not evaluate the pwm conditions a second time, this reduces the
instruction count (4 instructions per PWM) and text size (6 byte).

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2017-03-24 04:13:50 -05:00
Stefan Brüns
0a74774af1 soft_pwm: avoid useless refetches of pwm_count
The compiler is not able to reuse the value of pwm_count, but reloads it
on every evaluation, if is stored in a static variable, as it cannot prove
it will be unchanged. A variable with local scope may not be modified from
the outside, so its value can be reused.
Doing so reduces text size and instruction count.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2017-03-24 04:13:50 -05:00
Stefan Brüns
35a55d5757 SOFT_PWM: Implement dithering if SOFT_PWM_SCALE is 1 or more
If dithering is enabled, the remainder of the soft_pwm_X duty value at
turnoff time is added to the next cycle. If e.g. the duty is set to 9 and
SCALE is set to 2, the PWM will be active for 8 counts for 3 cycles and
12 counts on each fourth cycle, i.e. the average is 9 cycles.

This compensates the resolution loss at higher scales and allows running
fans with SOFT_PWM with significantly reduced noise.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2017-03-24 04:13:36 -05:00
Stefan Brüns
2aed66a955 temperature: Fix SOFT_PWM off by one
A 128 step PWM has 127 intervals (0/127 ... 127/127 duty). Currently, a
PWM setting of 1/127 is active for 2/128, i.e. double the expected time,
or, in general n+1/128 instead of n/127.
Fixes issue#6003.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2017-03-24 04:13:36 -05:00
Scott Lahteine
6618346148 Patches to work around "register spill" compiler bug 2017-03-18 11:35:21 -05:00
Scott Lahteine
77491dd924 Remove extraneous whitespace 2017-03-18 03:17:39 -05:00
Scott Lahteine
2defb1d748 Use SET_INPUT_PULLUP where appropriate 2017-03-07 23:43:33 -06:00
Scott Lahteine
fea0d3f20f Endstop and temp-isr general cleanup 2017-03-06 02:07:07 -06:00
Scott Lahteine
aef08e8780 Compact some macro substitutions 2017-03-06 02:07:07 -06:00
Sebastianv650
271ced7341 Prevent re-entering of temperature ISR
If Marlin is inside the temperature ISR, the stepper ISR is enabled. If
a stepper event is now happening Marlin will proceed with the stepper
ISR. Now, at the end of the stepper ISR, the temperatre ISR gets enabled
again. While Marlin proceed the rest of the temperature ISR, it's now
vulnerable to a second ISR call.
2017-02-14 07:52:03 -06:00
Scott Lahteine
7176de8605 Merge pull request #5814 from thinkyhead/hotend_loop_always
Make HOTEND_LOOP more consistent, let compiler optimize it
2017-02-12 04:13:14 -06:00
Scott Lahteine
e44294bb4d Make HOTEND_LOOP more consistent, let compiler optimize it 2017-02-12 02:50:38 -06:00
Bob-the-Kuhn
0369f97ec1 guaranteed BLTouch detection
To guarantee that the 5mS pulse from a BLTouch is recognized you need to
have the endstops.update() routine run twice in that 5mS period.

At 200 steps per mm, my system has problems  below a feedrate of 120 mm
per minute.

Two things were done to guarantee the two updates within 5mS:
1) In interrupt mode, a check was added to the temperature ISR.  If the
endstop interrupt flag/counter is active then it'll kick off the endstop
update routine every 1mS until the flag/counter is zero.  This
flag/counter is decremented by the temperature ISR AND by the stepper
ISR.

2) In poling mode, code was added to the stepper ISR that will make sure
the ISR runs about every 1.5mS.  The "extra" ISR runs only check the
endstops.  This was done by grabbing the intended ISR delay and, if it's
over 2.0mS, splitting the intended delay into multiple smaller delays.
The first delay can be up to 2.0mS, the next ones 1.5mS (as needed) and
the last no less than 0.5mS.

=========================================

BLTouch error state recovery

If BLTouch already active when deploying the probe then try to reset it
& clear the probe.

If that doesn't fix it then declare an error.

Also added BLTouch init routine to startup section
2017-02-11 12:01:34 -06:00
esenapaj
069c6b38dd Remove unnecessary tabs and spaces 2016-12-16 00:21:32 +09:00
Sebastianv650
912704a0d8 Enable ISRs inside temperature ISR
to capture chars at UART at 250000 baud.
2016-11-28 20:08:50 +01:00
Scott Lahteine
00662b8635 Minor babystep cleanup patches 2016-11-03 23:31:45 -05:00
Scott Lahteine
24f6612551 Reduce and optimize endstop_monitor code 2016-10-31 08:08:03 -05:00
Bob-the-Kuhn
c7f1f0dae6 Add endstop monitor & make pins report pretty 2016-10-31 08:08:02 -05:00
Scott Lahteine
9cbedab91b Use DPM where possible 2016-10-26 18:38:32 -05:00
Scott Lahteine
b6aa894893 Rename auto fan pins and add auto fan flags 2016-10-26 17:51:26 -05:00
Benoit Miller
2aa12d78dc Only issue MAXTEMP when heating 2016-10-24 17:09:29 -04:00
esenapaj
70e287ca8c Extend measuring range of thermocouple for MAX31855 2016-10-23 10:22:39 +09:00
Scott Lahteine
f888597197 Reduce, clean up code for mintemp/maxtemp tests 2016-10-22 10:31:03 -05:00
Scott Lahteine
ad64723354 Move MAX_EXTRUDERS to pins.h 2016-10-22 10:07:51 -05:00
esenapaj
385bd8a4a3 Fix freezing and MINTEMP Error with MAX31855 thermocouple 2016-10-16 07:33:14 +09:00
Scott Lahteine
d41f2bdbd8 Merge pull request #4991 from thinkyhead/rc_max31855_fix
Patches for Stepper DAC and MAX31855
2016-10-10 20:12:06 -05:00
Scott Lahteine
149b8d9e4b Handle MAX31855 error conditions 2016-10-09 17:12:50 -05:00
Scott Lahteine
1e551c0688 Revert "Squashed - Removal of PID functional range" 2016-10-09 16:27:45 -05:00
Scott Lahteine
3752d9aca8 Fix timer comments 2016-10-09 12:11:00 -05:00
Scott Lahteine
00261cbfcb Merge pull request #4933 from thinkyhead/rc_drop_pid_func_range
Squashed - Removal of PID functional range
2016-10-07 15:07:55 -05:00
Scott Lahteine
c63cb45268 Fix thermal runaway timeout 2016-10-05 08:42:39 -05:00
Scott Lahteine
d80a79eb77 Use right-shift instead of / 2, why not? 2016-10-02 07:01:40 -05:00
Rerouter
02fe9cf558 Removal of functional range constraint
Also lined up the >> 1 and / 2 mentioned earlier in the unconstrained I term issue,
2016-10-02 07:01:40 -05:00
Scott Lahteine
761593b74b Cleanup some vars, use of min/max 2016-10-02 06:34:56 -05:00
Rerouter
1a2f1d4974 Update temperature.cpp 2016-09-28 17:36:53 +10:00
Scott Lahteine
16461900c2 Fix for HEATERS_PARALLEL 2016-09-24 05:34:40 -05:00
Scott Lahteine
076f3a8284 unsigned char => uint8_t 2016-09-24 05:23:40 -05:00
Scott Lahteine
6ac9d895ca Tweak Filament Width variables 2016-09-10 13:29:25 -05:00
Scott Lahteine
e9bfca5870 Additional comments for Temperature::isr 2016-08-27 20:12:22 -05:00
Scott Lahteine
37ac540a26 Fix unsigned/signed comparison in fanPin loop 2016-08-24 21:34:30 -05:00
Scott Lahteine
27b80b1dd1 Merge pull request #4667 from thinkyhead/rc_M211_sw_endstop_switch
M211: Enable/Disable Software Endstops
2016-08-21 06:44:00 -05:00
Scott Lahteine
2f223b8c79 Use ABC and XYZ for "3" 2016-08-21 00:10:08 -05:00
Scott Lahteine
01d4703429 PREVENT_DANGEROUS_EXTRUDE => PREVENT_COLD_EXTRUSION
Also improve the documentation of this and related options, and set
EXTRUDE_MINTEMP to 170 everywhere.
2016-08-20 23:35:27 -05:00
Scott Lahteine
3a0a94b21a Always init configured fan pins 2016-08-13 20:38:40 -07:00
Scott Lahteine
c63003ed3e Use matching auto-fan flags 2016-08-13 20:38:40 -07:00
Scott Lahteine
3475fd7b0f Init PWM-able auto fan pins with SET_OUTPUT 2016-08-13 20:38:40 -07:00
Scott Lahteine
abf9696db1 Loop fan-pins based on array size 2016-08-13 20:05:32 -07:00
Scott Lahteine
e88575c8ec Init next_auto_fan_check_ms to zero 2016-08-13 20:05:32 -07:00
Scott Lahteine
b63d70b186 Fix serial output for MBL, M303 2016-08-10 18:49:52 -07:00
Scott Lahteine
b7b5b50a84 Throw bed min temp error only if heating 2016-08-08 22:49:22 -07:00
Scott Lahteine
d3ba878f70 Drop intermediate float in HEATER_0_USES_MAX6675 test 2016-08-08 22:49:22 -07:00
Scott Lahteine
3e8f9ecd1c Extend min/max_temp_error for the bed 2016-08-08 22:49:21 -07:00
AnHardt
aa9b52b2e7 MISO is an input 2016-08-08 20:09:57 +02:00
AnHardt
9ab94bd2c1 fix-babysrepping 2016-08-02 21:06:42 +02:00
Scott Lahteine
63fd1f49a6 PID_EXTRUSION_SCALING, disabled by default 2016-07-31 17:49:34 -07:00
AnHardt
e4942d2163 Switch SD2cadrLib to fastio
Replace all fastDigitalRead/Write() with READ/WRITE()

Define SCK_PIN, MISO_PIN, MOSI_PIN in pins.h if not already defined in the pins_*.h files.

Remove these conditional pin definitions from the pin-files. They are now always defined.

Define separate sets of SPI-pins for AT90USB with and without Teensy support in fastio.h.
Likely this was the main reason for all that confusion about the AT90USB-SPI pins.
2016-07-27 12:40:44 +02:00
Scott Lahteine
2d378fac1b No need to include thermistortables.h in Configuration.h 2016-07-25 22:43:50 -07:00
Scott Lahteine
d8f2876753 Replace some float division with multiplication 2016-07-24 13:27:50 -07:00
Scott Lahteine
f8b5749235 Replace division in planner with multiplication 2016-07-24 13:27:49 -07:00
João Brázio
3ebad4e020 Moves all global enums to a central file 2016-07-19 14:31:09 +01:00
esenapaj
c2c8ab4698 Follow-up the PR #4278 (Fixups for PID_ADD_EXTRUSION_RATE and HOTENDS==1) 2016-07-13 22:24:31 +09:00
Scott Lahteine
cdd77d23bb Neaten up temperature member data 2016-07-12 20:04:15 -07:00
Scott Lahteine
d4c68279c8 Add "P" parameter to M302 2016-07-12 20:04:15 -07:00
Scott Lahteine
11dcbae7a2 Only a single E axis. Can tool-change reseed position[E_AXIS]? 2016-07-11 22:27:24 -07:00
Scott Lahteine
182c8d7f8f Dyze High Temp Thermistor Support 2016-07-10 17:59:05 -07:00
Scott Lahteine
ee0983ab57 Further reduction when HOTENDS == 1 2016-07-10 16:54:30 -07:00
Scott Lahteine
b72238f406 Invariant get_pid_output with HOTENDS < 2 2016-07-10 16:33:51 -07:00
AnHardt
a129078927 Add an emergency-command parser to MarlinSerial (supporting M108)
Add an emergency-command parser to MarlinSerial's RX interrupt.

The parser tries to find and execute M108,M112,M410 before the commands disappear in the RX-buffer.

To avoid false positives for M117, comments and commands followed by filenames (M23, M28, M30, M32, M33) are filtered.

This enables Marlin to receive and react on the Emergency command at all times - regardless of whether the buffers are full or not. It remains to convince hosts to send the commands. To inform the hosts about the new feature a new entry in the M115-report was made. "`EMERGENCY_CODES:M112,M108,M410;`".

The parser is fast. It only ever needs two switch decisions and one assignment of the new state for every character.

One problem remains. If the host has sent an incomplete line before sending an emergency command the emergency command could be omitted when the parser is in `state_IGNORE`.
In that case the host should send "\ncommand\n"

Also introduces M108 to break the waiting for the heaters in M109, M190 and M303.

Rename `cancel_heatup` to `wait_for_heatup` to better see the purpose.
2016-07-07 16:37:22 -07:00
Scott Lahteine
bd491818d6 Reduce storage requirements for strings, make some PGM 2016-06-27 20:36:18 -07:00
Scott Lahteine
7b2fadd598 Apply some fixes from Andreas
Derived from
https://github.com/AnHardt/Marlin/commit/6e8ede8c694fa4d9e3c769840b09d56
7f8d8e0dd
2016-06-22 17:35:59 -07:00
Scott Lahteine
dcb8ec32ee Fix compile error with watch_bed_next_ms 2016-06-21 02:13:41 -07:00
Scott Lahteine
ee5be92206 Fix broken DISABLE_HEATER macro 2016-06-13 20:57:58 -07:00
Scott Lahteine
e2d4919c01 Merge pull request #3991 from thinkyhead/rc_axis_units
Rename some vars to clarify their relationship to acceleration
2016-06-09 20:57:01 -07:00
Scott Lahteine
72c6f2923f axis_steps_per_unit => axis_steps_per_mm 2016-06-09 17:04:51 -07:00
Scott Lahteine
3c68be79dc Throw an error in PID_autotune for E < -1 2016-06-09 16:41:53 -07:00
Scott Lahteine
cd441ce652 SINGLENOZZLE: EXTRUDERS versus HOTENDS 2016-06-03 17:38:03 -07:00
Scott Lahteine
3fd9b331f0 Merge pull request #3924 from thinkyhead/rc_statics_temperature
Apply static to Temperature class
2016-06-02 17:13:17 -07:00
Scott Lahteine
78fb02a5ad Apply static to Temperature class 2016-05-30 16:50:51 -07:00
Scott Lahteine
fad7680605 Slower SPI speed for MAX31855 2016-05-25 18:15:36 -07:00
Scott Lahteine
0c7c45063b PID_ADD_EXTRUSION_RATE based on MarlinKimbra 2016-05-20 16:15:05 -07:00
Scott Lahteine
8218558953 Update comments, rename next_ping_ms, followup to #3797 2016-05-19 16:44:57 -07:00
Scott Lahteine
58339aea5f Merge pull request #3769 from jbrazio/bugfix/iteration-invokes-undef-behavior
Bugfix: iteration invokes undefined behavior
2016-05-15 20:36:25 -07:00
Scott Lahteine
2f14934c65 Fix checkExtruderAutoFans
Make sure to only set the fan state once when extruders share a fan
2016-05-15 18:54:37 -07:00
João Brázio
ecd490ed49
Bugfix: iteration invokes undefined behavior 2016-05-15 22:45:08 +01:00
Scott Lahteine
4d6bb52b26 Don't try to enable unused auto fans
Addressing #3743
2016-05-14 14:46:14 -07:00
Scott Lahteine
9b92bb8f31 Set the initial state based on target temperature 2016-05-08 17:25:44 -07:00