Module updates

This commit is contained in:
Scott Lahteine
2017-09-06 06:28:32 -05:00
parent 0fcec02db5
commit 3d8a0ab4b2
20 changed files with 223 additions and 117 deletions

View File

@ -24,15 +24,15 @@
* temperature.cpp - temperature control
*/
#include "Marlin.h"
#include "temperature.h"
#include "thermistortables.h"
#include "ultralcd.h"
#include "../Marlin.h"
#include "../lcd/ultralcd.h"
#include "planner.h"
#include "language.h"
#include "../core/language.h"
#if ENABLED(HEATER_0_USES_MAX6675)
#include "private_spi.h"
#include "../libs/private_spi.h"
#endif
#if ENABLED(BABYSTEPPING)
@ -43,6 +43,8 @@
#include "endstops.h"
#endif
#include "printcounter.h"
#ifdef K1 // Defined in Configuration.h in the PID settings
#define K2 (1.0-K1)
#endif
@ -333,7 +335,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
SERIAL_PROTOCOLPAIR(MSG_T_MIN, min);
SERIAL_PROTOCOLPAIR(MSG_T_MAX, max);
if (cycles > 2) {
Ku = (4.0 * d) / (M_PI * (max - min) * 0.5);
Ku = (4.0 * d) / (M_PI * (max - min) * 0.5); // i.e., CIRCLE_CIRC((max - min) * 0.25)
Tu = ((float)(t_low + t_high) * 0.001);
SERIAL_PROTOCOLPAIR(MSG_KU, Ku);
SERIAL_PROTOCOLPAIR(MSG_TU, Tu);
@ -1074,7 +1076,7 @@ void Temperature::init() {
HAL_ANALOG_SELECT(FILWIDTH_PIN);
#endif
// todo: HAL: fix abstraction
// todo: HAL: fix abstraction
#ifdef ARDUINO_ARCH_AVR
// Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt
@ -1219,6 +1221,63 @@ void Temperature::init() {
#endif
}
#if ENABLED(FAST_PWM_FAN)
void Temperature::setPwmFrequency(const uint8_t pin, int val) {
val &= 0x07;
switch (digitalPinToTimer(pin)) {
#ifdef TCCR0A
#if !AVR_AT90USB1286_FAMILY
case TIMER0A:
#endif
case TIMER0B:
//_SET_CS(0, val);
break;
#endif
#ifdef TCCR1A
case TIMER1A:
case TIMER1B:
//_SET_CS(1, val);
break;
#endif
#ifdef TCCR2
case TIMER2:
case TIMER2:
_SET_CS(2, val);
break;
#endif
#ifdef TCCR2A
case TIMER2A:
case TIMER2B:
_SET_CS(2, val);
break;
#endif
#ifdef TCCR3A
case TIMER3A:
case TIMER3B:
case TIMER3C:
_SET_CS(3, val);
break;
#endif
#ifdef TCCR4A
case TIMER4A:
case TIMER4B:
case TIMER4C:
_SET_CS(4, val);
break;
#endif
#ifdef TCCR5A
case TIMER5A:
case TIMER5B:
case TIMER5C:
_SET_CS(5, val);
break;
#endif
}
}
#endif // FAST_PWM_FAN
#if WATCH_HOTENDS
/**
* Start Heating Sanity Check for hotends that are below