Commit Graph

31 Commits

Author SHA1 Message Date
Phil Hord 592df2c73f Drop redundant "simulator.h" includes.
simulator.h is already included in config.h/arduino.h, so it doesn't
need to be included again most of the time. In some cases it was
included twice on purpose to undo some intervening include file, but
these intervening includes were unnecessary. Remove some related
include file redundancy by re-ordering the include files and relocating
some nested includes up to the parent .c file.
2016-06-11 15:12:40 +02:00
Markus Hitter d753e2ca7f ARM: enable temperature control.
Postponed until now to allow better testing of heaters earlier.

Also made pid_init() to handle all heaters at once.
2015-08-13 17:12:12 +02:00
Markus Hitter be6ca4c857 ARM, AVR: support inverted heater pin signals.
Implemented and tested for both platforms. This is quite a big
commit. Unlike with the previous changes to now choosable PWM
frequencies, all board configuration files and Configtool had
to be changed immediately to deal with the additional parameter
in DEFINE_HEATER() and keep AVR builds working (and regression
tests passing).
2015-08-13 17:12:10 +02:00
Markus Hitter ee43a86474 ARM: split out heater-avr.c from heater.c.
Also move #defines from heater.c to heater.h

This operation became bigger than expected, because PID handling
hat to be separated from heater handling. Code and strategy wasn't
changed, but some chunks of code had to be moved.
2015-08-13 16:41:26 +02:00
Markus Hitter cf3b94b980 heater.c/.h: get rid of heaters_all_off().
Nowhere used and exactly duplicated heaters_all_zero().
2015-08-07 16:16:05 +02:00
Phil Hord 21e5343552 Add config.h wrapper to simplify test automation
Test code which wants to customize config.h can do so without
touching config.h itself by wrapping config.h in a macro variable
which is passed in to the compiler.  It defaults to "config.h" if
no override is provided.

This change would break makefile dependency checking since the selection
of a different header file on the command line is not noticed by make
as a build-trigger.  To solve this, we add a layer to the BUILDDIR path
so build products are now specific to the USER_CONFIG choice if it is
not "config.h".
2014-03-04 19:56:23 +01:00
Phil Hord 452e2e5cd9 Restore simulation build target.
This code was accidentally removed long ago in a botched merge. This
patch recovers it and makes it build again. I've done minimal testing
and some necessary cleanup. It compiles and runs, but it probably still
has a few dust bunnies here and there.

I added registers and pin definitions to simulator.h and
simulator/simulator.c which I needed to match my Gen7-based config.
Other configs or non-AVR ports will need to define more or different
registers. Some registers are 16-bits, some are 8-bit, and some are just
constant values (enums). A more clever solution would read in the
chip-specific header and produce saner definitions which covered all
GPIOs. But this commit just takes the quick and easy path to support my
own hardware.

Most of this code originated in these commits:

	commit cbf41dd4ad
	Author: Stephan Walter <stephan@walter.name>
	Date:   Mon Oct 18 20:28:08 2010 +0200

	    document simulation

	commit 3028b297f3
	Author: Stephan Walter <stephan@walter.name>
	Date:   Mon Oct 18 20:15:59 2010 +0200

	    Add simulation code: use "make sim"

Additional tweaks:

Revert va_args processing for AVR, but keep 'int' generalization
for simulation. gcc wasn't lying. The sim really aborts without this.

Remove delay(us) from simulator (obsolete).

Improve the README.sim to demonstrate working pronterface connection
to sim. Also fix the build instructions.

Appease all stock configs.

Stub out intercom and shush usb_serial when building simulator.

Pretend to be all chip-types for config appeasement.

Replace sim_timer with AVR-simulator timer:

The original sim_timer and sim_clock provided direct replacements
for timer/clock.c in the main code. But when the main code changed,
simcode did not. The main clock.c was dropped and merged into timer.c.
Also, the timer.c now has movement calculation code in it in some
cases (ACCELERATION_TEMPORAL) and it would be wrong to teach the
simulator to do the same thing. Instead, teach the simulator to
emulate the AVR Timer1 functionality, reacting to values written to
OCR1A and OCR1B timer comparison registers.

Whenever OCR1A/B are changed, the sim_setTimer function needs to be
called. It is called automatically after a timer event, so changes
within the timer ISRs do not need to bother with this.

