#include "Marlin.h"
-
-
#include "ultralcd.h"
#include "planner.h"
#include "stepper.h"
#include "watchdog.h"
#include "EEPROMwrite.h"
-
-
-#define VERSION_STRING "1.0.0 Beta 1"
-
-
-
+#define VERSION_STRING "1.0.0 RC1"
// look here for descriptions of gcodes: http://linuxcnc.org/handbook/gcode/g-code.html
// http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
static float feedrate = 1500.0, next_feedrate, saved_feedrate;
static long gcode_N, gcode_LastN;
-
-
static bool relative_mode = false; //Determines Absolute or Relative Coordinates
static bool relative_mode_e = false; //Determines Absolute or Relative E Codes while in Absolute Coordinates mode. E is always relative in Relative Coordinates mode.
static uint8_t fanpwm=0;
-
-
static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
static bool fromsd[BUFSIZE];
static int bufindr = 0;
buflen += 1;
}
}
+
void setup_photpin()
{
#ifdef PHOTOGRAPH_PIN
#endif
}
-long millis_diff(unsigned long starttime) {
- unsigned long difftime = millis() - starttime;
- if (difftime > 0x8000) difftime += 0x8000;
- return difftime;
-}
-
void setup()
{
setup_powerhold();
LCD_STATUS;
}
-
void get_command()
{
while( MSerial.available() > 0 && buflen < BUFSIZE) {
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
st_synchronize();
-// codenum += millis(); // keep track of when we started waiting
+ codenum += millis(); // keep track of when we started waiting
previous_millis_cmd = millis();
- while(millis_diff(previous_millis_cmd) < codenum ){
+ while(millis() < codenum ){
manage_heater();
}
break;
#if (TEMP_0_PIN > -1)
SERIAL_PROTOCOLPGM("ok T:");
SERIAL_PROTOCOL(degHotend(tmp_extruder));
- #if TEMP_BED_PIN > -1
+ #if TEMP_BED_PIN > -1
SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL(degBed());
#endif //TEMP_BED_PIN
/* continue to loop until we have reached the target temp
_and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
while((residencyStart == -1) ||
- (residencyStart > -1 && (millis_diff(residencyStart) < TEMP_RESIDENCY_TIME*1000) )) {
+ (residencyStart > -1 && (millis() - residencyStart) < TEMP_RESIDENCY_TIME*1000) ) {
#else
while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) {
#endif //TEMP_RESIDENCY_TIME
- if(millis_diff(codenum) > 1000 )
+ if((millis() - codenum) > 1000 )
{ //Print Temp Reading and remaining time every 1 second while heating up/cooling down
SERIAL_PROTOCOLPGM("T:");
SERIAL_PROTOCOL( degHotend(tmp_extruder) );
SERIAL_PROTOCOLPGM(" W:");
if(residencyStart > -1)
{
- codenum = TEMP_RESIDENCY_TIME - (millis_diff(residencyStart) / 1000);
+ codenum = TEMP_RESIDENCY_TIME - ((millis() - residencyStart) / 1000);
SERIAL_PROTOCOLLN( codenum );
}
else
codenum = millis();
while(isHeatingBed())
{
- if( millis_diff(codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
+ if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
{
float tt=degHotend(active_extruder);
SERIAL_PROTOCOLPGM("T:");
bool all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))|| (code_seen(axis_codes[3])));
if(all_axis)
{
+ st_synchronize();
disable_e0();
disable_e1();
disable_e2();
void manage_inactivity(byte debug)
{
- if( millis_diff(previous_millis_cmd) > max_inactive_time )
+ if( (millis() - previous_millis_cmd) > max_inactive_time )
if(max_inactive_time)
kill();
if(stepper_inactive_time)
- if( millis_diff(last_stepperdisabled_time) > stepper_inactive_time )
+ if( (millis() - last_stepperdisabled_time) > stepper_inactive_time )
{
if(previous_millis_cmd>last_stepperdisabled_time)
last_stepperdisabled_time=previous_millis_cmd;
}
}
#ifdef EXTRUDER_RUNOUT_PREVENT
- if( millis_diff(previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
+ if( (millis() - previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
{
bool oldstatus=READ(E0_ENABLE_PIN);