LCD menu optimalization - lcd and menu

removed unused code and conditional translation
This commit is contained in:
Robert Pelnar 2018-07-16 02:13:52 +02:00
parent 39bb855333
commit 268d2634f0
26 changed files with 2134 additions and 2560 deletions

View File

@ -621,154 +621,18 @@ your extruder heater takes 2 minutes to hit the target on heating.
#define HOST_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
//LCD and SD support
#define ULTRA_LCD //general LCD support, also 16x2
#define SDSUPPORT // Enable SD Card Support in Hardware Console
//#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
#define SD_CHECK_AND_RETRY // Use CRC checks and retries on the SD communication
#define ENCODER_PULSES_PER_STEP 4 // Increase if you have a high resolution encoder
//#define ENCODER_STEPS_PER_MENU_ITEM 1 // Set according to ENCODER_PULSES_PER_STEP or your liking
//#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
//#define ULTIPANEL //the UltiPanel as on Thingiverse
//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
// The MaKr3d Makr-Panel with graphic controller and SD support
// http://reprap.org/wiki/MaKr3d_MaKrPanel
//#define MAKRPANEL
// The RepRapDiscount Smart Controller (white PCB)
// http://reprap.org/wiki/RepRapDiscount_Smart_Controller
#define REPRAP_DISCOUNT_SMART_CONTROLLER
// The GADGETS3D G3D LCD/SD Controller (blue PCB)
// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel
//#define G3D_PANEL
// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
//#define REPRAPWORLD_KEYPAD
//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
// The Elefu RA Board Control Panel
// http://www.elefu.com/index.php?route=product/product&product_id=53
// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
//#define RA_CONTROL_PANEL
//automatic expansion
#if defined (MAKRPANEL)
#define SDSUPPORT
#define ULTIPANEL
#define NEWPANEL
#define DEFAULT_LCD_CONTRAST 17
#endif
#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
#define ULTIPANEL
#define NEWPANEL
#endif
#if defined(REPRAPWORLD_KEYPAD)
#define NEWPANEL
#define ULTIPANEL
#endif
#if defined(RA_CONTROL_PANEL)
#define ULTIPANEL
#define NEWPANEL
#define LCD_I2C_TYPE_PCA8574
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#endif
//I2C PANELS
//#define LCD_I2C_SAINSMART_YWROBOT
#ifdef LCD_I2C_SAINSMART_YWROBOT
// This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-LiquidCrystal_Prusa/wiki/Home )
// Make sure it is placed in the Arduino libraries directory.
#define LCD_I2C_TYPE_PCF8575
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define NEWPANEL
#define ULTIPANEL
#endif
// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
//#define LCD_I2C_PANELOLU2
#ifdef LCD_I2C_PANELOLU2
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
// Note: The PANELOLU2 encoder click input can either be directly connected to a pin
// (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
#define NEWPANEL
#define ULTIPANEL
#ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 4
#endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 2
#endif
#ifdef LCD_USE_I2C_BUZZER
#define LCD_FEEDBACK_FREQUENCY_HZ 1000
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
#endif
#endif
// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
//#define LCD_I2C_VIKI
#ifdef LCD_I2C_VIKI
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// Note: The pause/stop/resume LCD button pin should be connected to the Arduino
// BTN_ENC pin (or set BTN_ENC to -1 if not used)
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
#define NEWPANEL
#define ULTIPANEL
#endif
// Shift register panels
// ---------------------
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-LiquidCrystal_Prusa/wiki/schematics#!shiftregister-connection
//#define SAV_3DLCD
#ifdef SAV_3DLCD
#define SR_LCD_2W_NL // Non latching 2 wire shiftregister
#define NEWPANEL
#define ULTIPANEL
#endif
#ifdef ULTIPANEL
// #define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT
#define ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the DOG graphic display
#define LCD_WIDTH 20
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 20
#define LCD_HEIGHT 4
#endif
#else //no panel but just LCD
#ifdef ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 20
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#endif
#endif
#endif
#define SDSUPPORT
#define LCD_WIDTH 20
#define LCD_HEIGHT 4
// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino

View File

@ -68,13 +68,6 @@ void Config_StoreSettings(uint16_t offset, uint8_t level)
EEPROM_WRITE_VAR(i,max_jerk[Z_AXIS]);
EEPROM_WRITE_VAR(i,max_jerk[E_AXIS]);
EEPROM_WRITE_VAR(i,add_homing);
#ifndef ULTIPANEL
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
#endif
/* EEPROM_WRITE_VAR(i,plaPreheatHotendTemp);
EEPROM_WRITE_VAR(i,plaPreheatHPBTemp);
EEPROM_WRITE_VAR(i,plaPreheatFanSpeed);
@ -100,10 +93,7 @@ void Config_StoreSettings(uint16_t offset, uint8_t level)
EEPROM_WRITE_VAR(i, bedKi);
EEPROM_WRITE_VAR(i, bedKd);
#endif
#ifndef DOGLCD
int lcd_contrast = 32;
#endif
EEPROM_WRITE_VAR(i,lcd_contrast);
// EEPROM_WRITE_VAR(i,lcd_contrast);
#ifdef FWRETRACT
EEPROM_WRITE_VAR(i,autoretract_enabled);
EEPROM_WRITE_VAR(i,retract_length);
@ -247,11 +237,6 @@ bool Config_RetrieveSettings(uint16_t offset, uint8_t level)
if (max_jerk[X_AXIS] > DEFAULT_XJERK) max_jerk[X_AXIS] = DEFAULT_XJERK;
if (max_jerk[Y_AXIS] > DEFAULT_YJERK) max_jerk[Y_AXIS] = DEFAULT_YJERK;
EEPROM_READ_VAR(i,add_homing);
#ifndef ULTIPANEL
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
#endif
/*
EEPROM_READ_VAR(i,plaPreheatHotendTemp);
EEPROM_READ_VAR(i,plaPreheatHPBTemp);
@ -275,10 +260,7 @@ bool Config_RetrieveSettings(uint16_t offset, uint8_t level)
EEPROM_READ_VAR(i, bedKi);
EEPROM_READ_VAR(i, bedKd);
#endif
#ifndef DOGLCD
int lcd_contrast;
#endif
EEPROM_READ_VAR(i,lcd_contrast);
// EEPROM_READ_VAR(i,lcd_contrast);
#ifdef FWRETRACT
EEPROM_READ_VAR(i,autoretract_enabled);
@ -363,9 +345,6 @@ void Config_ResetDefault()
#ifdef ENABLE_AUTO_BED_LEVELING
zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
#endif
#ifdef DOGLCD
lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif
#ifdef PIDTEMP
Kp = DEFAULT_Kp;
Ki = scalePID_i(DEFAULT_Ki);

View File

@ -178,9 +178,7 @@
//Comment to disable setting feedrate multiplier via encoder
#ifdef ULTIPANEL
#define ULTIPANEL_FEEDMULTIPLY
#endif
#define ULTIPANEL_FEEDMULTIPLY
// minimum time in microseconds that a movement needs to take if the buffer is emptied.
#define DEFAULT_MINSEGMENTTIME 20000
@ -328,10 +326,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should
// be commented out otherwise
#define SDCARDDETECTINVERTED
#ifdef ULTIPANEL
#undef SDCARDDETECTINVERTED
#endif
#undef SDCARDDETECTINVERTED
// Power Signal Control Definitions
// By default use ATX definition

View File

@ -33,24 +33,4 @@
#include "Configuration.h"
#include "pins.h"
#ifdef ULTRA_LCD
#if defined(LCD_I2C_TYPE_PCF8575)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#elif defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)
#include <Wire.h>
#include <LiquidTWI2.h>
#elif defined(DOGLCD)
#include <U8glib.h> // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/)
#else
#include "LiquidCrystal_Prusa.h" // library for character LCD
#endif
#endif
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
#include <SPI.h>
#endif
#if defined(DIGIPOT_I2C)
#include <Wire.h>
#endif
#include "LiquidCrystal_Prusa.h" // library for character LCD

View File

@ -341,11 +341,12 @@ void LiquidCrystal_Prusa::noAutoscroll(void) {
// Allows us to fill the first 8 CGRAM locations
// with custom characters
void LiquidCrystal_Prusa::createChar(uint8_t location, uint8_t charmap[]) {
void LiquidCrystal_Prusa::createChar_P(uint8_t location, const uint8_t* charmap)
{
location &= 0x7; // we only have 8 locations 0-7
command(LCD_SETCGRAMADDR | (location << 3));
for (int i=0; i<8; i++)
send(charmap[i], HIGH);
send(pgm_read_byte(&charmap[i]), HIGH);
}
/*********** mid level commands, for sending data/cmds */