A C++ class could make this requirement go away by noticing the
assignment. On the other hand, a chip-agnostic timer.c would help
make the main code more portable. The latter cleanup is probably
better for us in the long run.
2013-12-06 19:24:58 +01:00
Markus Hitter b10b3db4f8 Wrap EEPROM storage related stuff in #ifdef EECONFIG.
Saves a whopping 600 bytes. Let's cross fingers stuff still works.
It should, using the hardcoded default values.
2013-02-05 14:10:31 +01:00
Markus Hitter 042d9ddfc2 Move temp_all_zero() to heaters_all_zero().
We need the power supply for the heaters, after all, not for
the temperature sensors. Some heaters (e.g. fans) don't even have
a temp sensor.
2013-01-03 15:34:47 +01:00
Markus Hitter 8d91312991 heaters: allow to disable PWM on PWM-able pins.
This is not only handy for debugging non-PWM mode, it may also
help those who run a heated bed attached to a solid state relay.

This way it was found out connecting heaters to non-PWM pins
works just fine and did so for a loooong time.

Not yet distributed to all the config.h templates.
2012-11-08 16:24:53 +01:00
Markus Hitter fbf62a7dba heater.h: remove {en|dis}able_heater().
They were unused and no longer fit the heating algorithm strategy.
2012-11-08 16:23:41 +01:00
Markus Hitter f9a4495aa1 Introduce TEMP_NONE, a "sensor" just storing the target temperature.
This is useful when operation a milling spindle. In this case,
set the spindle speed with M104 Sxxx, where xxx is 1..255.
M104 S0 turns the spindle off.
2011-09-01 19:03:33 +02:00
Markus Amsler d97a4519d3 extruder: Get rid of _CONFIG_H, like on the mainboard config. 2011-04-07 03:29:17 +02:00
Michael Moon 3c3624542f simplify heater configuration by using arduino_*.h more effectively with DEFINE_HEATER macro 2011-03-28 18:45:28 +11:00
Michael Moon d0601716e8 reorganise intercom to send packets from extruder main loop, also generalise protocol as discussed in forum 2011-03-05 13:38:12 +11:00
Michael Moon 31634c6a8f Add M136 (DEBUG) to read back PID values, add heater_print function 2011-02-20 17:30:07 +11:00
Michael Moon 71eafbf96b keep power on when heaters are active
Reported-by: Jacky2K@forums.reprap.org
2011-02-09 08:16:15 +11:00
Michael Moon 553f3a50a6 some config templates, also bang-bang heater support to reduce code size 2011-02-07 20:48:57 +11:00
Michael Moon 1c723f7656 remove definition macros, doesn't work 2011-02-06 21:11:39 +11:00
Michael Moon d1b2754aba sorting out preprocessor interactions 2011-02-06 21:11:39 +11:00
Michael Moon 97f344f0fa changes discussed in chat on pull 19 2011-02-06 21:11:39 +11:00
Stephan Walter fcaa76d3c0 Simpler definition of temp sensors and heaters. 2011-02-01 19:40:27 +11:00
Michael Moon 096d7dfdf3 Merge release-candidate-triffid branch 2011-01-07 23:09:13 +11:00
Stephan Walter 3028b297f3 Add simulation code: use "make sim" 2010-10-21 11:05:55 +11:00
Markus Hitter 80d3fc5233 Revert "heater.h: simplify macros.", as there are in fact situations
where this seemingly obsolete code makes sense.

This reverts commit 896f6e140f.
2010-10-08 12:49:02 +02:00
Markus Hitter 90c00d0eff heater.h: remove the temp_achieved() declaration, which has
no definition in heater.c (but is properly coded in temp.h/.c).
2010-10-07 23:43:51 +02:00
Markus Hitter 2391dc2901 If there's no HEATER_PIN, there's no heater, so disable the
heater code. Also remove the temp_achieved() declaration
in heater.h, which has no definition in heater.c.

If you wonder about what might be the use of not having a heater,
think about a paste dispenser or an externally heated extruder :-)

Having no heater removes a whopping 1200 bytes of program size.
2010-10-07 23:43:46 +02:00
Markus Hitter 896f6e140f heater.h: simplify macros. 2010-10-07 23:43:44 +02:00
Markus Hitter 68f4610e79 heater.h/.c: remove a few obsolete #includes. 2010-10-07 23:43:36 +02:00
Markus Hitter 9839ac9fff Move heater macros from config.h to heater.h, as they're
not meant to be user configurable.
2010-10-07 23:43:22 +02:00
Michael Moon 273d63f242 splitting heater stuff out into a separate file 2010-09-12 14:47:49 +10:00