Skip to content

Commit

Permalink
LulzBot Touch UI Followup (MarlinFirmware#15007)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcio-ao authored and thinkyhead committed Aug 21, 2019
1 parent 8c2cfaa commit bd1ced1
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 34 deletions.
Expand Up @@ -20,8 +20,6 @@
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/

#ifdef LULZBOT_TOUCH_UI

class SPIFlash {
public:
static constexpr uint32_t erase_unit_size = 4 * 1024; // Minimum erase unit
Expand Down Expand Up @@ -106,5 +104,3 @@ class UIFlashStorage::BootMediaReader {

static int16_t read(void *obj, void *buffer, const size_t size);
};

#endif // LULZBOT_TOUCH_UI
Expand Up @@ -22,8 +22,12 @@

#pragma once

#include "../../../../../sd/SdFile.h"
#include "../../../../../sd/cardreader.h"
#include "../../../../../inc/MarlinConfigPre.h"

#if ENABLED(SDSUPPORT)
#include "../../../../../sd/SdFile.h"
#include "../../../../../sd/cardreader.h"
#endif

class MediaFileReader {
private:
Expand Down
18 changes: 5 additions & 13 deletions Marlin/src/lcd/extensible_ui/lib/lulzbot/compat.h
Expand Up @@ -35,21 +35,13 @@
#endif

#ifdef __MARLIN_FIRMWARE__
// If __MARLIN_FIRMWARE__ exists, then we are being
// compiled inside Marlin.
#include "pin_mappings.h"
// __MARLIN_FIRMWARE__ exists when compiled within Marlin.
#include "pin_mappings.h"
#else
// Messages that are declared in Marlin
#define WELCOME_MSG "Printer Ready"
#define MSG_SD_INSERTED "Media Inserted"
#define MSG_SD_REMOVED "Media Removed"

// Define macros for compatibility
#define EXTENSIBLE_UI
#define _CAT(a, ...) a ## __VA_ARGS__
#define SWITCH_ENABLED_ 1
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
#define DISABLED(b) !ENABLED(b)
#define WELCOME_MSG "Printer Ready"
#define MSG_MEDIA_INSERTED "Media Inserted"
#define MSG_MEDIA_REMOVED "Media Removed"

namespace UI {
static inline uint32_t safe_millis() {return millis();};
Expand Down
5 changes: 2 additions & 3 deletions Marlin/src/lcd/extensible_ui/lib/lulzbot/config.h
Expand Up @@ -80,9 +80,8 @@
// This is a recommended for smaller displays.
//#define TOUCH_UI_PASSCODE

// Define number of seconds after which the menu screens
// timeout and returns the user to the status screen
//#define LCD_TIMEOUT_TO_STATUS 120
// The timeout (in ms) to return to the status screen from sub-menus
//#define LCD_TIMEOUT_TO_STATUS 15000

// Enable this to debug the event framework
//#define UI_FRAMEWORK_DEBUG
Expand Down
Expand Up @@ -1160,7 +1160,7 @@ void CLCD::default_display_orientation() {
cmd.execute();
}
else {
#ifdef TOUCH_UI_INVERTED
#if ENABLED(TOUCH_UI_INVERTED)
mem_write_32(REG::ROTATE, 1);
#endif
}
Expand Down
17 changes: 14 additions & 3 deletions Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/compat.h
Expand Up @@ -20,13 +20,15 @@
#include "../config.h"

#ifdef __MARLIN_FIRMWARE__
// Marlin will define the I/O functions for us

// Marlin will define the I/O functions for us
#if ENABLED(LULZBOT_TOUCH_UI)
#define FTDI_BASIC
#define FTDI_EXTENDED
#endif
#else

#else // !__MARLIN_FIRMWARE__

#include "Arduino.h"

#if !defined(CLCD_USE_SOFT_SPI)
Expand Down Expand Up @@ -200,6 +202,14 @@

#define safe_delay delay

// Define macros for compatibility

#define _CAT(a, ...) a ## __VA_ARGS__
#define SWITCH_ENABLED_ 1
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
#define DISABLED(b) !ENABLED(b)
#define ANY(A,B) ENABLED(A) || ENABLED(B)

// Remove compiler warning on an unused variable
#ifndef UNUSED
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
Expand All @@ -208,4 +218,5 @@
#define UNUSED(x) ((void)(x))
#endif
#endif
#endif //!defined(__MARLIN_FIRMWARE__)

#endif // !__MARLIN_FIRMWARE__
Expand Up @@ -63,7 +63,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
void BaseScreen::onIdle() {
#ifdef LCD_TIMEOUT_TO_STATUS
const uint32_t elapsed = millis() - last_interaction;
if (elapsed > uint32_t(LCD_TIMEOUT_TO_STATUS) * 1000) {
if (elapsed > uint32_t(LCD_TIMEOUT_TO_STATUS)) {
reset_menu_timeout();
GOTO_SCREEN(StatusScreen);
}
Expand Down
Expand Up @@ -32,16 +32,10 @@ using namespace ExtUI;

void EndstopStatesScreen::onEntry() {
BaseScreen::onEntry();
#ifdef LULZBOT_SET_PROBE_PINS_STATE
LULZBOT_SET_PROBE_PINS_STATE(true)
#endif
}

void EndstopStatesScreen::onExit() {
BaseScreen::onExit();
#ifdef LULZBOT_SET_PROBE_PINS_STATE
LULZBOT_SET_PROBE_PINS_STATE(false)
#endif
}

void EndstopStatesScreen::onRedraw(draw_mode_t) {
Expand Down
Expand Up @@ -30,7 +30,7 @@
#include "../archim2-flash/flash_storage.h"

#if ENABLED(SDSUPPORT) && defined(LULZBOT_MANUAL_USB_STARTUP)
#include "../../../../sd/cardreader.h"
#include "../../../../../sd/cardreader.h"
#endif

using namespace FTDI;
Expand Down

0 comments on commit bd1ced1

Please sign in to comment.