File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -30,5 +30,8 @@ typedef uint32_t millis_t;
30
30
#define MS_TO_SEC (N ) millis_t((N)/1000UL)
31
31
#define MS_TO_SEC_PRECISE (N ) (float(N)/1000.0f)
32
32
33
- #define PENDING (NOW ,SOON ) ((int32_t)(NOW-(SOON))<0)
33
+ #define FUTURE (START ,DURA ) (millis_t(millis()-(START))<(DURA))
34
+ #define PAST (START ,DURA ) (!FUTURE(START,DURA))
35
+
36
+ #define PENDING (NOW ,SOON ) (int32_t((NOW)-(SOON))<0)
34
37
#define ELAPSED (NOW ,SOON ) (!PENDING(NOW,SOON))
Original file line number Diff line number Diff line change @@ -242,11 +242,11 @@ void GcodeSuite::get_destination_from_command() {
242
242
}
243
243
244
244
/* *
245
- * Dwell waits immediately. It does not synchronize. Use M400 instead of G4
245
+ * Dwell waits immediately. It does not synchronize.
246
246
*/
247
- void GcodeSuite::dwell (millis_t time) {
248
- time + = millis ();
249
- while (PENDING ( millis () , time)) idle ();
247
+ void GcodeSuite::dwell (const millis_t time) {
248
+ const millis_t startMillis = millis ();
249
+ while (FUTURE (startMillis , time)) idle ();
250
250
}
251
251
252
252
/* *
Original file line number Diff line number Diff line change @@ -503,7 +503,7 @@ class GcodeSuite {
503
503
#define KEEPALIVE_STATE (N ) NOOP
504
504
#endif
505
505
506
- static void dwell (millis_t time);
506
+ static void dwell (const millis_t time);
507
507
508
508
private:
509
509
You can’t perform that action at this time.
0 commit comments