View File

@ -80,7 +80,7 @@ public:
void autoscroll();
void noAutoscroll();
void createChar(uint8_t, uint8_t[]);
void createChar_P(uint8_t, const uint8_t*);
void setCursor(uint8_t, uint8_t);
// virtual size_t write(uint8_t);
size_t write(uint8_t);

View File

@ -64,6 +64,7 @@
extern FILE _lcdout;
#define lcdout (&_lcdout)
#include "lcd.h"
extern FILE _uartout;
#define uartout (&_uartout)

View File

@ -58,8 +58,11 @@
#endif
#include "printers.h"
#include "lcd.h"
#include "menu.h"
#include "ultralcd.h"
#include "Configuration_prusa.h"
#include "planner.h"
#include "stepper.h"
#include "temperature.h"
@ -167,7 +170,7 @@
// G92 - Set current position to coordinates given
// M Codes
// M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
// M0 - Unconditional stop - Wait for user to press a button on the LCD
// M1 - Same as M0
// M17 - Enable/Power all stepper motors
// M18 - Disable all stepper motors; same as M84
@ -431,13 +434,11 @@ int fanSpeed=0;
float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
#endif
#ifdef ULTIPANEL
#ifdef PS_DEFAULT_OFF
bool powersupply = false;
#else
bool powersupply = true;
#endif
#endif
bool cancel_heatup = false ;
@ -2022,7 +2023,7 @@ void loop()
manage_heater();
isPrintPaused ? manage_inactivity(true) : manage_inactivity(false);
checkHitEndstops();
lcd_update();
lcd_update(0);
#ifdef PAT9125
fsensor_update();
#endif //PAT9125
@ -3487,7 +3488,7 @@ void process_commands()
cnt++;
manage_heater();
manage_inactivity(true);
//lcd_update();
//lcd_update(0);
if(cnt==0)
{
#if BEEPER > 0
@ -3512,11 +3513,6 @@ void process_commands()
counterBeep++;
#else
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
lcd_buzz(1000/6,100);
#else
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ);
#endif
#endif
}
}
@ -3653,7 +3649,7 @@ void process_commands()
while(millis() < codenum) {
manage_heater();
manage_inactivity();
lcd_update();
lcd_update(0);
}
break;
#ifdef FWRETRACT
@ -4663,7 +4659,6 @@ void process_commands()
} else
switch((int)code_value())
{
#ifdef ULTIPANEL
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
case 1: // M1 - Conditional stop - Wait for user button press on LCD
@ -4699,18 +4694,16 @@ void process_commands()
while(millis() < codenum && !lcd_clicked()){
manage_heater();
manage_inactivity(true);
lcd_update();
lcd_update(0);
}
KEEPALIVE_STATE(IN_HANDLER);
lcd_ignore_click(false);
}else{
if (!lcd_detected())
break;
KEEPALIVE_STATE(PAUSED_FOR_USER);
while(!lcd_clicked()){
manage_heater();
manage_inactivity(true);
lcd_update();
lcd_update(0);
}
KEEPALIVE_STATE(IN_HANDLER);
}
@ -4720,7 +4713,6 @@ void process_commands()
LCD_MESSAGERPGM(_T(WELCOME_MSG));
}
break;
#endif
case 17:
LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE c=0 r=0
enable_x();
@ -5442,7 +5434,7 @@ Sigma_Exit:
}
manage_heater();
manage_inactivity();
lcd_update();
lcd_update(0);
}
LCD_MESSAGERPGM(_T(MSG_BED_DONE));
KEEPALIVE_STATE(IN_HANDLER);
@ -5479,11 +5471,9 @@ Sigma_Exit:
WRITE(SUICIDE_PIN, HIGH);
#endif
#ifdef ULTIPANEL
powersupply = true;
LCD_MESSAGERPGM(_T(WELCOME_MSG));
lcd_update();
#endif
lcd_update(0);
break;
#endif
@ -5503,11 +5493,9 @@ Sigma_Exit:
SET_OUTPUT(PS_ON_PIN);
WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif
#ifdef ULTIPANEL
powersupply = false;
LCD_MESSAGERPGM(CAT4(CUSTOM_MENDEL_NAME,PSTR(" "),MSG_OFF,PSTR(".")));
lcd_update();
#endif
lcd_update(0);
break;
case 82:
@ -5967,7 +5955,7 @@ Sigma_Exit:
while(digitalRead(pin_number) != target){
manage_heater();
manage_inactivity();
lcd_update();
lcd_update(0);
}
}
}
@ -6025,10 +6013,6 @@ Sigma_Exit:
tone(BEEPER, beepS);
delay(beepP);
noTone(BEEPER);
#elif defined(ULTRALCD)
lcd_buzz(beepS, beepP);
#elif defined(LCD_USE_I2C_BUZZER)
lcd_buzz(beepP, beepS);
#endif
}
else
@ -6117,18 +6101,6 @@ Sigma_Exit:
#endif //chdk end if
}
break;
#ifdef DOGLCD
case 250: // M250 Set LCD contrast value: C<value> (value 0..63)
{
if (code_seen('C')) {
lcd_setcontrast( ((int)code_value())&63 );
}
SERIAL_PROTOCOLPGM("lcd contrast value: ");
SERIAL_PROTOCOL(lcd_contrast);
SERIAL_PROTOCOLLN("");
}
break;
#endif
#ifdef PREVENT_DANGEROUS_EXTRUDE
case 302: // allow cold extrudes, or set the minimum extrude temperature
{
@ -6355,11 +6327,6 @@ Sigma_Exit:
counterBeep++;
#else
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
lcd_buzz(1000 / 6, 100);
#else
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#endif
#endif
}
@ -6757,7 +6724,7 @@ Sigma_Exit:
}
manage_heater();
manage_inactivity();
lcd_update();
lcd_update(0);
}
LCD_MESSAGERPGM(_T(MSG_OK));
@ -7778,7 +7745,7 @@ void kill(const char *full_screen_message, unsigned char id)
// FMC small patch to update the LCD before ending
sei(); // enable interrupts
for ( int i=5; i--; lcd_update())
for ( int i=5; i--; lcd_update(0))
{
delay(200);
}
@ -7953,7 +7920,7 @@ void delay_keep_alive(unsigned int ms)
manage_heater();
// Manage inactivity, but don't disable steppers on timeout.
manage_inactivity(true);
lcd_update();
lcd_update(0);
if (ms == 0)
break;
else if (ms >= 50) {
@ -8005,7 +7972,7 @@ void wait_for_heater(long codenum) {
}
manage_heater();
manage_inactivity();
lcd_update();
lcd_update(0);
#ifdef TEMP_RESIDENCY_TIME
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
or when current temp falls outside the hysteresis after target temp was reached */

View File

@ -4,6 +4,7 @@
#include "stepper.h"
#include "temperature.h"
#include "language.h"
#include "lcd.h"
#ifdef SDSUPPORT

664
Firmware/lcd.cpp Normal file
View File

@ -0,0 +1,664 @@
//menu.cpp
#include "lcd.h"
#include <stdio.h>
#include <stdarg.h>
#include <avr/pgmspace.h>
#include "Timer.h"
extern FILE _lcdout;
#define lcdout (&_lcdout)
uint8_t lcd_draw_update = 2;
int32_t lcd_encoder = 0;
uint8_t lcd_encoder_bits = 0;
int8_t lcd_encoder_diff = 0;
uint8_t lcd_buttons = 0;
uint8_t lcd_button_pressed = 0;
uint8_t lcd_update_enabled = 1;
uint32_t lcd_timeoutToStatus = 0;
uint32_t lcd_next_update_millis = 0;
uint8_t lcd_status_update_delay = 0;
uint8_t lcd_long_press_active = 0;
lcd_longpress_func_t lcd_longpress_func = 0;
lcd_charsetup_func_t lcd_charsetup_func = 0;
lcd_lcdupdate_func_t lcd_lcdupdate_func = 0;
uint32_t lcd_button_blanking_time = millis();
ShortTimer longPressTimer;
uint8_t lcd_clicked(void)
{
bool clicked = LCD_CLICKED;
if(clicked) lcd_button_pressed = 1;
return clicked;
}
void lcd_set_cursor(uint8_t c, uint8_t r)
{
lcd_printf_P(PSTR("\x1b[%hhu;%hhuH"), r, c);
}
void lcd_implementation_quick_feedback(void)
{
SET_OUTPUT(BEEPER);
for(int8_t i = 0; i < 10; i++)
{
WRITE(BEEPER,HIGH);
delayMicroseconds(100);
WRITE(BEEPER,LOW);
delayMicroseconds(100);
}
}
void lcd_quick_feedback(void)
{
lcd_draw_update = 2;
lcd_button_pressed = false;
lcd_implementation_quick_feedback();
}
int lcd_puts_P(const char* str)
{
return fputs_P(str, lcdout);
}
int lcd_putc(int c)
{
return fputc(c, lcdout);
}
int lcd_printf_P(const char* format, ...)
{
va_list args;
va_start(args, format);
int ret = vfprintf_P(lcdout, format, args);
va_end(args);
return ret;
}
void lcd_update(uint8_t lcdDrawUpdateOverride)
{
if (lcd_draw_update < lcdDrawUpdateOverride)
lcd_draw_update = lcdDrawUpdateOverride;
if (!lcd_update_enabled)
return;
lcd_buttons_update();
if (lcd_lcdupdate_func)
lcd_lcdupdate_func();
}
void lcd_update_enable(uint8_t enabled)
{
if (lcd_update_enabled != enabled)
{
lcd_update_enabled = enabled;
if (enabled)
{ // Reset encoder position. This is equivalent to re-entering a menu.
lcd_encoder = 0;
lcd_encoder_diff = 0;
// Enabling the normal LCD update procedure.
// Reset the timeout interval.
lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
// Force the keypad update now.
lcd_next_update_millis = millis() - 1;
// Full update.
lcd_implementation_clear();
if (lcd_charsetup_func)
lcd_charsetup_func();
lcd_update(2);
} else
{
// Clear the LCD always, or let it to the caller?
}
}
}
void lcd_buttons_update(void)
{
static bool _lock = false;
if (_lock) return;
_lock = true;
uint8_t newbutton = 0;
if (READ(BTN_EN1) == 0) newbutton |= EN_A;
if (READ(BTN_EN2) == 0) newbutton |= EN_B;
if (lcd_update_enabled)
{ //if we are in non-modal mode, long press can be used and short press triggers with button release
if (READ(BTN_ENC) == 0)
{ //button is pressed
lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
if (millis() > lcd_button_blanking_time)
{
lcd_button_blanking_time = millis() + BUTTON_BLANKING_TIME;
if ((lcd_button_pressed == 0) && (lcd_long_press_active == 0))
{
longPressTimer.start();
lcd_button_pressed = 1;
}
else
{
if (longPressTimer.expired(LONG_PRESS_TIME))
{
lcd_long_press_active = 1;
if (lcd_longpress_func)
lcd_longpress_func();
}
}
}
}
else
{ //button not pressed
if (lcd_button_pressed)
{ //button was released
lcd_button_blanking_time = millis() + BUTTON_BLANKING_TIME;
if (lcd_long_press_active == 0)
{ //button released before long press gets activated
newbutton |= EN_C;
}
//else if (menu_menu == lcd_move_z) lcd_quick_feedback();
//lcd_button_pressed is set back to false via lcd_quick_feedback function
}
else
lcd_long_press_active = 0;
}
}
else
{ //we are in modal mode
if (READ(BTN_ENC) == 0)
newbutton |= EN_C;
}
lcd_buttons = newbutton;
//manage encoder rotation
uint8_t enc = 0;
if (lcd_buttons & EN_A) enc |= B01;
if (lcd_buttons & EN_B) enc |= B10;
if (enc != lcd_encoder_bits)
{
switch (enc)
{
case encrot0:
if (lcd_encoder_bits == encrot3)
lcd_encoder_diff++;
else if (lcd_encoder_bits == encrot1)
lcd_encoder_diff--;
break;
case encrot1:
if (lcd_encoder_bits == encrot0)
lcd_encoder_diff++;
else if (lcd_encoder_bits == encrot2)
lcd_encoder_diff--;
break;
case encrot2:
if (lcd_encoder_bits == encrot1)
lcd_encoder_diff++;
else if (lcd_encoder_bits == encrot3)
lcd_encoder_diff--;
break;
case encrot3:
if (lcd_encoder_bits == encrot2)
lcd_encoder_diff++;
else if (lcd_encoder_bits == encrot0)
lcd_encoder_diff--;
break;
}
}
lcd_encoder_bits = enc;
_lock = false;
}
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
void lcd_implementation_init(void)
{
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd_set_custom_characters();
lcd.clear();
}
void lcd_implementation_init_noclear(void)
{
lcd.begin_noclear(LCD_WIDTH, LCD_HEIGHT);
lcd_set_custom_characters();
}
void lcd_implementation_nodisplay(void)
{
lcd.noDisplay();
}
void lcd_implementation_display(void)
{
lcd.display();
}
void lcd_implementation_clear(void)
{
lcd.clear();
}
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
void lcd_printPGM(const char* str)
{
char c;
while((c = pgm_read_byte(str++)) != '\0')
{
lcd.write(c);
}
}
void lcd_print_at_PGM(uint8_t x, uint8_t y, const char* str)
{
lcd.setCursor(x, y);
char c;
while((c = pgm_read_byte(str++)) != '\0')
{
lcd.write(c);
}
}
void lcd_implementation_write(char c)
{
lcd.write(c);
}
void lcd_implementation_print(int8_t i)
{
lcd.print(i);
}
void lcd_implementation_print_at(uint8_t x, uint8_t y, int8_t i)
{
lcd.setCursor(x, y);
lcd.print(i);
}
void lcd_implementation_print(int i)
{
lcd.print(i);
}
void lcd_implementation_print_at(uint8_t x, uint8_t y, int i)
{
lcd.setCursor(x, y);
lcd.print(i);
}
void lcd_implementation_print(float f)
{
lcd.print(f);
}
void lcd_implementation_print(const char *str)
{
lcd.print(str);
}
void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str)
{
lcd.setCursor(x, y);
lcd.print(str);
}
void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
{
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1;
#else
uint8_t n = LCD_WIDTH - 1 - 2;
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
{
lcd.print(c);
pstr++;
n--;
}
while(n--)
lcd.print(' ');
lcd.print(post_char);
lcd.print(' ');
}
void lcd_implementation_drawmenu_generic_RAM(uint8_t row, const char* str, char pre_char, char post_char)
{
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1;
#else
uint8_t n = LCD_WIDTH - 1 - 2;
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
while( ((c = *str) != '\0') && (n>0) )
{
lcd.print(c);
str++;
n--;
}
while(n--)
lcd.print(' ');
lcd.print(post_char);
lcd.print(' ');
}
void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
{
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data);
#else
uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
{
lcd.print(c);
pstr++;
n--;
}
lcd.print(':');
while(n--)
lcd.print(' ');
lcd.print(data);
}
void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
{
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data);
#else
uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
{
lcd.print(c);
pstr++;
n--;
}
lcd.print(':');
while(n--)
lcd.print(' ');
lcd_printPGM(data);
}
void lcd_implementation_drawedit(const char* pstr, char* value)
{
lcd.setCursor(1, 1);
lcd_printPGM(pstr);
lcd.print(':');
#if LCD_WIDTH < 20
lcd.setCursor(LCD_WIDTH - strlen(value), 1);
#else
lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
#endif
lcd.print(value);
}
void lcd_implementation_drawedit_2(const char* pstr, char* value)
{
lcd.setCursor(0, 1);
lcd_printPGM(pstr);
lcd.print(':');
lcd.setCursor((LCD_WIDTH - strlen(value))/2, 3);
lcd.print(value);
lcd.print(" mm");
}
////////////////////////////////////////////////////////////////////////////////
// Custom character data
const uint8_t lcd_chardata_bedTemp[8] PROGMEM = {
B00000,
B11111,
B10101,
B10001,
B10101,
B11111,
B00000,
B00000}; //thanks Sonny Mounicou
const uint8_t lcd_chardata_degree[8] PROGMEM = {
B01100,
B10010,
B10010,
B01100,
B00000,
B00000,
B00000,
B00000};
const uint8_t lcd_chardata_thermometer[8] PROGMEM = {
B00100,
B01010,
B01010,
B01010,
B01010,
B10001,
B10001,
B01110};
const uint8_t lcd_chardata_uplevel[8] PROGMEM = {
B00100,
B01110,
B11111,
B00100,
B11100,
B00000,
B00000,
B00000}; //thanks joris
const uint8_t lcd_chardata_refresh[8] PROGMEM = {
B00000,
B00110,
B11001,
B11000,
B00011,
B10011,
B01100,
B00000}; //thanks joris
const uint8_t lcd_chardata_folder[8] PROGMEM = {
B00000,
B11100,
B11111,
B10001,
B10001,
B11111,
B00000,
B00000}; //thanks joris
const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
B11100,
B10000,
B11000,
B10111,
B00101,
B00110,
B00101,
B00000}; //thanks Sonny Mounicou
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
B11100,
B10100,
B11000,
B10100,
B00000,
B00111,
B00010,
B00010};*/
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
B01100,
B10011,
B00000,
B01100,
B10011,
B00000,
B01100,
B10011};*/
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
B00000,
B00100,
B10010,
B01001,
B10010,
B00100,
B00000,
B00000};*/
const uint8_t lcd_chardata_clock[8] PROGMEM = {
B00000,
B01110,
B10011,
B10101,
B10001,
B01110,
B00000,
B00000}; //thanks Sonny Mounicou
const uint8_t lcd_chardata_arrup[8] PROGMEM = {
B00100,
B01110,
B11111,
B00000,
B00000,
B00000,
B00000,
B00000};
const uint8_t lcd_chardata_arrdown[8] PROGMEM = {
B00000,
B00000,
B00000,
B00000,
B00000,
B10001,
B01010,
B00100};
void lcd_set_custom_characters(void)
{
lcd.createChar_P(LCD_STR_BEDTEMP[0], lcd_chardata_bedTemp);
lcd.createChar_P(LCD_STR_DEGREE[0], lcd_chardata_degree);
lcd.createChar_P(LCD_STR_THERMOMETER[0], lcd_chardata_thermometer);
lcd.createChar_P(LCD_STR_UPLEVEL[0], lcd_chardata_uplevel);
lcd.createChar_P(LCD_STR_REFRESH[0], lcd_chardata_refresh);
lcd.createChar_P(LCD_STR_FOLDER[0], lcd_chardata_folder);
lcd.createChar_P(LCD_STR_FEEDRATE[0], lcd_chardata_feedrate);
lcd.createChar_P(LCD_STR_CLOCK[0], lcd_chardata_clock);
//lcd.createChar_P(LCD_STR_ARROW_UP[0], lcd_chardata_arrup);
//lcd.createChar_P(LCD_STR_ARROW_DOWN[0], lcd_chardata_arrdown);
}
void lcd_set_custom_characters_arrows(void)
{
lcd.createChar_P(1, lcd_chardata_arrdown);
}
const uint8_t lcd_chardata_progress[8] PROGMEM = {
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111};
void lcd_set_custom_characters_progress(void)
{
lcd.createChar_P(1, lcd_chardata_progress);
}
const uint8_t lcd_chardata_arr2down[8] PROGMEM = {
B00000,
B00000,
B10001,
B01010,
B00100,
B10001,
B01010,
B00100};
const uint8_t lcd_chardata_confirm[8] PROGMEM = {
B00000,
B00001,
B00011,
B10110,
B11100,
B01000,
B00000};
void lcd_set_custom_characters_nextpage(void)
{
lcd.createChar_P(1, lcd_chardata_arr2down);
lcd.createChar_P(2, lcd_chardata_confirm);
}
void lcd_set_custom_characters_degree(void)
{
lcd.createChar_P(1, lcd_chardata_degree);
}

