Compare commits
165 commits
nolookahea
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 51c592e467 | |||
| 0814505772 | |||
| 3e6e444b25 | |||
| fdde4e44a1 | |||
| ff6b7d0b57 | |||
|
|
b6820141ea | ||
|
|
04d0b538c4 | ||
|
|
de2feb0cac | ||
|
|
1f11008dc8 | ||
|
|
e206720abf | ||
|
|
3e6cce46ae | ||
|
|
08c975f3fa | ||
|
|
1db03fa315 | ||
|
|
7ef1d5bac3 | ||
|
|
0e3464eae1 | ||
|
|
eb9de32b30 | ||
|
|
9fe56bac47 | ||
|
|
982796f9f0 | ||
|
|
dd2b9ef537 | ||
|
|
d98317e213 | ||
|
|
3dca6f03e1 | ||
|
|
f09198255c | ||
|
|
840c11de71 | ||
|
|
890038c93e | ||
|
|
16a408af3d | ||
|
|
e0d9840439 | ||
|
|
c5cd7f4046 | ||
|
|
eda666ce33 | ||
|
|
7975010946 | ||
|
|
3cc48055c2 | ||
|
|
05e1d6083b | ||
|
|
490759557f | ||
|
|
1d4bc83291 | ||
|
|
866449371b | ||
|
|
22445736c7 | ||
|
|
12de400926 | ||
|
|
416965177a | ||
|
|
82bdbc233a | ||
|
|
02eb9b9099 | ||
|
|
cbaf809d76 | ||
|
|
597310a3dc | ||
|
|
2ac9c3e24d | ||
|
|
862b63b387 | ||
|
|
648b25444d | ||
|
|
e998ed8fdb | ||
|
|
87cf8e280d | ||
|
|
babd2a3e84 | ||
|
|
aab62de29c | ||
|
|
9af0980080 | ||
|
|
9c708af22e | ||
|
|
b76a110336 | ||
|
|
344235701b | ||
|
|
a63ade8350 | ||
|
|
a295b6147e | ||
|
|
c17bbb3296 | ||
|
|
18ad4ffc0e | ||
|
|
af7ebae0f8 | ||
|
|
d2ccafcb77 | ||
|
|
5a60fcd6f5 | ||
|
|
d651a6cb90 | ||
|
|
976c90b315 | ||
|
|
468dfeea60 | ||
|
|
4e9cf992e1 | ||
|
|
0e3d2ecea4 | ||
|
|
ed9fe956a7 | ||
|
|
3a29ee97d1 | ||
|
|
378426c766 | ||
|
|
d8b0ac3453 | ||
|
|
31ccfda44b | ||
|
|
4eeeaed9fc | ||
|
|
91ec05a01b | ||
|
|
e89142f6a2 | ||
|
|
52f7f30408 | ||
|
|
1748e3258b | ||
|
|
b75a6ad79d | ||
|
|
2579d9390d | ||
|
|
85f61f040f | ||
|
|
2379ce0df3 | ||
|
|
f1bc263860 | ||
|
|
13f642c637 | ||
|
|
13cd4cb757 | ||
|
|
c3324a234c | ||
|
|
0d4d5714bc | ||
|
|
0c36faa803 | ||
|
|
2d498da2c1 | ||
|
|
ed0f1c6f8c | ||
|
|
4df80c0d6b | ||
|
|
8147df6ae0 | ||
|
|
8954e1ccb9 | ||
|
|
3534d9bde3 | ||
|
|
9af1ae8589 | ||
|
|
e65e0d23ee | ||
|
|
8b8f5bf474 | ||
|
|
d8e913a6b6 | ||
|
|
1fee76039c | ||
|
|
97c90f7501 | ||
|
|
e48ba6ead7 | ||
|
|
10198f7ffe | ||
|
|
b0fc85c98d | ||
|
|
3116c11f5d | ||
|
|
7d93c079df | ||
|
|
54b68d0bf3 | ||
|
|
bcef226413 | ||
|
|
0a47e2d0b6 | ||
|
|
0ada66f112 | ||
|
|
8465acbfb8 | ||
|
|
b4911b203a | ||
|
|
0ed514e153 | ||
|
|
eb421e6a65 | ||
|
|
c6ebbfdb12 | ||
|
|
9a644d02ce | ||
|
|
7be03db9d8 | ||
|
|
421c390596 | ||
|
|
20a99c5925 | ||
|
|
7c5e58a7c4 | ||
|
|
d30c3199f9 | ||
|
|
89180de4bf | ||
|
|
39bd33a3d1 | ||
|
|
20daeb57bb | ||
|
|
6b44b4f9f1 | ||
|
|
4b1b0f1d96 | ||
|
|
ee764635a3 | ||
|
|
bb38d646d3 | ||
|
|
cba31acb76 | ||
|
|
7b21a2a055 | ||
|
|
5a41980404 | ||
|
|
e74587a1b4 | ||
|
|
0953453911 | ||
|
|
07a63e7eb1 | ||
|
|
da6a2e0436 | ||
|
|
2ffe5ec2b5 | ||
|
|
132f8c212e | ||
|
|
cedbef50f5 | ||
|
|
16143bc2cb | ||
|
|
4ea5b0d811 | ||
|
|
89e8e18850 | ||
|
|
eb2dc852d0 | ||
|
|
ceae0a472d | ||
|
|
ad7503df25 | ||
|
|
76bbfb39ae | ||
|
|
8d17b09475 | ||
|
|
fa63b839c6 | ||
|
|
908bc5314c | ||
|
|
4f59622219 | ||
|
|
d8b6c5f233 | ||
|
|
eb7a192c94 | ||
|
|
e7fb583df9 | ||
|
|
439f339f74 | ||
|
|
49c5c65dcf | ||
|
|
2c00d1580f | ||
|
|
09d5247ba2 | ||
|
|
b331d48101 | ||
|
|
9090c6a460 | ||
|
|
bb28b03aa2 | ||
|
|
fa1a0e7def | ||
|
|
d196068a8c | ||
|
|
514eec1fee | ||
|
|
6b882d0368 | ||
|
|
f5c05d9439 | ||
|
|
24469eaf25 | ||
|
|
318c7b4f64 | ||
|
|
4506c497a4 | ||
|
|
b98a4653d5 | ||
|
|
105eedeffa | ||
|
|
fcce94653d |
18 changed files with 4934 additions and 1143 deletions
31
README
31
README
|
|
@ -1,4 +1,6 @@
|
|||
The leading developers of Sprinter are currently Kliment and caru, though many others contribute with their patches.
|
||||
//this file is for the CERN Robotics club reprap. All the custom settings for our build are in config.h. Please download and flash this file.
|
||||
|
||||
The leading developers of Sprinter are currently Kliment, caru and midopple, though many others contribute with their patches.
|
||||
|
||||
This is a firmware for RAMPS and other reprap single-processor electronics setups. It supports printing from SD card, active heatbed control, and ATmega internal pullups.
|
||||
|
||||
|
|
@ -40,20 +42,12 @@ Software installation
|
|||
1. Install the required packages (gcc-avr, avr-libc, etc.)
|
||||
sudo apt-get install arduino-core
|
||||
|
||||
2. Get the arduino software version 0018 (0023 works for RAMPS), uncompress it in a directory
|
||||
Arduino software v1 DOES NOT work with Sprinter yet!
|
||||
2. Get the arduino software version 0023, uncompress it in a directory.
|
||||
Arduino software v1 has not been tested much, but is known to work with some boards.
|
||||
http://www.arduino.cc/en/Main/Software
|
||||
|
||||
3. Get the sanguino software, version 0018
|
||||
http://sanguino.cc/softwareforlinux
|
||||
|
||||
follow the sanguino's readme so that your arduino hardware folder looks like
|
||||
arduino-0018/hardware/arduino
|
||||
arduino-0018/hardware/sanguino
|
||||
arduino-0018/hardware/tools
|
||||
|
||||
4. Clone the Sprinter git repository.
|
||||
git clone https://github.com/kliment/Sprinter.git
|
||||
git clone https://github.com/pingud98/Sprinter.git
|
||||
Optionally, switch to the desired branch
|
||||
git branch -a
|
||||
git checkout THE_BRANCH_YOU_WANT
|
||||
|
|
@ -64,16 +58,13 @@ Firmware compilation and upload
|
|||
5. Edit INSTALL_DIR inside Sprinter/Makefile (do not mind the default reference to arduino 0022)
|
||||
|
||||
6. Run make. If everything goes well Sprinter/applet/Sprinter.cpp should have been created.
|
||||
You can safely ignore the error message mentioning arduino-0018/hardware/arduino/cores/arduino/WString.o
|
||||
You can safely ignore the error message mentioning arduino-0023/hardware/arduino/cores/arduino/WString.o
|
||||
|
||||
7. Connect your Sanguinololu to your computer
|
||||
http://reprap.org/wiki/Sanguinololu
|
||||
|
||||
8. Launch arduino-0018/arduino, open Sprinter/Sprinter.pde
|
||||
8. Launch arduino-0023/arduino, open Sprinter/Sprinter.pde
|
||||
|
||||
9. Go to Tools -> Serial Port, and select the relevant option
|
||||
|
||||
10. Go to Tools -> Board, select Sanguino
|
||||
10. Go to Tools -> Board, select Arduino Mega 2560
|
||||
|
||||
11. Go to the Configuration.h file and edit the following lines:
|
||||
#define MOTHERBOARD 62
|
||||
|
|
@ -95,6 +86,10 @@ also for the mentioned hardware setup
|
|||
13. Click on "the arrow going to the right" button to upload (you had done steps 7,8,9 before, right ?).
|
||||
If everything goes well you should see the message "Done uploading".
|
||||
|
||||
if GEN7 with 20 Mhz is in use set the Fuses for Bootloader to
|
||||
lfuse= 0xF7 hfuse = 0xD4 efuse = FD
|
||||
Brownout must be 2,7 V
|
||||
|
||||
Congratulations, you have just upgraded the firmware of your RepRap !
|
||||
|
||||
You can use pronterface.py to do some manual verifications by moving the printer's tip along
|
||||
|
|
|
|||
|
|
@ -5,15 +5,19 @@
|
|||
|
||||
//// The following define selects which electronics board you have. Please choose the one that matches your setup
|
||||
// MEGA/RAMPS up to 1.2 = 3,
|
||||
// RAMPS 1.3 = 33
|
||||
// RAMPS 1.3/1.4 = 33
|
||||
// Gen6 = 5,
|
||||
// Gen6 deluxe = 51
|
||||
// Sanguinololu up to 1.1 = 6
|
||||
// Sanguinololu 1.2 and above = 62
|
||||
// Gen 7 @ 16MHZ only= 7
|
||||
// Gen 7 @ 20MHZ only= 71
|
||||
// Teensylu (at90usb) = 8
|
||||
// Printrboard Rev. B (ATMEGA90USB1286) = 9
|
||||
// Gen 3 Plus = 21
|
||||
// gen 3 Monolithic Electronics = 22
|
||||
// Gen3 PLUS for TechZone Gen3 Remix Motherboard = 23
|
||||
#define MOTHERBOARD 3
|
||||
#define MOTHERBOARD 33
|
||||
|
||||
//// Thermistor settings:
|
||||
// 1 is 100k thermistor
|
||||
|
|
@ -28,70 +32,140 @@
|
|||
|
||||
//// Calibration variables
|
||||
// X, Y, Z, E steps per unit - Metric Prusa Mendel with Wade extruder:
|
||||
float axis_steps_per_unit[] = {80, 80, 3200/1.25,700};
|
||||
|
||||
// old values:
|
||||
//#define _AXIS_STEP_PER_UNIT {160, 160, 3200/0.80,350}
|
||||
// new values by Fosfor, 2015-04-29:
|
||||
#define _AXIS_STEP_PER_UNIT {228.57, 160, 5120, 1167.99}
|
||||
|
||||
// Metric Prusa Mendel with Makergear geared stepper extruder:
|
||||
//float axis_steps_per_unit[] = {80,80,3200/1.25,1380};
|
||||
//#define _AXIS_STEP_PER_UNIT {80,80,3200/1.25,1380}
|
||||
// MakerGear Hybrid Prusa Mendel:
|
||||
// Z axis value is for .9 stepper(if you have 1.8 steppers for Z, you need to use 2272.7272)
|
||||
//float axis_steps_per_unit[] = {104.987, 104.987, 4545.4544, 1487};
|
||||
//#define _AXIS_STEP_PER_UNIT {104.987, 104.987, 4545.4544, 1487}
|
||||
|
||||
|
||||
//// Endstop Settings
|
||||
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
|
||||
// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
|
||||
//If your axes are only moving in one direction, make sure the endstops are connected properly.
|
||||
//If your axes move in one direction ONLY when the endstops are triggered, set [XYZ]_ENDSTOP_INVERT to true here:
|
||||
const bool X_ENDSTOP_INVERT = false;
|
||||
const bool Y_ENDSTOP_INVERT = false;
|
||||
const bool Z_ENDSTOP_INVERT = false;
|
||||
const bool X_ENDSTOP_INVERT = true;
|
||||
const bool Y_ENDSTOP_INVERT = true;
|
||||
const bool Z_ENDSTOP_INVERT = true;
|
||||
|
||||
// This determines the communication speed of the printer
|
||||
#define BAUDRATE 115200
|
||||
//#define BAUDRATE 250000
|
||||
|
||||
// Comment out (using // at the start of the line) to disable SD support:
|
||||
#define SDSUPPORT
|
||||
// Uncomment to make Sprinter run init.g from SD on boot
|
||||
|
||||
// Uncomment to make run init.g from SD on boot
|
||||
//#define SDINITFILE
|
||||
|
||||
//Only work with Atmega1284 you need +1 kb ram
|
||||
//#define SD_FAST_XFER_AKTIV
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// STORE SETTINGS TO EEPROM
|
||||
//-----------------------------------------------------------------------
|
||||
// the microcontroller can store settings in the EEPROM
|
||||
// M500 - stores paramters in EEPROM
|
||||
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
||||
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
||||
// M503 - Print settings
|
||||
// define this to enable eeprom support
|
||||
#define USE_EEPROM_SETTINGS
|
||||
|
||||
// to disable EEPROM Serial responses and decrease program space by ~1000 byte: comment this out:
|
||||
// please keep turned on if you can.
|
||||
#define PRINT_EEPROM_SETTING
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// ARC Function (G2/G3 Command)
|
||||
//-----------------------------------------------------------------------
|
||||
//Uncomment to aktivate the arc (circle) function (G2/G3 Command)
|
||||
//Without SD function an ARC function the used Flash is smaller 31 kb
|
||||
#define USE_ARC_FUNCTION
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// ADVANCED SETTINGS - to tweak parameters
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
#include "thermistortables.h"
|
||||
#ifdef SDSUPPORT
|
||||
#ifdef SD_FAST_XFER_AKTIV
|
||||
//Fast transfer chunk size (> 1024 is unstable, change at your own risk).
|
||||
#define SD_FAST_XFER_CHUNK_SIZE 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
|
||||
//-----------------------------------------------------------------------
|
||||
#define X_ENABLE_ON 0
|
||||
#define Y_ENABLE_ON 0
|
||||
#define Z_ENABLE_ON 0
|
||||
#define E_ENABLE_ON 0
|
||||
|
||||
//Uncomment if you have problems with a stepper driver enabeling too late, this will also set how many microseconds delay there will be after enabeling the driver
|
||||
//#define DELAY_ENABLE 15
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Disables axis when it's not being used.
|
||||
//-----------------------------------------------------------------------
|
||||
const bool DISABLE_X = false;
|
||||
const bool DISABLE_Y = false;
|
||||
const bool DISABLE_Z = true;
|
||||
const bool DISABLE_E = false;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Inverting axis direction
|
||||
//-----------------------------------------------------------------------
|
||||
const bool INVERT_X_DIR = false;
|
||||
const bool INVERT_Y_DIR = false;
|
||||
const bool INVERT_Z_DIR = true;
|
||||
const bool INVERT_E_DIR = false;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// ENDSTOP SETTINGS:
|
||||
//-----------------------------------------------------------------------
|
||||
// Sets direction of endstops when homing; 1=MAX, -1=MIN
|
||||
#define X_HOME_DIR -1
|
||||
#define Y_HOME_DIR -1
|
||||
#define Z_HOME_DIR -1
|
||||
|
||||
const bool min_software_endstops = false; //If true, axis won't move to coordinates less than zero.
|
||||
const bool max_software_endstops = true; //If true, axis won't move to coordinates greater than the defined lengths below.
|
||||
const int X_MAX_LENGTH = 200;
|
||||
const int Y_MAX_LENGTH = 200;
|
||||
const int Z_MAX_LENGTH = 100;
|
||||
//#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
|
||||
|
||||
const bool min_software_endstops = false; //If true, axis won't move to coordinates less than zero.
|
||||
const bool max_software_endstops = true; //If true, axis won't move to coordinates greater than the defined lengths below.
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//Max Length for Prusa Mendel, check the ways of your axis and set this Values
|
||||
//-----------------------------------------------------------------------
|
||||
const int X_MAX_LENGTH = 130;
|
||||
const int Y_MAX_LENGTH = 110;
|
||||
const int Z_MAX_LENGTH = 90;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// MOVEMENT SETTINGS
|
||||
//-----------------------------------------------------------------------
|
||||
const int NUM_AXIS = 4; // The axis order in all axis related arrays is X, Y, Z, E
|
||||
float max_feedrate[] = {200000, 200000, 240, 500000};
|
||||
float homing_feedrate[] = {1500,1500,120};
|
||||
bool axis_relative_modes[] = {false, false, false, false};
|
||||
#define _MAX_FEEDRATE {400, 400, 2, 25} // (mm/sec)
|
||||
#define _HOMING_FEEDRATE {1500,1500,120} // (mm/min) !!
|
||||
#define _AXIS_RELATIVE_MODES {false, false, false, false}
|
||||
|
||||
#define MAX_STEP_FREQUENCY 30000 // Max step frequency
|
||||
|
||||
//For the retract (negative Extruder) move this maxiumum Limit of Feedrate is used
|
||||
//The next positive Extruder move use also this Limit,
|
||||
//then for the next (second after retract) move the original Maximum (_MAX_FEEDRATE) Limit is used
|
||||
#define MAX_RETRACT_FEEDRATE 100 //mm/sec
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// Not used at the Moment
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
// Min step delay in microseconds. If you are experiencing missing steps, try to raise the delay microseconds, but be aware this
|
||||
// If you enable this, make sure STEP_DELAY_RATIO is disabled.
|
||||
|
|
@ -101,51 +175,158 @@ bool axis_relative_modes[] = {false, false, false, false};
|
|||
// If you enable this, make sure STEP_DELAY_MICROS is disabled. (except for Gen6: both need to be enabled.)
|
||||
//#define STEP_DELAY_RATIO 0.25
|
||||
|
||||
// Comment this to disable ramp acceleration
|
||||
#define RAMP_ACCELERATION
|
||||
///Oscillation reduction. Forces x,y,or z axis to be stationary for ## ms before allowing axis to switch direcitons. Alternative method to prevent skipping steps. Uncomment the line below to activate.
|
||||
// At this Version with Planner this Function ist not used
|
||||
//#define RAPID_OSCILLATION_REDUCTION
|
||||
|
||||
//// Acceleration settings
|
||||
#ifdef RAMP_ACCELERATION
|
||||
// X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
|
||||
float max_start_speed_units_per_second[] = {25.0,25.0,0.2,10.0};
|
||||
long max_acceleration_units_per_sq_second[] = {1000,1000,50,10000}; // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts
|
||||
long max_travel_acceleration_units_per_sq_second[] = {500,500,50,500}; // X, Y, Z max acceleration in mm/s^2 for travel moves
|
||||
#ifdef RAPID_OSCILLATION_REDUCTION
|
||||
const long min_time_before_dir_change = 30; //milliseconds
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// Acceleration settings
|
||||
//-----------------------------------------------------------------------
|
||||
// X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
|
||||
#define _ACCELERATION 1000 // Axis Normal acceleration mm/s^2
|
||||
#define _RETRACT_ACCELERATION 2000 // Extruder Normal acceleration mm/s^2
|
||||
#define _MAX_XY_JERK 20.0
|
||||
#define _MAX_Z_JERK 0.4
|
||||
#define _MAX_E_JERK 5.0 // (mm/sec)
|
||||
//#define _MAX_START_SPEED_UNITS_PER_SECOND {25.0,25.0,0.2,10.0}
|
||||
#define _MAX_ACCELERATION_UNITS_PER_SQ_SECOND {5000,5000,50,5000} // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts
|
||||
|
||||
|
||||
// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
|
||||
// of the buffer and all stops. This should not be much greater than zero and should only be changed
|
||||
// if unwanted behavior is observed on a user's machine when running at very slow speeds.
|
||||
#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec)
|
||||
|
||||
#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
|
||||
#define DEFAULT_MINTRAVELFEEDRATE 0.0
|
||||
|
||||
#define _MIN_SEG_TIME 20000
|
||||
|
||||
// If defined the movements slow down when the look ahead buffer is only half full
|
||||
#define SLOWDOWN
|
||||
|
||||
|
||||
const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Machine UUID
|
||||
//-----------------------------------------------------------------------
|
||||
// This may be useful if you have multiple machines and wish to identify them by using the M115 command.
|
||||
// By default we set it to zeros.
|
||||
char uuid[] = "00000000-0000-0000-0000-000000000000";
|
||||
#define _DEF_CHAR_UUID "00000000-0000-0000-0000-000000000000"
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// Planner buffer Size
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
// The number of linear motions that can be in the plan at any give time
|
||||
// if the SD Card need to much memory reduce the Values for Plannerpuffer (base of 2)
|
||||
#ifdef SDSUPPORT
|
||||
#define BLOCK_BUFFER_SIZE 16
|
||||
#define BLOCK_BUFFER_MASK 0x0f
|
||||
#else
|
||||
#define BLOCK_BUFFER_SIZE 16
|
||||
#define BLOCK_BUFFER_MASK 0x0f
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// SETTINGS FOR ARC FUNCTION (Command G2/G2)
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
// Arc interpretation settings:
|
||||
//Step to split a cirrcle in small Lines
|
||||
#define MM_PER_ARC_SEGMENT 1
|
||||
//After this count of steps a new SIN / COS caluclation is startet to correct the circle interpolation
|
||||
#define N_ARC_CORRECTION 25
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// FANCONTROL WITH SOFT PWM
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
//With this option its possible to drive the fan with SOFT PWM (500hz) and use
|
||||
//every Digital output for it, main usage for Sanguinololu
|
||||
#define FAN_SOFT_PWM
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// MINIMUM START SPEED FOR FAN
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
//Minimum start speed for FAN when the last speed was zero
|
||||
//Set to 0 to deaktivate
|
||||
//If value is set the fan will drive with this minimum speed for MINIMUM_FAN_START_TIME
|
||||
#define MINIMUM_FAN_START_SPEED 0
|
||||
|
||||
//This is the time how long the minimum FAN speed is set
|
||||
#define MINIMUM_FAN_START_TIME 6000 //6sec
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
//// HEATERCONTROL AND PID PARAMETERS
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
//Testfunction to adjust the Hotend temperatur in case of Printingspeed
|
||||
//If the Printer print slow the Temp is going to AUTO_TEMP_MIN
|
||||
//At the moment this Value dont change the targettemp from the Hotend
|
||||
//The result of this function is only send with the Temperaturerequest to the host
|
||||
//#define AUTOTEMP
|
||||
#ifdef AUTOTEMP
|
||||
#define AUTO_TEMP_MAX 240
|
||||
#define AUTO_TEMP_MIN 205
|
||||
#define AUTO_TEMP_FACTOR 0.025
|
||||
#define AUTOTEMP_OLDWEIGHT 0.98
|
||||
#endif
|
||||
|
||||
//// AD595 THERMOCOUPLE SUPPORT UNTESTED... USE WITH CAUTION!!!!
|
||||
|
||||
//// PID settings:
|
||||
// Uncomment the following line to enable PID support. This is untested and could be disastrous. Be careful.
|
||||
//#define PIDTEMP 1
|
||||
#define PIDTEMP 1
|
||||
#ifdef PIDTEMP
|
||||
//Sanguinololu 1.2 and above, the PWM Output Hotend Timer 1 is used for the Hardware PWM
|
||||
//but in this Software use Timer1 for the Stepperfunction so it is not possible to use the "analogWrite" function.
|
||||
//This Soft PWM use Timer 2 with 400 Hz to drive the PWM for the hotend
|
||||
#define PID_SOFT_PWM
|
||||
|
||||
//Measure the MIN/MAX Value of the Hotend Temp and show it with
|
||||
//Command M601 / Command M602 Reset the MIN/MAX Value
|
||||
//#define DEBUG_HEATER_TEMP
|
||||
|
||||
// M303 - PID relay autotune S<temperature> sets the target temperature.
|
||||
// (default target temperature = 150C)
|
||||
#define PID_AUTOTUNE
|
||||
|
||||
//PID Controler Settings
|
||||
#define PID_INTEGRAL_DRIVE_MAX 80 // too big, and heater will lag after changing temperature, too small and it might not compensate enough for long-term errors
|
||||
#define PID_PGAIN 2560 //256 is 1.0 // value of X means that error of 1 degree is changing PWM duty by X, probably no need to go over 25
|
||||
#define PID_IGAIN 64 //256 is 1.0 // value of X (e.g 0.25) means that each degree error over 1 sec (2 measurements) changes duty cycle by 2X (=0.5) units (verify?)
|
||||
#define PID_DGAIN 4096 //256 is 1.0 // value of X means that around reached setpoint, each degree change over one measurement (half second) adjusts PWM by X units to compensate
|
||||
|
||||
// magic formula 1, to get approximate "zero error" PWM duty. Take few measurements with low PWM duty and make linear fit to get the formula
|
||||
#define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27) // for my makergear hot-end: linear fit {50,10},{60,20},{80,30},{105,50},{176,100},{128,64},{208,128}
|
||||
// for my makergear hot-end: linear fit {50,10},{60,20},{80,30},{105,50},{176,100},{128,64},{208,128}
|
||||
#define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27)
|
||||
// magic formula 2, to make led brightness approximately linear
|
||||
#define LED_PWM_FOR_BRIGHTNESS(brightness) ((64*brightness-1384)/(300-brightness))
|
||||
#endif
|
||||
|
||||
// Change this value (range 1-255) to limit the current to the nozzle
|
||||
// Change this value (range 30-255) to limit the current to the nozzle
|
||||
#define HEATER_CURRENT 255
|
||||
|
||||
// How often should the heater check for new temp readings, in milliseconds
|
||||
#define HEATER_CHECK_INTERVAL 500
|
||||
#define BED_CHECK_INTERVAL 5000
|
||||
|
||||
// Comment the following line to enable heat management during acceleration
|
||||
#define DISABLE_CHECK_DURING_ACC
|
||||
#ifndef DISABLE_CHECK_DURING_ACC
|
||||
// Uncomment the following line to disable heat management during moves
|
||||
//#define DISABLE_CHECK_DURING_MOVE
|
||||
#endif
|
||||
|
||||
// Uncomment the following line to disable heat management during travel moves (and extruder-only moves, eg: retracts), strongly recommended if you are missing steps mid print.
|
||||
// Probably this should remain commented if are using PID.
|
||||
// It also defines the max milliseconds interval after which a travel move is not considered so for the sake of this feature.
|
||||
|
|
@ -155,6 +336,7 @@ char uuid[] = "00000000-0000-0000-0000-000000000000";
|
|||
//#define SMOOTHING
|
||||
//#define SMOOTHFACTOR 16 //best to use a power of two here - determines how many values are averaged together by the smoothing algorithm
|
||||
|
||||
|
||||
//// Experimental watchdog and minimal temp
|
||||
// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
||||
// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
|
||||
|
|
@ -188,15 +370,29 @@ char uuid[] = "00000000-0000-0000-0000-000000000000";
|
|||
//#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
|
||||
#define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
|
||||
|
||||
//This is for controlling a fan that will keep the extruder cool.
|
||||
//#define EXTRUDERFAN_PIN 66 //Pin used to control the fan, comment out to disable this function
|
||||
#define EXTRUDERFAN_DEC 50 //Hotend temperature from where the fan will be turned on
|
||||
|
||||
//#define CHAIN_OF_COMMAND 1 //Finish buffered moves before executing M42, fan speed, heater target, and so...
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// DEBUGING
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
//Uncomment this to see on the host if a wrong or unknown Command is recived
|
||||
//Only for Testing !!!
|
||||
//#define SEND_WRONG_CMD_INFO
|
||||
|
||||
// Uncomment the following line to enable debugging. You can better control debugging below the following line
|
||||
//#define DEBUG
|
||||
#ifdef DEBUG
|
||||
//#define DEBUG_PREPARE_MOVE //Enable this to debug prepare_move() function
|
||||
//#define DEBUG_BRESENHAM //Enable this to debug the Bresenham algorithm
|
||||
//#define DEBUG_RAMP_ACCELERATION //Enable this to debug all constant acceleration info
|
||||
//#define DEBUG_MOVE_TIME //Enable this to time each move and print the result
|
||||
//#define DEBUG_MOVE_TIME //Enable this to time each move and print the result
|
||||
//#define DEBUG_HEAT_MGMT //Enable this to debug heat management. WARNING, this will cause axes to jitter!
|
||||
//#define DEBUG_DISABLE_CHECK_DURING_TRAVEL //Debug the namesake feature, see above in this file
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ $(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
|
|||
$(ARDUINO)/wiring_pulse.c \
|
||||
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
|
||||
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WMath.cpp $(ARDUINO)/WString.cpp\
|
||||
$(ARDUINO)/Print.cpp ./SdFile.cpp ./SdVolume.cpp ./Sd2Card.cpp
|
||||
$(ARDUINO)/Print.cpp ./SdFile.cpp ./SdVolume.cpp ./Sd2Card.cpp ./heater.cpp ./arc_func.cpp ./store_eeprom.cpp
|
||||
FORMAT = ihex
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
* along with the Arduino Sd2Card Library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include <Arduino.h>
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
#include "Sd2Card.h"
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef SOFTWARE_SPI
|
||||
|
|
|
|||
|
|
@ -283,7 +283,11 @@ class SdFile : public Print {
|
|||
}
|
||||
/** \return SdVolume that contains this file. */
|
||||
SdVolume* volume(void) const {return vol_;}
|
||||
#if ARDUINO >= 100
|
||||
size_t write(uint8_t b);
|
||||
#else
|
||||
void write(uint8_t b);
|
||||
#endif
|
||||
int16_t write(const void* buf, uint16_t nbyte);
|
||||
void write(const char* str);
|
||||
void write_P(PGM_P str);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@
|
|||
* \file
|
||||
* Useful utility functions.
|
||||
*/
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include <Arduino.h>
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
#include <avr/pgmspace.h>
|
||||
/** Store and print a string in flash memory.*/
|
||||
#define PgmPrint(x) SerialPrint_P(PSTR(x))
|
||||
|
|
@ -55,7 +59,7 @@ static int FreeRam(void) {
|
|||
* \param[in] str Pointer to string stored in flash memory.
|
||||
*/
|
||||
static NOINLINE void SerialPrint_P(PGM_P str) {
|
||||
for (uint8_t c; (c = pgm_read_byte(str)); str++) Serial.print(c);
|
||||
for (uint8_t c; (c = pgm_read_byte(str)); str++) Serial.print(char(c));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,7 +19,11 @@
|
|||
*/
|
||||
#include "SdFat.h"
|
||||
#include <avr/pgmspace.h>
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include <Arduino.h>
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
//------------------------------------------------------------------------------
|
||||
// callback function for date/time
|
||||
void (*SdFile::dateTime_)(uint16_t* date, uint16_t* time) = NULL;
|
||||
|
|
@ -213,7 +217,7 @@ void SdFile::ls(uint8_t flags, uint8_t indent) {
|
|||
if (!DIR_IS_FILE_OR_SUBDIR(p)) continue;
|
||||
|
||||
// print any indent spaces
|
||||
for (int8_t i = 0; i < indent; i++) Serial.print(' ');
|
||||
for (int8_t i = 0; i < indent; i++) Serial.print(char(' '));
|
||||
|
||||
// print file name with possible blank fill
|
||||
printDirName(*p, flags & (LS_DATE | LS_SIZE) ? 14 : 0);
|
||||
|
|
@ -221,12 +225,12 @@ void SdFile::ls(uint8_t flags, uint8_t indent) {
|
|||
// print modify date/time if requested
|
||||
if (flags & LS_DATE) {
|
||||
printFatDate(p->lastWriteDate);
|
||||
Serial.print(' ');
|
||||
Serial.print(char(' '));
|
||||
printFatTime(p->lastWriteTime);
|
||||
}
|
||||
// print size if requested
|
||||
if (!DIR_IS_SUBDIR(p) && (flags & LS_SIZE)) {
|
||||
Serial.print(' ');
|
||||
Serial.print(char(' '));
|
||||
Serial.print(p->fileSize);
|
||||
}
|
||||
Serial.println();
|
||||
|
|
@ -587,18 +591,18 @@ void SdFile::printDirName(const dir_t& dir, uint8_t width) {
|
|||
for (uint8_t i = 0; i < 11; i++) {
|
||||
if (dir.name[i] == ' ')continue;
|
||||
if (i == 8) {
|
||||
Serial.print('.');
|
||||
Serial.print(char('.'));
|
||||
w++;
|
||||
}
|
||||
Serial.print(dir.name[i]);
|
||||
Serial.print(char(dir.name[i]));
|
||||
w++;
|
||||
}
|
||||
if (DIR_IS_SUBDIR(&dir)) {
|
||||
Serial.print('/');
|
||||
Serial.print(char('/'));
|
||||
w++;
|
||||
}
|
||||
while (w < width) {
|
||||
Serial.print(' ');
|
||||
Serial.print(char(' '));
|
||||
w++;
|
||||
}
|
||||
}
|
||||
|
|
@ -611,9 +615,9 @@ void SdFile::printDirName(const dir_t& dir, uint8_t width) {
|
|||
*/
|
||||
void SdFile::printFatDate(uint16_t fatDate) {
|
||||
Serial.print(FAT_YEAR(fatDate));
|
||||
Serial.print('-');
|
||||
Serial.print(char('-'));
|
||||
printTwoDigits(FAT_MONTH(fatDate));
|
||||
Serial.print('-');
|
||||
Serial.print(char('-'));
|
||||
printTwoDigits(FAT_DAY(fatDate));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -625,9 +629,9 @@ void SdFile::printFatDate(uint16_t fatDate) {
|
|||
*/
|
||||
void SdFile::printFatTime(uint16_t fatTime) {
|
||||
printTwoDigits(FAT_HOUR(fatTime));
|
||||
Serial.print(':');
|
||||
Serial.print(char(':'));
|
||||
printTwoDigits(FAT_MINUTE(fatTime));
|
||||
Serial.print(':');
|
||||
Serial.print(char(':'));
|
||||
printTwoDigits(FAT_SECOND(fatTime));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -1219,8 +1223,17 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) {
|
|||
*
|
||||
* Use SdFile::writeError to check for errors.
|
||||
*/
|
||||
void SdFile::write(uint8_t b) {
|
||||
#if ARDUINO >= 100
|
||||
size_t SdFile::write(uint8_t b)
|
||||
#else
|
||||
void SdFile::write(uint8_t b)
|
||||
#endif
|
||||
{
|
||||
#if ARDUINO >= 100
|
||||
return (size_t) write(&b, 1);
|
||||
#else
|
||||
write(&b, 1);
|
||||
#endif
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,53 +1,18 @@
|
|||
// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
|
||||
// Licence: GPL
|
||||
#include <WProgram.h>
|
||||
|
||||
//Check Version of Arduino and then include the right libraries
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
|
||||
#include "fastio.h"
|
||||
|
||||
extern "C" void __cxa_pure_virtual();
|
||||
void __cxa_pure_virtual(){};
|
||||
void get_command();
|
||||
void process_commands();
|
||||
|
||||
void manage_inactivity(byte debug);
|
||||
void setup_acceleration();
|
||||
|
||||
void manage_heater();
|
||||
|
||||
#if defined HEATER_USES_THERMISTOR
|
||||
#define temp2analogh( c ) temp2analog_thermistor(c,temptable,NUMTEMPS)
|
||||
#define analog2temp( c ) analog2temp_thermistor(c,temptable,NUMTEMPS)
|
||||
#elif defined HEATER_USES_AD595
|
||||
#define temp2analogh( c ) temp2analog_ad595(c)
|
||||
#define analog2temp( c ) analog2temp_ad595(c)
|
||||
#elif defined HEATER_USES_MAX6675
|
||||
#define temp2analogh( c ) temp2analog_max6675(c)
|
||||
#define analog2temp( c ) analog2temp_max6675(c)
|
||||
#endif
|
||||
|
||||
#if defined BED_USES_THERMISTOR
|
||||
#define temp2analogBed( c ) temp2analog_thermistor((c),bedtemptable,BNUMTEMPS)
|
||||
#define analog2tempBed( c ) analog2temp_thermistor((c),bedtemptable,BNUMTEMPS)
|
||||
#elif defined BED_USES_AD595
|
||||
#define temp2analogBed( c ) temp2analog_ad595(c)
|
||||
#define analog2tempBed( c ) analog2temp_ad595(c)
|
||||
#elif defined BED_USES_MAX6675
|
||||
#define temp2analogBed( c ) temp2analog_max6675(c)
|
||||
#define analog2tempBed( c ) analog2temp_max6675(c)
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_THERMISTOR) || defined (BED_USES_THERMISTOR)
|
||||
int temp2analog_thermistor(int celsius, const short table[][2], int numtemps);
|
||||
int analog2temp_thermistor(int raw,const short table[][2], int numtemps);
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_AD595) || defined (BED_USES_AD595)
|
||||
int temp2analog_ad595(int celsius);
|
||||
int analog2temp_ad595(int raw);
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_MAX6675) || defined (BED_USES_MAX6675)
|
||||
int temp2analog_max6675(int celsius);
|
||||
int analog2temp_max6675(int raw);
|
||||
#endif
|
||||
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||
|
||||
#if X_ENABLE_PIN > -1
|
||||
#define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
|
||||
|
|
@ -78,12 +43,96 @@ int analog2temp_max6675(int raw);
|
|||
#define disable_e() ;
|
||||
#endif
|
||||
|
||||
#define X_AXIS 0
|
||||
#define Y_AXIS 1
|
||||
#define Z_AXIS 2
|
||||
#define E_AXIS 3
|
||||
|
||||
|
||||
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
|
||||
// the source g-code and may never actually be reached if acceleration management is active.
|
||||
typedef struct {
|
||||
// Fields used by the bresenham algorithm for tracing the line
|
||||
long steps_x, steps_y, steps_z, steps_e; // Step count along each axis
|
||||
|
||||
unsigned long step_event_count; // The number of step events required to complete this block
|
||||
long accelerate_until; // The index of the step event on which to stop acceleration
|
||||
long decelerate_after; // The index of the step event on which to start decelerating
|
||||
long acceleration_rate; // The acceleration rate used for acceleration calculation
|
||||
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
|
||||
|
||||
#ifdef ADVANCE
|
||||
long advance_rate;
|
||||
volatile long initial_advance;
|
||||
volatile long final_advance;
|
||||
float advance;
|
||||
#endif
|
||||
|
||||
// Fields used by the motion planner to manage acceleration
|
||||
// float speed_x, speed_y, speed_z, speed_e; // Nominal mm/minute for each axis
|
||||
float nominal_speed; // The nominal speed for this block in mm/min
|
||||
float entry_speed; // Entry speed at previous-current junction in mm/min
|
||||
float max_entry_speed; // Maximum allowable junction entry speed in mm/min
|
||||
float millimeters; // The total travel of this block in mm
|
||||
float acceleration; // acceleration mm/sec^2
|
||||
unsigned char recalculate_flag; // Planner flag to recalculate trapezoids on entry junction
|
||||
unsigned char nominal_length_flag; // Planner flag for nominal speed always reached
|
||||
|
||||
|
||||
// Settings for the trapezoid generator
|
||||
long nominal_rate; // The nominal step rate for this block in step_events/sec
|
||||
long initial_rate; // The jerk-adjusted step rate at start of block
|
||||
long final_rate; // The minimal rate at exit
|
||||
long acceleration_st; // acceleration steps/sec^2
|
||||
volatile char busy;
|
||||
} block_t;
|
||||
|
||||
|
||||
void FlushSerialRequestResend();
|
||||
void ClearToSend();
|
||||
|
||||
void analogWrite_check(uint8_t check_pin, int val);
|
||||
void showString (PGM_P s);
|
||||
|
||||
void manage_inactivity(byte debug);
|
||||
|
||||
void get_command();
|
||||
void get_coordinates();
|
||||
void prepare_move();
|
||||
void linear_move(unsigned long steps_remaining[]);
|
||||
void do_step(int axis);
|
||||
void prepare_arc_move(char isclockwise);
|
||||
FORCE_INLINE void process_commands();
|
||||
#ifdef USE_ARC_FUNCTION
|
||||
FORCE_INLINE void get_arc_coordinates();
|
||||
#endif
|
||||
|
||||
void kill(byte debug);
|
||||
|
||||
void check_axes_activity();
|
||||
void plan_init();
|
||||
void st_init();
|
||||
void tp_init();
|
||||
void plan_buffer_line(float x, float y, float z, float e, float feed_rate);
|
||||
void plan_set_position(float x, float y, float z, float e);
|
||||
void st_wake_up();
|
||||
void st_synchronize();
|
||||
void st_set_position(const long &x, const long &y, const long &z, const long &e);
|
||||
|
||||
void check_buffer_while_arc();
|
||||
|
||||
#ifdef SDSUPPORT
|
||||
void print_disk_info(void);
|
||||
#endif //SDSUPPORT
|
||||
|
||||
#if (MINIMUM_FAN_START_SPEED > 0)
|
||||
void manage_fan_start_speed(void);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void log_message(char* message);
|
||||
void log_bool(char* message, bool value);
|
||||
void log_int(char* message, int value);
|
||||
void log_long(char* message, long value);
|
||||
void log_float(char* message, float value);
|
||||
void log_uint(char* message, unsigned int value);
|
||||
void log_ulong(char* message, unsigned long value);
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
149
Sprinter/arc_func.cpp
Normal file
149
Sprinter/arc_func.cpp
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
arc_func.c - high level interface for issuing motion commands
|
||||
Part of Grbl
|
||||
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
Copyright (c) 2011 Sungeun K. Jeon
|
||||
|
||||
Grbl 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Grbl 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 Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "Configuration.h"
|
||||
#include "Sprinter.h"
|
||||
|
||||
#ifdef USE_ARC_FUNCTION
|
||||
// The arc is approximated by generating a huge number of tiny, linear segments. The length of each
|
||||
// segment is configured in settings.mm_per_arc_segment.
|
||||
void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8_t axis_1,
|
||||
uint8_t axis_linear, float feed_rate, float radius, uint8_t isclockwise)
|
||||
{
|
||||
// int acceleration_manager_was_enabled = plan_is_acceleration_manager_enabled();
|
||||
// plan_set_acceleration_manager_enabled(false); // disable acceleration management for the duration of the arc
|
||||
float center_axis0 = position[axis_0] + offset[axis_0];
|
||||
float center_axis1 = position[axis_1] + offset[axis_1];
|
||||
float linear_travel = target[axis_linear] - position[axis_linear];
|
||||
float extruder_travel = target[E_AXIS] - position[E_AXIS];
|
||||
float r_axis0 = -offset[axis_0]; // Radius vector from center to current location
|
||||
float r_axis1 = -offset[axis_1];
|
||||
float rt_axis0 = target[axis_0] - center_axis0;
|
||||
float rt_axis1 = target[axis_1] - center_axis1;
|
||||
|
||||
// CCW angle between position and target from circle center. Only one atan2() trig computation required.
|
||||
float angular_travel = atan2(r_axis0*rt_axis1-r_axis1*rt_axis0, r_axis0*rt_axis0+r_axis1*rt_axis1);
|
||||
if (angular_travel < 0) { angular_travel += 2*M_PI; }
|
||||
if (isclockwise) { angular_travel -= 2*M_PI; }
|
||||
|
||||
float millimeters_of_travel = hypot(angular_travel*radius, fabs(linear_travel));
|
||||
if (millimeters_of_travel < 0.001) { return; }
|
||||
uint16_t segments = floor(millimeters_of_travel/MM_PER_ARC_SEGMENT);
|
||||
if(segments == 0) segments = 1;
|
||||
|
||||
/*
|
||||
// Multiply inverse feed_rate to compensate for the fact that this movement is approximated
|
||||
// by a number of discrete segments. The inverse feed_rate should be correct for the sum of
|
||||
// all segments.
|
||||
if (invert_feed_rate) { feed_rate *= segments; }
|
||||
*/
|
||||
float theta_per_segment = angular_travel/segments;
|
||||
float linear_per_segment = linear_travel/segments;
|
||||
float extruder_per_segment = extruder_travel/segments;
|
||||
|
||||
/* Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector,
|
||||
and phi is the angle of rotation. Based on the solution approach by Jens Geisler.
|
||||
r_T = [cos(phi) -sin(phi);
|
||||
sin(phi) cos(phi] * r ;
|
||||
|
||||
For arc generation, the center of the circle is the axis of rotation and the radius vector is
|
||||
defined from the circle center to the initial position. Each line segment is formed by successive
|
||||
vector rotations. This requires only two cos() and sin() computations to form the rotation
|
||||
matrix for the duration of the entire arc. Error may accumulate from numerical round-off, since
|
||||
all double numbers are single precision on the Arduino. (True double precision will not have
|
||||
round off issues for CNC applications.) Single precision error can accumulate to be greater than
|
||||
tool precision in some cases. Therefore, arc path correction is implemented.
|
||||
|
||||
Small angle approximation may be used to reduce computation overhead further. This approximation
|
||||
holds for everything, but very small circles and large mm_per_arc_segment values. In other words,
|
||||
theta_per_segment would need to be greater than 0.1 rad and N_ARC_CORRECTION would need to be large
|
||||
to cause an appreciable drift error. N_ARC_CORRECTION~=25 is more than small enough to correct for
|
||||
numerical drift error. N_ARC_CORRECTION may be on the order a hundred(s) before error becomes an
|
||||
issue for CNC machines with the single precision Arduino calculations.
|
||||
|
||||
This approximation also allows mc_arc to immediately insert a line segment into the planner
|
||||
without the initial overhead of computing cos() or sin(). By the time the arc needs to be applied
|
||||
a correction, the planner should have caught up to the lag caused by the initial mc_arc overhead.
|
||||
This is important when there are successive arc motions.
|
||||
*/
|
||||
// Vector rotation matrix values
|
||||
float cos_T = 1-0.5*theta_per_segment*theta_per_segment; // Small angle approximation
|
||||
float sin_T = theta_per_segment;
|
||||
|
||||
float arc_target[4];
|
||||
float sin_Ti;
|
||||
float cos_Ti;
|
||||
float r_axisi;
|
||||
uint16_t i;
|
||||
int8_t count = 0;
|
||||
|
||||
// Initialize the linear axis
|
||||
arc_target[axis_linear] = position[axis_linear];
|
||||
|
||||
// Initialize the extruder axis
|
||||
arc_target[E_AXIS] = position[E_AXIS];
|
||||
|
||||
for (i = 1; i<segments; i++)
|
||||
{ // Increment (segments-1)
|
||||
|
||||
if((count == 10) || (count == 15))
|
||||
{
|
||||
//Read the next two Commands while arc is calculating
|
||||
check_buffer_while_arc();
|
||||
}
|
||||
|
||||
if (count < N_ARC_CORRECTION) //25 pieces
|
||||
{
|
||||
// Apply vector rotation matrix
|
||||
r_axisi = r_axis0*sin_T + r_axis1*cos_T;
|
||||
r_axis0 = r_axis0*cos_T - r_axis1*sin_T;
|
||||
r_axis1 = r_axisi;
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Arc correction to radius vector. Computed only every N_ARC_CORRECTION increments.
|
||||
// Compute exact location by applying transformation matrix from initial radius vector(=-offset).
|
||||
cos_Ti = cos(i*theta_per_segment);
|
||||
sin_Ti = sin(i*theta_per_segment);
|
||||
r_axis0 = -offset[axis_0]*cos_Ti + offset[axis_1]*sin_Ti;
|
||||
r_axis1 = -offset[axis_0]*sin_Ti - offset[axis_1]*cos_Ti;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
// Update arc_target location
|
||||
arc_target[axis_0] = center_axis0 + r_axis0;
|
||||
arc_target[axis_1] = center_axis1 + r_axis1;
|
||||
arc_target[axis_linear] += linear_per_segment;
|
||||
arc_target[E_AXIS] += extruder_per_segment;
|
||||
|
||||
plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate);
|
||||
|
||||
}
|
||||
// Ensure last segment arrives at target location.
|
||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate);
|
||||
|
||||
// plan_set_acceleration_manager_enabled(acceleration_manager_was_enabled);
|
||||
}
|
||||
#endif
|
||||
32
Sprinter/arc_func.h
Normal file
32
Sprinter/arc_func.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
arc_func.h - high level interface for issuing motion commands
|
||||
Part of Grbl
|
||||
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
Copyright (c) 2011 Sungeun K. Jeon
|
||||
|
||||
Grbl 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Grbl 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 Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef arc_func_h
|
||||
#define arc_func_h
|
||||
|
||||
// Execute an arc in offset mode format. position == current xyz, target == target xyz,
|
||||
// offset == offset from current xyz, axis_XXX defines circle plane in tool space, axis_linear is
|
||||
// the direction of helical travel, radius == circle radius, isclockwise boolean. Used
|
||||
// for vector transformation direction.
|
||||
void mc_arc(float *position, float *target, float *offset, unsigned char axis_0, unsigned char axis_1,
|
||||
unsigned char axis_linear, float feed_rate, float radius, unsigned char isclockwise);
|
||||
|
||||
#endif
|
||||
896
Sprinter/heater.cpp
Normal file
896
Sprinter/heater.cpp
Normal file
|
|
@ -0,0 +1,896 @@
|
|||
/*
|
||||
Reprap heater funtions based on Sprinter
|
||||
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
This softwarepart for Heatercontrol is based on Sprinter
|
||||
big thanks to kliment (https://github.com/kliment/Sprinter)
|
||||
*/
|
||||
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "heater.h"
|
||||
#include "fastio.h"
|
||||
#include "pins.h"
|
||||
#include "Sprinter.h"
|
||||
|
||||
#ifdef CONTROLLERFAN_PIN
|
||||
void controllerFan(void);
|
||||
#endif
|
||||
|
||||
#ifdef EXTRUDERFAN_PIN
|
||||
void extruderFan(void);
|
||||
#endif
|
||||
|
||||
// Manage heater variables. For a thermistor or AD595 thermocouple, raw values refer to the
|
||||
// reading from the analog pin. For a MAX6675 thermocouple, the raw value is the temperature in 0.25
|
||||
// degree increments (i.e. 100=25 deg).
|
||||
|
||||
int target_raw = 0;
|
||||
int target_temp = 0;
|
||||
int current_raw = 0;
|
||||
int current_raw_maxval = -32000;
|
||||
int current_raw_minval = 32000;
|
||||
int tt_maxval;
|
||||
int tt_minval;
|
||||
int target_bed_raw = 0;
|
||||
int current_bed_raw = 0;
|
||||
unsigned long previous_millis_heater, previous_millis_bed_heater, previous_millis_monitor;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
volatile unsigned char g_heater_pwm_val = 0;
|
||||
|
||||
//unsigned char PWM_off_time = 0;
|
||||
//unsigned char PWM_out_on = 0;
|
||||
|
||||
int temp_iState = 0;
|
||||
int temp_dState = 0;
|
||||
int prev_temp = 0;
|
||||
int pTerm;
|
||||
int iTerm;
|
||||
int dTerm;
|
||||
//int output;
|
||||
int error;
|
||||
int heater_duty = 0;
|
||||
int temp_iState_min = 256L * -PID_INTEGRAL_DRIVE_MAX / PID_IGAIN;
|
||||
int temp_iState_max = 256L * PID_INTEGRAL_DRIVE_MAX / PID_IGAIN;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FAN_SOFT_PWM) && (FAN_PIN > -1)
|
||||
volatile unsigned char g_fan_pwm_val = 0;
|
||||
#endif
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
float autotemp_max=AUTO_TEMP_MAX;
|
||||
float autotemp_min=AUTO_TEMP_MIN;
|
||||
float autotemp_factor=AUTO_TEMP_FACTOR;
|
||||
int autotemp_setpoint=0;
|
||||
bool autotemp_enabled=true;
|
||||
#endif
|
||||
|
||||
#ifndef HEATER_CURRENT
|
||||
#define HEATER_CURRENT 255
|
||||
#endif
|
||||
|
||||
#ifdef SMOOTHING
|
||||
uint32_t nma = 0;
|
||||
#endif
|
||||
|
||||
#ifdef WATCHPERIOD
|
||||
int watch_raw = -1000;
|
||||
unsigned long watchmillis = 0;
|
||||
#endif
|
||||
|
||||
#ifdef MINTEMP
|
||||
int minttemp = temp2analogh(MINTEMP);
|
||||
#endif
|
||||
|
||||
#ifdef MAXTEMP
|
||||
int maxttemp = temp2analogh(MAXTEMP);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define HEAT_INTERVAL 250
|
||||
#ifdef HEATER_USES_MAX6675
|
||||
unsigned long max6675_previous_millis = 0;
|
||||
int max6675_temp = 2000;
|
||||
|
||||
int read_max6675()
|
||||
{
|
||||
if (millis() - max6675_previous_millis < HEAT_INTERVAL)
|
||||
return max6675_temp;
|
||||
|
||||
max6675_previous_millis = millis();
|
||||
|
||||
max6675_temp = 0;
|
||||
|
||||
#ifdef PRR
|
||||
PRR &= ~(1<<PRSPI);
|
||||
#elif defined PRR0
|
||||
PRR0 &= ~(1<<PRSPI);
|
||||
#endif
|
||||
|
||||
SPCR = (1<<MSTR) | (1<<SPE) | (1<<SPR0);
|
||||
|
||||
// enable TT_MAX6675
|
||||
WRITE(MAX6675_SS, 0);
|
||||
|
||||
// ensure 100ns delay - a bit extra is fine
|
||||
delay(1);
|
||||
|
||||
// read MSB
|
||||
SPDR = 0;
|
||||
for (;(SPSR & (1<<SPIF)) == 0;);
|
||||
max6675_temp = SPDR;
|
||||
max6675_temp <<= 8;
|
||||
|
||||
// read LSB
|
||||
SPDR = 0;
|
||||
for (;(SPSR & (1<<SPIF)) == 0;);
|
||||
max6675_temp |= SPDR;
|
||||
|
||||
// disable TT_MAX6675
|
||||
WRITE(MAX6675_SS, 1);
|
||||
|
||||
if (max6675_temp & 4)
|
||||
{
|
||||
// thermocouple open
|
||||
max6675_temp = 2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
max6675_temp = max6675_temp >> 3;
|
||||
}
|
||||
|
||||
return max6675_temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Soft PWM for Heater and FAN
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#if defined(PID_SOFT_PWM) || (defined(FAN_SOFT_PWM) && (FAN_PIN > -1))
|
||||
void init_Timer2_softpwm(void)
|
||||
{
|
||||
// This is a simple SOFT PWM with 500 Hz for Extruder Heating
|
||||
|
||||
TIFR2 = (1 << TOV2); // clear interrupt flag
|
||||
TCCR2B = (1 << CS22) | (1 << CS20); // start timer (ck/128 prescalar)
|
||||
TCCR2A = 0;//(1 << WGM21); // Normal mode
|
||||
|
||||
TIMSK2 |= (1 << TOIE2);
|
||||
|
||||
#ifdef PID_SOFT_PWM
|
||||
OCR2A = 128; // We want to have at least 500Hz or else it gets choppy
|
||||
TIMSK2 |= (1 << OCIE2A); // enable timer2 output compare match interrupt
|
||||
#endif
|
||||
|
||||
#if defined(FAN_SOFT_PWM) && (FAN_PIN > -1)
|
||||
OCR2B = 128; // We want to have at least 500Hz or else it gets choppy
|
||||
TIMSK2 |= (1 << OCIE2B); // enable timer2 output compare match interrupt
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PID_SOFT_PWM) || (defined(FAN_SOFT_PWM) && (FAN_PIN > -1))
|
||||
ISR(TIMER2_OVF_vect)
|
||||
{
|
||||
|
||||
//--------------------------------------
|
||||
// Soft PWM, Heater, start PWM cycle
|
||||
//--------------------------------------
|
||||
#ifdef PID_SOFT_PWM
|
||||
if(g_heater_pwm_val >= 2)
|
||||
{
|
||||
#if LED_PIN > -1
|
||||
WRITE(LED_PIN,HIGH);
|
||||
#endif
|
||||
WRITE(HEATER_0_PIN,HIGH);
|
||||
|
||||
if(g_heater_pwm_val <= 253)
|
||||
OCR2A = g_heater_pwm_val;
|
||||
else
|
||||
OCR2A = 192;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LED_PIN > -1
|
||||
WRITE(LED_PIN,LOW);
|
||||
#endif
|
||||
WRITE(HEATER_0_PIN,LOW);
|
||||
OCR2A = 192;
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------
|
||||
// Soft PWM, Fan, start PWM cycle
|
||||
//--------------------------------------
|
||||
#if defined(FAN_SOFT_PWM) && (FAN_PIN > -1)
|
||||
if(g_fan_pwm_val >= 2)
|
||||
{
|
||||
#if (FAN_PIN > -1)
|
||||
WRITE(FAN_PIN,HIGH);
|
||||
#endif
|
||||
|
||||
if(g_fan_pwm_val <= 253)
|
||||
OCR2B = g_fan_pwm_val;
|
||||
else
|
||||
OCR2B = 128;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (FAN_PIN > -1)
|
||||
WRITE(FAN_PIN,LOW);
|
||||
#endif
|
||||
|
||||
OCR2B = 128;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PID_SOFT_PWM
|
||||
ISR(TIMER2_COMPA_vect)
|
||||
{
|
||||
|
||||
|
||||
if(g_heater_pwm_val > 253)
|
||||
{
|
||||
#if LED_PIN > -1
|
||||
WRITE(LED_PIN,HIGH);
|
||||
#endif
|
||||
WRITE(HEATER_0_PIN,HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LED_PIN > -1
|
||||
WRITE(LED_PIN,LOW);
|
||||
#endif
|
||||
WRITE(HEATER_0_PIN,LOW);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FAN_SOFT_PWM) && (FAN_PIN > -1)
|
||||
ISR(TIMER2_COMPB_vect)
|
||||
{
|
||||
|
||||
|
||||
if(g_fan_pwm_val > 253)
|
||||
{
|
||||
#if (FAN_PIN > -1)
|
||||
WRITE(FAN_PIN,HIGH);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (FAN_PIN > -1)
|
||||
WRITE(FAN_PIN,LOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
//--------------------END SOFT PWM---------------------------
|
||||
|
||||
//-------------------- START PID AUTOTUNE ---------------------------
|
||||
// Based on PID relay test
|
||||
// Thanks to Erik van der Zalm for this idea to use it for Marlin
|
||||
// Some information see:
|
||||
// http://brettbeauregard.com/blog/2012/01/arduino-pid-autotune-library/
|
||||
//------------------------------------------------------------------
|
||||
#ifdef PID_AUTOTUNE
|
||||
void PID_autotune(int PIDAT_test_temp)
|
||||
{
|
||||
float PIDAT_input = 0;
|
||||
int PIDAT_input_help = 0;
|
||||
unsigned char PIDAT_count_input = 0;
|
||||
|
||||
float PIDAT_max, PIDAT_min;
|
||||
|
||||
unsigned char PIDAT_PWM_val = HEATER_CURRENT;
|
||||
|
||||
unsigned char PIDAT_cycles=0;
|
||||
bool PIDAT_heating = true;
|
||||
|
||||
unsigned long PIDAT_temp_millis = millis();
|
||||
unsigned long PIDAT_t1=PIDAT_temp_millis;
|
||||
unsigned long PIDAT_t2=PIDAT_temp_millis;
|
||||
unsigned long PIDAT_T_check_AI_val = PIDAT_temp_millis;
|
||||
|
||||
unsigned char PIDAT_cycle_cnt = 0;
|
||||
|
||||
long PIDAT_t_high;
|
||||
long PIDAT_t_low;
|
||||
|
||||
long PIDAT_bias= HEATER_CURRENT/2;
|
||||
long PIDAT_d = HEATER_CURRENT/2;
|
||||
|
||||
float PIDAT_Ku, PIDAT_Tu;
|
||||
float PIDAT_Kp, PIDAT_Ki, PIDAT_Kd;
|
||||
|
||||
#define PIDAT_TIME_FACTOR ((HEATER_CHECK_INTERVAL*256.0) / 1000.0)
|
||||
|
||||
showString(PSTR("PID Autotune start\r\n"));
|
||||
|
||||
target_temp = PIDAT_test_temp;
|
||||
|
||||
#ifdef BED_USES_THERMISTOR
|
||||
WRITE(HEATER_1_PIN,LOW);
|
||||
#endif
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
||||
if((millis() - PIDAT_T_check_AI_val) > 100 )
|
||||
{
|
||||
PIDAT_T_check_AI_val = millis();
|
||||
PIDAT_cycle_cnt++;
|
||||
|
||||
#ifdef HEATER_USES_THERMISTOR
|
||||
current_raw = analogRead(TEMP_0_PIN);
|
||||
current_raw = 1023 - current_raw;
|
||||
PIDAT_input_help += analog2temp(current_raw);
|
||||
PIDAT_count_input++;
|
||||
#elif defined HEATER_USES_AD595
|
||||
current_raw = analogRead(TEMP_0_PIN);
|
||||
PIDAT_input_help += analog2temp(current_raw);
|
||||
PIDAT_count_input++;
|
||||
#elif defined HEATER_USES_MAX6675
|
||||
current_raw = read_max6675();
|
||||
PIDAT_input_help += analog2temp(current_raw);
|
||||
PIDAT_count_input++;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(PIDAT_cycle_cnt >= 10 )
|
||||
{
|
||||
|
||||
PIDAT_cycle_cnt = 0;
|
||||
|
||||
PIDAT_input = (float)PIDAT_input_help / (float)PIDAT_count_input;
|
||||
PIDAT_input_help = 0;
|
||||
PIDAT_count_input = 0;
|
||||
|
||||
PIDAT_max=max(PIDAT_max,PIDAT_input);
|
||||
PIDAT_min=min(PIDAT_min,PIDAT_input);
|
||||
|
||||
if(PIDAT_heating == true && PIDAT_input > PIDAT_test_temp)
|
||||
{
|
||||
if(millis() - PIDAT_t2 > 5000)
|
||||
{
|
||||
PIDAT_heating = false;
|
||||
PIDAT_PWM_val = (PIDAT_bias - PIDAT_d);
|
||||
PIDAT_t1 = millis();
|
||||
PIDAT_t_high = PIDAT_t1 - PIDAT_t2;
|
||||
PIDAT_max = PIDAT_test_temp;
|
||||
}
|
||||
}
|
||||
|
||||
if(PIDAT_heating == false && PIDAT_input < PIDAT_test_temp)
|
||||
{
|
||||
if(millis() - PIDAT_t1 > 5000)
|
||||
{
|
||||
PIDAT_heating = true;
|
||||
PIDAT_t2 = millis();
|
||||
PIDAT_t_low = PIDAT_t2 - PIDAT_t1;
|
||||
|
||||
if(PIDAT_cycles > 0)
|
||||
{
|
||||
PIDAT_bias += (PIDAT_d*(PIDAT_t_high - PIDAT_t_low))/(PIDAT_t_low + PIDAT_t_high);
|
||||
PIDAT_bias = constrain(PIDAT_bias, 20 ,HEATER_CURRENT - 20);
|
||||
if(PIDAT_bias > (HEATER_CURRENT/2)) PIDAT_d = (HEATER_CURRENT - 1) - PIDAT_bias;
|
||||
else PIDAT_d = PIDAT_bias;
|
||||
|
||||
showString(PSTR(" bias: ")); Serial.print(PIDAT_bias);
|
||||
showString(PSTR(" d: ")); Serial.print(PIDAT_d);
|
||||
showString(PSTR(" min: ")); Serial.print(PIDAT_min);
|
||||
showString(PSTR(" max: ")); Serial.println(PIDAT_max);
|
||||
|
||||
if(PIDAT_cycles > 2)
|
||||
{
|
||||
PIDAT_Ku = (4.0*PIDAT_d)/(3.14159*(PIDAT_max-PIDAT_min));
|
||||
PIDAT_Tu = ((float)(PIDAT_t_low + PIDAT_t_high)/1000.0);
|
||||
|
||||
showString(PSTR(" Ku: ")); Serial.print(PIDAT_Ku);
|
||||
showString(PSTR(" Tu: ")); Serial.println(PIDAT_Tu);
|
||||
|
||||
PIDAT_Kp = 0.60*PIDAT_Ku;
|
||||
PIDAT_Ki = 2*PIDAT_Kp/PIDAT_Tu;
|
||||
PIDAT_Kd = PIDAT_Kp*PIDAT_Tu/8;
|
||||
showString(PSTR(" Clasic PID \r\n"));
|
||||
//showString(PSTR(" Kp: ")); Serial.println(PIDAT_Kp);
|
||||
//showString(PSTR(" Ki: ")); Serial.println(PIDAT_Ki);
|
||||
//showString(PSTR(" Kd: ")); Serial.println(PIDAT_Kd);
|
||||
showString(PSTR(" CFG Kp: ")); Serial.println((unsigned int)(PIDAT_Kp*256));
|
||||
showString(PSTR(" CFG Ki: ")); Serial.println((unsigned int)(PIDAT_Ki*PIDAT_TIME_FACTOR));
|
||||
showString(PSTR(" CFG Kd: ")); Serial.println((unsigned int)(PIDAT_Kd*PIDAT_TIME_FACTOR));
|
||||
|
||||
PIDAT_Kp = 0.30*PIDAT_Ku;
|
||||
PIDAT_Ki = PIDAT_Kp/PIDAT_Tu;
|
||||
PIDAT_Kd = PIDAT_Kp*PIDAT_Tu/3;
|
||||
showString(PSTR(" Some overshoot \r\n"));
|
||||
showString(PSTR(" CFG Kp: ")); Serial.println((unsigned int)(PIDAT_Kp*256));
|
||||
showString(PSTR(" CFG Ki: ")); Serial.println((unsigned int)(PIDAT_Ki*PIDAT_TIME_FACTOR));
|
||||
showString(PSTR(" CFG Kd: ")); Serial.println((unsigned int)(PIDAT_Kd*PIDAT_TIME_FACTOR));
|
||||
/*
|
||||
PIDAT_Kp = 0.20*PIDAT_Ku;
|
||||
PIDAT_Ki = 2*PIDAT_Kp/PIDAT_Tu;
|
||||
PIDAT_Kd = PIDAT_Kp*PIDAT_Tu/3;
|
||||
showString(PSTR(" No overshoot \r\n"));
|
||||
showString(PSTR(" CFG Kp: ")); Serial.println((unsigned int)(PIDAT_Kp*256));
|
||||
showString(PSTR(" CFG Ki: ")); Serial.println((unsigned int)(PIDAT_Ki*PIDAT_TIME_FACTOR));
|
||||
showString(PSTR(" CFG Kd: ")); Serial.println((unsigned int)(PIDAT_Kd*PIDAT_TIME_FACTOR));
|
||||
*/
|
||||
}
|
||||
}
|
||||
PIDAT_PWM_val = (PIDAT_bias + PIDAT_d);
|
||||
PIDAT_cycles++;
|
||||
PIDAT_min = PIDAT_test_temp;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PID_SOFT_PWM
|
||||
g_heater_pwm_val = PIDAT_PWM_val;
|
||||
#else
|
||||
analogWrite_check(HEATER_0_PIN, PIDAT_PWM_val);
|
||||
#if LED_PIN>-1
|
||||
analogWrite_check(LED_PIN, PIDAT_PWM_val);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if((PIDAT_input > (PIDAT_test_temp + 55)) || (PIDAT_input > 255))
|
||||
{
|
||||
showString(PSTR("PID Autotune failed! Temperature to high\r\n"));
|
||||
target_temp = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(millis() - PIDAT_temp_millis > 2000)
|
||||
{
|
||||
PIDAT_temp_millis = millis();
|
||||
showString(PSTR("ok T:"));
|
||||
Serial.print(PIDAT_input);
|
||||
showString(PSTR(" @:"));
|
||||
Serial.println((unsigned char)PIDAT_PWM_val*1);
|
||||
}
|
||||
|
||||
if(((millis() - PIDAT_t1) + (millis() - PIDAT_t2)) > (10L*60L*1000L*2L))
|
||||
{
|
||||
showString(PSTR("PID Autotune failed! timeout\r\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(PIDAT_cycles > 5)
|
||||
{
|
||||
showString(PSTR("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h\r\n"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//---------------- END AUTOTUNE PID ------------------------------
|
||||
|
||||
void updatePID()
|
||||
{
|
||||
#ifdef PIDTEMP
|
||||
temp_iState_min = (256L * -PID_INTEGRAL_DRIVE_MAX) / PID_Ki;
|
||||
temp_iState_max = (256L * PID_INTEGRAL_DRIVE_MAX) / PID_Ki;
|
||||
#endif
|
||||
}
|
||||
|
||||
void manage_heater()
|
||||
{
|
||||
|
||||
//Temperatur Monitor for repetier
|
||||
if((millis() - previous_millis_monitor) > 250 )
|
||||
{
|
||||
previous_millis_monitor = millis();
|
||||
|
||||
|
||||
if(manage_monitor <= 1)
|
||||
{
|
||||
showString(PSTR("MTEMP:"));
|
||||
Serial.print(millis());
|
||||
if(manage_monitor<1)
|
||||
{
|
||||
showString(PSTR(" "));
|
||||
Serial.print(analog2temp(current_raw));
|
||||
showString(PSTR(" "));
|
||||
Serial.print(target_temp);
|
||||
showString(PSTR(" "));
|
||||
#ifdef PIDTEMP
|
||||
Serial.println(heater_duty);
|
||||
#else
|
||||
#if (HEATER_0_PIN > -1)
|
||||
if(READ(HEATER_0_PIN))
|
||||
Serial.println(255);
|
||||
else
|
||||
Serial.println(0);
|
||||
#else
|
||||
Serial.println(0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#if THERMISTORBED!=0
|
||||
else
|
||||
{
|
||||
showString(PSTR(" "));
|
||||
Serial.print(analog2tempBed(current_bed_raw));
|
||||
showString(PSTR(" "));
|
||||
Serial.print(analog2tempBed(target_bed_raw));
|
||||
showString(PSTR(" "));
|
||||
#if (HEATER_1_PIN > -1)
|
||||
if(READ(HEATER_1_PIN))
|
||||
Serial.println(255);
|
||||
else
|
||||
Serial.println(0);
|
||||
#else
|
||||
Serial.println(0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// ENDE Temperatur Monitor for repetier
|
||||
|
||||
if((millis() - previous_millis_heater) < HEATER_CHECK_INTERVAL )
|
||||
return;
|
||||
|
||||
previous_millis_heater = millis();
|
||||
|
||||
#ifdef HEATER_USES_THERMISTOR
|
||||
current_raw = analogRead(TEMP_0_PIN);
|
||||
#ifdef DEBUG_HEAT_MGMT
|
||||
log_int("_HEAT_MGMT - analogRead(TEMP_0_PIN)", current_raw);
|
||||
log_int("_HEAT_MGMT - NUMTEMPS", NUMTEMPS);
|
||||
#endif
|
||||
// When using thermistor, when the heater is colder than targer temp, we get a higher analog reading than target,
|
||||
// this switches it up so that the reading appears lower than target for the control logic.
|
||||
current_raw = 1023 - current_raw;
|
||||
#elif defined HEATER_USES_AD595
|
||||
current_raw = analogRead(TEMP_0_PIN);
|
||||
#elif defined HEATER_USES_MAX6675
|
||||
current_raw = read_max6675();
|
||||
#endif
|
||||
|
||||
//MIN / MAX save to display the jitter of Heaterbarrel
|
||||
if(current_raw > current_raw_maxval)
|
||||
current_raw_maxval = current_raw;
|
||||
|
||||
if(current_raw < current_raw_minval)
|
||||
current_raw_minval = current_raw;
|
||||
|
||||
#ifdef SMOOTHING
|
||||
if (!nma) nma = SMOOTHFACTOR * current_raw;
|
||||
nma = (nma + current_raw) - (nma / SMOOTHFACTOR);
|
||||
current_raw = nma / SMOOTHFACTOR;
|
||||
#endif
|
||||
|
||||
#ifdef WATCHPERIOD
|
||||
if(watchmillis && millis() - watchmillis > WATCHPERIOD)
|
||||
{
|
||||
if(watch_raw + 1 >= current_raw)
|
||||
{
|
||||
target_temp = target_raw = 0;
|
||||
WRITE(HEATER_0_PIN,LOW);
|
||||
|
||||
#ifdef PID_SOFT_PWM
|
||||
g_heater_pwm_val = 0;
|
||||
#else
|
||||
analogWrite(HEATER_0_PIN, 0);
|
||||
#if LED_PIN>-1
|
||||
WRITE(LED_PIN,LOW);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
watchmillis = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//If tmp is lower then MINTEMP stop the Heater
|
||||
//or it os better to deaktivate the uutput PIN or PWM ?
|
||||
#ifdef MINTEMP
|
||||
if(current_raw <= minttemp)
|
||||
target_temp = target_raw = 0;
|
||||
#endif
|
||||
|
||||
#ifdef MAXTEMP
|
||||
if(current_raw >= maxttemp)
|
||||
{
|
||||
target_temp = target_raw = 0;
|
||||
|
||||
#if (ALARM_PIN > -1)
|
||||
WRITE(ALARM_PIN,HIGH);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (TEMP_0_PIN > -1) || defined (HEATER_USES_MAX6675) || defined (HEATER_USES_AD595)
|
||||
#ifdef PIDTEMP
|
||||
|
||||
int current_temp = analog2temp(current_raw);
|
||||
error = target_temp - current_temp;
|
||||
int delta_temp = current_temp - prev_temp;
|
||||
|
||||
prev_temp = current_temp;
|
||||
pTerm = ((long)PID_Kp * error) / 256;
|
||||
const int H0 = min(HEATER_DUTY_FOR_SETPOINT(target_temp),HEATER_CURRENT);
|
||||
heater_duty = H0 + pTerm;
|
||||
|
||||
if(error < 30)
|
||||
{
|
||||
temp_iState += error;
|
||||
temp_iState = constrain(temp_iState, temp_iState_min, temp_iState_max);
|
||||
iTerm = ((long)PID_Ki * temp_iState) / 256;
|
||||
heater_duty += iTerm;
|
||||
}
|
||||
|
||||
int prev_error = abs(target_temp - prev_temp);
|
||||
int log3 = 1; // discrete logarithm base 3, plus 1
|
||||
|
||||
if(prev_error > 81){ prev_error /= 81; log3 += 4; }
|
||||
if(prev_error > 9){ prev_error /= 9; log3 += 2; }
|
||||
if(prev_error > 3){ prev_error /= 3; log3 ++; }
|
||||
|
||||
dTerm = ((long)PID_Kd * delta_temp) / (256*log3);
|
||||
heater_duty += dTerm;
|
||||
heater_duty = constrain(heater_duty, 0, HEATER_CURRENT);
|
||||
|
||||
#ifdef PID_SOFT_PWM
|
||||
if(target_raw != 0)
|
||||
g_heater_pwm_val = (unsigned char)heater_duty;
|
||||
else
|
||||
g_heater_pwm_val = 0;
|
||||
#else
|
||||
if(target_raw != 0)
|
||||
analogWrite(HEATER_0_PIN, heater_duty);
|
||||
else
|
||||
analogWrite(HEATER_0_PIN, 0);
|
||||
|
||||
#if LED_PIN>-1
|
||||
if(target_raw != 0)
|
||||
analogWrite(LED_PIN, constrain(LED_PWM_FOR_BRIGHTNESS(heater_duty),0,255));
|
||||
else
|
||||
analogWrite(LED_PIN, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
if(current_raw >= target_raw)
|
||||
{
|
||||
WRITE(HEATER_0_PIN,LOW);
|
||||
#if LED_PIN>-1
|
||||
WRITE(LED_PIN,LOW);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if(target_raw != 0)
|
||||
{
|
||||
WRITE(HEATER_0_PIN,HIGH);
|
||||
#if LED_PIN > -1
|
||||
WRITE(LED_PIN,HIGH);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
|
||||
return;
|
||||
|
||||
previous_millis_bed_heater = millis();
|
||||
|
||||
#ifndef TEMP_1_PIN
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if TEMP_1_PIN == -1
|
||||
return;
|
||||
#else
|
||||
|
||||
#ifdef BED_USES_THERMISTOR
|
||||
|
||||
current_bed_raw = analogRead(TEMP_1_PIN);
|
||||
|
||||
#ifdef DEBUG_HEAT_MGMT
|
||||
log_int("_HEAT_MGMT - analogRead(TEMP_1_PIN)", current_bed_raw);
|
||||
log_int("_HEAT_MGMT - BNUMTEMPS", BNUMTEMPS);
|
||||
#endif
|
||||
|
||||
// If using thermistor, when the heater is colder than targer temp, we get a higher analog reading than target,
|
||||
// this switches it up so that the reading appears lower than target for the control logic.
|
||||
current_bed_raw = 1023 - current_bed_raw;
|
||||
#elif defined BED_USES_AD595
|
||||
current_bed_raw = analogRead(TEMP_1_PIN);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MINTEMP
|
||||
if(current_bed_raw >= target_bed_raw || current_bed_raw < minttemp)
|
||||
#else
|
||||
if(current_bed_raw >= target_bed_raw)
|
||||
#endif
|
||||
{
|
||||
WRITE(HEATER_1_PIN,LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(HEATER_1_PIN,HIGH);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONTROLLERFAN_PIN
|
||||
controllerFan(); //Check if fan should be turned on to cool stepper drivers down
|
||||
#endif
|
||||
|
||||
#ifdef EXTRUDERFAN_PIN
|
||||
extruderFan(); //Check if fan should be turned on to cool extruder down
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if defined (HEATER_USES_THERMISTOR) || defined (BED_USES_THERMISTOR)
|
||||
int temp2analog_thermistor(int celsius, const short table[][2], int numtemps)
|
||||
{
|
||||
int raw = 0;
|
||||
byte i;
|
||||
|
||||
for (i=1; i<numtemps; i++)
|
||||
{
|
||||
if (table[i][1] < celsius)
|
||||
{
|
||||
raw = table[i-1][0] +
|
||||
(celsius - table[i-1][1]) *
|
||||
(table[i][0] - table[i-1][0]) /
|
||||
(table[i][1] - table[i-1][1]);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Overflow: Set to last value in the table
|
||||
if (i == numtemps) raw = table[i-1][0];
|
||||
|
||||
return 1023 - raw;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_AD595) || defined (BED_USES_AD595)
|
||||
int temp2analog_ad595(int celsius)
|
||||
{
|
||||
return (celsius * 1024.0) / (500.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_MAX6675) || defined (BED_USES_MAX6675)
|
||||
int temp2analog_max6675(int celsius)
|
||||
{
|
||||
return celsius * 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_THERMISTOR) || defined (BED_USES_THERMISTOR)
|
||||
int analog2temp_thermistor(int raw,const short table[][2], int numtemps) {
|
||||
int celsius = 0;
|
||||
byte i;
|
||||
|
||||
raw = 1023 - raw;
|
||||
|
||||
for (i=1; i<numtemps; i++)
|
||||
{
|
||||
if (table[i][0] > raw)
|
||||
{
|
||||
celsius = table[i-1][1] +
|
||||
(raw - table[i-1][0]) *
|
||||
(table[i][1] - table[i-1][1]) /
|
||||
(table[i][0] - table[i-1][0]);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Overflow: Set to last value in the table
|
||||
if (i == numtemps) celsius = table[i-1][1];
|
||||
|
||||
return celsius;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_AD595) || defined (BED_USES_AD595)
|
||||
int analog2temp_ad595(int raw)
|
||||
{
|
||||
return (raw * 500.0) / 1024.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_MAX6675) || defined (BED_USES_MAX6675)
|
||||
int analog2temp_max6675(int raw)
|
||||
{
|
||||
return raw / 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONTROLLERFAN_PIN
|
||||
unsigned long lastMotor = 0; //Save the time for when a motor was turned on last
|
||||
unsigned long lastMotorCheck = 0;
|
||||
|
||||
void controllerFan()
|
||||
{
|
||||
if ((millis() - lastMotorCheck) >= 2500) //Not a time critical function, so we only check every 2500ms
|
||||
{
|
||||
lastMotorCheck = millis();
|
||||
|
||||
if(!READ(X_ENABLE_PIN) || !READ(Y_ENABLE_PIN) || !READ(Z_ENABLE_PIN) || !READ(E_ENABLE_PIN)) //If any of the drivers are enabled...
|
||||
{
|
||||
lastMotor = millis(); //... set time to NOW so the fan will turn on
|
||||
}
|
||||
|
||||
if ((millis() - lastMotor) >= (CONTROLLERFAN_SEC*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...
|
||||
{
|
||||
WRITE(CONTROLLERFAN_PIN, LOW); //... turn the fan off
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(CONTROLLERFAN_PIN, HIGH); //... turn the fan on
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EXTRUDERFAN_PIN
|
||||
unsigned long lastExtruderCheck = 0;
|
||||
|
||||
void extruderFan()
|
||||
{
|
||||
if ((millis() - lastExtruderCheck) >= 2500) //Not a time critical function, so we only check every 2500ms
|
||||
{
|
||||
lastExtruderCheck = millis();
|
||||
|
||||
if (analog2temp(current_raw) < EXTRUDERFAN_DEC)
|
||||
{
|
||||
WRITE(EXTRUDERFAN_PIN, LOW); //... turn the fan off
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(EXTRUDERFAN_PIN, HIGH); //... turn the fan on
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
132
Sprinter/heater.h
Normal file
132
Sprinter/heater.h
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
Reprap heater funtions based on Sprinter
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
This softwarepart for Heatercontrol is based on Sprinter
|
||||
big thanks to kliment (https://github.com/kliment/Sprinter)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "Configuration.h"
|
||||
#include "thermistortables.h"
|
||||
|
||||
#if defined HEATER_USES_THERMISTOR
|
||||
#define temp2analogh( c ) temp2analog_thermistor(c,temptable,NUMTEMPS)
|
||||
#define analog2temp( c ) analog2temp_thermistor(c,temptable,NUMTEMPS)
|
||||
#elif defined HEATER_USES_AD595
|
||||
#define temp2analogh( c ) temp2analog_ad595(c)
|
||||
#define analog2temp( c ) analog2temp_ad595(c)
|
||||
#elif defined HEATER_USES_MAX6675
|
||||
#define temp2analogh( c ) temp2analog_max6675(c)
|
||||
#define analog2temp( c ) analog2temp_max6675(c)
|
||||
#endif
|
||||
|
||||
#if defined BED_USES_THERMISTOR
|
||||
#define temp2analogBed( c ) temp2analog_thermistor((c),bedtemptable,BNUMTEMPS)
|
||||
#define analog2tempBed( c ) analog2temp_thermistor((c),bedtemptable,BNUMTEMPS)
|
||||
#elif defined BED_USES_AD595
|
||||
#define temp2analogBed( c ) temp2analog_ad595(c)
|
||||
#define analog2tempBed( c ) analog2temp_ad595(c)
|
||||
#elif defined BED_USES_MAX6675
|
||||
#define temp2analogBed( c ) temp2analog_max6675(c)
|
||||
#define analog2tempBed( c ) analog2temp_max6675(c)
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_THERMISTOR) || defined (BED_USES_THERMISTOR)
|
||||
int temp2analog_thermistor(int celsius, const short table[][2], int numtemps);
|
||||
int analog2temp_thermistor(int raw,const short table[][2], int numtemps);
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_AD595) || defined (BED_USES_AD595)
|
||||
int temp2analog_ad595(int celsius);
|
||||
int analog2temp_ad595(int raw);
|
||||
#endif
|
||||
|
||||
#if defined (HEATER_USES_MAX6675) || defined (BED_USES_MAX6675)
|
||||
int temp2analog_max6675(int celsius);
|
||||
int analog2temp_max6675(int raw);
|
||||
#endif
|
||||
|
||||
|
||||
extern int target_raw;
|
||||
extern int target_temp;
|
||||
extern int current_raw;
|
||||
extern int current_raw_maxval;
|
||||
extern int current_raw_minval;
|
||||
extern int tt_maxval;
|
||||
extern int tt_minval;
|
||||
extern int target_bed_raw;
|
||||
extern int current_bed_raw;
|
||||
extern unsigned long previous_millis_heater, previous_millis_bed_heater;
|
||||
extern unsigned char manage_monitor;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
extern volatile unsigned char g_heater_pwm_val;
|
||||
|
||||
extern unsigned char PWM_off_time;
|
||||
extern unsigned char PWM_out_on;
|
||||
|
||||
extern int temp_iState;
|
||||
extern int temp_dState;
|
||||
extern int prev_temp;
|
||||
extern int pTerm;
|
||||
extern int iTerm;
|
||||
extern int dTerm;
|
||||
extern int error;
|
||||
extern int heater_duty;
|
||||
|
||||
extern unsigned int PID_Kp, PID_Ki, PID_Kd;
|
||||
#endif
|
||||
|
||||
#if defined(FAN_SOFT_PWM) && (FAN_PIN > -1)
|
||||
extern volatile unsigned char g_fan_pwm_val;
|
||||
#endif
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
extern float autotemp_max;
|
||||
extern float autotemp_min;
|
||||
extern float autotemp_factor;
|
||||
extern int autotemp_setpoint;
|
||||
extern bool autotemp_enabled;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SMOOTHING
|
||||
extern uint32_t nma;
|
||||
#endif
|
||||
|
||||
#ifdef WATCHPERIOD
|
||||
extern int watch_raw;
|
||||
extern unsigned long watchmillis;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(PID_SOFT_PWM) || (defined(FAN_SOFT_PWM) && (FAN_PIN > -1))
|
||||
void init_Timer2_softpwm(void);
|
||||
#endif
|
||||
|
||||
#ifdef PID_AUTOTUNE
|
||||
void PID_autotune(int PIDAT_test_temp);
|
||||
#endif
|
||||
|
||||
#ifdef PIDTEMP
|
||||
void updatePID();
|
||||
#endif
|
||||
|
||||
void manage_heater();
|
||||
106
Sprinter/pins.h
106
Sprinter/pins.h
|
|
@ -96,6 +96,36 @@
|
|||
* PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
|
||||
* +--------+
|
||||
*
|
||||
****************************************************************************************
|
||||
*
|
||||
* ATMega644P (SMD)
|
||||
*
|
||||
* +--------+
|
||||
* MOSI (D 5) PB5 1| O |44 PB4 (D 4) PWM
|
||||
* MISO (D 6) PB6 2| |43 PB3 (D 3) PWM
|
||||
* SCK (D 7) PB7 3| |42 PB2 (D 2) INT2
|
||||
* RST 4| |41 PB1 (D 1)
|
||||
* Vcc 5| |40 PB0 (D 0)
|
||||
* GND 6| |39 GND
|
||||
* XTAL2 7| |38 Vcc
|
||||
* XTAL1 8| |37 PA0 (AI 0 / D31)
|
||||
* RX0 (D 8) PD0 9| |36 PA1 (AI 1 / D30)
|
||||
* TX0 (D 9) PD1 10| |35 PA2 (AI 2 / D29)
|
||||
* INT0 RX1 (D 10) PD2 11| |34 PA3 (AI 3 / D28)
|
||||
* + +
|
||||
* INT1 TX1 (D 11) PD3 12| |33 PA4 (AI 4 / D27)
|
||||
* PWM (D 12) PD4 13| |32 PA5 (AI 5 / D26)
|
||||
* PWM (D 13) PD5 14| |31 PA6 (AI 6 / D25)
|
||||
* PWM (D 14) PD6 15| |30 PA7 (AI 7 / D24)
|
||||
* PWM (D 15) PD7 16| |29 AREF
|
||||
* Vcc 17| |28 GND
|
||||
* GND 18| |27 AVCC
|
||||
* (D 16) PC0 19| |26 PC7 (D 23)
|
||||
* (D 17) PC1 20| |25 PC6 (D 22)
|
||||
* (D 18) PC2 21| |24 PC5 (D 21) TDI
|
||||
* (D 19) PC3 22| |23 PC4 (D 20) TDO
|
||||
* +--------+
|
||||
*
|
||||
****************************************************************************************/
|
||||
#if MOTHERBOARD == 1
|
||||
#define KNOWN_BOARD 1
|
||||
|
|
@ -151,7 +181,7 @@
|
|||
#if MOTHERBOARD == 2
|
||||
#define KNOWN_BOARD 1
|
||||
|
||||
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__)
|
||||
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) && !defined(__ATmega644P__) && !defined(__ATmega1284P__)
|
||||
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
|
||||
#endif
|
||||
|
||||
|
|
@ -568,6 +598,11 @@
|
|||
* Gen6 pin assignment
|
||||
*
|
||||
****************************************************************************************/
|
||||
#if MOTHERBOARD == 51
|
||||
#define MOTHERBOARD 5
|
||||
#define GEN6_DELUXE
|
||||
#endif
|
||||
|
||||
#if MOTHERBOARD == 5
|
||||
#define KNOWN_BOARD 1
|
||||
|
||||
|
|
@ -602,13 +637,18 @@
|
|||
#define E_ENABLE_PIN 3 //Added @ EJE Electronics 20100715
|
||||
#define TEMP_0_PIN 5 //changed @ rkoeppl 20110410
|
||||
#define HEATER_0_PIN 14 //changed @ rkoeppl 20110410
|
||||
#define HEATER_1_PIN -1 //changed @ rkoeppl 20110410
|
||||
|
||||
#ifdef GEN6_DELUXE
|
||||
#define HEATER_1_PIN 1
|
||||
#define TEMP_1_PIN 0
|
||||
#else
|
||||
#define HEATER_1_PIN -1
|
||||
#define TEMP_1_PIN -1
|
||||
#endif
|
||||
|
||||
#define SDPOWER -1
|
||||
#define SDSS 17
|
||||
#define LED_PIN -1 //changed @ rkoeppl 20110410
|
||||
#define TEMP_1_PIN -1 //changed @ rkoeppl 20110410
|
||||
#define FAN_PIN -1 //changed @ rkoeppl 20110410
|
||||
#define PS_ON_PIN -1 //changed @ rkoeppl 20110410
|
||||
//our pin for debugging.
|
||||
|
|
@ -669,7 +709,6 @@
|
|||
#define Y_ENABLE_PIN 14
|
||||
#define Z_ENABLE_PIN 26
|
||||
#define E_ENABLE_PIN 14
|
||||
|
||||
#else
|
||||
|
||||
#define HEATER_1_PIN 14 // (bed)
|
||||
|
|
@ -687,6 +726,65 @@
|
|||
|
||||
#endif
|
||||
|
||||
/****************************************************************************************
|
||||
* Gen7 pin assignment
|
||||
*
|
||||
****************************************************************************************
|
||||
* for Gen7 to work properly, you should reset your fuses to lfuse= 0xF7 ; hfuse = 0xD4 ; efuse = FD;
|
||||
* else you will always get a "brown out reset" loop resetting the firmware
|
||||
* you need a programmer to set the fuses
|
||||
**/
|
||||
#if MOTHERBOARD == 71 //GEN7 with 20 Mhz
|
||||
#define MOTHERBOARD 7
|
||||
#define QUARZ_20MHZ
|
||||
#endif
|
||||
|
||||
#if MOTHERBOARD == 7
|
||||
#define KNOWN_BOARD 1
|
||||
|
||||
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) && !defined(__AVR_ATmega644__)
|
||||
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
|
||||
#endif
|
||||
|
||||
//x axis pins
|
||||
#define X_STEP_PIN 19
|
||||
#define X_DIR_PIN 18
|
||||
#define X_ENABLE_PIN 24
|
||||
#define X_MIN_PIN 7
|
||||
#define X_MAX_PIN -1 //X - Maxpin is 6
|
||||
|
||||
//y axis pins
|
||||
#define Y_STEP_PIN 23
|
||||
#define Y_DIR_PIN 22
|
||||
#define Y_ENABLE_PIN 24
|
||||
#define Y_MIN_PIN 5
|
||||
#define Y_MAX_PIN -1 //Y - Maxpin is 2
|
||||
|
||||
//z axis pins
|
||||
#define Z_STEP_PIN 26
|
||||
#define Z_DIR_PIN 25
|
||||
#define Z_ENABLE_PIN 24
|
||||
#define Z_MIN_PIN 1
|
||||
#define Z_MAX_PIN -1 //Z - Maxpin is 0
|
||||
|
||||
//extruder pins
|
||||
#define E_STEP_PIN 28
|
||||
#define E_DIR_PIN 27
|
||||
#define E_ENABLE_PIN 24
|
||||
#define TEMP_0_PIN 1 // Extruder
|
||||
#define HEATER_0_PIN 4 // Extruder
|
||||
#define HEATER_1_PIN 3 // Bed
|
||||
|
||||
|
||||
#define SDPOWER -1
|
||||
#define SDSS -1
|
||||
#define LED_PIN -1
|
||||
#define TEMP_1_PIN 2 //Bed
|
||||
#define FAN_PIN -1
|
||||
#define PS_ON_PIN 15
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************************
|
||||
* Teensylu 0.7 pin assingments (ATMEGA90USB)
|
||||
* Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE!
|
||||
|
|
|
|||
151
Sprinter/speed_lookuptable.h
Normal file
151
Sprinter/speed_lookuptable.h
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#ifndef SPEED_LOOKUPTABLE_H
|
||||
#define SPEED_LOOKUPTABLE_H
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
|
||||
#if F_CPU == 16000000
|
||||
const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\
|
||||
{ 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135},
|
||||
{ 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32},
|
||||
{ 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14},
|
||||
{ 323, 13}, { 310, 11}, { 299, 11}, { 288, 11}, { 277, 9}, { 268, 9}, { 259, 8}, { 251, 8},
|
||||
{ 243, 8}, { 235, 7}, { 228, 6}, { 222, 6}, { 216, 6}, { 210, 6}, { 204, 5}, { 199, 5},
|
||||
{ 194, 5}, { 189, 4}, { 185, 4}, { 181, 4}, { 177, 4}, { 173, 4}, { 169, 4}, { 165, 3},
|
||||
{ 162, 3}, { 159, 4}, { 155, 3}, { 152, 3}, { 149, 2}, { 147, 3}, { 144, 3}, { 141, 2},
|
||||
{ 139, 3}, { 136, 2}, { 134, 2}, { 132, 3}, { 129, 2}, { 127, 2}, { 125, 2}, { 123, 2},
|
||||
{ 121, 2}, { 119, 1}, { 118, 2}, { 116, 2}, { 114, 1}, { 113, 2}, { 111, 2}, { 109, 1},
|
||||
{ 108, 2}, { 106, 1}, { 105, 2}, { 103, 1}, { 102, 1}, { 101, 1}, { 100, 2}, { 98, 1},
|
||||
{ 97, 1}, { 96, 1}, { 95, 2}, { 93, 1}, { 92, 1}, { 91, 1}, { 90, 1}, { 89, 1},
|
||||
{ 88, 1}, { 87, 1}, { 86, 1}, { 85, 1}, { 84, 1}, { 83, 0}, { 83, 1}, { 82, 1},
|
||||
{ 81, 1}, { 80, 1}, { 79, 1}, { 78, 0}, { 78, 1}, { 77, 1}, { 76, 1}, { 75, 0},
|
||||
{ 75, 1}, { 74, 1}, { 73, 1}, { 72, 0}, { 72, 1}, { 71, 1}, { 70, 0}, { 70, 1},
|
||||
{ 69, 0}, { 69, 1}, { 68, 1}, { 67, 0}, { 67, 1}, { 66, 0}, { 66, 1}, { 65, 0},
|
||||
{ 65, 1}, { 64, 1}, { 63, 0}, { 63, 1}, { 62, 0}, { 62, 1}, { 61, 0}, { 61, 1},
|
||||
{ 60, 0}, { 60, 0}, { 60, 1}, { 59, 0}, { 59, 1}, { 58, 0}, { 58, 1}, { 57, 0},
|
||||
{ 57, 1}, { 56, 0}, { 56, 0}, { 56, 1}, { 55, 0}, { 55, 1}, { 54, 0}, { 54, 0},
|
||||
{ 54, 1}, { 53, 0}, { 53, 0}, { 53, 1}, { 52, 0}, { 52, 0}, { 52, 1}, { 51, 0},
|
||||
{ 51, 0}, { 51, 1}, { 50, 0}, { 50, 0}, { 50, 1}, { 49, 0}, { 49, 0}, { 49, 1},
|
||||
{ 48, 0}, { 48, 0}, { 48, 1}, { 47, 0}, { 47, 0}, { 47, 0}, { 47, 1}, { 46, 0},
|
||||
{ 46, 0}, { 46, 1}, { 45, 0}, { 45, 0}, { 45, 0}, { 45, 1}, { 44, 0}, { 44, 0},
|
||||
{ 44, 0}, { 44, 1}, { 43, 0}, { 43, 0}, { 43, 0}, { 43, 1}, { 42, 0}, { 42, 0},
|
||||
{ 42, 0}, { 42, 1}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 1}, { 40, 0},
|
||||
{ 40, 0}, { 40, 0}, { 40, 0}, { 40, 1}, { 39, 0}, { 39, 0}, { 39, 0}, { 39, 0},
|
||||
{ 39, 1}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 1}, { 37, 0}, { 37, 0},
|
||||
{ 37, 0}, { 37, 0}, { 37, 0}, { 37, 1}, { 36, 0}, { 36, 0}, { 36, 0}, { 36, 0},
|
||||
{ 36, 1}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 1},
|
||||
{ 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 1}, { 33, 0}, { 33, 0},
|
||||
{ 33, 0}, { 33, 0}, { 33, 0}, { 33, 0}, { 33, 1}, { 32, 0}, { 32, 0}, { 32, 0},
|
||||
{ 32, 0}, { 32, 0}, { 32, 0}, { 32, 0}, { 32, 1}, { 31, 0}, { 31, 0}, { 31, 0},
|
||||
{ 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0}
|
||||
};
|
||||
|
||||
const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {\
|
||||
{ 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894},
|
||||
{ 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657},
|
||||
{ 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331},
|
||||
{ 8928, 308}, { 8620, 287}, { 8333, 269}, { 8064, 252}, { 7812, 237}, { 7575, 223}, { 7352, 210}, { 7142, 198},
|
||||
{ 6944, 188}, { 6756, 178}, { 6578, 168}, { 6410, 160}, { 6250, 153}, { 6097, 145}, { 5952, 139}, { 5813, 132},
|
||||
{ 5681, 126}, { 5555, 121}, { 5434, 115}, { 5319, 111}, { 5208, 106}, { 5102, 102}, { 5000, 99}, { 4901, 94},
|
||||
{ 4807, 91}, { 4716, 87}, { 4629, 84}, { 4545, 81}, { 4464, 79}, { 4385, 75}, { 4310, 73}, { 4237, 71},
|
||||
{ 4166, 68}, { 4098, 66}, { 4032, 64}, { 3968, 62}, { 3906, 60}, { 3846, 59}, { 3787, 56}, { 3731, 55},
|
||||
{ 3676, 53}, { 3623, 52}, { 3571, 50}, { 3521, 49}, { 3472, 48}, { 3424, 46}, { 3378, 45}, { 3333, 44},
|
||||
{ 3289, 43}, { 3246, 41}, { 3205, 41}, { 3164, 39}, { 3125, 39}, { 3086, 38}, { 3048, 36}, { 3012, 36},
|
||||
{ 2976, 35}, { 2941, 35}, { 2906, 33}, { 2873, 33}, { 2840, 32}, { 2808, 31}, { 2777, 30}, { 2747, 30},
|
||||
{ 2717, 29}, { 2688, 29}, { 2659, 28}, { 2631, 27}, { 2604, 27}, { 2577, 26}, { 2551, 26}, { 2525, 25},
|
||||
{ 2500, 25}, { 2475, 25}, { 2450, 23}, { 2427, 24}, { 2403, 23}, { 2380, 22}, { 2358, 22}, { 2336, 22},
|
||||
{ 2314, 21}, { 2293, 21}, { 2272, 20}, { 2252, 20}, { 2232, 20}, { 2212, 20}, { 2192, 19}, { 2173, 18},
|
||||
{ 2155, 19}, { 2136, 18}, { 2118, 18}, { 2100, 17}, { 2083, 17}, { 2066, 17}, { 2049, 17}, { 2032, 16},
|
||||
{ 2016, 16}, { 2000, 16}, { 1984, 16}, { 1968, 15}, { 1953, 16}, { 1937, 14}, { 1923, 15}, { 1908, 15},
|
||||
{ 1893, 14}, { 1879, 14}, { 1865, 14}, { 1851, 13}, { 1838, 14}, { 1824, 13}, { 1811, 13}, { 1798, 13},
|
||||
{ 1785, 12}, { 1773, 13}, { 1760, 12}, { 1748, 12}, { 1736, 12}, { 1724, 12}, { 1712, 12}, { 1700, 11},
|
||||
{ 1689, 12}, { 1677, 11}, { 1666, 11}, { 1655, 11}, { 1644, 11}, { 1633, 10}, { 1623, 11}, { 1612, 10},
|
||||
{ 1602, 10}, { 1592, 10}, { 1582, 10}, { 1572, 10}, { 1562, 10}, { 1552, 9}, { 1543, 10}, { 1533, 9},
|
||||
{ 1524, 9}, { 1515, 9}, { 1506, 9}, { 1497, 9}, { 1488, 9}, { 1479, 9}, { 1470, 9}, { 1461, 8},
|
||||
{ 1453, 8}, { 1445, 9}, { 1436, 8}, { 1428, 8}, { 1420, 8}, { 1412, 8}, { 1404, 8}, { 1396, 8},
|
||||
{ 1388, 7}, { 1381, 8}, { 1373, 7}, { 1366, 8}, { 1358, 7}, { 1351, 7}, { 1344, 8}, { 1336, 7},
|
||||
{ 1329, 7}, { 1322, 7}, { 1315, 7}, { 1308, 6}, { 1302, 7}, { 1295, 7}, { 1288, 6}, { 1282, 7},
|
||||
{ 1275, 6}, { 1269, 7}, { 1262, 6}, { 1256, 6}, { 1250, 7}, { 1243, 6}, { 1237, 6}, { 1231, 6},
|
||||
{ 1225, 6}, { 1219, 6}, { 1213, 6}, { 1207, 6}, { 1201, 5}, { 1196, 6}, { 1190, 6}, { 1184, 5},
|
||||
{ 1179, 6}, { 1173, 5}, { 1168, 6}, { 1162, 5}, { 1157, 5}, { 1152, 6}, { 1146, 5}, { 1141, 5},
|
||||
{ 1136, 5}, { 1131, 5}, { 1126, 5}, { 1121, 5}, { 1116, 5}, { 1111, 5}, { 1106, 5}, { 1101, 5},
|
||||
{ 1096, 5}, { 1091, 5}, { 1086, 4}, { 1082, 5}, { 1077, 5}, { 1072, 4}, { 1068, 5}, { 1063, 4},
|
||||
{ 1059, 5}, { 1054, 4}, { 1050, 4}, { 1046, 5}, { 1041, 4}, { 1037, 4}, { 1033, 5}, { 1028, 4},
|
||||
{ 1024, 4}, { 1020, 4}, { 1016, 4}, { 1012, 4}, { 1008, 4}, { 1004, 4}, { 1000, 4}, { 996, 4},
|
||||
{ 992, 4}, { 988, 4}, { 984, 4}, { 980, 4}, { 976, 4}, { 972, 4}, { 968, 3}, { 965, 3}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {
|
||||
{62500, 54055}, {8445, 3917}, {4528, 1434}, {3094, 745}, {2349, 456}, {1893, 307}, {1586, 222}, {1364, 167},
|
||||
{1197, 131}, {1066, 105}, {961, 86}, {875, 72}, {803, 61}, {742, 53}, {689, 45}, {644, 40},
|
||||
{604, 35}, {569, 32}, {537, 28}, {509, 25}, {484, 23}, {461, 21}, {440, 19}, {421, 17},
|
||||
{404, 16}, {388, 15}, {373, 14}, {359, 13}, {346, 12}, {334, 11}, {323, 10}, {313, 10},
|
||||
{303, 9}, {294, 9}, {285, 8}, {277, 7}, {270, 8}, {262, 7}, {255, 6}, {249, 6},
|
||||
{243, 6}, {237, 6}, {231, 5}, {226, 5}, {221, 5}, {216, 5}, {211, 4}, {207, 5},
|
||||
{202, 4}, {198, 4}, {194, 4}, {190, 3}, {187, 4}, {183, 3}, {180, 3}, {177, 4},
|
||||
{173, 3}, {170, 3}, {167, 2}, {165, 3}, {162, 3}, {159, 2}, {157, 3}, {154, 2},
|
||||
{152, 3}, {149, 2}, {147, 2}, {145, 2}, {143, 2}, {141, 2}, {139, 2}, {137, 2},
|
||||
{135, 2}, {133, 2}, {131, 2}, {129, 1}, {128, 2}, {126, 2}, {124, 1}, {123, 2},
|
||||
{121, 1}, {120, 2}, {118, 1}, {117, 1}, {116, 2}, {114, 1}, {113, 1}, {112, 2},
|
||||
{110, 1}, {109, 1}, {108, 1}, {107, 2}, {105, 1}, {104, 1}, {103, 1}, {102, 1},
|
||||
{101, 1}, {100, 1}, {99, 1}, {98, 1}, {97, 1}, {96, 1}, {95, 1}, {94, 1},
|
||||
{93, 1}, {92, 1}, {91, 0}, {91, 1}, {90, 1}, {89, 1}, {88, 1}, {87, 0},
|
||||
{87, 1}, {86, 1}, {85, 1}, {84, 0}, {84, 1}, {83, 1}, {82, 1}, {81, 0},
|
||||
{81, 1}, {80, 1}, {79, 0}, {79, 1}, {78, 0}, {78, 1}, {77, 1}, {76, 0},
|
||||
{76, 1}, {75, 0}, {75, 1}, {74, 1}, {73, 0}, {73, 1}, {72, 0}, {72, 1},
|
||||
{71, 0}, {71, 1}, {70, 0}, {70, 1}, {69, 0}, {69, 1}, {68, 0}, {68, 1},
|
||||
{67, 0}, {67, 1}, {66, 0}, {66, 1}, {65, 0}, {65, 0}, {65, 1}, {64, 0},
|
||||
{64, 1}, {63, 0}, {63, 1}, {62, 0}, {62, 0}, {62, 1}, {61, 0}, {61, 1},
|
||||
{60, 0}, {60, 0}, {60, 1}, {59, 0}, {59, 0}, {59, 1}, {58, 0}, {58, 0},
|
||||
{58, 1}, {57, 0}, {57, 0}, {57, 1}, {56, 0}, {56, 0}, {56, 1}, {55, 0},
|
||||
{55, 0}, {55, 1}, {54, 0}, {54, 0}, {54, 1}, {53, 0}, {53, 0}, {53, 0},
|
||||
{53, 1}, {52, 0}, {52, 0}, {52, 1}, {51, 0}, {51, 0}, {51, 0}, {51, 1},
|
||||
{50, 0}, {50, 0}, {50, 0}, {50, 1}, {49, 0}, {49, 0}, {49, 0}, {49, 1},
|
||||
{48, 0}, {48, 0}, {48, 0}, {48, 1}, {47, 0}, {47, 0}, {47, 0}, {47, 1},
|
||||
{46, 0}, {46, 0}, {46, 0}, {46, 0}, {46, 1}, {45, 0}, {45, 0}, {45, 0},
|
||||
{45, 1}, {44, 0}, {44, 0}, {44, 0}, {44, 0}, {44, 1}, {43, 0}, {43, 0},
|
||||
{43, 0}, {43, 0}, {43, 1}, {42, 0}, {42, 0}, {42, 0}, {42, 0}, {42, 0},
|
||||
{42, 1}, {41, 0}, {41, 0}, {41, 0}, {41, 0}, {41, 0}, {41, 1}, {40, 0},
|
||||
{40, 0}, {40, 0}, {40, 0}, {40, 1}, {39, 0}, {39, 0}, {39, 0}, {39, 0},
|
||||
{39, 0}, {39, 0}, {39, 1}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, {38, 0},
|
||||
};
|
||||
|
||||
const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {
|
||||
{62500, 10417}, {52083, 7441}, {44642, 5580}, {39062, 4340}, {34722, 3472}, {31250, 2841}, {28409, 2368}, {26041, 2003},
|
||||
{24038, 1717}, {22321, 1488}, {20833, 1302}, {19531, 1149}, {18382, 1021}, {17361, 914}, {16447, 822}, {15625, 745},
|
||||
{14880, 676}, {14204, 618}, {13586, 566}, {13020, 520}, {12500, 481}, {12019, 445}, {11574, 414}, {11160, 385},
|
||||
{10775, 359}, {10416, 336}, {10080, 315}, {9765, 296}, {9469, 278}, {9191, 263}, {8928, 248}, {8680, 235},
|
||||
{8445, 222}, {8223, 211}, {8012, 200}, {7812, 191}, {7621, 181}, {7440, 173}, {7267, 165}, {7102, 158},
|
||||
{6944, 151}, {6793, 145}, {6648, 138}, {6510, 133}, {6377, 127}, {6250, 123}, {6127, 118}, {6009, 113},
|
||||
{5896, 109}, {5787, 106}, {5681, 101}, {5580, 98}, {5482, 95}, {5387, 91}, {5296, 88}, {5208, 86},
|
||||
{5122, 82}, {5040, 80}, {4960, 78}, {4882, 75}, {4807, 73}, {4734, 70}, {4664, 69}, {4595, 67},
|
||||
{4528, 64}, {4464, 63}, {4401, 61}, {4340, 60}, {4280, 58}, {4222, 56}, {4166, 55}, {4111, 53},
|
||||
{4058, 52}, {4006, 51}, {3955, 49}, {3906, 48}, {3858, 48}, {3810, 45}, {3765, 45}, {3720, 44},
|
||||
{3676, 43}, {3633, 42}, {3591, 40}, {3551, 40}, {3511, 39}, {3472, 38}, {3434, 38}, {3396, 36},
|
||||
{3360, 36}, {3324, 35}, {3289, 34}, {3255, 34}, {3221, 33}, {3188, 32}, {3156, 31}, {3125, 31},
|
||||
{3094, 31}, {3063, 30}, {3033, 29}, {3004, 28}, {2976, 28}, {2948, 28}, {2920, 27}, {2893, 27},
|
||||
{2866, 26}, {2840, 25}, {2815, 25}, {2790, 25}, {2765, 24}, {2741, 24}, {2717, 24}, {2693, 23},
|
||||
{2670, 22}, {2648, 22}, {2626, 22}, {2604, 22}, {2582, 21}, {2561, 21}, {2540, 20}, {2520, 20},
|
||||
{2500, 20}, {2480, 20}, {2460, 19}, {2441, 19}, {2422, 19}, {2403, 18}, {2385, 18}, {2367, 18},
|
||||
{2349, 17}, {2332, 18}, {2314, 17}, {2297, 16}, {2281, 17}, {2264, 16}, {2248, 16}, {2232, 16},
|
||||
{2216, 16}, {2200, 15}, {2185, 15}, {2170, 15}, {2155, 15}, {2140, 15}, {2125, 14}, {2111, 14},
|
||||
{2097, 14}, {2083, 14}, {2069, 14}, {2055, 13}, {2042, 13}, {2029, 13}, {2016, 13}, {2003, 13},
|
||||
{1990, 13}, {1977, 12}, {1965, 12}, {1953, 13}, {1940, 11}, {1929, 12}, {1917, 12}, {1905, 12},
|
||||
{1893, 11}, {1882, 11}, {1871, 11}, {1860, 11}, {1849, 11}, {1838, 11}, {1827, 11}, {1816, 10},
|
||||
{1806, 11}, {1795, 10}, {1785, 10}, {1775, 10}, {1765, 10}, {1755, 10}, {1745, 9}, {1736, 10},
|
||||
{1726, 9}, {1717, 10}, {1707, 9}, {1698, 9}, {1689, 9}, {1680, 9}, {1671, 9}, {1662, 9},
|
||||
{1653, 9}, {1644, 8}, {1636, 9}, {1627, 8}, {1619, 9}, {1610, 8}, {1602, 8}, {1594, 8},
|
||||
{1586, 8}, {1578, 8}, {1570, 8}, {1562, 8}, {1554, 7}, {1547, 8}, {1539, 8}, {1531, 7},
|
||||
{1524, 8}, {1516, 7}, {1509, 7}, {1502, 7}, {1495, 7}, {1488, 7}, {1481, 7}, {1474, 7},
|
||||
{1467, 7}, {1460, 7}, {1453, 7}, {1446, 6}, {1440, 7}, {1433, 7}, {1426, 6}, {1420, 6},
|
||||
{1414, 7}, {1407, 6}, {1401, 6}, {1395, 7}, {1388, 6}, {1382, 6}, {1376, 6}, {1370, 6},
|
||||
{1364, 6}, {1358, 6}, {1352, 6}, {1346, 5}, {1341, 6}, {1335, 6}, {1329, 5}, {1324, 6},
|
||||
{1318, 5}, {1313, 6}, {1307, 5}, {1302, 6}, {1296, 5}, {1291, 5}, {1286, 6}, {1280, 5},
|
||||
{1275, 5}, {1270, 5}, {1265, 5}, {1260, 5}, {1255, 5}, {1250, 5}, {1245, 5}, {1240, 5},
|
||||
{1235, 5}, {1230, 5}, {1225, 5}, {1220, 5}, {1215, 4}, {1211, 5}, {1206, 5}, {1201, 5},
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
227
Sprinter/store_eeprom.cpp
Normal file
227
Sprinter/store_eeprom.cpp
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/*
|
||||
EEPROM routines to save Sprinter Settings
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "Sprinter.h"
|
||||
#include "store_eeprom.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
#ifdef PIDTEMP
|
||||
extern unsigned int PID_Kp, PID_Ki, PID_Kd;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_EEPROM_SETTINGS
|
||||
|
||||
//======================================================================================
|
||||
//========================= Read / Write EEPROM =======================================
|
||||
template <class T> int EEPROM_write_setting(int address, const T& value)
|
||||
{
|
||||
const byte* p = (const byte*)(const void*)&value;
|
||||
int i;
|
||||
for (i = 0; i < (int)sizeof(value); i++)
|
||||
eeprom_write_byte((unsigned char *)address++, *p++);
|
||||
return i;
|
||||
}
|
||||
|
||||
template <class T> int EEPROM_read_setting(int address, T& value)
|
||||
{
|
||||
byte* p = (byte*)(void*)&value;
|
||||
int i;
|
||||
for (i = 0; i < (int)sizeof(value); i++)
|
||||
*p++ = eeprom_read_byte((unsigned char *)address++);
|
||||
return i;
|
||||
}
|
||||
//======================================================================================
|
||||
|
||||
|
||||
void EEPROM_StoreSettings()
|
||||
{
|
||||
char ver[4]= "000";
|
||||
EEPROM_write_setting(EEPROM_OFFSET, ver); // invalidate data first
|
||||
EEPROM_write_setting(axis_steps_per_unit_address, axis_steps_per_unit);
|
||||
EEPROM_write_setting(max_feedrate_address, max_feedrate);
|
||||
EEPROM_write_setting(max_acceleration_units_per_sq_second_address, max_acceleration_units_per_sq_second);
|
||||
EEPROM_write_setting(move_acceleration_address, move_acceleration);
|
||||
EEPROM_write_setting(retract_acceleration_address, retract_acceleration);
|
||||
EEPROM_write_setting(minimumfeedrate_address, minimumfeedrate);
|
||||
EEPROM_write_setting(mintravelfeedrate_address, mintravelfeedrate);
|
||||
EEPROM_write_setting(min_seg_time_address, min_seg_time); //Min Segment Time, not used yet
|
||||
EEPROM_write_setting(max_xy_jerk_address, max_xy_jerk);
|
||||
EEPROM_write_setting(max_z_jerk_address, max_z_jerk);
|
||||
EEPROM_write_setting(max_e_jerk_address, max_e_jerk);
|
||||
|
||||
//PID Settings
|
||||
#ifdef PIDTEMP
|
||||
EEPROM_write_setting(Kp_address, PID_Kp); //Kp
|
||||
EEPROM_write_setting(Ki_address, PID_Ki); //Ki
|
||||
EEPROM_write_setting(Kd_address, PID_Kd); //Kd
|
||||
#else
|
||||
EEPROM_write_setting(Kp_address, 2048); //Kp
|
||||
EEPROM_write_setting(Ki_address, 32); //Ki
|
||||
EEPROM_write_setting(Kd_address, 2048); //Kd
|
||||
#endif
|
||||
|
||||
|
||||
char ver2[4]=EEPROM_VERSION;
|
||||
EEPROM_write_setting(EEPROM_OFFSET, ver2); // validate data
|
||||
showString(PSTR("Settings Stored\r\n"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EEPROM_printSettings()
|
||||
{
|
||||
#ifdef PRINT_EEPROM_SETTING
|
||||
showString(PSTR("Steps per unit:\r\n"));
|
||||
showString(PSTR(" M92 X"));
|
||||
Serial.print(axis_steps_per_unit[0]);
|
||||
showString(PSTR(" Y"));
|
||||
Serial.print(axis_steps_per_unit[1]);
|
||||
showString(PSTR(" Z"));
|
||||
Serial.print(axis_steps_per_unit[2]);
|
||||
showString(PSTR(" E"));
|
||||
Serial.println(axis_steps_per_unit[3]);
|
||||
|
||||
showString(PSTR("Maximum feedrates (mm/s):\r\n"));
|
||||
showString(PSTR(" M202 X"));
|
||||
Serial.print(max_feedrate[0]);
|
||||
showString(PSTR(" Y"));
|
||||
Serial.print(max_feedrate[1]);
|
||||
showString(PSTR(" Z"));
|
||||
Serial.print(max_feedrate[2]);
|
||||
showString(PSTR(" E"));
|
||||
Serial.println(max_feedrate[3]);
|
||||
|
||||
showString(PSTR("Maximum Acceleration (mm/s2):\r\n"));
|
||||
showString(PSTR(" M201 X"));
|
||||
Serial.print(max_acceleration_units_per_sq_second[0] );
|
||||
showString(PSTR(" Y"));
|
||||
Serial.print(max_acceleration_units_per_sq_second[1] );
|
||||
showString(PSTR(" Z"));
|
||||
Serial.print(max_acceleration_units_per_sq_second[2] );
|
||||
showString(PSTR(" E"));
|
||||
Serial.println(max_acceleration_units_per_sq_second[3]);
|
||||
|
||||
showString(PSTR("Acceleration: S=acceleration, T=retract acceleration\r\n"));
|
||||
showString(PSTR(" M204 S"));
|
||||
Serial.print(move_acceleration );
|
||||
showString(PSTR(" T"));
|
||||
Serial.println(retract_acceleration);
|
||||
|
||||
showString(PSTR("Advanced variables (mm/s): S=Min feedrate, T=Min travel feedrate, X=max xY jerk, Z=max Z jerk, E=max E jerk\r\n"));
|
||||
|
||||
showString(PSTR(" M205 S"));
|
||||
Serial.print(minimumfeedrate );
|
||||
showString(PSTR(" T" ));
|
||||
Serial.print(mintravelfeedrate );
|
||||
// showString(PSTR(" B"));
|
||||
// Serial.print(min_seg_time );
|
||||
showString(PSTR(" X"));
|
||||
Serial.print(max_xy_jerk );
|
||||
showString(PSTR(" Z"));
|
||||
Serial.print(max_z_jerk);
|
||||
showString(PSTR(" E"));
|
||||
Serial.println(max_e_jerk);
|
||||
|
||||
|
||||
#ifdef PIDTEMP
|
||||
|
||||
showString(PSTR("PID settings:\r\n"));
|
||||
showString(PSTR(" M301 P"));
|
||||
Serial.print(PID_Kp);
|
||||
showString(PSTR(" I"));
|
||||
Serial.print(PID_Ki);
|
||||
showString(PSTR(" D"));
|
||||
Serial.println(PID_Kd);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EEPROM_RetrieveSettings(bool def, bool printout)
|
||||
{ // if def=true, the default values will be used
|
||||
|
||||
int i=EEPROM_OFFSET;
|
||||
char stored_ver[4];
|
||||
char ver[4]=EEPROM_VERSION;
|
||||
|
||||
EEPROM_read_setting(EEPROM_OFFSET,stored_ver); //read stored version
|
||||
if ((!def)&&(strncmp(ver,stored_ver,3)==0))
|
||||
{ // version number match
|
||||
EEPROM_read_setting(axis_steps_per_unit_address, axis_steps_per_unit);
|
||||
EEPROM_read_setting(max_feedrate_address, max_feedrate);
|
||||
EEPROM_read_setting(max_acceleration_units_per_sq_second_address, max_acceleration_units_per_sq_second);
|
||||
EEPROM_read_setting(move_acceleration_address, move_acceleration);
|
||||
EEPROM_read_setting(retract_acceleration_address, retract_acceleration);
|
||||
EEPROM_read_setting(minimumfeedrate_address, minimumfeedrate);
|
||||
EEPROM_read_setting(mintravelfeedrate_address, mintravelfeedrate);
|
||||
EEPROM_read_setting(min_seg_time_address, min_seg_time); //min Segmenttime --> not used yet
|
||||
EEPROM_read_setting(max_xy_jerk_address, max_xy_jerk);
|
||||
EEPROM_read_setting(max_z_jerk_address, max_z_jerk);
|
||||
EEPROM_read_setting(max_e_jerk_address, max_e_jerk);
|
||||
|
||||
#ifdef PIDTEMP
|
||||
EEPROM_read_setting(Kp_address, PID_Kp);
|
||||
EEPROM_read_setting(Ki_address, PID_Ki);
|
||||
EEPROM_read_setting(Kd_address, PID_Kd);
|
||||
#endif
|
||||
|
||||
showString(PSTR("Stored settings retreived\r\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
float tmp1[]=_AXIS_STEP_PER_UNIT;
|
||||
float tmp2[]=_MAX_FEEDRATE;
|
||||
long tmp3[]=_MAX_ACCELERATION_UNITS_PER_SQ_SECOND;
|
||||
for (short i=0;i<4;i++)
|
||||
{
|
||||
axis_steps_per_unit[i]=tmp1[i];
|
||||
max_feedrate[i]=tmp2[i];
|
||||
max_acceleration_units_per_sq_second[i]=tmp3[i];
|
||||
}
|
||||
move_acceleration=_ACCELERATION;
|
||||
retract_acceleration=_RETRACT_ACCELERATION;
|
||||
minimumfeedrate=DEFAULT_MINIMUMFEEDRATE;
|
||||
mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE;
|
||||
max_xy_jerk=_MAX_XY_JERK;
|
||||
max_z_jerk=_MAX_Z_JERK;
|
||||
max_e_jerk=_MAX_E_JERK;
|
||||
min_seg_time=_MIN_SEG_TIME;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
PID_Kp = PID_PGAIN;
|
||||
PID_Ki = PID_IGAIN;
|
||||
PID_Kd = PID_DGAIN;
|
||||
#endif
|
||||
|
||||
showString(PSTR("Using Default settings\r\n"));
|
||||
}
|
||||
|
||||
if(printout)
|
||||
{
|
||||
EEPROM_printSettings();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
65
Sprinter/store_eeprom.h
Normal file
65
Sprinter/store_eeprom.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
EEPROM routines to save Sprinter Settings
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __EEPROMH
|
||||
#define __EEPROMH
|
||||
|
||||
#define EEPROM_OFFSET 100
|
||||
|
||||
|
||||
// IMPORTANT: Whenever there are changes made to the variables stored in EEPROM
|
||||
// in the functions below, also increment the version number. This makes sure that
|
||||
// the default values are used whenever there is a change to the data, to prevent
|
||||
// wrong data being written to the variables.
|
||||
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
|
||||
#define EEPROM_VERSION "S03"
|
||||
|
||||
|
||||
extern float axis_steps_per_unit[4];
|
||||
extern float max_feedrate[4];
|
||||
extern long max_acceleration_units_per_sq_second[4];
|
||||
extern float move_acceleration;
|
||||
extern float retract_acceleration;
|
||||
extern float mintravelfeedrate;
|
||||
extern float minimumfeedrate;
|
||||
extern float max_xy_jerk;
|
||||
extern float max_z_jerk;
|
||||
extern float max_e_jerk;
|
||||
extern unsigned long min_seg_time;
|
||||
|
||||
#define axis_steps_per_unit_address (EEPROM_OFFSET + 4*sizeof(char))
|
||||
#define max_feedrate_address (axis_steps_per_unit_address + 4*sizeof(float))
|
||||
#define max_acceleration_units_per_sq_second_address (max_feedrate_address + 4*sizeof(float))
|
||||
#define move_acceleration_address (max_acceleration_units_per_sq_second_address + 4*sizeof(long))
|
||||
#define retract_acceleration_address (move_acceleration_address + sizeof(float))
|
||||
#define mintravelfeedrate_address (retract_acceleration_address + sizeof(float))
|
||||
#define minimumfeedrate_address (mintravelfeedrate_address + sizeof(float))
|
||||
#define max_xy_jerk_address (minimumfeedrate_address + sizeof(float))
|
||||
#define max_z_jerk_address (max_xy_jerk_address + sizeof(float))
|
||||
#define max_e_jerk_address (max_z_jerk_address + sizeof(float))
|
||||
#define min_seg_time_address (max_e_jerk_address + sizeof(float))
|
||||
#define Kp_address (min_seg_time_address + sizeof(unsigned long))
|
||||
#define Ki_address (Kp_address + sizeof(unsigned int))
|
||||
#define Kd_address (Ki_address + sizeof(unsigned int))
|
||||
|
||||
extern void EEPROM_RetrieveSettings(bool def, bool printout );
|
||||
extern void EEPROM_printSettings();
|
||||
extern void EEPROM_StoreSettings();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -176,7 +176,7 @@ const short temptable_3[NUMTEMPS_3][2] = {
|
|||
#if (THERMISTORHEATER == 4) || (THERMISTORBED == 4) //10k thermistor
|
||||
|
||||
#define NUMTEMPS_4 20
|
||||
short temptable_4[NUMTEMPS_4][2] = {
|
||||
const short temptable_4[NUMTEMPS_4][2] = {
|
||||
{1, 430},
|
||||
{54, 137},
|
||||
{107, 107},
|
||||
|
|
@ -280,8 +280,8 @@ const short temptable_6[NUMTEMPS_6][2] = {
|
|||
{49, 220},
|
||||
{53, 215},
|
||||
{62, 210},
|
||||
{73, 205},
|
||||
{72, 200},
|
||||
{71, 205}, //fitted graphically
|
||||
{78, 200}, //fitted graphically
|
||||
{94, 190},
|
||||
{102, 185},
|
||||
{116, 170},
|
||||
|
|
@ -311,7 +311,7 @@ const short temptable_6[NUMTEMPS_6][2] = {
|
|||
#endif
|
||||
|
||||
#if (THERMISTORHEATER == 7) || (THERMISTORBED == 7) // 100k Honeywell 135-104LAG-J01
|
||||
#define NUMTEMPS_7 54
|
||||
#define NUMTEMPS_7 55
|
||||
const short temptable_7[NUMTEMPS_7][2] = {
|
||||
{46, 270},
|
||||
{50, 265},
|
||||
|
|
@ -366,7 +366,9 @@ const short temptable_7[NUMTEMPS_7][2] = {
|
|||
{989, 20},
|
||||
{994, 15},
|
||||
{1001, 10},
|
||||
{1005, 5}
|
||||
{1005, 5},
|
||||
{1021, 0} //safety
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue