Feature file updates

This commit is contained in:
Scott Lahteine 2017-09-06 06:28:32 -05:00
parent d7ee81202f
commit 4a82e95c3e
23 changed files with 1831 additions and 1650 deletions

View file

@ -28,19 +28,18 @@
//todo: consider Marlin-optimized Wire library; i.e. MarlinWire, like MarlinSerial
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(I2C_POSITION_ENCODERS)
#include "Marlin.h"
#include "temperature.h"
#include "stepper.h"
#include "I2CPositionEncoder.h"
#include "gcode.h"
#include "../module/temperature.h"
#include "../module/stepper.h"
#include "../gcode/parser.h"
#include <Wire.h>
void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
encoderAxis = axis;
i2cAddress = address;

View file

@ -23,13 +23,10 @@
#ifndef I2CPOSENC_H
#define I2CPOSENC_H
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(I2C_POSITION_ENCODERS)
#include "../module/planner.h"
#include "enum.h"
#include "macros.h"
#include "types.h"
#include <Wire.h>
//=========== Advanced / Less-Common Encoder Configuration Settings ==========
@ -355,5 +352,4 @@
FORCE_INLINE static void gcode_M868() { I2CPEM.M868(); }
FORCE_INLINE static void gcode_M869() { I2CPEM.M869(); }
#endif //I2C_POSITION_ENCODERS
#endif //I2CPOSENC_H

View file

@ -3,12 +3,16 @@
* External DAC for Alligator Board
*
****************************************************************/
#include "Marlin.h"
#include "../../inc/MarlinConfig.h"
#if MB(ALLIGATOR)
#include "stepper.h"
#include "dac_dac084s085.h"
#include "../../Marlin.h"
#include "../../module/stepper.h"
dac084s085::dac084s085() {
return ;
}
@ -105,4 +109,4 @@
return;
}
#endif
#endif // MB(ALLIGATOR)

View file