240
Firmware/lcd.h Normal file
View File

@ -0,0 +1,240 @@
//lcd.h
#ifndef _LCD_H
#define _LCD_H
#include <inttypes.h>
#define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 30000
typedef void (*lcd_longpress_func_t)(void);
typedef void (*lcd_charsetup_func_t)(void);
typedef void (*lcd_lcdupdate_func_t)(void);
//Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
extern uint8_t lcd_draw_update;
extern int32_t lcd_encoder;
extern uint8_t lcd_encoder_bits;
// lcd_encoder_diff is updated from interrupt context and added to lcd_encoder every LCD update
extern int8_t lcd_encoder_diff;
//the last checked lcd_buttons in a bit array.
extern uint8_t lcd_buttons;
extern uint8_t lcd_button_pressed;
extern uint8_t lcd_update_enabled;
extern uint32_t lcd_timeoutToStatus;
extern uint32_t lcd_next_update_millis;
extern uint8_t lcd_status_update_delay;
extern uint8_t lcd_long_press_active;
extern lcd_longpress_func_t lcd_longpress_func;
extern lcd_charsetup_func_t lcd_charsetup_func;
extern lcd_lcdupdate_func_t lcd_lcdupdate_func;
extern uint8_t lcd_clicked(void);
extern void lcd_set_cursor(uint8_t c, uint8_t r);
extern void lcd_implementation_quick_feedback(void);
//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
extern void lcd_quick_feedback(void);
extern int lcd_puts_P(const char* str);
extern int lcd_putc(int c);
extern int lcd_printf_P(const char* format, ...);
extern void lcd_update(uint8_t lcdDrawUpdateOverride);
extern void lcd_update_enable(uint8_t enabled);
extern void lcd_buttons_update(void);
#include "Configuration_prusa.h"
#include "Marlin.h"
/**
* Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays.
* When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters.
**/
////////////////////////////////////
// Setup button and encode mappings for each panel (into 'lcd_buttons' variable
//
// This is just to map common functions (across different panels) onto the same
// macro name. The mapping is independent of whether the button is directly connected or
// via a shift/i2c register.
#define BLEN_B 1
#define BLEN_A 0
#define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A (1<<BLEN_A)
#define BLEN_C 2
#define EN_C (1<<BLEN_C)
#define LCD_CLICKED (lcd_buttons&EN_C)
////////////////////////
// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
// These values are independent of which pins are used for EN_A and EN_B indications
// The rotary encoder part is also independent to the chipset used for the LCD
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
////////////////////////////////////
// Create LCD class instance and chipset-specific information
#include "LiquidCrystal_Prusa.h"
#define LCD_CLASS LiquidCrystal_Prusa
extern LCD_CLASS lcd;
//Custom characters defined in the first 8 characters of the LCD
#define LCD_STR_BEDTEMP "\x00"
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_UP "\x0B"
#define LCD_STR_ARROW_DOWN "\x01"
#define LCD_STR_ARROW_RIGHT "\x7E" //from the default character set
extern void lcd_set_custom_characters(void);
extern void lcd_set_custom_characters_arrows(void);
extern void lcd_set_custom_characters_progress(void);
extern void lcd_set_custom_characters_nextpage(void);
extern void lcd_set_custom_characters_degree(void);
extern void lcd_implementation_init(void);
extern void lcd_implementation_init_noclear(void);
extern void lcd_implementation_nodisplay(void);
extern void lcd_implementation_display(void);
extern void lcd_implementation_clear(void);
// Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own
extern void lcd_printPGM(const char* str);
extern void lcd_print_at_PGM(uint8_t x, uint8_t y, const char* str);
extern void lcd_implementation_write(char c);
extern void lcd_implementation_print(int8_t i);
extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int8_t i);
extern void lcd_implementation_print(int i);
extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int i);
extern void lcd_implementation_print(float f);
extern void lcd_implementation_print(const char *str);
extern void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str);
extern void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char);
extern void lcd_implementation_drawmenu_generic_RAM(uint8_t row, const char* str, char pre_char, char post_char);
extern void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data);
extern void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data);
extern char *wfac_to_str5(const uint8_t &x);
extern char *mres_to_str3(const uint8_t &x);
#define lcd_implementation_drawmenu_setting_edit_wfac_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', wfac_to_str5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_wfac(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', wfac_to_str5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_mres_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', mres_to_str3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_mres(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', mres_to_str3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_byte3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3((uint8_t)*(data)))
#define lcd_implementation_drawmenu_setting_edit_byte3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3((uint8_t)*(data)))
#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float43_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float43(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
//Add version for callback functions
#define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float43_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float43(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
extern void lcd_implementation_drawedit(const char* pstr, char* value);
extern void lcd_implementation_drawedit_2(const char* pstr, char* value);
#endif //_LCD_H

