Skip to content

Commit

Permalink
Merge branch '2.0.x' into FrankenFelix
Browse files Browse the repository at this point in the history
* 2.0.x:
  ♻️ Refactor STM32 ini files (MarlinFirmware#22377)
  ✨ Chitu3D V9 board (MarlinFirmware#22401)
  🐛 Fix Longer3D build environment (MarlinFirmware#22378)
  🔨 More HAL/STM32 targets (MarlinFirmware#22358, MarlinFirmware#22369)
  🐛 Fix STATUS_COMBINE_HEATERS compile (MarlinFirmware#22405)
  🐛 Fix Ammeter display on DOGM (MarlinFirmware#22384)
  🎨 Prefer DELAY_NS over DELAY_CYCLES (MarlinFirmware#22382)
  🎨 Add MMU2 enabled() accessor
  🐛 Fix G2/G3 angular motion calculation (MarlinFirmware#22407)
  🩹 Init var to suppress invalid warning (MarlinFirmware#22396)
  🐛 Ensure Software SPI pins for Max Thermocouple (MarlinFirmware#22389)
  🐛 Change font for selected language (MarlinFirmware#22381)
  🐛 Fix UBL G29 J - Vector3 regression
  🐛 Fix BTC_SAMPLE_RES sanity check (MarlinFirmware#22394)
  🎨 Fix unused lambda warning (MarlinFirmware#22399)
  🐛 Fix MKS UI compile (MarlinFirmware#22388, MarlinFirmware#22395)
  🐛 Fix M913 typos (MarlinFirmware#22385)
  • Loading branch information
madeinoz67 committed Jul 25, 2021
2 parents eb68419 + 7773504 commit 9dfed28
Show file tree
Hide file tree
Showing 79 changed files with 2,061 additions and 1,845 deletions.
8 changes: 4 additions & 4 deletions Marlin/src/HAL/DUE/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
}

// all the others
static uint32_t spiDelayCyclesX4 = 4 * (F_CPU) / 1000000; // 4µs => 125khz
static uint16_t spiDelayNS = 4000; // 4000ns => 125khz

static uint8_t spiTransferX(uint8_t b) { // using Mode 0
int bits = 8;
Expand All @@ -249,12 +249,12 @@
b <<= 1; // little setup time

WRITE(SD_SCK_PIN, HIGH);
DELAY_CYCLES(spiDelayCyclesX4);
DELAY_NS(spiDelayNS);

b |= (READ(SD_MISO_PIN) != 0);

WRITE(SD_SCK_PIN, LOW);
DELAY_CYCLES(spiDelayCyclesX4);
DELAY_NS(spiDelayNS);
} while (--bits);
return b;
}
Expand Down Expand Up @@ -510,7 +510,7 @@
spiRxBlock = (pfnSpiRxBlock)spiRxBlockX;
break;
default:
spiDelayCyclesX4 = ((F_CPU) / 1000000) >> (6 - spiRate) << 2; // spiRate of 2 gives the maximum error with current CPU
spiDelayNS = 4000 >> (6 - spiRate); // spiRate of 2 gives the maximum error with current CPU
spiTransferTx = (pfnSpiTransfer)spiTransferX;
spiTransferRx = (pfnSpiTransfer)spiTransferX;
spiTxBlock = (pfnSpiTxBlock)spiTxBlockX;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#if HAS_TFT_LVGL_UI
#include "lcd/extui/mks_ui/tft_lvgl_configuration.h"
#include "lcd/extui/mks_ui/draw_ui.h"
#include "lcd/extui/mks_ui/mks_hardware_test.h"
#include "lcd/extui/mks_ui/mks_hardware.h"
#include <lvgl.h>
#endif

Expand Down
25 changes: 13 additions & 12 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,19 @@
#define BOARD_CCROBOT_MEEB_3DP 4035 // ccrobot-online.com MEEB_3DP (STM32F103RC)
#define BOARD_CHITU3D_V5 4036 // Chitu3D TronXY X5SA V5 Board
#define BOARD_CHITU3D_V6 4037 // Chitu3D TronXY X5SA V6 Board
#define BOARD_CREALITY_V4 4038 // Creality v4.x (STM32F103RE)
#define BOARD_CREALITY_V427 4039 // Creality v4.2.7 (STM32F103RE)
#define BOARD_CREALITY_V4210 4040 // Creality v4.2.10 (STM32F103RE) as found in the CR-30
#define BOARD_CREALITY_V431 4041 // Creality v4.3.1 (STM32F103RE)
#define BOARD_CREALITY_V452 4042 // Creality v4.5.2 (STM32F103RE)
#define BOARD_CREALITY_V453 4043 // Creality v4.5.3 (STM32F103RE)
#define BOARD_TRIGORILLA_PRO 4044 // Trigorilla Pro (STM32F103ZET6)
#define BOARD_FLY_MINI 4045 // FLYmaker FLY MINI (STM32F103RCT6)
#define BOARD_FLSUN_HISPEED 4046 // FLSUN HiSpeedV1 (STM32F103VET6)
#define BOARD_BEAST 4047 // STM32F103RET6 Libmaple-based controller
#define BOARD_MINGDA_MPX_ARM_MINI 4048 // STM32F103ZET6 Mingda MD-16
#define BOARD_GTM32_PRO_VD 4049 // STM32F103VET6 controller
#define BOARD_CHITU3D_V9 4038 // Chitu3D TronXY X5SA V9 Board
#define BOARD_CREALITY_V4 4039 // Creality v4.x (STM32F103RE)
#define BOARD_CREALITY_V427 4040 // Creality v4.2.7 (STM32F103RE)
#define BOARD_CREALITY_V4210 4041 // Creality v4.2.10 (STM32F103RE) as found in the CR-30
#define BOARD_CREALITY_V431 4042 // Creality v4.3.1 (STM32F103RE)
#define BOARD_CREALITY_V452 4043 // Creality v4.5.2 (STM32F103RE)
#define BOARD_CREALITY_V453 4044 // Creality v4.5.3 (STM32F103RE)
#define BOARD_TRIGORILLA_PRO 4045 // Trigorilla Pro (STM32F103ZET6)
#define BOARD_FLY_MINI 4046 // FLYmaker FLY MINI (STM32F103RCT6)
#define BOARD_FLSUN_HISPEED 4047 // FLSUN HiSpeedV1 (STM32F103VET6)
#define BOARD_BEAST 4048 // STM32F103RET6 Libmaple-based controller
#define BOARD_MINGDA_MPX_ARM_MINI 4049 // STM32F103ZET6 Mingda MD-16
#define BOARD_GTM32_PRO_VD 4050 // STM32F103VET6 controller

//
// ARM Cortex-M4F
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/core/multi_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,12 @@ typedef const char Language_Str[];
#ifndef LCD_LANGUAGE_2
#define LCD_LANGUAGE_2 LCD_LANGUAGE
#endif

#ifndef LCD_LANGUAGE_3
#define LCD_LANGUAGE_3 LCD_LANGUAGE_2
#endif

#ifndef LCD_LANGUAGE_4
#define LCD_LANGUAGE_4 LCD_LANGUAGE_3
#endif

#ifndef LCD_LANGUAGE_5
#define LCD_LANGUAGE_5 LCD_LANGUAGE_4
#endif
Expand Down
28 changes: 14 additions & 14 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ MMU2 mmu2;
#define MMU2_NO_TOOL 99
#define MMU_BAUD 115200

bool MMU2::enabled, MMU2::ready, MMU2::mmu_print_saved;
bool MMU2::_enabled, MMU2::ready, MMU2::mmu_print_saved;
#if HAS_PRUSA_MMU2S
bool MMU2::mmu2s_triggered;
#endif
Expand Down Expand Up @@ -219,7 +219,7 @@ void MMU2::mmu_loop() {

DEBUG_ECHOLNPAIR("MMU => ", finda, "\nMMU - ENABLED");

enabled = true;
_enabled = true;
state = 1;
TERN_(HAS_PRUSA_MMU2S, mmu2s_triggered = false);
}
Expand Down Expand Up @@ -480,7 +480,7 @@ static void mmu2_not_responding() {
*/
void MMU2::tool_change(const uint8_t index) {

if (!enabled) return;
if (!_enabled) return;

set_runout_valid(false);

Expand Down Expand Up @@ -512,7 +512,7 @@ static void mmu2_not_responding() {
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char *special) {
if (!enabled) return;
if (!_enabled) return;

set_runout_valid(false);

Expand Down Expand Up @@ -561,7 +561,7 @@ static void mmu2_not_responding() {
* Handle tool change
*/
void MMU2::tool_change(const uint8_t index) {
if (!enabled) return;
if (!_enabled) return;

set_runout_valid(false);

Expand Down Expand Up @@ -599,7 +599,7 @@ static void mmu2_not_responding() {
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char *special) {
if (!enabled) return;
if (!_enabled) return;

set_runout_valid(false);

Expand Down Expand Up @@ -665,7 +665,7 @@ static void mmu2_not_responding() {
* Handle tool change
*/
void MMU2::tool_change(const uint8_t index) {
if (!enabled) return;
if (!_enabled) return;

set_runout_valid(false);

Expand Down Expand Up @@ -693,7 +693,7 @@ static void mmu2_not_responding() {
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char *special) {
if (!enabled) return;
if (!_enabled) return;

set_runout_valid(false);

Expand Down Expand Up @@ -744,7 +744,7 @@ static void mmu2_not_responding() {
* Set next command
*/
void MMU2::command(const uint8_t mmu_cmd) {
if (!enabled) return;
if (!_enabled) return;
cmd = mmu_cmd;
ready = false;
}
Expand Down Expand Up @@ -833,7 +833,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
}

void MMU2::set_filament_type(const uint8_t index, const uint8_t filamentType) {
if (!enabled) return;
if (!_enabled) return;

cmd_arg = filamentType;
command(MMU_CMD_F0 + index);
Expand Down Expand Up @@ -892,7 +892,7 @@ void MMU2::filament_runout() {

// Load filament into MMU2
void MMU2::load_filament(const uint8_t index) {
if (!enabled) return;
if (!_enabled) return;

command(MMU_CMD_L0 + index);
manage_response(false, false);
Expand All @@ -904,7 +904,7 @@ void MMU2::load_filament(const uint8_t index) {
*/
bool MMU2::load_filament_to_nozzle(const uint8_t index) {

if (!enabled) return false;
if (!_enabled) return false;

if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
Expand Down Expand Up @@ -940,7 +940,7 @@ void MMU2::load_to_nozzle() {

bool MMU2::eject_filament(const uint8_t index, const bool recover) {

if (!enabled) return false;
if (!_enabled) return false;

if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
Expand Down Expand Up @@ -989,7 +989,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
*/
bool MMU2::unload() {

if (!enabled) return false;
if (!_enabled) return false;

if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/feature/mmu/mmu2.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MMU2 {

static void init();
static void reset();
static inline bool enabled() { return _enabled; }
static void mmu_loop();
static void tool_change(const uint8_t index);
static void tool_change(const char *special);
Expand Down Expand Up @@ -88,7 +89,7 @@ class MMU2 {
static void mmu_continue_loading();
#endif

static bool enabled, ready, mmu_print_saved;
static bool _enabled, ready, mmu_print_saved;

static uint8_t cmd, cmd_arg, last_cmd, extruder;
static int8_t state;
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/gcode/bedlevel/mbl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ void GcodeSuite::G29() {
return;
}

int8_t ix, iy = 0;
int8_t ix, iy;
ix = iy = 0;

switch (state) {
case MeshReport:
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/gcode/feature/trinamic/M911-M914.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@
#endif

case Z_AXIS:
TERN_(Z_HAS_STEALTCHOP, if (index < 2) TMC_SET_PWMTHRS(Z,Z));
TERN_(Z2_HAS_STEALTCHOP, if (index == 0 || index == 2) TMC_SET_PWMTHRS(Z,Z2));
TERN_(Z3_HAS_STEALTCHOP, if (index == 0 || index == 3) TMC_SET_PWMTHRS(Z,Z3));
TERN_(Z4_HAS_STEALTCHOP, if (index == 0 || index == 4) TMC_SET_PWMTHRS(Z,Z4));
TERN_(Z_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(Z,Z));
TERN_(Z2_HAS_STEALTHCHOP, if (index == 0 || index == 2) TMC_SET_PWMTHRS(Z,Z2));
TERN_(Z3_HAS_STEALTHCHOP, if (index == 0 || index == 3) TMC_SET_PWMTHRS(Z,Z3));
TERN_(Z4_HAS_STEALTHCHOP, if (index == 0 || index == 4) TMC_SET_PWMTHRS(Z,Z4));
break;
#if E_STEPPERS
case E_AXIS: {
Expand Down
15 changes: 9 additions & 6 deletions Marlin/src/gcode/motion/G2_G3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@ void plan_arc(
#endif

// Angle of rotation between position and target from the circle center.
float angular_travel;
float angular_travel, abs_angular_travel;

// Do a full circle if starting and ending positions are "identical"
if (NEAR(current_position[p_axis], cart[p_axis]) && NEAR(current_position[q_axis], cart[q_axis])) {
// Preserve direction for circles
angular_travel = clockwise ? -RADIANS(360) : RADIANS(360);
abs_angular_travel = RADIANS(360);
}
else {
// Calculate the angle
Expand All @@ -103,8 +104,10 @@ void plan_arc(
case 2: angular_travel += RADIANS(360); break; // Negative but CCW? Reverse direction.
}

abs_angular_travel = ABS(angular_travel);

#ifdef MIN_ARC_SEGMENTS
min_segments = CEIL(min_segments * ABS(angular_travel) / RADIANS(360));
min_segments = CEIL(min_segments * abs_angular_travel / RADIANS(360));
NOLESS(min_segments, 1U);
#endif
}
Expand All @@ -117,8 +120,8 @@ void plan_arc(
#endif

// If circling around...
if (ENABLED(ARC_P_CIRCLES) && circles) {
const float total_angular = angular_travel + circles * RADIANS(360), // Total rotation with all circles and remainder
if (TERN0(ARC_P_CIRCLES, circles)) {
const float total_angular = abs_angular_travel + circles * RADIANS(360), // Total rotation with all circles and remainder
part_per_circle = RADIANS(360) / total_angular; // Each circle's part of the total

#if HAS_Z_AXIS
Expand All @@ -138,8 +141,8 @@ void plan_arc(
TERN_(HAS_EXTRUDERS, extruder_travel = cart.e - current_position.e);
}

const float flat_mm = radius * angular_travel,
mm_of_travel = TERN_(HAS_Z_AXIS, linear_travel ? HYPOT(flat_mm, linear_travel) :) ABS(flat_mm);
const float flat_mm = radius * abs_angular_travel,
mm_of_travel = TERN_(HAS_Z_AXIS, linear_travel ? HYPOT(flat_mm, linear_travel) :) flat_mm;
if (mm_of_travel < 0.001f) return;

const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
static_assert(_test_btc_sample_start != 12.3f, "BTC_SAMPLE_START must be a whole number.");
#endif
#ifdef BTC_SAMPLE_RES
constexpr _btc_sample_res = BTC_SAMPLE_RES;
constexpr auto _btc_sample_res = BTC_SAMPLE_RES;
constexpr decltype(_btc_sample_res) _test_btc_sample_res = 12.3f;
static_assert(_test_btc_sample_res != 12.3f, "BTC_SAMPLE_RES must be a whole number.");
#endif
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/dogm/dogm_Statusscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@
#define STATUS_AMMETER_X (LCD_PIXEL_WIDTH - (STATUS_AMMETER_BYTEWIDTH + STATUS_FLOWMETER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH + STATUS_CUTTER_BYTEWIDTH + STATUS_COOLER_BYTEWIDTH) * 8)
#endif
#ifndef STATUS_AMMETER_HEIGHT
#define STATUS_AMMETER_HEIGHT(S) (sizeof(status_ammeter_bmp1) / (STATUS_AMMETER_BYTEWIDTH))
#define STATUS_AMMETER_HEIGHT(S) (sizeof(status_ammeter_bmp_mA) / (STATUS_AMMETER_BYTEWIDTH))
#endif
#ifndef STATUS_AMMETER_Y
#define STATUS_AMMETER_Y(S) (18 - STATUS_AMMETER_HEIGHT(S))
Expand All @@ -633,8 +633,8 @@
#define STATUS_AMMETER_TEXT_X (STATUS_AMMETER_X + 7)
#endif
static_assert(
sizeof(status_ammeter_bmp1) == (STATUS_AMMETER_BYTEWIDTH) * STATUS_AMMETER_HEIGHT(0),
"Status ammeter bitmap (status_ammeter_bmp1) dimensions don't match data."
sizeof(status_ammeter_bmp_mA) == (STATUS_AMMETER_BYTEWIDTH) * STATUS_AMMETER_HEIGHT(0),
"Status ammeter bitmap (status_ammeter_bmp_mA) dimensions don't match data."
);
#endif

Expand Down
23 changes: 23 additions & 0 deletions Marlin/src/lcd/dogm/fontdata/langdata.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#pragma once

#include <U8glib-HAL.h>

#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
7 changes: 4 additions & 3 deletions Marlin/src/lcd/dogm/fontdata/langdata_an.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Contents will be REPLACED by future processing!
* Use genallfont.sh to generate font data for updated languages.
*/
#include <U8glib-HAL.h>
#pragma once

#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {};
#include "langdata.h"

static const uxg_fontinfo_t g_fontinfo_an[] PROGMEM = {};
Loading

0 comments on commit 9dfed28

Please sign in to comment.