Commit Graph

22 Commits

Author SHA1 Message Date
Kevin O'Connor 7b03b04c78 klippy: Support minimum/maximum value checks on configuration variables
Verify that numeric parameters are in a sane range when reading the
config.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-04-11 11:42:55 -04:00
Kevin O'Connor e60779bfe1 heater: Force set_pwm of zero when target_temp is zero
Fix a corner case where a residual in the PID could cause a non-zero
pwm request even when the target_temp is zero.  (Which could lead to a
firmware "Missed scheduling of next pwm event" shutdown.)

Simplify the logic for suppressing duplicate pwm updates and make sure
a zero target_temp always results in a zero pwm update on the
following set_pwm calculation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-16 12:49:15 -04:00
Kevin O'Connor f66b1ac450 heater: Add support for AD595 type sensors
Add support for sensor chips that produce a voltage that linearly
scales with temperature.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-13 00:48:30 -04:00
Kevin O'Connor ff6a96665a heater: Rename thermistor_type config name to sensor_type
Rename the thermistor_type and thermistor_pin config variables to
sensor_type and sensor_pin.  This is in preparation for support of
sensors beyond thermistors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-13 00:46:33 -04:00
Kevin O'Connor 4388a294a4 heater: Handle case where min adc value is less than max adc value
When using a sensor that isn't a thermisistor, the maximum and minimum
adc values may be swapped - handle that case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-13 00:44:53 -04:00
Kevin O'Connor d21b9280f0 klippy: Eliminate high-level build_config phase
Now that the mcu objects can be created prior to connecting to the
mcu, it is no longer necessary to separate the init and build_config
phases in the high-level code.  Move the mcu objection creation from
the build_config phase to the init phase and eliminate the
build_config phase.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-13 00:38:17 -04:00
Kevin O'Connor bcaf818c0e fan: Default to using software PWM
Not all hardware has PWM support and there is no compelling reason to
use hardware PWM for fans.  Change the default to use software PWM.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-08 20:23:09 -05:00
Kevin O'Connor f53897758d heater: Support max_power setting for heaters
Change the mcu PWM value from an integer (0-255) to a float (0. - 1.).
Add support for limiting the maximum power (as measured over a
sufficiently long duration) to a particular heater.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-03-03 20:00:16 -05:00
Kevin O'Connor 47f1d377f5 heater: Enforce min/max_temp in heater.set_temp()
Raise an error if the user requests a temperate outside the configured
min/max_temp range.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-21 10:48:42 -05:00
Kevin O'Connor f335045273 heater: Resend PWM values even if last value was zero
Continue to resend the pwm value even if the last value was zero -
this extends the debugging info.

Also, add the target temperature to the pwm debugging.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-01-12 15:13:41 -05:00
Kevin O'Connor 4ea091339e heater: Only create a soft PWM object for PID heaters
The "watermark" style heater only needs a digital_out pin - not a
software PWM pin.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-01-10 18:36:43 -05:00
Kevin O'Connor 4a71c7a2bd heater: Report last temperature in PWM debugging
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-01-10 12:36:51 -05:00
Kevin O'Connor 2f97b2d7c2 klippy: Add ConfigWrapper.getchoice method
Add helper function that ensures a config option is one of several
choices.  This helps ensure that a proper error is raised if an
invalid choice is made.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-30 21:19:44 -05:00
Kevin O'Connor ceb60ffcc6 mcu: Rename output_file_mode variable to is_fileoutput
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 21:54:40 -05:00
Kevin O'Connor d161d66741 mcu: Handle adc initialization entirely in mcu code
Don't expose the ADC initialization to the gcode and heater code -
instead, register a callback within the MCU_adc class and call it
directly from the MCU class after configuration completes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-29 18:21:56 -05:00
Kevin O'Connor 3b5b895a10 heater: Do not require target temperature be above min_extrude_temp
Only disable the extruder if the last measured temperature is below
the minimum extrude temperature setting.  Verifying the target
temperature is not necessary, and it can incorrectly prevent some
valid moves.  It's not uncommon for scripts to retract filament
immiedietly after setting the extruder temperature to zero.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-11-08 09:22:43 -05:00
Kevin O'Connor 7f8a94ff48 heater: Make it possible to disable min_extrude_temp for testing
Allow a config file to specify 'min_extrude_temp: 0' to disable the
minimum extrude temperature test.  This makes it easier to perform
testing on the avr simulator.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-10-11 00:21:30 -04:00
Kevin O'Connor 9faa0fbd25 extruder: Support a minimum extrude temperature
Allow the config file to specify the minimum temperature for the
extruder and check for that temperature prior to moving the extruder
motor.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-09-30 21:36:51 -04:00
Kevin O'Connor 94272ed072 heater: Add "ATC Semitec 104GT-2" thermistor definition
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-09-15 12:16:08 -04:00
Kevin O'Connor 7b2f6f89f0 heater: Remove redundant float conversion
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-09-15 12:15:35 -04:00
Kevin O'Connor 11ecac626d mcu: Convert PWM and ADC objects to take mcu_time instead of clock
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-24 15:16:02 -04:00
Kevin O'Connor f582a36e4d Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-05-25 11:37:40 -04:00