Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzmax committed Jan 21, 2020
2 parents 7c15cbd + b7f86bf commit 38413dc
Show file tree
Hide file tree
Showing 18 changed files with 251 additions and 54 deletions.
10 changes: 6 additions & 4 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@
* -1 : thermocouple with AD595
* 0 : not used
* 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
* 331 : (3.3V scaled thermistor 1 table)
* 331 : (3.3V scaled thermistor 1 table for MEGA)
* 332 : (3.3V scaled thermistor 1 table for DUE)
* 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
* 3 : Mendel-parts thermistor (4.7k pullup)
* 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
Expand Down Expand Up @@ -1536,9 +1537,10 @@
// Default number of triangles
#define NOZZLE_CLEAN_TRIANGLES 3

// Specify positions as { X, Y, Z }
#define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1) }
#define NOZZLE_CLEAN_END_POINT { 100, 60, (Z_MIN_POS + 1) }
// Specify positions for each tool as { { X, Y, Z }, { X, Y, Z } }
// Dual hotend system may use { { -20, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }, { 420, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }}
#define NOZZLE_CLEAN_START_POINT { { 30, 30, (Z_MIN_POS + 1) } }
#define NOZZLE_CLEAN_END_POINT { { 100, 60, (Z_MIN_POS + 1) } }

// Circular pattern radius
#define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5
Expand Down
40 changes: 26 additions & 14 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,21 @@
* Thermal Protection parameters for the bed are just as above for hotends.
*/
#if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius

/**
* As described above, except for the bed (M140/M190/M303).
*/
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
#endif

/**
* Thermal Protection parameters for the heated chamber.
*/
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius

/**
Expand Down Expand Up @@ -1567,14 +1567,15 @@
//
// G2/G3 Arc Support
//
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define MM_PER_ARC_SEGMENT 1 // (mm) Length (or minimum length) of each arc segment
//#define ARC_SEGMENTS_PER_R 1 // Max segment length, MM_PER = Min
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
//#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum)
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif

// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
Expand Down Expand Up @@ -1771,6 +1772,9 @@
// Z raise distance for tool-change, as needed for some extruders
#define TOOLCHANGE_ZRAISE 2 // (mm)
//#define TOOLCHANGE_NO_RETURN // Never return to the previous position on tool-change
#if ENABLED(TOOLCHANGE_NO_RETURN)
//#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // G-code to run after tool-change is complete
#endif

// Retract and prime filament on tool-change
//#define TOOLCHANGE_FILAMENT_SWAP
Expand Down Expand Up @@ -2449,6 +2453,14 @@

#endif // HAS_L64XX

// @section i2cbus

//
// I2C Master ID for LPC176x LCD and Digital Current control
// Does not apply to other peripherals based on the Wire library.
//
//#define I2C_MASTER_ID 1 // Set a value from 0 to 2

/**
* TWI/I2C BUS
*
Expand Down Expand Up @@ -2477,10 +2489,10 @@
* echo:i2c-reply: from:99 bytes:5 data:hello
*/

// @section i2cbus

//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#if ENABLED(EXPERIMENTAL_I2CBUS)
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif

// @section extras

Expand Down
7 changes: 3 additions & 4 deletions Marlin/src/HAL/HAL_LPC1768/include/i2c_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#ifdef TARGET_LPC1768

#include "../../../inc/MarlinConfigPre.h"
#include "i2c_util.h"

