Commit Graph

1392 Commits

Author SHA1 Message Date
Markus Hitter 65857b17dc temp.c: get rid of TEMPTABLE_FORMAT.
Detecting tables by data size works fine, the optimiser removes
unneeded code successfully. Binary size stays the same.
2016-04-17 14:31:52 +02:00
Phil Hord 2291642456 Expand thermistortable to include precomputed slope
Save a division at runtime by pre-calculating the slope between each
pair of adjacent thermistortable values.  Since we use the larger value
each time, save the slope between two values A and B in the table
with the B data.  Therefore the slope is that between each value and
its predecessor in the list.

Store this new value in the third element of the now 3-integers-wide
array which makes up the table. Use fixed-point 6.10 format to store
the slope.  This is almost too narrow for some slopes and maybe it
should be changed to 8.8 fixed-point. In practice this presents a
loss in accuracy, but it is still significantly better than the
previous fixed-sample-size table production method. In particular no
provision is made to handle values which scale over 65535, and it
seems we should at least warn about this if not simply fail before
letting the user go off compiling his code.

Add a new flag TEMPTABLE_FORMAT and define it as 1 to tell the code
that we are using this new and incompatible format.  This lets us
tolerate old hand-crafted thermistor tables by keeping the slower
algorithm in case one is still used.  New thermistor tables should be
defined with this new format and with the FORMAT define set accordingly.

With the default 25 samples this adds 100 bytes to the flash image for
the thermistortable storage for two different thermistors.  But the
code is simplified and saves me 134 bytes in the bargain for a net
decrease in flash size of 34 bytes.
2016-04-17 14:31:12 +02:00
Phil Hord fe006021ee thermistortablefile.py: keep fractional part when computing table.
The Thermistortablefile.py routine prematurely drops the
fractional part of the temperature when computing the 14.2
temperature values to emit in the code. Keep this instead until
the last moment when we finally calculate the integer format we
will store.
2016-04-16 01:01:16 +02:00
Markus Hitter 74769f4275 Simulator: add help messsage for -T.
Taken from the previous commit message.
2016-04-16 01:00:01 +02:00
Phil Hord 47e62f572c Sim: add --report-temptables option
Teach simulator to calculate temperatures for all possible ADC
values using the compiled-in temperature tables and report the
resulting conversion.  Do no other run-time simulation; exit
after reporting the conversion results.  Output is suitable for
gnuplot for example like this:

  gnuplot --persist -e "plot '< ./sim -T0' u 1:2 with lines,
                             '< ./sim -T1' u 1:2 with lines"
2016-04-16 00:59:55 +02:00
Robert Konklewski ab55b86472 Add board config for the Tronxy/Cstar P802E. 2016-04-15 14:59:03 +02:00
Robert Konklewski 347fbcef5f Add printer config for the Tronxy. 2016-04-14 23:39:10 +02:00
Robert Konklewski c36f899811 .gitignore: add entries for Atmel Studio project files.
Decided to not include project files into the repo, because the
projects seem to include some absolute paths, which is not good
for developer cooperation.
2016-04-14 23:04:05 +02:00
Robert Konklewski 14788b3fe3 sersendf.c: fix printing signed 16-bit values.
The function converted int16_t to unsigned before printing it,
resulting in integer overflow.
2016-04-14 22:59:52 +02:00
Robert Konklewski 9a731c83dc watchdog.c: fix compilation with module enabled.
There was a linker error regarding missing MASK function, which
is actually a macro defined in 'pinio.h'. After #including the
file, problem disappeared.
2016-04-14 22:51:22 +02:00
Phil Hord 090be579d1 Refactor temp table optimization for any algorithm
This should be squashed but is separated here for comparison.
2016-04-14 13:26:17 +02:00
Phil Hord b7a2d58b31 Restrict thermistor table range to 0C-500C
We don't care about the accuracy of very cold temperatures
or unreasonably hot ones.
2016-04-14 13:24:59 +02:00
Phil Hord 6542c284fb Optimize temperature tables for accuracy
Temperature tables are emitted by selecting arbitrary sample values
to be used for the linear lookup table.  This is fine in the range
where the thermistor produces linear output, but it is markedly wrong
near the extremes where the thermister output begins to curve.

Introduce a new sample selector which chooses samples based on the "most
incorrect estimate" and improves from there to ensure we get a cleaner
approximation across the selected range.

