Skip to content

Commit

Permalink
Merge patches from bugfix-2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 24, 2020
2 parents d37bfa3 + 68face8 commit efc1926
Show file tree
Hide file tree
Showing 260 changed files with 13,728 additions and 13,128 deletions.
5 changes: 2 additions & 3 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
/**
* Select the serial port on the board to use for communication with the host.
* This allows the connection of wireless adapters (for instance) to non-default port pins.
* Serial port -1 is the USB emulated serial port, if available.
* Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader.
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
Expand All @@ -107,9 +108,6 @@

/**
* Select a secondary serial port on the board to use for communication with the host.
* This allows the connection of wireless adapters (for instance) to non-default port pins.
* Serial port -1 is the USB emulated serial port, if available.
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_2 -1
Expand Down Expand Up @@ -363,6 +361,7 @@
* 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)
* 202 : 200k thermistor - Copymaster 3D
* 3 : Mendel-parts thermistor (4.7k pullup)
* 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
* 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan & J-Head) (4.7k pullup)
Expand Down
19 changes: 13 additions & 6 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,22 @@
* Controller Fan
* To cool down the stepper drivers and MOSFETs.
*
* The fan will turn on automatically whenever any stepper is enabled
* and turn off after a set period after all steppers are turned off.
* The fan turns on automatically whenever any driver is enabled and turns
* off (or reduces to idle speed) shortly after drivers are turned off.
*
*/
//#define USE_CONTROLLER_FAN
#if ENABLED(USE_CONTROLLER_FAN)
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
#define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled
#define CONTROLLERFAN_SPEED 255 // 255 == full speed
//#define CONTROLLERFAN_SPEED_Z_ONLY 127 // Reduce noise on machines that keep Z enabled
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
#define CONTROLLERFAN_SPEED_MIN 0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
#define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
#define CONTROLLERFAN_SPEED_IDLE 0 // (0-255) Idle speed, used when motors are disabled
#define CONTROLLERFAN_IDLE_TIME 60 // (seconds) Extra time to keep the fan running after disabling motors
//#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings
#if ENABLED(CONTROLLER_FAN_EDITABLE)
#define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu
#endif
#endif

// When first starting the main fan, run it at full speed for the
Expand Down
2 changes: 2 additions & 0 deletions Marlin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1147)
else ifeq ($(HARDWARE_MOTHERBOARD),1148)
# MKS GEN L V2
else ifeq ($(HARDWARE_MOTHERBOARD),1149)
# Copymaster 3D
else ifeq ($(HARDWARE_MOTHERBOARD),1150)

#
# RAMBo and derivatives
Expand Down
5 changes: 2 additions & 3 deletions Marlin/src/HAL/DUE/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <stdint.h>

// Define MYSERIAL0/1 before MarlinSerial includes!
#if SERIAL_PORT == -1
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL0 customizedSerial1
#elif SERIAL_PORT == 0
#define MYSERIAL0 Serial
Expand All @@ -56,7 +56,7 @@
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == SERIAL_PORT
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
#elif SERIAL_PORT_2 == -1
#elif SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL1 customizedSerial2
#elif SERIAL_PORT_2 == 0
#define MYSERIAL1 Serial
Expand Down Expand Up @@ -94,7 +94,6 @@
#endif
#endif


#include "MarlinSerial.h"
#include "MarlinSerialUSB.h"

Expand Down
20 changes: 5 additions & 15 deletions Marlin/src/HAL/DUE/MarlinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,23 +629,13 @@ void MarlinSerial<Cfg>::printFloat(double number, uint8_t digits) {

// If not using the USB port as serial port
#if SERIAL_PORT >= 0

// Preinstantiate
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>;

// Instantiate
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;

template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>; // Define
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1; // Instantiate
#endif

#ifdef SERIAL_PORT_2

// Preinstantiate
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>;

// Instantiate
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;

#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>; // Define
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2; // Instantiate
#endif

#endif // ARDUINO_ARCH_SAM
8 changes: 2 additions & 6 deletions Marlin/src/HAL/DUE/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,9 @@ struct MarlinSerialCfg {
};

#if SERIAL_PORT >= 0

extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
#endif

#endif // SERIAL_PORT >= 0

#ifdef SERIAL_PORT_2

#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;

#endif
12 changes: 8 additions & 4 deletions Marlin/src/HAL/DUE/MarlinSerialUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "../../inc/MarlinConfig.h"

#if SERIAL_PORT == -1
#if HAS_USB_SERIAL

#include "MarlinSerialUSB.h"

Expand Down Expand Up @@ -283,8 +283,12 @@ void MarlinSerialUSB::printFloat(double number, uint8_t digits) {
}

// Preinstantiate
MarlinSerialUSB customizedSerial1;

#endif // SERIAL_PORT == -1
#if SERIAL_PORT == -1
MarlinSerialUSB customizedSerial1;
#endif
#if SERIAL_PORT_2 == -1
MarlinSerialUSB customizedSerial2;
#endif

#endif // HAS_USB_SERIAL
#endif // ARDUINO_ARCH_SAM
12 changes: 9 additions & 3 deletions Marlin/src/HAL/DUE/MarlinSerialUSB.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "../../inc/MarlinConfig.h"

#if SERIAL_PORT == -1
#if HAS_USB_SERIAL

#include <WString.h>

Expand Down Expand Up @@ -88,6 +88,12 @@ class MarlinSerialUSB {
static void printFloat(double, uint8_t);
};

extern MarlinSerialUSB customizedSerial1;
#if SERIAL_PORT == -1
extern MarlinSerialUSB customizedSerial1;
#endif

#if SERIAL_PORT_2 == -1
extern MarlinSerialUSB customizedSerial2;
#endif

#endif // SERIAL_PORT == -1
#endif // HAS_USB_SERIAL
4 changes: 1 addition & 3 deletions Marlin/src/HAL/LPC1768/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
return ind > -1 ? ind : dval;
}