#define U8G_I2C_OPT_FAST 16 // from u8g.h
Expand All @@ -43,13 +42,13 @@ void configure_i2c(const uint8_t clock_option) {
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Portnum = 0;
#if USEDI2CDEV_M == 0
#if I2C_MASTER_ID == 0
PinCfg.Funcnum = 1;
PinCfg.Pinnum = 27; // SDA0 / D57 AUX-1 ... SCL0 / D58 AUX-1
#elif USEDI2CDEV_M == 1
#elif I2C_MASTER_ID == 1
PinCfg.Funcnum = 3;
PinCfg.Pinnum = 0; // SDA1 / D20 SCA ... SCL1 / D21 SCL
#elif USEDI2CDEV_M == 2
#elif I2C_MASTER_ID == 2
PinCfg.Funcnum = 2;
PinCfg.Pinnum = 10; // SDA2 / D38 X_ENABLE_PIN ... SCL2 / D55 X_DIR_PIN
#endif
Expand Down
12 changes: 7 additions & 5 deletions Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
* HAL_LPC1768/include/i2c_util.h
*/

#ifndef USEDI2CDEV_M
#define USEDI2CDEV_M 1 // By default use I2C1 controller
#include "../../../inc/MarlinConfigPre.h"

#ifndef I2C_MASTER_ID
#define I2C_MASTER_ID 1
#endif

#if USEDI2CDEV_M == 0
#if I2C_MASTER_ID == 0
#define I2CDEV_M LPC_I2C0
#elif USEDI2CDEV_M == 1
#elif I2C_MASTER_ID == 1
#define I2CDEV_M LPC_I2C1
#elif USEDI2CDEV_M == 2
#elif I2C_MASTER_ID == 2
#define I2CDEV_M LPC_I2C2
#else
#error "Master I2C device not defined!"
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/HAL_LPC1768/u8g/LCD_I2C_routines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

#ifdef TARGET_LPC1768

#include "../include/i2c_util.h"
#include "../../../core/millis_t.h"

extern int millis();

#ifdef __cplusplus
extern "C" {
#endif

#include "../include/i2c_util.h"
#include "../../../core/millis_t.h"

//////////////////////////////////////////////////////////////////////////////////////

// These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to
Expand Down
34 changes: 29 additions & 5 deletions Marlin/src/HAL/HAL_STM32/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
#define TEMP_TIMER 2
#endif

#elif defined(STM32F4xx) || defined(STM32F7xx)
#elif defined(STM32F401xC) || defined(STM32F401xE)

#define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals

// STM32F401 only has timers 1-5 & 9-11 with timers 4 & 5 usually assigned to TIMER_SERVO and TIMER_TONE

Expand All @@ -71,6 +71,30 @@
#define TEMP_TIMER 10
#endif

#elif defined(STM32F4xx)

#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals

#ifndef STEP_TIMER
#define STEP_TIMER 6
#endif

#ifndef TEMP_TIMER
#define TEMP_TIMER 14
#endif

#elif defined(STM32F7xx)

#define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals

#ifndef STEP_TIMER
#define STEP_TIMER 6
#endif

#ifndef TEMP_TIMER
#define TEMP_TIMER 14
#endif

#endif

#ifndef SWSERIAL_TIMER_IRQ_PRIO
Expand All @@ -82,16 +106,16 @@
#endif

#ifndef TEMP_TIMER_IRQ_PRIO
#define TEMP_TIMER_IRQ_PRIO 14 //14 = after hardware ISRs
#define TEMP_TIMER_IRQ_PRIO 14 // 14 = after hardware ISRs
#endif

#define STEP_TIMER_NUM 0 // index of timer to use for stepper
#define TEMP_TIMER_NUM 1 // index of timer to use for temperature
#define PULSE_TIMER_NUM STEP_TIMER_NUM

#define TEMP_TIMER_FREQUENCY 1000 //Temperature::isr() is expected to be called at around 1kHz
#define TEMP_TIMER_FREQUENCY 1000 // Temperature::isr() is expected to be called at around 1kHz

//TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
// TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
#define BOARD_ARCHIM1 3023 // UltiMachine Archim1 (with DRV8825 drivers)
#define BOARD_ARCHIM2 3024 // UltiMachine Archim2 (with TMC2130 drivers)
#define BOARD_ALLIGATOR 3025 // Alligator Board R2
#define BOARD_CNCONTROLS_15D 3026 // Cartesio CN Controls V15 on DUE

//
// SAM3X8C ARM Cortex M3
Expand Down
11 changes: 6 additions & 5 deletions Marlin/src/gcode/bedlevel/G26.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,13 @@ inline bool turn_on_heaters() {
inline bool prime_nozzle() {

const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
#if HAS_LCD_MENU
#if HAS_LCD_MENU && DISABLED(TOUCH_BUTTONS) // ui.button_pressed issue with touchscreen
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
float Total_Prime = 0.0;
#endif

if (g26_prime_flag == -1) { // The user wants to control how much filament gets purged
#if HAS_LCD_MENU
ui.capture();
#endif
ui.capture();
ui.set_status_P(GET_TEXT(MSG_G26_MANUAL_PRIME), 99);
ui.chirp();

Expand All @@ -439,7 +437,10 @@ inline bool prime_nozzle() {
destination.e += 0.25;
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
Total_Prime += 0.25;
if (Total_Prime >= EXTRUDE_MAXLENGTH) return G26_ERR;
if (Total_Prime >= EXTRUDE_MAXLENGTH) {
ui.release();
return G26_ERR;
}
#endif
prepare_internal_move_to_destination(fr_slow_e);
destination = current_position;
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/gcode/motion/G2_G3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ void plan_arc(

const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);

#ifdef ARC_SEGMENTS_PER_SEC
#ifdef ARC_SEGMENTS_PER_R
float seg_length = MM_PER_ARC_SEGMENT * radius;
LIMIT(seg_length, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R);
#elif ARC_SEGMENTS_PER_SEC
float seg_length = scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC);
NOLESS(seg_length, MM_PER_ARC_SEGMENT);
#else
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-01-20"
#define STRING_DISTRIBUTION_DATE "2020-01-21"
#endif

/**
Expand Down
16 changes: 7 additions & 9 deletions Marlin/src/libs/nozzle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,24 @@ Nozzle nozzle;
* @param argument depends on the cleaning pattern
*/
void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
xyz_pos_t start = NOZZLE_CLEAN_START_POINT, end = NOZZLE_CLEAN_END_POINT;
xyz_pos_t start[HOTENDS] = NOZZLE_CLEAN_START_POINT, end[HOTENDS] = NOZZLE_CLEAN_END_POINT, middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE;

if (pattern == 2) {
if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
SERIAL_ECHOLNPGM("Warning : Clean Circle requires XY");
return;
}
constexpr xyz_pos_t middle NOZZLE_CLEAN_CIRCLE_MIDDLE;
end = middle;
}
else {
if (!TEST(cleans, X_AXIS)) start.x = end.x = current_position.x;
if (!TEST(cleans, Y_AXIS)) start.y = end.y = current_position.y;
if (!TEST(cleans, X_AXIS)) start[active_extruder].x = end[active_extruder].x = current_position.x;
if (!TEST(cleans, Y_AXIS)) start[active_extruder].y = end[active_extruder].y = current_position.y;
}
if (!TEST(cleans, Z_AXIS)) start.z = end.z = current_position.z;
if (!TEST(cleans, Z_AXIS)) start[active_extruder].z = end[active_extruder].z = current_position.z;

switch (pattern) {
case 1: zigzag(start, end, strokes, objects); break;
case 2: circle(start, end, strokes, radius); break;
default: stroke(start, end, strokes);
case 1: zigzag(start[active_extruder], end[active_extruder], strokes, objects); break;
case 2: circle(start[active_extruder], middle[active_extruder], strokes, radius); break;
default: stroke(start[active_extruder], end[active_extruder], strokes);
}
}

Expand Down
50 changes: 50 additions & 0 deletions Marlin/src/module/thermistor/thermistor_332.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* 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/>.
*
*/
#pragma once

#define OVM(V) OV((V)*(0.327/0.327))

// R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
const short temptable_332[][2] PROGMEM = {
{ OVM( 268), 150 },
{ OVM( 293), 145 },
{ OVM( 320), 141 },
{ OVM( 379), 133 },
{ OVM( 445), 122 },
{ OVM( 516), 108 },
{ OVM( 591), 98 },
{ OVM( 665), 88 },
{ OVM( 737), 79 },
{ OVM( 801), 70 },
{ OVM( 857), 55 },
{ OVM( 903), 46 },
{ OVM( 939), 39 },
{ OVM( 954), 33 },
{ OVM( 966), 27 },
{ OVM( 977), 22 },
{ OVM( 999), 15 },
{ OVM(1004), 5 },
{ OVM(1008), 0 },
{ OVM(1012), -5 },
{ OVM(1016), -10 },
{ OVM(1020), -15 }
};
5 changes: 4 additions & 1 deletion Marlin/src/module/thermistor/thermistors.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,12 @@
#if ANY_THERMISTOR_IS(201) // Pt100 with LMV324 Overlord
#include "thermistor_201.h"
#endif
#if ANY_THERMISTOR_IS(331) // Like table 1, but with 3V3 as input voltage
#if ANY_THERMISTOR_IS(331) // Like table 1, but with 3V3 as input voltage for MEGA
#include "thermistor_331.h"
#endif
#if ANY_THERMISTOR_IS(332) // Like table 1, but with 3V3 as input voltage for DUE
#include "thermistor_332.h"
#endif
#if ANY_THERMISTOR_IS(666) // beta25 = UNK, R25 = 200K, Pull-up = 10 kOhm, "Unidentified 200K NTC thermistor (Einstart S)"
#include "thermistor_666.h"
#endif
Expand Down
Loading

0 comments on commit 38413dc

Please sign in to comment.