270
Firmware/menu.cpp Normal file
View File

@ -0,0 +1,270 @@
//menu.cpp
#include "menu.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <avr/pgmspace.h>
#include "lcd.h"
extern int32_t lcd_encoder;
menu_record_t menu_stack[MENU_DEPTH_MAX];
uint8_t menu_data[MENU_DATA_SIZE];
uint8_t menu_depth = 0;
uint8_t menu_line = 0;
uint8_t menu_item = 0;
uint8_t menu_row = 0;
uint8_t menu_top = 0;
uint8_t menu_clicked = 0;
menu_func_t menu_menu = 0;
void menu_goto(menu_func_t menu, const uint32_t encoder, const bool feedback, bool reset_menu_state)
{
asm("cli");
if (menu_menu != menu)
{
menu_menu = menu;
lcd_encoder = encoder;
asm("sei");
if (reset_menu_state)
{
// Resets the global shared C union.
// This ensures, that the menu entered will find out, that it shall initialize itself.
memset(&menu_data, 0, sizeof(menu_data));
}
if (feedback) lcd_quick_feedback();
}
else
asm("sei");
}
void menu_start(void)
{
if (lcd_encoder > 0x8000) lcd_encoder = 0;
if (lcd_encoder < 0) lcd_encoder = 0;
if (lcd_encoder < menu_top)
menu_top = lcd_encoder;
menu_line = menu_top;
menu_clicked = LCD_CLICKED;
}
void menu_end(void)
{
if (lcd_encoder >= menu_item)
lcd_encoder = menu_item - 1;
if (((uint8_t)lcd_encoder) >= menu_top + LCD_HEIGHT)
{
menu_top = lcd_encoder - LCD_HEIGHT + 1;
lcd_draw_update = 1;
menu_line = menu_top - 1;
menu_row = -1;
}
}
void menu_back(void)
{
if (menu_depth > 0) menu_goto(menu_stack[--menu_depth].menu, menu_stack[menu_depth].position, true, true);
}
void menu_back_if_clicked(void)
{
if (lcd_clicked())
menu_back();
}
void menu_back_if_clicked_fb(void)
{
if (lcd_clicked())
{
lcd_quick_feedback();
menu_back();
}
}
void menu_submenu(menu_func_t submenu)
{
if (menu_depth <= MENU_DEPTH_MAX)
{
menu_stack[menu_depth].menu = menu_menu;
menu_stack[menu_depth++].position = lcd_encoder;
menu_goto(submenu, 0, true, true);
}
}
uint8_t menu_item_ret(void)
{
lcd_implementation_quick_feedback();
lcd_draw_update = 2;
lcd_button_pressed = false;
return 1;
}
/*
int menu_item_printf_P(char type_char, const char* format, ...)
{
va_list args;
va_start(args, format);
int ret = 0;
lcd_set_cursor(0, menu_row);
if (lcd_encoder == menu_item)
lcd.print('>');
else
lcd.print(' ');
int cnt = vfprintf_P(lcdout, format, args);
for (int i = cnt; i < 18; i++)
lcd.print(' ');
lcd.print(type_char);
va_end(args);
return ret;
}
*/
int menu_draw_item_puts_P(char type_char, const char* str)
{
lcd_set_cursor(0, menu_row);
int cnt = lcd_printf_P(PSTR("%c%-18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char);
return cnt;
}
/*
int menu_draw_item_puts_P_int16(char type_char, const char* str, int16_t val, )
{
lcd_set_cursor(0, menu_row);
int cnt = lcd_printf_P(PSTR("%c%-18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char);
return cnt;
}
*/
void menu_item_dummy(void)
{
menu_item++;
}
uint8_t menu_item_text_P(const char* str)
{
if (menu_item == menu_line)
{
if (lcd_draw_update) menu_draw_item_puts_P(' ', str);
if (menu_clicked && (lcd_encoder == menu_item))
return menu_item_ret();
}
menu_item++;
return 0;
}
uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu)
{
if (menu_item == menu_line)
{
if (lcd_draw_update) menu_draw_item_puts_P(LCD_STR_ARROW_RIGHT[0], str);
if (menu_clicked && (lcd_encoder == menu_item))
{
menu_submenu(submenu);
return menu_item_ret();
}
}
menu_item++;
return 0;
}
uint8_t menu_item_back_P(const char* str)
{
if (menu_item == menu_line)
{
if (lcd_draw_update) menu_draw_item_puts_P(LCD_STR_UPLEVEL[0], str);
if (menu_clicked && (lcd_encoder == menu_item))
{
menu_back();
return menu_item_ret();
}
}
menu_item++;
return 0;
}
uint8_t menu_item_function_P(const char* str, menu_func_t func)
{
if (menu_item == menu_line)
{
if (lcd_draw_update) menu_draw_item_puts_P(' ', str);
if (menu_clicked && (lcd_encoder == menu_item))
{
menu_clicked = false;
if (func) func();
return menu_item_ret();
}
}
menu_item++;
return 0;
}
uint8_t menu_item_gcode_P(const char* str, const char* str_gcode)
{
if (menu_item == menu_line)
{
if (lcd_draw_update) menu_draw_item_puts_P(' ', str);
if (menu_clicked && (lcd_encoder == menu_item))
{
if (str_gcode) enquecommand_P(str_gcode);
return menu_item_ret();
}
}
menu_item++;
return 0;
}
const char menu_fmt_int3[] PROGMEM = "%c%S:\x1b[%hhu;16H%3d";
#define _menu_data (*((menu_data_edit_t*)menu_data))
void _menu_edit_int3(void)
{
if (lcd_draw_update)
{
if (lcd_encoder < _menu_data.minEditValue) lcd_encoder = _menu_data.minEditValue;
if (lcd_encoder > _menu_data.maxEditValue) lcd_encoder = _menu_data.maxEditValue;
lcd_set_cursor(0, 1);
lcd_printf_P(menu_fmt_int3, ' ', _menu_data.editLabel, (uint8_t)1, (int)lcd_encoder);
}
if (LCD_CLICKED)
{
*((int*)(_menu_data.editValue)) = (int)lcd_encoder;
menu_back();
}
}
uint8_t menu_item_edit_int3(const char* str, int16_t* pval, int16_t min_val, int16_t max_val)
{
if (menu_item == menu_line)
{
if (lcd_draw_update)
{
lcd_set_cursor(0, menu_row);
lcd_printf_P(menu_fmt_int3, (lcd_encoder == menu_item)?'>':' ', str, menu_row, *pval);
}
if (menu_clicked && (lcd_encoder == menu_item))
{
menu_submenu(_menu_edit_int3);
_menu_data.editLabel = str;
_menu_data.editValue = pval;
_menu_data.minEditValue = min_val;
_menu_data.maxEditValue = max_val;
lcd_encoder = *pval;
return menu_item_ret();
}
}
menu_item++;
return 0;
}
#undef _menu_data

99
Firmware/menu.h Normal file
View File

@ -0,0 +1,99 @@
//menu.h
#ifndef _MENU_H
#define _MENU_H
#include <inttypes.h>
#define MENU_DEPTH_MAX 4
#define MENU_DATA_SIZE 32
//Function pointer to menu functions.
typedef void (*menu_func_t)(void);
typedef struct
{
menu_func_t menu;
uint8_t position;
} menu_record_t;
typedef struct
{
//Variables used when editing values.
const char* editLabel;
void* editValue;
int32_t minEditValue;
int32_t maxEditValue;
} menu_data_edit_t;
extern menu_record_t menu_stack[MENU_DEPTH_MAX];
extern uint8_t menu_data[MENU_DATA_SIZE];
extern uint8_t menu_depth;
extern uint8_t menu_line;
extern uint8_t menu_item;
extern uint8_t menu_row;
;
//scroll offset in the current menu
extern uint8_t menu_top;
extern uint8_t menu_clicked;
//function pointer to the currently active menu
extern menu_func_t menu_menu;
extern void menu_goto(menu_func_t menu, const uint32_t encoder, const bool feedback, bool reset_menu_state);
#define MENU_BEGIN() menu_start(); for(menu_row = 0; menu_row < LCD_HEIGHT; menu_row++, menu_line++) { menu_item = 0;
void menu_start(void);
#define MENU_END() menu_end(); }
extern void menu_end(void);
extern void menu_back(void);
extern void menu_back_if_clicked(void);
extern void menu_back_if_clicked_fb(void);
extern void menu_submenu(menu_func_t submenu);
extern uint8_t menu_item_ret(void);
//int menu_item_printf_P(char type_char, const char* format, ...);
extern int menu_draw_item_puts_P(char type_char, const char* str);
//int menu_draw_item_puts_P_int16(char type_char, const char* str, int16_t val, );
#define MENU_ITEM_DUMMY() menu_item_dummy()
extern void menu_item_dummy(void);
#define MENU_ITEM_TEXT_P(str) do { if (menu_item_text_P(str)) return; } while (0)
extern uint8_t menu_item_text_P(const char* str);
#define MENU_ITEM_SUBMENU_P(str, submenu) do { if (menu_item_submenu_P(str, submenu)) return; } while (0)
extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu);
#define MENU_ITEM_BACK_P(str) do { if (menu_item_back_P(str)) return; } while (0)
extern uint8_t menu_item_back_P(const char* str);
#define MENU_ITEM_FUNCTION_P(str, func) do { if (menu_item_function_P(str, func)) return; } while (0)
extern uint8_t menu_item_function_P(const char* str, menu_func_t func);
#define MENU_ITEM_GCODE_P(str, str_gcode) do { if (menu_item_gcode_P(str, str_gcode)) return; } while (0)
extern uint8_t menu_item_gcode_P(const char* str, const char* str_gcode);
extern const char menu_fmt_int3[];
extern void _menu_edit_int3(void);
#define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_int3(str, pval, minval, maxval)) return; } while (0)
//#define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) MENU_ITEM_EDIT(int3, str, pval, minval, maxval)
extern uint8_t menu_item_edit_int3(const char* str, int16_t* pval, int16_t min_val, int16_t max_val);
#endif //_MENU_H

