Remove 'unused-parameter' and 'empty-body' warinings

Additional warnings cleanup for SNMM config.
Fix uninitialized 'SilentMode' refrences in stepper
This commit is contained in:
Ted Hess 2017-10-13 17:18:20 -04:00
parent f2d9c00103
commit dc391e3fc2
9 changed files with 70 additions and 123 deletions

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "Arduino.h"
#include "Marlin.h"
// When the display powers up, it is configured as follows:
//
@ -83,6 +83,8 @@ void LiquidCrystal::init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t en
}
void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
UNUSED(cols);
if (lines > 1) {
_displayfunction |= LCD_2LINE;
}
@ -161,6 +163,8 @@ void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
void LiquidCrystal::begin_noclear(uint8_t cols, uint8_t lines, uint8_t dotsize) {
UNUSED(cols);
if (lines > 1) {
_displayfunction |= LCD_2LINE;
}

View File

@ -122,8 +122,8 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
#define disable_x() { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
#else
#define enable_x() ;
#define disable_x() ;
#define enable_x() {}
#define disable_x() {}
#endif
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
@ -135,8 +135,8 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#endif
#else
#define enable_y() ;
#define disable_y() ;
#define enable_y() {}
#define disable_y() {}
#endif
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
@ -146,7 +146,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define disable_z() ;
#define disable_z() {}
#endif
#else
#ifdef Z_DUAL_STEPPER_DRIVERS
@ -158,8 +158,8 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif
#endif
#else
#define enable_z() ;
#define disable_z() ;
#define enable_z() {}
#define disable_z() {}
#endif
@ -183,24 +183,24 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define enable_e0() WRITE(E0_ENABLE_PIN, E_ENABLE_ON)
#define disable_e0() WRITE(E0_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e0() /* nothing */
#define disable_e0() /* nothing */
#define enable_e0() {/* nothing */}
#define disable_e0() {/* nothing */}
#endif
#if (EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e1() /* nothing */
#define disable_e1() /* nothing */
#define enable_e1() {/* nothing */}
#define disable_e1() {/* nothing */}
#endif
#if (EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e2() /* nothing */
#define disable_e2() /* nothing */
#define enable_e2() {/* nothing */}
#define disable_e2() {/* nothing */}
#endif
@ -385,6 +385,7 @@ extern MarlinBusyState busy_state;
bool gcode_M45(bool onlyZ);
void gcode_M701();
#define UNUSED(x) (void)(x)
#endif //ifndef marlin.h

View File

@ -931,6 +931,8 @@ void servo_init()
int er_progress = 0;
void factory_reset(char level, bool quiet)
{
UNUSED(quiet);
lcd_implementation_clear();
switch (level) {
@ -3297,18 +3299,20 @@ void process_commands()
case 80:
#ifdef MK1BP
break;
#endif //MK1BP
#else
case_G80:
{
mesh_bed_leveling_flag = true;
int8_t verbosity_level = 0;
static bool run = false;
#ifdef SUPPORT_VERBOSITY
int8_t verbosity_level = 0;
if (code_seen('V')) {
// Just 'V' without a number counts as V1.
char c = strchr_pointer[1];
verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short();
}
#endif
// Firstly check if we know where we are
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) {
// We don't know where we are! HOME!
@ -3369,8 +3373,10 @@ void process_commands()
if (verbosity_level >= 1) {
clamped ? SERIAL_PROTOCOLPGM("First calibration point clamped.\n") : SERIAL_PROTOCOLPGM("No clamping for first calibration point.\n");
}
#else
UNUSED(clamped);
#endif // SUPPORT_VERBOSITY
// mbl.get_meas_xy(0, 0, current_position[X_AXIS], current_position[Y_AXIS], false);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS] / 30, active_extruder);
// Wait until the move is finished.
st_synchronize();
@ -3424,13 +3430,15 @@ void process_commands()
world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
clamped = world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
#ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 1) {
SERIAL_PROTOCOL(mesh_point);
clamped ? SERIAL_PROTOCOLPGM(": xy clamped.\n") : SERIAL_PROTOCOLPGM(": no xy clamping\n");
}
#else
UNUSED(clamped);
#endif // SUPPORT_VERBOSITY
@ -3571,7 +3579,7 @@ void process_commands()
}
break;
#endif //MK1BP
/**
* G81: Print mesh bed leveling status and bed profile if activated
*/

View File

@ -143,8 +143,10 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
int8_t verbosity_level
)
{
float angleDiff;
#ifdef SUPPORT_VERBOSITY
float angleDiff;
#ifndef SUPPORT_VERBOSITY
UNUSED(verbosity_level);
#else
if (verbosity_level >= 10) {
SERIAL_ECHOLNPGM("calculate machine skew and offset LS");
@ -186,7 +188,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
}
delay_keep_alive(100);
}
#endif // SUPPORT_VERBOSITY
#endif // SUPPORT_VERBOSITY
// Run some iterations of the Gauss-Newton method of non-linear least squares.
// Initial set of parameters:
@ -823,6 +825,8 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
{
#ifdef SUPPORT_VERBOSITY
if(verbosity_level >= 10) SERIAL_ECHOLNPGM("find bed induction sensor point z");
#else
UNUSED(verbosity_level);
#endif // SUPPORT_VERBOSITY
bool endstops_enabled = enable_endstops(true);
bool endstop_z_enabled = enable_z_endstop(false);
@ -880,6 +884,8 @@ inline bool find_bed_induction_sensor_point_xy(int verbosity_level)
{
#ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 10) MYSERIAL.println("find bed induction sensor point xy");
#else
UNUSED(verbosity_level);
#endif // SUPPORT_VERBOSITY
float feedrate = homing_feedrate[X_AXIS] / 60.f;
bool found = false;
@ -1218,13 +1224,15 @@ inline bool improve_bed_induction_sensor_point2(bool lift_z_on_min_y, int8_t ver
}
b = current_position[X_AXIS];
if (b - a < MIN_BED_SENSOR_POINT_RESPONSE_DMR) {
#ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 5) {
#ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 5) {
SERIAL_ECHOPGM("Point width too small: ");
SERIAL_ECHO(b - a);
SERIAL_ECHOLNPGM("");
}
#endif // SUPPORT_VERBOSITY
#else
UNUSED(verbosity_level);
#endif // SUPPORT_VERBOSITY
// We force the calibration routine to move the Z axis slightly down to make the response more pronounced.
if (b - a < 0.5f * MIN_BED_SENSOR_POINT_RESPONSE_DMR) {
// Don't use the new X value.
@ -1350,6 +1358,8 @@ inline bool improve_bed_induction_sensor_point3(int verbosity_level)
#ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 20) MYSERIAL.println("Improve bed induction sensor point3");
#else
UNUSED(verbosity_level);
#endif // SUPPORT_VERBOSITY
// Was the sensor point detected too far in the minus Y axis?
// If yes, the center of the induction point cannot be reached by the machine.
@ -2436,6 +2446,8 @@ bool sample_mesh_and_store_reference()
bool scan_bed_induction_points(int8_t verbosity_level)
{
UNUSED(verbosity_level);
// Don't let the manage_inactivity() function remove power from the motors.
refresh_cmd_timeout();

View File

@ -21,78 +21,6 @@ static inline bool vec_undef(const float v[2])
return vx[0] == 0x0FFFFFFFF || vx[1] == 0x0FFFFFFFF;
}
void mesh_bed_leveling::get_meas_xy(int ix, int iy, float &x, float &y, bool use_default)
{
#if 0
float cntr[2] = {
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0)),
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4))
};
float vec_x[2] = {
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +0)),
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +4))
};
float vec_y[2] = {
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +0)),
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +4))
};
if (use_default || vec_undef(cntr) || vec_undef(vec_x) || vec_undef(vec_y)) {
// Default, uncorrected positions of the calibration points. Works well for correctly built printers.
x = float(MESH_MIN_X) + float(MEAS_NUM_X_DIST) * float(ix) - X_PROBE_OFFSET_FROM_EXTRUDER;
//FIXME
//x -= 5.f;
y = float(MESH_MIN_Y) + float(MEAS_NUM_Y_DIST) * float(iy) - Y_PROBE_OFFSET_FROM_EXTRUDER;
} else {
#if 0
SERIAL_ECHO("Running bed leveling. Calibration data: ");
SERIAL_ECHO(cntr[0]);
SERIAL_ECHO(",");
SERIAL_ECHO(cntr[1]);
SERIAL_ECHO(", x: ");
SERIAL_ECHO(vec_x[0]);
SERIAL_ECHO(",");
SERIAL_ECHO(vec_x[1]);
SERIAL_ECHO(", y: ");
SERIAL_ECHO(vec_y[0]);
SERIAL_ECHO(",");
SERIAL_ECHO(vec_y[1]);
SERIAL_ECHOLN("");
#endif
x = cntr[0];
y = cntr[1];
if (ix < 1) {
x -= vec_x[0];
y -= vec_x[1];
} else if (ix > 1) {
x += vec_x[0];
y += vec_x[1];
}
if (iy < 1) {
x -= vec_y[0];
y -= vec_y[1];
} else if (iy > 1) {
x += vec_y[0];
y += vec_y[1];
}
#if 0
SERIAL_ECHO("Calibration point position: ");
SERIAL_ECHO(x);
SERIAL_ECHO(",");
SERIAL_ECHO(y);
SERIAL_ECHOLN("");
#endif
}
#else
// Default, uncorrected positions of the calibration points.
// This coordinate will be corrected by the planner.
x = pgm_read_float(bed_ref_points + 2 * (iy * 3 + ix));
y = pgm_read_float(bed_ref_points + 2 * (iy * 3 + ix) + 1);
#endif
}
#if MESH_NUM_X_POINTS>=5 && MESH_NUM_Y_POINTS>=5 && (MESH_NUM_X_POINTS&1)==1 && (MESH_NUM_Y_POINTS&1)==1
// Works for an odd number of MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS

View File

@ -24,11 +24,6 @@ public:
static float get_x(int i) { return float(MESH_MIN_X) + float(MESH_X_DIST) * float(i); }
static float get_y(int i) { return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i); }
// Measurement point for the Z probe.
// If use_default=true, then the default positions for a correctly built printer are used.
// Otherwise a correction matrix is pulled from the EEPROM if available.
static void get_meas_xy(int ix, int iy, float &x, float &y, bool use_default);
void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; }
int select_x_index(float x) {

View File

@ -90,8 +90,6 @@ static bool old_z_max_endstop=false;
static bool check_endstops = true;
static bool check_z_endstop = false;
int8_t SilentMode;
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
@ -1146,26 +1144,16 @@ void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl e
SPI.transfer(value);
digitalWrite(DIGIPOTSS_PIN,HIGH); // take the SS pin high to de-select the chip:
//delay(10);
#else
UNUSED(address); UNUSED(value);
#endif
}
void EEPROM_read_st(int pos, uint8_t* value, uint8_t size)
{
do
{
*value = eeprom_read_byte((unsigned char*)pos);
pos++;
value++;
}while(--size);
}
void digipot_init() //Initialize Digipot Motor Current
{
EEPROM_read_st(EEPROM_SILENT,(uint8_t*)&SilentMode,sizeof(SilentMode));
SilentModeMenu = SilentMode;
SilentModeMenu = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
if(SilentMode == 0){
if(SilentModeMenu == 0){
const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT_LOUD;
}else{
const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT;
@ -1180,7 +1168,7 @@ void digipot_init() //Initialize Digipot Motor Current
pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT);
pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT);
pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT);
if((SilentMode == 0) || (farm_mode) ){
if((SilentModeMenu == 0) || (farm_mode) ){
motor_current_setting[0] = motor_current_setting_loud[0];
motor_current_setting[1] = motor_current_setting_loud[1];

View File

@ -4158,7 +4158,6 @@ void extr_adj(int extruder) //loading filament for SNMM
void extr_unload() { //unloads filament
float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT;
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
int8_t SilentMode;
if (degHotend0() > EXTRUDE_MINTEMP) {
lcd_implementation_clear();
@ -4205,7 +4204,7 @@ void extr_unload() { //unloads filament
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder);
st_synchronize();
//digipot_init();
if (SilentMode == 1) digipot_current(2, tmp_motor[2]); //set back to normal operation currents
if (SilentModeMenu == 1) digipot_current(2, tmp_motor[2]); //set back to normal operation currents
else digipot_current(2, tmp_motor_loud[2]);
lcd_update_enable(true);
lcd_return_to_status();
@ -5791,6 +5790,8 @@ static bool check_file(const char* filename) {
static void menu_action_sdfile(const char* filename, char* longFilename)
{
UNUSED(longFilename);
loading_flag = false;
char cmd[30];
char* c;
@ -5810,6 +5811,8 @@ static void menu_action_sdfile(const char* filename, char* longFilename)
}
static void menu_action_sddirectory(const char* filename, char* longFilename)
{
UNUSED(longFilename);
card.chdir(filename);
encoderPosition = 0;
}
@ -6305,12 +6308,12 @@ bool lcd_detected(void)
#endif
}
#ifdef LCD_USE_I2C_BUZZER
void lcd_buzz(long duration, uint16_t freq)
{
#ifdef LCD_USE_I2C_BUZZER
lcd.buzz(duration, freq);
#endif
}
#endif
bool lcd_clicked()
{

View File

@ -1189,6 +1189,8 @@ void lcd_implementation_drawedit_2(const char* pstr, char* value)
static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
UNUSED(pstr); UNUSED(filename);
char c;
int enc_dif = encoderDiff;
uint8_t n = LCD_WIDTH - 1;
@ -1242,6 +1244,8 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
}
static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
UNUSED(pstr);
char c;
uint8_t n = LCD_WIDTH - 1;
lcd.setCursor(0, row);
@ -1262,6 +1266,8 @@ static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, co
}
static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
UNUSED(pstr);
char c;
uint8_t n = LCD_WIDTH - 2;
lcd.setCursor(0, row);
@ -1283,6 +1289,8 @@ static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const
}
static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
UNUSED(pstr);
char c;
uint8_t n = LCD_WIDTH - 2;
lcd.setCursor(0, row);