Go to file
Markus Hitter 2ad7517e27 preprocessor_math.h, SQRT(): take a better initial guess.
Now results are apparently accurate across the whole uint32 range.
At least, this test passes with all numbers being exact:

  #include "preprocessor_math.h"
  #include <math.h>
  ... in main() ...
  sersendf_P(PSTR("0:  %lu  %lu\n"), (uint32_t)SQRT(0), (uint32_t)sqrt(0));
  sersendf_P(PSTR("1:  %lu  %lu\n"), (uint32_t)SQRT(1), (uint32_t)sqrt(1));
  sersendf_P(PSTR("2:  %lu  %lu\n"), (uint32_t)SQRT(2), (uint32_t)sqrt(2));
  sersendf_P(PSTR("3:  %lu  %lu\n"), (uint32_t)SQRT(3), (uint32_t)sqrt(3));
  sersendf_P(PSTR("4:  %lu  %lu\n"), (uint32_t)SQRT(4), (uint32_t)sqrt(4));
  sersendf_P(PSTR("5:  %lu  %lu\n"), (uint32_t)SQRT(5), (uint32_t)sqrt(5));
  sersendf_P(PSTR("6:  %lu  %lu\n"), (uint32_t)SQRT(6), (uint32_t)sqrt(6));
  sersendf_P(PSTR("7:  %lu  %lu\n"), (uint32_t)SQRT(7), (uint32_t)sqrt(7));
  sersendf_P(PSTR("8:  %lu  %lu\n"), (uint32_t)SQRT(8), (uint32_t)sqrt(8));
  sersendf_P(PSTR("9:  %lu  %lu\n"), (uint32_t)SQRT(9), (uint32_t)sqrt(9));
  sersendf_P(PSTR("10:  %lu  %lu\n"), (uint32_t)SQRT(10), (uint32_t)sqrt(10));
  sersendf_P(PSTR("20:  %lu  %lu\n"), (uint32_t)SQRT(20), (uint32_t)sqrt(20));
  sersendf_P(PSTR("30:  %lu  %lu\n"), (uint32_t)SQRT(30), (uint32_t)sqrt(30));
  sersendf_P(PSTR("40:  %lu  %lu\n"), (uint32_t)SQRT(40), (uint32_t)sqrt(40));
  sersendf_P(PSTR("50:  %lu  %lu\n"), (uint32_t)SQRT(50), (uint32_t)sqrt(50));
  sersendf_P(PSTR("60:  %lu  %lu\n"), (uint32_t)SQRT(60), (uint32_t)sqrt(60));
  sersendf_P(PSTR("70:  %lu  %lu\n"), (uint32_t)SQRT(70), (uint32_t)sqrt(70));
  sersendf_P(PSTR("80:  %lu  %lu\n"), (uint32_t)SQRT(80), (uint32_t)sqrt(80));
  sersendf_P(PSTR("90:  %lu  %lu\n"), (uint32_t)SQRT(90), (uint32_t)sqrt(90));
  sersendf_P(PSTR("100:  %lu  %lu\n"), (uint32_t)SQRT(100), (uint32_t)sqrt(100));
  sersendf_P(PSTR("200:  %lu  %lu\n"), (uint32_t)SQRT(200), (uint32_t)sqrt(200));
  sersendf_P(PSTR("300:  %lu  %lu\n"), (uint32_t)SQRT(300), (uint32_t)sqrt(300));
  sersendf_P(PSTR("400:  %lu  %lu\n"), (uint32_t)SQRT(400), (uint32_t)sqrt(400));
  sersendf_P(PSTR("500:  %lu  %lu\n"), (uint32_t)SQRT(500), (uint32_t)sqrt(500));
  sersendf_P(PSTR("600:  %lu  %lu\n"), (uint32_t)SQRT(600), (uint32_t)sqrt(600));
  sersendf_P(PSTR("700:  %lu  %lu\n"), (uint32_t)SQRT(700), (uint32_t)sqrt(700));
  sersendf_P(PSTR("800:  %lu  %lu\n"), (uint32_t)SQRT(800), (uint32_t)sqrt(800));
  sersendf_P(PSTR("900:  %lu  %lu\n"), (uint32_t)SQRT(900), (uint32_t)sqrt(900));
  sersendf_P(PSTR("1000:  %lu  %lu\n"), (uint32_t)SQRT(1000), (uint32_t)sqrt(1000));
  sersendf_P(PSTR("2000:  %lu  %lu\n"), (uint32_t)SQRT(2000), (uint32_t)sqrt(2000));
  sersendf_P(PSTR("3000:  %lu  %lu\n"), (uint32_t)SQRT(3000), (uint32_t)sqrt(3000));
  sersendf_P(PSTR("4000:  %lu  %lu\n"), (uint32_t)SQRT(4000), (uint32_t)sqrt(4000));
  sersendf_P(PSTR("5000:  %lu  %lu\n"), (uint32_t)SQRT(5000), (uint32_t)sqrt(5000));
  sersendf_P(PSTR("6000:  %lu  %lu\n"), (uint32_t)SQRT(6000), (uint32_t)sqrt(6000));
  sersendf_P(PSTR("7000:  %lu  %lu\n"), (uint32_t)SQRT(7000), (uint32_t)sqrt(7000));
  sersendf_P(PSTR("8000:  %lu  %lu\n"), (uint32_t)SQRT(8000), (uint32_t)sqrt(8000));
  sersendf_P(PSTR("9000:  %lu  %lu\n"), (uint32_t)SQRT(9000), (uint32_t)sqrt(9000));
  sersendf_P(PSTR("10000:  %lu  %lu\n"), (uint32_t)SQRT(10000), (uint32_t)sqrt(10000));
  sersendf_P(PSTR("20000:  %lu  %lu\n"), (uint32_t)SQRT(20000), (uint32_t)sqrt(20000));
  sersendf_P(PSTR("30000:  %lu  %lu\n"), (uint32_t)SQRT(30000), (uint32_t)sqrt(30000));
  sersendf_P(PSTR("40000:  %lu  %lu\n"), (uint32_t)SQRT(40000), (uint32_t)sqrt(40000));
  sersendf_P(PSTR("50000:  %lu  %lu\n"), (uint32_t)SQRT(50000), (uint32_t)sqrt(50000));
  sersendf_P(PSTR("60000:  %lu  %lu\n"), (uint32_t)SQRT(60000), (uint32_t)sqrt(60000));
  sersendf_P(PSTR("70000:  %lu  %lu\n"), (uint32_t)SQRT(70000), (uint32_t)sqrt(70000));
  sersendf_P(PSTR("80000:  %lu  %lu\n"), (uint32_t)SQRT(80000), (uint32_t)sqrt(80000));
  sersendf_P(PSTR("90000:  %lu  %lu\n"), (uint32_t)SQRT(90000), (uint32_t)sqrt(90000));
  sersendf_P(PSTR("100000:  %lu  %lu\n"), (uint32_t)SQRT(100000), (uint32_t)sqrt(100000));
  sersendf_P(PSTR("200000:  %lu  %lu\n"), (uint32_t)SQRT(200000), (uint32_t)sqrt(200000));
  sersendf_P(PSTR("300000:  %lu  %lu\n"), (uint32_t)SQRT(300000), (uint32_t)sqrt(300000));
  sersendf_P(PSTR("400000:  %lu  %lu\n"), (uint32_t)SQRT(400000), (uint32_t)sqrt(400000));
  sersendf_P(PSTR("500000:  %lu  %lu\n"), (uint32_t)SQRT(500000), (uint32_t)sqrt(500000));
  sersendf_P(PSTR("600000:  %lu  %lu\n"), (uint32_t)SQRT(600000), (uint32_t)sqrt(600000));
  sersendf_P(PSTR("700000:  %lu  %lu\n"), (uint32_t)SQRT(700000), (uint32_t)sqrt(700000));
  sersendf_P(PSTR("800000:  %lu  %lu\n"), (uint32_t)SQRT(800000), (uint32_t)sqrt(800000));
  sersendf_P(PSTR("900000:  %lu  %lu\n"), (uint32_t)SQRT(900000), (uint32_t)sqrt(900000));
  sersendf_P(PSTR("1000000:  %lu  %lu\n"), (uint32_t)SQRT(1000000), (uint32_t)sqrt(1000000));
  sersendf_P(PSTR("2000000:  %lu  %lu\n"), (uint32_t)SQRT(2000000), (uint32_t)sqrt(2000000));
  sersendf_P(PSTR("3000000:  %lu  %lu\n"), (uint32_t)SQRT(3000000), (uint32_t)sqrt(3000000));
  sersendf_P(PSTR("4000000:  %lu  %lu\n"), (uint32_t)SQRT(4000000), (uint32_t)sqrt(4000000));
  sersendf_P(PSTR("5000000:  %lu  %lu\n"), (uint32_t)SQRT(5000000), (uint32_t)sqrt(5000000));
  sersendf_P(PSTR("6000000:  %lu  %lu\n"), (uint32_t)SQRT(6000000), (uint32_t)sqrt(6000000));
  sersendf_P(PSTR("7000000:  %lu  %lu\n"), (uint32_t)SQRT(7000000), (uint32_t)sqrt(7000000));
  sersendf_P(PSTR("8000000:  %lu  %lu\n"), (uint32_t)SQRT(8000000), (uint32_t)sqrt(8000000));
  sersendf_P(PSTR("9000000:  %lu  %lu\n"), (uint32_t)SQRT(9000000), (uint32_t)sqrt(9000000));
  sersendf_P(PSTR("10000000:  %lu  %lu\n"), (uint32_t)SQRT(10000000), (uint32_t)sqrt(10000000));
  sersendf_P(PSTR("20000000:  %lu  %lu\n"), (uint32_t)SQRT(20000000), (uint32_t)sqrt(20000000));
  sersendf_P(PSTR("30000000:  %lu  %lu\n"), (uint32_t)SQRT(30000000), (uint32_t)sqrt(30000000));
  sersendf_P(PSTR("40000000:  %lu  %lu\n"), (uint32_t)SQRT(40000000), (uint32_t)sqrt(40000000));
  sersendf_P(PSTR("50000000:  %lu  %lu\n"), (uint32_t)SQRT(50000000), (uint32_t)sqrt(50000000));
  sersendf_P(PSTR("60000000:  %lu  %lu\n"), (uint32_t)SQRT(60000000), (uint32_t)sqrt(60000000));
  sersendf_P(PSTR("70000000:  %lu  %lu\n"), (uint32_t)SQRT(70000000), (uint32_t)sqrt(70000000));
  sersendf_P(PSTR("80000000:  %lu  %lu\n"), (uint32_t)SQRT(80000000), (uint32_t)sqrt(80000000));
  sersendf_P(PSTR("90000000:  %lu  %lu\n"), (uint32_t)SQRT(90000000), (uint32_t)sqrt(90000000));
  sersendf_P(PSTR("100000000:  %lu  %lu\n"), (uint32_t)SQRT(100000000), (uint32_t)sqrt(100000000));
  sersendf_P(PSTR("200000000:  %lu  %lu\n"), (uint32_t)SQRT(200000000), (uint32_t)sqrt(200000000));
  sersendf_P(PSTR("300000000:  %lu  %lu\n"), (uint32_t)SQRT(300000000), (uint32_t)sqrt(300000000));
  sersendf_P(PSTR("400000000:  %lu  %lu\n"), (uint32_t)SQRT(400000000), (uint32_t)sqrt(400000000));
  sersendf_P(PSTR("500000000:  %lu  %lu\n"), (uint32_t)SQRT(500000000), (uint32_t)sqrt(500000000));
  sersendf_P(PSTR("600000000:  %lu  %lu\n"), (uint32_t)SQRT(600000000), (uint32_t)sqrt(600000000));
  sersendf_P(PSTR("700000000:  %lu  %lu\n"), (uint32_t)SQRT(700000000), (uint32_t)sqrt(700000000));
  sersendf_P(PSTR("800000000:  %lu  %lu\n"), (uint32_t)SQRT(800000000), (uint32_t)sqrt(800000000));
  sersendf_P(PSTR("900000000:  %lu  %lu\n"), (uint32_t)SQRT(900000000), (uint32_t)sqrt(900000000));
  sersendf_P(PSTR("1000000000:  %lu  %lu\n"), (uint32_t)SQRT(1000000000), (uint32_t)sqrt(1000000000));
  sersendf_P(PSTR("2000000000:  %lu  %lu\n"), (uint32_t)SQRT(2000000000), (uint32_t)sqrt(2000000000));
  sersendf_P(PSTR("3000000000:  %lu  %lu\n"), (uint32_t)SQRT(3000000000), (uint32_t)sqrt(3000000000));
  sersendf_P(PSTR("4000000000:  %lu  %lu\n"), (uint32_t)SQRT(4000000000), (uint32_t)sqrt(4000000000));