void flashFirmware(int16_t value) {
NVIC_SystemReset();
}
void flashFirmware(const int16_t) { NVIC_SystemReset(); }

void HAL_clear_reset_source(void) {
#if ENABLED(USE_WATCHDOG)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
void HAL_idletask();

#define PLATFORM_M997_SUPPORT
void flashFirmware(int16_t value);
void flashFirmware(const int16_t);

/**
* set_pwm_frequency
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRe

uint16_t HAL_adc_get_result() { return HAL_adc_result; }

void flashFirmware(int16_t) { NVIC_SystemReset(); }
void flashFirmware(const int16_t) { NVIC_SystemReset(); }

#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@ uint16_t HAL_adc_get_result();
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)

#define PLATFORM_M997_SUPPORT
void flashFirmware(int16_t value);
void flashFirmware(const int16_t);
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,6 @@ void analogWrite(pin_t pin, int pwm_val8) {
analogWrite(uint8_t(pin), pwm_val8);
}

void flashFirmware(int16_t value) { nvic_sys_reset(); }
void flashFirmware(const int16_t) { nvic_sys_reset(); }

#endif // __STM32F1__
3 changes: 2 additions & 1 deletion Marlin/src/HAL/STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ void HAL_idletask();

#ifndef digitalPinHasPWM
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != nullptr)
#define NO_COMPILE_TIME_PWM
#endif

#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); (void)__iCliRetVal()
Expand Down Expand Up @@ -287,4 +288,4 @@ void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!?
#define JTAGSWD_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE)

#define PLATFORM_M997_SUPPORT
void flashFirmware(int16_t value);
void flashFirmware(const int16_t);
10 changes: 5 additions & 5 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
#endif

#if ENABLED(USE_CONTROLLER_FAN)
controllerfan_update(); // Check if fan should be turned on to cool stepper drivers down
controllerFan.update(); // Check if fan should be turned on to cool stepper drivers down
#endif

#if ENABLED(AUTO_POWER_CONTROL)
Expand Down Expand Up @@ -984,6 +984,10 @@ void setup() {
SETUP_RUN(leds.setup());
#endif

#if ENABLED(USE_CONTROLLER_FAN) // Set up fan controller to initialize also the default configurations.
SETUP_RUN(controllerFan.setup());
#endif

SETUP_RUN(ui.init());
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)

Expand Down Expand Up @@ -1047,10 +1051,6 @@ void setup() {
SETUP_RUN(endstops.enable_z_probe(false));
#endif

#if ENABLED(USE_CONTROLLER_FAN)
SET_OUTPUT(CONTROLLER_FAN_PIN);
#endif

#if HAS_STEPPER_RESET
SETUP_RUN(enableStepperDrivers());
#endif
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 @@ -103,6 +103,7 @@
#define BOARD_HJC2560C_REV2 1147 // ADIMLab Gantry v2
#define BOARD_TANGO 1148 // BIQU Tango V1
#define BOARD_MKS_GEN_L_V2 1149 // MKS GEN L V2
#define BOARD_COPYMASTER_3D 1150 // Copymaster 3D

//
// RAMBo and derivatives
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
*/
#pragma once

#if !defined(__has_include)
#define __has_include(...) 1
#endif

#define ABCE 4
#define XYZE 4
#define ABC 3
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@
* numbers for those locations should be 0.
*/
#ifdef VALIDATE_MESH_TILT
auto d_from = []() { DEBUG_ECHOPGM("D from "); };
auto d_from = []{ DEBUG_ECHOPGM("D from "); };
auto normed = [&](const xy_pos_t &pos, const float &zadd) {
return normal.x * pos.x + normal.y * pos.y + zadd;
};
Expand Down
Loading

0 comments on commit efc1926

Please sign in to comment.