View File

@ -95,11 +95,9 @@
#define KILL_PIN -1 // 80 with Smart Controller LCD
#define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing.
#ifdef ULTRA_LCD
//#define KILL_PIN 32
#ifdef NEWPANEL
//#define LCD_PWM_PIN -1//32 // lcd backlight brightnes pwm control pin
//#define LCD_PWM_MAX 0x0f // lcd pwm maximum value (0x07=64Hz, 0x0f=32Hz, 0x1f=16Hz)
@ -122,8 +120,6 @@
#define TACH_0 79 // !!! changed from 81 (EINY03)
#define TACH_1 80
#endif //NEWPANEL
#endif //ULTRA_LCD
// Support for an 8 bit logic analyzer, for example the Saleae.
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.

View File

@ -83,11 +83,9 @@
#define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing.
#define TACH_0 30 // noctua extruder fan
#ifdef ULTRA_LCD
//#define KILL_PIN 32
#ifdef NEWPANEL
#define BEEPER 78 // Beeper on AUX-4
#define LCD_PINS_RS 38
@ -105,8 +103,6 @@
#define SDCARDDETECT 72
#endif //NEWPANEL
#endif //ULTRA_LCD
// Support for an 8 bit logic analyzer, for example the Saleae.
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.

View File

@ -83,11 +83,9 @@
#define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing.
#define TACH_0 30 // noctua extruder fan
#ifdef ULTRA_LCD
//#define KILL_PIN 32
#ifdef NEWPANEL
#define BEEPER 84 // Beeper on AUX-4
#define LCD_PINS_RS 82
@ -105,8 +103,6 @@
#define SDCARDDETECT 15
#endif //NEWPANEL
#endif //ULTRA_LCD
// Support for an 8 bit logic analyzer, for example the Saleae.
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.

