Commit Graph

1333 Commits

Author SHA1 Message Date
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
Markus Hitter 8f24fbaad4 ARM: get temp.c in.
No code changes, but quite a few removals of __ARMEL_NOTYET__
guards. 20 such guards left.

Test: M105 should work and report plausible temperatures.

Current code size:

    SIZES          ARM...     lpc1114
    FLASH  :  9460 bytes          29%
    RAM    :  1258 bytes          31%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:37 +02:00
Markus Hitter 6b6aa84124 Makefile-ARM: disable Link Time Optimisation (-flto).
LTO makes generated assembly unreadable and also produces, despite
its intention, bigger binaries, currently by 90 bytes.
2015-08-12 14:26:37 +02:00
Markus Hitter 1a2973a2de analog-avr.c: take the opportunity to rewrite analog_read() here.
The former implementation easily led to memory corruption, because
no range check happened.

Costs 22 bytes binary size, unfortunately.
2015-08-12 14:26:37 +02:00
Markus Hitter 7805e741cd analog-arm.c: read not by ADC channel number, but by Teacup number.
Analog reading should be complete by now :-)
2015-08-12 14:26:37 +02:00
Markus Hitter 708289714f analog-arm.c: use configured analog pins, not two fixed ones.
An obvious neccessity, just not done before to show better how
stuff works.
2015-08-12 14:26:37 +02:00
Markus Hitter f81000a4b6 ARM: implement analog-arm.c.
Very simple, because the LPC1114 features a hardware scan mode,
which automatically scans a given set of pins in freerunning mode
and stores all the values separately. No need for an interrupt!

Not yet done: configure not PIO1_0 and PIO1_1, but the pins
actually defined in the board file.

For testing, add this to ifclock(clock_flag_1s) in clock.c:
  uint8_t i;

  for (i = 0; i <= 7; i++) {
    sersendf_P(PSTR("%lu "), analog_read(i));
  }
  serial_writechar('\n');

This should print all 8 ADC values repeatedly. Only two pins are
actually set up, these values should change depending on the
thermistor temperature. More precisely: depending on the voltage
on the pin.
2015-08-12 14:26:37 +02:00
Markus Hitter 56f6b381fd ARM: split out analog-avr.c from analog.c. 2015-08-12 14:26:37 +02:00
Markus Hitter 05c7cf067f ARM: get dda_lookahead.c in.
Not much to say, simply works.
2015-08-12 14:26:37 +02:00
Markus Hitter 7afbc70d58 Step timer: reset timer after pauses instead of doing a guess.
We know already wether we start from a pause or not, so let's
take advantage of this knowledge instead of checking for
plausibility of a timer delay at interrupt time.

Costs just 8 bytes binary size:

    SIZES          ARM...     lpc1114
    FLASH  :  7764 bytes          24%
    RAM    :   960 bytes          24%
    EEPROM :     0 bytes           0%

Due to the less code at interrupt time, maximum step rate was
raised from 127.9 kHz to 130.6 kHz.
2015-08-12 14:26:37 +02:00