Some minor changes on code style. And a bugfix where the counters for positioning in the stepper where wrong depending on compiler settings. (Caused strange values to reported back with M114 and endstop triggers). Also fixed compiling with FWRETRACT enabled.

This commit is contained in:
daid303 2012-12-03 12:13:20 +01:00
parent 6c51fe5039
commit 94ea26ff46
6 changed files with 24 additions and 18 deletions

View File

@ -179,11 +179,20 @@ void setPwmFrequency(uint8_t pin, int val);
extern float homing_feedrate[]; extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply;
extern int extrudemultiply; // Sets extrude multiply factor (in percent)
extern float current_position[NUM_AXIS] ; extern float current_position[NUM_AXIS] ;
extern float add_homeing[3]; extern float add_homeing[3];
extern float min_pos[3]; extern float min_pos[3];
extern float max_pos[3]; extern float max_pos[3];
extern unsigned char FanSpeed; extern int fanSpeed;
#ifdef FWRETRACT
extern bool autoretract_enabled;
extern bool retracted;
extern float retract_length, retract_feedrate, retract_zlift;
extern float retract_recover_length, retract_recover_feedrate;
#endif
extern unsigned long starttime; extern unsigned long starttime;
extern unsigned long stoptime; extern unsigned long stoptime;

View File

@ -146,16 +146,15 @@ CardReader card;
#endif #endif
float homing_feedrate[] = HOMING_FEEDRATE; float homing_feedrate[] = HOMING_FEEDRATE;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES; bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
volatile int feedmultiply=100; //100->1 200->2 int feedmultiply=100; //100->1 200->2
int saved_feedmultiply; int saved_feedmultiply;
volatile bool feedmultiplychanged=false; int extrudemultiply=100; //100->1 200->2
volatile int extrudemultiply=100; //100->1 200->2
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 }; float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
float add_homeing[3]={0,0,0}; float add_homeing[3]={0,0,0};
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }; float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
uint8_t active_extruder = 0; uint8_t active_extruder = 0;
unsigned char FanSpeed=0; int fanSpeed=0;
#ifdef FWRETRACT #ifdef FWRETRACT
bool autoretract_enabled=true; bool autoretract_enabled=true;
@ -1124,14 +1123,14 @@ void process_commands()
#if FAN_PIN > -1 #if FAN_PIN > -1
case 106: //M106 Fan On case 106: //M106 Fan On
if (code_seen('S')){ if (code_seen('S')){
FanSpeed=constrain(code_value(),0,255); fanSpeed=constrain(code_value(),0,255);
} }
else { else {
FanSpeed=255; fanSpeed=255;
} }
break; break;
case 107: //M107 Fan Off case 107: //M107 Fan Off
FanSpeed = 0; fanSpeed = 0;
break; break;
#endif //FAN_PIN #endif //FAN_PIN
@ -1372,7 +1371,6 @@ void process_commands()
if(code_seen('S')) if(code_seen('S'))
{ {
feedmultiply = code_value() ; feedmultiply = code_value() ;
feedmultiplychanged=true;
} }
} }
break; break;

View File

@ -66,6 +66,7 @@ private:
char* diveDirName; char* diveDirName;
void lsDive(const char *prepend,SdFile parent); void lsDive(const char *prepend,SdFile parent);
}; };
extern CardReader card;
#define IS_SD_PRINTING (card.sdprinting) #define IS_SD_PRINTING (card.sdprinting)
#else #else

View File

@ -80,8 +80,6 @@ long position[4]; //rescaled from extern when axis_steps_per_unit are changed
static float previous_speed[4]; // Speed of previous path line segment static float previous_speed[4]; // Speed of previous path line segment
static float previous_nominal_speed; // Nominal speed of previous path line segment static float previous_nominal_speed; // Nominal speed of previous path line segment
extern volatile int extrudemultiply; // Sets extrude multiply factor (in percent)
#ifdef AUTOTEMP #ifdef AUTOTEMP
float autotemp_max=250; float autotemp_max=250;
float autotemp_min=210; float autotemp_min=210;
@ -462,8 +460,8 @@ void check_axes_activity()
else else
{ {
#if FAN_PIN > -1 #if FAN_PIN > -1
if (FanSpeed != 0){ if (fanSpeed != 0){
analogWrite(FAN_PIN,FanSpeed); // If buffer is empty use current fan speed analogWrite(FAN_PIN,fanSpeed); // If buffer is empty use current fan speed
} }
#endif #endif
} }
@ -477,12 +475,12 @@ void check_axes_activity()
disable_e2(); disable_e2();
} }
#if FAN_PIN > -1 #if FAN_PIN > -1
if((FanSpeed == 0) && (fan_speed ==0)) if((fanSpeed == 0) && (fan_speed ==0))
{ {
analogWrite(FAN_PIN, 0); analogWrite(FAN_PIN, 0);
} }
if (FanSpeed != 0 && tail_fan_speed !=0) if (fanSpeed != 0 && tail_fan_speed !=0)
{ {
analogWrite(FAN_PIN,tail_fan_speed); analogWrite(FAN_PIN,tail_fan_speed);
} }
@ -562,7 +560,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
return; return;
} }
block->fan_speed = FanSpeed; block->fan_speed = fanSpeed;
// Compute direction bits for this block // Compute direction bits for this block
block->direction_bits = 0; block->direction_bits = 0;

View File

@ -78,7 +78,7 @@ static bool old_z_max_endstop=false;
static bool check_endstops = true; static bool check_endstops = true;
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0}; volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1}; volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
//=========================================================================== //===========================================================================
//=============================functions ============================ //=============================functions ============================

View File

@ -567,7 +567,7 @@ float analog2temp(int raw, uint8_t e) {
} }
#endif #endif
if(heater_ttbl_map[e] != 0) if(heater_ttbl_map[e] != NULL)
{ {
float celsius = 0; float celsius = 0;
byte i; byte i;