diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index fb7890c55..b0384b322 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -22,8 +22,6 @@ #define LCD_8BIT #endif -// #define VT100 - // commands #define LCD_CLEARDISPLAY 0x01 #define LCD_RETURNHOME 0x02 @@ -77,10 +75,6 @@ static uint8_t lcd_displaymode = 0; uint8_t lcd_currline; static uint8_t lcd_ddram_address; // no need for preventing ddram overflow -#ifdef VT100 -uint8_t lcd_escape[8]; -#endif - struct CustomCharacter { uint8_t colByte; uint8_t rowData[4]; @@ -98,10 +92,6 @@ static void lcd_display(void); static void lcd_print_custom(uint8_t c); static void lcd_invalidate_custom_characters(); -#ifdef VT100 -void lcd_escape_write(uint8_t chr); -#endif - static void lcd_pulseEnable(void) { WRITE(LCD_PINS_ENABLE,HIGH); @@ -149,16 +139,9 @@ static void lcd_write(uint8_t value) if (value == '\n') { if (lcd_currline > 3) lcd_currline = -1; lcd_set_cursor(0, lcd_currline + 1); // LF - } - else if ((value >= 0x80) && (value < (0x80 + CUSTOM_CHARACTERS_CNT))) { + } else if ((value >= 0x80) && (value < (0x80 + CUSTOM_CHARACTERS_CNT))) { lcd_print_custom(value); - } - #ifdef VT100 - else if (lcd_escape[0] || (value == '\e')) { - lcd_escape_write(value); - } - #endif - else { + } else { lcd_send(value, HIGH); lcd_ddram_address++; // no need for preventing ddram overflow } @@ -192,10 +175,6 @@ static void lcd_begin(uint8_t clear) lcd_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; // set the entry mode lcd_command(LCD_ENTRYMODESET | lcd_displaymode); - - #ifdef VT100 - lcd_escape[0] = 0; - #endif } static int lcd_putchar(char c, FILE *) @@ -263,21 +242,6 @@ void lcd_display(void) lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); } -#ifdef VT100 //required functions for VT100 -// Turns the underline cursor on/off -void lcd_no_cursor(void) -{ - lcd_displaycontrol &= ~LCD_CURSORON; - lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); -} - -void lcd_cursor(void) -{ - lcd_displaycontrol |= LCD_CURSORON; - lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); -} -#endif - /// @brief set the current LCD row /// @param row LCD row number, ranges from 0 to LCD_HEIGHT - 1 static void FORCE_INLINE lcd_set_current_row(uint8_t row) @@ -366,144 +330,6 @@ void lcd_createChar_P(uint8_t location, const CustomCharacter *char_p) lcd_command(LCD_SETDDRAMADDR | lcd_ddram_address); // no need for masking the address } -#ifdef VT100 - -//Supported VT100 escape codes: -//EraseScreen "\x1b[2J" -//CursorHome "\x1b[%d;%dH" -//CursorShow "\x1b[?25h" -//CursorHide "\x1b[?25l" -void lcd_escape_write(uint8_t chr) -{ -#define escape_cnt (lcd_escape[0]) //escape character counter -#define is_num_msk (lcd_escape[1]) //numeric character bit mask -#define chr_is_num (is_num_msk & 0x01) //current character is numeric -#define e_2_is_num (is_num_msk & 0x04) //escape char 2 is numeric -#define e_3_is_num (is_num_msk & 0x08) //... -#define e_4_is_num (is_num_msk & 0x10) -#define e_5_is_num (is_num_msk & 0x20) -#define e_6_is_num (is_num_msk & 0x40) -#define e_7_is_num (is_num_msk & 0x80) -#define e2_num (lcd_escape[2] - '0') //number from character 2 -#define e3_num (lcd_escape[3] - '0') //number from character 3 -#define e23_num (10*e2_num+e3_num) //number from characters 2 and 3 -#define e4_num (lcd_escape[4] - '0') //number from character 4 -#define e5_num (lcd_escape[5] - '0') //number from character 5 -#define e45_num (10*e4_num+e5_num) //number from characters 4 and 5 -#define e6_num (lcd_escape[6] - '0') //number from character 6 -#define e56_num (10*e5_num+e6_num) //number from characters 5 and 6 - if (escape_cnt > 1) // escape length > 1 = "\x1b[" - { - lcd_escape[escape_cnt] = chr; // store current char - if ((chr >= '0') && (chr <= '9')) // char is numeric - is_num_msk |= (1 | (1 << escape_cnt)); //set mask - else - is_num_msk &= ~1; //clear mask - } - switch (escape_cnt++) - { - case 0: - if (chr == 0x1b) return; // escape = "\x1b" - break; - case 1: - is_num_msk = 0x00; // reset 'is number' bit mask - if (chr == '[') return; // escape = "\x1b[" - break; - case 2: - switch (chr) - { - case '2': return; // escape = "\x1b[2" - case '?': return; // escape = "\x1b[?" - default: - if (chr_is_num) return; // escape = "\x1b[%1d" - } - break; - case 3: - switch (lcd_escape[2]) - { - case '?': // escape = "\x1b[?" - if (chr == '2') return; // escape = "\x1b[?2" - break; - case '2': - if (chr == 'J') // escape = "\x1b[2J" - { lcd_clear(); break; } // EraseScreen - default: - if (e_2_is_num && // escape = "\x1b[%1d" - ((chr == ';') || // escape = "\x1b[%1d;" - chr_is_num)) // escape = "\x1b[%2d" - return; - } - break; - case 4: - switch (lcd_escape[2]) - { - case '?': // "\x1b[?" - if ((lcd_escape[3] == '2') && (chr == '5')) return; // escape = "\x1b[?25" - break; - default: - if (e_2_is_num) // escape = "\x1b[%1d" - { - if ((lcd_escape[3] == ';') && chr_is_num) return; // escape = "\x1b[%1d;%1d" - else if (e_3_is_num && (chr == ';')) return; // escape = "\x1b[%2d;" - } - } - break; - case 5: - switch (lcd_escape[2]) - { - case '?': - if ((lcd_escape[3] == '2') && (lcd_escape[4] == '5')) // escape = "\x1b[?25" - switch (chr) - { - case 'h': // escape = "\x1b[?25h" - lcd_cursor(); // CursorShow - break; - case 'l': // escape = "\x1b[?25l" - lcd_no_cursor(); // CursorHide - break; - } - break; - default: - if (e_2_is_num) // escape = "\x1b[%1d" - { - if ((lcd_escape[3] == ';') && e_4_is_num) // escape = "\x1b%1d;%1dH" - { - if (chr == 'H') // escape = "\x1b%1d;%1dH" - lcd_set_cursor(e4_num, e2_num); // CursorHome - else if (chr_is_num) - return; // escape = "\x1b%1d;%2d" - } - else if (e_3_is_num && (lcd_escape[4] == ';') && chr_is_num) - return; // escape = "\x1b%2d;%1d" - } - } - break; - case 6: - if (e_2_is_num) // escape = "\x1b[%1d" - { - if ((lcd_escape[3] == ';') && e_4_is_num && e_5_is_num && (chr == 'H')) // escape = "\x1b%1d;%2dH" - lcd_set_cursor(e45_num, e2_num); // CursorHome - else if (e_3_is_num && (lcd_escape[4] == ';') && e_5_is_num) // escape = "\x1b%2d;%1d" - { - if (chr == 'H') // escape = "\x1b%2d;%1dH" - lcd_set_cursor(e5_num, e23_num); // CursorHome - else if (chr_is_num) // "\x1b%2d;%2d" - return; - } - } - break; - case 7: - if (e_2_is_num && e_3_is_num && (lcd_escape[4] == ';')) // "\x1b[%2d;" - if (e_5_is_num && e_6_is_num && (chr == 'H')) // "\x1b[%2d;%2dH" - lcd_set_cursor(e56_num, e23_num); // CursorHome - break; - } - escape_cnt = 0; // reset escape -} - -#endif //VT100 - - int lcd_putc(char c) { return fputc(c, lcdout); diff --git a/Firmware/lcd.h b/Firmware/lcd.h index 5048b1bf9..897195070 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -57,19 +57,6 @@ extern void lcd_print(unsigned int, int = 10); extern void lcd_print(long, int = 10); extern void lcd_print(unsigned long, int = 10); -//! @brief Clear screen -#define ESC_2J "\x1b[2J" -//! @brief Show cursor -#define ESC_25h "\x1b[?25h" -//! @brief Hide cursor -#define ESC_25l "\x1b[?25l" -//! @brief Set cursor to -//! @param c column -//! @param r row -#define ESC_H(c,r) "\x1b["#r";"#c"H" - - - #define LCD_UPDATE_INTERVAL 100 #define LCD_TIMEOUT_TO_STATUS 30000ul //!< Generic timeout to status screen in ms, when no user action. #define LCD_TIMEOUT_TO_STATUS_BABYSTEP_Z 90000ul //!< Specific timeout for lcd_babystep_z screen in ms.