From b64157109872c696c328cc2b19bdfa314007a5e7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 20 Oct 2018 16:10:50 -0500 Subject: [PATCH] Replace types.h with millis_t.h --- Marlin/src/core/macros.h | 3 --- Marlin/src/core/{types.h => millis_t.h} | 21 ++------------------- Marlin/src/feature/fwretract.h | 19 +++++++++++++++++++ Marlin/src/feature/pause.h | 10 +++++++++- Marlin/src/feature/power.h | 8 ++------ Marlin/src/feature/power_loss_recovery.h | 2 +- Marlin/src/inc/MarlinConfigPre.h | 2 +- Marlin/src/libs/stopwatch.h | 2 +- Marlin/src/module/configuration_store.cpp | 9 ++------- 9 files changed, 37 insertions(+), 39 deletions(-) rename Marlin/src/core/{types.h => millis_t.h} (52%) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 3f4e99ebb3..294d6213ca 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -193,9 +193,6 @@ #define PIN_EXISTS(PN) (defined(PN ##_PIN) && PN ##_PIN >= 0) -#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) -#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) - #define MMM_TO_MMS(MM_M) ((MM_M)/60.0f) #define MMS_TO_MMM(MM_S) ((MM_S)*60.0f) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/millis_t.h similarity index 52% rename from Marlin/src/core/types.h rename to Marlin/src/core/millis_t.h index 7223087f11..97532374b5 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/millis_t.h @@ -22,25 +22,8 @@ #pragma once #include -#include typedef uint32_t millis_t; -#pragma pack(push, 1) // No padding between fields - -typedef struct { - float unload_length, load_length; -} fil_change_settings_t; - -typedef struct { - float retract_length, // M207 S - G10 Retract length - retract_feedrate_mm_s, // M207 F - G10 Retract feedrate - retract_zraise, // M207 Z - G10 Retract hop size - retract_recover_length, // M208 S - G11 Recover length - retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate - swap_retract_length, // M207 W - G10 Swap Retract length - swap_retract_recover_length, // M208 W - G11 Swap Recover length - swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate -} fwretract_settings_t; - -#pragma pack(pop) +#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) +#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) diff --git a/Marlin/src/feature/fwretract.h b/Marlin/src/feature/fwretract.h index bcc44cf83f..9da737465b 100644 --- a/Marlin/src/feature/fwretract.h +++ b/Marlin/src/feature/fwretract.h @@ -27,6 +27,23 @@ #include "../inc/MarlinConfigPre.h" +#pragma pack(push, 1) // No padding between fields + +typedef struct { + float retract_length, // M207 S - G10 Retract length + retract_feedrate_mm_s, // M207 F - G10 Retract feedrate + retract_zraise, // M207 Z - G10 Retract hop size + retract_recover_length, // M208 S - G11 Recover length + retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate + swap_retract_length, // M207 W - G10 Swap Retract length + swap_retract_recover_length, // M208 W - G11 Swap Recover length + swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate +} fwretract_settings_t; + +#pragma pack(pop) + +#if ENABLED(FWRETRACT) + class FWRetract { private: #if EXTRUDERS > 1 @@ -69,3 +86,5 @@ public: }; extern FWRetract fwretract; + +#endif // FWRETRACT diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 7c60bdecbb..d5c39846ab 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -26,10 +26,16 @@ * This may be combined with related G-codes if features are consolidated. */ -#include "../libs/nozzle.h" +typedef struct { + float unload_length, load_length; +} fil_change_settings_t; #include "../inc/MarlinConfigPre.h" +#if ENABLED(ADVANCED_PAUSE_FEATURE) + +#include "../libs/nozzle.h" + enum AdvancedPauseMode : char { ADVANCED_PAUSE_MODE_PAUSE_PRINT, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, @@ -86,3 +92,5 @@ bool load_filament(const float &slow_load_length=0, const float &fast_load_lengt const bool pause_for_user=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PARAMS); bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT); + +#endif //ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/feature/power.h b/Marlin/src/feature/power.h index 225e4dc6f3..101ccb4a52 100644 --- a/Marlin/src/feature/power.h +++ b/Marlin/src/feature/power.h @@ -19,15 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * power.h - power control */ -#ifndef POWER_H -#define POWER_H - -#include "../core/types.h" +#include "../core/millis_t.h" class Power { public: @@ -40,5 +38,3 @@ class Power { }; extern Power powerManager; - -#endif // POWER_H diff --git a/Marlin/src/feature/power_loss_recovery.h b/Marlin/src/feature/power_loss_recovery.h index 04b011be15..d173b87c54 100644 --- a/Marlin/src/feature/power_loss_recovery.h +++ b/Marlin/src/feature/power_loss_recovery.h @@ -28,7 +28,7 @@ #define _POWER_LOSS_RECOVERY_H_ #include "../sd/cardreader.h" -#include "../core/types.h" +#include "../core/millis_t.h" #include "../inc/MarlinConfigPre.h" #define SAVE_INFO_INTERVAL_MS 0 diff --git a/Marlin/src/inc/MarlinConfigPre.h b/Marlin/src/inc/MarlinConfigPre.h index ae36a1efcd..3bca46ed09 100644 --- a/Marlin/src/inc/MarlinConfigPre.h +++ b/Marlin/src/inc/MarlinConfigPre.h @@ -30,7 +30,7 @@ #include "../HAL/platforms.h" #include "../core/boards.h" #include "../core/macros.h" -#include "../core/types.h" +#include "../core/millis_t.h" #include "Version.h" #include "../../Configuration.h" #include "Conditionals_LCD.h" diff --git a/Marlin/src/libs/stopwatch.h b/Marlin/src/libs/stopwatch.h index 64099e7744..358f636ca2 100644 --- a/Marlin/src/libs/stopwatch.h +++ b/Marlin/src/libs/stopwatch.h @@ -27,7 +27,7 @@ //#define DEBUG_STOPWATCH #include "../core/macros.h" // for FORCE_INLINE -#include "../core/types.h" // for millis_t +#include "../core/millis_t.h" /** * @brief Stopwatch class diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index bb3e341cb1..16e30e41fe 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -81,13 +81,8 @@ #include "../module/probe.h" #endif -#if ENABLED(FWRETRACT) - #include "../feature/fwretract.h" -#endif - -#if ENABLED(ADVANCED_PAUSE_FEATURE) - #include "../feature/pause.h" -#endif +#include "../feature/fwretract.h" +#include "../feature/pause.h" #if EXTRUDERS > 1 #include "tool_change.h"