Merge pull request #7722 from tcm0116/2.0.x-warnings

Cleanup 2.0.x compiler warnings
This commit is contained in:
Scott Lahteine 2017-10-01 21:56:54 -05:00 committed by GitHub
commit ac41eb5871
22 changed files with 238 additions and 224 deletions

View file

@ -352,8 +352,8 @@ script:
- opt_enable FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY
- opt_enable FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE
- opt_enable BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY
- opt_enable PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER
- opt_enable_adv ADVANCED_PAUSE_FEATURE LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA
- opt_enable PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER
- opt_enable_adv ADVANCED_PAUSE_FEATURE LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA PARK_HEAD_ON_PAUSE
- opt_set_adv I2C_SLAVE_ADDRESS 63
- opt_set ABL_GRID_POINTS_X 16
- opt_set ABL_GRID_POINTS_Y 16
@ -388,7 +388,7 @@ script:
# Mixing Extruder
#
- restore_configs
- opt_enable MIXING_EXTRUDER
- opt_enable MIXING_EXTRUDER DIRECT_MIXING_IN_G1
- opt_set MIXING_STEPPERS 2
- build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
#

View file

@ -171,7 +171,7 @@
UNUSED(response);
}
static void spiSend(const uint8_t* buf, size_t n) {
void spiSend(const uint8_t* buf, size_t n) {
uint8_t response;
if (n == 0) return;
for (uint16_t i = 0; i < n; i++) {

View file

@ -346,7 +346,6 @@ extern "C" {
void UART0_IRQHandler (void)
{
uint8_t IIRValue, LSRValue;
uint8_t Dummy = Dummy;
IIRValue = LPC_UART0->IIR;
@ -361,7 +360,7 @@ void UART0_IRQHandler (void)
/* There are errors or break interrupt */
/* Read LSR will clear the interrupt */
UART0Status = LSRValue;
Dummy = LPC_UART0->RBR; /* Dummy read on RX to clear
dummy = LPC_UART0->RBR; /* Dummy read on RX to clear
interrupt, then bail out */
return;
}
@ -375,7 +374,7 @@ void UART0_IRQHandler (void)
UART0RxQueueWritePos = (UART0RxQueueWritePos+1) % UARTRXQUEUESIZE;
}
else
dummy = LPC_UART0->RBR;;
dummy = LPC_UART0->RBR;
}
}
else if ( IIRValue == IIR_RDA ) /* Receive Data Available */
@ -387,7 +386,7 @@ void UART0_IRQHandler (void)
UART0RxQueueWritePos = (UART0RxQueueWritePos+1) % UARTRXQUEUESIZE;
}
else
dummy = LPC_UART1->RBR;;
dummy = LPC_UART1->RBR;
}
else if ( IIRValue == IIR_CTI ) /* Character timeout indicator */
{
@ -422,7 +421,6 @@ void UART0_IRQHandler (void)
void UART1_IRQHandler (void)
{
uint8_t IIRValue, LSRValue;
uint8_t Dummy = Dummy;
IIRValue = LPC_UART1->IIR;
@ -437,7 +435,7 @@ void UART1_IRQHandler (void)
/* There are errors or break interrupt */
/* Read LSR will clear the interrupt */
UART1Status = LSRValue;
Dummy = LPC_UART1->RBR; /* Dummy read on RX to clear
dummy = LPC_UART1->RBR; /* Dummy read on RX to clear
interrupt, then bail out */
return;
}
@ -451,7 +449,7 @@ void UART1_IRQHandler (void)
UART1RxQueueWritePos =(UART1RxQueueWritePos+1) % UARTRXQUEUESIZE;
}
else
dummy = LPC_UART1->RBR;;
dummy = LPC_UART1->RBR;
}
}
else if ( IIRValue == IIR_RDA ) /* Receive Data Available */
@ -463,7 +461,7 @@ void UART1_IRQHandler (void)
UART1RxQueueWritePos = (UART1RxQueueWritePos+1) % UARTRXQUEUESIZE;
}
else
dummy = LPC_UART1->RBR;;
dummy = LPC_UART1->RBR;
}
else if ( IIRValue == IIR_CTI ) /* Character timeout indicator */
{
@ -484,7 +482,6 @@ void UART1_IRQHandler (void)
UART1TxEmpty = 0;
}
}
}
/*****************************************************************************
** Function name: UART2_IRQHandler
@ -498,7 +495,6 @@ void UART1_IRQHandler (void)
void UART2_IRQHandler (void)
{
uint8_t IIRValue, LSRValue;
uint8_t Dummy = Dummy;
IIRValue = LPC_UART2->IIR;
@ -513,7 +509,7 @@ void UART2_IRQHandler (void)
/* There are errors or break interrupt */
/* Read LSR will clear the interrupt */
UART2Status = LSRValue;
Dummy = LPC_UART2->RBR; /* Dummy read on RX to clear
dummy = LPC_UART2->RBR; /* Dummy read on RX to clear
interrupt, then bail out */
return;
}
@ -537,7 +533,7 @@ void UART2_IRQHandler (void)
UART2RxQueueWritePos = (UART2RxQueueWritePos+1) % UARTRXQUEUESIZE;
}
else
dummy = LPC_UART2->RBR;;
dummy = LPC_UART2->RBR;
}
else if ( IIRValue == IIR_CTI ) /* Character timeout indicator */
{
@ -571,7 +567,6 @@ void UART2_IRQHandler (void)
void UART3_IRQHandler (void)
{
uint8_t IIRValue, LSRValue;
uint8_t Dummy = Dummy;
IIRValue = LPC_UART3->IIR;
@ -586,7 +581,7 @@ void UART3_IRQHandler (void)
/* There are errors or break interrupt */
/* Read LSR will clear the interrupt */
UART3Status = LSRValue;
Dummy = LPC_UART3->RBR; /* Dummy read on RX to clear
dummy = LPC_UART3->RBR; /* Dummy read on RX to clear
interrupt, then bail out */
return;
}
@ -610,7 +605,7 @@ void UART3_IRQHandler (void)
UART3RxQueueWritePos = (UART3RxQueueWritePos+1) % UARTRXQUEUESIZE;
}
else
dummy = LPC_UART3->RBR;;
dummy = LPC_UART3->RBR;
}
else if ( IIRValue == IIR_CTI ) /* Character timeout indicator */
{

View file

@ -147,9 +147,11 @@
bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; }
void Servo::move(const int value) {
constexpr uint16_t servo_delay[] = SERVO_DELAY;
static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
if (this->attach(0) >= 0) { // notice the pin number is zero here
this->write(value);
delay(SERVO_DELAY);
delay(servo_delay[this->servoIndex]);
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
this->detach();
LPC1768_PWM_detach_pin(servo_info[this->servoIndex].Pin.nbr); // shut down the PWM signal

View file

@ -71,12 +71,12 @@ private:
static SoftwareSerial *active_object;
// private methods
void recv() __attribute__((__always_inline__));
void recv();
uint32_t rx_pin_read();
void tx_pin_write(uint8_t pin_state) __attribute__((__always_inline__));
void tx_pin_write(uint8_t pin_state);
void setTX(uint8_t transmitPin);
void setRX(uint8_t receivePin);
void setRxIntMsk(bool enable) __attribute__((__always_inline__));
void setRxIntMsk(bool enable);
// private static method for timing
static inline void tunedDelay(uint32_t delay);

View file

@ -62,9 +62,9 @@ void delayMicroseconds(uint32_t us) {
while (loops > 0) --loops;
}
else { // poll systick, more accurate through interrupts
int32_t start = SysTick->VAL;
int32_t load = SysTick->LOAD;
int32_t end = start - (load / 1000) * us;
uint32_t start = SysTick->VAL;
uint32_t load = SysTick->LOAD;
uint32_t end = start - (load / 1000) * us;
if (end >> 31)
while (!(SysTick->VAL > start && SysTick->VAL < (load + end))) __NOP();

View file

@ -24,6 +24,10 @@
#if ENABLED(MIXING_EXTRUDER)
#if ENABLED(DIRECT_MIXING_IN_G1)
#include "../gcode/parser.h"
#endif
float mixing_factor[MIXING_STEPPERS]; // Reciprocal of mix proportion. 0.0 = off, otherwise >= 1.0.
#if MIXING_VIRTUAL_TOOLS > 1

View file

@ -52,6 +52,7 @@ static float resume_position[XYZE];
static bool sd_print_paused = false;
#endif
#if HAS_BUZZER
static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
static millis_t next_buzz = 0;
static int8_t runout_beep = 0;
@ -67,6 +68,7 @@ static void filament_change_beep(const int8_t max_beep_count, const bool init=fa
}
}
}
#endif
static void ensure_safe_temperature() {
bool heaters_heating = true;

View file

@ -79,8 +79,8 @@ char* top_of_stack() {
}
// Count the number of test bytes at the specified location.
inline int16_t count_test_bytes(const char * const ptr) {
for (uint16_t i = 0; i < 32000; i++)
inline int32_t count_test_bytes(const char * const ptr) {
for (uint32_t i = 0; i < 32000; i++)
if (((char) ptr[i]) != TEST_BYTE)
return i - 1;
@ -180,7 +180,7 @@ inline int check_for_free_memory_corruption(const char * const title) {
int block_cnt = 0;
for (int i = 0; i < n; i++) {
if (ptr[i] == TEST_BYTE) {
int16_t j = count_test_bytes(ptr + i);
int32_t j = count_test_bytes(ptr + i);
if (j > 8) {
// SERIAL_ECHOPAIR("Found ", j);
// SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(ptr + i));
@ -215,14 +215,14 @@ inline int check_for_free_memory_corruption(const char * const title) {
* Return the number of free bytes in the memory pool,
* with other vital statistics defining the pool.
*/
inline void free_memory_pool_report(char * const ptr, const int16_t size) {
int16_t max_cnt = -1, block_cnt = 0;
inline void free_memory_pool_report(char * const ptr, const int32_t size) {
int32_t max_cnt = -1, block_cnt = 0;
char *max_addr = NULL;
// Find the longest block of test bytes in the buffer
for (int16_t i = 0; i < size; i++) {
for (int32_t i = 0; i < size; i++) {
char *addr = ptr + i;
if (*addr == TEST_BYTE) {
const int16_t j = count_test_bytes(addr);
const int32_t j = count_test_bytes(addr);
if (j > 8) {
SERIAL_ECHOPAIR("Found ", j);
SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(addr));
@ -249,13 +249,13 @@ inline void free_memory_pool_report(char * const ptr, const int16_t size) {
* Corrupt <num> locations in the free memory pool and report the corrupt addresses.
* This is useful to check the correctness of the M100 D and the M100 F commands.
*/
inline void corrupt_free_memory(char *ptr, const uint16_t size) {
inline void corrupt_free_memory(char *ptr, const uint32_t size) {
ptr += 8;
const uint16_t near_top = top_of_stack() - ptr - 250, // -250 to avoid interrupt activity that's altered the stack.
const uint32_t near_top = top_of_stack() - ptr - 250, // -250 to avoid interrupt activity that's altered the stack.
j = near_top / (size + 1);
SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
for (uint16_t i = 1; i <= size; i++) {
for (uint32_t i = 1; i <= size; i++) {
char * const addr = ptr + i * j;
*addr = i;
SERIAL_ECHOPAIR("\nCorrupting address: ", hex_address(addr));
@ -268,7 +268,7 @@ inline void free_memory_pool_report(char * const ptr, const int16_t size) {
* M100 I
* Init memory for the M100 tests. (Automatically applied on the first M100.)
*/
inline void init_free_memory(char *ptr, int16_t size) {
inline void init_free_memory(char *ptr, int32_t size) {
SERIAL_ECHOLNPGM("Initializing free memory block.\n\n");
size -= 250; // -250 to avoid interrupt activity that's altered the stack.
@ -284,7 +284,7 @@ inline void init_free_memory(char *ptr, int16_t size) {
SERIAL_ECHO(size);
SERIAL_ECHOLNPGM(" bytes of memory initialized.\n");
for (int16_t i = 0; i < size; i++) {
for (int32_t i = 0; i < size; i++) {
if (ptr[i] != TEST_BYTE) {
SERIAL_ECHOPAIR("? address : ", hex_address(ptr + i));
SERIAL_ECHOLNPAIR("=", hex_byte(ptr[i]));

View file

@ -141,15 +141,16 @@ inline void servo_probe_test() {
SERIAL_PROTOCOLLNPGM(". deploy & stow 4 times");
SET_INPUT_PULLUP(PROBE_TEST_PIN);
uint8_t i = 0;
bool deploy_state, stow_state;
for (uint8_t i = 0; i < 4; i++) {
do {
MOVE_SERVO(probe_index, z_servo_angle[0]); //deploy
safe_delay(500);
deploy_state = READ(PROBE_TEST_PIN);
MOVE_SERVO(probe_index, z_servo_angle[1]); //stow
safe_delay(500);
stow_state = READ(PROBE_TEST_PIN);
}
} while (++i < 4);
if (probe_inverting != deploy_state) SERIAL_PROTOCOLLNPGM("WARNING - INVERTING setting probably backwards");
gcode.refresh_cmd_timeout();
@ -167,7 +168,6 @@ inline void servo_probe_test() {
#if ENABLED(BLTOUCH)
SERIAL_PROTOCOLLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true.");
#endif
}
else { // measure active signal length
MOVE_SERVO(probe_index, z_servo_angle[0]); // deploy

View file

@ -27,6 +27,7 @@
#include "../../gcode.h"
#include "../../parser.h"
#include "../../../feature/pause.h"
#include "../../../module/motion.h"
/**
* M125: Store current position and move to filament change position.

View file

@ -36,6 +36,10 @@ GcodeSuite gcode;
#include "../module/printcounter.h"
#endif
#if ENABLED(DIRECT_MIXING_IN_G1)
#include "../feature/mixing.h"
#endif
#include "../Marlin.h" // for idle()
uint8_t GcodeSuite::target_extruder;

View file

@ -29,7 +29,7 @@
#include "../Marlin.h"
#if ENABLED(DEBUG_GCODE_PARSER)
#include "../../libs/hex_print_routines.h"
#include "../libs/hex_print_routines.h"
#endif
// Must be declared for allocation and to satisfy the linker

View file

@ -2693,7 +2693,6 @@ void kill_screen(const char* lcd_msg) {
void lcd_delta_settings() {
START_MENU();
MENU_BACK(MSG_DELTA_CALIBRATE);
float Tz = 0.00;
MENU_ITEM_EDIT(float52, MSG_DELTA_DIAG_ROG, &delta_diagonal_rod, DELTA_DIAGONAL_ROD - 5.0, DELTA_DIAGONAL_ROD + 5.0);
_delta_height = DELTA_HEIGHT + home_offset[Z_AXIS];
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_HEIGHT, &_delta_height, _delta_height - 10.0, _delta_height + 10.0, _lcd_set_delta_height);

View file

@ -21,41 +21,46 @@
*/
#include "../inc/MarlinConfig.h"
#include "../gcode/parser.h"
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(M100_FREE_MEMORY_WATCHER) || ENABLED(DEBUG_GCODE_PARSER)
#include "hex_print_routines.h"
#ifdef CPU_32_BIT
constexpr int byte_start = 0;
static char _hex[] = "0x0000";
#else
constexpr int byte_start = 4;
static char _hex[] = "0x00000000";
#else
constexpr int byte_start = 0;
static char _hex[] = "0x0000";
#endif
char* hex_byte(const uint8_t b) {
_hex[byte_start + 4] = hex_nybble(b >> 4);
_hex[byte_start + 5] = hex_nybble(b);
return &_hex[byte_start];
return &_hex[byte_start + 4];
}
char* hex_word(const uint16_t w) {
inline void _hex_word(const uint16_t w) {
_hex[byte_start + 2] = hex_nybble(w >> 12);
_hex[byte_start + 3] = hex_nybble(w >> 8);
_hex[byte_start + 4] = hex_nybble(w >> 4);
_hex[byte_start + 5] = hex_nybble(w);
return &_hex[byte_start - 2];
}
char* hex_word(const uint16_t w) {
_hex_word(w);
return &_hex[byte_start + 2];
}
#ifdef CPU_32_BIT
char* hex_long(const uint32_t w) {
_hex[byte_start - 2] = hex_nybble(w >> 28);
_hex[byte_start - 1] = hex_nybble(w >> 24);
_hex[byte_start + 0] = hex_nybble(w >> 20);
_hex[byte_start + 1] = hex_nybble(w >> 16);
(void)hex_word((uint16_t)(w & 0xFFFF));
return &_hex[byte_start - 6];
char* hex_long(const uint32_t l) {
_hex[2] = hex_nybble(l >> 28);
_hex[3] = hex_nybble(l >> 24);
_hex[4] = hex_nybble(l >> 20);
_hex[5] = hex_nybble(l >> 16);
_hex_word((uint16_t)(l & 0xFFFF));
return &_hex[2];
}
#endif

View file

@ -26,6 +26,10 @@
#include "../module/motion.h"
#include "point_t.h"
#if ENABLED(DELTA)
#include "../module/delta.h"
#endif
/**
* @brief Stroke clean pattern
* @details Wipes the nozzle back and forth in a linear movement

View file

@ -135,9 +135,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
* This fix isn't perfect and may lose steps - but better than locking up completely
* in future the planner should slow down if advance stepping rate would be too high
*/
FORCE_INLINE uint16_t adv_rate(const int steps, const uint16_t timer, const uint8_t loops) {
FORCE_INLINE HAL_TIMER_TYPE adv_rate(const int steps, const HAL_TIMER_TYPE timer, const uint8_t loops) {
if (steps) {
const uint16_t rate = (timer * loops) / abs(steps);
const HAL_TIMER_TYPE rate = (timer * loops) / abs(steps);
//return constrain(rate, 1, ADV_NEVER - 1)
return rate ? rate : 1;
}
@ -815,7 +815,7 @@ void Stepper::isr() {
#if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
#ifdef CPU_32_BIT
// Make sure stepper interrupt does not monopolise CPU by adjusting count to give about 8 us room
uint32_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
HAL_TIMER_TYPE stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
stepper_timer_current_count = HAL_timer_get_current_count(STEP_TIMER_NUM) + 8 * HAL_TICKS_PER_US;
HAL_timer_set_count(STEP_TIMER_NUM, max(stepper_timer_count, stepper_timer_current_count));
#else

View file

@ -1744,8 +1744,8 @@ void Temperature::isr() {
// Macros for Slow PWM timer logic
#define _SLOW_PWM_ROUTINE(NR, src) \
soft_pwm_ ##NR = src; \
if (soft_pwm_ ##NR > 0) { \
soft_pwm_count_ ##NR = src; \
if (soft_pwm_count_ ##NR > 0) { \
if (state_timer_heater_ ##NR == 0) { \
if (state_heater_ ##NR == 0) state_timer_heater_ ##NR = MIN_STATE_TIME; \
state_heater_ ##NR = 1; \
@ -1762,7 +1762,7 @@ void Temperature::isr() {
#define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm_amount[n])
#define PWM_OFF_ROUTINE(NR) \
if (soft_pwm_ ##NR < slow_pwm_count) { \
if (soft_pwm_count_ ##NR < slow_pwm_count) { \
if (state_timer_heater_ ##NR == 0) { \
if (state_heater_ ##NR == 1) state_timer_heater_ ##NR = MIN_STATE_TIME; \
state_heater_ ##NR = 0; \

View file

@ -286,8 +286,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#else // !DUAL_X_CARRIAGE
#if ENABLED(PARKING_EXTRUDER) // Dual Parking extruder
const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
float z_raise = 0;
float z_raise = PARKING_EXTRUDER_SECURITY_RAISE;
if (!no_move) {
const float parkingposx[] = PARKING_EXTRUDER_PARKING_X,
@ -310,7 +309,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
SERIAL_ECHOLNPGM("Starting Autopark");
if (DEBUGGING(LEVELING)) DEBUG_POS("current position:", current_position);
#endif
z_raise = PARKING_EXTRUDER_SECURITY_RAISE;
current_position[Z_AXIS] += z_raise;
#if ENABLED(DEBUG_LEVELING_FEATURE)
SERIAL_ECHOLNPGM("(1) Raise Z-Axis ");

View file

@ -1388,7 +1388,7 @@ bool SdBaseFile::rmdir() {
* the value zero, false, is returned for failure.
*/
bool SdBaseFile::rmRfStar() {
uint16_t index;
uint32_t index;
SdBaseFile f;
rewind();
while (curPosition_ < fileSize_) {

View file

@ -115,7 +115,7 @@ void NVIC_SCBDeInit(void)
SCB->SCR = 0x00000000;
SCB->CCR = 0x00000000;
for (tmp = 0; tmp < 32; tmp++) {
for (tmp = 0; tmp < (sizeof(SCB->SHP) / sizeof(SCB->SHP[0])); tmp++) {
SCB->SHP[tmp] = 0x00;
}