2014-08-31 19:10:07 +02:00
attic Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
extruder Align section attributes usage: always before the variable name. 2014-03-04 19:57:56 +01:00
research Add gnuplot script to explore simulator output 2013-12-06 19:24:58 +01:00
simulator Datalog: show traced data as signed ints, not unsigned. 2014-08-31 19:09:37 +02:00
testcases testcases: Add config.h. 2014-08-31 19:07:39 +02:00
tools deriv.awk: Calculate derivative of every column 2014-03-04 19:57:28 +01:00
.gitignore WIP: Add simulator data-logging. 2013-12-06 19:24:58 +01:00
Doxyfile Remove LUFA. 2012-12-03 19:48:54 +01:00
LICENSE licensing- GPL-2 at the moment 2010-10-20 18:15:09 +11:00
Makefile-AVR Makefile-AVR: Update MCU_TARGET=at90usb1286 conditional. 2014-06-13 21:04:13 +02:00
Makefile-SIM simulator: Turn off printf format warnings 2014-05-29 21:47:52 +02:00
Makefile-common DRY: Reduce duplication in platform Makefiles 2014-03-04 19:56:46 +01:00
Makefile-example make Makefile-{SIM,AVR,common} more generic 2014-03-04 19:56:30 +01:00
README README: shorten drastically to avoid documentation duplication. 2013-02-05 14:10:55 +01:00
README.sim Teach simulator to process gcode files directly 2013-12-06 19:24:58 +01:00
Teacup_Firmware.pde arduino ide: .pde must have the same name as the folder. 2011-02-27 22:08:41 +01:00
ThermistorTable.double.h Align section attributes usage: always before the variable name. 2014-03-04 19:57:56 +01:00
ThermistorTable.single.h Align section attributes usage: always before the variable name. 2014-03-04 19:57:56 +01:00
analog.c Zungmann's fixes to compile simulator on Mac OS X, part 2. 2014-03-04 19:57:48 +01:00
analog.h Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
arduino.h Zungmann's fixes to compile simulator on Mac OS X, part 2. 2014-03-04 19:57:48 +01:00
arduino_32U4.h Configuration: move DEBUG_LED definition. 2014-08-31 19:05:38 +02:00
arduino_168_328p.h Configuration: move DEBUG_LED definition. 2014-08-31 19:05:38 +02:00
arduino_644.h Configuration: move DEBUG_LED definition. 2014-08-31 19:05:38 +02:00
arduino_1280.h Configuration: move DEBUG_LED definition. 2014-08-31 19:05:38 +02:00
arduino_usb1286.h Configuration: move DEBUG_LED definition. 2014-08-31 19:05:38 +02:00
arduino_usb1287.h Configuration: move DEBUG_LED definition. 2014-08-31 19:05:38 +02:00
calc.pl setting up new branch 2 2010-08-10 14:26:24 +10:00
clock.c DDA: Convert TARGET axis vars to array. 2014-08-31 19:03:17 +02:00
clock.h clock.c: make clock_10ms() and clock_250ms() static. 2012-09-29 23:00:39 +02:00
config.default.h config.default.h: Add DEBUG_LED_PIN to the pinout section. 2014-08-31 19:07:01 +02:00
config.gen3.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.gen6.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.gen7-v1.1-v1.3.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.gen7-v1.4.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.ramps-v1.2.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.ramps-v1.3.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.sanguinololu-v1.1.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.sanguinololu-v1.2.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.sanguish.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.teensy.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config.teensypp.h config.*.h: extend DEBUG_LED_PIN comment to all config templates. 2014-08-31 19:07:13 +02:00
config_wrapper.h Give users a hint in case they obviously forgot to read instructions. 2014-07-09 21:38:12 +02:00
copier.c Merge release-candidate-triffid branch 2011-01-07 23:09:13 +11:00
copier.h setting up new branch 2 2010-08-10 14:26:24 +10:00
crc.c Restore simulation build target. 2013-12-06 19:24:58 +01:00
crc.h use CRC16 to verify heater PID settings in eeprom 2011-02-20 17:13:09 +11:00
createTemperatureLookup.py Update URLs for new github location 2014-03-04 19:57:08 +01:00
dda.c DDA: Rename confusing variable name. 2014-08-31 19:09:24 +02:00
dda.h DDA: Rename confusing variable name. 2014-08-31 19:09:24 +02:00
dda_lookahead.c dda_lookahead.c: Eliminate debug crossF variable compile warning. 2014-08-31 19:06:43 +02:00
dda_lookahead.h Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
dda_maths.c Rename all these new PROGMEM variables to end in _P. 2014-08-31 19:05:25 +02:00
dda_maths.h dda_maths.h: Add comment on units of C0. 2014-08-31 19:06:34 +02:00
dda_queue.c DDA: clear flags of a queue entry earlier. 2014-03-04 19:58:06 +01:00
dda_queue.h Remove __attribute__((hot)). 2014-03-04 19:56:13 +01:00
debug.c setting up new branch 2 2010-08-10 14:26:24 +10:00
debug.h debug.h: Align M111 debug bit codes with Repetier-Host. 2014-08-31 19:08:26 +02:00
delay.c Eliminate _delay(), delay() and _delay_us(). 2013-03-24 16:19:24 +01:00
delay.h delay.h: re-add falsely removed #include. 2013-03-24 16:19:25 +01:00
extract.py Added gcode documentation and extraction tool 2011-06-03 02:02:46 +10:00
func.sh func.sh: Fix a potential infinite loop in mendel_readsym_target 2011-05-08 00:36:55 +10:00
fuses.h make it even harder to unintentionally include fuse definitions 2011-02-04 11:04:15 +11:00
gcode_parse.c gcode_parse.c: Debug S with serwrite_int32. 2014-08-31 19:07:30 +02:00
gcode_parse.h gcode_parse.h: raise S word size. 2014-05-29 21:49:29 +02:00
gcode_process.c gcode_process.c: Add comment on units of P, I, and D parameters. 2014-08-31 19:06:52 +02:00
gcode_process.h gcode_process.c: make special moves non-public. 2011-02-27 11:55:01 +01:00
graycode.c disable greycode by default in arduino IDE 2011-02-17 21:52:15 +11:00
heater.c heater.c, config.default.h: Make PID_CONDITIONAL_INTEGRATION non-optional. 2014-07-11 01:37:35 +02:00
heater.h Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
home.c home.c: no need to turn off Z axis here. 2014-08-31 19:03:57 +02:00
home.h Fixed single inclusion of file. Added missing define. 2011-08-16 14:09:49 +02:00
intercom.c Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
intercom.h Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
memory_barrier.h Simulator cleanup 2013-12-06 19:24:58 +01:00
mendel.c mendel.c: Enable DEBUG_LED_PIN output if defined. 2014-05-29 21:48:46 +02:00
mendel_cmd Merge release-candidate-triffid branch 2011-01-07 23:09:13 +11:00
pinio.c DDA: Move axis calculations into loops, part 6b. 2014-08-31 19:07:59 +02:00
pinio.h DDA: Move axis calculations into loops, part 6b. 2014-08-31 19:07:59 +02:00
preprocessor_math.h preprocessor_math.h, SQRT(): take a better initial guess. 2014-08-31 19:10:07 +02:00
sd.c Eliminate _delay(), delay() and _delay_us(). 2013-03-24 16:19:24 +01:00
sender-mac.sh sender-mac.sh: another minor fix. 2011-09-30 21:02:25 +02:00
sender.sh sender.sh: Allow for "ok" to be surrounded by DEBUG output. 2011-03-04 19:42:00 +11:00
serial.c Rename all these new PROGMEM variables to end in _P. 2014-08-31 19:05:25 +02:00
serial.h Rename all these new PROGMEM variables to end in _P. 2014-08-31 19:05:25 +02:00
sermsg.c sermesg.c: Add documentation tag for variable floating point. 2014-08-31 19:07:21 +02:00
sermsg.h M114 returns millimeters instead of steps 2011-04-26 14:44:17 +10:00
sersendf.c Rename all these new PROGMEM variables to end in _P. 2014-08-31 19:05:25 +02:00
sersendf.h Rename all these new PROGMEM variables to end in _P. 2014-08-31 19:05:25 +02:00
simulator.h Zungmann's fixes to compile simulator on Mac OS X, part 2. 2014-03-04 19:57:48 +01:00
temp.c temp.c: fix typo. 2014-04-13 11:24:47 +02:00
temp.h Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
timer.c Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
timer.h Restore simulation build target. 2013-12-06 19:24:58 +01:00
usb_serial.c Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00
usb_serial.h Import USB Serial from http://www.pjrc.com/teensy/usb_serial.html 2012-11-08 16:36:48 +01:00
watchdog.c According to avr-libc documentation, ISR() handles SREG its self. 2013-10-27 20:01:51 +01:00
watchdog.h Add config.h wrapper to simplify test automation 2014-03-04 19:56:23 +01:00