Traumflug: this topic is tracked here:
https://github.com/Traumflug/Teacup_Firmware/pull/208
2016-04-14 13:03:30 +02:00
Witold Sowa fdf6dbe849 Added support for MCP3008 and MCP3004 ADC for temperature read 2016-04-12 22:37:50 +02:00
Phil Hord 52e5d784fd Remove useless lines from Configtool
I don't know what these lines were intended for, but the 'idx'
variable is not used anywhere else, so setting it is pointless.
2016-04-12 14:15:11 +02:00
Markus Hitter 67f0f6ef0e check_integrity.sh: move to a less user visible place.
No functional changes.
2016-04-12 00:11:43 +02:00
Markus Hitter 32f10e4f4b check_integrity.sh: check only version controlled files.
Checking files customized by the user is out of scope of this
tool and sometimes even workflow hindering.
2016-04-12 00:11:32 +02:00
Markus Hitter 595dd017ea Fix config files which didn't pass the new regression test.
All the changes are pretty much dummies, no functional change
anywhere.
2016-03-28 01:34:07 +02:00
Markus Hitter f0604b5e9d Add test for config files integrity.
It happens all to often that a #define is added or removed here
or there, but some related files gets forgotten. Now at least
existence of all the #defines is cross-checked.
2016-03-28 01:29:38 +02:00
Markus Hitter 4c205704ad config.h.Profiling: add Z_AUTODISABLE here, too. 2016-03-27 20:41:36 +02:00
Markus Hitter 7faab99671 board.gen7-arm.h: adjust for the released Gen7-ARM.
Just a few pin changes and similar stuff, no code change.
2016-03-27 20:36:03 +02:00
Markus Hitter 82374b8e24 Rename Z_LATE_ENABLE to Z_AUTODISABLE and refine description.
Also turn it on by default for the Mendel printer.

Also add the forgotten Mendel90 printer.
2016-03-27 20:23:05 +02:00
Wurstnase 57afef9fdd Add Z late enable.
Until this commit, the Z axis is disabled after each move and
only enabled when the Z axis will move. Now you can enable this
as a feature. Some printer axes are too heavy or have a high
pitch which are not self locking. In that case simply do nothing.
It's now off by default.
2016-03-27 20:14:04 +02:00
Markus Hitter 57cf28ad36 Add a board config for the SinapTec AT328-02.
See http://www.reprap.org/wiki/SinapTec
2016-02-28 15:57:54 +01:00
Phil Hord edae0dd31d Reduce lookahead "error" to "notice"
The marlin firmware reportedly reports "Error" instead of "!!", indicating
a machine failure which is followed by a full power-down.  The Octoprint
GCode-sender assumes a reported Error means the print has failed and
the machine turned off.

In Teacup we report an "Error" when lookahead was too slow to join
movements, but this is interpreted as an emergency-stop by Octoprint who
then stops the job and leaves the printer idle with all the heaters running.

Change this "Error" to a "Notice" to avoid this problem.  Add a comment
prefix while we're at it to fit the de facto standard better.

See http://reprap.org/wiki/G-code
2015-11-18 16:07:35 -05:00
Phil Hord 6ef35a11f2 Add test for "no endstops defined" build
This configuration used to fail.  Now it's fixed.  Test the
configuration to ensure it doesn't break again in the future.
2015-11-18 14:53:12 -05:00
Phil Hord 4f30e270b2 Don't declare variables which never get used
Fix a compiler warning about "unused variables" when no endstops
are defined.
2015-11-18 14:53:12 -05:00
Phil Hord 890879e7ee Messages: more newlines needed.
The recent switch to send 'ok' postponed requires also sending a
newline in a few places, because this 'ok' is no longer at the
start of the line. Now it appears in its own line.

A recent commit tried to correct this already, but it missed a
few locations.  Also remove the comments promising a forthcoming
newline from gcode_parse.
2015-09-23 08:21:16 -04:00
Markus Hitter 777967b3d5 Add configuration for a Mendel90 printer.
Derived from a contribution of Neil Darlow. Thank you, Neil!
2015-09-14 17:20:07 +02:00
Markus Hitter ba007f6265 Add configuration for a Melzi board.
Derived from a contribution of Neil Darlow. Thank you, Neil!

