2012-12-12 10:47:03 +00:00
# ifndef ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
# define ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
/**
* Implementation of the LCD display routines for a hitachi HD44780 display . These are common LCD character displays .
* When selecting the rusian language , a slightly different LCD implementation is used to handle UTF8 characters .
* */
# if LANGUAGE_CHOICE == 6
# include "LiquidCrystalRus.h"
# define LCD_CLASS LiquidCrystalRus
# else
2013-05-06 14:44:38 +00:00
# ifdef LCD_I2C_TYPE_PCA8574
# include <LiquidCrystal_I2C.h>
# define LCD_CLASS LiquidCrystal_I2C
# else
# include <LiquidCrystal.h>
# define LCD_CLASS LiquidCrystal
# endif
2012-12-12 10:47:03 +00:00
# endif
/* 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_RIGHT "\x7E" /* from the default character set */
2013-05-06 14:44:38 +00:00
# ifdef LCD_I2C_TYPE_PCA8574
LCD_CLASS lcd ( LCD_I2C_ADDRESS , LCD_WIDTH , LCD_HEIGHT ) ;
# else
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
# endif
2012-12-12 10:47:03 +00:00
static void lcd_implementation_init ( )
{
byte bedTemp [ 8 ] =
{
B00000 ,
B11111 ,
B10101 ,
B10001 ,
B10101 ,
B11111 ,
B00000 ,
B00000
} ; //thanks Sonny Mounicou
byte degree [ 8 ] =
{
B01100 ,
B10010 ,
B10010 ,
B01100 ,
B00000 ,
B00000 ,
B00000 ,
B00000
} ;
byte thermometer [ 8 ] =
{
B00100 ,
B01010 ,
B01010 ,
B01010 ,
B01010 ,
B10001 ,
B10001 ,
B01110
} ;
byte uplevel [ 8 ] = {
B00100 ,
B01110 ,
B11111 ,
B00100 ,
B11100 ,
B00000 ,
B00000 ,
B00000
} ; //thanks joris
byte refresh [ 8 ] = {
B00000 ,
B00110 ,
B11001 ,
B11000 ,
B00011 ,
B10011 ,
B01100 ,
B00000 ,
} ; //thanks joris
byte folder [ 8 ] = {
B00000 ,
B11100 ,
B11111 ,
B10001 ,
B10001 ,
B11111 ,
B00000 ,
B00000
} ; //thanks joris
byte feedrate [ 8 ] = {
B11100 ,
B10000 ,
B11000 ,
B10111 ,
B00101 ,
B00110 ,
B00101 ,
B00000
} ; //thanks Sonny Mounicou
byte clock [ 8 ] = {
B00000 ,
B01110 ,
B10011 ,
B10101 ,
B10001 ,
B01110 ,
B00000 ,
B00000
} ; //thanks Sonny Mounicou
2013-05-06 14:44:38 +00:00
# ifdef LCD_I2C_TYPE_PCA8574
lcd . init ( ) ;
lcd . backlight ( ) ;
# else
lcd . begin ( LCD_WIDTH , LCD_HEIGHT ) ;
# endif
2012-12-12 10:47:03 +00:00
lcd . createChar ( LCD_STR_BEDTEMP [ 0 ] , bedTemp ) ;
lcd . createChar ( LCD_STR_DEGREE [ 0 ] , degree ) ;
lcd . createChar ( LCD_STR_THERMOMETER [ 0 ] , thermometer ) ;
lcd . createChar ( LCD_STR_UPLEVEL [ 0 ] , uplevel ) ;
lcd . createChar ( LCD_STR_REFRESH [ 0 ] , refresh ) ;
lcd . createChar ( LCD_STR_FOLDER [ 0 ] , folder ) ;
lcd . createChar ( LCD_STR_FEEDRATE [ 0 ] , feedrate ) ;
lcd . createChar ( LCD_STR_CLOCK [ 0 ] , clock ) ;
lcd . clear ( ) ;
}
static void lcd_implementation_clear ( )
{
lcd . clear ( ) ;
}
2012-12-14 09:53:11 +00:00
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
static void lcd_printPGM ( const char * str )
{
char c ;
while ( ( c = pgm_read_byte ( str + + ) ) ! = ' \0 ' )
{
lcd . write ( c ) ;
}
}
2012-12-12 10:47:03 +00:00
/*
Possible status screens :
16 x2 | 01234567 89012345 |
| 000 / 000 B000 / 000 |
| Status line . . . . . |
16 x4 | 01234567 89012345 |
| 000 / 000 B000 / 000 |
| SD100 % Z000 .0 |
| F100 % T - - : - - |
| Status line . . . . . |
20 x2 | 01234567 890123456789 |
| T000 / 000 D B000 / 000 D |
| Status line . . . . . . . . . |
20 x4 | 01234567 890123456789 |
| T000 / 000 D B000 / 000 D |
| X + 000.0 Y + 000.0 Z + 000.0 |
| F100 % SD100 % T - - : - - |
| Status line . . . . . . . . . |
20 x4 | 01234567 890123456789 |
| T000 / 000 D B000 / 000 D |
| T000 / 000 D Z000 .0 |
| F100 % SD100 % T - - : - - |
| Status line . . . . . . . . . |
*/
static void lcd_implementation_status_screen ( )
{
int tHotend = int ( degHotend ( 0 ) + 0.5 ) ;
int tTarget = int ( degTargetHotend ( 0 ) + 0.5 ) ;
# if LCD_WIDTH < 20
lcd . setCursor ( 0 , 0 ) ;
lcd . print ( itostr3 ( tHotend ) ) ;
lcd . print ( ' / ' ) ;
lcd . print ( itostr3left ( tTarget ) ) ;
# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd . setCursor ( 8 , 0 ) ;
# if EXTRUDERS > 1
tHotend = int ( degHotend ( 1 ) + 0.5 ) ;
tTarget = int ( degTargetHotend ( 1 ) + 0.5 ) ;
lcd . print ( LCD_STR_THERMOMETER [ 0 ] ) ;
# else //Heated bed
tHotend = int ( degBed ( ) + 0.5 ) ;
tTarget = int ( degTargetBed ( ) + 0.5 ) ;
lcd . print ( LCD_STR_BEDTEMP [ 0 ] ) ;
# endif
lcd . print ( itostr3 ( tHotend ) ) ;
lcd . print ( ' / ' ) ;
lcd . print ( itostr3left ( tTarget ) ) ;
# endif //EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
# else //LCD_WIDTH > 19
lcd . setCursor ( 0 , 0 ) ;
lcd . print ( LCD_STR_THERMOMETER [ 0 ] ) ;
lcd . print ( itostr3 ( tHotend ) ) ;
lcd . print ( ' / ' ) ;
lcd . print ( itostr3left ( tTarget ) ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( LCD_STR_DEGREE " " ) ) ;
2012-12-17 10:09:09 +00:00
if ( tTarget < 10 )
lcd . print ( ' ' ) ;
2012-12-12 10:47:03 +00:00
# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd . setCursor ( 10 , 0 ) ;
# if EXTRUDERS > 1
tHotend = int ( degHotend ( 1 ) + 0.5 ) ;
tTarget = int ( degTargetHotend ( 1 ) + 0.5 ) ;
lcd . print ( LCD_STR_THERMOMETER [ 0 ] ) ;
# else //Heated bed
tHotend = int ( degBed ( ) + 0.5 ) ;
tTarget = int ( degTargetBed ( ) + 0.5 ) ;
lcd . print ( LCD_STR_BEDTEMP [ 0 ] ) ;
# endif
lcd . print ( itostr3 ( tHotend ) ) ;
lcd . print ( ' / ' ) ;
lcd . print ( itostr3left ( tTarget ) ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( LCD_STR_DEGREE " " ) ) ;
2012-12-17 10:09:09 +00:00
if ( tTarget < 10 )
lcd . print ( ' ' ) ;
2012-12-12 10:47:03 +00:00
# endif //EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
# endif //LCD_WIDTH > 19
# if LCD_HEIGHT > 2
//Lines 2 for 4 line LCD
# if LCD_WIDTH < 20
# ifdef SDSUPPORT
lcd . setCursor ( 0 , 2 ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( " SD " ) ) ;
2012-12-12 10:47:03 +00:00
if ( IS_SD_PRINTING )
lcd . print ( itostr3 ( card . percentDone ( ) ) ) ;
else
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( " --- " ) ) ;
2012-12-12 10:47:03 +00:00
lcd . print ( ' % ' ) ;
# endif //SDSUPPORT
# else //LCD_WIDTH > 19
# if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
//If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
tHotend = int ( degBed ( ) + 0.5 ) ;
tTarget = int ( degTargetBed ( ) + 0.5 ) ;
lcd . setCursor ( 0 , 1 ) ;
lcd . print ( LCD_STR_BEDTEMP [ 0 ] ) ;
lcd . print ( itostr3 ( tHotend ) ) ;
lcd . print ( ' / ' ) ;
lcd . print ( itostr3left ( tTarget ) ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( LCD_STR_DEGREE " " ) ) ;
2012-12-17 10:09:09 +00:00
if ( tTarget < 10 )
lcd . print ( ' ' ) ;
2012-12-12 10:47:03 +00:00
# else
lcd . setCursor ( 0 , 1 ) ;
lcd . print ( ' X ' ) ;
lcd . print ( ftostr3 ( current_position [ X_AXIS ] ) ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( " Y " ) ) ;
2012-12-12 10:47:03 +00:00
lcd . print ( ftostr3 ( current_position [ Y_AXIS ] ) ) ;
# endif //EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
# endif //LCD_WIDTH > 19
2013-01-08 10:53:18 +00:00
lcd . setCursor ( LCD_WIDTH - 8 , 1 ) ;
2012-12-12 10:47:03 +00:00
lcd . print ( ' Z ' ) ;
2013-01-08 10:53:18 +00:00
lcd . print ( ftostr32 ( current_position [ Z_AXIS ] ) ) ;
2012-12-12 10:47:03 +00:00
# endif //LCD_HEIGHT > 2
# if LCD_HEIGHT > 3
lcd . setCursor ( 0 , 2 ) ;
lcd . print ( LCD_STR_FEEDRATE [ 0 ] ) ;
lcd . print ( itostr3 ( feedmultiply ) ) ;
2012-12-14 09:53:11 +00:00
lcd . print ( ' % ' ) ;
2012-12-12 10:47:03 +00:00
# if LCD_WIDTH > 19
# ifdef SDSUPPORT
lcd . setCursor ( 7 , 2 ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( " SD " ) ) ;
2012-12-12 10:47:03 +00:00
if ( IS_SD_PRINTING )
lcd . print ( itostr3 ( card . percentDone ( ) ) ) ;
else
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( " --- " ) ) ;
lcd . print ( ' % ' ) ;
2012-12-12 10:47:03 +00:00
# endif //SDSUPPORT
# endif //LCD_WIDTH > 19
lcd . setCursor ( LCD_WIDTH - 6 , 2 ) ;
lcd . print ( LCD_STR_CLOCK [ 0 ] ) ;
if ( starttime ! = 0 )
{
uint16_t time = millis ( ) / 60000 - starttime / 60000 ;
lcd . print ( itostr2 ( time / 60 ) ) ;
2012-12-14 09:53:11 +00:00
lcd . print ( ' : ' ) ;
2012-12-12 10:47:03 +00:00
lcd . print ( itostr2 ( time % 60 ) ) ;
} else {
2012-12-14 09:53:11 +00:00
lcd_printPGM ( PSTR ( " --:-- " ) ) ;
2012-12-12 10:47:03 +00:00
}
# endif
//Status message line on the last line
lcd . setCursor ( 0 , LCD_HEIGHT - 1 ) ;
lcd . print ( lcd_status_message ) ;
}
static void lcd_implementation_drawmenu_generic ( uint8_t row , const char * pstr , char pre_char , char post_char )
{
char c ;
2013-02-11 23:03:40 +00:00
//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
2012-12-12 10:47:03 +00:00
lcd . setCursor ( 0 , row ) ;
lcd . print ( pre_char ) ;
while ( ( c = pgm_read_byte ( pstr ) ) ! = ' \0 ' )
{
lcd . print ( c ) ;
pstr + + ;
n - - ;
}
while ( n - - )
lcd . print ( ' ' ) ;
lcd . print ( post_char ) ;
lcd . print ( ' ' ) ;
}
static void lcd_implementation_drawmenu_setting_edit_generic ( uint8_t row , const char * pstr , char pre_char , char * data )
{
char c ;
2013-02-11 23:03:40 +00:00
//Use all characters in narrow LCDs
# if LCD_WIDTH < 20
2013-02-12 19:06:51 +00:00
uint8_t n = LCD_WIDTH - 1 - 1 - strlen ( data ) ;
2013-02-11 23:03:40 +00:00
# else
2013-02-12 19:06:51 +00:00
uint8_t n = LCD_WIDTH - 1 - 2 - strlen ( data ) ;
2013-02-11 23:03:40 +00:00
# endif
2012-12-12 10:47:03 +00:00
lcd . setCursor ( 0 , row ) ;
lcd . print ( pre_char ) ;
while ( ( c = pgm_read_byte ( pstr ) ) ! = ' \0 ' )
{
lcd . print ( c ) ;
pstr + + ;
n - - ;
}
lcd . print ( ' : ' ) ;
while ( n - - )
lcd . print ( ' ' ) ;
lcd . print ( data ) ;
}
static void lcd_implementation_drawmenu_setting_edit_generic_P ( uint8_t row , const char * pstr , char pre_char , const char * data )
{
char c ;
2013-02-11 23:03:40 +00:00
//Use all characters in narrow LCDs
# if LCD_WIDTH < 20
2013-02-12 19:06:51 +00:00
uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P ( data ) ;
2013-02-11 23:03:40 +00:00
# else
2013-02-12 19:06:51 +00:00
uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P ( data ) ;
2013-02-11 23:03:40 +00:00
# endif
2012-12-12 10:47:03 +00:00
lcd . setCursor ( 0 , row ) ;
lcd . print ( pre_char ) ;
while ( ( c = pgm_read_byte ( pstr ) ) ! = ' \0 ' )
{
lcd . print ( c ) ;
pstr + + ;
n - - ;
}
lcd . print ( ' : ' ) ;
while ( n - - )
lcd . print ( ' ' ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( data ) ;
2012-12-12 10:47:03 +00:00
}
# 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_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))
Allow Edit menu to call fn after edit; Fix PID Ki and Kd display in menus; Actually use changed PID and Max Accel values
Add new 'callback' edit-menu types that call a function after the edit is done. Use this to display and edit Ki and Kd correctly (removing the scaling first and reapplying it after). Also use it to reset maximum stepwise acceleration rates, after updating mm/s^2 rates via menus. (Previously, changes did nothing to affect planner unless saved back to EEPROM, and the machine reset).
Add calls to updatePID() so that PID loop uses updated values whether set by gcode (it already did this), or by restoring defaults, or loading from EEPROM (it didn't do those last two). Similarly, update the maximum step/s^2 accel rates when the mm/s^2 values are changed - whether by menu edits, restore defaults, or EEPROM read.
Refactor the acceleration rate update logic, and the PID scaling logic, into new functions that can be called from wherever, including the callbacks.
Add menu items to allow the z jerk and e jerk to be viewed/edited in the Control->Motion menu, as per xy jerk.
Conflicts:
Marlin/language.h
2013-03-19 14:05:11 +00:00
//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_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))
2012-12-12 10:47:03 +00:00
void lcd_implementation_drawedit ( const char * pstr , char * value )
{
2012-12-21 15:14:47 +00:00
lcd . setCursor ( 1 , 1 ) ;
2012-12-14 09:53:11 +00:00
lcd_printPGM ( pstr ) ;
2012-12-12 10:47:03 +00:00
lcd . print ( ' : ' ) ;
2013-02-11 23:03:40 +00:00
# if LCD_WIDTH < 20
lcd . setCursor ( LCD_WIDTH - strlen ( value ) , 1 ) ;
# else
lcd . setCursor ( LCD_WIDTH - 1 - strlen ( value ) , 1 ) ;
# endif
2012-12-12 10:47:03 +00:00
lcd . print ( value ) ;
}
static void lcd_implementation_drawmenu_sdfile_selected ( uint8_t row , const char * pstr , const char * filename , char * longFilename )
{
char c ;
uint8_t n = LCD_WIDTH - 1 ;
lcd . setCursor ( 0 , row ) ;
lcd . print ( ' > ' ) ;
if ( longFilename [ 0 ] ! = ' \0 ' )
{
filename = longFilename ;
longFilename [ LCD_WIDTH - 1 ] = ' \0 ' ;
}
while ( ( c = * filename ) ! = ' \0 ' )
{
lcd . print ( c ) ;
filename + + ;
n - - ;
}
while ( n - - )
lcd . print ( ' ' ) ;
}
static void lcd_implementation_drawmenu_sdfile ( uint8_t row , const char * pstr , const char * filename , char * longFilename )
{
char c ;
uint8_t n = LCD_WIDTH - 1 ;
lcd . setCursor ( 0 , row ) ;
lcd . print ( ' ' ) ;
if ( longFilename [ 0 ] ! = ' \0 ' )
{
filename = longFilename ;
longFilename [ LCD_WIDTH - 1 ] = ' \0 ' ;
}
while ( ( c = * filename ) ! = ' \0 ' )
{
lcd . print ( c ) ;
filename + + ;
n - - ;
}
while ( n - - )
lcd . print ( ' ' ) ;
}
static void lcd_implementation_drawmenu_sddirectory_selected ( uint8_t row , const char * pstr , const char * filename , char * longFilename )
{
char c ;
uint8_t n = LCD_WIDTH - 2 ;
lcd . setCursor ( 0 , row ) ;
lcd . print ( ' > ' ) ;
lcd . print ( LCD_STR_FOLDER [ 0 ] ) ;
if ( longFilename [ 0 ] ! = ' \0 ' )
{
filename = longFilename ;
longFilename [ LCD_WIDTH - 2 ] = ' \0 ' ;
}
while ( ( c = * filename ) ! = ' \0 ' )
{
lcd . print ( c ) ;
filename + + ;
n - - ;
}
while ( n - - )
lcd . print ( ' ' ) ;
}
static void lcd_implementation_drawmenu_sddirectory ( uint8_t row , const char * pstr , const char * filename , char * longFilename )
{
char c ;
uint8_t n = LCD_WIDTH - 2 ;
lcd . setCursor ( 0 , row ) ;
lcd . print ( ' ' ) ;
lcd . print ( LCD_STR_FOLDER [ 0 ] ) ;
if ( longFilename [ 0 ] ! = ' \0 ' )
{
filename = longFilename ;
longFilename [ LCD_WIDTH - 2 ] = ' \0 ' ;
}
while ( ( c = * filename ) ! = ' \0 ' )
{
lcd . print ( c ) ;
filename + + ;
n - - ;
}
while ( n - - )
lcd . print ( ' ' ) ;
}
# define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
# define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
# define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
# define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
# define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
# define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
# define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
# define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
static void lcd_implementation_quick_feedback ( )
{
# if BEEPER > -1
SET_OUTPUT ( BEEPER ) ;
for ( int8_t i = 0 ; i < 10 ; i + + )
{
WRITE ( BEEPER , HIGH ) ;
delay ( 3 ) ;
WRITE ( BEEPER , LOW ) ;
delay ( 3 ) ;
}
# endif
}
# endif //ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H