Prusa MINI Firmware overview
|
#include "temperature.h"
#include "endstops.h"
#include "../Marlin.h"
#include "../lcd/ultralcd.h"
#include "planner.h"
#include "../core/language.h"
#include "../HAL/shared/Delay.h"
#include "stepper.h"
#include "printcounter.h"
Classes | |
class | SoftPWM |
Macros | |
#define | MAX6675_SEPARATE_SPI (EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PIN_EXISTS(MAX6675_SCK, MAX6675_DO)) |
#define | _BED_PSTR(h) |
#define | _CHAMBER_PSTR(h) |
#define | _E_PSTR(h, N) ((HOTENDS) > N && (h) == N) ? PSTR(LCD_STR_E##N) : |
#define | HEATER_PSTR(h) _BED_PSTR(h) _CHAMBER_PSTR(h) _E_PSTR(h,1) _E_PSTR(h,2) _E_PSTR(h,3) _E_PSTR(h,4) _E_PSTR(h,5) PSTR(LCD_STR_E0) |
#define | TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) < (HEATER_##N##_RAW_HI_TEMP) ? 1 : -1) |
#define | _EFANOVERLAP(A, B) _FANOVERLAP(E##A,B) |
#define | TEMP_AD595(RAW) ((RAW) * 5.0 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET) |
#define | TEMP_AD8495(RAW) ((RAW) * 6.6 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET) |
#define | SCAN_THERMISTOR_TABLE(TBL, LEN) |
#define | _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH) |
#define | _INIT_FAN_PIN(P) do{ if (PWM_PIN(P)) SET_PWM(P); else _INIT_SOFT_FAN(P); }while(0) |
#define | SET_FAST_PWM_FREQ(P) NOOP |
#define | INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0) |
#define | INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(FAST_PWM_FAN_FREQUENCY); } else SET_OUTPUT(P); }while(0) |
#define | INIT_CHAMBER_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(FAST_PWM_FAN_FREQUENCY); } else SET_OUTPUT(P); }while(0) |
#define | DISABLE_HEATER(NR) |
#define | _PWM_MOD(N, S, T) |
#define | _PWM_LOW(N, S) do{ if (S.count <= pwm_count_tmp) WRITE_HEATER_##N(LOW); }while(0) |
#define | ACCUMULATE_ADC(obj) |
Functions | |
void | loud_kill (PGM_P const lcd_msg, const heater_ind_t heater) |
HAL_TEMP_TIMER_ISR () | |
Variables | |
Temperature | thermalManager |
#define MAX6675_SEPARATE_SPI (EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PIN_EXISTS(MAX6675_SCK, MAX6675_DO)) |
Marlin 3D Printer Firmware Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
Based on Sprinter and grbl. Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. temperature.cpp - temperature control
#define _BED_PSTR | ( | h | ) |
Macros to include the heater id in temp errors. The compiler's dead-code elimination should (hopefully) optimize out the unused strings.
#define _CHAMBER_PSTR | ( | h | ) |
#define HEATER_PSTR | ( | h | ) | _BED_PSTR(h) _CHAMBER_PSTR(h) _E_PSTR(h,1) _E_PSTR(h,2) _E_PSTR(h,3) _E_PSTR(h,4) _E_PSTR(h,5) PSTR(LCD_STR_E0) |
#define TEMPDIR | ( | N | ) | ((HEATER_##N##_RAW_LO_TEMP) < (HEATER_##N##_RAW_HI_TEMP) ? 1 : -1) |
#define _EFANOVERLAP | ( | A, | |
B | |||
) | _FANOVERLAP(E##A,B) |
#define TEMP_AD595 | ( | RAW | ) | ((RAW) * 5.0 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET) |
#define TEMP_AD8495 | ( | RAW | ) | ((RAW) * 6.6 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET) |
#define SCAN_THERMISTOR_TABLE | ( | TBL, | |
LEN | |||
) |
Bisect search for the range of the 'raw' value, then interpolate proportionally between the under and over values.
#define _INIT_SOFT_FAN | ( | P | ) | OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH) |
#define _INIT_FAN_PIN | ( | P | ) | do{ if (PWM_PIN(P)) SET_PWM(P); else _INIT_SOFT_FAN(P); }while(0) |
#define SET_FAST_PWM_FREQ | ( | P | ) | NOOP |
#define INIT_FAN_PIN | ( | P | ) | do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0) |
#define INIT_E_AUTO_FAN_PIN | ( | P | ) | do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(FAST_PWM_FAN_FREQUENCY); } else SET_OUTPUT(P); }while(0) |
#define INIT_CHAMBER_AUTO_FAN_PIN | ( | P | ) | do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(FAST_PWM_FAN_FREQUENCY); } else SET_OUTPUT(P); }while(0) |
#define DISABLE_HEATER | ( | NR | ) |
#define _PWM_MOD | ( | N, | |
S, | |||
T | |||
) |
#define ACCUMULATE_ADC | ( | obj | ) |
void loud_kill | ( | PGM_P const | lcd_msg, |
const heater_ind_t | heater | ||
) |
HAL_TEMP_TIMER_ISR | ( | ) |
Timer 0 is shared with millies so don't change the prescaler.
On AVR this ISR uses the compare method so it runs at the base frequency (16 MHz / 64 / 256 = 976.5625 Hz), but at the TCNT0 set in OCR0B above (128 or halfway between OVFs).
Temperature thermalManager |