mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2026-01-04 05:40:31 -07:00
🚸 Fix G4 Dwell overflow
This commit is contained in:
parent
a68b70de15
commit
363f324179
3 changed files with 9 additions and 6 deletions
|
|
@ -30,5 +30,8 @@ typedef uint32_t millis_t;
|
|||
#define MS_TO_SEC(N) millis_t((N)/1000UL)
|
||||
#define MS_TO_SEC_PRECISE(N) (float(N)/1000.0f)
|
||||
|
||||
#define PENDING(NOW,SOON) ((int32_t)(NOW-(SOON))<0)
|
||||
#define FUTURE(START,DURA) (millis_t(millis()-(START))<(DURA))
|
||||
#define PAST(START,DURA) (!FUTURE(START,DURA))
|
||||
|
||||
#define PENDING(NOW,SOON) (int32_t((NOW)-(SOON))<0)
|
||||
#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))
|
||||
|
|
|
|||
|
|
@ -242,11 +242,11 @@ void GcodeSuite::get_destination_from_command() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Dwell waits immediately. It does not synchronize. Use M400 instead of G4
|
||||
* Dwell waits immediately. It does not synchronize.
|
||||
*/
|
||||
void GcodeSuite::dwell(millis_t time) {
|
||||
time += millis();
|
||||
while (PENDING(millis(), time)) idle();
|
||||
void GcodeSuite::dwell(const millis_t time) {
|
||||
const millis_t startMillis = millis();
|
||||
while (FUTURE(startMillis, time)) idle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ public:
|
|||
#define KEEPALIVE_STATE(N) NOOP
|
||||
#endif
|
||||
|
||||
static void dwell(millis_t time);
|
||||
static void dwell(const millis_t time);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue