Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/work092' into work092
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/ArduinoAVR/Repetier/Printer.cpp
  • Loading branch information
jay committed Oct 28, 2015
2 parents 9a19440 + 73abf26 commit 1e26b6e
Show file tree
Hide file tree
Showing 38 changed files with 12,618 additions and 468 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Version 0.92
Extra motor drivers.
Event system for lights etc.
New homing sequence with preheat for nozzle based z sensors.
Language selectable on runtime.

Version 0.91.8
New languages french and Czech
Expand Down
16 changes: 12 additions & 4 deletions src/ArduinoAVR/Repetier/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ void Commands::printCurrentPosition(FSTRINGPARAM(s))

void Commands::printTemperatures(bool showRaw)
{
#if NUM_EXTRUDER > 0
float temp = Extruder::current->tempControl.currentTemperatureC;
#if HEATED_BED_SENSOR_TYPE == 0
Com::printF(Com::tTColon,temp);
Expand Down Expand Up @@ -198,8 +199,15 @@ void Commands::printTemperatures(bool showRaw)
Com::printF(Com::tColon,(1023 << (2 - ANALOG_REDUCE_BITS)) - extruder[i].tempControl.currentTemperature);
}
}
#else if NUM_EXTRUDER == 1
if(showRaw)
{
Com::printF(Com::tSpaceRaw,(int)0);
Com::printF(Com::tColon,(1023 << (2 - ANALOG_REDUCE_BITS)) - extruder[0].tempControl.currentTemperature);
}
#endif
Com::println();
#endif
}
void Commands::changeFeedrateMultiply(int factor)
{
Expand Down Expand Up @@ -1333,6 +1341,7 @@ void Commands::processGCode(GCode *com)
EEPROM::setDeltaTowerZOffsetSteps(offz);
}
#endif
PrintLine::moveRelativeDistanceInSteps(0, 0, -5*Printer::axisStepsPerMM[Z_AXIS], 0, Printer::homingFeedrate[Z_AXIS], true, true);
Printer::homeAxis(true,true,true);
}
break;
Expand Down Expand Up @@ -1756,15 +1765,14 @@ void Commands::processMCode(GCode *com)
}
if(Printer::debugDryrun()) // simulate movements without printing
{
Extruder::setTemperatureForExtruder(0, 0);
#if NUM_EXTRUDER>1
#if NUM_EXTRUDER > 1
for(uint8_t i = 0; i < NUM_EXTRUDER; i++)
Extruder::setTemperatureForExtruder(0, i);
#else
Extruder::setTemperatureForExtruder(0, 0);
#endif
#if HEATED_BED_TYPE!=0
target_bed_raw = 0;
#if HEATED_BED_TYPE != 0
Extruder::setHeatedBedTemperature(0,false);
#endif
}
break;
Expand Down
14 changes: 9 additions & 5 deletions src/ArduinoAVR/Repetier/Communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@
uint8_t Com::selectedLanguage;
#endif

#ifndef MACHINE_TYPE
#if DRIVE_SYSTEM == DELTA
FSTRINGVALUE(Com::tFirmware,"FIRMWARE_NAME:Repetier_" REPETIER_VERSION " FIRMWARE_URL:https://github.com/repetier/Repetier-Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Delta EXTRUDER_COUNT:" XSTR(NUM_EXTRUDER) " REPETIER_PROTOCOL:3")
#define MACHINE_TYPE "Delta"
#elif DRIVE_SYSTEM == CARTESIAN
#define MACHINE_TYPE "Mendel"
#else
#if DRIVE_SYSTEM == CARTESIAN
FSTRINGVALUE(Com::tFirmware,"FIRMWARE_NAME:Repetier_" REPETIER_VERSION " FIRMWARE_URL:https://github.com/repetier/Repetier-Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:" XSTR(NUM_EXTRUDER) " REPETIER_PROTOCOL:3")
#else
FSTRINGVALUE(Com::tFirmware,"FIRMWARE_NAME:Repetier_" REPETIER_VERSION " FIRMWARE_URL:https://github.com/repetier/Repetier-Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Core_XY EXTRUDER_COUNT:" XSTR(NUM_EXTRUDER) " REPETIER_PROTOCOL:3")
#define MACHINE_TYPE "Core_XY"
#endif
#endif
#ifndef FIRMWARE_URL
#define FIRMWARE_URL "https://github.com/repetier/Repetier-Firmware/"
#endif // FIRMWARE_URL
FSTRINGVALUE(Com::tFirmware,"FIRMWARE_NAME:Repetier_" REPETIER_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:1.0 MACHINE_TYPE:" MACHINE_TYPE " EXTRUDER_COUNT:" XSTR(NUM_EXTRUDER) " REPETIER_PROTOCOL:3")
FSTRINGVALUE(Com::tDebug,"Debug:")
FSTRINGVALUE(Com::tOk,"ok")
FSTRINGVALUE(Com::tNewline,"\r\n")
Expand Down
19 changes: 17 additions & 2 deletions src/ArduinoAVR/Repetier/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ Overridden if EEPROM activated.*/
// 3 is mendel-parts thermistor (EPCOS G550)
// 4 is 10k thermistor
// 8 is ATC Semitec 104GT-2
// 12 is 100k RS thermistor 198-961
// 13 is PT100 for E3D/Ultimaker
// 5 is userdefined thermistor table 0
// 6 is userdefined thermistor table 1
Expand Down Expand Up @@ -496,6 +497,15 @@ Retractions speeds are taken from RETRACTION_SPEED and RETRACTION_UNDO_SPEED
#define FILAMENTCHANGE_SHORTRETRACT 30
#define FILAMENTCHANGE_LONGRETRACT 30

/* Define how we detect jam/out of filament
1 = Distance between signal changes increase
2 = signal gets high
3 = signal gets low
2 and 3 are not jam detections, but only out of filament detection by a switch
that changes the signal!
*/
#define JAM_METHOD 1
// Steps normally needed for a full signal cycle.
#define JAM_STEPS 220
// Steps for reducing speed. Must be higher then JAM_STEPS
Expand Down Expand Up @@ -1221,8 +1231,8 @@ IMPORTANT: With mode <>0 some changes in Configuration.h are not set any more, a

/**************** duplicate motor driver ***************
If you have an unused extruder stepper free, you could use it to drive the second z motor
instead of driving both with a single stepper. The same works for the other axis if needed.
If you have unused extruder steppers free, you could use it to drive the second or third z motor
instead of driving them with a single stepper. The same works for the other axis if needed.
*/

#define FEATURE_TWO_XSTEPPER 0
Expand All @@ -1240,6 +1250,11 @@ instead of driving both with a single stepper. The same works for the other axis
#define Z2_DIR_PIN E1_DIR_PIN
#define Z2_ENABLE_PIN E1_ENABLE_PIN

#define FEATURE_THREE_ZSTEPPER 0
#define Z3_STEP_PIN E2_STEP_PIN
#define Z3_DIR_PIN E2_DIR_PIN
#define Z3_ENABLE_PIN E2_ENABLE_PIN

/* Ditto printing allows 2 extruders to do the same action. This effectively allows
to print an object two times at the speed of one. Works only with dual extruder setup.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/ArduinoAVR/Repetier/Eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ have problems with other modules using the eeprom */
#define EEPROM_BYTE(x) HAL::eprGetByte(EPR_##x)
#define EEPROM_SET_BYTE(x,val) HAL::eprSetByte(EPR_##x,val)
#else
#define EEPROM_FLOAT(x) (x)
#define EEPROM_INT32(x) (x)
#define EEPROM_BYTE(x) (x)
#define EEPROM_FLOAT(x) (float)(x)
#define EEPROM_INT32(x) (int32_t)(x)
#define EEPROM_BYTE(x) (uint8_t)(x)
#define EEPROM_SET_BYTE(x,val)
#endif

Expand Down
13 changes: 8 additions & 5 deletions src/ArduinoAVR/Repetier/Extruder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,14 @@ void Extruder::setTemperatureForExtruder(float temperatureInCelsius, uint8_t ext
{
TemperatureController *tc2 = tempController[1];
tc2->setTargetTemperature(temperatureInCelsius);
tc2->updateTempControlVars();
if(temperatureInCelsius >= EXTRUDER_FAN_COOL_TEMP) extruder[1].coolerPWM = extruder[1].coolerSpeed;
#if NUM_EXTRUDER > 2
if(Extruder::dittoMode > 1 && extr == 0)
{
TemperatureController *tc2 = tempController[2];
tc2->setTargetTemperature(temperatureInCelsius);
tc2->updateTempControlVars();
if(temperatureInCelsius >= EXTRUDER_FAN_COOL_TEMP) extruder[2].coolerPWM = extruder[2].coolerSpeed;
}
#endif
Expand All @@ -639,6 +641,7 @@ void Extruder::setTemperatureForExtruder(float temperatureInCelsius, uint8_t ext
{
TemperatureController *tc2 = tempController[3];
tc2->setTargetTemperature(temperatureInCelsius);
tc2->updateTempControlVars();
if(temperatureInCelsius >= EXTRUDER_FAN_COOL_TEMP) extruder[3].coolerPWM = extruder[3].coolerSpeed;
}
#endif
Expand Down Expand Up @@ -1299,7 +1302,7 @@ const short temptable_4[NUMTEMPS_4][2] PROGMEM =
{478*4, 46*8},{531*4, 41*8},{584*4, 35*8},{637*4, 30*8},{690*4, 25*8},{743*4, 20*8},{796*4, 14*8},{849*4, 7*8},{902*4, 0*8},
{955*4, -11*8},{1008*4, -35*8}
};

// ATC 104GT
#define NUMTEMPS_8 34
const short temptable_8[NUMTEMPS_8][2] PROGMEM =
{
Expand Down Expand Up @@ -1342,9 +1345,9 @@ const short temptable_12[NUMTEMPS_12][2] PROGMEM =
{701*4, 86*8},{736*4, 81*8},{771*4, 76*8},{806*4, 70*8},{841*4, 63*8},{876*4, 56*8},{911*4, 48*8},{946*4, 38*8},{981*4, 23*8},{1005*4, 5*8},{1016*4, 0*8}
};
#define NUMTEMPS_13 19
const short temptable_13[NUMTEMPS_12][2] PROGMEM =
const short temptable_13[NUMTEMPS_13][2] PROGMEM =
{
{0,0},{908,8},{941,410*8},{982,20*8},{1015,8*30},{1048,8*40},{1080,8*50},{1113,8*60},{1146,8*70},{1178,8*80},{11211,8*90},{1276,8*110},{1318,8*120}
{0,0},{908,8},{942,10*8},{982,20*8},{1015,8*30},{1048,8*40},{1080,8*50},{1113,8*60},{1146,8*70},{1178,8*80},{11211,8*90},{1276,8*110},{1318,8*120}
,{1670,8*230},{2455,8*500},{3445,8*900},{3666,8*1000},{3871,8*1100},{4095,8*2000}
};
#if NUM_TEMPS_USERTHERMISTOR0 > 0
Expand Down Expand Up @@ -1654,13 +1657,13 @@ void TemperatureController::setTargetTemperature(float target)
short oldraw = pgm_read_word(&temptable[0]);
short oldtemp = pgm_read_word(&temptable[1]);
short newraw = 0,newtemp;
while(i<num)
while(i < num)
{
newraw = pgm_read_word(&temptable[i++]);
newtemp = pgm_read_word(&temptable[i++]);
if (newtemp > temp)
{
targetTemperature = oldraw + (int32_t)(oldtemp-temp) * (int32_t)(oldraw-newraw) / (oldtemp-newtemp);
targetTemperature = oldraw + (int32_t)(oldtemp - temp) * (int32_t)(oldraw - newraw) / (oldtemp-newtemp);
return;
}
oldtemp = newtemp;
Expand Down
14 changes: 13 additions & 1 deletion src/ArduinoAVR/Repetier/Extruder.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class Extruder;
extern Extruder extruder[];

#if EXTRUDER_JAM_CONTROL
#if JAM_METHOD == 1
#define _TEST_EXTRUDER_JAM(x,pin) {\
uint8_t sig = READ(pin);extruder[x].jamStepsSinceLastSignal += extruder[x].jamLastDir;\
if(extruder[x].jamLastSignal != sig && abs(extruder[x].jamStepsSinceLastSignal - extruder[x].jamLastChangeAt) > JAM_MIN_STEPS) {\
Expand All @@ -156,10 +157,21 @@ extern Extruder extruder[];
} else if(abs(extruder[x].jamStepsSinceLastSignal) > JAM_ERROR_STEPS && !Printer::isDebugJamOrDisabled() && !extruder[x].tempControl.isJammed()) \
extruder[x].tempControl.setJammed(true);\
}
#define RESET_EXTRUDER_JAM(x,dir) extruder[x].jamLastDir = dir ? 1 : -1;
#elif JAM_METHOD == 2
#define _TEST_EXTRUDER_JAM(x,pin) {\
uint8_t sig = READ(pin);\
if(sig){extruder[x].tempControl.setJammed(true);} else if(!Printer::isDebugJamOrDisabled() && !extruder[x].tempControl.isJammed()) {extruder[x].resetJamSteps();}
#elif JAM_METHOD == 3
#define _TEST_EXTRUDER_JAM(x,pin) {\
uint8_t sig = !READ(pin);\
if(sig){extruder[x].tempControl.setJammed(true);} else if(!Printer::isDebugJamOrDisabled() && !extruder[x].tempControl.isJammed()) {extruder[x].resetJamSteps();}
#else
#error Unknown value for JAM_METHOD
#endif
#define ___TEST_EXTRUDER_JAM(x,y) _TEST_EXTRUDER_JAM(x,y)
#define __TEST_EXTRUDER_JAM(x) ___TEST_EXTRUDER_JAM(x,EXT ## x ## _JAM_PIN)
#define TEST_EXTRUDER_JAM(x) __TEST_EXTRUDER_JAM(x)
#define RESET_EXTRUDER_JAM(x,dir) extruder[x].jamLastDir = dir ? 1 : -1;
#else
#define TEST_EXTRUDER_JAM(x)
#define RESET_EXTRUDER_JAM(x,dir)
Expand Down
9 changes: 4 additions & 5 deletions src/ArduinoAVR/Repetier/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1168,15 +1168,14 @@ ISR(USART_UDRE_vect)
{
// There is more data in the output buffer. Send the next byte
uint8_t c = tx_buffer.buffer[tx_buffer.tail];
tx_buffer.tail = (tx_buffer.tail + 1) & SERIAL_TX_BUFFER_MASK;

#if defined(UDR0)
UDR0 = c;
#elif defined(UDR)
UDR = c;
#else
#error UDR not defined
#endif
tx_buffer.tail = (tx_buffer.tail + 1) & SERIAL_TX_BUFFER_MASK;
}
}
#endif
Expand Down Expand Up @@ -1368,7 +1367,7 @@ int RFHardwareSerial::available(void)
}
int RFHardwareSerial::outputUnused(void)
{
return SERIAL_TX_BUFFER_SIZE-(unsigned int)((SERIAL_TX_BUFFER_SIZE + _tx_buffer->head - _tx_buffer->tail) & SERIAL_TX_BUFFER_MASK);
return SERIAL_TX_BUFFER_SIZE - (unsigned int)((SERIAL_TX_BUFFER_SIZE + _tx_buffer->head - _tx_buffer->tail) & SERIAL_TX_BUFFER_MASK);
}

int RFHardwareSerial::peek(void)
Expand Down Expand Up @@ -1411,9 +1410,9 @@ RFHardwareSerial::write(uint8_t c)

// If the output buffer is full, there's nothing for it other than to
// wait for the interrupt handler to empty it a bit
while (i == _tx_buffer->tail) ;
while (i == _tx_buffer->tail) {}
#if defined(BLUETOOTH_SERIAL) && BLUETOOTH_SERIAL > 0
while (i == txx_buffer_tail) ;
while (i == txx_buffer_tail) {}
#endif
_tx_buffer->buffer[_tx_buffer->head] = c;
_tx_buffer->head = i;
Expand Down
9 changes: 8 additions & 1 deletion src/ArduinoAVR/Repetier/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ All known arduino boards use 64. This value is needed for the extruder timing. *
#endif
#include <inttypes.h>
#include "Print.h"

#ifdef EXTERNALSERIAL
#define SERIAL_RX_BUFFER_SIZE 128
#endif
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
Expand Down Expand Up @@ -175,8 +177,13 @@ typedef uint8_t ufast8_t;

#define SERIAL_BUFFER_SIZE 128
#define SERIAL_BUFFER_MASK 127
#ifdef BIG_OUTPUT_BUFFER
#define SERIAL_TX_BUFFER_SIZE 128
#define SERIAL_TX_BUFFER_MASK 127
#else
#define SERIAL_TX_BUFFER_SIZE 64
#define SERIAL_TX_BUFFER_MASK 63
#endif

struct ring_buffer
{
Expand Down
Loading

0 comments on commit 1e26b6e

Please sign in to comment.