@ -1,5 +1,5 @@
#ifndef dac084s085_h
#define dac084s085_h
#ifndef DAC084S085_H
#define DAC084S085_H
class dac084s085 {
public:
@ -8,4 +8,4 @@ class dac084s085 {
static void setValue(uint8_t channel, uint8_t value);
};
#endif //dac084s085_h
#endif // DAC084S085_H

View file

@ -30,11 +30,12 @@
* http://arduino.cc/forum/index.php/topic,51842.0.html
*/
#include "dac_mcp4728.h"
#include "enum.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(DAC_STEPPER_CURRENT)
#include "dac_mcp4728.h"
uint16_t mcp4728_values[XYZE];
/**

View file

@ -27,10 +27,7 @@
#ifndef DAC_MCP4728_H
#define DAC_MCP4728_H
#include "MarlinConfig.h"
#if ENABLED(DAC_STEPPER_CURRENT)
#include "Wire.h"
#include <Wire.h>
#define defaultVDD DAC_STEPPER_MAX //was 5000 but differs with internal Vref
#define BASE_ADDR 0x60
@ -50,7 +47,6 @@
// DAC_OR_ADDRESS defined in pins_BOARD.h file
#define DAC_DEV_ADDRESS (BASE_ADDR | DAC_OR_ADDRESS)
void mcp4728_init();
uint8_t mcp4728_analogWrite(uint8_t channel, uint16_t value);
uint8_t mcp4728_eepromWrite();
@ -62,5 +58,4 @@ uint8_t mcp4728_simpleCommand(byte simpleCommand);
uint8_t mcp4728_getDrvPct(uint8_t channel);
void mcp4728_setDrvPct(uint8_t pct[XYZE]);
#endif
#endif // DAC_MCP4728_H

View file

@ -41,7 +41,7 @@
along with Marlin. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(DAC_STEPPER_CURRENT)

View file

@ -20,11 +20,11 @@
*
*/
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(DIGIPOT_I2C) && ENABLED(DIGIPOT_MCP4018)
#include "enum.h"
#include "../core/enum.h"
#include "Stream.h"
#include "utility/twi.h"
#include <SlowSoftI2CMaster.h> //https://github.com/stawel/SlowSoftI2CMaster

View file

@ -20,7 +20,7 @@
*
*/
#include "MarlinConfig.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(DIGIPOT_I2C) && DISABLED(DIGIPOT_MCP4018)

View file

@ -49,15 +49,16 @@
* void Max7219_idle_tasks();
*/
#include "MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(MAX7219_DEBUG)
#include "Marlin.h"
#include "planner.h"
#include "stepper.h"
#include "Max7219_Debug_LEDs.h"
#include "../../module/planner.h"
#include "../../module/stepper.h"
#include "../../Marlin.h"
static uint8_t LEDs[8] = { 0 };
void Max7219_PutByte(uint8_t data) {

View file

@ -25,7 +25,7 @@
* Created by Tim Koster, August 21 2013.
*/
#include "Marlin.h"
#include "../../Marlin.h"
#if ENABLED(BLINKM)

View file

@ -20,12 +20,12 @@
*
*/
/*
/**
* Driver for the Philips PCA9632 LED driver.
* Written by Robert Mendon Feb 2017.
*/
#include "MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(PCA9632)

View file

@ -20,10 +20,12 @@
*
*/
#include "mesh_bed_leveling.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(MESH_BED_LEVELING)
#include "mesh_bed_leveling.h"
mesh_bed_leveling mbl;
uint8_t mesh_bed_leveling::status;

View file

@ -20,9 +20,10 @@
*
*/
#include "Marlin.h"
#ifndef _MESH_BED_LEVELING_H_
#define _MESH_BED_LEVELING_H_
#if ENABLED(MESH_BED_LEVELING)
#include "../../Marlin.h"
enum MeshLevelingState {
MeshReport,
@ -119,4 +120,4 @@
extern mesh_bed_leveling mbl;
#endif // MESH_BED_LEVELING
#endif // _MESH_BED_LEVELING_H_

View file

@ -0,0 +1,157 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 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/>.
*
*/
#include "../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130)
#include "tmc2130.h"
#include "../Marlin.h"
#include "../libs/duration_t.h"
#include "../module/stepper_indirection.h"
#include <TMC2130Stepper.h>
#ifdef AUTOMATIC_CURRENT_CONTROL
bool auto_current_control = 0;
#endif
void automatic_current_control(TMC2130Stepper &st, String axisID) {
// Check otpw even if we don't use automatic control. Allows for flag inspection.
const bool is_otpw = st.checkOT();
// Report if a warning was triggered
static bool previous_otpw = false;
if (is_otpw && !previous_otpw) {
char timestamp[10];
duration_t elapsed = print_job_timer.duration();
const bool has_days = (elapsed.value > 60*60*24L);
(void)elapsed.toDigital(timestamp, has_days);
SERIAL_ECHO(timestamp);
SERIAL_ECHOPGM(": ");
SERIAL_ECHO(axisID);
SERIAL_ECHOLNPGM(" driver overtemperature warning!");
}
previous_otpw = is_otpw;
#if ENABLED(AUTOMATIC_CURRENT_CONTROL) && CURRENT_STEP > 0
// Return if user has not enabled current control start with M906 S1.
if (!auto_current_control) return;
/**
* Decrease current if is_otpw is true.
* Bail out if driver is disabled.
* Increase current if OTPW has not been triggered yet.
*/
uint16_t current = st.getCurrent();
if (is_otpw) {
st.setCurrent(current - CURRENT_STEP, R_SENSE, HOLD_MULTIPLIER);
#if ENABLED(REPORT_CURRENT_CHANGE)
SERIAL_ECHO(axisID);
SERIAL_ECHOPAIR(" current decreased to ", st.getCurrent());
#endif
}
else if (!st.isEnabled())
return;
else if (!is_otpw && !st.getOTPW()) {
current += CURRENT_STEP;
if (current <= AUTO_ADJUST_MAX) {
st.setCurrent(current, R_SENSE, HOLD_MULTIPLIER);
#if ENABLED(REPORT_CURRENT_CHANGE)
SERIAL_ECHO(axisID);
SERIAL_ECHOPAIR(" current increased to ", st.getCurrent());
#endif
}
}
SERIAL_EOL();
#endif
}
void tmc2130_checkOverTemp(void) {
static millis_t next_cOT = 0;
if (ELAPSED(millis(), next_cOT)) {
next_cOT = millis() + 5000;
#if ENABLED(X_IS_TMC2130)
automatic_current_control(stepperX, "X");
#endif
#if ENABLED(Y_IS_TMC2130)
automatic_current_control(stepperY, "Y");
#endif
#if ENABLED(Z_IS_TMC2130)
automatic_current_control(stepperZ, "Z");
#endif
#if ENABLED(X2_IS_TMC2130)
automatic_current_control(stepperX2, "X2");
#endif
#if ENABLED(Y2_IS_TMC2130)
automatic_current_control(stepperY2, "Y2");
#endif
#if ENABLED(Z2_IS_TMC2130)
automatic_current_control(stepperZ2, "Z2");
#endif
#if ENABLED(E0_IS_TMC2130)
automatic_current_control(stepperE0, "E0");
#endif
#if ENABLED(E1_IS_TMC2130)
automatic_current_control(stepperE1, "E1");
#endif
#if ENABLED(E2_IS_TMC2130)
automatic_current_control(stepperE2, "E2");
#endif
#if ENABLED(E3_IS_TMC2130)
automatic_current_control(stepperE3, "E3");
#endif
#if ENABLED(E4_IS_TMC2130)
automatic_current_control(stepperE4, "E4");
#endif
#if ENABLED(E4_IS_TMC2130)
automatic_current_control(stepperE4);
#endif
}
}
/**
* TMC2130 specific sensorless homing using stallGuard2.
* stallGuard2 only works when in spreadCycle mode.
* spreadCycle and stealthChop are mutually exclusive.
*/
#if ENABLED(SENSORLESS_HOMING)
void tmc2130_sensorless_homing(TMC2130Stepper &st, bool enable/*=true*/) {
#if ENABLED(STEALTHCHOP)
if (enable) {
st.coolstep_min_speed(1024UL * 1024UL - 1UL);
st.stealthChop(0);
}
else {
st.coolstep_min_speed(0);
st.stealthChop(1);
}
#endif
st.diag1_stall(enable ? 1 : 0);
}
#endif // SENSORLESS_HOMING
#endif // HAVE_TMC2130

View file

@ -0,0 +1,30 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 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/>.
*
*/
#ifndef _TMC2130_H_
#define _TMC2130_H_
extern bool auto_current_control;
void tmc2130_checkOverTemp(void);
#endif // _TMC2130_H_

View file

@ -20,11 +20,12 @@
*
*/
#include "Marlin.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(EXPERIMENTAL_I2CBUS)
#include "twibus.h"
#include <Wire.h>
TWIBus::TWIBus() {

View file

@ -23,7 +23,7 @@
#ifndef TWIBUS_H
#define TWIBUS_H
#include "macros.h"
#include "../core/macros.h"
#include <Wire.h>

View file

@ -24,17 +24,18 @@
* Marlin Firmware -- G26 - Mesh Validation Tool
*/
#include "MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_VALIDATION)
#include "ubl.h"
#include "Marlin.h"
#include "planner.h"
#include "stepper.h"
#include "temperature.h"
#include "ultralcd.h"
#include "gcode.h"
#include "../../Marlin.h"
#include "../../module/planner.h"
#include "../../module/stepper.h"
#include "../../module/temperature.h"
#include "../../lcd/ultralcd.h"
#include "../../gcode/parser.h"
#define EXTRUSION_MULTIPLIER 1.0
#define RETRACTION_MULTIPLIER 1.0
@ -140,8 +141,8 @@
inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
inline void set_current_to_destination() { COPY(current_position, destination); }
#else
extern void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
extern void set_current_to_destination() { COPY(current_position, destination); }
extern void sync_plan_position_e();
extern void set_current_to_destination();
#endif
#if ENABLED(NEWPANEL)
void lcd_setstatusPGM(const char* const message, const int8_t level);

View file

@ -20,16 +20,18 @@
*
*/
#include "Marlin.h"
#include "math.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "ubl.h"
#include "hex_print_routines.h"
#include "temperature.h"
unified_bed_leveling ubl;
extern Planner planner;
#include "../../module/configuration_store.h"
#include "../../core/serial.h"
#include "../../module/planner.h"
#include "math.h"
/**
* These support functions allow the use of large bit arrays of flags that take very
@ -37,9 +39,9 @@
* to unsigned long will allow us to go to 32x32 if higher resolution Mesh's are needed
* in the future.
*/
void bit_clear(uint16_t bits[16], uint8_t x, uint8_t y) { CBI(bits[y], x); }
void bit_set(uint16_t bits[16], uint8_t x, uint8_t y) { SBI(bits[y], x); }
bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y) { return TEST(bits[y], x); }
void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); }
void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); }
bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); }
uint8_t ubl_cnt = 0;

