Eliminate most warnings

- Fix a bug reading `code_value` for `M503 Sn`
- Hide and remove unused variables
This commit is contained in:
Scott Lahteine 2015-03-26 20:07:17 -07:00
parent 3fd7790a15
commit 267d6bef15
3 changed files with 25 additions and 19 deletions

View File

@ -3548,7 +3548,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
@ -4286,7 +4285,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
@ -4583,9 +4582,14 @@ 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;
} }
@ -5182,16 +5186,18 @@ void ClearToSend()
SERIAL_PROTOCOLLNPGM(MSG_OK); SERIAL_PROTOCOLLNPGM(MSG_OK);
} }
void get_coordinates() void get_coordinates() {
{ for (int i = 0; i < NUM_AXIS; i++) {
bool seen[4]={false,false,false,false}; float dest;
for(int8_t i=0; i < NUM_AXIS; i++) { if (code_seen(axis_codes[i])) {
if(code_seen(axis_codes[i])) dest = code_value();
{ if (axis_relative_modes[i] || relative_mode)
destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; dest += current_position[i];
seen[i]=true;
} }
else destination[i] = current_position[i]; //Are these else lines really needed? else
dest = current_position[i];
destination[i] = dest;
} }
if (code_seen('F')) { if (code_seen('F')) {
next_feedrate = code_value(); next_feedrate = code_value();

View File

@ -1176,8 +1176,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 +1190,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
} }

View File

@ -55,7 +55,7 @@
int target_temperature[EXTRUDERS] = { 0 }; int target_temperature[EXTRUDERS] = { 0 };
int target_temperature_bed = 0; int target_temperature_bed = 0;
int current_temperature_raw[EXTRUDERS] = { 0 }; int current_temperature_raw[4] = { 0 };
float current_temperature[EXTRUDERS] = { 0.0 }; float current_temperature[EXTRUDERS] = { 0.0 };
int current_temperature_bed_raw = 0; int current_temperature_bed_raw = 0;
float current_temperature_bed = 0.0; float current_temperature_bed = 0.0;