summaryrefslogtreecommitdiff
path: root/Tonokip_Firmware
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2011-04-15 09:02:06 +0200
committerkliment <kliment.yanev@gmail.com>2011-04-15 09:02:06 +0200
commit00aa507248a05e772bccf1c3cb8e00b87d5fce6b (patch)
treef70100ce5fe6f846cd6d540b61957de2222401b6 /Tonokip_Firmware
parent6ec0bada6c713f4080f0f4ae7bd67259b0f1651e (diff)
Add support for Gen6, conditional SD and heated bed code, and mendelparts thermistor table
Diffstat (limited to 'Tonokip_Firmware')
-rw-r--r--Tonokip_Firmware/ThermistorTable_mendelparts.h32
-rw-r--r--Tonokip_Firmware/Tonokip_Firmware.pde33
-rw-r--r--Tonokip_Firmware/configuration.h5
-rw-r--r--Tonokip_Firmware/pins.h64
4 files changed, 124 insertions, 10 deletions
diff --git a/Tonokip_Firmware/ThermistorTable_mendelparts.h b/Tonokip_Firmware/ThermistorTable_mendelparts.h
new file mode 100644
index 0000000..68766ad
--- /dev/null
+++ b/Tonokip_Firmware/ThermistorTable_mendelparts.h
@@ -0,0 +1,32 @@
+#ifndef THERMISTORTABLE_H_
+#define THERMISTORTABLE_H_
+
+//thermistor table for mendel-parts thermistor
+
+#define NUMTEMPS 20
+short temptable[NUMTEMPS][2] = {
+ {1, 827},
+ {54, 253},
+ {107, 207},
+ {160, 182},
+ {213, 165},
+ {266, 152},
+ {319, 141},
+ {372, 132},
+ {425, 123},
+ {478, 115},
+ {531, 107},
+ {584, 100},
+ {637, 93},
+ {690, 86},
+ {743, 78},
+ {796, 70},
+ {849, 61},
+ {902, 49},
+ {955, 34},
+ {1008, 3}
+};
+
+
+#endif
+
diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde
index cdd0294..90c42d5 100644
--- a/Tonokip_Firmware/Tonokip_Firmware.pde
+++ b/Tonokip_Firmware/Tonokip_Firmware.pde
@@ -118,10 +118,11 @@ int16_t n;
void initsd(){
sdactive=false;
+#if SDSS>-1
if(root.isOpen())
root.close();
-if (!card.init(SPI_FULL_SPEED)){
- if (!card.init(SPI_HALF_SPEED))
+if (!card.init(SPI_FULL_SPEED,SDSS)){
+ if (!card.init(SPI_HALF_SPEED,SDSS))
Serial.println("SD init fail");
}
else if (!volume.init(&card))
@@ -130,7 +131,7 @@ else if (!root.openRoot(&volume))
Serial.println("openRoot failed");
else
sdactive=true;
-
+#endif
}
inline void write_command(char *buf){
@@ -203,9 +204,12 @@ void setup()
#ifdef SDSUPPORT
//power to SD reader
-pinMode(48,OUTPUT);
-digitalWrite(48,HIGH);
+#if SDPOWER > -1
+pinMode(SDPOWER,OUTPUT);
+digitalWrite(SDPOWER,HIGH);
+#endif
initsd();
+
#endif
@@ -596,14 +600,26 @@ inline void process_commands()
if (code_seen('S')) target_bed_raw = temp2analogBed(code_value());
break;
case 105: // M105
+ #if TEMP_0_PIN>-1
tt=analog2temp(analogRead(TEMP_0_PIN));
+ #endif
+ #if TEMP_1_PIN>-1
bt=analog2tempBed(analogRead(TEMP_1_PIN));
+ #endif
+ #if TEMP_0_PIN>-1
+
Serial.print("T:");
Serial.println(tt);
+ #if TEMP_1_PIN>-1
+
Serial.print("ok T:");
Serial.print(tt);
Serial.print(" B:");
Serial.println(bt);
+ #endif
+ #else
+ Serial.println("No thermistors - no temp");
+ #endif
return;
//break;
case 109: // M109 - Wait for heater to reach target.
@@ -942,7 +958,7 @@ inline void enable_e() { if(E_ENABLE_PIN > -1) digitalWrite(E_ENABLE_PIN, E_ENA
inline void manage_heater()
{
-
+ #if TEMP_0_PIN > -1
current_raw = analogRead(TEMP_0_PIN); // If using thermistor, when the heater is colder than targer temp, we get a higher analog reading than target,
if(USE_THERMISTOR) current_raw = 1023 - current_raw; // this switches it up so that the reading appears lower than target for the control logic.
@@ -968,12 +984,12 @@ inline void manage_heater()
digitalWrite(LED_PIN,HIGH);
}
#endif
-
+ #endif
if(millis()-previous_millis_bed_heater<5000)
return;
previous_millis_bed_heater = millis();
-
+ #if TEMP_1_PIN > -1
current_bed_raw = analogRead(TEMP_1_PIN); // If using thermistor, when the heater is colder than targer temp, we get a higher analog reading than target,
if(USE_THERMISTOR) current_bed_raw = 1023 - current_bed_raw; // this switches it up so that the reading appears lower than target for the control logic.
@@ -985,6 +1001,7 @@ inline void manage_heater()
{
digitalWrite(HEATER_1_PIN,HIGH);
}
+ #endif
}
// Takes hot end temperature value as input and returns corresponding analog value from RepRap thermistor temp table.
diff --git a/Tonokip_Firmware/configuration.h b/Tonokip_Firmware/configuration.h
index 5e12295..8d822bb 100644
--- a/Tonokip_Firmware/configuration.h
+++ b/Tonokip_Firmware/configuration.h
@@ -3,7 +3,7 @@
// NO RS485/EXTRUDER CONTROLLER SUPPORT
// PLEASE VERIFY PIN ASSIGNMENTS FOR YOUR CONFIGURATION!!!!!!!
-#define MOTHERBOARD 3 // ATMEGA168 0, SANGUINO 1, MOTHERBOARD = 2, MEGA 3, ATMEGA328 4
+#define MOTHERBOARD 3 // ATMEGA168 = 0, SANGUINO = 1, MOTHERBOARD = 2, MEGA/RAMPS = 3, ATMEGA328 = 4, Gen6 = 5
//Comment out to disable SD support
#define SDSUPPORT 1
@@ -72,9 +72,10 @@ const bool INVERT_E_DIR = false;
//#include "ThermistorTable_200k.h"
//#include "BedThermistorTable_200k.h"
-//Identical thermistors on heater and bed:
+//Identical thermistors on heater and bed - use this if you have no heated bed or if the thermistors are the same on both:
#include "ThermistorTable_200k.h"
//#include "ThermistorTable_100k.h"
+//#include "ThermistorTable_mendelparts.h"
#define BNUMTEMPS NUMTEMPS
#define bedtemptable temptable
diff --git a/Tonokip_Firmware/pins.h b/Tonokip_Firmware/pins.h
index 816fd96..70c2b1c 100644
--- a/Tonokip_Firmware/pins.h
+++ b/Tonokip_Firmware/pins.h
@@ -49,6 +49,8 @@
#define E_DIR_PIN 12
#define E_ENABLE_PIN -1
+#define SDPOWER -1
+#define SDSS -1
#define LED_PIN -1
#define FAN_PIN -1
#define PS_ON_PIN 15
@@ -118,6 +120,8 @@
#define E_DIR_PIN 16
#define E_ENABLE_PIN 3
+#define SDPOWER -1
+#define SDSS -1
#define LED_PIN 0
#define FAN_PIN -1
#define PS_ON_PIN -1
@@ -164,6 +168,8 @@
#define E_DIR_PIN 16
#define E_ENABLE_PIN -1
+#define SDPOWER -1
+#define SDSS 4
#define LED_PIN 0
#define SD_CARD_WRITE 2
@@ -222,6 +228,8 @@
#define E_DIR_PIN 34
#define E_ENABLE_PIN 30
+#define SDPOWER 48
+#define SDSS 53
#define LED_PIN 13
//#define FAN_PIN 11 // UNCOMMENT THIS LINE FOR V1.0
@@ -273,6 +281,8 @@
#define E_DIR_PIN 12
#define E_ENABLE_PIN -1
+#define SDPOWER -1
+#define SDSS -1
#define LED_PIN -1
#define FAN_PIN 5
#define PS_ON_PIN -1
@@ -284,6 +294,60 @@
+/****************************************************************************************
+* Gen6 pin assignment
+*
+****************************************************************************************/
+#elif MOTHERBOARD == 4
+
+#ifndef __AVR_ATmega644P__
+ #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
+#endif
+
+//x axis pins
+ #define X_STEP_PIN 15
+ #define X_DIR_PIN 18
+ #define X_ENABLE_PIN 19
+ #define X_MIN_PIN 20
+ #define X_MAX_PIN -1
+
+ //y axis pins
+ #define Y_STEP_PIN 23
+ #define Y_DIR_PIN 22
+ #define Y_ENABLE_PIN 24
+ #define Y_MIN_PIN 25
+ #define Y_MAX_PIN -1
+
+ //z axis pins
+ #define Z_STEP_PIN 27
+ #define Z_DIR_PIN 28
+ #define Z_ENABLE_PIN 29
+ #define Z_MIN_PIN 30
+ #define Z_MAX_PIN -1
+
+ //extruder pins
+ #define E_STEP_PIN 4 //Edited @ EJE Electronics 20100715
+ #define E_DIR_PIN 2 //Edited @ EJE Electronics 20100715
+ #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
+
+
+ #define SDPOWER -1
+ #define SDSS -1
+ #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.
+
+ #define DEBUG_PIN 0
+
+ //our RS485 pins
+ #define TX_ENABLE_PIN 12
+ #define RX_ENABLE_PIN 13
+
#else