Fixed fancheck and include in TimerRemaining.h

this commit enables fast pwm mode for bed (SYSTEM_TIMER_2 definition uncomented)
fancheck fix verified with selftest
This commit is contained in:
Robert Pelnar 2019-01-28 12:57:33 +01:00
parent eea755496b
commit 1b4e49b5ac
2 changed files with 15 additions and 3 deletions

View File

@ -18,7 +18,7 @@
#include <avr/interrupt.h> #include <avr/interrupt.h>
//#define SYSTEM_TIMER_2 #define SYSTEM_TIMER_2
#ifdef SYSTEM_TIMER_2 #ifdef SYSTEM_TIMER_2
#include "timer02.h" #include "timer02.h"
@ -275,10 +275,22 @@ void refresh_cmd_timeout(void);
// The standard Arduino timer() function returns this value atomically // The standard Arduino timer() function returns this value atomically
// by disabling / enabling interrupts. This is costly, if the interrupts are known // by disabling / enabling interrupts. This is costly, if the interrupts are known
// to be disabled. // to be disabled.
#ifdef SYSTEM_TIMER_2
extern volatile unsigned long timer2_millis;
#else //SYSTEM_TIMER_2
extern volatile unsigned long timer0_millis; extern volatile unsigned long timer0_millis;
#endif //SYSTEM_TIMER_2
// An unsynchronized equivalent to a standard Arduino _millis() function. // An unsynchronized equivalent to a standard Arduino _millis() function.
// To be used inside an interrupt routine. // To be used inside an interrupt routine.
FORCE_INLINE unsigned long millis_nc() { return timer0_millis; }
FORCE_INLINE unsigned long millis_nc() {
#ifdef SYSTEM_TIMER_2
return timer2_millis;
#else //SYSTEM_TIMER_2
return timer0_millis;
#endif //SYSTEM_TIMER_2
}
#ifdef FAST_PWM_FAN #ifdef FAST_PWM_FAN
void setPwmFrequency(uint8_t pin, int val); void setPwmFrequency(uint8_t pin, int val);

View File

@ -7,7 +7,7 @@
#define TIMERREMAINING_H #define TIMERREMAINING_H
#include "Timer.h" #include "Timer.h"
#include "Arduino.h" #include "Marlin.h"
#include <limits.h> #include <limits.h>
class TimerRemaining : public LongTimer class TimerRemaining : public LongTimer