View file

@ -23,14 +23,9 @@
#ifndef UNIFIED_BED_LEVELING_H
#define UNIFIED_BED_LEVELING_H
#include "MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "Marlin.h"
#include "planner.h"
#include "math.h"
#include "vector_3.h"
#include "configuration_store.h"
#include "../../Marlin.h"
#include "../../core/serial.h"
#include "../../module/planner.h"
#define UBL_VERSION "1.01"
#define UBL_OK false
@ -46,9 +41,9 @@
// ubl.cpp
void bit_clear(uint16_t bits[16], uint8_t x, uint8_t y);
void bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y);
void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y);
bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y);
// ubl_motion.cpp
@ -399,11 +394,4 @@
extern unified_bed_leveling ubl;
#if ENABLED(UBL_G26_MESH_VALIDATION)
FORCE_INLINE void gcode_G26() { ubl.G26(); }
#endif
FORCE_INLINE void gcode_G29() { ubl.G29(); }
#endif // AUTO_BED_LEVELING_UBL
#endif // UNIFIED_BED_LEVELING_H

View file

@ -20,21 +20,22 @@
*
*/
#include "MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "ubl.h"
#include "Marlin.h"
#include "hex_print_routines.h"
#include "configuration_store.h"
#include "ultralcd.h"
#include "stepper.h"
#include "planner.h"
#include "gcode.h"
#include "../../Marlin.h"
#include "../../libs/hex_print_routines.h"
#include "../../module/configuration_store.h"
#include "../../lcd/ultralcd.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
#include "../../gcode/parser.h"
#include "../../libs/least_squares_fit.h"
#include <math.h>
#include "least_squares_fit.h"
#define UBL_G29_P31

View file

@ -19,14 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "Marlin.h"
#include "ubl.h"
#include "planner.h"
#include "stepper.h"
#include "../../Marlin.h"
#include "../../module/planner.h"
#include "../../module/stepper.h"
#include <math.h>
extern float destination[XYZE];