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
22 changed files with 238 additions and 224 deletions

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