🐛 Fix JyersUI scrolling filename, etc. (#23082)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
parent
396df93220
commit
57bd04b6ce
@ -678,31 +678,31 @@ void CrealityDWINClass::Draw_Print_Filename(const bool reset/*=false*/) {
|
||||
static uint8_t namescrl = 0;
|
||||
if (reset) namescrl = 0;
|
||||
if (process == Print) {
|
||||
size_t len = strlen(filename);
|
||||
int8_t pos = len;
|
||||
if (pos > 30) {
|
||||
pos -= namescrl;
|
||||
len = _MIN(pos, 30);
|
||||
char dispname[len + 1];
|
||||
constexpr int8_t maxlen = 30;
|
||||
char *outstr = filename;
|
||||
size_t slen = strlen(filename);
|
||||
int8_t outlen = slen;
|
||||
if (slen > maxlen) {
|
||||
char dispname[maxlen + 1];
|
||||
int8_t pos = slen - namescrl, len = maxlen;
|
||||
if (pos >= 0) {
|
||||
NOMORE(len, pos);
|
||||
LOOP_L_N(i, len) dispname[i] = filename[i + namescrl];
|
||||
}
|
||||
else {
|
||||
LOOP_L_N(i, 30 + pos) dispname[i] = ' ';
|
||||
LOOP_S_L_N(i, 30 + pos, 30) dispname[i] = filename[i - (30 + pos)];
|
||||
const int8_t mp = maxlen + pos;
|
||||
LOOP_L_N(i, mp) dispname[i] = ' ';
|
||||
LOOP_S_L_N(i, mp, maxlen) dispname[i] = filename[i - mp];
|
||||
if (mp <= 0) namescrl = 0;
|
||||
}
|
||||
dispname[len] = '\0';
|
||||
DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80);
|
||||
const int8_t npos = (DWIN_WIDTH - 30 * MENU_CHR_W) / 2;
|
||||
DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, dispname);
|
||||
if (-pos >= 30) namescrl = 0;
|
||||
outstr = dispname;
|
||||
outlen = maxlen;
|
||||
namescrl++;
|
||||
}
|
||||
else {
|
||||
DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80);
|
||||
const int8_t npos = (DWIN_WIDTH - strlen(filename) * MENU_CHR_W) / 2;
|
||||
DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, filename);
|
||||
}
|
||||
const int8_t npos = (DWIN_WIDTH - outlen * MENU_CHR_W) / 2;
|
||||
DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, outstr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4702,7 +4702,7 @@ void CrealityDWINClass::Update_Status(const char * const text) {
|
||||
char header[4];
|
||||
LOOP_L_N(i, 3) header[i] = text[i];
|
||||
header[3] = '\0';
|
||||
if (strcmp_P(header,"<F>") == 0) {
|
||||
if (strcmp_P(header, PSTR("<F>")) == 0) {
|
||||
LOOP_L_N(i, _MIN((size_t)LONG_FILENAME_LENGTH, strlen(text))) filename[i] = text[i + 3];
|
||||
filename[_MIN((size_t)LONG_FILENAME_LENGTH - 1, strlen(text))] = '\0';
|
||||
Draw_Print_Filename(true);
|
||||
@ -4798,22 +4798,23 @@ void CrealityDWINClass::State_Update() {
|
||||
}
|
||||
|
||||
void CrealityDWINClass::Screen_Update() {
|
||||
const millis_t ms = millis();
|
||||
static millis_t scrltime = 0;
|
||||
if (ELAPSED(millis(), scrltime)) {
|
||||
scrltime = millis() + 200;
|
||||
if (ELAPSED(ms, scrltime)) {
|
||||
scrltime = ms + 200;
|
||||
Update_Status_Bar();
|
||||
if (process == Print) Draw_Print_Filename();
|
||||
}
|
||||
|
||||
static millis_t statustime = 0;
|
||||
if (ELAPSED(millis(), statustime)) {
|
||||
statustime = millis() + 500;
|
||||
if (ELAPSED(ms, statustime)) {
|
||||
statustime = ms + 500;
|
||||
Draw_Status_Area();
|
||||
}
|
||||
|
||||
static millis_t printtime = 0;
|
||||
if (ELAPSED(millis(), printtime)) {
|
||||
printtime = millis() + 1000;
|
||||
if (ELAPSED(ms, printtime)) {
|
||||
printtime = ms + 1000;
|
||||
if (process == Print) {
|
||||
Draw_Print_ProgressBar();
|
||||
Draw_Print_ProgressElapsed();
|
||||
@ -5000,6 +5001,7 @@ void MarlinUI::init() {
|
||||
void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
|
||||
switch (message) {
|
||||
case PAUSE_MESSAGE_INSERT: CrealityDWIN.Confirm_Handler(FilInsert); break;
|
||||
case PAUSE_MESSAGE_PURGE:
|
||||
case PAUSE_MESSAGE_OPTION: CrealityDWIN.Popup_Handler(PurgeMore); break;
|
||||
case PAUSE_MESSAGE_HEAT: CrealityDWIN.Confirm_Handler(HeaterTime); break;
|
||||
case PAUSE_MESSAGE_WAITING: CrealityDWIN.Draw_Print_Screen(); break;
|
||||
|
Loading…
Reference in New Issue
Block a user