The adjustments done were reverting customisations like moving
direction reversals (which depend on motor wiring) or custom
thermistor beta values. Everything else left as-is.
2015-09-14 15:51:02 +02:00
Markus Hitter 959e803eac Git tools: a few minor improvements.
Behaviour should be unchanged, but the same tools can be used for
gEDA/pcb now, too.
2015-09-14 15:24:03 +02:00
Phil Hord 47f0f0045c MOVEBUFFER_SIZE really does not have to be power of 2
A comment in dda_queue.h says that MOVEBUFFER_SIZE no longer needs to be
a power of 2 in size.  The comment is from a commit in 2011, but only
queue_full seems to be modified to make this true.  Other places in the
code still assume that MOVEBUFFER_SIZE is always a power of 2, wrapping
it with "& (MOVEBUFFER_SIZE-1)".

Add a MB_NEXT(x) macro which can be used to definitively find the next
slot in the queue without using any boolean math.  Replace all the
queue-position functions with new code that uses this MB_NEXT function
instead.

Also change the queue_full function to use this simpler method instead
of the complicated multi-step confusion which it did.
2015-09-14 15:17:20 +02:00
Markus Hitter 040e95b555 ARM: generic port is done, all printing relevant stuff works.
Also we can compile *.c now.

:-)
2015-08-13 17:12:13 +02:00
Markus Hitter 9c29665a72 ARM: take care of system startup status.
Not much to do, still it was necessary to review this topic.
2015-08-13 17:12:13 +02:00
Markus Hitter 2376242c36 ARM: last not least, enable CANNED_CYCLE.
Was just a matter of removing the wrappers, tests ran fine.
2015-08-13 17:12:13 +02:00
Markus Hitter 5c203b6689 ARM: get watchdog.c in.
The last .c file of the generic ARM port! Again made sure it
doesn't accidentially slip in.
2015-08-13 17:12:13 +02:00
Markus Hitter f8230d6565 ARM: get usb_serial.c in.
Once more just made sure it doesn't accidentially slip in without
giving the user a warning.
2015-08-13 17:12:13 +02:00
Markus Hitter fb317fef08 ARM: get spi.c, pff.c and pff_diskio.c (SD card handling) in.
Neither is ported for now, but also not essential for printing,
so it's just made sure it's always disabled on ARM.
2015-08-13 17:12:13 +02:00
Markus Hitter d2fcc57ed4 Introduce #ifdef SPI.
It's better to separate this by function than by usage.
2015-08-13 17:12:12 +02:00
Markus Hitter 274f6c954b ARM: get graycode.c and intercom.c in.
Also both used only in unusual setups, so no functional or binary
size change for ARM.
2015-08-13 17:12:12 +02:00
Markus Hitter cc6600ca76 ARM: get debug.c and crc.c in.
Both used only in special cases, so no binary size change.
2015-08-13 17:12:12 +02:00
Markus Hitter b849e28836 ARM: get home.c in.
As usual, homing works just fine.
2015-08-13 17:12:12 +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 a1ef39f1f0 ARM: allow non-PWM pins as heater output.
Just like with AVR, they're simply set as a GPIO output and
turned on and off as needed.

Bed heater and temp sensor not yet re-enabled, because Gen7-ARM
has a driver MOSFET for the bed, which needs an inverted signal.
It can be enabled for testing; M106 P1 S2 turns it on, M106 P1 S20
turns it off. Not the way it should work.
2015-08-13 16:41:33 +02:00
Markus Hitter 10310e9d19 heater-arm.c: respect configured PWM frequencies.
Especially at high frequencies the achieved one is only close,
but that's entirely sufficient for our purposes.

Test: the PWM frequency on the scope should be similar to the
one configures in the board file with DEFINE_HEATER().
2015-08-13 16:41:33 +02:00
Markus Hitter 857fef578b heater-arm.c: turn on only timers needed.
OK, that's kind of nitpicking ...

Test: PWM pins should work as before.
2015-08-13 16:41:33 +02:00
Markus Hitter 1aeb04329c heater-arm.c: implement heater_set().
Works very nicely from full off (M106 S0) to full on (M106 S255).

Test: M106 should work now as expected. M106 S0 should turn full
off, M106 S255 should turn full on, both without any spike on the
scope.
2015-08-13 16:41:33 +02:00
Markus Hitter d7b59e2d33 ARM: implement heater-arm.c partially.
Currently at a fixed frequency of 1 kHz and with a fixed duty
cycle of 10%, but PWM does work.

As it turns out, PIO0_11 is not usable for PWM, because its timer
is already in use for the Step timer, and had to be disabled for
Gen7-ARM.

Test: define a heater in board.gen7-arm.h and a square signal
of 1 kHz with 10% duty cycle should appear on the heater pin.
2015-08-13 16:41:33 +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