Browse Source

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.

pull/1/head
daid303 12 years ago
parent
commit
94ea26ff46
  1. 11
      Marlin/Marlin.h
  2. 14
      Marlin/Marlin_main.cpp
  3. 1
      Marlin/cardreader.h
  4. 12
      Marlin/planner.cpp
  5. 2
      Marlin/stepper.cpp
  6. 2
      Marlin/temperature.cpp

11
Marlin/Marlin.h

@ -179,11 +179,20 @@ void setPwmFrequency(uint8_t pin, int val);
extern float homing_feedrate[];
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 add_homeing[3];
extern float min_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 stoptime;

14
Marlin/Marlin_main.cpp

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

1
Marlin/cardreader.h

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

12
Marlin/planner.cpp

@ -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_nominal_speed; // Nominal speed of previous path line segment
extern volatile int extrudemultiply; // Sets extrude multiply factor (in percent)
#ifdef AUTOTEMP
float autotemp_max=250;
float autotemp_min=210;
@ -462,8 +460,8 @@ void check_axes_activity()
else
{
#if FAN_PIN > -1
if (FanSpeed != 0){
analogWrite(FAN_PIN,FanSpeed); // If buffer is empty use current fan speed
if (fanSpeed != 0){
analogWrite(FAN_PIN,fanSpeed); // If buffer is empty use current fan speed
}
#endif
}
@ -477,12 +475,12 @@ void check_axes_activity()
disable_e2();
}
#if FAN_PIN > -1
if((FanSpeed == 0) && (fan_speed ==0))
if((fanSpeed == 0) && (fan_speed ==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);
}
@ -562,7 +560,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
return;
}
block->fan_speed = FanSpeed;
block->fan_speed = fanSpeed;
// Compute direction bits for this block
block->direction_bits = 0;

2
Marlin/stepper.cpp

@ -78,7 +78,7 @@ static bool old_z_max_endstop=false;
static bool check_endstops = true;
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 ============================

2
Marlin/temperature.cpp

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

Loading…
Cancel
Save