Use PGM_P for PSTR pointers (#11977)

This commit is contained in:
Scott Lahteine
2018-09-30 23:44:33 -05:00
committed by GitHub
parent 4d5566a6b7
commit 11ac75edcb
39 changed files with 166 additions and 165 deletions

View File

@ -108,7 +108,7 @@ void ac_cleanup(
#endif
}
void print_signed_float(const char * const prefix, const float &f) {
void print_signed_float(PGM_P const prefix, const float &f) {
SERIAL_PROTOCOLPGM(" ");
serialprintPGM(prefix);
SERIAL_PROTOCOLCHAR(':');
@ -517,7 +517,7 @@ void GcodeSuite::G33() {
}
// Report settings
const char* checkingac = PSTR("Checking... AC");
PGM_P checkingac = PSTR("Checking... AC");
serialprintPGM(checkingac);
if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
if (set_up) SERIAL_PROTOCOLPGM(" (SET-UP)");
@ -705,7 +705,7 @@ void GcodeSuite::G33() {
}
}
else { // dry run
const char *enddryrun = PSTR("End DRY-RUN");
PGM_P enddryrun = PSTR("End DRY-RUN");
serialprintPGM(enddryrun);
SERIAL_PROTOCOL_SP(35);
SERIAL_PROTOCOLPGM("std dev:");

View File

@ -50,8 +50,8 @@
*
* Also, there are two support functions that can be called from a developer's C code.
*
* uint16_t check_for_free_memory_corruption(const char * const ptr);
* void M100_dump_routine(const char * const title, const char *start, const char *end);
* uint16_t check_for_free_memory_corruption(PGM_P const ptr);
* void M100_dump_routine(PGM_P const title, const char *start, const char *end);
*
* Initial version by Roxy-3D
*/
@ -80,7 +80,7 @@ char* top_of_stack() {
// Count the number of test bytes at the specified location.
inline int32_t count_test_bytes(const char * const ptr) {
for (uint32_t i = 0; i < 32000; i++)
if (((char) ptr[i]) != TEST_BYTE)
if (char(ptr[i]) != TEST_BYTE)
return i - 1;
return -1;
@ -136,8 +136,9 @@ inline int32_t count_test_bytes(const char * const ptr) {
}
}
void M100_dump_routine(const char * const title, const char *start, const char *end) {
SERIAL_ECHOLN(title);
void M100_dump_routine(PGM_P const title, const char *start, const char *end) {
serialprintPGM(title);
SERIAL_EOL();
//
// Round the start and end locations to produce full lines of output
//
@ -148,8 +149,8 @@ inline int32_t count_test_bytes(const char * const ptr) {
#endif // M100_FREE_MEMORY_DUMPER
inline int check_for_free_memory_corruption(const char * const title) {
SERIAL_ECHO(title);
inline int check_for_free_memory_corruption(PGM_P const title) {
serialprintPGM(title);
char *ptr = END_OF_HEAP(), *sp = top_of_stack();
int n = sp - ptr;
@ -171,7 +172,7 @@ inline int check_for_free_memory_corruption(const char * const title) {
// idle();
safe_delay(20);
#if ENABLED(M100_FREE_MEMORY_DUMPER)
M100_dump_routine(" Memory corruption detected with sp<Heap\n", (char*)0x1B80, (char*)0x21FF);
M100_dump_routine(PSTR(" Memory corruption detected with sp<Heap\n"), (char*)0x1B80, (char*)0x21FF);
#endif
}
@ -239,7 +240,7 @@ inline void free_memory_pool_report(char * const ptr, const int32_t size) {
SERIAL_ECHOPAIR("\nLargest free block is ", max_cnt);
SERIAL_ECHOLNPAIR(" bytes at ", hex_address(max_addr));
}
SERIAL_ECHOLNPAIR("check_for_free_memory_corruption() = ", check_for_free_memory_corruption("M100 F "));
SERIAL_ECHOLNPAIR("check_for_free_memory_corruption() = ", check_for_free_memory_corruption(PSTR("M100 F ")));
}
#if ENABLED(M100_FREE_MEMORY_CORRUPTOR)