Merge Suppress some compiler warnings (PR#70)

This commit is contained in:
Richard Wackerbarth 2015-08-16 06:57:54 -05:00
commit 4939c642b4
6 changed files with 65 additions and 54 deletions

View file

@ -5,6 +5,10 @@
#define MARLIN_H #define MARLIN_H
#define FORCE_INLINE __attribute__((always_inline)) inline #define FORCE_INLINE __attribute__((always_inline)) inline
/**
* Compiler warning on unused varable.
*/
#define UNUSED(x) (void) (x)
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>

View file

@ -1,8 +1,8 @@
#include "Marlin.h" #include "Marlin.h"
#include "buzzer.h"
#include "ultralcd.h"
#if HAS_BUZZER #if HAS_BUZZER
#include "buzzer.h"
#include "ultralcd.h"
void buzz(long duration, uint16_t freq) { void buzz(long duration, uint16_t freq) {
if (freq > 0) { if (freq > 0) {
#if ENABLED(LCD_USE_I2C_BUZZER) #if ENABLED(LCD_USE_I2C_BUZZER)

View file

@ -168,7 +168,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, mesh_num_x); EEPROM_WRITE_VAR(i, mesh_num_x);
EEPROM_WRITE_VAR(i, mesh_num_y); EEPROM_WRITE_VAR(i, mesh_num_y);
dummy = 0.0f; dummy = 0.0f;
for (int q=0; q<mesh_num_x*mesh_num_y; q++) EEPROM_WRITE_VAR(i, dummy); for (uint8_t q=0; q<mesh_num_x*mesh_num_y; q++) EEPROM_WRITE_VAR(i, dummy);
#endif // MESH_BED_LEVELING #endif // MESH_BED_LEVELING
#if DISABLED(ENABLE_AUTO_BED_LEVELING) #if DISABLED(ENABLE_AUTO_BED_LEVELING)
@ -470,7 +470,7 @@ void Config_ResetDefault() {
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT; float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE; float tmp2[] = DEFAULT_MAX_FEEDRATE;
long tmp3[] = DEFAULT_MAX_ACCELERATION; long tmp3[] = DEFAULT_MAX_ACCELERATION;
for (uint16_t i = 0; i < NUM_AXIS; i++) { for (uint8_t i = 0; i < NUM_AXIS; i++) {
axis_steps_per_unit[i] = tmp1[i]; axis_steps_per_unit[i] = tmp1[i];
max_feedrate[i] = tmp2[i]; max_feedrate[i] = tmp2[i];
max_acceleration_units_per_sq_second[i] = tmp3[i]; max_acceleration_units_per_sq_second[i] = tmp3[i];
@ -565,7 +565,7 @@ void Config_ResetDefault() {
#endif #endif
volumetric_enabled = false; volumetric_enabled = false;
for (int q=0; q<COUNT(filament_size); q++) for (uint8_t q=0; q<COUNT(filament_size); q++)
filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA; filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA;
calculate_volumetric_multipliers(); calculate_volumetric_multipliers();

View file

@ -217,6 +217,7 @@ FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity
// The kernel called by planner_recalculate() when scanning the plan from last to first entry. // The kernel called by planner_recalculate() when scanning the plan from last to first entry.
void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *next) { void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *next) {
if (!current) return; if (!current) return;
UNUSED(previous);
if (next) { if (next) {
// If entry speed is already at the maximum entry speed, no need to recheck. Block is cruising. // If entry speed is already at the maximum entry speed, no need to recheck. Block is cruising.
@ -265,6 +266,7 @@ void planner_reverse_pass() {
// The kernel called by planner_recalculate() when scanning the plan from first to last entry. // The kernel called by planner_recalculate() when scanning the plan from first to last entry.
void planner_forward_pass_kernel(block_t *previous, block_t *current, block_t *next) { void planner_forward_pass_kernel(block_t *previous, block_t *current, block_t *next) {
if (!previous) return; if (!previous) return;
UNUSED(next);
// If the previous block is an acceleration block, but it is not long enough to complete the // If the previous block is an acceleration block, but it is not long enough to complete the
// full speed change within the block, we need to adjust the entry speed accordingly. Entry // full speed change within the block, we need to adjust the entry speed accordingly. Entry

View file

@ -1185,6 +1185,9 @@ void digitalPotWrite(int address, int value) {
SPI.transfer(value); SPI.transfer(value);
digitalWrite(DIGIPOTSS_PIN,HIGH); // take the SS pin high to de-select the chip: digitalWrite(DIGIPOTSS_PIN,HIGH); // take the SS pin high to de-select the chip:
//delay(10); //delay(10);
#else
UNUSED(address);
UNUSED(value);
#endif #endif
} }
@ -1216,14 +1219,16 @@ void digipot_current(uint8_t driver, int current) {
#if HAS_DIGIPOTSS #if HAS_DIGIPOTSS
const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
digitalPotWrite(digipot_ch[driver], current); digitalPotWrite(digipot_ch[driver], current);
#endif #elif defined(MOTOR_CURRENT_PWM_XY_PIN)
#ifdef MOTOR_CURRENT_PWM_XY_PIN
switch(driver) { switch(driver) {
case 0: analogWrite(MOTOR_CURRENT_PWM_XY_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break; case 0: analogWrite(MOTOR_CURRENT_PWM_XY_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
case 1: analogWrite(MOTOR_CURRENT_PWM_Z_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break; case 1: analogWrite(MOTOR_CURRENT_PWM_Z_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
case 2: analogWrite(MOTOR_CURRENT_PWM_E_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break; case 2: analogWrite(MOTOR_CURRENT_PWM_E_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
} }
#endif #else
UNUSED(driver);
UNUSED(current);
#endif
} }
void microstep_init() { void microstep_init() {

View file

@ -2,9 +2,9 @@
#define ULTRALCD_H #define ULTRALCD_H
#include "Marlin.h" #include "Marlin.h"
#include "buzzer.h"
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
#include "buzzer.h"
int lcd_strlen(char *s); int lcd_strlen(char *s);
int lcd_strlen_P(const char *s); int lcd_strlen_P(const char *s);
void lcd_update(); void lcd_update();
@ -105,8 +105,8 @@
FORCE_INLINE void lcd_update() {} FORCE_INLINE void lcd_update() {}
FORCE_INLINE void lcd_init() {} FORCE_INLINE void lcd_init() {}
FORCE_INLINE bool lcd_hasstatus() { return false; } FORCE_INLINE bool lcd_hasstatus() { return false; }
FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {} FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {UNUSED(message); UNUSED(persist);}
FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {} FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {UNUSED(message); UNUSED(level);}
FORCE_INLINE void lcd_buttons_update() {} FORCE_INLINE void lcd_buttons_update() {}
FORCE_INLINE void lcd_reset_alert_level() {} FORCE_INLINE void lcd_reset_alert_level() {}
FORCE_INLINE bool lcd_detected(void) { return true; } FORCE_INLINE bool lcd_detected(void) { return true; }