Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix runout dialog be overwritten bt printing menu #738

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions TFT/src/User/API/extend.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,23 @@ bool FIL_IsRunout(void)
}
}

void loopFILRunoutDetect(void)
void loopBackEndFILRunoutDetect(void)
{
if (infoSettings.runout == FILAMENT_RUNOUT_OFF) return; // Filament runout turn off
if (!FIL_IsRunout()) return; // Filament not runout yet, need constant scanning to filter interference
if (!isPrinting() || isPause()) return; // No printing or printing paused

setPrintRunout(true);
}

void loopFrontEndFILRunoutDetect(void)
{
if (!getPrintRunout()) return;

if (setPrintPause(true,false))
{
setPrintRunout(false);
popupReminder(textSelect(LABEL_WARNING), textSelect(LABEL_FILAMENT_RUNOUT));
}
}

#endif
3 changes: 2 additions & 1 deletion TFT/src/User/API/extend.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void PS_ON_On(void);
void PS_ON_Off(void);
void positionSetUpdateWaiting(bool isWaiting);
void FIL_Runout_Init(void);
void loopFILRunoutDetect(void);
void loopBackEndFILRunoutDetect(void);
void loopFrontEndFILRunoutDetect(void);

#endif
1 change: 1 addition & 0 deletions TFT/src/User/API/parseACK.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const char *const ignoreEcho[] = {
"echo: M", //M503
"Cap:", //M115
"Config:", //M360
"Settings Stored" // M500
};

bool portSeen[_UART_CNT] = {false, false, false, false, false, false};
Expand Down
14 changes: 12 additions & 2 deletions TFT/src/User/Menu/Printing.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool isPause(void)

bool isM0_Pause(void)
{
return infoPrinting.m0_pause;
return infoPrinting.m0_pause;
}

//
Expand Down Expand Up @@ -139,6 +139,16 @@ void setPrintCur(u32 cur)
infoPrinting.cur = cur;
}

bool getPrintRunout(void)
{
return infoPrinting.runout;
}

void setPrintRunout(bool runout)
{
infoPrinting.runout = runout;
}

u8 getPrintProgress(void)
{
return infoPrinting.progress;
Expand Down Expand Up @@ -676,8 +686,8 @@ void menuPrinting(void)

default :break;
}
loopProcess();
toggleinfo();
loopProcess();
}
}

Expand Down
7 changes: 5 additions & 2 deletions TFT/src/User/Menu/Printing.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ typedef struct
u32 cur; // Gcode has printed file size
u8 progress;
bool printing; // 1 means printing, 0 means idle
bool pause; //1 means paused
bool m0_pause; //pause triggered through M0/M1 gcode
bool pause; // 1 means paused
bool m0_pause; // pause triggered through M0/M1 gcode
bool runout; // 1: runout in printing, 0: idle
}PRINTING;

void exitPrinting(void);
Expand All @@ -34,6 +35,8 @@ void setPrintSize(u32 size);
void setPrintCur(u32 cur);
u32 getPrintSize(void);
u32 getPrintCur(void);
bool getPrintRunout(void);
void setPrintRunout(bool runout);

u8 getPrintProgress(void);
u32 getPrintTime(void);
Expand Down
8 changes: 6 additions & 2 deletions TFT/src/User/Menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ if(infoMachineSettings.onboard_sd_support == ENABLED && infoMachineSettings.auto
#endif

#ifdef FIL_RUNOUT_PIN
loopFILRunoutDetect();
loopBackEndFILRunoutDetect();
#endif
}

Expand All @@ -452,7 +452,11 @@ void loopFrontEnd(void)

loopBusySignClear(); //Busy Indicator clear

temp_Change();
temp_Change();

#ifdef FIL_RUNOUT_PIN
loopFrontEndFILRunoutDetect();
#endif
}

void loopProcess(void)
Expand Down