Fix up the code to eliminate warnings

master
Scott Lahteine 10 years ago
parent 4385ac4f9d
commit 19d418cd6a

@ -388,7 +388,11 @@ const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
static float destination[NUM_AXIS] = { 0, 0, 0, 0 }; static float destination[NUM_AXIS] = { 0, 0, 0, 0 };
static float offset[3] = { 0, 0, 0 }; static float offset[3] = { 0, 0, 0 };
static bool home_all_axis = true;
#ifndef DELTA
static bool home_all_axis = true;
#endif
static float feedrate = 1500.0, next_feedrate, saved_feedrate; static float feedrate = 1500.0, next_feedrate, saved_feedrate;
static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0; static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
@ -396,8 +400,8 @@ static bool relative_mode = false; //Determines Absolute or Relative Coordinate
static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE]; static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
#ifdef SDSUPPORT #ifdef SDSUPPORT
static bool fromsd[BUFSIZE]; static bool fromsd[BUFSIZE];
#endif //!SDSUPPORT #endif
static int bufindr = 0; static int bufindr = 0;
static int bufindw = 0; static int bufindw = 0;
static int buflen = 0; static int buflen = 0;
@ -1233,10 +1237,6 @@ static void do_blocking_move_to(float x, float y, float z) {
feedrate = oldFeedRate; feedrate = oldFeedRate;
} }
static void do_blocking_move_relative(float offset_x, float offset_y, float offset_z) {
do_blocking_move_to(current_position[X_AXIS] + offset_x, current_position[Y_AXIS] + offset_y, current_position[Z_AXIS] + offset_z);
}
static void setup_for_endstop_move() { static void setup_for_endstop_move() {
saved_feedrate = feedrate; saved_feedrate = feedrate;
saved_feedmultiply = feedmultiply; saved_feedmultiply = feedmultiply;
@ -2150,7 +2150,6 @@ inline void gcode_G28() {
} }
int verbose_level = 1; int verbose_level = 1;
float x_tmp, y_tmp, z_tmp, real_z;
if (code_seen('V') || code_seen('v')) { if (code_seen('V') || code_seen('v')) {
verbose_level = code_value_long(); verbose_level = code_value_long();
@ -2436,6 +2435,7 @@ inline void gcode_G28() {
// When the bed is uneven, this height must be corrected. // When the bed is uneven, this height must be corrected.
if (!dryrun) if (!dryrun)
{ {
float x_tmp, y_tmp, z_tmp, real_z;
real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane) real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER; x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER; y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
@ -3545,7 +3545,6 @@ inline void gcode_M200() {
} }
} }
float area = .0;
if (code_seen('D')) { if (code_seen('D')) {
float diameter = code_value(); float diameter = code_value();
// setting any extruder filament size disables volumetric on the assumption that // setting any extruder filament size disables volumetric on the assumption that
@ -4283,7 +4282,7 @@ inline void gcode_M502() {
* M503: print settings currently in memory * M503: print settings currently in memory
*/ */
inline void gcode_M503() { inline void gcode_M503() {
Config_PrintSettings(code_seen('S') && code_value == 0); Config_PrintSettings(code_seen('S') && code_value() == 0);
} }
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
@ -4580,9 +4579,13 @@ inline void gcode_T() {
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER); SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
} }
else { else {
boolean make_move = false; #if EXTRUDERS > 1
bool make_move = false;
#endif
if (code_seen('F')) { if (code_seen('F')) {
#if EXTRUDERS > 1
make_move = true; make_move = true;
#endif
next_feedrate = code_value(); next_feedrate = code_value();
if (next_feedrate > 0.0) feedrate = next_feedrate; if (next_feedrate > 0.0) feedrate = next_feedrate;
} }
@ -5181,12 +5184,10 @@ void ClearToSend()
void get_coordinates() void get_coordinates()
{ {
bool seen[4]={false,false,false,false};
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) if(code_seen(axis_codes[i]))
{ {
destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
seen[i]=true;
} }
else destination[i] = current_position[i]; //Are these else lines really needed? else destination[i] = current_position[i]; //Are these else lines really needed?
} }

@ -489,7 +489,7 @@ void CardReader::updir() {
if (workDirDepth > 0) { if (workDirDepth > 0) {
--workDirDepth; --workDirDepth;
workDir = workDirParents[0]; workDir = workDirParents[0];
for (int d = 0; d < workDirDepth; d++) for (uint16_t d = 0; d < workDirDepth; d++)
workDirParents[d] = workDirParents[d+1]; workDirParents[d] = workDirParents[d+1];
} }
} }

@ -62,6 +62,7 @@
#endif #endif
#ifdef CUSTOM_MENDEL_NAME #ifdef CUSTOM_MENDEL_NAME
#undef MACHINE_NAME
#define MACHINE_NAME CUSTOM_MENDEL_NAME #define MACHINE_NAME CUSTOM_MENDEL_NAME
#endif #endif

@ -62,6 +62,7 @@
#endif #endif
#ifdef CUSTOM_MENDEL_NAME #ifdef CUSTOM_MENDEL_NAME
#undef MACHINE_NAME
#define MACHINE_NAME CUSTOM_MENDEL_NAME #define MACHINE_NAME CUSTOM_MENDEL_NAME
#endif #endif

@ -167,12 +167,18 @@
#endif #endif
#ifdef DISABLE_MAX_ENDSTOPS #ifdef DISABLE_MAX_ENDSTOPS
#undef X_MAX_PIN
#undef Y_MAX_PIN
#undef Z_MAX_PIN
#define X_MAX_PIN -1 #define X_MAX_PIN -1
#define Y_MAX_PIN -1 #define Y_MAX_PIN -1
#define Z_MAX_PIN -1 #define Z_MAX_PIN -1
#endif #endif
#ifdef DISABLE_MIN_ENDSTOPS #ifdef DISABLE_MIN_ENDSTOPS
#undef X_MIN_PIN
#undef Y_MIN_PIN
#undef Z_MIN_PIN
#define X_MIN_PIN -1 #define X_MIN_PIN -1
#define Y_MIN_PIN -1 #define Y_MIN_PIN -1
#define Z_MIN_PIN -1 #define Z_MIN_PIN -1

@ -701,12 +701,12 @@ float junction_deviation = 0.1;
int moves_queued = movesplanned(); int moves_queued = movesplanned();
// slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
#if defined(OLD_SLOWDOWN) || defined(SLOWDOWN)
bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2; bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2;
#ifdef OLD_SLOWDOWN #ifdef OLD_SLOWDOWN
if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE; if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
#endif #endif
#ifdef SLOWDOWN #ifdef SLOWDOWN
// segment time im micro seconds // segment time im micro seconds
unsigned long segment_time = lround(1000000.0/inverse_second); unsigned long segment_time = lround(1000000.0/inverse_second);
@ -720,7 +720,7 @@ float junction_deviation = 0.1;
} }
} }
#endif #endif
// END OF SLOW DOWN SECTION #endif
block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0 block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0 block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0

@ -607,7 +607,6 @@ double dnrm2 ( int n, double x[], int incx )
double norm; double norm;
double scale; double scale;
double ssq; double ssq;
double value;
if ( n < 1 || incx < 1 ) if ( n < 1 || incx < 1 )
{ {

@ -85,18 +85,24 @@ static volatile bool endstop_z_hit = false;
int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT; int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
#endif #endif
static bool old_x_min_endstop = false, #if defined(X_MIN_PIN) && X_MIN_PIN >= 0
old_x_max_endstop = false, static bool old_x_min_endstop = false;
old_y_min_endstop = false, #endif
old_y_max_endstop = false, #if defined(X_MAX_PIN) && X_MAX_PIN >= 0
old_z_min_endstop = false, static bool old_x_max_endstop = false;
#ifndef Z_DUAL_ENDSTOPS #endif
old_z_max_endstop = false; #if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0
#else static bool old_y_min_endstop = false;
old_z_max_endstop = false, #endif
old_z2_min_endstop = false, #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0
old_z2_max_endstop = false; static bool old_y_max_endstop = false;
#endif #endif
static bool old_z_min_endstop = false, old_z_max_endstop = false;
#ifdef Z_DUAL_ENDSTOPS
static bool old_z2_min_endstop = false, old_z2_max_endstop = false;
#endif
static bool check_endstops = true; static bool check_endstops = true;
@ -1176,8 +1182,6 @@ void digipot_current(uint8_t driver, int current) {
} }
void microstep_init() { void microstep_init() {
const uint8_t microstep_modes[] = MICROSTEP_MODES;
#if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0 #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0
pinMode(E1_MS1_PIN,OUTPUT); pinMode(E1_MS1_PIN,OUTPUT);
pinMode(E1_MS2_PIN,OUTPUT); pinMode(E1_MS2_PIN,OUTPUT);
@ -1192,7 +1196,9 @@ void microstep_init() {
pinMode(Z_MS2_PIN,OUTPUT); pinMode(Z_MS2_PIN,OUTPUT);
pinMode(E0_MS1_PIN,OUTPUT); pinMode(E0_MS1_PIN,OUTPUT);
pinMode(E0_MS2_PIN,OUTPUT); pinMode(E0_MS2_PIN,OUTPUT);
for (int i = 0; i <= 4; i++) microstep_mode(i, microstep_modes[i]); const uint8_t microstep_modes[] = MICROSTEP_MODES;
for (int i = 0; i < sizeof(microstep_modes) / sizeof(microstep_modes[0]); i++)
microstep_mode(i, microstep_modes[i]);
#endif #endif
} }

@ -17,9 +17,8 @@
#ifdef DOGLCD #ifdef DOGLCD
extern int lcd_contrast; extern int lcd_contrast;
void lcd_setcontrast(uint8_t value); void lcd_setcontrast(uint8_t value);
#endif
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
#endif
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))

Loading…
Cancel
Save