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

@ -177,28 +177,28 @@
MarlinSettings settings;
#include "Marlin.h"
#include "language.h"
#include "endstops.h"
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
#include "stepper.h"
#include "temperature.h"
#include "../lcd/ultralcd.h"
#include "../core/language.h"
#include "../Marlin.h"
#if ENABLED(INCH_MODE_SUPPORT) || (ENABLED(ULTIPANEL) && ENABLED(TEMPERATURE_UNITS_SUPPORT))
#include "gcode.h"
#include "../gcode/parser.h"
#endif
#if ENABLED(MESH_BED_LEVELING)
#include "mesh_bed_leveling.h"
#if HAS_BED_PROBE
#include "../module/probe.h"
#endif
#if ENABLED(HAVE_TMC2130)
#include "stepper_indirection.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "ubl.h"
#if ENABLED(FWRETRACT)
#include "../feature/fwretract.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@ -252,7 +252,7 @@ void MarlinSettings::postprocess() {
}
#if ENABLED(EEPROM_SETTINGS)
#include "src/HAL/persistent_store_api.h"
#include "../HAL/persistent_store_api.h"
#define DUMMY_PID_VALUE 3000.0f
#define EEPROM_START() int eeprom_index = EEPROM_OFFSET; HAL::PersistentStore::access_start()

View File

