New GCode Parser - Implementation

This commit is contained in:
Scott Lahteine
2017-05-20 03:03:08 -05:00
parent 002a06c507
commit f4028fe088
13 changed files with 1110 additions and 733 deletions

View File

@ -61,6 +61,7 @@ extern size_t __heap_start, __heap_end, __flp;
extern char __bss_end;
#include "Marlin.h"
#include "gcode.h"
#include "hex_print_routines.h"
//
@ -188,7 +189,7 @@ void free_memory_pool_report(char * const ptr, const int16_t size) {
* This is useful to check the correctness of the M100 D and the M100 F commands.
*/
void corrupt_free_memory(char *ptr, const uint16_t size) {
if (code_seen('C')) {
if (parser.seen('C')) {
ptr += 8;
const uint16_t near_top = top_of_stack() - ptr - 250, // -250 to avoid interrupt activity that's altered the stack.
j = near_top / (size + 1);
@ -247,23 +248,23 @@ void gcode_M100() {
// Always init on the first invocation of M100
static bool m100_not_initialized = true;
if (m100_not_initialized || code_seen('I')) {
if (m100_not_initialized || parser.seen('I')) {
m100_not_initialized = false;
init_free_memory(ptr, sp - ptr);
}
#if ENABLED(M100_FREE_MEMORY_DUMPER)
if (code_seen('D'))
if (parser.seen('D'))
return dump_free_memory(ptr, sp);
#endif
if (code_seen('F'))
if (parser.seen('F'))
return free_memory_pool_report(ptr, sp - ptr);
#if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
if (code_seen('C'))
return corrupt_free_memory(ptr, code_value_int());
if (parser.seen('C'))
return corrupt_free_memory(ptr, parser.value_int());
#endif
}