diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h
index 25c5aca636b4c067682f1e2102bf86982dd5cb13..af3f517c86926cdc38b20ce45807b57ad2d62474 100644
--- a/Marlin/Marlin.h
+++ b/Marlin/Marlin.h
@@ -186,6 +186,8 @@ extern float add_homeing[3];
extern float min_pos[3];
extern float max_pos[3];
extern int fanSpeed;
+extern int ValvePressure;
+extern int EtoPPressure;
#ifdef FWRETRACT
extern bool autoretract_enabled;
diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 9f2ba7be17cc79d62b0099ae824f543a087a0c28..3d966bf1d7fd46efe674ce3fafa45c311f6da585 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -101,6 +101,10 @@
// M115 - Capabilities string
// M117 - display message
// M119 - Output Endstop status to serial port
+// M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
+// M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil)
+// M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
+// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
// M140 - Set bed target temp
// M190 - Wait for bed current temp to reach target temp.
// M200 - Set filament diameter
@@ -168,6 +172,8 @@ float extruder_offset[2][EXTRUDERS] = {
#endif
uint8_t active_extruder = 0;
int fanSpeed=0;
+int ValvePressure=0;
+int EtoPPressure=0;
#ifdef FWRETRACT
bool autoretract_enabled=true;
@@ -1169,6 +1175,37 @@ void process_commands()
break;
#endif //FAN_PIN
+ // PWM for HEATER_1_PIN
+ #if HEATER_1_PIN > -1
+ case 126: //M126 valve open
+ if (code_seen('S')){
+ ValvePressure=constrain(code_value(),0,255);
+ }
+ else {
+ ValvePressure=255;
+ }
+ break;
+ case 127: //M127 valve closed
+ ValvePressure = 0;
+ break;
+ #endif //HEATER_1_PIN
+
+ // PWM for HEATER_2_PIN
+ #if HEATER_2_PIN > -1
+ case 128: //M128 valve open
+ if (code_seen('S')){
+ EtoPPressure=constrain(code_value(),0,255);
+ }
+ else {
+ EtoPPressure=255;
+ }
+ break;
+ case 129: //M129 valve closed
+ EtoPPressure = 0;
+ break;
+ #endif //HEATER_2_PIN
+
+
#if (PS_ON_PIN > -1)
case 80: // M80 - ATX Power On
SET_OUTPUT(PS_ON_PIN); //GND
diff --git a/Marlin/pins.h b/Marlin/pins.h
index 952fa7a9a3ef691aec9947a18f2ced6f96a65435..ac25dea4cf5f8e144bf1b2b9626fef07aa72573f 100644
--- a/Marlin/pins.h
+++ b/Marlin/pins.h
@@ -1474,7 +1474,7 @@
#define HEATER_1_PIN 7
#define TEMP_1_PIN 1
-#define HEATER_2_PIN -1
+#define HEATER_2_PIN 6
#define TEMP_2_PIN -1
#define E0_STEP_PIN 34
diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp
index 854fd19eec58f6c4b66ddd8a72bb71657f26f54a..f7473c602380de7648e5d2149e604ca64b23aa5b 100644
--- a/Marlin/planner.cpp
+++ b/Marlin/planner.cpp
@@ -439,12 +439,18 @@ void check_axes_activity()
unsigned char z_active = 0;
unsigned char e_active = 0;
unsigned char tail_fan_speed = fanSpeed;
+ unsigned char valve_pressure = 0;
+ unsigned char e_to_p_pressure = 0;
+ unsigned char tail_valve_pressure = 0;
+ unsigned char tail_e_to_p_pressure = 0;
block_t *block;
if(block_buffer_tail != block_buffer_head)
{
uint8_t block_index = block_buffer_tail;
tail_fan_speed = block_buffer[block_index].fan_speed;
+ tail_valve_pressure = block_buffer[block_index].valve_pressure;
+ tail_e_to_p_pressure = block_buffer[block_index].e_to_p_pressure;
while(block_index != block_buffer_head)
{
block = &block_buffer[block_index];
@@ -486,6 +492,17 @@ void check_axes_activity()
#ifdef AUTOTEMP
getHighESpeed();
#endif
+
+#if HEATER_1_PIN > -1
+ if (ValvePressure != 0){
+ analogWrite(HEATER_1_PIN,ValvePressure); // If buffer is empty use current fan speed
+ }
+#endif
+#if HEATER_2_PIN > -1
+ if (EtoPPressure != 0){
+ analogWrite(HEATER_2_PIN,EtoPPressure); // If buffer is empty use current fan speed
+ }
+#endif
}
@@ -559,6 +576,8 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
}
block->fan_speed = fanSpeed;
+ block->valve_pressure = ValvePressure;
+ block->e_to_p_pressure = EtoPPressure;
// Compute direction bits for this block
block->direction_bits = 0;
diff --git a/Marlin/planner.h b/Marlin/planner.h
index 9a904e5776f17036dddb9dd241d3b576acd4c419..4af72a475e378a10e90e6e597ced934134e5e5d7 100644
--- a/Marlin/planner.h
+++ b/Marlin/planner.h
@@ -60,6 +60,8 @@ typedef struct {
unsigned long final_rate; // The minimal rate at exit
unsigned long acceleration_st; // acceleration steps/sec^2
unsigned long fan_speed;
+ unsigned long valve_pressure;
+ unsigned long e_to_p_pressure;
volatile char busy;
} block_t;