clock.c: introduce clock().

This simplifies calls to clock_10ms() a bit and saves 18 bytes
binary size.
This commit is contained in:
Markus Hitter 2012-09-02 19:24:15 +02:00
parent 97a663a00c
commit f06b013179
5 changed files with 17 additions and 12 deletions

13
clock.c
View File

@ -65,7 +65,7 @@ void clock_250ms() {
/*! do stuff every 10 milliseconds
call from ifclock(CLOCK_FLAG_10MS) in busy loops
called from clock(), do not call directly
*/
void clock_10ms() {
// 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();
}
}

View File

@ -3,5 +3,6 @@
void clock_250ms(void);
void clock_10ms(void);
void clock(void);
#endif /* _CLOCK_H */

View File

@ -198,9 +198,6 @@ void queue_flush() {
/// wait for queue to empty
void queue_wait() {
for (;queue_empty() == 0;) {
ifclock(clock_flag_10ms) {
clock_10ms();
}
}
while (queue_empty() == 0)
clock();
}

View File

@ -155,9 +155,7 @@ void process_gcode_command() {
// delay
if (next_target.seen_P) {
for (;next_target.P > 0;next_target.P--) {
ifclock(clock_flag_10ms) {
clock_10ms();
}
clock();
delay_ms(1);
}
}

View File

@ -323,8 +323,6 @@ int main (void)
gcode_parse_char(c);
}
ifclock(clock_flag_10ms) {
clock_10ms();
}
clock();
}
}