Commit aa1b69a7 authored by Franco (nextime) Lanza's avatar Franco (nextime) Lanza

Merge remote-tracking branch 'upstream/dev' into dev

parents 2f99cb36 46ac851b
Pipeline #50 skipped
......@@ -8,10 +8,10 @@
* G3 - CCW ARC
* G4 - Dwell S[seconds] or P[milliseconds], delay in Second or Millisecond
* G5 - Bezier curve - from http://forums.reprap.org/read.php?147,93577
* G7 - execute raster (base64) line (LASER)
* G7 - Laser raster base64
* G10 - retract filament according to settings of M207
* G11 - retract recover filament according to settings of M208
* G28 - X0 Y0 Z0 Home all Axis. G28 M for bed manual setting with LCD.
* G28 - X Y Z Home all Axis. M for bed manual setting with LCD. B return to back point
* G29 - Detailed Z-Probe, probes the bed at 3 points or grid. You must be at the home position for this to work correctly.
G29 Fyyy Lxxx Rxxx Byyy for customer grid.
* G30 - Single Z Probe, probes bed at current XY location. Bed Probe and Delta geometry Autocalibration G30 A
......@@ -47,7 +47,8 @@
* M32 - Make directory
* M35 - Upload Firmware to Nextion from SD
* M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
* M49 - Z probe repetability test
* M48 - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
* M70 - Power consumption sensor calibration
* M80 - Turn on Power Supply
* M81 - Turn off Power, including Power Supply, if possible
* M82 - Set E codes absolute (default)
......@@ -60,34 +61,40 @@
* M98 - Print Hysteresis value
* M99 - Set Hysteresis parameter M99 X<in mm> Y<in mm> Z<in mm> E<in mm>
* M100 - Watch Free Memory (For Debugging Only)
* M104 - Set extruder target temp
* M104 - Set hotend target temp
* M105 - Read current temp
* M106 - Fan on
* M107 - Fan off
* M109 - S[xxx] Wait for extruder current temp to reach target temp. Waits only when heating
- R[xxx] Wait for extruder current temp to reach target temp. Waits when heating and cooling
* M111 - Debug Dryrun Repetier
* M109 - S[xxx] Wait for hotend current temp to reach target temp. Waits only when heating
- R[xxx] Wait for hotend current temp to reach target temp. Waits when heating and cooling
* M110 - Set the current line number
* M111 - Set debug flags with S<mask>.
* M112 - Emergency stop
* M114 - Output current position to serial port, (V)erbose for user
* M114 - Output current position to serial port
* M115 - Capabilities string
* M117 - display message
* M117 - Display a message on the controller screen
* M119 - Output Endstop status to serial port
* M120 - Disable Endstop
* M121 - Enable Endstop
* M120 - Enable endstop detection
* M121 - Disable endstop detection
* M122 - S<1=true/0=false> Enable or disable check software endstop
* 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 or cooler target temp
* M140 - Set hot bed target temp
* M141 - Set hot chamber target temp
* M142 - Set cooler target temp
* M145 - Set the heatup state H<hotend> B<bed> F<fan speed> for S<material> (0=PLA, 1=ABS)
* M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
* M163 - Set a single proportion for a mixing extruder. Requires COLOR_MIXING_EXTRUDER.
* M164 - Save the mix as a virtual extruder. Requires COLOR_MIXING_EXTRUDER and MIXING_VIRTUAL_TOOLS.
* M165 - Set the proportions for a mixing extruder. Use parameters ABCDHI to set the mixing factors. Requires COLOR_MIXING_EXTRUDER.
* M190 - S[xxx] Wait for bed or cooler current temp to reach target temp. Waits only when heating bed or cooling cooler
- R[xxx] Wait for bed or cooler current temp to reach target temp. Waits when heating and cooling
- C parameter select Cooler, omitting it selec bed.
* M190 - S[xxx] Wait for bed current temp to reach target temp. Waits only when heating
- R[xxx] Wait for bed current temp to reach target temp. Waits when heating and cooling
* M191 - Sxxx Wait for chamber current temp to reach target temp. Waits only when heating
* Rxxx Wait for chamber current temp to reach target temp. Waits when heating and cooling
* M192 - Sxxx Wait for cooler current temp to reach target temp. Waits only when heating
* Rxxx Wait for cooler current temp to reach target temp. Waits when heating and cooling
* M200 - D[millimeters]- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
* M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000 Z1000 E0 S1000 E1 S1000 E2 S1000 E3 S1000) in mm/sec^2
* M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E0 S1000 E1 S1000 E2 S1000 E3 S1000) in mm/sec
......@@ -107,7 +114,9 @@
* M301 - Set PID parameters P I and D
* M302 - Allow cold extrudes
* M303 - PID relay autotune S<temperature> sets the target temperature (default target temperature = 150C). H<hotend> C<cycles> U<Apply result>
* M304 - Set bed PID parameters P I and D or Water Cooling if C parameter
* M304 - Set hot bed PID parameters P I and D
* M305 - Set hot chamber PID parameters P I and D
* M306 - Set cooler PID parameters P I and D
* M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly.
* M400 - Finish all moves
......@@ -130,11 +139,10 @@
* M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
* M605 - Set dual x-carriage movement mode: Smode [ X<duplication x-offset> Rduplication temp offset ]
* M649 - laser set options
* M650 - mUVe peel set peel distance
* M651 - mUVe peel run peel move
* M666 - Set z probe offset or Endstop and delta geometry adjustment. M666 L for list command
* M906 - Set motor currents XYZ T0-4 E
* M907 - Set digital trimpot motor current using axis codes.
* M908 - Control digital trimpot directly.
* M928 - Start SD logging (M928 filename.g) - ended by M29
* M997 - NPR2 Color rotate
* M999 - Restart after being stopped by error
### Version 4.2.83
* Add Cooler and Hot Chamber
* Add Laser Beam PWM and raster base64 ONLY ARDUINO MEGA
### Version 4.2.82
* Add DONDOLO_DUAL_MOTOR for DONDOLO bowden and dual extruder
* Add reader TAG width MFRC522
......
......@@ -94,7 +94,10 @@
*
* PIDTEMPBED:
* M304 PID bedKp, bedKi, bedKd
* M304 L PID coolerKp, coolerKi, coolerKd
* PIDTEMPCHAMBER
* M305 PID chamberKp, chamberKi, chamberKd
* PIDTEMPCOOLER
* M306 PID coolerKp, coolerKi, coolerKd
*
* DOGLCD:
* M250 C lcd_contrast
......@@ -232,6 +235,12 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, bedKd);
#endif
#if ENABLED(PIDTEMPCHAMBER)
EEPROM_WRITE_VAR(i, chamberKp);
EEPROM_WRITE_VAR(i, chamberKi);
EEPROM_WRITE_VAR(i, chamberKd);
#endif
#if ENABLED(PIDTEMPCOOLER)
EEPROM_WRITE_VAR(i, coolerKp);
EEPROM_WRITE_VAR(i, coolerKi);
......@@ -387,13 +396,18 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, bedKd);
#endif
#if ENABLED(PIDTEMPCHAMBER)
EEPROM_READ_VAR(i, chamberKp);
EEPROM_READ_VAR(i, chamberKi);
EEPROM_READ_VAR(i, chamberKd);
#endif
#if ENABLED(PIDTEMPCOOLER)
EEPROM_READ_VAR(i, coolerKp);
EEPROM_READ_VAR(i, coolerKi);
EEPROM_READ_VAR(i, coolerKd);
#endif
#if HASNT(LCD_CONTRAST)
int lcd_contrast;
#endif
......@@ -588,13 +602,18 @@ void Config_ResetDefault() {
bedKd = scalePID_d(DEFAULT_bedKd);
#endif
#if ENABLED(PIDTEMPCHAMBER)
chamberKp = DEFAULT_chamberKp;
chamberKi = scalePID_i(DEFAULT_chamberKi);
chamberKd = scalePID_d(DEFAULT_chamberKd);
#endif
#if ENABLED(PIDTEMPCOOLER)
coolerKp = DEFAULT_coolerKp;
coolerKi = scalePID_i(DEFAULT_coolerKi);
coolerKd = scalePID_d(DEFAULT_coolerKd);
#endif
#if ENABLED(FWRETRACT)
autoretract_enabled = false;
retract_length = RETRACT_LENGTH;
......@@ -797,7 +816,7 @@ void Config_ResetDefault() {
ECHO_EM(" (Material GUM)");
#endif // ULTIPANEL
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) || ENABLED(PIDTEMPCOOLER)
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) || ENABLED(PIDTEMPCHAMBER) || ENABLED(PIDTEMPCOOLER)
if (!forReplay) {
ECHO_LM(CFG, "PID settings:");
}
......@@ -817,12 +836,17 @@ void Config_ResetDefault() {
#endif
#endif
#if ENABLED(PIDTEMPBED)
ECHO_SMV(CFG, " M304 P", bedKp); // for compatibility with hosts, only echos values for E0
ECHO_SMV(CFG, " M304 P", bedKp);
ECHO_MV(" I", unscalePID_i(bedKi));
ECHO_EMV(" D", unscalePID_d(bedKd));
#endif
#if ENABLED(PIDTEMPCHAMBER)
ECHO_SMV(CFG, " M305 P", chamberKp);
ECHO_MV(" I", unscalePID_i(chamberKi));
ECHO_EMV(" D", unscalePID_d(chamberKd));
#endif
#if ENABLED(PIDTEMPCOOLER)
ECHO_SMV(CFG, " M304 C P", coolerKp); // for compatibility with hosts, only echos values for E0
ECHO_SMV(CFG, " M306 P", coolerKp);
ECHO_MV(" I", unscalePID_i(coolerKi));
ECHO_EMV(" D", unscalePID_d(coolerKd));
#endif
......
......@@ -12,11 +12,11 @@
*
* 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
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
......@@ -38,12 +38,12 @@
* G1 - Coordinated Movement X Y Z E, for laser move by firing
* G2 - CW ARC
* G3 - CCW ARC
* G4 - Dwell S<seconds> or P<milliseconds>
* G4 - Dwell S[seconds] or P[milliseconds], delay in Second or Millisecond
* G5 - Bezier curve - from http://forums.reprap.org/read.php?147,93577
* G7 - Execute laser raster line
* G7 - Laser raster base64
* G10 - retract filament according to settings of M207
* G11 - retract recover filament according to settings of M208
* G28 - Home one or more axes
* G28 - X Y Z Home all Axis. M for bed manual setting with LCD. B return to back point
* G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
* G30 - Single Z Probe, probes bed at current XY location. - Bed Probe and Delta geometry Autocalibration
* G31 - Dock sled (Z_PROBE_SLED only)
......@@ -98,15 +98,15 @@
* M98 - Print Hysteresis value
* M99 - Set Hysteresis parameter M99 X<in mm> Y<in mm> Z<in mm> E<in mm>
* M100 - Watch Free Memory (For Debugging Only)
* M104 - Set extruder target temp
* M104 - Set hotend target temp
* M105 - Read current temp
* M106 - Fan on
* M107 - Fan off
* M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
* Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
* M109 - Sxxx Wait for hotend current temp to reach target temp. Waits only when heating
* Rxxx Wait for hotend current temp to reach target temp. Waits when heating and cooling
* IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
* M110 - Set the current line number
* M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
* M111 - Set debug flags with S<mask>.
* M112 - Emergency stop
* M114 - Output current position to serial port
* M115 - Capabilities string
......@@ -119,15 +119,20 @@
* 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 or cooler target temp
* M140 - Set hot bed target temp
* M141 - Set hot chamber target temp
* M142 - Set cooler target temp
* M145 - Set the heatup state H<hotend> B<bed> F<fan speed> for S<material> (0=PLA, 1=ABS)
* M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
* M163 - Set a single proportion for a mixing extruder. Requires COLOR_MIXING_EXTRUDER.
* M164 - Save the mix as a virtual extruder. Requires COLOR_MIXING_EXTRUDER and MIXING_VIRTUAL_TOOLS.
* M165 - Set the proportions for a mixing extruder. Use parameters ABCDHI to set the mixing factors. Requires COLOR_MIXING_EXTRUDER.
* M190 - Sxxx Wait for bed or cooler current temp to reach target temp. Waits only when heating Waits only when heating bed or cooling cooler
* Rxxx Wait for bed or cooler current temp to reach target temp. Waits when heating and cooling
* C parameter select Cooler, omitting it selec bed.
* M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
* Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
* M191 - Sxxx Wait for chamber current temp to reach target temp. Waits only when heating
* Rxxx Wait for chamber current temp to reach target temp. Waits when heating and cooling
* M192 - Sxxx Wait for cooler current temp to reach target temp. Waits only when heating
* Rxxx Wait for cooler current temp to reach target temp. Waits when heating and cooling
* M200 - set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).:D<millimeters>-
* M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
* M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
......@@ -140,8 +145,8 @@
* M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
* M218 - Set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
* M220 - Set speed factor override percentage: S<factor in percent>
* M221 - Set extrude factor override percentage: S<factor in percent>
* M222 - Set density extrusion percentage for purge: S<factor in percent>
* M221 - T<extruder> S<factor in percent> - set extrude factor override percentage
* M222 - T<extruder> S<factor in percent> - set density extrude factor percentage for purge
* M226 - Wait until the specified pin reaches the state required: P<pin number> S<pin state>
* M240 - Trigger a camera to take a photograph
* M250 - Set LCD contrast C<contrast value> (value 0..63)
......@@ -150,7 +155,9 @@
* M301 - Set PID parameters P I D and C
* M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
* M303 - PID relay autotune S<temperature> sets the target temperature (default target temperature = 150C). H<hotend> C<cycles> U<Apply result>
* M304 - Set bed PID parameters P I and D or cooling if C parameter
* M304 - Set hot bed PID parameters P I and D
* M305 - Set hot chamber PID parameters P I and D
* M306 - Set cooler PID parameters P I and D
* M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly.
* M380 - Activate solenoid on active extruder
......@@ -175,8 +182,6 @@
* M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
* M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
* M649 - laser set options
* M650 - mUVe peel set peel distance
* M651 - mUVe peel run peel move
* M666 - Set z probe offset or Endstop and delta geometry adjustment
* M906 - Set motor currents XYZ T0-4 E
* M907 - Set digital trimpot motor current using axis codes.
......
......@@ -32,11 +32,11 @@
*
* 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
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* Description: *** HAL for Arduino ***
......@@ -92,16 +92,16 @@
inline void protect() {
cli();
}
inline void unprotect() {
SREG = sreg;
}
inline InterruptProtectedBlock(bool later = false) {
sreg = SREG;
if (!later) cli();
}
inline ~InterruptProtectedBlock() {
SREG = sreg;
}
......
/*
HardwareSerial.h - Hardware serial library for Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 28 September 2010 by Mark Sproul
*/
/**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
/**
* HardwareSerial.h - Hardware serial library for Wiring
* Copyright (c) 2006 Nicholas Zambetti. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Modified 28 September 2010 by Mark Sproul
* Modified 3 March 2015 by MagoKimbra
*/
#ifndef HardwareSerial_H
#define HardwareSerial_H
......
......@@ -12,11 +12,11 @@
*
* 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
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
......
This diff is collapsed.
......@@ -13,7 +13,9 @@
#if MB(RAMPS_FD_V1)
#define RAMPS_FD_V1
#define INVERTED_HEATER_PINS
#define INVERTED_BED_PINS
#define INVERTED_BED_PIN
#define INVERTED_CHAMBER_PIN
#define INVERTED_COOLER_PIN
// No EEPROM
// Use 4k7 thermistor tables
#else
......
......@@ -13,7 +13,9 @@
#if MB(RAMPS_FD_V1)
#define RAMPS_FD_V1
#define INVERTED_HEATER_PINS
#define INVERTED_BED_PINS
#define INVERTED_BED_PIN
#define INVERTED_CHAMBER_PIN
#define INVERTED_COOLER_PIN
// No EEPROM
// Use 4k7 thermistor tables
#else
......
......@@ -184,6 +184,8 @@
#define MSG_ERR_MINTEMP "MINTEMP ERROR"
#define MSG_ERR_MAXTEMP_BED "MAXTEMP BED ERROR"
#define MSG_ERR_MINTEMP_BED "MINTEMP BED ERROR"
#define MSG_ERR_MAXTEMP_CHAMBER "MAXTEMP CHAMBER ERROR"
#define MSG_ERR_MINTEMP_CHAMBER "MINTEMP CHAMBER ERROR"
#define MSG_ERR_MAXTEMP_COOLER "MAXTEMP COOLER ERROR"
#define MSG_ERR_MINTEMP_COOLER "MINTEMP COOLER ERROR"
#define MSG_END_DAY "days"
......
......@@ -181,6 +181,8 @@
#define MSG_ERR_MINTEMP "Err: TEMP MINIMA"
#define MSG_ERR_MAXTEMP_BED "Err: TEMP MASSIMA PIATTO"
#define MSG_ERR_MINTEMP_BED "Err: TEMP MINIMA PIATTO"
#define MSG_ERR_MAXTEMP_CHAMBER "MAXTEMP CHAMBER ERROR"
#define MSG_ERR_MINTEMP_CHAMBER "MINTEMP CHAMBER ERROR"
#define MSG_ERR_MAXTEMP_COOLER "MAXTEMP COOLER ERROR"
#define MSG_ERR_MINTEMP_COOLER "MINTEMP COOLER ERROR"
#define MSG_END_DAY "giorni"
......@@ -246,7 +248,6 @@
#define MSG_COOLER_COOLING "Raffreddamento..."
#define MSG_COOLER_DONE "Raffreddamento finito."
// Extra
#define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configurazione"
......
......@@ -165,6 +165,7 @@ bool PrintCounter::stop() {
this->data.completePrints++;
this->data.printTime += this->deltaDuration();
this->saveStats();
return true;
}
else return false;
}
......
/**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
/**
* flowmeter.h - Flowmeter control library for Arduino - Version 1
* Copyright (c) 2016 Franco (nextime) Lanza. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../../base.h"
#include <Arduino.h>
#if ENABLED(FLOWMETER_SENSOR)
volatile int flowrate_pulsecount;
float flowrate;
static millis_t flowmeter_timer = 0;
static millis_t lastflow = 0;
void flowrate_pulsecounter();
void flow_init() {
flowrate = 0;
flowrate_pulsecount = 0;
pinMode(FLOWMETER_PIN, INPUT);
attachInterrupt(digitalPinToInterrupt(FLOWMETER_PIN), flowrate_pulsecounter, FALLING);
}
void flowrate_manage() {
millis_t now;
now = millis();
if(ELAPSED(now, flowmeter_timer)) {
detachInterrupt(digitalPinToInterrupt(FLOWMETER_PIN));
flowrate = (float)(((1000.0 / (float)((float)now - (float)lastflow)) * (float)flowrate_pulsecount) / (float)FLOWMETER_CALIBRATION);
#if ENABLED(FLOWMETER_DEBUG)
ECHO_M(" FLOWMETER DEBUG ");
ECHO_MV(" flowrate:", flowrate);
ECHO_MV(" flowrate_pulsecount:", flowrate_pulsecount);
ECHO_EMV(" CALIBRATION:", FLOWMETER_CALIBRATION);
#endif
flowmeter_timer = now + 1000UL;
lastflow = now;
flowrate_pulsecount = 0;
attachInterrupt(digitalPinToInterrupt(FLOWMETER_PIN), flowrate_pulsecounter, FALLING);
}
}
float get_flowrate() {
return flowrate;
}
void flowrate_pulsecounter() {
// Increment the pulse counter
flowrate_pulsecount++;
}
#endif // FLOWMETER_SENSOR
/**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
/**
* flowmeter.h - Flowmeter control library for Arduino - Version 1
* Copyright (c) 2016 Franco (nextime) Lanza. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FLOWMETER_H
#define FLOWMETER_H
#define FLOWMETER_CALIBRATION (FLOWMETER_MAXFREQ / FLOWMETER_MAXFLOW)
#if ENABLED(FLOWMETER_SENSOR)
void flowrate_manage();
void flow_init();
float get_flowrate();
#endif
#endif // FLOWMETER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment