clock.c: introduce clock().
This simplifies calls to clock_10ms() a bit and saves 18 bytes binary size.
This commit is contained in:
parent
97a663a00c
commit
f06b013179
13
clock.c
13
clock.c
|
|
@ -65,7 +65,7 @@ void clock_250ms() {
|
||||||
|
|
||||||
/*! do stuff every 10 milliseconds
|
/*! do stuff every 10 milliseconds
|
||||||
|
|
||||||
call from ifclock(CLOCK_FLAG_10MS) in busy loops
|
called from clock(), do not call directly
|
||||||
*/
|
*/
|
||||||
void clock_10ms() {
|
void clock_10ms() {
|
||||||
// reset watchdog
|
// reset watchdog
|
||||||
|
|
@ -78,3 +78,14 @@ void clock_10ms() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! do reoccuring stuff
|
||||||
|
|
||||||
|
call it occasionally in busy loops
|
||||||
|
*/
|
||||||
|
void clock() {
|
||||||
|
ifclock(clock_flag_10ms) {
|
||||||
|
clock_10ms();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
1
clock.h
1
clock.h
|
|
@ -3,5 +3,6 @@
|
||||||
|
|
||||||
void clock_250ms(void);
|
void clock_250ms(void);
|
||||||
void clock_10ms(void);
|
void clock_10ms(void);
|
||||||
|
void clock(void);
|
||||||
|
|
||||||
#endif /* _CLOCK_H */
|
#endif /* _CLOCK_H */
|
||||||
|
|
|
||||||
|
|
@ -198,9 +198,6 @@ void queue_flush() {
|
||||||
|
|
||||||
/// wait for queue to empty
|
/// wait for queue to empty
|
||||||
void queue_wait() {
|
void queue_wait() {
|
||||||
for (;queue_empty() == 0;) {
|
while (queue_empty() == 0)
|
||||||
ifclock(clock_flag_10ms) {
|
clock();
|
||||||
clock_10ms();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,9 +155,7 @@ void process_gcode_command() {
|
||||||
// delay
|
// delay
|
||||||
if (next_target.seen_P) {
|
if (next_target.seen_P) {
|
||||||
for (;next_target.P > 0;next_target.P--) {
|
for (;next_target.P > 0;next_target.P--) {
|
||||||
ifclock(clock_flag_10ms) {
|
clock();
|
||||||
clock_10ms();
|
|
||||||
}
|
|
||||||
delay_ms(1);
|
delay_ms(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue