Merge pull request #9769 from teemuatlut/bf2_compile_fixes
[2.0.x] Fix compiling with M600 and runout sensor
This commit is contained in:
commit
b17982bde9
3 changed files with 37 additions and 32 deletions
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
#include "../libs/buzzer.h"
|
#include "../libs/buzzer.h"
|
||||||
#include "../libs/nozzle.h"
|
#include "../libs/nozzle.h"
|
||||||
|
#include "pause.h"
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
|
|
||||||
|
|
|
@ -35,45 +35,45 @@
|
||||||
#include "../inc/MarlinConfig.h"
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
class FilamentRunoutSensor {
|
class FilamentRunoutSensor {
|
||||||
|
public:
|
||||||
|
FilamentRunoutSensor() {}
|
||||||
|
|
||||||
FilamentRunoutSensor() {}
|
static void setup();
|
||||||
|
|
||||||
static bool filament_ran_out;
|
FORCE_INLINE static void reset() { filament_ran_out = false; }
|
||||||
static void setup();
|
|
||||||
|
|
||||||
FORCE_INLINE static reset() { filament_ran_out = false; }
|
FORCE_INLINE static void run() {
|
||||||
|
if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
|
||||||
|
filament_ran_out = true;
|
||||||
|
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
||||||
|
stepper.synchronize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
static bool filament_ran_out;
|
||||||
|
|
||||||
FORCE_INLINE static bool check() {
|
FORCE_INLINE static bool check() {
|
||||||
#if NUM_RUNOUT_SENSORS < 2
|
#if NUM_RUNOUT_SENSORS < 2
|
||||||
// A single sensor applying to all extruders
|
// A single sensor applying to all extruders
|
||||||
return READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;
|
return READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;
|
||||||
#else
|
#else
|
||||||
// Read the sensor for the active extruder
|
// Read the sensor for the active extruder
|
||||||
switch (active_extruder) {
|
switch (active_extruder) {
|
||||||
case 0: return READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;
|
case 0: return READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;
|
||||||
case 1: return READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING;
|
case 1: return READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING;
|
||||||
#if NUM_RUNOUT_SENSORS > 2
|
#if NUM_RUNOUT_SENSORS > 2
|
||||||
case 2: return READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING;
|
case 2: return READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING;
|
||||||
#if NUM_RUNOUT_SENSORS > 3
|
#if NUM_RUNOUT_SENSORS > 3
|
||||||
case 3: return READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING;
|
case 3: return READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING;
|
||||||
#if NUM_RUNOUT_SENSORS > 4
|
#if NUM_RUNOUT_SENSORS > 4
|
||||||
case 4: return READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING;
|
case 4: return READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FORCE_INLINE static void run() {
|
|
||||||
if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
|
|
||||||
filament_ran_out = true;
|
|
||||||
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
|
||||||
stepper.synchronize();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FilamentRunoutSensor runout;
|
extern FilamentRunoutSensor runout;
|
||||||
|
|
|
@ -71,6 +71,10 @@
|
||||||
#include "../feature/fwretract.h"
|
#include "../feature/fwretract.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
|
#include "../feature/pause.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma pack(push, 1) // No padding between variables
|
#pragma pack(push, 1) // No padding between variables
|
||||||
|
|
||||||
typedef struct PID { float Kp, Ki, Kd; } PID;
|
typedef struct PID { float Kp, Ki, Kd; } PID;
|
||||||
|
|
Reference in a new issue