|
@@ -46,8 +46,8 @@
|
|
|
#include "first_lay_cal.h"
|
|
|
|
|
|
|
|
|
-int scrollstuff = 0;
|
|
|
-char longFilenameOLD[LONG_FILENAME_LENGTH];
|
|
|
+//filename scrolling
|
|
|
+const char* scrollPointer;
|
|
|
|
|
|
|
|
|
static void lcd_sd_updir();
|
|
@@ -313,7 +313,53 @@ bool bSettings; // flag (i.e. 'fake parameter'
|
|
|
|
|
|
const char STR_SEPARATOR[] PROGMEM = "------------";
|
|
|
|
|
|
+static void lcd_filename_scroll() //this is a submenu
|
|
|
+{
|
|
|
+ typedef struct
|
|
|
+ {
|
|
|
+ int8_t status;
|
|
|
+ int encoderInitial;
|
|
|
+ } _menu_data_t;
|
|
|
+ static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data");
|
|
|
+ _menu_data_t* _md = (_menu_data_t*)&(menu_data[0]);
|
|
|
+
|
|
|
+ if (_md->status == 0)
|
|
|
+ {
|
|
|
+ _md->status = 1;
|
|
|
+ _md->encoderInitial = lcd_encoder_diff / ENCODER_PULSES_PER_STEP;
|
|
|
+ lcd_scrollTimer.start();
|
|
|
+ }
|
|
|
+ if (LCD_CLICKED || (_md->encoderInitial != (lcd_encoder_diff / ENCODER_PULSES_PER_STEP))) //go back to sd_menu.
|
|
|
+ {
|
|
|
+ lcd_scrollTimer.stop();
|
|
|
+ // menu_depth--;
|
|
|
+ // menu_goto(menu_stack[menu_depth].menu, menu_stack[menu_depth].position + lcd_encoder_diff / ENCODER_PULSES_PER_STEP, false, true);
|
|
|
+ menu_back_no_feedback();
|
|
|
+ }
|
|
|
+ if(lcd_scrollTimer.expired(300))
|
|
|
+ {
|
|
|
+ uint8_t i = LCD_WIDTH - 1;
|
|
|
+ lcd_set_cursor(0, lcd_encoder);
|
|
|
+ lcd_print('>');
|
|
|
+ for (; i != 0; i--)
|
|
|
+ {
|
|
|
+ char c = *(scrollPointer + LCD_WIDTH - i);
|
|
|
+ if (c == '\0') break; //stop at the end of the string
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lcd_print(c);
|
|
|
+ lcd_scrollTimer.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (i != 0) //adds spaces if string is incomplete or at the end (instead of null).
|
|
|
+ {
|
|
|
+ lcd_space(i);
|
|
|
+ }
|
|
|
+ scrollPointer++;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+/*
|
|
|
static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* filename, char* longFilename)
|
|
|
{
|
|
|
char c;
|
|
@@ -372,21 +418,17 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
|
|
|
while(n--)
|
|
|
lcd_print(' ');
|
|
|
}
|
|
|
-static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* filename, char* longFilename)
|
|
|
+*/
|
|
|
+static void lcd_implementation_drawmenu_sdfile(uint8_t row, char* longFilename)
|
|
|
{
|
|
|
char c;
|
|
|
uint8_t n = LCD_WIDTH - 1;
|
|
|
lcd_set_cursor(0, row);
|
|
|
- lcd_print(' ');
|
|
|
- if (longFilename[0] != '\0')
|
|
|
- {
|
|
|
- filename = longFilename;
|
|
|
- longFilename[LCD_WIDTH-1] = '\0';
|
|
|
- }
|
|
|
- while( ((c = *filename) != '\0') && (n>0) )
|
|
|
+ lcd_print((lcd_encoder == menu_item)?'>':' ');
|
|
|
+ while( ((c = *longFilename) != '\0') && (n>0) )
|
|
|
{
|
|
|
lcd_print(c);
|
|
|
- filename++;
|
|
|
+ longFilename++;
|
|
|
n--;
|
|
|
}
|
|
|
while(n--)
|
|
@@ -441,9 +483,7 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* fil
|
|
|
//#define MENU_ITEM_SDDIR(str, str_fn, str_fnl) MENU_ITEM(sddirectory, str, str_fn, str_fnl)
|
|
|
//extern uint8_t menu_item_sddir(const char* str, const char* str_fn, char* str_fnl);
|
|
|
|
|
|
-#define MENU_ITEM_SDFILE(str, str_fn, str_fnl) do { if (menu_item_sdfile(str, str_fn, str_fnl)) return; } while (0)
|
|
|
-//#define MENU_ITEM_SDFILE(str, str_fn, str_fnl) MENU_ITEM(sdfile, str, str_fn, str_fnl)
|
|
|
-//extern uint8_t menu_item_sdfile(const char* str, const char* str_fn, char* str_fnl);
|
|
|
+#define MENU_ITEM_SDFILE(str_fn, str_fnl) do { if (menu_item_sdfile(str_fn, str_fnl)) return; } while (0)
|
|
|
|
|
|
|
|
|
uint8_t menu_item_sddir(const char* str_fn, char* str_fnl)
|
|
@@ -496,60 +536,18 @@ uint8_t menu_item_sddir(const char* str_fn, char* str_fnl)
|
|
|
#endif //NEW_SD_MENU
|
|
|
}
|
|
|
|
|
|
-static uint8_t menu_item_sdfile(const char*
|
|
|
-#ifdef NEW_SD_MENU
|
|
|
- str
|
|
|
-#endif //NEW_SD_MENU
|
|
|
- ,const char* str_fn, char* str_fnl)
|
|
|
+static uint8_t menu_item_sdfile(const char* str_fn, char* str_fnl)
|
|
|
{
|
|
|
-#ifdef NEW_SD_MENU
|
|
|
-// printf_P(PSTR("menu sdfile\n"));
|
|
|
-// str_fnl[19] = 0;
|
|
|
-// printf_P(PSTR("menu file %d '%s' '%s'\n"), menu_row, str_fn, str_fnl);
|
|
|
if (menu_item == menu_line)
|
|
|
{
|
|
|
if (lcd_draw_update)
|
|
|
{
|
|
|
-// printf_P(PSTR("menu file %d %d '%s'\n"), menu_row, menuData.sdcard_menu.viewState, str_fnl[0]?str_fnl:str_fn);
|
|
|
- lcd_set_cursor(0, menu_row);
|
|
|
-/* if (lcd_encoder == menu_item)
|
|
|
- {
|
|
|
- lcd_printf_P(PSTR("%c%-19s"), (lcd_encoder == menu_item)?'>':' ', (str_fnl[0]?str_fnl:str_fn) + 1);
|
|
|
- if (menuData.sdcard_menu.viewState == 0)
|
|
|
- {
|
|
|
- menuData.sdcard_menu.viewState++;
|
|
|
- lcd_printf_P(PSTR("%c%-19s"), (lcd_encoder == menu_item)?'>':' ', (str_fnl[0]?str_fnl:str_fn) + 1);
|
|
|
- }
|
|
|
- else if (menuData.sdcard_menu.viewState == 1)
|
|
|
- {
|
|
|
- lcd_printf_P(PSTR("%c%-19s"), (lcd_encoder == menu_item)?'>':' ', (str_fnl[0]?str_fnl:str_fn) + 2);
|
|
|
- }
|
|
|
- }
|
|
|
- else*/
|
|
|
+ scrollPointer = (str_fnl[0] == '\0') ? str_fn : str_fnl;
|
|
|
+ if (lcd_encoder == menu_item)
|
|
|
{
|
|
|
- str_fnl[19] = 0;
|
|
|
- lcd_printf_P(PSTR("%c%-19s"), (lcd_encoder == menu_item)?'>':' ', str_fnl[0]?str_fnl:str_fn);
|
|
|
+ if (lcd_scrollTimer.expired(1000)) menu_submenu_scroll(lcd_filename_scroll);
|
|
|
}
|
|
|
-
|
|
|
-// int cnt = lcd_printf_P(PSTR("%c%-19s"), (lcd_encoder == menu_item)?'>':' ', str_fnl);
|
|
|
-// int cnt = lcd_printf_P(PSTR("%cTESTIK.gcode"), (lcd_encoder == menu_item)?'>':' ');
|
|
|
- }
|
|
|
- if (menu_clicked && (lcd_encoder == menu_item))
|
|
|
- {
|
|
|
- return menu_item_ret();
|
|
|
- }
|
|
|
- }
|
|
|
- menu_item++;
|
|
|
- return 0;
|
|
|
-#else //NEW_SD_MENU
|
|
|
- if (menu_item == menu_line)
|
|
|
- {
|
|
|
- if (lcd_draw_update)
|
|
|
- {
|
|
|
- if (lcd_encoder == menu_item)
|
|
|
- lcd_implementation_drawmenu_sdfile_selected(menu_row, str_fn, str_fnl);
|
|
|
- else
|
|
|
- lcd_implementation_drawmenu_sdfile(menu_row, str_fn, str_fnl);
|
|
|
+ else lcd_implementation_drawmenu_sdfile(menu_row, str_fnl);
|
|
|
}
|
|
|
if (menu_clicked && (lcd_encoder == menu_item))
|
|
|
{
|
|
@@ -560,7 +558,6 @@ static uint8_t menu_item_sdfile(const char*
|
|
|
}
|
|
|
menu_item++;
|
|
|
return 0;
|
|
|
-#endif //NEW_SD_MENU
|
|
|
}
|
|
|
|
|
|
// Print temperature (nozzle/bed) (9 chars total)
|
|
@@ -727,7 +724,7 @@ void lcdui_print_time(void)
|
|
|
//Print status line on status screen
|
|
|
void lcdui_print_status_line(void)
|
|
|
{
|
|
|
- if (IS_SD_PRINTING)
|
|
|
+/* if (IS_SD_PRINTING)
|
|
|
{
|
|
|
if (strcmp(longFilenameOLD, (card.longFilename[0] ? card.longFilename : card.filename)) != 0)
|
|
|
{
|
|
@@ -735,7 +732,7 @@ void lcdui_print_status_line(void)
|
|
|
sprintf_P(longFilenameOLD, PSTR("%s"), (card.longFilename[0] ? card.longFilename : card.filename));
|
|
|
scrollstuff = 0;
|
|
|
}
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
if (heating_status)
|
|
|
{ // If heating flag, show progress of heating
|
|
@@ -780,7 +777,7 @@ void lcdui_print_status_line(void)
|
|
|
}
|
|
|
else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status))
|
|
|
{ // If printing from SD, show what we are printing
|
|
|
- if(strlen(longFilenameOLD) > LCD_WIDTH)
|
|
|
+ /* if(strlen(longFilenameOLD) > LCD_WIDTH)
|
|
|
{
|
|
|
int inters = 0;
|
|
|
int gh = scrollstuff;
|
|
@@ -806,7 +803,7 @@ void lcdui_print_status_line(void)
|
|
|
else
|
|
|
{
|
|
|
lcd_printf_P(PSTR("%-20s"), longFilenameOLD);
|
|
|
- }
|
|
|
+ } */
|
|
|
}
|
|
|
else
|
|
|
{ // Otherwise check for other special events
|
|
@@ -4275,7 +4272,7 @@ static void prusa_stat_printinfo()
|
|
|
SERIAL_ECHO("][FEM:");
|
|
|
SERIAL_ECHO(itostr3(feedmultiply));
|
|
|
SERIAL_ECHO("][FNM:");
|
|
|
- SERIAL_ECHO(longFilenameOLD);
|
|
|
+ SERIAL_ECHO(card.longFilename);
|
|
|
SERIAL_ECHO("][TIM:");
|
|
|
if (starttime != 0)
|
|
|
{
|
|
@@ -7279,7 +7276,7 @@ void lcd_sdcard_menu()
|
|
|
return; // nothing to do (so don't thrash the SD card)
|
|
|
uint16_t fileCnt = card.getnrfilenames();
|
|
|
|
|
|
-
|
|
|
+ lcd_scrollTimer.start();
|
|
|
MENU_BEGIN();
|
|
|
MENU_ITEM_BACK_P(_T(bMain?MSG_MAIN:MSG_BACK)); // i.e. default menu-item / menu-item after card insertion
|
|
|
card.getWorkDirName();
|
|
@@ -7309,11 +7306,10 @@ void lcd_sdcard_menu()
|
|
|
#else
|
|
|
card.getfilename(nr);
|
|
|
#endif
|
|
|
-
|
|
|
if (card.filenameIsDir)
|
|
|
MENU_ITEM_SDDIR(card.filename, card.longFilename);
|
|
|
- else
|
|
|
- MENU_ITEM_SDFILE(_T(MSG_CARD_MENU), card.filename, card.longFilename);
|
|
|
+ else
|
|
|
+ MENU_ITEM_SDFILE(card.filename, card.longFilename);
|
|
|
} else {
|
|
|
MENU_ITEM_DUMMY();
|
|
|
}
|