@ -23,7 +23,7 @@
#ifndef CONFIGURATION_STORE_H
#define CONFIGURATION_STORE_H
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
class MarlinSettings {
public:

View File

@ -24,12 +24,13 @@
* endstops.cpp - A singleton object to manage endstops
*/
#include "Marlin.h"
#include "cardreader.h"
#include "endstops.h"
#include "temperature.h"
#include "stepper.h"
#include "ultralcd.h"
#include "../Marlin.h"
#include "../sd/cardreader.h"
#include "../module/temperature.h"
#include "../lcd/ultralcd.h"
// TEST_ENDSTOP: test the old and the current status of an endstop
#define TEST_ENDSTOP(ENDSTOP) (TEST(current_endstop_bits & old_endstop_bits, ENDSTOP))

View File

@ -27,7 +27,7 @@
#ifndef ENDSTOPS_H
#define ENDSTOPS_H
#include "enum.h"
#include "../core/enum.h"
class Endstops {
@ -48,7 +48,7 @@ class Endstops {
/**
* Initialize the endstop pins
*/
void init();
static void init();
/**
* Update the endstops bits from the pins

View File

@ -60,16 +60,16 @@
#include "planner.h"
#include "stepper.h"
#include "temperature.h"
#include "ultralcd.h"
#include "language.h"
#include "ubl.h"
#include "gcode.h"
#include "../module/temperature.h"
#include "../lcd/ultralcd.h"
#include "../core/language.h"
#include "../feature/ubl/ubl.h"
#include "../gcode/parser.h"
#include "Marlin.h"
#include "../Marlin.h"
#if ENABLED(MESH_BED_LEVELING)
#include "mesh_bed_leveling.h"
#include "../feature/mbl/mesh_bed_leveling.h"
#endif
Planner planner;

View File

@ -32,12 +32,10 @@
#ifndef PLANNER_H
#define PLANNER_H
#include "types.h"
#include "enum.h"
#include "Marlin.h"
#include "../Marlin.h"
#if HAS_ABL
#include "vector_3.h"
#include "../libs/vector_3.h"
#endif
enum BlockFlagBit {

View File

@ -27,13 +27,14 @@
*
*/
#include "Marlin.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(BEZIER_CURVE_SUPPORT)
#include "planner.h"
#include "language.h"
#include "temperature.h"
#include "../Marlin.h"
#include "../module/planner.h"
#include "../core/language.h"
#include "../module/temperature.h"
// See the meaning in the documentation of cubic_b_spline().
#define MIN_STEP 0.002

View File

@ -30,7 +30,7 @@
#ifndef PLANNER_BEZIER_H
#define PLANNER_BEZIER_H
#include "Marlin.h"
#include "../inc/MarlinConfig.h"
void cubic_b_spline(
const float position[NUM_AXIS], // current position

View File

@ -20,9 +20,10 @@
*
*/
#include "Marlin.h"
#include "printcounter.h"
#include "duration_t.h"
#include "../Marlin.h"
#include "../libs/duration_t.h"
PrintCounter::PrintCounter(): super() {
this->loadStats();

View File

@ -23,9 +23,8 @@
#ifndef PRINTCOUNTER_H
#define PRINTCOUNTER_H
#include "macros.h"
#include "language.h"
#include "stopwatch.h"
#include "../inc/MarlinConfig.h"
#include "../libs/stopwatch.h"
// Print debug messages with M111 S2
//#define DEBUG_PRINTCOUNTER

View File

@ -23,8 +23,6 @@
#ifndef SPEED_LOOKUPTABLE_H
#define SPEED_LOOKUPTABLE_H
#include "Marlin.h"
#if F_CPU == 16000000
const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {

View File

@ -44,21 +44,29 @@
/* The timer calculations of this module informed by the 'RepRap cartesian firmware' by Zack Smith
and Philipp Tiefenbacher. */
#include "Marlin.h"
#include "stepper.h"
#include "endstops.h"
#include "planner.h"
#if MB(ALLIGATOR)
#include "dac_dac084s085.h"
#endif
#include "temperature.h"
#include "ultralcd.h"
#include "language.h"
#include "cardreader.h"
#ifdef ARDUINO_ARCH_AVR
#include "speed_lookuptable.h"
#endif
#include "endstops.h"
#include "planner.h"
#include "../Marlin.h"
#include "../module/temperature.h"
#include "../lcd/ultralcd.h"
#include "../core/language.h"
#include "../sd/cardreader.h"
#if MB(ALLIGATOR)
#include "../feature/dac/dac_dac084s085.h"
#endif
#if HAS_LEVELING
#include "../feature/bedlevel/bedlevel.h"
#endif
#if HAS_DIGIPOTSS
#include <SPI.h>
#endif
@ -67,10 +75,6 @@ Stepper stepper; // Singleton
// public:
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL)
extern bool ubl_lcd_map_control;
#endif
block_t* Stepper::current_block = NULL; // A pointer to the block currently being traced
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
@ -1272,12 +1276,12 @@ void Stepper::finish_and_disable() {
}
void Stepper::quick_stop() {
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL)
if (!ubl_lcd_map_control)
cleaning_buffer_counter = 5000;
#else
cleaning_buffer_counter = 5000;
if (!ubl.lcd_map_control)
#endif
cleaning_buffer_counter = 5000;
DISABLE_STEPPER_DRIVER_INTERRUPT();
while (planner.blocks_queued()) planner.discard_current_block();
current_block = NULL;

View File

@ -43,11 +43,15 @@
#ifndef STEPPER_H
#define STEPPER_H
#include "planner.h"
#include "speed_lookuptable.h"
#include "stepper_indirection.h"
#include "language.h"
#include "types.h"
#ifdef ARDUINO_ARCH_AVR
#include "speed_lookuptable.h"
#endif
#include "../inc/MarlinConfig.h"
#include "../module/planner.h"
#include "../core/language.h"
class Stepper;
extern Stepper stepper;

View File

@ -33,7 +33,7 @@
#include "stepper_indirection.h"
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
//
// TMC26X Driver objects and inits
@ -129,7 +129,7 @@
#include <SPI.h>
#include <TMC2130Stepper.h>
#include "enum.h"
#include "../core/enum.h"
#define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN)

View File

@ -44,7 +44,7 @@
#ifndef STEPPER_INDIRECTION_H
#define STEPPER_INDIRECTION_H
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
// TMC26X drivers have STEP/DIR on normal pins, but ENABLE via SPI
#if ENABLED(HAVE_TMCDRIVER)

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

View File

@ -27,9 +27,13 @@
#ifndef TEMPERATURE_H
#define TEMPERATURE_H
#include "thermistortables.h"
#include "thermistor/thermistors.h"
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(BABYSTEPPING)
extern bool axis_known_position[XYZ];
#endif
#if ENABLED(PID_EXTRUSION_SCALING)
#include "stepper.h"
@ -39,16 +43,6 @@
#define SOFT_PWM_SCALE 0
#endif
#define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
#if HOTENDS == 1
#define HOTEND_INDEX 0
#define EXTRUDER_IDX 0
#else
#define HOTEND_INDEX e
#define EXTRUDER_IDX active_extruder
#endif
/**
* States for ADC reading in the ISR
*/
@ -533,6 +527,10 @@ class Temperature {
private:
#if ENABLED(FAST_PWM_FAN)
static void setPwmFrequency(const uint8_t pin, int val);
#endif
static void set_current_temp_raw();
static void updateTemperaturesFromRawValues();

View File

@ -20,11 +20,10 @@
*
*/
#ifndef THERMISTORTABLES_H_
#define THERMISTORTABLES_H_
#ifndef THERMISTORS_H_
#define THERMISTORS_H_
#include "Marlin.h"
#include "macros.h"
#include "../../inc/MarlinConfig.h"
#define OVERSAMPLENR 16
@ -41,88 +40,88 @@
#define PtLine(T,R0,Rup) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T },
#if ANY_THERMISTOR_IS(1) // 100k bed thermistor
#include "thermistortable_1.h"
#include "thermistor_1.h"
#endif
#if ANY_THERMISTOR_IS(2) // 200k bed thermistor
#include "thermistortable_2.h"
#include "thermistor_2.h"
#endif
#if ANY_THERMISTOR_IS(3) // mendel-parts
#include "thermistortable_3.h"
#include "thermistor_3.h"
#endif
#if ANY_THERMISTOR_IS(4) // 10k thermistor
#include "thermistortable_4.h"
#include "thermistor_4.h"
#endif
#if ANY_THERMISTOR_IS(5) // 100k ParCan thermistor (104GT-2)
#include "thermistortable_5.h"
#include "thermistor_5.h"
#endif
#if ANY_THERMISTOR_IS(6) // 100k Epcos thermistor
#include "thermistortable_6.h"
#include "thermistor_6.h"
#endif
#if ANY_THERMISTOR_IS(7) // 100k Honeywell 135-104LAG-J01
#include "thermistortable_7.h"
#include "thermistor_7.h"
#endif
#if ANY_THERMISTOR_IS(71) // 100k Honeywell 135-104LAF-J01
#include "thermistortable_71.h"
#include "thermistor_71.h"
#endif
#if ANY_THERMISTOR_IS(8) // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
#include "thermistortable_8.h"
#include "thermistor_8.h"
#endif
#if ANY_THERMISTOR_IS(9) // 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
#include "thermistortable_9.h"
#include "thermistor_9.h"
#endif
#if ANY_THERMISTOR_IS(10) // 100k RS thermistor 198-961 (4.7k pullup)
#include "thermistortable_10.h"
#include "thermistor_10.h"
#endif
#if ANY_THERMISTOR_IS(11) // QU-BD silicone bed QWG-104F-3950 thermistor
#include "thermistortable_11.h"
#include "thermistor_11.h"
#endif
#if ANY_THERMISTOR_IS(13) // Hisens thermistor B25/50 =3950 +/-1%
#include "thermistortable_13.h"
#include "thermistor_13.h"
#endif
#if ANY_THERMISTOR_IS(20) // PT100 with INA826 amp on Ultimaker v2.0 electronics
#include "thermistortable_20.h"
#include "thermistor_20.h"
#endif
#if ANY_THERMISTOR_IS(51) // 100k EPCOS (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
#include "thermistortable_51.h"
#include "thermistor_51.h"
#endif
#if ANY_THERMISTOR_IS(52) // 200k ATC Semitec 204GT-2 (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
#include "thermistortable_52.h"
#include "thermistor_52.h"
#endif
#if ANY_THERMISTOR_IS(55) // 100k ATC Semitec 104GT-2 (Used on ParCan) (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
#include "thermistortable_55.h"
#include "thermistor_55.h"
#endif
#if ANY_THERMISTOR_IS(60) // Maker's Tool Works Kapton Bed Thermistor
#include "thermistortable_60.h"
#include "thermistor_60.h"
#endif
#if ANY_THERMISTOR_IS(66) // DyzeDesign 500°C Thermistor
#include "thermistortable_66.h"
#include "thermistor_66.h"
#endif
#if ANY_THERMISTOR_IS(12) // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
#include "thermistortable_12.h"
#include "thermistor_12.h"
#endif
#if ANY_THERMISTOR_IS(70) // bqh2 stock thermistor
#include "thermistortable_70.h"
#include "thermistor_70.h"
#endif
#if ANY_THERMISTOR_IS(75) // Many of the generic silicon heat pads use the MGB18-104F39050L32 Thermistor
#include "thermistortable_75.h"
#include "thermistor_75.h"
#endif
#if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
#include "thermistortable_110.h"
#include "thermistor_110.h"
#endif
#if ANY_THERMISTOR_IS(147) // Pt100 with 4k7 pullup
#include "thermistortable_147.h"
#include "thermistor_147.h"
#endif
#if ANY_THERMISTOR_IS(1010) // Pt1000 with 1k0 pullup
#include "thermistortable_1010.h"
#include "thermistor_1010.h"
#endif
#if ANY_THERMISTOR_IS(1047) // Pt1000 with 4k7 pullup
#include "thermistortable_1047.h"
#include "thermistor_1047.h"
#endif
#if ANY_THERMISTOR_IS(998) // User-defined table 1
#include "thermistortable_998.h"
#include "thermistor_998.h"
#endif
#if ANY_THERMISTOR_IS(999) // User-defined table 2
#include "thermistortable_999.h"
#include "thermistor_999.h"
#endif
#define _TT_NAME(_N) temptable_ ## _N
@ -245,4 +244,4 @@
#endif
#endif
#endif // THERMISTORTABLES_H_
#endif // THERMISTORS_H_