README

##############################################################################
#                                                                            #
# Teacup - lean and efficient firmware for RepRap printers                   #
#                                                                            #
# by Triffid Hunter, Traumflug, jakepoz, Markus Hitter, many others          #
#                                                                            #
##############################################################################

For installation instructions, see
http://reprap.org/wiki/Teacup_Firmware#Simple_Installation and/or
http://reprap.org/wiki/Teacup_Firmware#Developer_Installation

For documentation, see
http://reprap.org/wiki/Teacup_Firmware


##############################################################################
#                                                                            #
# This firmware is Copyright (c) ...                                         #
#   2009 - 2010 Michael Moon aka Triffid_Hunter                              #
#   2010 - 2013 Markus "Traumflug" Hitter <mah@jump-ing.de>                  #
#                                                                            #
# This program is free software; you can redistribute it and/or modify       #
# it under the terms of the GNU General Public License as published by       #
# the Free Software Foundation; either version 2 of the License, or          #
# (at your option) any later version.                                        #
#                                                                            #
# This program is distributed in the hope that it will be useful,            #
# but WITHOUT ANY WARRANTY; without even the implied warranty of             #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              #
# GNU General Public License for more details.                               #
#                                                                            #
# You should have received a copy of the GNU General Public License          #
# along with this program; if not, write to the Free Software                #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA #
#                                                                            #
##############################################################################