Improve ExtUI, fix compiler errors, warnings (#14441)

This commit is contained in:
Marcio Teixeira
2019-06-28 23:23:57 -06:00
committed by Scott Lahteine
parent 14fb683682
commit e6cf7860e8
10 changed files with 80 additions and 31 deletions

View File

@ -411,9 +411,13 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
SERIAL_ECHOLNPGM("Nozzle Tip Outer Dimensions:");
#if HAS_X_CENTER
SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension[X_AXIS]);
#else
UNUSED(m);
#endif
#if HAS_Y_CENTER
SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension[Y_AXIS]);
#else
UNUSED(m);
#endif
SERIAL_EOL();
}
@ -518,6 +522,8 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const
#if HOTENDS > 1
set_nozzle(m, extruder);
#else
UNUSED(extruder);
#endif
probe_sides(m, uncertainty);

View File

@ -40,9 +40,9 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
SERIAL_ECHOPAIR(" M92 T", (int)i);
SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)]));
}
#else
UNUSED(e);
#endif
UNUSED_E(e);
}
/**

View File

@ -89,6 +89,13 @@ GCodeQueue::GCodeQueue() {
for (uint8_t i = 0; i < COUNT(send_ok); i++) send_ok[i] = true;
}
/**
* Check whether there are any commands yet to be executed
*/
bool GCodeQueue::has_commands_queued() {
return queue.length || injected_commands_P;
}
/**
* Clear the Marlin command queue
*/
@ -154,6 +161,8 @@ bool GCodeQueue::enqueue_one(const char* cmd) {
/**
* Process the next "immediate" command.
* Return 'true' if any commands were processed,
* or remain to process.
*/
bool GCodeQueue::process_injected_command() {
if (injected_commands_P == nullptr) return false;
@ -161,19 +170,16 @@ bool GCodeQueue::process_injected_command() {
char c;
size_t i = 0;
while ((c = pgm_read_byte(&injected_commands_P[i])) && c != '\n') i++;
if (!i) return false;
char cmd[i + 1];
memcpy_P(cmd, injected_commands_P, i);
cmd[i] = '\0';
if (i) {
char cmd[i + 1];
memcpy_P(cmd, injected_commands_P, i);
cmd[i] = '\0';
parser.parse(cmd);
PORT_REDIRECT(SERIAL_PORT);
gcode.process_parsed_command();
}
injected_commands_P = c ? injected_commands_P + i + 1 : nullptr;
parser.parse(cmd);
PORT_REDIRECT(SERIAL_PORT);
gcode.process_parsed_command();
PORT_RESTORE();
return true;
}
@ -183,17 +189,13 @@ bool GCodeQueue::process_injected_command() {
* Aborts the current queue, if any.
* Note: process_injected_command() will be called to drain any commands afterwards
*/
void GCodeQueue::inject_P(PGM_P const pgcode) {
injected_commands_P = pgcode;
}
void GCodeQueue::inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
/**
* Enqueue and return only when commands are actually enqueued.
* Never call this from a G-code handler!
*/
void GCodeQueue::enqueue_one_now(const char* cmd) {
while (!enqueue_one(cmd)) idle();
}
void GCodeQueue::enqueue_one_now(const char* cmd) { while (!enqueue_one(cmd)) idle(); }
/**
* Enqueue from program memory and return only when commands are actually enqueued

View File

@ -84,6 +84,11 @@ public:
*/
static void enqueue_now_P(PGM_P const cmd);
/**
* Check whether there are any commands yet to be executed
*/
static bool has_commands_queued();
/**
* Get the next command in the queue, optionally log it to SD, then dispatch it
*/