Commit 72c7bdc1 authored by MagoKimbra's avatar MagoKimbra

Revert "Fix Power Consumation"

This reverts commit 3223901a.

Conflicts:
	MarlinKimbra/ultralcd.cpp
parent ed3f6361
...@@ -75,11 +75,6 @@ ...@@ -75,11 +75,6 @@
// This is used for single nozzle and multiple extrusion configuration // This is used for single nozzle and multiple extrusion configuration
// Uncomment below to enable (One Hotend) // Uncomment below to enable (One Hotend)
//#define SINGLENOZZLE //#define SINGLENOZZLE
#ifdef SINGLENOZZLE
#define HOTENDS 1
#else
#define HOTENDS EXTRUDERS
#endif
/*********************************************************************** /***********************************************************************
*********************** Multiextruder MKR4 *************************** *********************** Multiextruder MKR4 ***************************
...@@ -651,7 +646,6 @@ your extruder heater takes 2 minutes to hit the target on heating. ...@@ -651,7 +646,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
//When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec. //When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec.
//#define FILAMENT_LCD_DISPLAY //#define FILAMENT_LCD_DISPLAY
/**********************************************************************\ /**********************************************************************\
* Support for a current sensor (Hall effect sensor like ACS712) for measure the power consumption * Support for a current sensor (Hall effect sensor like ACS712) for measure the power consumption
* Since it's more simple to deal with, we measure the DC current and we assume that POWER_VOLTAGE that comes from your power supply it's almost stable. * Since it's more simple to deal with, we measure the DC current and we assume that POWER_VOLTAGE that comes from your power supply it's almost stable.
...@@ -659,7 +653,7 @@ your extruder heater takes 2 minutes to hit the target on heating. ...@@ -659,7 +653,7 @@ your extruder heater takes 2 minutes to hit the target on heating.
* With this module we measure the Printer power consumption ignoring the Power Supply power consumption, so we consider the EFFICIENCY of our supply to be 100% so without * With this module we measure the Printer power consumption ignoring the Power Supply power consumption, so we consider the EFFICIENCY of our supply to be 100% so without
* any power dispersion. If you want to approximately add the supply consumption you can decrease the EFFICIENCY to a value less than 100. Eg: 85 is a good value. * any power dispersion. If you want to approximately add the supply consumption you can decrease the EFFICIENCY to a value less than 100. Eg: 85 is a good value.
* You can find a better value measuring the AC current with a good multimeter and moltiple it with the mains voltage. * You can find a better value measuring the AC current with a good multimeter and moltiple it with the mains voltage.
* MULTIMETER_WATT := MULTIMETER_CURRENT * MAINS_VOLTAGE * MULTIMETER_WATT := MULTIMETER_CURRENT*MAINS_VOLTAGE
* Now you have a Wattage value that you can compare with the one measured from ACS712. * Now you have a Wattage value that you can compare with the one measured from ACS712.
* NEW_EFFICENCY := (SENSOR_WATT*EFFICIENCY)/MULTIMETER_WATT * NEW_EFFICENCY := (SENSOR_WATT*EFFICIENCY)/MULTIMETER_WATT
* For now this feature is to be consider BETA as i'll have to do some accurate test to see the affidability * For now this feature is to be consider BETA as i'll have to do some accurate test to see the affidability
...@@ -667,14 +661,13 @@ your extruder heater takes 2 minutes to hit the target on heating. ...@@ -667,14 +661,13 @@ your extruder heater takes 2 minutes to hit the target on heating.
// Uncomment below to enable // Uncomment below to enable
//#define POWER_CONSUMPTION //#define POWER_CONSUMPTION
#define POWER_VOLTAGE 12.00 //(V) The power supply OUT voltage #define POWER_VOLTAGE 12.00 //(V) The power supply OUT voltage
#define POWER_ZERO 2.5 //(V) The /\V coming out from the sensor when no current flow. #define POWER_ZERO 2.5 //(V) The /\V coming out from the sensor when no current flow.
#define POWER_SENSITIVITY 0.066 //(V/A) How much increase V for 1A of increase #define POWER_SENSITIVITY 0.066 //(V/A) How much increase V for 1A of increase
#define POWER_EFFICIENCY 100.0 //(%) The power efficency of the power supply #define POWER_EFFICIENCY 100.0 //(%) The power efficency of the power supply
//When using an LCD, uncomment the line below to display the Power consumption sensor data on the last line instead of status. Status will appear for 5 sec. //When using an LCD, uncomment the line below to display the Power consumption sensor data on the last line instead of status. Status will appear for 5 sec.
//#define POWER_CONSUMPTION_LCD_DISPLAY //#define POWER_CONSUMPTION_LCD_DISPLAY
//=================================== Misc ================================= //=================================== Misc =================================
// Temperature status LEDs that display the hotend and bet temperature. // Temperature status LEDs that display the hotend and bet temperature.
......
...@@ -44,15 +44,35 @@ ...@@ -44,15 +44,35 @@
//The M105 command return, besides traditional information, the ADC value read from temperature sensors. //The M105 command return, besides traditional information, the ADC value read from temperature sensors.
//#define SHOW_TEMP_ADC_VALUES //#define SHOW_TEMP_ADC_VALUES
// extruder idle oozing prevention
//if the extruder motor is idle for more than SECONDS, and the temperature over MINTEMP, some filament is retracted. The filament retracted is re-added before the next extrusion
//#define IDLE_OOZING_PREVENT
#define IDLE_OOZING_MINTEMP 170
#define IDLE_OOZING_FEEDRATE 45 //default feedrate for retracting (mm/s)
#define IDLE_OOZING_SECONDS 10
#define IDLE_OOZING_LENGTH 15 //default retract length (positive mm)
#define IDLE_OOZING_RECOVER_LENGTH 0 //default additional recover length (mm, added to retract length when recovering)
#define IDLE_OOZING_RECOVER_FEEDRATE 50 //default feedrate for recovering from retraction (mm/s)
#if defined(IDLE_OOZING_PREVENT) && IDLE_OOZING_MINTEMP < EXTRUDE_MINTEMP
#error IDLE_OOZING_MINTEMP have to be greater than EXTRUDE_MINTEMP
#endif
// extruder run-out prevention. // extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
//#define EXTRUDER_RUNOUT_PREVENT //#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30. #define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament #define EXTRUDER_RUNOUT_ESTEPS 14 //mm filament
#define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_SPEED 1500 //extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100 #define EXTRUDER_RUNOUT_EXTRUDE 100
#if defined(EXTRUDER_RUNOUT_PREVENT) && EXTRUDER_RUNOUT_MINTEMP < EXTRUDE_MINTEMP
#error EXTRUDER_RUNOUT_MINTEMP have to be greater than EXTRUDE_MINTEMP
#endif
#if defined(EXTRUDER_RUNOUT_PREVENT) && defined(IDLE_OOZING_PREVENT)
#error EXTRUDER_RUNOUT_PREVENT and IDLE_OOZING_PREVENT are incopatible. Please comment one of them.
#endif
//These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements.
//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET"
#define TEMP_SENSOR_AD595_OFFSET 0.0 #define TEMP_SENSOR_AD595_OFFSET 0.0
...@@ -466,12 +486,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st ...@@ -466,12 +486,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#endif #endif
#endif #endif
#ifdef FILAMENTCHANGEENABLE
#ifdef EXTRUDER_RUNOUT_PREVENT
#error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
#endif
#endif
/******************************************************************************\ /******************************************************************************\
* enable this section if you have TMC26X motor drivers. * enable this section if you have TMC26X motor drivers.
......
...@@ -301,20 +301,19 @@ extern unsigned char fanSpeedSoftPwm; ...@@ -301,20 +301,19 @@ extern unsigned char fanSpeedSoftPwm;
#endif #endif
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
extern float filament_width_nominal; //holds the theoretical filament diameter ie., 3.00 or 1.75 extern float filament_width_nominal; //holds the theoretical filament diameter ie., 3.00 or 1.75
extern bool filament_sensor; //indicates that filament sensor readings should control extrusion extern bool filament_sensor; //indicates that filament sensor readings should control extrusion
extern float filament_width_meas; //holds the filament diameter as accurately measured extern float filament_width_meas; //holds the filament diameter as accurately measured
extern signed char measurement_delay[]; //ring buffer to delay measurement extern signed char measurement_delay[]; //ring buffer to delay measurement
extern int delay_index1, delay_index2; //index into ring buffer extern int delay_index1, delay_index2; //index into ring buffer
extern float delay_dist; //delay distance counter extern float delay_dist; //delay distance counter
extern int meas_delay_cm; //delay distance extern int meas_delay_cm; //delay distance
#endif #endif
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) #if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
extern unsigned int power_consumption_meas; //holds the power consumption as accurately measured extern unsigned int power_consumption_meas; //holds the power consumption as accurately measured
extern unsigned long power_consumption_hour; //holds the power consumption per hour as accurately measured extern unsigned long power_consumption_hour; //holds the power consumption per hour as accurately measured
#endif #endif
#ifdef FWRETRACT #ifdef FWRETRACT
extern bool autoretract_enabled; extern bool autoretract_enabled;
extern bool retracted[EXTRUDERS]; extern bool retracted[EXTRUDERS];
......
...@@ -336,6 +336,23 @@ uint8_t debugLevel = 0; ...@@ -336,6 +336,23 @@ uint8_t debugLevel = 0;
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
bool filament_changing = false; bool filament_changing = false;
#endif #endif
#ifdef IDLE_OOZING_PREVENT || EXTRUDER_RUNOUT_PREVENT
unsigned long axis_last_activity = 0;
bool axis_is_moving = false;
#endif
#ifdef IDLE_OOZING_PREVENT
bool IDLE_OOZING_retracted[EXTRUDERS] = { false
#if EXTRUDERS > 1
, false
#if EXTRUDERS > 2
, false
#if EXTRUDERS > 3
, false
#endif
#endif
#endif
};
#endif
#ifdef FWRETRACT #ifdef FWRETRACT
bool autoretract_enabled = false; bool autoretract_enabled = false;
...@@ -386,18 +403,18 @@ uint8_t debugLevel = 0; ...@@ -386,18 +403,18 @@ uint8_t debugLevel = 0;
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
//Variables for Filament Sensor input //Variables for Filament Sensor input
float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404 float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404
bool filament_sensor=false; //M405 turns on filament_sensor control, M406 turns it off bool filament_sensor=false; //M405 turns on filament_sensor control, M406 turns it off
float filament_width_meas=DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter float filament_width_meas=DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter
signed char measurement_delay[MAX_MEASUREMENT_DELAY+1]; //ring buffer to delay measurement store extruder factor after subtracting 100 signed char measurement_delay[MAX_MEASUREMENT_DELAY+1]; //ring buffer to delay measurement store extruder factor after subtracting 100
int delay_index1=0; //index into ring buffer int delay_index1=0; //index into ring buffer
int delay_index2=-1; //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized int delay_index2=-1; //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
float delay_dist=0; //delay distance counter float delay_dist=0; //delay distance counter
int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting
#endif #endif
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) #if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
unsigned int power_consumption_meas = 0; unsigned int power_consumption_meas = 0;
unsigned long power_consumption_hour = 0.0; unsigned long power_consumption_hour = 0.0;
#endif #endif
#ifdef LASERBEAM #ifdef LASERBEAM
...@@ -1324,7 +1341,7 @@ bool extruder_duplication_enabled = false; // used in mode 2 ...@@ -1324,7 +1341,7 @@ bool extruder_duplication_enabled = false; // used in mode 2
#if SERVO_LEVELING #if SERVO_LEVELING
servos[servo_endstops[Z_AXIS]].attach(0); servos[servo_endstops[Z_AXIS]].attach(0);
#endif #endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]); servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if SERVO_LEVELING #if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY); delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach(); servos[servo_endstops[Z_AXIS]].detach();
...@@ -1941,6 +1958,40 @@ bool extruder_duplication_enabled = false; // used in mode 2 ...@@ -1941,6 +1958,40 @@ bool extruder_duplication_enabled = false; // used in mode 2
void refresh_cmd_timeout(void) { previous_millis_cmd = millis(); } void refresh_cmd_timeout(void) { previous_millis_cmd = millis(); }
#ifdef IDLE_OOZING_PREVENT
void IDLE_OOZING_retract(bool retracting)
{
if(retracting && !IDLE_OOZING_retracted[active_extruder]) {
//SERIAL_ECHOLN("RETRACT FOR OOZING PREVENT");
destination[X_AXIS]=current_position[X_AXIS];
destination[Y_AXIS]=current_position[Y_AXIS];
destination[Z_AXIS]=current_position[Z_AXIS];
destination[E_AXIS]=current_position[E_AXIS];
current_position[E_AXIS]+=IDLE_OOZING_LENGTH/volumetric_multiplier[active_extruder];
plan_set_e_position(current_position[E_AXIS]);
float oldFeedrate = feedrate;
feedrate=IDLE_OOZING_FEEDRATE*60;
IDLE_OOZING_retracted[active_extruder]=true;
prepare_move();
feedrate = oldFeedrate;
}
else if(!retracting && IDLE_OOZING_retracted[active_extruder]){
//SERIAL_ECHOLN("EXTRUDE FOR OOZING PREVENT");
destination[X_AXIS]=current_position[X_AXIS];
destination[Y_AXIS]=current_position[Y_AXIS];
destination[Z_AXIS]=current_position[Z_AXIS];
destination[E_AXIS]=current_position[E_AXIS];
current_position[E_AXIS]-=(IDLE_OOZING_LENGTH+IDLE_OOZING_RECOVER_LENGTH)/volumetric_multiplier[active_extruder];
plan_set_e_position(current_position[E_AXIS]);
float oldFeedrate = feedrate;
feedrate=IDLE_OOZING_RECOVER_FEEDRATE * 60;
IDLE_OOZING_retracted[active_extruder] = false;
prepare_move();
feedrate = oldFeedrate;
}
}
#endif
#ifdef FWRETRACT #ifdef FWRETRACT
void retract(bool retracting, bool swapretract = false) void retract(bool retracting, bool swapretract = false)
{ {
...@@ -2164,6 +2215,9 @@ inline void wait_bed() { ...@@ -2164,6 +2215,9 @@ inline void wait_bed() {
// G0-G1: Coordinated movement of X Y Z E axes // G0-G1: Coordinated movement of X Y Z E axes
inline void gcode_G0_G1() { inline void gcode_G0_G1() {
if (!Stopped) { if (!Stopped) {
#ifdef IDLE_OOZING_PREVENT
IDLE_OOZING_retract(false);
#endif
get_coordinates(); // For X Y Z E F get_coordinates(); // For X Y Z E F
#ifdef FWRETRACT #ifdef FWRETRACT
if (autoretract_enabled) { if (autoretract_enabled) {
...@@ -2283,11 +2337,6 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2283,11 +2337,6 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
#endif //DELTA #endif //DELTA
#ifdef SCARA
calculate_delta(current_position);
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
#endif
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) #if defined(CARTESIAN) || defined(COREXY) || defined(SCARA)
#if Z_HOME_DIR > 0 // If homing away from BED do Z first #if Z_HOME_DIR > 0 // If homing away from BED do Z first
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
...@@ -2738,8 +2787,8 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2738,8 +2787,8 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
current_position[Y_AXIS] = uncorrected_position.y; current_position[Y_AXIS] = uncorrected_position.y;
current_position[Z_AXIS] = uncorrected_position.z; current_position[Z_AXIS] = uncorrected_position.z;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
setup_for_endstop_move(); setup_for_endstop_move();
feedrate = homing_feedrate[Z_AXIS]; feedrate = homing_feedrate[Z_AXIS];
#ifdef AUTO_BED_LEVELING_GRID #ifdef AUTO_BED_LEVELING_GRID
...@@ -3851,7 +3900,7 @@ inline void gcode_M204() { ...@@ -3851,7 +3900,7 @@ inline void gcode_M204() {
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
//M600: Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] //M600: Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
inline void gcode_M600() { inline void gcode_M600() {
filament_changing = true; filament_changing = true;
float target[NUM_AXIS]; float target[NUM_AXIS];
for (int i=0; i < NUM_AXIS; i++) target[i] = lastpos[i] = current_position[i]; for (int i=0; i < NUM_AXIS; i++) target[i] = lastpos[i] = current_position[i];
...@@ -4011,7 +4060,7 @@ inline void gcode_M204() { ...@@ -4011,7 +4060,7 @@ inline void gcode_M204() {
for(int8_t i=0; i < NUM_AXIS; i++) current_position[i]=lastpos[i]; for(int8_t i=0; i < NUM_AXIS; i++) current_position[i]=lastpos[i];
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
#endif #endif
filament_changing = false; filament_changing = false;
} }
#endif //FILAMENTCHANGEENABLE #endif //FILAMENTCHANGEENABLE
...@@ -6135,6 +6184,9 @@ void clamp_to_software_endstops(float target[3]) ...@@ -6135,6 +6184,9 @@ void clamp_to_software_endstops(float target[3])
void prepare_move() void prepare_move()
{ {
#ifdef IDLE_OOZING_PREVENT || EXTRUDER_RUNOUT_PREVENT
axis_is_moving = true;
#endif
clamp_to_software_endstops(destination); clamp_to_software_endstops(destination);
refresh_cmd_timeout(); refresh_cmd_timeout();
...@@ -6154,6 +6206,7 @@ void prepare_move() ...@@ -6154,6 +6206,7 @@ void prepare_move()
return; return;
} }
float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
int steps = max(1, int(scara_segments_per_second * seconds)); int steps = max(1, int(scara_segments_per_second * seconds));
//SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm); //SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
//SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds); //SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
...@@ -6263,6 +6316,11 @@ void prepare_move() ...@@ -6263,6 +6316,11 @@ void prepare_move()
} }
#endif // !(DELTA || SCARA) #endif // !(DELTA || SCARA)
#ifdef IDLE_OOZING_PREVENT || EXTRUDER_RUNOUT_PREVENT
axis_last_activity = millis();
axis_is_moving = false;
#endif
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i]; current_position[i] = destination[i];
} }
...@@ -6527,6 +6585,11 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s ...@@ -6527,6 +6585,11 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
controllerFan(); //Check if fan should be turned on to cool stepper drivers down controllerFan(); //Check if fan should be turned on to cool stepper drivers down
#endif #endif
#ifdef IDLE_OOZING_PREVENT
if(!debugDryrun() && !axis_is_moving && !filament_changing && (millis() - axis_last_activity) > IDLE_OOZING_SECONDS*1000 && degHotend(active_extruder) > IDLE_OOZING_MINTEMP) {
IDLE_OOZING_retract(true);
}
#endif
#ifdef EXTRUDER_RUNOUT_PREVENT #ifdef EXTRUDER_RUNOUT_PREVENT
if(!debugDryrun() && !axis_is_moving && !filament_changing && (millis() - axis_last_activity) > EXTRUDER_RUNOUT_SECONDS*1000 && degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP) if(!debugDryrun() && !axis_is_moving && !filament_changing && (millis() - axis_last_activity) > EXTRUDER_RUNOUT_SECONDS*1000 && degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
{ {
......
...@@ -504,6 +504,7 @@ void CardReader::printingHasFinished() { ...@@ -504,6 +504,7 @@ void CardReader::printingHasFinished() {
startFileprint(); startFileprint();
} }
else { else {
quickStop();
file.close(); file.close();
sdprinting = false; sdprinting = false;
if (SD_FINISHED_STEPPERRELEASE) { if (SD_FINISHED_STEPPERRELEASE) {
......
...@@ -268,34 +268,37 @@ static void lcd_implementation_status_screen() { ...@@ -268,34 +268,37 @@ static void lcd_implementation_status_screen() {
u8g.setFont(FONT_STATUSMENU); u8g.setFont(FONT_STATUSMENU);
u8g.setPrintPos(0,63); u8g.setPrintPos(0,63);
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line
u8g.print(lcd_status_message); u8g.print(lcd_status_message);
} }
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY)
else if (millis() < message_millis + 10000) else if (millis() < message_millis + 10000)
#else #else
else else
#endif #endif
{ {
lcd_printPGM(PSTR("P:")); lcd_printPGM(PSTR("P:"));
u8g.print(itostr3(power_consumption_meas)); u8g.print(itostr3(power_consumption_meas));
lcd_printPGM(PSTR("W C:")); lcd_printPGM(PSTR("W C:"));
u8g.print(ltostr7(power_consumption_hour)); u8g.print(ltostr7(power_consumption_hour));
lcd_printPGM(PSTR("Wh")); lcd_printPGM(PSTR("Wh"));
} }
#endif #endif
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY)
else { else {
lcd_printPGM(PSTR("D:")); lcd_printPGM(PSTR("D:"));
u8g.print(ftostr12ns(filament_width_meas)); u8g.print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR("mm F:")); lcd_printPGM(PSTR("mm F:"));
u8g.print(itostr3(volumetric_multiplier[active_extruder] * 100)); u8g.print(itostr3(volumetric_multiplier[active_extruder] * 100));
u8g.print('%'); u8g.print('%');
} }
#endif #endif
#else #else
u8g.print(lcd_status_message); u8g.print(lcd_status_message);
#endif #endif
} }
......
...@@ -78,12 +78,12 @@ float mintravelfeedrate; ...@@ -78,12 +78,12 @@ float mintravelfeedrate;
unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS]; unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level // this holds the required transform to compensate for bed level
matrix_3x3 plan_bed_level_matrix = { matrix_3x3 plan_bed_level_matrix = {
1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 1.0 0.0, 0.0, 1.0
}; };
#endif // #ifdef ENABLE_AUTO_BED_LEVELING #endif // #ifdef ENABLE_AUTO_BED_LEVELING
// The current position of the tool in absolute steps // The current position of the tool in absolute steps
...@@ -92,26 +92,26 @@ static float previous_speed[NUM_AXIS]; // Speed of previous path line segment ...@@ -92,26 +92,26 @@ static float previous_speed[NUM_AXIS]; // Speed of previous path line segment
static float previous_nominal_speed; // Nominal speed of previous path line segment static float previous_nominal_speed; // Nominal speed of previous path line segment
#ifdef AUTOTEMP #ifdef AUTOTEMP
float autotemp_max = 250; float autotemp_max=250;
float autotemp_min = 210; float autotemp_min=210;
float autotemp_factor = 0.1; float autotemp_factor=0.1;
bool autotemp_enabled = false; bool autotemp_enabled=false;
#endif #endif
unsigned char g_uc_extruder_last_move[4] = {0,0,0,0}; unsigned char g_uc_extruder_last_move[4] = {0,0,0,0};
//=========================================================================== //===========================================================================
//=================semi-private variables, used in inline functions ========= //=================semi-private variables, used in inline functions =====
//=========================================================================== //===========================================================================
block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
volatile unsigned char block_buffer_head; // Index of the next block to be pushed volatile unsigned char block_buffer_head; // Index of the next block to be pushed
volatile unsigned char block_buffer_tail; // Index of the block to process now volatile unsigned char block_buffer_tail; // Index of the block to process now
//=========================================================================== //===========================================================================
//=============================private variables ============================ //=============================private variables ============================
//=========================================================================== //===========================================================================
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
float extrude_min_temp = EXTRUDE_MINTEMP; float extrude_min_temp=EXTRUDE_MINTEMP;
#endif #endif
#ifdef XY_FREQUENCY_LIMIT #ifdef XY_FREQUENCY_LIMIT
#define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT) #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT)
...@@ -151,9 +151,15 @@ static int8_t prev_block_index(int8_t block_index) { ...@@ -151,9 +151,15 @@ static int8_t prev_block_index(int8_t block_index) {
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the // Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
// given acceleration: // given acceleration:
FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) { FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration)
if (acceleration == 0) return 0; // acceleration was 0, set acceleration distance to 0 {
return (target_rate * target_rate - initial_rate * initial_rate) / (acceleration * 2); if (acceleration!=0) {
return((target_rate*target_rate-initial_rate*initial_rate)/
(2.0*acceleration));
}
else {
return 0.0; // acceleration was 0, set acceleration distance to 0
}
} }
// This function gives you the point at which you must start braking (at the rate of -acceleration) if // This function gives you the point at which you must start braking (at the rate of -acceleration) if
...@@ -161,42 +167,54 @@ FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float targ ...@@ -161,42 +167,54 @@ FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float targ
// a total travel of distance. This can be used to compute the intersection point between acceleration and // a total travel of distance. This can be used to compute the intersection point between acceleration and
// deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed) // deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) { FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance)
if (acceleration == 0) return 0; // acceleration was 0, set intersection distance to 0 {
return (acceleration * 2 * distance - initial_rate * initial_rate + final_rate * final_rate) / (acceleration * 4); if (acceleration!=0) {
return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
(4.0*acceleration) );
}
else {
return 0.0; // acceleration was 0, set intersection distance to 0
}
} }
// Calculates trapezoid parameters so that the entry- and exit-speed is compensated by the provided factors. // Calculates trapezoid parameters so that the entry- and exit-speed is compensated by the provided factors.
void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exit_factor) { void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exit_factor) {
unsigned long initial_rate = ceil(block->nominal_rate * entry_factor); // (step/min) unsigned long initial_rate = ceil(block->nominal_rate*entry_factor); // (step/min)
unsigned long final_rate = ceil(block->nominal_rate * exit_factor); // (step/min) unsigned long final_rate = ceil(block->nominal_rate*exit_factor); // (step/min)
// Limit minimal step rate (Otherwise the timer will overflow.) // Limit minimal step rate (Otherwise the timer will overflow.)
if (initial_rate < 120) initial_rate = 120; if(initial_rate <120) {
if (final_rate < 120) final_rate = 120; initial_rate=120;
}
if(final_rate < 120) {
final_rate=120;
}
long acceleration = block->acceleration_st; long acceleration = block->acceleration_st;
int32_t accelerate_steps = ceil(estimate_acceleration_distance(initial_rate, block->nominal_rate, acceleration)); int32_t accelerate_steps =
int32_t decelerate_steps = floor(estimate_acceleration_distance(block->nominal_rate, final_rate, -acceleration)); ceil(estimate_acceleration_distance(initial_rate, block->nominal_rate, acceleration));
int32_t decelerate_steps =
floor(estimate_acceleration_distance(block->nominal_rate, final_rate, -acceleration));
// Calculate the size of Plateau of Nominal Rate. // Calculate the size of Plateau of Nominal Rate.
int32_t plateau_steps = block->step_event_count - accelerate_steps - decelerate_steps; int32_t plateau_steps = block->step_event_count-accelerate_steps-decelerate_steps;
// Is the Plateau of Nominal Rate smaller than nothing? That means no cruising, and we will // Is the Plateau of Nominal Rate smaller than nothing? That means no cruising, and we will
// have to use intersection_distance() to calculate when to abort acceleration and start braking // have to use intersection_distance() to calculate when to abort acceleration and start braking
// in order to reach the final_rate exactly at the end of this block. // in order to reach the final_rate exactly at the end of this block.
if (plateau_steps < 0) { if (plateau_steps < 0) {
accelerate_steps = ceil(intersection_distance(initial_rate, final_rate, acceleration, block->step_event_count)); accelerate_steps = ceil(intersection_distance(initial_rate, final_rate, acceleration, block->step_event_count));
accelerate_steps = max(accelerate_steps, 0); // Check limits due to numerical round-off accelerate_steps = max(accelerate_steps,0); // Check limits due to numerical round-off
accelerate_steps = min((uint32_t)accelerate_steps, block->step_event_count);//(We can cast here to unsigned, because the above line ensures that we are above zero) accelerate_steps = min((uint32_t)accelerate_steps,block->step_event_count);//(We can cast here to unsigned, because the above line ensures that we are above zero)
plateau_steps = 0; plateau_steps = 0;
} }
#ifdef ADVANCE #ifdef ADVANCE
volatile long initial_advance = block->advance * entry_factor * entry_factor; volatile long initial_advance = block->advance*entry_factor*entry_factor;
volatile long final_advance = block->advance * exit_factor * exit_factor; volatile long final_advance = block->advance*exit_factor*exit_factor;
#endif // ADVANCE #endif // ADVANCE
// block->accelerate_until = accelerate_steps; // block->accelerate_until = accelerate_steps;
// block->decelerate_after = accelerate_steps+plateau_steps; // block->decelerate_after = accelerate_steps+plateau_steps;
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
#ifdef PID_dT #ifdef PID_dT
#undef PID_dT #undef PID_dT
#endif #endif
#define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0)) #define PID_dT ((OVERSAMPLENR * 12.0)/(F_CPU / 64.0 / 256.0))
#ifndef SINGLENOZZLE #ifndef SINGLENOZZLE
int target_temperature[EXTRUDERS] = { 0 }; int target_temperature[EXTRUDERS] = { 0 };
...@@ -133,7 +133,6 @@ unsigned char soft_pwm_bed; ...@@ -133,7 +133,6 @@ unsigned char soft_pwm_bed;
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS_POWER_CONSUMPTION_SENSOR
int current_raw_powconsumption = 0; //Holds measured power consumption int current_raw_powconsumption = 0; //Holds measured power consumption
#endif #endif
//=========================================================================== //===========================================================================
//=============================private variables============================ //=============================private variables============================
//=========================================================================== //===========================================================================
...@@ -181,7 +180,7 @@ static volatile bool temp_meas_ready = false; ...@@ -181,7 +180,7 @@ static volatile bool temp_meas_ready = false;
static float temp_iState_min_bed; static float temp_iState_min_bed;
static float temp_iState_max_bed; static float temp_iState_max_bed;
#else //PIDTEMPBED #else //PIDTEMPBED
static unsigned long previous_millis_bed_heater; static unsigned long previous_millis_bed_heater;
#endif //PIDTEMPBED #endif //PIDTEMPBED
#ifndef SINGLENOZZLE #ifndef SINGLENOZZLE
static unsigned char soft_pwm[EXTRUDERS]; static unsigned char soft_pwm[EXTRUDERS];
...@@ -801,8 +800,8 @@ void manage_heater() { ...@@ -801,8 +800,8 @@ void manage_heater() {
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
if (filament_sensor) { if (filament_sensor) {
meas_shift_index = delay_index1 - meas_delay_cm; meas_shift_index = delay_index1 - meas_delay_cm;
if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed
// Get the delayed info and add 100 to reconstitute to a percent of // Get the delayed info and add 100 to reconstitute to a percent of
// the nominal filament diameter then square it to get an area // the nominal filament diameter then square it to get an area
meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY); meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY);
...@@ -859,7 +858,7 @@ static float analog2temp(int raw, uint8_t e) { ...@@ -859,7 +858,7 @@ static float analog2temp(int raw, uint8_t e) {
return celsius; return celsius;
} }
return ((raw * ((5.0 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
} }
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
...@@ -873,7 +872,7 @@ static float analog2tempBed(int raw) { ...@@ -873,7 +872,7 @@ static float analog2tempBed(int raw) {
{ {
if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw)
{ {
celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) +
(raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * (raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) *
(float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) / (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) /
(float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i-1][0])); (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i-1][0]));
...@@ -886,7 +885,7 @@ static float analog2tempBed(int raw) { ...@@ -886,7 +885,7 @@ static float analog2tempBed(int raw) {
return celsius; return celsius;
#elif defined BED_USES_AD595 #elif defined BED_USES_AD595
return ((raw * ((5.0 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else //NO BED_USES_THERMISTOR #else //NO BED_USES_THERMISTOR
return 0; return 0;
#endif //BED_USES_THERMISTOR #endif //BED_USES_THERMISTOR
...@@ -915,17 +914,17 @@ static void updateTemperaturesFromRawValues() { ...@@ -915,17 +914,17 @@ static void updateTemperaturesFromRawValues() {
filament_width_meas = analog2widthFil(); filament_width_meas = analog2widthFil();
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS_POWER_CONSUMPTION_SENSOR
static float watt_overflow = 0.0; static float watt_overflow = 0.0;
static unsigned long last_power_update = millis(); static unsigned long last_power_update = millis();
unsigned long temp_last_power_update = millis(); unsigned long temp_last_power_update = millis();
float power_temp = analog2power(); float power_temp = analog2power();
power_consumption_meas = (unsigned int)power_temp; power_consumption_meas = (unsigned int)power_temp;
watt_overflow += (power_temp*(temp_last_power_update-last_power_update))/3600000.0; watt_overflow += (power_temp*(temp_last_power_update-last_power_update))/3600000.0;
if(watt_overflow >= 1.0) { if(watt_overflow >= 1.0) {
power_consumption_hour++; power_consumption_hour++;
watt_overflow--; watt_overflow--;
} }
last_power_update = temp_last_power_update; last_power_update = temp_last_power_update;
#endif #endif
//Reset the watchdog after we know we have a temperature measurement. //Reset the watchdog after we know we have a temperature measurement.
watchdog_reset(); watchdog_reset();
...@@ -937,9 +936,10 @@ static void updateTemperaturesFromRawValues() { ...@@ -937,9 +936,10 @@ static void updateTemperaturesFromRawValues() {
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
// Convert raw Filament Width to millimeters // Convert raw Filament Width to millimeters
float analog2widthFil() { float analog2widthFil() {
return current_raw_filwidth / (1024 * OVERSAMPLENR) * 5.0; return current_raw_filwidth / (1023.0 * OVERSAMPLENR) * 5.0;
//return current_raw_filwidth; //return current_raw_filwidth;
} }
...@@ -954,10 +954,12 @@ static void updateTemperaturesFromRawValues() { ...@@ -954,10 +954,12 @@ static void updateTemperaturesFromRawValues() {
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS_POWER_CONSUMPTION_SENSOR
// Convert raw Power Consumption to watt // Convert raw Power Consumption to watt
float analog2power() { float analog2power() {
return (((((5.0 * current_raw_powconsumption) / (1024.0 * OVERSAMPLENR)) - POWER_ZERO) * (POWER_VOLTAGE * 100.0)) / (POWER_SENSITIVITY * POWER_EFFICIENCY)); return (((((5.0 * current_raw_powconsumption) / (1023.0 * OVERSAMPLENR)) - POWER_ZERO) * (POWER_VOLTAGE * 100.0)) / (POWER_SENSITIVITY * POWER_EFFICIENCY));
} }
#endif #endif
void tp_init() void tp_init()
...@@ -975,7 +977,7 @@ void tp_init() ...@@ -975,7 +977,7 @@ void tp_init()
int e = 0; int e = 0;
#endif // !SINGLENOZZLE #endif // !SINGLENOZZLE
{ {
// populate with the first value // populate with the first value
maxttemp[e] = maxttemp[0]; maxttemp[e] = maxttemp[0];
#ifdef PIDTEMP #ifdef PIDTEMP
temp_iState_min[e] = 0.0; temp_iState_min[e] = 0.0;
...@@ -1643,8 +1645,8 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1643,8 +1645,8 @@ ISR(TIMER0_COMPB_vect) {
} }
#endif #endif
temp_state = Prepare_POWCONSUMPTION; temp_state = Prepare_POWCONSUMPTION;
break; break;
case Prepare_POWCONSUMPTION: case Prepare_POWCONSUMPTION:
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS_POWER_CONSUMPTION_SENSOR
START_ADC(POWER_CONSUMPTION_PIN); START_ADC(POWER_CONSUMPTION_PIN);
#endif #endif
...@@ -1655,7 +1657,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1655,7 +1657,7 @@ ISR(TIMER0_COMPB_vect) {
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS_POWER_CONSUMPTION_SENSOR
// raw_powconsumption_value += ADC; //remove to use an IIR filter approach // raw_powconsumption_value += ADC; //remove to use an IIR filter approach
raw_powconsumption_value -= (raw_powconsumption_value>>7); //multiply raw_powconsumption_value by 127/128 raw_powconsumption_value -= (raw_powconsumption_value>>7); //multiply raw_powconsumption_value by 127/128
raw_powconsumption_value += ((unsigned long)((ADC < (POWER_ZERO*1024)/5.0) ? (1024 - ADC) : (ADC))<<7); //add new ADC reading raw_powconsumption_value += ((unsigned long)((ADC < (POWER_ZERO*1023)/5.0) ? (1023 - ADC) : (ADC))<<7); //add new ADC reading
#endif #endif
temp_state = PrepareTemp_0; temp_state = PrepareTemp_0;
temp_count++; temp_count++;
......
...@@ -31,16 +31,16 @@ void tp_init(); //initialize the heating ...@@ -31,16 +31,16 @@ void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically. void manage_heater(); //it is critical that this is called periodically.
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
// For converting raw Filament Width to milimeters // For converting raw Filament Width to milimeters
float analog2widthFil(); float analog2widthFil();
// For converting raw Filament Width to an extrusion ratio // For converting raw Filament Width to an extrusion ratio
int widthFil_to_size_ratio(); int widthFil_to_size_ratio();
#endif #endif
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) #if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
// For converting raw Power Consumption to watt // For converting raw Power Consumption to watt
float analog2power(); float analog2power();
#endif #endif
// low level conversion routines // low level conversion routines
......
...@@ -310,12 +310,16 @@ static void lcd_status_screen() ...@@ -310,12 +310,16 @@ static void lcd_status_screen()
lcd_implementation_status_screen(); lcd_implementation_status_screen();
lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */ lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
} }
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
if (millis() > message_millis + 15000) message_millis = millis(); #if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) && (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#else if (millis() > message_millis + 15000)
if (millis() > message_millis + 10000) message_millis = millis(); #else
if (millis() > message_millis + 10000)
#endif #endif
{
message_millis = millis();
}
#endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
...@@ -689,13 +693,12 @@ void config_lcd_level_bed() ...@@ -689,13 +693,12 @@ void config_lcd_level_bed()
void lcd_level_bed() void lcd_level_bed()
{ {
if(ChangeScreen) { if(ChangeScreen){
lcd.clear(); switch(pageShowInfo){
switch(pageShowInfo) {
case 0: case 0:
{ {
lcd.setCursor(0, 1); u8g.setPrintPos(0, 1);
lcd_printPGM(PSTR(MSG_LP_INTRO)); lcd_printPGM(PSTR(MSG_LP_INTRO));
currentMenu = lcd_level_bed; currentMenu = lcd_level_bed;
ChangeScreen=false; ChangeScreen=false;
...@@ -704,7 +707,7 @@ void lcd_level_bed() ...@@ -704,7 +707,7 @@ void lcd_level_bed()
case 1: case 1:
{ {
lcd.setCursor(0, 1); u8g.setPrintPos(0, 1);
lcd_printPGM(PSTR(MSG_LP_1)); lcd_printPGM(PSTR(MSG_LP_1));
currentMenu = lcd_level_bed; currentMenu = lcd_level_bed;
ChangeScreen=false; ChangeScreen=false;
...@@ -713,7 +716,7 @@ void lcd_level_bed() ...@@ -713,7 +716,7 @@ void lcd_level_bed()
break; break;
case 2: case 2:
{ {
lcd.setCursor(0, 1); u8g.setPrintPos(0, 1);
lcd_printPGM(PSTR(MSG_LP_2)); lcd_printPGM(PSTR(MSG_LP_2));
currentMenu = lcd_level_bed; currentMenu = lcd_level_bed;
ChangeScreen=false; ChangeScreen=false;
...@@ -722,7 +725,7 @@ void lcd_level_bed() ...@@ -722,7 +725,7 @@ void lcd_level_bed()
break; break;
case 3: case 3:
{ {
lcd.setCursor(0, 1); u8g.setPrintPos(0, 1);
lcd_printPGM(PSTR(MSG_LP_3)); lcd_printPGM(PSTR(MSG_LP_3));
currentMenu = lcd_level_bed; currentMenu = lcd_level_bed;
ChangeScreen=false; ChangeScreen=false;
...@@ -731,7 +734,7 @@ void lcd_level_bed() ...@@ -731,7 +734,7 @@ void lcd_level_bed()
break; break;
case 4: case 4:
{ {
lcd.setCursor(0, 1); u8g.setPrintPos(0, 1);
lcd_printPGM(PSTR(MSG_LP_4)); lcd_printPGM(PSTR(MSG_LP_4));
currentMenu = lcd_level_bed; currentMenu = lcd_level_bed;
ChangeScreen=false; ChangeScreen=false;
...@@ -741,7 +744,7 @@ void lcd_level_bed() ...@@ -741,7 +744,7 @@ void lcd_level_bed()
case 5: case 5:
{ {
lcd.setCursor(0, 1); u8g.setPrintPos(0, 1);
lcd_printPGM(PSTR(MSG_LP_5)); lcd_printPGM(PSTR(MSG_LP_5));
currentMenu = lcd_level_bed; currentMenu = lcd_level_bed;
ChangeScreen=false; ChangeScreen=false;
...@@ -751,14 +754,17 @@ void lcd_level_bed() ...@@ -751,14 +754,17 @@ void lcd_level_bed()
case 6: case 6:
{ {
lcd.setCursor(2, 2); u8g.setPrintPos(2, 2);
lcd_printPGM(PSTR(MSG_LP_6)); lcd_printPGM(PSTR(MSG_LP_6));
ChangeScreen=false; ChangeScreen=false;
delay(1200); delay(1200);
encoderPosition = 0; encoderPosition = 0;
<<<<<<< HEAD
lcd.clear(); lcd.clear();
=======
>>>>>>> parent of 3223901... Fix Power Consumation
currentMenu = lcd_status_screen; currentMenu = lcd_status_screen;
lcd_status_screen(); lcd_status_screen();
pageShowInfo=0; pageShowInfo=0;
......
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