View File

@ -646,10 +646,10 @@ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate
manage_heater();
// Vojtech: Don't disable motors inside the planner!
manage_inactivity(false);
lcd_update();
lcd_update(0);
} while (block_buffer_tail == next_buffer_head);
if (waiting_inside_plan_buffer_line_print_aborted) {
// Inside the lcd_update() routine the print has been aborted.
// Inside the lcd_update(0) routine the print has been aborted.
// Cancel the print, do not plan the current line this routine is waiting on.
#ifdef PLANNER_DIAGNOSTICS
planner_update_queue_min_counter();

View File

@ -1325,13 +1325,13 @@ void st_synchronize()
if (!tmc2130_update_sg())
{
manage_inactivity(true);
lcd_update();
lcd_update(0);
}
#else //TMC2130
manage_heater();
// Vojtech: Don't disable motors inside the planner!
manage_inactivity(true);
lcd_update();
lcd_update(0);
#endif //TMC2130
}
}

View File

@ -30,6 +30,7 @@
#include "Marlin.h"
#include "lcd.h"
#include "ultralcd.h"
#include "temperature.h"
#include "cardreader.h"
@ -403,7 +404,7 @@ unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
pid_cycle = 0;
return;
}
lcd_update();
lcd_update(0);
}
}
@ -1332,7 +1333,7 @@ void temp_runaway_stop(bool isPreheat, bool isBed)
disable_e1();
disable_e2();
manage_heater();
lcd_update();
lcd_update(0);
WRITE(BEEPER, HIGH);
delayMicroseconds(500);
WRITE(BEEPER, LOW);

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,13 @@
extern int lcd_puts_P(const char* str);
extern int lcd_printf_P(const char* format, ...);
#ifdef ULTRA_LCD
extern void menu_lcd_longpress_func(void);
extern void menu_lcd_charsetup_func(void);
extern void menu_lcd_lcdupdate_func(void);
static void lcd_language_menu();
void lcd_update(uint8_t lcdDrawUpdateOverride = 0);
// Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
void lcd_update_enable(bool enable);
void lcd_init();
void lcd_setstatus(const char* message);
void lcd_setstatuspgm(const char* message);
@ -37,7 +37,6 @@ extern int lcd_printf_P(const char* format, ...);
void lcd_confirm_print();
unsigned char lcd_choose_color();
//void lcd_mylang();
bool lcd_detected(void);
static void lcd_selftest_v();
extern bool lcd_selftest();
@ -81,10 +80,6 @@ extern int lcd_printf_P(const char* format, ...);
extern void lcd_diag_show_end_stops();
#ifdef DOGLCD
extern int lcd_contrast;
void lcd_setcontrast(uint8_t value);
#endif
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
@ -93,18 +88,7 @@ extern int lcd_printf_P(const char* format, ...);
#define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
#define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
#define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 30000
#ifdef ULTIPANEL
void lcd_buttons_update();
extern volatile uint8_t buttons; //the last checked buttons in a bit array.
#ifdef REPRAPWORLD_KEYPAD
extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
#endif
#else
FORCE_INLINE void lcd_buttons_update() {}
#endif
// To be used in lcd_commands_type.
@ -143,65 +127,10 @@ extern int lcd_printf_P(const char* format, ...);
extern bool cancel_heatup;
extern bool isPrintPaused;
void lcd_buzz(long duration,uint16_t freq);
bool lcd_clicked();
void lcd_ignore_click(bool b=true);
void lcd_commands();
#ifdef NEWPANEL
#define EN_C (1<<BLEN_C)
#define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A)
#define LCD_CLICKED (buttons&EN_C)
#ifdef REPRAPWORLD_KEYPAD
#define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
#define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
#define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
#define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
#define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
#define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
#define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
#define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
#define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
#define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
#define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
#define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
#endif //REPRAPWORLD_KEYPAD
#else
//atomic, do not change
#define B_LE (1<<BL_LE)
#define B_UP (1<<BL_UP)
#define B_MI (1<<BL_MI)
#define B_DW (1<<BL_DW)
#define B_RI (1<<BL_RI)
#define B_ST (1<<BL_ST)
#define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A)
#define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
#endif//NEWPANEL
#else //no LCD
FORCE_INLINE void
{}
FORCE_INLINE void lcd_init() {}
FORCE_INLINE void lcd_setstatus(const char* message) {}
FORCE_INLINE void lcd_buttons_update() {}
FORCE_INLINE void lcd_reset_alert_level() {}
FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
FORCE_INLINE bool lcd_detected(void) { return true; }
#define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x)
#endif //ULTRA_LCD
char *itostr2(const uint8_t &x);
char *itostr31(const int &xx);

File diff suppressed because it is too large Load Diff

View File

@ -304,7 +304,7 @@ bool show_upgrade_dialog_if_version_newer(const char *version_string)
lcd_wait_for_click();
lcd_update_enable(true);
lcd_implementation_clear();
lcd_update();
lcd_update(0);
}
// Succeeded.

View File

@ -136,7 +136,6 @@
//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages
//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3)
//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3)
//#define DEBUG_BLINK_ACTIVE
//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled)
//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled)
//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line

View File

@ -136,7 +136,6 @@
//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages
//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3)
//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3)
//#define DEBUG_BLINK_ACTIVE
//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled)
//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled)
//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line

View File

@ -177,7 +177,6 @@
//#define DEBUG_DISABLE_FORCE_SELFTEST //disable force selftest
//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3)
//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3)
//#define DEBUG_BLINK_ACTIVE
//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled)
//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled)
#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line