From 0a549fd1f28be756472ded0362c6a16674498297 Mon Sep 17 00:00:00 2001 From: gjdodd <31553294+gjdodd@users.noreply.github.com> Date: Wed, 24 Oct 2018 22:36:11 +0100 Subject: [PATCH] Fix EXTENSIBLE_UI compile errors (#12206) --- Marlin/src/lcd/extensible_ui/lib/example.cpp | 6 ++-- Marlin/src/lcd/extensible_ui/ui_api.cpp | 29 ++++++++++++++------ Marlin/src/libs/buzzer.h | 2 +- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Marlin/src/lcd/extensible_ui/lib/example.cpp b/Marlin/src/lcd/extensible_ui/lib/example.cpp index d11c85d6f..6b8a27db6 100644 --- a/Marlin/src/lcd/extensible_ui/lib/example.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/example.cpp @@ -47,9 +47,9 @@ namespace UI { } void onIdle() {} void onPrinterKilled(const char* msg) {} - void onMediaInserted(); - void onMediaError(); - void onMediaRemoved(); + void onMediaInserted() {}; + void onMediaError() {}; + void onMediaRemoved() {}; void onPlayTone(const uint16_t frequency, const uint16_t duration) {} void onPrintTimerStarted() {} void onPrintTimerPaused() {} diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 56ac9216f..1ed15cb60 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -68,6 +68,9 @@ #if ENABLED(PRINTCOUNTER) #include "../../core/utility.h" #include "../../module/printcounter.h" + #define IFPC(A,B) (A) +#else + #define IFPC(A,B) (B) #endif #include "ui_api.h" @@ -194,7 +197,9 @@ namespace UI { switch (axis) { case X: case Y: case Z: break; case E0: case E1: case E2: case E3: case E4: case E5: - active_extruder = axis - E0; + #if EXTRUDERS > 1 + active_extruder = axis - E0; + #endif break; default: return; } @@ -223,7 +228,9 @@ namespace UI { if (extruder != active_extruder) tool_change(extruder, 0, no_move); #endif - active_extruder = extruder; + #if EXTRUDERS > 1 + active_extruder = extruder; + #endif } uint8_t getActiveTool() { return active_extruder + 1; } @@ -438,7 +445,7 @@ namespace UI { } 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; } @@ -493,7 +500,7 @@ namespace UI { } void printFile(const char *filename) { - IFSD(card.openAndPrintFile(filename), NOOP); + IFSD(card.openAndPrintFile(filename), 0); } bool isPrintingFromMediaPaused() { @@ -505,7 +512,7 @@ namespace UI { } bool isPrinting() { - return (planner.movesplanned() || IS_SD_PRINTING() || isPrintingFromMedia()); + return (planner.movesplanned() || IFSD(IS_SD_PRINTING(), false) || isPrintingFromMedia()); } bool isMediaInserted() { @@ -515,7 +522,9 @@ namespace UI { void pausePrint() { #if ENABLED(SDSUPPORT) card.pauseSDPrint(); - print_job_timer.pause(); + #if ENABLED(PRINTCOUNTER) + print_job_timer.pause(); + #endif #if ENABLED(PARK_HEAD_ON_PAUSE) enqueue_and_echo_commands_P(PSTR("M125")); #endif @@ -529,7 +538,9 @@ namespace UI { enqueue_and_echo_commands_P(PSTR("M24")); #else card.startFileprint(); - print_job_timer.start(); + #if ENABLED(PRINTCOUNTER) + print_job_timer.start(); + #endif #endif UI::onStatusChanged(PSTR(MSG_PRINTING)); #endif @@ -659,13 +670,13 @@ void lcd_reset_status() { static const char printing[] PROGMEM = MSG_PRINTING; static const char welcome[] PROGMEM = WELCOME_MSG; PGM_P msg; - if (print_job_timer.isPaused()) + if (IFPC(print_job_timer.isPaused(), false)) msg = paused; #if ENABLED(SDSUPPORT) else if (card.sdprinting) return lcd_setstatus(card.longest_filename(), true); #endif - else if (print_job_timer.isRunning()) + else if (IFPC(print_job_timer.isRunning(), false)) msg = printing; else msg = welcome; diff --git a/Marlin/src/libs/buzzer.h b/Marlin/src/libs/buzzer.h index 6661c1045..2da9b8dee 100644 --- a/Marlin/src/libs/buzzer.h +++ b/Marlin/src/libs/buzzer.h @@ -28,7 +28,7 @@ // Make a buzzer and macro #if ENABLED(LCD_USE_I2C_BUZZER) // BUZZ() will be defined in ultralcd.h -#elif PIN_EXISTS(BEEPER) || ENABLED(EXTENSIBLE_UI) +#elif PIN_EXISTS(BEEPER) #include "circularqueue.h"