🐛 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;
|
static uint8_t namescrl = 0;
|
||||||
if (reset) namescrl = 0;
|
if (reset) namescrl = 0;
|
||||||
if (process == Print) {
|
if (process == Print) {
|
||||||
size_t len = strlen(filename);
|
constexpr int8_t maxlen = 30;
|
||||||
int8_t pos = len;
|
char *outstr = filename;
|
||||||
if (pos > 30) {
|
size_t slen = strlen(filename);
|
||||||
pos -= namescrl;
|
int8_t outlen = slen;
|
||||||
len = _MIN(pos, 30);
|
if (slen > maxlen) {
|
||||||
char dispname[len + 1];
|
char dispname[maxlen + 1];
|
||||||
|
int8_t pos = slen - namescrl, len = maxlen;
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
|
NOMORE(len, pos);
|
||||||
LOOP_L_N(i, len) dispname[i] = filename[i + namescrl];
|
LOOP_L_N(i, len) dispname[i] = filename[i + namescrl];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOOP_L_N(i, 30 + pos) dispname[i] = ' ';
|
const int8_t mp = maxlen + pos;
|
||||||
LOOP_S_L_N(i, 30 + pos, 30) dispname[i] = filename[i - (30 + 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';
|
dispname[len] = '\0';
|
||||||
DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80);
|
outstr = dispname;
|
||||||
const int8_t npos = (DWIN_WIDTH - 30 * MENU_CHR_W) / 2;
|
outlen = maxlen;
|
||||||
DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, dispname);
|
|
||||||
if (-pos >= 30) namescrl = 0;
|
|
||||||
namescrl++;
|
namescrl++;
|
||||||
}
|
}
|
||||||
else {
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80);
|
||||||
DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80);
|
const int8_t npos = (DWIN_WIDTH - outlen * MENU_CHR_W) / 2;
|
||||||
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, outstr);
|
||||||
DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4702,7 +4702,7 @@ void CrealityDWINClass::Update_Status(const char * const text) {
|
|||||||
char header[4];
|
char header[4];
|
||||||
LOOP_L_N(i, 3) header[i] = text[i];
|
LOOP_L_N(i, 3) header[i] = text[i];
|
||||||
header[3] = '\0';
|
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];
|
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';
|
filename[_MIN((size_t)LONG_FILENAME_LENGTH - 1, strlen(text))] = '\0';
|
||||||
Draw_Print_Filename(true);
|
Draw_Print_Filename(true);
|
||||||
@ -4798,22 +4798,23 @@ void CrealityDWINClass::State_Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CrealityDWINClass::Screen_Update() {
|
void CrealityDWINClass::Screen_Update() {
|
||||||
|
const millis_t ms = millis();
|
||||||
static millis_t scrltime = 0;
|
static millis_t scrltime = 0;
|
||||||
if (ELAPSED(millis(), scrltime)) {
|
if (ELAPSED(ms, scrltime)) {
|
||||||
scrltime = millis() + 200;
|
scrltime = ms + 200;
|
||||||
Update_Status_Bar();
|
Update_Status_Bar();
|
||||||
if (process == Print) Draw_Print_Filename();
|
if (process == Print) Draw_Print_Filename();
|
||||||
}
|
}
|
||||||
|
|
||||||
static millis_t statustime = 0;
|
static millis_t statustime = 0;
|
||||||
if (ELAPSED(millis(), statustime)) {
|
if (ELAPSED(ms, statustime)) {
|
||||||
statustime = millis() + 500;
|
statustime = ms + 500;
|
||||||
Draw_Status_Area();
|
Draw_Status_Area();
|
||||||
}
|
}
|
||||||
|
|
||||||
static millis_t printtime = 0;
|
static millis_t printtime = 0;
|
||||||
if (ELAPSED(millis(), printtime)) {
|
if (ELAPSED(ms, printtime)) {
|
||||||
printtime = millis() + 1000;
|
printtime = ms + 1000;
|
||||||
if (process == Print) {
|
if (process == Print) {
|
||||||
Draw_Print_ProgressBar();
|
Draw_Print_ProgressBar();
|
||||||
Draw_Print_ProgressElapsed();
|
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*/) {
|
void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case PAUSE_MESSAGE_INSERT: CrealityDWIN.Confirm_Handler(FilInsert); break;
|
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_OPTION: CrealityDWIN.Popup_Handler(PurgeMore); break;
|
||||||
case PAUSE_MESSAGE_HEAT: CrealityDWIN.Confirm_Handler(HeaterTime); break;
|
case PAUSE_MESSAGE_HEAT: CrealityDWIN.Confirm_Handler(HeaterTime); break;
|
||||||
case PAUSE_MESSAGE_WAITING: CrealityDWIN.Draw_Print_Screen(); break;
|
case PAUSE_MESSAGE_WAITING: CrealityDWIN.Draw_Print_Screen(); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user