Fix EXTENSIBLE_UI compile errors (#12206)

This commit is contained in:
gjdodd 2018-10-24 22:36:11 +01:00 committed by Scott Lahteine
parent a80ba8fc6e
commit 0a549fd1f2
3 changed files with 24 additions and 13 deletions

View file

@ -47,9 +47,9 @@ namespace UI {
} }
void onIdle() {} void onIdle() {}
void onPrinterKilled(const char* msg) {} void onPrinterKilled(const char* msg) {}
void onMediaInserted(); void onMediaInserted() {};
void onMediaError(); void onMediaError() {};
void onMediaRemoved(); void onMediaRemoved() {};
void onPlayTone(const uint16_t frequency, const uint16_t duration) {} void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
void onPrintTimerStarted() {} void onPrintTimerStarted() {}
void onPrintTimerPaused() {} void onPrintTimerPaused() {}

View file

@ -68,6 +68,9 @@
#if ENABLED(PRINTCOUNTER) #if ENABLED(PRINTCOUNTER)
#include "../../core/utility.h" #include "../../core/utility.h"
#include "../../module/printcounter.h" #include "../../module/printcounter.h"
#define IFPC(A,B) (A)
#else
#define IFPC(A,B) (B)
#endif #endif
#include "ui_api.h" #include "ui_api.h"
@ -194,7 +197,9 @@ namespace UI {
switch (axis) { switch (axis) {
case X: case Y: case Z: break; case X: case Y: case Z: break;
case E0: case E1: case E2: case E3: case E4: case E5: case E0: case E1: case E2: case E3: case E4: case E5:
#if EXTRUDERS > 1
active_extruder = axis - E0; active_extruder = axis - E0;
#endif
break; break;
default: return; default: return;
} }
@ -223,7 +228,9 @@ namespace UI {
if (extruder != active_extruder) if (extruder != active_extruder)
tool_change(extruder, 0, no_move); tool_change(extruder, 0, no_move);
#endif #endif
#if EXTRUDERS > 1
active_extruder = extruder; active_extruder = extruder;
#endif
} }
uint8_t getActiveTool() { return active_extruder + 1; } uint8_t getActiveTool() { return active_extruder + 1; }
@ -438,7 +445,7 @@ namespace UI {
} }
uint32_t getProgress_seconds_elapsed() { uint32_t getProgress_seconds_elapsed() {
const duration_t elapsed = print_job_timer.duration(); const duration_t elapsed = IFPC(print_job_timer.duration(), 0);
return elapsed.value; return elapsed.value;
} }
@ -493,7 +500,7 @@ namespace UI {
} }
void printFile(const char *filename) { void printFile(const char *filename) {
IFSD(card.openAndPrintFile(filename), NOOP); IFSD(card.openAndPrintFile(filename), 0);
} }
bool isPrintingFromMediaPaused() { bool isPrintingFromMediaPaused() {
@ -505,7 +512,7 @@ namespace UI {
} }
bool isPrinting() { bool isPrinting() {
return (planner.movesplanned() || IS_SD_PRINTING() || isPrintingFromMedia()); return (planner.movesplanned() || IFSD(IS_SD_PRINTING(), false) || isPrintingFromMedia());
} }
bool isMediaInserted() { bool isMediaInserted() {
@ -515,7 +522,9 @@ namespace UI {
void pausePrint() { void pausePrint() {
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
card.pauseSDPrint(); card.pauseSDPrint();
#if ENABLED(PRINTCOUNTER)
print_job_timer.pause(); print_job_timer.pause();
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE) #if ENABLED(PARK_HEAD_ON_PAUSE)
enqueue_and_echo_commands_P(PSTR("M125")); enqueue_and_echo_commands_P(PSTR("M125"));
#endif #endif
@ -529,8 +538,10 @@ namespace UI {
enqueue_and_echo_commands_P(PSTR("M24")); enqueue_and_echo_commands_P(PSTR("M24"));
#else #else
card.startFileprint(); card.startFileprint();
#if ENABLED(PRINTCOUNTER)
print_job_timer.start(); print_job_timer.start();
#endif #endif
#endif
UI::onStatusChanged(PSTR(MSG_PRINTING)); UI::onStatusChanged(PSTR(MSG_PRINTING));
#endif #endif
} }
@ -659,13 +670,13 @@ void lcd_reset_status() {
static const char printing[] PROGMEM = MSG_PRINTING; static const char printing[] PROGMEM = MSG_PRINTING;
static const char welcome[] PROGMEM = WELCOME_MSG; static const char welcome[] PROGMEM = WELCOME_MSG;
PGM_P msg; PGM_P msg;
if (print_job_timer.isPaused()) if (IFPC(print_job_timer.isPaused(), false))
msg = paused; msg = paused;
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
else if (card.sdprinting) else if (card.sdprinting)
return lcd_setstatus(card.longest_filename(), true); return lcd_setstatus(card.longest_filename(), true);
#endif #endif
else if (print_job_timer.isRunning()) else if (IFPC(print_job_timer.isRunning(), false))
msg = printing; msg = printing;
else else
msg = welcome; msg = welcome;

View file

@ -28,7 +28,7 @@
// Make a buzzer and macro // Make a buzzer and macro
#if ENABLED(LCD_USE_I2C_BUZZER) #if ENABLED(LCD_USE_I2C_BUZZER)
// BUZZ() will be defined in ultralcd.h // BUZZ() will be defined in ultralcd.h
#elif PIN_EXISTS(BEEPER) || ENABLED(EXTENSIBLE_UI) #elif PIN_EXISTS(BEEPER)
#include "circularqueue.h" #include "circularqueue.h"