Skip to content

Commit ceae921

Browse files
author
Mrnt
authored
Prepare for marlin merge (#106)
* Make more like "Marlin style" code * Make build option more generic, remove redundant calls * Remove machine option added by accident
1 parent 8af5964 commit ceae921

File tree

4 files changed

+69
-73
lines changed

4 files changed

+69
-73
lines changed

Marlin/Marlin/Configuration.h

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/* you must be sure what you know what you do :) */
2525
#define FF_FLASHAIR_FIX
2626
#define FF_RUSSIAN_FIX
27-
#define FF_M907_PROTECTION
27+
#define M907_PROTECTION
2828

2929
/* Select one of the printers below */
3030
//#define FF_INVENTOR_MACHINE
@@ -37,22 +37,22 @@
3737
//#define FF_SILVER_PULLEY
3838

3939
#if NONE(FF_BLACK_PULLEY, FF_SILVER_PULLEY)
40-
#define FF_BLACK_PULLEY
40+
#define FF_BLACK_PULLEY
4141
#endif
4242

4343
/* Switch left and right extruder */
4444
//#define FF_EXTRUDER_SWAP
45-
#if NONE(FF_DREAMER_MACHINE, FF_INVENTOR_MACHINE) && ENABLED( FF_EXTRUDER_SWAP )
46-
#error FF_EXTRUDER_SWAP works only with dreamer and inventor
45+
#if NONE(FF_DREAMER_MACHINE, FF_INVENTOR_MACHINE) && ENABLED(FF_EXTRUDER_SWAP)
46+
#error FF_EXTRUDER_SWAP works only with Dreamer, Inventor
4747
#endif
4848

4949
/* Select UI type */
5050
//#define USE_OLD_MARLIN_UI
5151
//#define USE_MKS_UI
5252

5353
/* NX and 3D20 mostly same, but 3D20 does not have heated bed and chamber */
54-
#if ENABLED( FF_DREMEL_3D20_MACHINE )
55-
#define FF_DREAMER_NX_MACHINE
54+
#if ENABLED(FF_DREMEL_3D20_MACHINE)
55+
#define FF_DREAMER_NX_MACHINE
5656
#endif
5757

5858

@@ -178,7 +178,7 @@
178178
//#define BLUETOOTH
179179

180180
// Name displayed in the LCD "Ready" message and Info menu
181-
#if ENABLED( FF_DREMEL_3D20_MACHINE )
181+
#if ENABLED(FF_DREMEL_3D20_MACHINE)
182182
#define CUSTOM_MACHINE_NAME "Dremel"
183183
#else
184184
#define CUSTOM_MACHINE_NAME "FlashForge"
@@ -231,7 +231,7 @@
231231

232232
// This defines the number of extruders
233233
// :[0, 1, 2, 3, 4, 5, 6, 7, 8]
234-
#if ANY(FF_INVENTOR_MACHINE,FF_DREAMER_MACHINE)
234+
#if ANY(FF_INVENTOR_MACHINE, FF_DREAMER_MACHINE)
235235
#define EXTRUDERS 2
236236
#else
237237
#define EXTRUDERS 1
@@ -393,12 +393,12 @@
393393
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
394394
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
395395
// For the other hotends it is their distance from the extruder 0 hotend.
396-
#if ANY(FF_INVENTOR_MACHINE,FF_DREAMER_MACHINE)
397-
#if ENABLED(FF_EXTRUDER_SWAP)
398-
#define HOTEND_OFFSET_X { 0.0, 34.0 } // (mm) relative X-offset for each nozzle
399-
#else
400-
#define HOTEND_OFFSET_X { 0.0, -34.0 } // (mm) relative X-offset for each nozzle
401-
#endif
396+
#if ANY(FF_INVENTOR_MACHINE, FF_DREAMER_MACHINE)
397+
#if ENABLED(FF_EXTRUDER_SWAP)
398+
#define HOTEND_OFFSET_X { 0.0, 34.0 } // (mm) relative X-offset for each nozzle
399+
#else
400+
#define HOTEND_OFFSET_X { 0.0, -34.0 } // (mm) relative X-offset for each nozzle
401+
#endif
402402
#endif
403403

404404
//#define HOTEND_OFFSET_Y { 0.0, 5.00 } // (mm) relative Y-offset for each nozzle
@@ -546,13 +546,13 @@
546546
#define TEMP_SENSOR_5 0
547547
#define TEMP_SENSOR_6 0
548548
#define TEMP_SENSOR_7 0
549-
#if ENABLED( FF_DREMEL_3D20_MACHINE )
549+
#if ENABLED(FF_DREMEL_3D20_MACHINE)
550550
#define TEMP_SENSOR_BED 0
551551
#else
552552
#define TEMP_SENSOR_BED 1
553553
#endif
554554
#define TEMP_SENSOR_PROBE 0
555-
#if ENABLED( FF_DREMEL_3D20_MACHINE )
555+
#if ENABLED(FF_DREMEL_3D20_MACHINE)
556556
#define TEMP_SENSOR_CHAMBER 0
557557
#else
558558
#define TEMP_SENSOR_CHAMBER 1
@@ -650,8 +650,8 @@
650650
#if ENABLED(PIDTEMP)
651651
#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
652652
#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
653-
#if ( EXTRUDERS > 1 )
654-
#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
653+
#if (EXTRUDERS > 1)
654+
#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
655655
// Set/get with gcode: M301 E[extruder number, 0-2]
656656
#endif
657657

@@ -799,8 +799,8 @@
799799
*/
800800

801801
#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
802-
#if DISABLED( FF_DREMEL_3D20_MACHINE )
803-
#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
802+
#if DISABLED(FF_DREMEL_3D20_MACHINE)
803+
#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
804804
#endif
805805
//#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
806806
#define THERMAL_PROTECTION_COOLER // Enable thermal protection for the laser cooling
@@ -843,16 +843,16 @@
843843
// extra connectors. Leave undefined any used for non-endstop and non-probe purposes.
844844
//#define USE_XMIN_PLUG
845845
//#define USE_YMIN_PLUG
846-
#if ANY( FF_DREAMER_MACHINE, FF_DREAMER_NX_MACHINE )
847-
#define USE_ZMIN_PLUG
846+
#if ANY(FF_DREAMER_MACHINE, FF_DREAMER_NX_MACHINE)
847+
#define USE_ZMIN_PLUG
848848
#endif
849849
//#define USE_IMIN_PLUG
850850
//#define USE_JMIN_PLUG
851851
//#define USE_KMIN_PLUG
852852
#define USE_XMAX_PLUG
853853
#define USE_YMAX_PLUG
854854
#if ENABLED(FF_INVENTOR_MACHINE)
855-
#define USE_ZMAX_PLUG
855+
#define USE_ZMAX_PLUG
856856
#endif
857857
//#define USE_IMAX_PLUG
858858
//#define USE_JMAX_PLUG
@@ -1097,7 +1097,7 @@
10971097
* See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained
10981098
*/
10991099
#if DISABLED(LIN_ADVANCE)
1100-
#define S_CURVE_ACCELERATION
1100+
#define S_CURVE_ACCELERATION
11011101
#endif
11021102

11031103
//===========================================================================
@@ -1135,9 +1135,9 @@
11351135
* - normally-open switches to 5V and D32.
11361136
*/
11371137
#if ANY(FF_DREAMER_MACHINE, FF_DREAMER_NX_MACHINE)
1138-
#define Z_MIN_PROBE_PIN Z_MAX_PIN
1138+
#define Z_MIN_PROBE_PIN Z_MAX_PIN
11391139
#else
1140-
#define Z_MIN_PROBE_PIN Z_MIN_PIN /* Inventor */
1140+
#define Z_MIN_PROBE_PIN Z_MIN_PIN /* Inventor */
11411141
#endif
11421142

11431143
/**
@@ -1476,9 +1476,9 @@
14761476
#define X_HOME_DIR 1
14771477
#define Y_HOME_DIR 1
14781478
#if ENABLED(FF_INVENTOR_MACHINE)
1479-
#define Z_HOME_DIR 1
1479+
#define Z_HOME_DIR 1
14801480
#else
1481-
#define Z_HOME_DIR -1
1481+
#define Z_HOME_DIR -1
14821482
#endif
14831483
//#define I_HOME_DIR -1
14841484
//#define J_HOME_DIR -1
@@ -1490,37 +1490,37 @@
14901490
#define X_BED_SIZE 230
14911491
#define Y_BED_SIZE 150
14921492

1493-
#if ENABLED( FF_EXTRUDER_SWAP )
1494-
#define FF_TOOL_OFFSET 34
1493+
#if ENABLED(FF_EXTRUDER_SWAP)
1494+
#define FF_TOOL_OFFSET 34
14951495
#else
1496-
#define FF_TOOL_OFFSET 0
1496+
#define FF_TOOL_OFFSET 0
14971497
#endif
14981498

14991499
// Travel limits (mm) after homing, corresponding to endstop positions.
15001500
#if ENABLED(FF_INVENTOR_MACHINE)
1501-
#define X_MAX_POS (159.99-FF_TOOL_OFFSET)
1502-
#define Y_MAX_POS 75.00
1503-
#define X_MIN_POS (-110.00-FF_TOOL_OFFSET)
1504-
#define Y_MIN_POS -75.00
1501+
#define X_MAX_POS (159.99-FF_TOOL_OFFSET)
1502+
#define Y_MAX_POS 75.00
1503+
#define X_MIN_POS (-110.00-FF_TOOL_OFFSET)
1504+
#define Y_MIN_POS -75.00
15051505
#elif ENABLED(FF_DREAMER_MACHINE)
1506-
#define X_MAX_POS (156.99-FF_TOOL_OFFSET)
1507-
#define Y_MAX_POS 79.99
1508-
#define X_MIN_POS (-113.00-FF_TOOL_OFFSET)
1509-
#define Y_MIN_POS -79.99
1506+
#define X_MAX_POS (156.99-FF_TOOL_OFFSET)
1507+
#define Y_MAX_POS 79.99
1508+
#define X_MIN_POS (-113.00-FF_TOOL_OFFSET)
1509+
#define Y_MIN_POS -79.99
15101510
#elif ENABLED(FF_DREAMER_NX_MACHINE)
1511-
#define X_MAX_POS 158.50
1512-
#define Y_MAX_POS 76.23
1513-
#define X_MIN_POS -111.00
1514-
#define Y_MIN_POS -76.23
1511+
#define X_MAX_POS 158.50
1512+
#define Y_MAX_POS 76.23
1513+
#define X_MIN_POS -111.00
1514+
#define Y_MIN_POS -76.23
15151515
#else
1516-
#error Invalid printer model selection
1516+
#error Invalid printer model selection
15171517
#endif
15181518

15191519
#define Z_MIN_POS 0
15201520
#if ENABLED(FF_INVENTOR_MACHINE)
1521-
#define Z_MAX_POS 160
1521+
#define Z_MAX_POS 160
15221522
#else
1523-
#define Z_MAX_POS 140
1523+
#define Z_MAX_POS 140
15241524
#endif
15251525
//#define I_MIN_POS 0
15261526
//#define I_MAX_POS 50
@@ -1577,8 +1577,8 @@
15771577
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
15781578
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
15791579
*/
1580-
#if DISABLED( USE_MKS_UI )
1581-
#define FILAMENT_RUNOUT_SENSOR
1580+
#if DISABLED(USE_MKS_UI)
1581+
#define FILAMENT_RUNOUT_SENSOR
15821582
#endif
15831583
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
15841584
#define FIL_RUNOUT_ENABLED_DEFAULT false // Enable the sensor on startup. Override with M412 followed by M500.
@@ -1824,11 +1824,11 @@
18241824
#define LEVEL_BED_CORNERS
18251825

18261826
#if ENABLED(LEVEL_BED_CORNERS)
1827-
#if ANY(FF_DREAMER_MACHINE, FF_INVENTOR_MACHINE)
1828-
#define LEVEL_CORNERS_INSET_LFRB { 40, 30, 40, 30 } // (mm) Left, Front, Right, Back insets
1829-
#else
1830-
#define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
1831-
#endif
1827+
#if ANY(FF_DREAMER_MACHINE, FF_INVENTOR_MACHINE)
1828+
#define LEVEL_CORNERS_INSET_LFRB { 40, 30, 40, 30 } // (mm) Left, Front, Right, Back insets
1829+
#else
1830+
#define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
1831+
#endif
18321832
#define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points
18331833
#define LEVEL_CORNERS_Z_HOP 5.0 // (mm) Z height of nozzle between leveling points
18341834
#define LEVEL_CENTER_TOO // Move to the center after the last corner
@@ -2785,13 +2785,13 @@
27852785
// Usually paired with MKS Robin Nano V1.2
27862786
//
27872787
//#define MKS_ROBIN_TFT24
2788-
#if ENABLED( USE_OLD_MARLIN_UI )
2789-
#define TFT_CLASSIC_UI
2790-
#elif ENABLED( USE_MKS_UI )
2791-
#define TFT_LVGL_UI
2792-
#undef LCD_BED_LEVELING
2788+
#if ENABLED(USE_OLD_MARLIN_UI)
2789+
#define TFT_CLASSIC_UI
2790+
#elif ENABLED(USE_MKS_UI)
2791+
#define TFT_LVGL_UI
2792+
#undef LCD_BED_LEVELING
27932793
#else
2794-
#define TFT_COLOR_UI
2794+
#define TFT_COLOR_UI
27952795
#endif
27962796
#define TFT_GENERIC
27972797
#define TFT_INTERFACE_FSMC

Marlin/Marlin/src/core/boards.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@
410410
#define BOARD_MKS_EAGLE 4236 // MKS Eagle (STM32F407VET6)
411411
#define BOARD_ARTILLERY_RUBY 4237 // Artillery Ruby (STM32F401RCT6)
412412
#define BOARD_FYSETC_SPIDER_V2_2 4238 // FYSETC Spider V2.2 (STM32F446VET6)
413-
#define BOARD_FF_MOTHERBOARD 4250 // FlashForge board ( STM32F407ZG )
413+
#define BOARD_FF_MOTHERBOARD 4250 // FlashForge board (STM32F407ZG)
414414

415415
//
416416
// ARM Cortex M7

Marlin/Marlin/src/feature/digipot/digipot_mcp4018.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#include <Stream.h>
3030
#include <SlowSoftI2CMaster.h> // https://github.com/felias-fogg/SlowSoftI2CMaster
3131

32+
#if ENABLED(M907_PROTECTION)
33+
#include "../../MarlinCore.h"
34+
#endif
35+
3236
// Settings for the I2C based DIGIPOT (MCP4018) based on WT150
3337

3438
#ifndef DIGIPOT_A4988_Rsx
@@ -44,20 +48,13 @@
4448
#define DIGIPOT_A4988_FACTOR ((DIGIPOT_MCP4018_MAX_VALUE) / DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax))
4549
#define DIGIPOT_A4988_MAX_CURRENT 2.0
4650

47-
#if ENABLED( FF_M907_PROTECTION )
48-
#include "../../MarlinCore.h"
49-
#include "../../module/temperature.h"
50-
#endif
51-
5251
static byte current_to_wiper(const float current) {
5352
const int16_t value = TERN(DIGIPOT_USE_RAW_VALUES, current, CEIL(current * DIGIPOT_A4988_FACTOR));
5453

55-
#if ENABLED( FF_M907_PROTECTION )
54+
#if ENABLED(M907_PROTECTION)
5655
/* protect printer from old original FF firmware G-Codes */
5756
if( current > DIGIPOT_A4988_MAX_CURRENT ) {
58-
thermalManager.disable_all_heaters();
59-
watchdog_refresh();
60-
kill( F( "M907 overcurrent!" ), nullptr, true );
57+
kill(F("M907 overcurrent!"), nullptr, true );
6158
}
6259
#endif
6360
return byte(constrain(value, 0, DIGIPOT_MCP4018_MAX_VALUE));

Marlin/ini/stm32f4.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@ board_build.offset = 0x8000
4949
build_flags = ${stm32_variant.build_flags} -DSTM32F401xC
5050

5151
#
52-
# FlashForge Motherboard
52+
# FlashForge Motherboard (STM32F407ZGT6)
5353
#
5454
[env:FF_F407ZG]
55-
platform = ${common_stm32.platform}
56-
extends = common_stm32
55+
extends = stm32_variant
5756
board = FF407ZG
58-
build_flags = ${common_stm32.build_flags} -DHAL_SRAM_MODULE_ENABLED -DKTHERM_WITH_BINARY_SEARCH -DVECT_TAB_OFFSET=0x10000
57+
build_flags = ${stm32_variant.build_flags} -DHAL_SRAM_MODULE_ENABLED -DKTHERM_WITH_BINARY_SEARCH -DVECT_TAB_OFFSET=0x10000
5958
extra_scripts = ${common.extra_scripts}
6059
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
6160

0 commit comments

Comments
 (0)