Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 12a4d60e18 | |||
| 5a998558a9 | |||
| f6ff0ab767 | |||
| 5d471e0f34 | |||
| d3ebc34958 | |||
| b6ff45254e | |||
| 7e348fcb5f | |||
| 06b58a9c4f | |||
| 539f3b3fe4 | |||
| 2f20df3f55 | |||
| 65c9a0728f | |||
| ab9d183024 | |||
| f5631a89e8 | |||
| a4f9e1ebf2 | |||
| 2873d67b17 | |||
| a7e40b2903 | |||
| 23b0f8ed4b | |||
| 6ed02c86be | |||
| 2a67363e27 | |||
| 205304ddee | |||
| 58bca87c72 | |||
| febeb43197 | |||
| 8178dec4c3 | |||
| 70f57a6844 | |||
| ff14199e58 | |||
| bfdf0932c1 | |||
| 695938ba3f | |||
| cb02c2f9d8 | |||
| e4a5e333ef | |||
| e10d3136c8 | |||
| 9f089756b7 | |||
| 654387297f | |||
| 326423719f | |||
| d07b6e93d5 | |||
| efcc28d347 | |||
| cfc193cdac | |||
| 24bcc9647d | |||
| bc27d809fb | |||
| bf7e453d02 | |||
| 36a746d7d5 | |||
| 50daf27e5a | |||
| df09e2adce | |||
| ddf6603d81 | |||
| 4bf8b1aeee | |||
| 7afd202b89 | |||
| ebc4601185 | |||
| c0aad4c28a | |||
| d197f8504b | |||
| eb06a886c4 | |||
| 04631d2250 | |||
| 0a5ad3ab85 | |||
| 8ac5b29e02 | |||
| 0a31ccb1d1 | |||
| c6caa45ae2 | |||
| dc566d654f | |||
| ba898faa7d | |||
| 0152ee71a5 | |||
| 348d543425 | |||
| 6ccbfeb80c | |||
| c433142abf | |||
| 1d389ad3a8 | |||
| 5bfccab650 | |||
| 9698f4ea64 | |||
| 47d4f55bc0 | |||
| 6cd150842f | |||
| 299c18596f | |||
| d38b96fff1 |
+53
-5
@@ -11,6 +11,11 @@
|
|||||||
#define STRING_VERSION_CONFIG_H "2012-05-02" //Personal revision number for changes to THIS file.
|
#define STRING_VERSION_CONFIG_H "2012-05-02" //Personal revision number for changes to THIS file.
|
||||||
#define STRING_CONFIG_H_AUTHOR "erik" //Who made the changes.
|
#define STRING_CONFIG_H_AUTHOR "erik" //Who made the changes.
|
||||||
|
|
||||||
|
// SERIAL_PORT selects which serial port should be used for communication with the host.
|
||||||
|
// This allows the connection of wireless adapters (for instance) to non-default port pins.
|
||||||
|
// Serial port 0 is still used by the Arduino bootloader regardless of this setting.
|
||||||
|
#define SERIAL_PORT 0
|
||||||
|
|
||||||
// This determines the communication speed of the printer
|
// This determines the communication speed of the printer
|
||||||
#define BAUDRATE 250000
|
#define BAUDRATE 250000
|
||||||
//#define BAUDRATE 115200
|
//#define BAUDRATE 115200
|
||||||
@@ -30,6 +35,7 @@
|
|||||||
// Ultimaker = 7
|
// Ultimaker = 7
|
||||||
// Teensylu = 8
|
// Teensylu = 8
|
||||||
// Gen3+ =9
|
// Gen3+ =9
|
||||||
|
// Megatronics =70
|
||||||
|
|
||||||
#ifndef MOTHERBOARD
|
#ifndef MOTHERBOARD
|
||||||
#define MOTHERBOARD 7
|
#define MOTHERBOARD 7
|
||||||
@@ -98,7 +104,7 @@
|
|||||||
#define PID_MAX 255 // limits current to nozzle; 255=full current
|
#define PID_MAX 255 // limits current to nozzle; 255=full current
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
//#define PID_DEBUG // Sends debug data to the serial port.
|
//#define PID_DEBUG // Sends debug data to the serial port.
|
||||||
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104 sets the output power in %
|
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
|
||||||
#define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term
|
#define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term
|
||||||
#define K1 0.95 //smoothing factor withing the PID
|
#define K1 0.95 //smoothing factor withing the PID
|
||||||
#define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the
|
#define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the
|
||||||
@@ -120,6 +126,44 @@
|
|||||||
// #define DEFAULT_Kd 440
|
// #define DEFAULT_Kd 440
|
||||||
#endif // PIDTEMP
|
#endif // PIDTEMP
|
||||||
|
|
||||||
|
// Bed Temperature Control
|
||||||
|
// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
|
||||||
|
//
|
||||||
|
// uncomment this to enable PID on the bed. It uses the same ferquency PWM as the extruder.
|
||||||
|
// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
|
||||||
|
// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
|
||||||
|
// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
|
||||||
|
// If your configuration is significantly different than this and you don't understand the issues involved, you proabaly
|
||||||
|
// shouldn't use bed PID until someone else verifies your hardware works.
|
||||||
|
// If this is enabled, find your own PID constants below.
|
||||||
|
//#define PIDTEMPBED
|
||||||
|
//
|
||||||
|
//#define BED_LIMIT_SWITCHING
|
||||||
|
|
||||||
|
// This sets the max power delived to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
|
||||||
|
// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
|
||||||
|
// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
|
||||||
|
// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED)
|
||||||
|
#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
|
||||||
|
|
||||||
|
#ifdef PIDTEMPBED
|
||||||
|
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||||
|
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, argressive factor of .15 (vs .1, 1, 10)
|
||||||
|
#define DEFAULT_bedKp 10.00
|
||||||
|
#define DEFAULT_bedKi .023
|
||||||
|
#define DEFAULT_bedKd 305.4
|
||||||
|
|
||||||
|
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||||
|
//from pidautotune
|
||||||
|
// #define DEFAULT_bedKp 97.1
|
||||||
|
// #define DEFAULT_bedKi 1.41
|
||||||
|
// #define DEFAULT_bedKd 1675.16
|
||||||
|
|
||||||
|
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
|
||||||
|
#endif // PIDTEMPBED
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
|
//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
|
||||||
//can be software-disabled for whatever purposes by
|
//can be software-disabled for whatever purposes by
|
||||||
#define PREVENT_DANGEROUS_EXTRUDE
|
#define PREVENT_DANGEROUS_EXTRUDE
|
||||||
@@ -203,10 +247,14 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
|||||||
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
|
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
|
||||||
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
|
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
|
||||||
|
|
||||||
// The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
|
// The position of the homing switches
|
||||||
#define X_HOME_POS 0
|
//#define MANUAL_HOME_POSITIONS // If defined, manualy programed locations will be used
|
||||||
#define Y_HOME_POS 0
|
//#define BED_CENTER_AT_0_0 // If defined the center of the bed is defined as (0,0)
|
||||||
#define Z_HOME_POS 0
|
|
||||||
|
//Manual homing switch locations:
|
||||||
|
#define MANUAL_X_HOME_POS 0
|
||||||
|
#define MANUAL_Y_HOME_POS 0
|
||||||
|
#define MANUAL_Z_HOME_POS 0
|
||||||
|
|
||||||
//// MOVEMENT SETTINGS
|
//// MOVEMENT SETTINGS
|
||||||
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
|
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef CONFIG_STORE_H
|
||||||
|
#define CONFIG_STORE_H
|
||||||
|
|
||||||
|
#include "Configuration.h"
|
||||||
|
|
||||||
|
#ifdef EEPROM_SETTINGS
|
||||||
|
void Config_StoreSettings();
|
||||||
|
void Config_RetrieveSettings();
|
||||||
|
#else
|
||||||
|
FORCE_INLINE void Config_StoreSettings() {}
|
||||||
|
FORCE_INLINE void Config_RetrieveSettings() {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EEPROM_CHITCHAT
|
||||||
|
void Config_PrintSettings();
|
||||||
|
#else
|
||||||
|
FORCE_INLINE void Config_PrintSettings() {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Config_ResetDefault();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
+59
-14
@@ -5,13 +5,10 @@
|
|||||||
//=============================Thermal Settings ============================
|
//=============================Thermal Settings ============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
// Select one of these only to define how the bed temp is read.
|
|
||||||
//
|
|
||||||
//#define BED_LIMIT_SWITCHING
|
|
||||||
#ifdef BED_LIMIT_SWITCHING
|
#ifdef BED_LIMIT_SWITCHING
|
||||||
#define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
|
#define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
|
||||||
#endif
|
#endif
|
||||||
#define BED_CHECK_INTERVAL 5000 //ms
|
#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
|
||||||
|
|
||||||
//// Heating sanity check:
|
//// Heating sanity check:
|
||||||
// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
||||||
@@ -76,6 +73,54 @@
|
|||||||
|
|
||||||
#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
|
#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
|
||||||
|
|
||||||
|
|
||||||
|
//// AUTOSET LOCATIONS OF LIMIT SWITCHES
|
||||||
|
//// Added by ZetaPhoenix 09-15-2012
|
||||||
|
#ifdef MANUAL_HOME_POSITION //Use manual limit switch locations
|
||||||
|
#define X_HOME_POS MANUAL_X_HOME_POS
|
||||||
|
#define Y_HOME_POS MANUAL_Y_HOME_POS
|
||||||
|
#define Z_HOME_POS MANUAL_Z_HOME_POS
|
||||||
|
#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
|
||||||
|
//X axis
|
||||||
|
#if X_HOME_DIR == -1
|
||||||
|
#ifdef BED_CENTER_AT_0_0
|
||||||
|
#define X_HOME_POS X_MAX_LENGTH * -0.5
|
||||||
|
#else
|
||||||
|
#define X_HOME_POS X_MIN_POS
|
||||||
|
#endif //BED_CENTER_AT_0_0
|
||||||
|
#else
|
||||||
|
#ifdef BED_CENTER_AT_0_0
|
||||||
|
#define X_HOME_POS X_MAX_LENGTH * 0.5
|
||||||
|
#else
|
||||||
|
#define X_HOME_POS X_MAX_POS
|
||||||
|
#endif //BED_CENTER_AT_0_0
|
||||||
|
#endif //X_HOME_DIR == -1
|
||||||
|
|
||||||
|
//Y axis
|
||||||
|
#if Y_HOME_DIR == -1
|
||||||
|
#ifdef BED_CENTER_AT_0_0
|
||||||
|
#define Y_HOME_POS Y_MAX_LENGTH * -0.5
|
||||||
|
#else
|
||||||
|
#define Y_HOME_POS Y_MIN_POS
|
||||||
|
#endif //BED_CENTER_AT_0_0
|
||||||
|
#else
|
||||||
|
#ifdef BED_CENTER_AT_0_0
|
||||||
|
#define Y_HOME_POS Y_MAX_LENGTH * 0.5
|
||||||
|
#else
|
||||||
|
#define Y_HOME_POS Y_MAX_POS
|
||||||
|
#endif //BED_CENTER_AT_0_0
|
||||||
|
#endif //Y_HOME_DIR == -1
|
||||||
|
|
||||||
|
// Z axis
|
||||||
|
#if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
|
||||||
|
#define Z_HOME_POS Z_MIN_POS
|
||||||
|
#else
|
||||||
|
#define Z_HOME_POS Z_MAX_POS
|
||||||
|
#endif //Z_HOME_DIR == -1
|
||||||
|
#endif //End auto min/max positions
|
||||||
|
//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
|
||||||
|
|
||||||
|
|
||||||
//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
|
//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
|
||||||
|
|
||||||
// A single Z stepper driver is usually used to drive 2 stepper motors.
|
// A single Z stepper driver is usually used to drive 2 stepper motors.
|
||||||
@@ -134,17 +179,17 @@
|
|||||||
|
|
||||||
|
|
||||||
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
|
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
|
||||||
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // no z because of layer shift.
|
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
|
||||||
|
|
||||||
// The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However:
|
// The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
|
||||||
// the Watchdog is not working well, so please only enable this for testing
|
|
||||||
// this enables the watchdog interrupt.
|
|
||||||
//#define USE_WATCHDOG
|
//#define USE_WATCHDOG
|
||||||
//#ifdef USE_WATCHDOG
|
|
||||||
// you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
|
#ifdef USE_WATCHDOG
|
||||||
//#define RESET_MANUAL
|
// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
|
||||||
//#define WATCHDOG_TIMEOUT 4 //seconds
|
// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
|
||||||
//#endif
|
// However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
|
||||||
|
//#define WATCHDOG_RESET_MANUAL
|
||||||
|
#endif
|
||||||
|
|
||||||
// extruder advance constant (s2/mm3)
|
// extruder advance constant (s2/mm3)
|
||||||
//
|
//
|
||||||
@@ -169,7 +214,7 @@
|
|||||||
#define MM_PER_ARC_SEGMENT 1
|
#define MM_PER_ARC_SEGMENT 1
|
||||||
#define N_ARC_CORRECTION 25
|
#define N_ARC_CORRECTION 25
|
||||||
|
|
||||||
const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
|
const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
|
||||||
|
|
||||||
// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
|
// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
|
||||||
// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
|
// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
|
||||||
|
|||||||
@@ -1,232 +0,0 @@
|
|||||||
#ifndef EEPROM_H
|
|
||||||
#define EEPROM_H
|
|
||||||
|
|
||||||
#include "Marlin.h"
|
|
||||||
#include "planner.h"
|
|
||||||
#include "temperature.h"
|
|
||||||
//#include <EEPROM.h>
|
|
||||||
|
|
||||||
int plaPreheatHotendTemp;
|
|
||||||
int plaPreheatHPBTemp;
|
|
||||||
int plaPreheatFanSpeed;
|
|
||||||
|
|
||||||
int absPreheatHotendTemp;
|
|
||||||
int absPreheatHPBTemp;
|
|
||||||
int absPreheatFanSpeed;
|
|
||||||
|
|
||||||
template <class T> int EEPROM_writeAnything(int &ee, const T& value)
|
|
||||||
{
|
|
||||||
const byte* p = (const byte*)(const void*)&value;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < (int)sizeof(value); i++)
|
|
||||||
eeprom_write_byte((unsigned char *)ee++, *p++);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> int EEPROM_readAnything(int &ee, T& value)
|
|
||||||
{
|
|
||||||
byte* p = (byte*)(void*)&value;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < (int)sizeof(value); i++)
|
|
||||||
*p++ = eeprom_read_byte((unsigned char *)ee++);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
//======================================================================================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define EEPROM_OFFSET 100
|
|
||||||
|
|
||||||
|
|
||||||
// IMPORTANT: Whenever there are changes made to the variables stored in EEPROM
|
|
||||||
// in the functions below, also increment the version number. This makes sure that
|
|
||||||
// the default values are used whenever there is a change to the data, to prevent
|
|
||||||
// wrong data being written to the variables.
|
|
||||||
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
|
|
||||||
#define EEPROM_VERSION "V07"
|
|
||||||
|
|
||||||
inline void EEPROM_StoreSettings()
|
|
||||||
{
|
|
||||||
#ifdef EEPROM_SETTINGS
|
|
||||||
char ver[4]= "000";
|
|
||||||
int i=EEPROM_OFFSET;
|
|
||||||
EEPROM_writeAnything(i,ver); // invalidate data first
|
|
||||||
EEPROM_writeAnything(i,axis_steps_per_unit);
|
|
||||||
EEPROM_writeAnything(i,max_feedrate);
|
|
||||||
EEPROM_writeAnything(i,max_acceleration_units_per_sq_second);
|
|
||||||
EEPROM_writeAnything(i,acceleration);
|
|
||||||
EEPROM_writeAnything(i,retract_acceleration);
|
|
||||||
EEPROM_writeAnything(i,minimumfeedrate);
|
|
||||||
EEPROM_writeAnything(i,mintravelfeedrate);
|
|
||||||
EEPROM_writeAnything(i,minsegmenttime);
|
|
||||||
EEPROM_writeAnything(i,max_xy_jerk);
|
|
||||||
EEPROM_writeAnything(i,max_z_jerk);
|
|
||||||
EEPROM_writeAnything(i,max_e_jerk);
|
|
||||||
EEPROM_writeAnything(i,add_homeing);
|
|
||||||
EEPROM_writeAnything(i,plaPreheatHotendTemp);
|
|
||||||
EEPROM_writeAnything(i,plaPreheatHPBTemp);
|
|
||||||
EEPROM_writeAnything(i,plaPreheatFanSpeed);
|
|
||||||
EEPROM_writeAnything(i,absPreheatHotendTemp);
|
|
||||||
EEPROM_writeAnything(i,absPreheatHPBTemp);
|
|
||||||
EEPROM_writeAnything(i,absPreheatFanSpeed);
|
|
||||||
#ifdef PIDTEMP
|
|
||||||
EEPROM_writeAnything(i,Kp);
|
|
||||||
EEPROM_writeAnything(i,Ki);
|
|
||||||
EEPROM_writeAnything(i,Kd);
|
|
||||||
#else
|
|
||||||
EEPROM_writeAnything(i,3000);
|
|
||||||
EEPROM_writeAnything(i,0);
|
|
||||||
EEPROM_writeAnything(i,0);
|
|
||||||
#endif
|
|
||||||
char ver2[4]=EEPROM_VERSION;
|
|
||||||
i=EEPROM_OFFSET;
|
|
||||||
EEPROM_writeAnything(i,ver2); // validate data
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Settings Stored");
|
|
||||||
#endif //EEPROM_SETTINGS
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void EEPROM_printSettings()
|
|
||||||
{ // if def=true, the default values will be used
|
|
||||||
// #ifdef EEPROM_SETTINGS
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Steps per unit:");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[0]);
|
|
||||||
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[1]);
|
|
||||||
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[2]);
|
|
||||||
SERIAL_ECHOPAIR(" E",axis_steps_per_unit[3]);
|
|
||||||
SERIAL_ECHOLN("");
|
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOPAIR(" M203 X",max_feedrate[0]);
|
|
||||||
SERIAL_ECHOPAIR(" Y",max_feedrate[1] );
|
|
||||||
SERIAL_ECHOPAIR(" Z", max_feedrate[2] );
|
|
||||||
SERIAL_ECHOPAIR(" E", max_feedrate[3]);
|
|
||||||
SERIAL_ECHOLN("");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOPAIR(" M201 X" ,max_acceleration_units_per_sq_second[0] );
|
|
||||||
SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[1] );
|
|
||||||
SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[2] );
|
|
||||||
SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[3]);
|
|
||||||
SERIAL_ECHOLN("");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOPAIR(" M204 S",acceleration );
|
|
||||||
SERIAL_ECHOPAIR(" T" ,retract_acceleration);
|
|
||||||
SERIAL_ECHOLN("");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum xY jerk (mm/s), Z=maximum Z jerk (mm/s)");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOPAIR(" M205 S",minimumfeedrate );
|
|
||||||
SERIAL_ECHOPAIR(" T" ,mintravelfeedrate );
|
|
||||||
SERIAL_ECHOPAIR(" B" ,minsegmenttime );
|
|
||||||
SERIAL_ECHOPAIR(" X" ,max_xy_jerk );
|
|
||||||
SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
|
|
||||||
SERIAL_ECHOPAIR(" E" ,max_e_jerk);
|
|
||||||
SERIAL_ECHOLN("");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Home offset (mm):");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOPAIR(" M206 X",add_homeing[0] );
|
|
||||||
SERIAL_ECHOPAIR(" Y" ,add_homeing[1] );
|
|
||||||
SERIAL_ECHOPAIR(" Z" ,add_homeing[2] );
|
|
||||||
SERIAL_ECHOLN("");
|
|
||||||
#ifdef PIDTEMP
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("PID settings:");
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOPAIR(" M301 P",Kp);
|
|
||||||
SERIAL_ECHOPAIR(" I" ,Ki/PID_dT);
|
|
||||||
SERIAL_ECHOPAIR(" D" ,Kd*PID_dT);
|
|
||||||
SERIAL_ECHOLN("");
|
|
||||||
#endif
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void EEPROM_RetrieveSettings(bool def=false)
|
|
||||||
{ // if def=true, the default values will be used
|
|
||||||
#ifdef EEPROM_SETTINGS
|
|
||||||
int i=EEPROM_OFFSET;
|
|
||||||
char stored_ver[4];
|
|
||||||
char ver[4]=EEPROM_VERSION;
|
|
||||||
EEPROM_readAnything(i,stored_ver); //read stored version
|
|
||||||
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
|
|
||||||
if ((!def)&&(strncmp(ver,stored_ver,3)==0))
|
|
||||||
{ // version number match
|
|
||||||
EEPROM_readAnything(i,axis_steps_per_unit);
|
|
||||||
EEPROM_readAnything(i,max_feedrate);
|
|
||||||
EEPROM_readAnything(i,max_acceleration_units_per_sq_second);
|
|
||||||
EEPROM_readAnything(i,acceleration);
|
|
||||||
EEPROM_readAnything(i,retract_acceleration);
|
|
||||||
EEPROM_readAnything(i,minimumfeedrate);
|
|
||||||
EEPROM_readAnything(i,mintravelfeedrate);
|
|
||||||
EEPROM_readAnything(i,minsegmenttime);
|
|
||||||
EEPROM_readAnything(i,max_xy_jerk);
|
|
||||||
EEPROM_readAnything(i,max_z_jerk);
|
|
||||||
EEPROM_readAnything(i,max_e_jerk);
|
|
||||||
EEPROM_readAnything(i,add_homeing);
|
|
||||||
EEPROM_readAnything(i,plaPreheatHotendTemp);
|
|
||||||
EEPROM_readAnything(i,plaPreheatHPBTemp);
|
|
||||||
EEPROM_readAnything(i,plaPreheatFanSpeed);
|
|
||||||
EEPROM_readAnything(i,absPreheatHotendTemp);
|
|
||||||
EEPROM_readAnything(i,absPreheatHPBTemp);
|
|
||||||
EEPROM_readAnything(i,absPreheatFanSpeed);
|
|
||||||
#ifndef PIDTEMP
|
|
||||||
float Kp,Ki,Kd;
|
|
||||||
#endif
|
|
||||||
EEPROM_readAnything(i,Kp);
|
|
||||||
EEPROM_readAnything(i,Ki);
|
|
||||||
EEPROM_readAnything(i,Kd);
|
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM("Stored settings retreived:");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
float tmp1[]=DEFAULT_AXIS_STEPS_PER_UNIT;
|
|
||||||
float tmp2[]=DEFAULT_MAX_FEEDRATE;
|
|
||||||
long tmp3[]=DEFAULT_MAX_ACCELERATION;
|
|
||||||
for (short i=0;i<4;i++)
|
|
||||||
{
|
|
||||||
axis_steps_per_unit[i]=tmp1[i];
|
|
||||||
max_feedrate[i]=tmp2[i];
|
|
||||||
max_acceleration_units_per_sq_second[i]=tmp3[i];
|
|
||||||
}
|
|
||||||
acceleration=DEFAULT_ACCELERATION;
|
|
||||||
retract_acceleration=DEFAULT_RETRACT_ACCELERATION;
|
|
||||||
minimumfeedrate=DEFAULT_MINIMUMFEEDRATE;
|
|
||||||
minsegmenttime=DEFAULT_MINSEGMENTTIME;
|
|
||||||
mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE;
|
|
||||||
max_xy_jerk=DEFAULT_XYJERK;
|
|
||||||
max_z_jerk=DEFAULT_ZJERK;
|
|
||||||
max_e_jerk=DEFAULT_EJERK;
|
|
||||||
add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLN("Using Default settings:");
|
|
||||||
#ifdef ULTIPANEL
|
|
||||||
plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
|
|
||||||
plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP;
|
|
||||||
plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
|
|
||||||
absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP;
|
|
||||||
absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP;
|
|
||||||
absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef EEPROM_CHITCHAT
|
|
||||||
EEPROM_printSettings();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,389 @@
|
|||||||
|
#include "LiquidCrystalRus.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
|
#if defined(ARDUINO) && ARDUINO >= 100
|
||||||
|
#include "Arduino.h"
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// it is a russian alphabet translation
|
||||||
|
// except 0401 --> 0xa2 = ╗, 0451 --> 0xb5
|
||||||
|
const PROGMEM uint8_t utf_recode[] =
|
||||||
|
{ 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
|
||||||
|
0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
|
||||||
|
0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,
|
||||||
|
0xbe,0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0,0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7
|
||||||
|
};
|
||||||
|
|
||||||
|
// When the display powers up, it is configured as follows:
|
||||||
|
//
|
||||||
|
// 1. Display clear
|
||||||
|
// 2. Function set:
|
||||||
|
// DL = 1; 8-bit interface data
|
||||||
|
// N = 0; 1-line display
|
||||||
|
// F = 0; 5x8 dot character font
|
||||||
|
// 3. Display on/off control:
|
||||||
|
// D = 0; Display off
|
||||||
|
// C = 0; Cursor off
|
||||||
|
// B = 0; Blinking off
|
||||||
|
// 4. Entry mode set:
|
||||||
|
// I/D = 1; Increment by 1
|
||||||
|
// S = 0; No shift
|
||||||
|
//
|
||||||
|
// Note, however, that resetting the Arduino doesn't reset the LCD, so we
|
||||||
|
// can't assume that its in that state when a sketch starts (and the
|
||||||
|
// LiquidCrystal constructor is called).
|
||||||
|
//
|
||||||
|
// modified 27 Jul 2011
|
||||||
|
// by Ilya V. Danilov http://mk90.ru/
|
||||||
|
|
||||||
|
|
||||||
|
LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
|
||||||
|
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
|
||||||
|
{
|
||||||
|
init(0, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7);
|
||||||
|
}
|
||||||
|
|
||||||
|
LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
|
||||||
|
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
|
||||||
|
{
|
||||||
|
init(0, rs, 255, enable, d0, d1, d2, d3, d4, d5, d6, d7);
|
||||||
|
}
|
||||||
|
|
||||||
|
LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
|
||||||
|
{
|
||||||
|
init(1, rs, rw, enable, d0, d1, d2, d3, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
|
||||||
|
{
|
||||||
|
init(1, rs, 255, enable, d0, d1, d2, d3, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LiquidCrystalRus::init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
|
||||||
|
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
|
||||||
|
{
|
||||||
|
_rs_pin = rs;
|
||||||
|
_rw_pin = rw;
|
||||||
|
_enable_pin = enable;
|
||||||
|
|
||||||
|
_data_pins[0] = d0;
|
||||||
|
_data_pins[1] = d1;
|
||||||
|
_data_pins[2] = d2;
|
||||||
|
_data_pins[3] = d3;
|
||||||
|
_data_pins[4] = d4;
|
||||||
|
_data_pins[5] = d5;
|
||||||
|
_data_pins[6] = d6;
|
||||||
|
_data_pins[7] = d7;
|
||||||
|
|
||||||
|
pinMode(_rs_pin, OUTPUT);
|
||||||
|
// we can save 1 pin by not using RW. Indicate by passing 255 instead of pin#
|
||||||
|
if (_rw_pin != 255) {
|
||||||
|
pinMode(_rw_pin, OUTPUT);
|
||||||
|
}
|
||||||
|
pinMode(_enable_pin, OUTPUT);
|
||||||
|
|
||||||
|
if (fourbitmode)
|
||||||
|
_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
|
||||||
|
else
|
||||||
|
_displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS;
|
||||||
|
|
||||||
|
begin(16, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LiquidCrystalRus::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
|
||||||
|
if (lines > 1) {
|
||||||
|
_displayfunction |= LCD_2LINE;
|
||||||
|
}
|
||||||
|
_numlines = lines;
|
||||||
|
_currline = 0;
|
||||||
|
|
||||||
|
// for some 1 line displays you can select a 10 pixel high font
|
||||||
|
if ((dotsize != 0) && (lines == 1)) {
|
||||||
|
_displayfunction |= LCD_5x10DOTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
|
||||||
|
// according to datasheet, we need at least 40ms after power rises above 2.7V
|
||||||
|
// before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50
|
||||||
|
delayMicroseconds(50000);
|
||||||
|
// Now we pull both RS and R/W low to begin commands
|
||||||
|
digitalWrite(_rs_pin, LOW);
|
||||||
|
digitalWrite(_enable_pin, LOW);
|
||||||
|
if (_rw_pin != 255) {
|
||||||
|
digitalWrite(_rw_pin, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
//put the LCD into 4 bit or 8 bit mode
|
||||||
|
if (! (_displayfunction & LCD_8BITMODE)) {
|
||||||
|
// this is according to the hitachi HD44780 datasheet
|
||||||
|
// figure 24, pg 46
|
||||||
|
|
||||||
|
// we start in 8bit mode, try to set 4 bit mode
|
||||||
|
writeNbits(0x03,4);
|
||||||
|
delayMicroseconds(4500); // wait min 4.1ms
|
||||||
|
|
||||||
|
// second try
|
||||||
|
writeNbits(0x03,4);
|
||||||
|
delayMicroseconds(4500); // wait min 4.1ms
|
||||||
|
|
||||||
|
// third go!
|
||||||
|
writeNbits(0x03,4);
|
||||||
|
delayMicroseconds(150);
|
||||||
|
|
||||||
|
// finally, set to 8-bit interface
|
||||||
|
writeNbits(0x02,4);
|
||||||
|
} else {
|
||||||
|
// this is according to the hitachi HD44780 datasheet
|
||||||
|
// page 45 figure 23
|
||||||
|
|
||||||
|
// Send function set command sequence
|
||||||
|
command(LCD_FUNCTIONSET | _displayfunction);
|
||||||
|
delayMicroseconds(4500); // wait more than 4.1ms
|
||||||
|
|
||||||
|
// second try
|
||||||
|
command(LCD_FUNCTIONSET | _displayfunction);
|
||||||
|
delayMicroseconds(150);
|
||||||
|
|
||||||
|
// third go
|
||||||
|
command(LCD_FUNCTIONSET | _displayfunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
// finally, set # lines, font size, etc.
|
||||||
|
command(LCD_FUNCTIONSET | _displayfunction);
|
||||||
|
|
||||||
|
// turn the display on with no cursor or blinking default
|
||||||
|
_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
|
||||||
|
display();
|
||||||
|
|
||||||
|
// clear it off
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Initialize to default text direction (for romance languages)
|
||||||
|
_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
|
||||||
|
// set the entry mode
|
||||||
|
command(LCD_ENTRYMODESET | _displaymode);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LiquidCrystalRus::setDRAMModel(uint8_t model) {
|
||||||
|
_dram_model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/********** high level commands, for the user! */
|
||||||
|
void LiquidCrystalRus::clear()
|
||||||
|
{
|
||||||
|
command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero
|
||||||
|
delayMicroseconds(2000); // this command takes a long time!
|
||||||
|
}
|
||||||
|
|
||||||
|
void LiquidCrystalRus::home()
|
||||||
|
{
|
||||||
|
command(LCD_RETURNHOME); // set cursor position to zero
|
||||||
|
delayMicroseconds(2000); // this command takes a long time!
|
||||||
|
}
|
||||||
|
|
||||||
|
void LiquidCrystalRus::setCursor(uint8_t col, uint8_t row)
|
||||||
|
{
|
||||||
|
int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
|
||||||
|
if ( row >= _numlines ) {
|
||||||
|
row = _numlines-1; // we count rows starting w/0
|
||||||
|
}
|
||||||
|
|
||||||
|
command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn the display on/off (quickly)
|
||||||
|
void LiquidCrystalRus::noDisplay() {
|
||||||
|
_displaycontrol &= ~LCD_DISPLAYON;
|
||||||
|
command(LCD_DISPLAYCONTROL | _displaycontrol);
|
||||||
|
}
|
||||||
|
void LiquidCrystalRus::display() {
|
||||||
|
_displaycontrol |= LCD_DISPLAYON;
|
||||||
|
command(LCD_DISPLAYCONTROL | _displaycontrol);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turns the underline cursor on/off
|
||||||
|
void LiquidCrystalRus::noCursor() {
|
||||||
|
_displaycontrol &= ~LCD_CURSORON;
|
||||||
|
command(LCD_DISPLAYCONTROL | _displaycontrol);
|
||||||
|
}
|
||||||
|
void LiquidCrystalRus::cursor() {
|
||||||
|
_displaycontrol |= LCD_CURSORON;
|
||||||
|
command(LCD_DISPLAYCONTROL | _displaycontrol);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn on and off the blinking cursor
|
||||||
|
void LiquidCrystalRus::noBlink() {
|
||||||
|
_displaycontrol &= ~LCD_BLINKON;
|
||||||
|
command(LCD_DISPLAYCONTROL | _displaycontrol);
|
||||||
|
}
|
||||||
|
void LiquidCrystalRus::blink() {
|
||||||
|
_displaycontrol |= LCD_BLINKON;
|
||||||
|
command(LCD_DISPLAYCONTROL | _displaycontrol);
|
||||||
|
}
|
||||||
|
|
||||||
|
// These commands scroll the display without changing the RAM
|
||||||
|
void LiquidCrystalRus::scrollDisplayLeft(void) {
|
||||||
|
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
|
||||||
|
}
|
||||||
|
void LiquidCrystalRus::scrollDisplayRight(void) {
|
||||||
|
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is for text that flows Left to Right
|
||||||
|
void LiquidCrystalRus::leftToRight(void) {
|
||||||
|
_displaymode |= LCD_ENTRYLEFT;
|
||||||
|
command(LCD_ENTRYMODESET | _displaymode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is for text that flows Right to Left
|
||||||
|
void LiquidCrystalRus::rightToLeft(void) {
|
||||||
|
_displaymode &= ~LCD_ENTRYLEFT;
|
||||||
|
command(LCD_ENTRYMODESET | _displaymode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will 'right justify' text from the cursor
|
||||||
|
void LiquidCrystalRus::autoscroll(void) {
|
||||||
|
_displaymode |= LCD_ENTRYSHIFTINCREMENT;
|
||||||
|
command(LCD_ENTRYMODESET | _displaymode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will 'left justify' text from the cursor
|
||||||
|
void LiquidCrystalRus::noAutoscroll(void) {
|
||||||
|
_displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
|
||||||
|
command(LCD_ENTRYMODESET | _displaymode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allows us to fill the first 8 CGRAM locations
|
||||||
|
// with custom characters
|
||||||
|
void LiquidCrystalRus::createChar(uint8_t location, uint8_t charmap[]) {
|
||||||
|
location &= 0x7; // we only have 8 locations 0-7
|
||||||
|
command(LCD_SETCGRAMADDR | (location << 3));
|
||||||
|
for (int i=0; i<8; i++) {
|
||||||
|
write(charmap[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********** mid level commands, for sending data/cmds */
|
||||||
|
|
||||||
|
inline void LiquidCrystalRus::command(uint8_t value) {
|
||||||
|
send(value, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(ARDUINO) && ARDUINO >= 100
|
||||||
|
size_t LiquidCrystalRus::write(uint8_t value)
|
||||||
|
#else
|
||||||
|
void LiquidCrystalRus::write(uint8_t value)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
uint8_t out_char=value;
|
||||||
|
|
||||||
|
if (_dram_model == LCD_DRAM_WH1601) {
|
||||||
|
uint8_t ac=recv(LOW) & 0x7f;
|
||||||
|
if (ac>7 && ac<0x14) command(LCD_SETDDRAMADDR | (0x40+ac-8));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value>=0x80) { // UTF-8 handling
|
||||||
|
if (value >= 0xc0) {
|
||||||
|
utf_hi_char = value - 0xd0;
|
||||||
|
} else {
|
||||||
|
value &= 0x3f;
|
||||||
|
if (!utf_hi_char && (value == 1))
|
||||||
|
send(0xa2,HIGH); // ╗
|
||||||
|
else if ((utf_hi_char == 1) && (value == 0x11))
|
||||||
|
send(0xb5,HIGH); // ╦
|
||||||
|
else
|
||||||
|
send(pgm_read_byte_near(utf_recode + value + (utf_hi_char<<6) - 0x10), HIGH);
|
||||||
|
}
|
||||||
|
} else send(out_char, HIGH);
|
||||||
|
#if defined(ARDUINO) && ARDUINO >= 100
|
||||||
|
return 1; // assume sucess
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/************ low level data pushing commands **********/
|
||||||
|
|
||||||
|
// write either command or data, with automatic 4/8-bit selection
|
||||||
|
void LiquidCrystalRus::send(uint8_t value, uint8_t mode) {
|
||||||
|
digitalWrite(_rs_pin, mode);
|
||||||
|
|
||||||
|
// if there is a RW pin indicated, set it low to Write
|
||||||
|
if (_rw_pin != 255) {
|
||||||
|
digitalWrite(_rw_pin, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_displayfunction & LCD_8BITMODE) {
|
||||||
|
writeNbits(value,8);
|
||||||
|
} else {
|
||||||
|
writeNbits(value>>4,4);
|
||||||
|
writeNbits(value,4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// read data, with automatic 4/8-bit selection
|
||||||
|
uint8_t LiquidCrystalRus::recv(uint8_t mode) {
|
||||||
|
uint8_t retval;
|
||||||
|
digitalWrite(_rs_pin, mode);
|
||||||
|
|
||||||
|
// if there is a RW pin indicated, set it low to Write
|
||||||
|
if (_rw_pin != 255) {
|
||||||
|
digitalWrite(_rw_pin, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_displayfunction & LCD_8BITMODE) {
|
||||||
|
retval = readNbits(8);
|
||||||
|
} else {
|
||||||
|
retval = readNbits(4) << 4;
|
||||||
|
retval |= readNbits(4);
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
void LiquidCrystalRus::pulseEnable() {
|
||||||
|
digitalWrite(_enable_pin, LOW);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
digitalWrite(_enable_pin, HIGH);
|
||||||
|
delayMicroseconds(1); // enable pulse must be >450ns
|
||||||
|
digitalWrite(_enable_pin, LOW);
|
||||||
|
delayMicroseconds(100); // commands need > 37us to settle
|
||||||
|
}
|
||||||
|
|
||||||
|
void LiquidCrystalRus::writeNbits(uint8_t value, uint8_t n) {
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
pinMode(_data_pins[i], OUTPUT);
|
||||||
|
digitalWrite(_data_pins[i], (value >> i) & 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
pulseEnable();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t LiquidCrystalRus::readNbits(uint8_t n) {
|
||||||
|
uint8_t retval=0;
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
pinMode(_data_pins[i], INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalWrite(_enable_pin, LOW);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
digitalWrite(_enable_pin, HIGH);
|
||||||
|
delayMicroseconds(1); // enable pulse must be >450ns
|
||||||
|
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
retval |= (digitalRead(_data_pins[i]) == HIGH)?(1 << i):0;
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalWrite(_enable_pin, LOW);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
//
|
||||||
|
// based on LiquidCrystal library from ArduinoIDE, see http://arduino.cc
|
||||||
|
// modified 27 Jul 2011
|
||||||
|
// by Ilya V. Danilov http://mk90.ru/
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef LiquidCrystalRus_h
|
||||||
|
#define LiquidCrystalRus_h
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include "Print.h"
|
||||||
|
|
||||||
|
// commands
|
||||||
|
#define LCD_CLEARDISPLAY 0x01
|
||||||
|
#define LCD_RETURNHOME 0x02
|
||||||
|
#define LCD_ENTRYMODESET 0x04
|
||||||
|
#define LCD_DISPLAYCONTROL 0x08
|
||||||
|
#define LCD_CURSORSHIFT 0x10
|
||||||
|
#define LCD_FUNCTIONSET 0x20
|
||||||
|
#define LCD_SETCGRAMADDR 0x40
|
||||||
|
#define LCD_SETDDRAMADDR 0x80
|
||||||
|
|
||||||
|
// flags for display entry mode
|
||||||
|
#define LCD_ENTRYRIGHT 0x00
|
||||||
|
#define LCD_ENTRYLEFT 0x02
|
||||||
|
#define LCD_ENTRYSHIFTINCREMENT 0x01
|
||||||
|
#define LCD_ENTRYSHIFTDECREMENT 0x00
|
||||||
|
|
||||||
|
// flags for display on/off control
|
||||||
|
#define LCD_DISPLAYON 0x04
|
||||||
|
#define LCD_DISPLAYOFF 0x00
|
||||||
|
#define LCD_CURSORON 0x02
|
||||||
|
#define LCD_CURSOROFF 0x00
|
||||||
|
#define LCD_BLINKON 0x01
|
||||||
|
#define LCD_BLINKOFF 0x00
|
||||||
|
|
||||||
|
// flags for display/cursor shift
|
||||||
|
#define LCD_DISPLAYMOVE 0x08
|
||||||
|
#define LCD_CURSORMOVE 0x00
|
||||||
|
#define LCD_MOVERIGHT 0x04
|
||||||
|
#define LCD_MOVELEFT 0x00
|
||||||
|
|
||||||
|
// flags for function set
|
||||||
|
#define LCD_8BITMODE 0x10
|
||||||
|
#define LCD_4BITMODE 0x00
|
||||||
|
#define LCD_2LINE 0x08
|
||||||
|
#define LCD_1LINE 0x00
|
||||||
|
#define LCD_5x10DOTS 0x04
|
||||||
|
#define LCD_5x8DOTS 0x00
|
||||||
|
|
||||||
|
// enum for
|
||||||
|
#define LCD_DRAM_Normal 0x00
|
||||||
|
#define LCD_DRAM_WH1601 0x01
|
||||||
|
|
||||||
|
|
||||||
|
class LiquidCrystalRus : public Print {
|
||||||
|
public:
|
||||||
|
LiquidCrystalRus(uint8_t rs, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
|
||||||
|
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
|
||||||
|
LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
|
||||||
|
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
|
||||||
|
LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
|
||||||
|
LiquidCrystalRus(uint8_t rs, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
|
||||||
|
|
||||||
|
void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
|
||||||
|
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
|
||||||
|
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
|
||||||
|
|
||||||
|
void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void home();
|
||||||
|
|
||||||
|
void noDisplay();
|
||||||
|
void display();
|
||||||
|
void noBlink();
|
||||||
|
void blink();
|
||||||
|
void noCursor();
|
||||||
|
void cursor();
|
||||||
|
void scrollDisplayLeft();
|
||||||
|
void scrollDisplayRight();
|
||||||
|
void leftToRight();
|
||||||
|
void rightToLeft();
|
||||||
|
void autoscroll();
|
||||||
|
void noAutoscroll();
|
||||||
|
|
||||||
|
void createChar(uint8_t, uint8_t[]);
|
||||||
|
void setCursor(uint8_t, uint8_t);
|
||||||
|
|
||||||
|
#if defined(ARDUINO) && ARDUINO >= 100
|
||||||
|
virtual size_t write(uint8_t);
|
||||||
|
using Print::write;
|
||||||
|
#else
|
||||||
|
virtual void write(uint8_t);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void command(uint8_t);
|
||||||
|
|
||||||
|
void setDRAMModel(uint8_t);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void send(uint8_t, uint8_t);
|
||||||
|
void writeNbits(uint8_t, uint8_t);
|
||||||
|
uint8_t recv(uint8_t);
|
||||||
|
uint8_t readNbits(uint8_t);
|
||||||
|
void pulseEnable();
|
||||||
|
|
||||||
|
uint8_t _rs_pin; // LOW: command. HIGH: character.
|
||||||
|
uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD.
|
||||||
|
uint8_t _enable_pin; // activated by a HIGH pulse.
|
||||||
|
uint8_t _data_pins[8];
|
||||||
|
|
||||||
|
uint8_t _displayfunction;
|
||||||
|
uint8_t _displaycontrol;
|
||||||
|
uint8_t _displaymode;
|
||||||
|
|
||||||
|
uint8_t _initialized;
|
||||||
|
|
||||||
|
uint8_t _numlines,_currline;
|
||||||
|
|
||||||
|
uint8_t _dram_model;
|
||||||
|
uint8_t utf_hi_char; // UTF-8 high part
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -277,6 +277,10 @@ applet/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
|
|||||||
$(Pecho) " CC $@"
|
$(Pecho) " CC $@"
|
||||||
$P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
|
$P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
applet/%.o: applet/%.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
|
||||||
|
$(Pecho) " CXX $@"
|
||||||
|
$P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
applet/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
|
applet/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
|
||||||
$(Pecho) " CXX $@"
|
$(Pecho) " CXX $@"
|
||||||
$P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
|
$P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
|
||||||
|
|||||||
+6
-16
@@ -17,8 +17,7 @@
|
|||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
#include <avr/wdt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
@@ -52,22 +51,11 @@
|
|||||||
#define MYSERIAL MSerial
|
#define MYSERIAL MSerial
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//this is a unfinsihed attemp to removes a lot of warning messages, see:
|
|
||||||
// http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011
|
|
||||||
//typedef char prog_char PROGMEM;
|
|
||||||
// //#define PSTR (s ) ((const PROGMEM char *)(s))
|
|
||||||
// //# define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];}))
|
|
||||||
// //#define MYPGM(s) ((const prog_char *g PROGMEM=s))
|
|
||||||
#define MYPGM(s) PSTR(s)
|
|
||||||
//#define MYPGM(s) (__extension__({static char __c[] __attribute__((__progmem__)) = (s); &__c[0];})) //This is the normal behaviour
|
|
||||||
//#define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) //this does not work but hides the warnings
|
|
||||||
|
|
||||||
|
|
||||||
#define SERIAL_PROTOCOL(x) MYSERIAL.print(x);
|
#define SERIAL_PROTOCOL(x) MYSERIAL.print(x);
|
||||||
#define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y);
|
#define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y);
|
||||||
#define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
|
#define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x));
|
||||||
#define SERIAL_PROTOCOLLN(x) {MYSERIAL.print(x);MYSERIAL.write('\n');}
|
#define SERIAL_PROTOCOLLN(x) {MYSERIAL.print(x);MYSERIAL.write('\n');}
|
||||||
#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MYSERIAL.write('\n');}
|
#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(PSTR(x));MYSERIAL.write('\n');}
|
||||||
|
|
||||||
|
|
||||||
const char errormagic[] PROGMEM ="Error:";
|
const char errormagic[] PROGMEM ="Error:";
|
||||||
@@ -92,7 +80,6 @@ void serial_echopair_P(const char *s_P, unsigned long v);
|
|||||||
|
|
||||||
|
|
||||||
//things to write to serial from Programmemory. saves 400 to 2k of RAM.
|
//things to write to serial from Programmemory. saves 400 to 2k of RAM.
|
||||||
#define SerialprintPGM(x) serialprintPGM(MYPGM(x))
|
|
||||||
FORCE_INLINE void serialprintPGM(const char *str)
|
FORCE_INLINE void serialprintPGM(const char *str)
|
||||||
{
|
{
|
||||||
char ch=pgm_read_byte(str);
|
char ch=pgm_read_byte(str);
|
||||||
@@ -197,6 +184,9 @@ extern float min_pos[3];
|
|||||||
extern float max_pos[3];
|
extern float max_pos[3];
|
||||||
extern unsigned char FanSpeed;
|
extern unsigned char FanSpeed;
|
||||||
|
|
||||||
|
extern unsigned long starttime;
|
||||||
|
extern unsigned long stoptime;
|
||||||
|
|
||||||
// Handling multiple extruders pins
|
// Handling multiple extruders pins
|
||||||
extern uint8_t active_extruder;
|
extern uint8_t active_extruder;
|
||||||
|
|
||||||
|
|||||||
+4
-1800
File diff suppressed because it is too large
Load Diff
+18
-24
@@ -28,7 +28,7 @@
|
|||||||
// this is so I can support Attiny series and any other chip without a uart
|
// this is so I can support Attiny series and any other chip without a uart
|
||||||
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
|
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
|
||||||
|
|
||||||
#if defined(UBRRH) || defined(UBRR0H)
|
#if UART_PRESENT(SERIAL_PORT)
|
||||||
ring_buffer rx_buffer = { { 0 }, 0, 0 };
|
ring_buffer rx_buffer = { { 0 }, 0, 0 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -48,18 +48,12 @@ FORCE_INLINE void store_char(unsigned char c)
|
|||||||
|
|
||||||
|
|
||||||
//#elif defined(SIG_USART_RECV)
|
//#elif defined(SIG_USART_RECV)
|
||||||
#if defined(USART0_RX_vect)
|
#if defined(M_USARTx_RX_vect)
|
||||||
// fixed by Mark Sproul this is on the 644/644p
|
// fixed by Mark Sproul this is on the 644/644p
|
||||||
//SIGNAL(SIG_USART_RECV)
|
//SIGNAL(SIG_USART_RECV)
|
||||||
SIGNAL(USART0_RX_vect)
|
SIGNAL(M_USARTx_RX_vect)
|
||||||
{
|
{
|
||||||
#if defined(UDR0)
|
unsigned char c = M_UDRx;
|
||||||
unsigned char c = UDR0;
|
|
||||||
#elif defined(UDR)
|
|
||||||
unsigned char c = UDR; // atmega8, atmega32
|
|
||||||
#else
|
|
||||||
#error UDR not defined
|
|
||||||
#endif
|
|
||||||
store_char(c);
|
store_char(c);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -76,39 +70,39 @@ MarlinSerial::MarlinSerial()
|
|||||||
void MarlinSerial::begin(long baud)
|
void MarlinSerial::begin(long baud)
|
||||||
{
|
{
|
||||||
uint16_t baud_setting;
|
uint16_t baud_setting;
|
||||||
bool useU2X0 = true;
|
bool useU2X = true;
|
||||||
|
|
||||||
#if F_CPU == 16000000UL
|
#if F_CPU == 16000000UL && SERIAL_PORT == 0
|
||||||
// hardcoded exception for compatibility with the bootloader shipped
|
// hardcoded exception for compatibility with the bootloader shipped
|
||||||
// with the Duemilanove and previous boards and the firmware on the 8U2
|
// with the Duemilanove and previous boards and the firmware on the 8U2
|
||||||
// on the Uno and Mega 2560.
|
// on the Uno and Mega 2560.
|
||||||
if (baud == 57600) {
|
if (baud == 57600) {
|
||||||
useU2X0 = false;
|
useU2X = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (useU2X0) {
|
if (useU2X) {
|
||||||
UCSR0A = 1 << U2X0;
|
M_UCSRxA = 1 << M_U2Xx;
|
||||||
baud_setting = (F_CPU / 4 / baud - 1) / 2;
|
baud_setting = (F_CPU / 4 / baud - 1) / 2;
|
||||||
} else {
|
} else {
|
||||||
UCSR0A = 0;
|
M_UCSRxA = 0;
|
||||||
baud_setting = (F_CPU / 8 / baud - 1) / 2;
|
baud_setting = (F_CPU / 8 / baud - 1) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
|
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
|
||||||
UBRR0H = baud_setting >> 8;
|
M_UBRRxH = baud_setting >> 8;
|
||||||
UBRR0L = baud_setting;
|
M_UBRRxL = baud_setting;
|
||||||
|
|
||||||
sbi(UCSR0B, RXEN0);
|
sbi(M_UCSRxB, M_RXENx);
|
||||||
sbi(UCSR0B, TXEN0);
|
sbi(M_UCSRxB, M_TXENx);
|
||||||
sbi(UCSR0B, RXCIE0);
|
sbi(M_UCSRxB, M_RXCIEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinSerial::end()
|
void MarlinSerial::end()
|
||||||
{
|
{
|
||||||
cbi(UCSR0B, RXEN0);
|
cbi(M_UCSRxB, M_RXENx);
|
||||||
cbi(UCSR0B, TXEN0);
|
cbi(M_UCSRxB, M_TXENx);
|
||||||
cbi(UCSR0B, RXCIE0);
|
cbi(M_UCSRxB, M_RXCIEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+47
-5
@@ -23,6 +23,48 @@
|
|||||||
#define MarlinSerial_h
|
#define MarlinSerial_h
|
||||||
#include "Marlin.h"
|
#include "Marlin.h"
|
||||||
|
|
||||||
|
#if !defined(SERIAL_PORT)
|
||||||
|
#error SERIAL_PORT not set
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// The presence of the UBRRH register is used to detect a UART.
|
||||||
|
#define UART_PRESENT(port) ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \
|
||||||
|
(port == 1 && defined(UBRR1H)) || (port == 2 && defined(UBRR2H)) || \
|
||||||
|
(port == 3 && defined(UBRR3H)))
|
||||||
|
|
||||||
|
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
|
||||||
|
// requires two levels of indirection to expand macro values properly)
|
||||||
|
#define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix)
|
||||||
|
#if SERIAL_PORT == 0 && !defined(UBRR0H)
|
||||||
|
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix
|
||||||
|
#else
|
||||||
|
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Registers used by MarlinSerial class (these are expanded
|
||||||
|
// depending on selected serial port
|
||||||
|
#define M_UCSRxA SERIAL_REGNAME(UCSR,SERIAL_PORT,A) // defines M_UCSRxA to be UCSRxA where x is the serial port number
|
||||||
|
#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B)
|
||||||
|
#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,)
|
||||||
|
#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,)
|
||||||
|
#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,)
|
||||||
|
#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,)
|
||||||
|
#if SERIAL_PORT == 0 && !defined(UDR0)
|
||||||
|
#if defined(UDR)
|
||||||
|
#define M_UDRx UDR // atmega8, atmega32
|
||||||
|
#else
|
||||||
|
#error UDR not defined
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,)
|
||||||
|
#endif
|
||||||
|
#define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H)
|
||||||
|
#define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L)
|
||||||
|
#define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,)
|
||||||
|
#define M_USARTx_RX_vect SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)
|
||||||
|
#define M_U2Xx SERIAL_REGNAME(U2X,SERIAL_PORT,)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DEC 10
|
#define DEC 10
|
||||||
#define HEX 16
|
#define HEX 16
|
||||||
@@ -46,7 +88,7 @@ struct ring_buffer
|
|||||||
int tail;
|
int tail;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(UBRRH) || defined(UBRR0H)
|
#if UART_PRESENT(SERIAL_PORT)
|
||||||
extern ring_buffer rx_buffer;
|
extern ring_buffer rx_buffer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -68,17 +110,17 @@ class MarlinSerial //: public Stream
|
|||||||
|
|
||||||
FORCE_INLINE void write(uint8_t c)
|
FORCE_INLINE void write(uint8_t c)
|
||||||
{
|
{
|
||||||
while (!((UCSR0A) & (1 << UDRE0)))
|
while (!((M_UCSRxA) & (1 << M_UDREx)))
|
||||||
;
|
;
|
||||||
|
|
||||||
UDR0 = c;
|
M_UDRx = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FORCE_INLINE void checkRx(void)
|
FORCE_INLINE void checkRx(void)
|
||||||
{
|
{
|
||||||
if((UCSR0A & (1<<RXC0)) != 0) {
|
if((M_UCSRxA & (1<<M_RXCx)) != 0) {
|
||||||
unsigned char c = UDR0;
|
unsigned char c = M_UDRx;
|
||||||
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
|
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
|
||||||
|
|
||||||
// if we should be storing the received character into the location
|
// if we should be storing the received character into the location
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+8
-5
@@ -55,13 +55,16 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) {
|
|||||||
* Use writeError to check for errors.
|
* Use writeError to check for errors.
|
||||||
*/
|
*/
|
||||||
#if ARDUINO >= 100
|
#if ARDUINO >= 100
|
||||||
size_t SdFile::write(uint8_t b)
|
size_t SdFile::write(uint8_t b)
|
||||||
#else
|
|
||||||
void SdFile::write(uint8_t b)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
SdBaseFile::write(&b, 1);
|
return SdBaseFile::write(&b, 1);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void SdFile::write(uint8_t b)
|
||||||
|
{
|
||||||
|
SdBaseFile::write(&b, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
/** Write a string to a file. Used by the Arduino Print class.
|
/** Write a string to a file. Used by the Arduino Print class.
|
||||||
* \param[in] str Pointer to the string.
|
* \param[in] str Pointer to the string.
|
||||||
|
|||||||
+354
-27
@@ -12,7 +12,9 @@
|
|||||||
// 3 French (Waiting translation)
|
// 3 French (Waiting translation)
|
||||||
// 4 German
|
// 4 German
|
||||||
// 5 Spanish
|
// 5 Spanish
|
||||||
// 6 Etc
|
// 6 Russian
|
||||||
|
// 7 Italian
|
||||||
|
// 8 Etc
|
||||||
|
|
||||||
#define LANGUAGE_CHOICE 1 // Pick your language from the list above
|
#define LANGUAGE_CHOICE 1 // Pick your language from the list above
|
||||||
|
|
||||||
@@ -151,17 +153,20 @@
|
|||||||
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n"
|
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n"
|
||||||
#define MSG_COUNT_X " Count X:"
|
#define MSG_COUNT_X " Count X:"
|
||||||
#define MSG_ERR_KILLED "Printer halted. kill() called !!"
|
#define MSG_ERR_KILLED "Printer halted. kill() called !!"
|
||||||
#define MSG_ERR_STOPPED "Printer stopped deu to errors. Fix the error and use M999 to restart!. (Temperature is reset. Set it before restarting)"
|
#define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart!. (Temperature is reset. Set it before restarting)"
|
||||||
#define MSG_RESEND "Resend:"
|
#define MSG_RESEND "Resend:"
|
||||||
#define MSG_UNKNOWN_COMMAND "Unknown command:\""
|
#define MSG_UNKNOWN_COMMAND "Unknown command:\""
|
||||||
#define MSG_ACTIVE_EXTRUDER "Active Extruder: "
|
#define MSG_ACTIVE_EXTRUDER "Active Extruder: "
|
||||||
#define MSG_INVALID_EXTRUDER "Invalid extruder"
|
#define MSG_INVALID_EXTRUDER "Invalid extruder"
|
||||||
#define MSG_X_MIN "x_min:"
|
#define MSG_X_MIN "x_min: "
|
||||||
#define MSG_X_MAX "x_max:"
|
#define MSG_X_MAX "x_max: "
|
||||||
#define MSG_Y_MIN "y_min:"
|
#define MSG_Y_MIN "y_min: "
|
||||||
#define MSG_Y_MAX "y_max:"
|
#define MSG_Y_MAX "y_max: "
|
||||||
#define MSG_Z_MIN "z_min:"
|
#define MSG_Z_MIN "z_min: "
|
||||||
#define MSG_Z_MAX "z_max:"
|
#define MSG_Z_MAX "z_max: "
|
||||||
|
#define MSG_M119_REPORT "Reporting endstop status"
|
||||||
|
#define MSG_ENDSTOP_HIT "TRIGGERED"
|
||||||
|
#define MSG_ENDSTOP_OPEN "open"
|
||||||
|
|
||||||
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
|
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
|
||||||
#define MSG_SD_INIT_FAIL "SD init fail"
|
#define MSG_SD_INIT_FAIL "SD init fail"
|
||||||
@@ -311,12 +316,15 @@
|
|||||||
#define MSG_UNKNOWN_COMMAND "Unknown command:\""
|
#define MSG_UNKNOWN_COMMAND "Unknown command:\""
|
||||||
#define MSG_ACTIVE_EXTRUDER "Active Extruder: "
|
#define MSG_ACTIVE_EXTRUDER "Active Extruder: "
|
||||||
#define MSG_INVALID_EXTRUDER "Invalid extruder"
|
#define MSG_INVALID_EXTRUDER "Invalid extruder"
|
||||||
#define MSG_X_MIN "x_min:"
|
#define MSG_X_MIN "x_min: "
|
||||||
#define MSG_X_MAX "x_max:"
|
#define MSG_X_MAX "x_max: "
|
||||||
#define MSG_Y_MIN "y_min:"
|
#define MSG_Y_MIN "y_min: "
|
||||||
#define MSG_Y_MAX "y_max:"
|
#define MSG_Y_MAX "y_max: "
|
||||||
#define MSG_Z_MIN "z_min:"
|
#define MSG_Z_MIN "z_min: "
|
||||||
#define MSG_Z_MAX "z_max:"
|
#define MSG_Z_MAX "z_max: "
|
||||||
|
#define MSG_M119_REPORT "Reporting endstop status"
|
||||||
|
#define MSG_ENDSTOP_HIT "TRIGGERED"
|
||||||
|
#define MSG_ENDSTOP_OPEN "open"
|
||||||
|
|
||||||
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
|
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
|
||||||
#define MSG_SD_INIT_FAIL "SD init fail"
|
#define MSG_SD_INIT_FAIL "SD init fail"
|
||||||
@@ -354,11 +362,11 @@
|
|||||||
#define MSG_SET_ORIGIN " Establecer Cero"
|
#define MSG_SET_ORIGIN " Establecer Cero"
|
||||||
#define MSG_COOLDOWN " Enfriar"
|
#define MSG_COOLDOWN " Enfriar"
|
||||||
#define MSG_EXTRUDE " Extruir"
|
#define MSG_EXTRUDE " Extruir"
|
||||||
#define MSG_RETRACT " Retract"
|
#define MSG_RETRACT " Retraer"
|
||||||
#define MSG_PREHEAT_PLA " Precalentar PLA"
|
#define MSG_PREHEAT_PLA " Precalentar PLA"
|
||||||
#define MSG_PREHEAT_PLA_SETTINGS " Precalentar PLA Setting"
|
#define MSG_PREHEAT_PLA_SETTINGS " Ajustar temp. PLA"
|
||||||
#define MSG_PREHEAT_ABS " Precalentar ABS"
|
#define MSG_PREHEAT_ABS " Precalentar ABS"
|
||||||
#define MSG_PREHEAT_ABS_SETTINGS " Precalentar ABS Setting"
|
#define MSG_PREHEAT_ABS_SETTINGS " Ajustar temp. ABS"
|
||||||
#define MSG_MOVE_AXIS " Mover Ejes \x7E"
|
#define MSG_MOVE_AXIS " Mover Ejes \x7E"
|
||||||
#define MSG_SPEED " Velocidad:"
|
#define MSG_SPEED " Velocidad:"
|
||||||
#define MSG_NOZZLE " \002Nozzle:"
|
#define MSG_NOZZLE " \002Nozzle:"
|
||||||
@@ -406,10 +414,10 @@
|
|||||||
#define MSG_PREPARE " Preparar \x7E"
|
#define MSG_PREPARE " Preparar \x7E"
|
||||||
#define MSG_PREPARE_ALT " Preparar \003"
|
#define MSG_PREPARE_ALT " Preparar \003"
|
||||||
#define MSG_CONTROL_ARROW " Control \x7E"
|
#define MSG_CONTROL_ARROW " Control \x7E"
|
||||||
#define MSG_RETRACT_ARROW " Control \x7E"
|
#define MSG_RETRACT_ARROW " Retraer \x7E"
|
||||||
#define MSG_TUNE " Ajustar \x7E"
|
#define MSG_TUNE " Ajustar \x7E"
|
||||||
#define MSG_PAUSE_PRINT " Pause Print \x7E"
|
#define MSG_PAUSE_PRINT " Pausar Impresion \x7E"
|
||||||
#define MSG_RESUME_PRINT " Resume Print \x7E"
|
#define MSG_RESUME_PRINT " Reanudar Impresion \x7E"
|
||||||
#define MSG_STOP_PRINT " Detener Impresion \x7E"
|
#define MSG_STOP_PRINT " Detener Impresion \x7E"
|
||||||
#define MSG_CARD_MENU " Menu de SD \x7E"
|
#define MSG_CARD_MENU " Menu de SD \x7E"
|
||||||
#define MSG_NO_CARD " No hay Tarjeta SD"
|
#define MSG_NO_CARD " No hay Tarjeta SD"
|
||||||
@@ -466,12 +474,14 @@
|
|||||||
#define MSG_UNKNOWN_COMMAND "Comando Desconocido:\""
|
#define MSG_UNKNOWN_COMMAND "Comando Desconocido:\""
|
||||||
#define MSG_ACTIVE_EXTRUDER "Extrusor Activo: "
|
#define MSG_ACTIVE_EXTRUDER "Extrusor Activo: "
|
||||||
#define MSG_INVALID_EXTRUDER "Extrusor Invalido"
|
#define MSG_INVALID_EXTRUDER "Extrusor Invalido"
|
||||||
#define MSG_X_MIN "x_min:"
|
#define MSG_X_MIN "x_min: "
|
||||||
#define MSG_X_MAX "x_max:"
|
#define MSG_X_MAX "x_max: "
|
||||||
#define MSG_Y_MIN "y_min:"
|
#define MSG_Y_MIN "y_min: "
|
||||||
#define MSG_Y_MAX "y_max:"
|
#define MSG_Y_MAX "y_max: "
|
||||||
#define MSG_Z_MIN "z_min:"
|
#define MSG_Z_MIN "z_min: "
|
||||||
#define MSG_Z_MAX "z_max:"
|
#define MSG_M119_REPORT "Comprobando fines de carrera."
|
||||||
|
#define MSG_ENDSTOP_HIT "PULSADO"
|
||||||
|
#define MSG_ENDSTOP_OPEN "abierto"
|
||||||
|
|
||||||
#define MSG_SD_CANT_OPEN_SUBDIR "No se pudo abrir la subcarpeta."
|
#define MSG_SD_CANT_OPEN_SUBDIR "No se pudo abrir la subcarpeta."
|
||||||
#define MSG_SD_INIT_FAIL "Fallo al iniciar la SD"
|
#define MSG_SD_INIT_FAIL "Fallo al iniciar la SD"
|
||||||
@@ -487,7 +497,7 @@
|
|||||||
#define MSG_SD_PRINTING_BYTE "SD imprimiendo el byte "
|
#define MSG_SD_PRINTING_BYTE "SD imprimiendo el byte "
|
||||||
#define MSG_SD_NOT_PRINTING "No se esta imprimiendo con SD"
|
#define MSG_SD_NOT_PRINTING "No se esta imprimiendo con SD"
|
||||||
#define MSG_SD_ERR_WRITE_TO_FILE "Error al escribir en el archivo"
|
#define MSG_SD_ERR_WRITE_TO_FILE "Error al escribir en el archivo"
|
||||||
#define MSG_SD_CANT_ENTER_SUBDIR "No se puede entrar en la carpeta:"
|
#define MSG_SD_CANT_ENTER_SUBDIR "No se puede abrir la carpeta:"
|
||||||
|
|
||||||
#define MSG_STEPPER_TO_HIGH "Steprate demasiado alto : "
|
#define MSG_STEPPER_TO_HIGH "Steprate demasiado alto : "
|
||||||
#define MSG_ENDSTOPS_HIT "Se ha tocado el fin de carril: "
|
#define MSG_ENDSTOPS_HIT "Se ha tocado el fin de carril: "
|
||||||
@@ -495,4 +505,321 @@
|
|||||||
#define MSG_ERR_LONG_EXTRUDE_STOP " extrusion demasiado larga evitada"
|
#define MSG_ERR_LONG_EXTRUDE_STOP " extrusion demasiado larga evitada"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LANGUAGE_CHOICE == 6
|
||||||
|
|
||||||
|
// LCD Menu Messages
|
||||||
|
#define WELCOME_MSG MACHINE_NAME " Готов."
|
||||||
|
#define MSG_SD_INSERTED "Карта вставлена"
|
||||||
|
#define MSG_SD_REMOVED "Карта извлечена"
|
||||||
|
#define MSG_MAIN " Меню \003"
|
||||||
|
#define MSG_AUTOSTART " Автостарт "
|
||||||
|
#define MSG_DISABLE_STEPPERS " Выключить двигатели"
|
||||||
|
#define MSG_AUTO_HOME " Парковка "
|
||||||
|
#define MSG_SET_ORIGIN " Запомнить ноль "
|
||||||
|
#define MSG_PREHEAT_PLA " Преднагрев PLA "
|
||||||
|
#define MSG_PREHEAT_PLA_SETTINGS " Настр. преднагр.PLA"
|
||||||
|
#define MSG_PREHEAT_ABS " Преднагрев ABS "
|
||||||
|
#define MSG_PREHEAT_ABS_SETTINGS " Настр. преднагр.ABS"
|
||||||
|
#define MSG_COOLDOWN " Охлаждение "
|
||||||
|
#define MSG_EXTRUDE " Экструзия "
|
||||||
|
#define MSG_RETRACT " Откат"
|
||||||
|
#define MSG_MOVE_AXIS " Движение по осям \x7E"
|
||||||
|
#define MSG_SPEED " Скорость:"
|
||||||
|
#define MSG_NOZZLE " \002 Фильера:"
|
||||||
|
#define MSG_NOZZLE1 " \002 Фильера2:"
|
||||||
|
#define MSG_NOZZLE2 " \002 Фильера3:"
|
||||||
|
#define MSG_BED " \002 Кровать:"
|
||||||
|
#define MSG_FAN_SPEED " Куллер:"
|
||||||
|
#define MSG_FLOW " Поток:"
|
||||||
|
#define MSG_CONTROL " Настройки \003"
|
||||||
|
#define MSG_MIN " \002 Минимум:"
|
||||||
|
#define MSG_MAX " \002 Максимум:"
|
||||||
|
#define MSG_FACTOR " \002 Фактор:"
|
||||||
|
#define MSG_AUTOTEMP " Autotemp:"
|
||||||
|
#define MSG_ON "Вкл. "
|
||||||
|
#define MSG_OFF "Выкл. "
|
||||||
|
#define MSG_PID_P " PID-P: "
|
||||||
|
#define MSG_PID_I " PID-I: "
|
||||||
|
#define MSG_PID_D " PID-D: "
|
||||||
|
#define MSG_PID_C " PID-C: "
|
||||||
|
#define MSG_ACC " Acc:"
|
||||||
|
#define MSG_VXY_JERK " Vxy-jerk: "
|
||||||
|
#define MSG_VMAX " Vmax "
|
||||||
|
#define MSG_X "x:"
|
||||||
|
#define MSG_Y "y:"
|
||||||
|
#define MSG_Z "z:"
|
||||||
|
#define MSG_E "e:"
|
||||||
|
#define MSG_VMIN " Vmin:"
|
||||||
|
#define MSG_VTRAV_MIN " VTrav min:"
|
||||||
|
#define MSG_AMAX " Amax "
|
||||||
|
#define MSG_A_RETRACT " A-retract:"
|
||||||
|
#define MSG_XSTEPS " X шаг/mm:"
|
||||||
|
#define MSG_YSTEPS " Y шаг/mm:"
|
||||||
|
#define MSG_ZSTEPS " Z шаг/mm:"
|
||||||
|
#define MSG_ESTEPS " E шаг/mm:"
|
||||||
|
#define MSG_MAIN_WIDE " Меню \003"
|
||||||
|
#define MSG_RECTRACT_WIDE " Откат подачи \x7E"
|
||||||
|
#define MSG_TEMPERATURE_WIDE " Температура \x7E"
|
||||||
|
#define MSG_TEMPERATURE_RTN " Температура \003"
|
||||||
|
#define MSG_MOTION_WIDE " Скорости \x7E"
|
||||||
|
#define MSG_STORE_EPROM " Сохранить настройки"
|
||||||
|
#define MSG_LOAD_EPROM " Загрузить настройки"
|
||||||
|
#define MSG_RESTORE_FAILSAFE " Сброс настроек "
|
||||||
|
#define MSG_REFRESH "\004Обновить "
|
||||||
|
#define MSG_WATCH " Обзор \003"
|
||||||
|
#define MSG_PREPARE " Действия \x7E"
|
||||||
|
#define MSG_PREPARE_ALT " Действия \003"
|
||||||
|
#define MSG_CONTROL_ARROW " Настройки \x7E"
|
||||||
|
#define MSG_RETRACT_ARROW " Настройки отката \x7E"
|
||||||
|
#define MSG_TUNE " Tune \x7E"
|
||||||
|
#define MSG_PAUSE_PRINT " Пауза печати \x7E"
|
||||||
|
#define MSG_RESUME_PRINT " Продолжить печать \x7E"
|
||||||
|
#define MSG_STOP_PRINT " Остановить печать \x7E"
|
||||||
|
#define MSG_CARD_MENU " Меню карты \x7E"
|
||||||
|
#define MSG_NO_CARD " Нет карты"
|
||||||
|
#define MSG_DWELL "Сон..."
|
||||||
|
#define MSG_USERWAIT "Нажмите для продолж."
|
||||||
|
#define MSG_NO_MOVE "Нет движения. "
|
||||||
|
#define MSG_PART_RELEASE " Извлечение принта "
|
||||||
|
#define MSG_KILLED "УБИТО. "
|
||||||
|
#define MSG_STOPPED "ОСТАНОВЛЕНО. "
|
||||||
|
#define MSG_STEPPER_RELEASED "Двигатели отключены."
|
||||||
|
#define MSG_CONTROL_RETRACT " Откат mm:"
|
||||||
|
#define MSG_CONTROL_RETRACTF " Откат F:"
|
||||||
|
#define MSG_CONTROL_RETRACT_ZLIFT " Прыжок mm:"
|
||||||
|
#define MSG_CONTROL_RETRACT_RECOVER " Возврат +mm:"
|
||||||
|
#define MSG_CONTROL_RETRACT_RECOVERF " Возврат F:"
|
||||||
|
#define MSG_AUTORETRACT " АвтоОткат:"
|
||||||
|
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Ошибка в структуре меню."
|
||||||
|
|
||||||
|
// Serial Console Messages
|
||||||
|
|
||||||
|
#define MSG_Enqueing "Запланировано \""
|
||||||
|
#define MSG_POWERUP "Включение питания"
|
||||||
|
#define MSG_EXTERNAL_RESET " Внешний сброс"
|
||||||
|
#define MSG_BROWNOUT_RESET " Brown out сброс"
|
||||||
|
#define MSG_WATCHDOG_RESET " Watchdog сброс"
|
||||||
|
#define MSG_SOFTWARE_RESET " программный сброс"
|
||||||
|
#define MSG_MARLIN "Marlin "
|
||||||
|
#define MSG_AUTHOR " | Автор: "
|
||||||
|
#define MSG_CONFIGURATION_VER " Последнее обновление: "
|
||||||
|
#define MSG_FREE_MEMORY " Памяти свободно: "
|
||||||
|
#define MSG_PLANNER_BUFFER_BYTES " Буффер очереди команд Bytes: "
|
||||||
|
#define MSG_OK "ok"
|
||||||
|
#define MSG_FILE_SAVED "Файл записан."
|
||||||
|
#define MSG_ERR_LINE_NO "Номен строки это не последняя строка+1, последняя строка:"
|
||||||
|
#define MSG_ERR_CHECKSUM_MISMATCH "контрольная сумма не совпадает, последняя строка:"
|
||||||
|
#define MSG_ERR_NO_CHECKSUM "нет контрольной суммы для строки, последняя строка:"
|
||||||
|
#define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "нет строки для контрольной суммы, последняя строка:"
|
||||||
|
#define MSG_FILE_PRINTED "Печать файла завершена"
|
||||||
|
#define MSG_BEGIN_FILE_LIST "Список файлов"
|
||||||
|
#define MSG_END_FILE_LIST "Конец списка файлов"
|
||||||
|
#define MSG_M104_INVALID_EXTRUDER "M104 ошибка экструдера "
|
||||||
|
#define MSG_M105_INVALID_EXTRUDER "M105 ошибка экструдера "
|
||||||
|
#define MSG_ERR_NO_THERMISTORS "Нет термистра - нет температуры"
|
||||||
|
#define MSG_M109_INVALID_EXTRUDER "M109 ошибка экструдера "
|
||||||
|
#define MSG_HEATING "Нагрев... "
|
||||||
|
#define MSG_HEATING_COMPLETE "Наргето. "
|
||||||
|
#define MSG_BED_HEATING "Нагрев стола... "
|
||||||
|
#define MSG_BED_DONE "Стол нагрет. "
|
||||||
|
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n"
|
||||||
|
#define MSG_COUNT_X " Count X:"
|
||||||
|
#define MSG_ERR_KILLED "Принтер остановлен. вызов kill() !!"
|
||||||
|
#define MSG_ERR_STOPPED "Ошибка принтера, останов. Устраните неисправность и используйте M999 для перезагрузки!. (Температура недоступна. Проверьте датчики)"
|
||||||
|
#define MSG_RESEND "Переотправка:"
|
||||||
|
#define MSG_UNKNOWN_COMMAND "Неизвестная команда:\""
|
||||||
|
#define MSG_ACTIVE_EXTRUDER "Активный экструдер: "
|
||||||
|
#define MSG_INVALID_EXTRUDER "Ошибка экструдера"
|
||||||
|
#define MSG_X_MIN "x_min:"
|
||||||
|
#define MSG_X_MAX "x_max:"
|
||||||
|
#define MSG_Y_MIN "y_min:"
|
||||||
|
#define MSG_Y_MAX "y_max:"
|
||||||
|
#define MSG_Z_MIN "z_min:"
|
||||||
|
#define MSG_Z_MAX "z_max:"
|
||||||
|
|
||||||
|
#define MSG_SD_CANT_OPEN_SUBDIR "Не открыть папку"
|
||||||
|
#define MSG_SD_INIT_FAIL "Ошибка инициализации SD"
|
||||||
|
#define MSG_SD_VOL_INIT_FAIL "Ошибка инициализации раздела"
|
||||||
|
#define MSG_SD_OPENROOT_FAIL "Не прочесть содержимое корня"
|
||||||
|
#define MSG_SD_CARD_OK "SD карта в порядке"
|
||||||
|
#define MSG_SD_WORKDIR_FAIL "не открыть рабочую папку"
|
||||||
|
#define MSG_SD_OPEN_FILE_FAIL "Ошибка чтения, файл: "
|
||||||
|
#define MSG_SD_FILE_OPENED "Файл открыт:"
|
||||||
|
#define MSG_SD_SIZE " Размер:"
|
||||||
|
#define MSG_SD_FILE_SELECTED "Файл выбран"
|
||||||
|
#define MSG_SD_WRITE_TO_FILE "Запись в файл: "
|
||||||
|
#define MSG_SD_PRINTING_BYTE "SD печать byte "
|
||||||
|
#define MSG_SD_NOT_PRINTING "нет SD печати"
|
||||||
|
#define MSG_SD_ERR_WRITE_TO_FILE "ошибка записи в файл"
|
||||||
|
#define MSG_SD_CANT_ENTER_SUBDIR "Не зайти в папку:"
|
||||||
|
|
||||||
|
#define MSG_STEPPER_TO_HIGH "Частота шагов очень высока : "
|
||||||
|
#define MSG_ENDSTOPS_HIT "концевик сработал: "
|
||||||
|
#define MSG_ERR_COLD_EXTRUDE_STOP " защита холодной экструзии"
|
||||||
|
#define MSG_ERR_LONG_EXTRUDE_STOP " защита превышения длинны экструзии"
|
||||||
|
#define MSG_M119_REPORT "Статус концевиков"
|
||||||
|
#define MSG_ENDSTOP_HIT "Срабатывание концевика"
|
||||||
|
#define MSG_ENDSTOP_OPEN "Концевик освобожден"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LANGUAGE_CHOICE == 7
|
||||||
|
|
||||||
|
// LCD Menu Messages
|
||||||
|
#define WELCOME_MSG MACHINE_NAME " Pronto."
|
||||||
|
#define MSG_SD_INSERTED "SD Card inserita"
|
||||||
|
#define MSG_SD_REMOVED "SD Card rimossa"
|
||||||
|
#define MSG_MAIN " Menu principale \003"
|
||||||
|
#define MSG_AUTOSTART " Autostart"
|
||||||
|
#define MSG_DISABLE_STEPPERS " Disabilita Motori Passo-Passo"
|
||||||
|
#define MSG_AUTO_HOME " Auto Home"
|
||||||
|
#define MSG_SET_ORIGIN " Imposta Origini Assi"
|
||||||
|
#define MSG_PREHEAT_PLA " Preriscalda PLA"
|
||||||
|
#define MSG_PREHEAT_PLA_SETTINGS " Impostazioni Preriscaldamento PLA"
|
||||||
|
#define MSG_PREHEAT_ABS " Preriscalda ABS"
|
||||||
|
#define MSG_PREHEAT_ABS_SETTINGS " Impostazioni Preriscaldamento ABS"
|
||||||
|
#define MSG_COOLDOWN " Rafredda"
|
||||||
|
#define MSG_EXTRUDE " Estrudi"
|
||||||
|
#define MSG_RETRACT " Ritrai"
|
||||||
|
#define MSG_MOVE_AXIS " Muovi Asse \x7E"
|
||||||
|
#define MSG_SPEED " Velcità:"
|
||||||
|
#define MSG_NOZZLE " \002Ugello:"
|
||||||
|
#define MSG_NOZZLE1 " \002Ugello2:"
|
||||||
|
#define MSG_NOZZLE2 " \002Ugello3:"
|
||||||
|
#define MSG_BED " \002Piatto:"
|
||||||
|
#define MSG_FAN_SPEED " Velocità Ventola:"
|
||||||
|
#define MSG_FLOW " Flusso:"
|
||||||
|
#define MSG_CONTROL " Controllo \003"
|
||||||
|
#define MSG_MIN " \002 Min:"
|
||||||
|
#define MSG_MAX " \002 Max:"
|
||||||
|
#define MSG_FACTOR " \002 Fact:"
|
||||||
|
#define MSG_AUTOTEMP " Autotemp:"
|
||||||
|
#define MSG_ON "On "
|
||||||
|
#define MSG_OFF "Off"
|
||||||
|
#define MSG_PID_P " PID-P: "
|
||||||
|
#define MSG_PID_I " PID-I: "
|
||||||
|
#define MSG_PID_D " PID-D: "
|
||||||
|
#define MSG_PID_C " PID-C: "
|
||||||
|
#define MSG_ACC " Acc:"
|
||||||
|
#define MSG_VXY_JERK " Vxy-jerk: "
|
||||||
|
#define MSG_VMAX " Vmax "
|
||||||
|
#define MSG_X "x:"
|
||||||
|
#define MSG_Y "y:"
|
||||||
|
#define MSG_Z "z:"
|
||||||
|
#define MSG_E "e:"
|
||||||
|
#define MSG_VMIN " Vmin:"
|
||||||
|
#define MSG_VTRAV_MIN " VTrav min:"
|
||||||
|
#define MSG_AMAX " Amax "
|
||||||
|
#define MSG_A_RETRACT " A-ritrai:"
|
||||||
|
#define MSG_XSTEPS " Xpassi/mm:"
|
||||||
|
#define MSG_YSTEPS " Ypassi/mm:"
|
||||||
|
#define MSG_ZSTEPS " Zpassi/mm:"
|
||||||
|
#define MSG_ESTEPS " Epassi/mm:"
|
||||||
|
#define MSG_MAIN_WIDE " Menu Principale \003"
|
||||||
|
#define MSG_RECTRACT_WIDE " Ritrai \x7E"
|
||||||
|
#define MSG_TEMPERATURE_WIDE " Temperatura \x7E"
|
||||||
|
#define MSG_TEMPERATURE_RTN " Temperatura \003"
|
||||||
|
#define MSG_MOTION_WIDE " Movimento \x7E"
|
||||||
|
#define MSG_STORE_EPROM " Salva in memoria"
|
||||||
|
#define MSG_LOAD_EPROM " Carica dalla memoria"
|
||||||
|
#define MSG_RESTORE_FAILSAFE " Configurazioni di default"
|
||||||
|
#define MSG_REFRESH "\004Aggiorna"
|
||||||
|
#define MSG_WATCH " Guarda \003"
|
||||||
|
#define MSG_PREPARE " Prepara \x7E"
|
||||||
|
#define MSG_PREPARE_ALT " Prepara \003"
|
||||||
|
#define MSG_CONTROL_ARROW " Controllo \x7E"
|
||||||
|
#define MSG_RETRACT_ARROW " Ritrai \x7E"
|
||||||
|
#define MSG_TUNE " Tune \x7E"
|
||||||
|
#define MSG_PAUSE_PRINT " Metti in Pausa la Stampa \x7E"
|
||||||
|
#define MSG_RESUME_PRINT " Riprendi Stampa \x7E"
|
||||||
|
#define MSG_STOP_PRINT " Arresta Stampa \x7E"
|
||||||
|
#define MSG_CARD_MENU " Card Menu \x7E"
|
||||||
|
#define MSG_NO_CARD " No Card"
|
||||||
|
#define MSG_DWELL " Sospensione..."
|
||||||
|
#define MSG_USERWAIT "Attendi utente..."
|
||||||
|
#define MSG_NO_MOVE "Nessun movimento."
|
||||||
|
#define MSG_PART_RELEASE "Rilascio Parziale"
|
||||||
|
#define MSG_KILLED "UCCISO. "
|
||||||
|
#define MSG_STOPPED "ARRESTATO. "
|
||||||
|
#define MSG_STEPPER_RELEASED "Rilasciato."
|
||||||
|
#define MSG_CONTROL_RETRACT " Ritrai mm:"
|
||||||
|
#define MSG_CONTROL_RETRACTF " Ritrai F:"
|
||||||
|
#define MSG_CONTROL_RETRACT_ZLIFT " Salta mm:"
|
||||||
|
#define MSG_CONTROL_RETRACT_RECOVER " UnRet +mm:"
|
||||||
|
#define MSG_CONTROL_RETRACT_RECOVERF " UnRet F:"
|
||||||
|
#define MSG_AUTORETRACT " AutoRilascio.:"
|
||||||
|
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Qualcosa non va in MenuStructure."
|
||||||
|
|
||||||
|
// Serial Console Messages
|
||||||
|
|
||||||
|
#define MSG_Enqueing "accodamento \""
|
||||||
|
#define MSG_POWERUP "Accensione"
|
||||||
|
#define MSG_EXTERNAL_RESET " Reset Esterno"
|
||||||
|
#define MSG_BROWNOUT_RESET " Brown out Reset"
|
||||||
|
#define MSG_WATCHDOG_RESET " Watchdog Reset"
|
||||||
|
#define MSG_SOFTWARE_RESET " Software Reset"
|
||||||
|
#define MSG_MARLIN "Marlin "
|
||||||
|
#define MSG_AUTHOR " | Autore: "
|
||||||
|
#define MSG_CONFIGURATION_VER " Ultimo Aggiornamento: "
|
||||||
|
#define MSG_FREE_MEMORY " Memoria Libera: "
|
||||||
|
#define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: "
|
||||||
|
#define MSG_OK "ok"
|
||||||
|
#define MSG_FILE_SAVED "File Salvato."
|
||||||
|
#define MSG_ERR_LINE_NO "Il Numero della Linea non corrisponde al Numero dell'Ultima Linea+1, Ultima Linea:"
|
||||||
|
#define MSG_ERR_CHECKSUM_MISMATCH "checksum non corrispondente, Ultima Linea:"
|
||||||
|
#define MSG_ERR_NO_CHECKSUM "Nessun Checksum con Numero di Linea, Ultima Linea:"
|
||||||
|
#define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "Nessun Numero di Linea con Checksum, Ultima Linea:"
|
||||||
|
#define MSG_FILE_PRINTED "File stampato"
|
||||||
|
#define MSG_BEGIN_FILE_LIST "Inizio Lista File"
|
||||||
|
#define MSG_END_FILE_LIST "Fine Lista File"
|
||||||
|
#define MSG_M104_INVALID_EXTRUDER "M104 Estrusore non valido "
|
||||||
|
#define MSG_M105_INVALID_EXTRUDER "M105 Estrusore non valido "
|
||||||
|
#define MSG_ERR_NO_THERMISTORS "Nessun Termistore - nessuna temperatura"
|
||||||
|
#define MSG_M109_INVALID_EXTRUDER "M109 Estrusore non valido "
|
||||||
|
#define MSG_HEATING "Riscaldamento..."
|
||||||
|
#define MSG_HEATING_COMPLETE "Riscaldamento concluso."
|
||||||
|
#define MSG_BED_HEATING "Riscaldamento Piatto."
|
||||||
|
#define MSG_BED_DONE "Piatto Pronto."
|
||||||
|
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n"
|
||||||
|
#define MSG_COUNT_X " Calcola X:"
|
||||||
|
#define MSG_ERR_KILLED "Stampante Calda. kill() chiamata !!"
|
||||||
|
#define MSG_ERR_STOPPED "Stampante fermata a causa di errori. Risolvi l'errore e usa M999 per ripartire!. (Reset temperatura. Impostala prima di ripartire)"
|
||||||
|
#define MSG_RESEND "Reinviato:"
|
||||||
|
#define MSG_UNKNOWN_COMMAND "Comando sconosciuto:\""
|
||||||
|
#define MSG_ACTIVE_EXTRUDER "Attiva Estrusore: "
|
||||||
|
#define MSG_INVALID_EXTRUDER "Estrusore non valido"
|
||||||
|
#define MSG_X_MIN "x_min: "
|
||||||
|
#define MSG_X_MAX "x_max: "
|
||||||
|
#define MSG_Y_MIN "y_min: "
|
||||||
|
#define MSG_Y_MAX "y_max: "
|
||||||
|
#define MSG_Z_MIN "z_min: "
|
||||||
|
#define MSG_Z_MAX "z_max: "
|
||||||
|
#define MSG_M119_REPORT "Segnalazione stato degli endstop"
|
||||||
|
#define MSG_ENDSTOP_HIT "INNESCATO"
|
||||||
|
#define MSG_ENDSTOP_OPEN "aperto"
|
||||||
|
|
||||||
|
#define MSG_SD_CANT_OPEN_SUBDIR "Impossibile aprire sottocartella"
|
||||||
|
#define MSG_SD_INIT_FAIL "Fallita Inizializzazione SD"
|
||||||
|
#define MSG_SD_VOL_INIT_FAIL "Fallito il montaggio del Volume"
|
||||||
|
#define MSG_SD_OPENROOT_FAIL "Fallita l'apertura Cartella Principale"
|
||||||
|
#define MSG_SD_CARD_OK "SD card ok"
|
||||||
|
#define MSG_SD_WORKDIR_FAIL "Fallita l'apertura Cartella di Lavoro"
|
||||||
|
#define MSG_SD_OPEN_FILE_FAIL "Fallita l'apertura del File: "
|
||||||
|
#define MSG_SD_FILE_OPENED "File aperto:"
|
||||||
|
#define MSG_SD_SIZE " Dimensione:"
|
||||||
|
#define MSG_SD_FILE_SELECTED "File selezionato"
|
||||||
|
#define MSG_SD_WRITE_TO_FILE "Scrittura su file: "
|
||||||
|
#define MSG_SD_PRINTING_BYTE "Si sta scrivendo il byte su SD "
|
||||||
|
#define MSG_SD_NOT_PRINTING "Non si sta scrivendo su SD"
|
||||||
|
#define MSG_SD_ERR_WRITE_TO_FILE "Errore nella scrittura su file"
|
||||||
|
#define MSG_SD_CANT_ENTER_SUBDIR "Impossibile entrare nella sottocartella:"
|
||||||
|
|
||||||
|
#define MSG_STEPPER_TO_HIGH "Steprate troppo alto : "
|
||||||
|
#define MSG_ENDSTOPS_HIT "Raggiunto il fondo carrello: "
|
||||||
|
#define MSG_ERR_COLD_EXTRUDE_STOP " prevenuta estrusione fredda"
|
||||||
|
#define MSG_ERR_LONG_EXTRUDE_STOP " prevenuta estrusione troppo lunga"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // ifndef LANGUAGE_H
|
#endif // ifndef LANGUAGE_H
|
||||||
|
|||||||
+181
-9
@@ -45,16 +45,11 @@
|
|||||||
#endif /* 99 */
|
#endif /* 99 */
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* Gen7 v1.1, v1.2, v1.3, v1.4 pin assignment
|
* Gen7 v1.1, v1.2, v1.3 pin assignment
|
||||||
*
|
*
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#if MOTHERBOARD == 13
|
|
||||||
#define MOTHERBOARD 11
|
|
||||||
#define GEN7_VERSION 14 // v1.4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MOTHERBOARD == 12
|
#if MOTHERBOARD == 12
|
||||||
#define MOTHERBOARD 11
|
#define MOTHERBOARD 11
|
||||||
#define GEN7_VERSION 13 // v1.3
|
#define GEN7_VERSION 13 // v1.3
|
||||||
@@ -122,12 +117,86 @@
|
|||||||
#endif
|
#endif
|
||||||
#define PS_ON_PIN 15
|
#define PS_ON_PIN 15
|
||||||
|
|
||||||
#if (GEN7_VERSION < 14)
|
//All these generations of Gen7 supply thermistor power
|
||||||
// Gen 1.3 and earlier supplied thermistor power via PS_ON
|
//via PS_ON, so ignore bad thermistor readings
|
||||||
// Need to ignore the bad thermistor readings on those units
|
|
||||||
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
||||||
|
|
||||||
|
//our pin for debugging.
|
||||||
|
#define DEBUG_PIN 0
|
||||||
|
|
||||||
|
//our RS485 pins
|
||||||
|
#define TX_ENABLE_PIN 12
|
||||||
|
#define RX_ENABLE_PIN 13
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************************
|
||||||
|
* Gen7 v1.4 pin assignment
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#if MOTHERBOARD == 13
|
||||||
|
#define GEN7_VERSION 14 // v1.4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MOTHERBOARD == 13
|
||||||
|
#define KNOWN_BOARD
|
||||||
|
|
||||||
|
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__)
|
||||||
|
#error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu.
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GEN7_VERSION
|
||||||
|
#define GEN7_VERSION 14 // v1.x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//x axis pins
|
||||||
|
#define X_STEP_PIN 29
|
||||||
|
#define X_DIR_PIN 28
|
||||||
|
#define X_ENABLE_PIN 25
|
||||||
|
#define X_MIN_PIN 0
|
||||||
|
#define X_MAX_PIN -1
|
||||||
|
|
||||||
|
//y axis pins
|
||||||
|
#define Y_STEP_PIN 27
|
||||||
|
#define Y_DIR_PIN 26
|
||||||
|
#define Y_ENABLE_PIN 25
|
||||||
|
#define Y_MIN_PIN 1
|
||||||
|
#define Y_MAX_PIN -1
|
||||||
|
|
||||||
|
//z axis pins
|
||||||
|
#define Z_STEP_PIN 23
|
||||||
|
#define Z_DIR_PIN 22
|
||||||
|
#define Z_ENABLE_PIN 25
|
||||||
|
#define Z_MIN_PIN 2
|
||||||
|
#define Z_MAX_PIN -1
|
||||||
|
|
||||||
|
//extruder pins
|
||||||
|
#define E0_STEP_PIN 19
|
||||||
|
#define E0_DIR_PIN 18
|
||||||
|
#define E0_ENABLE_PIN 25
|
||||||
|
|
||||||
|
#define TEMP_0_PIN 0
|
||||||
|
#define TEMP_1_PIN -1
|
||||||
|
#define TEMP_2_PIN -1
|
||||||
|
#define TEMP_BED_PIN 1
|
||||||
|
|
||||||
|
#define HEATER_0_PIN 4
|
||||||
|
#define HEATER_1_PIN -1
|
||||||
|
#define HEATER_2_PIN -1
|
||||||
|
#define HEATER_BED_PIN 3
|
||||||
|
|
||||||
|
#define KILL_PIN -1
|
||||||
|
|
||||||
|
#define SDPOWER -1
|
||||||
|
#define SDSS -1 // SCL pin of I2C header
|
||||||
|
#define LED_PIN -1
|
||||||
|
|
||||||
|
#define FAN_PIN -1
|
||||||
|
|
||||||
|
#define PS_ON_PIN 15
|
||||||
|
|
||||||
//our pin for debugging.
|
//our pin for debugging.
|
||||||
#define DEBUG_PIN 0
|
#define DEBUG_PIN 0
|
||||||
|
|
||||||
@@ -1132,6 +1201,109 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************************
|
||||||
|
* MegaTronics
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
#if MOTHERBOARD == 70
|
||||||
|
#define KNOWN_BOARD 1
|
||||||
|
|
||||||
|
//////////////////FIX THIS//////////////
|
||||||
|
|
||||||
|
#ifndef __AVR_ATmega2560__
|
||||||
|
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define X_STEP_PIN 26
|
||||||
|
#define X_DIR_PIN 28
|
||||||
|
#define X_ENABLE_PIN 24
|
||||||
|
#define X_MIN_PIN 41
|
||||||
|
#define X_MAX_PIN 37 //2 //Max endstops default to disabled "-1", set to commented value to enable.
|
||||||
|
|
||||||
|
#define Y_STEP_PIN 60 // A6
|
||||||
|
#define Y_DIR_PIN 61 // A7
|
||||||
|
#define Y_ENABLE_PIN 22
|
||||||
|
#define Y_MIN_PIN 14
|
||||||
|
#define Y_MAX_PIN 15 //15
|
||||||
|
|
||||||
|
#define Z_STEP_PIN 54 // A0
|
||||||
|
#define Z_DIR_PIN 55 // A1
|
||||||
|
#define Z_ENABLE_PIN 56 // A2
|
||||||
|
#define Z_MIN_PIN 18
|
||||||
|
#define Z_MAX_PIN 19
|
||||||
|
|
||||||
|
#define E0_STEP_PIN 31
|
||||||
|
#define E0_DIR_PIN 32
|
||||||
|
#define E0_ENABLE_PIN 38
|
||||||
|
|
||||||
|
#define E1_STEP_PIN 34
|
||||||
|
#define E1_DIR_PIN 36
|
||||||
|
#define E1_ENABLE_PIN 30
|
||||||
|
|
||||||
|
#define SDPOWER -1
|
||||||
|
#define SDSS 53
|
||||||
|
#define LED_PIN 13
|
||||||
|
|
||||||
|
|
||||||
|
#define FAN_PIN 7 // IO pin. Buffer needed
|
||||||
|
#define PS_ON_PIN 12
|
||||||
|
#define KILL_PIN -1
|
||||||
|
|
||||||
|
#define HEATER_0_PIN 9 // EXTRUDER 1
|
||||||
|
#define HEATER_1_PIN 8 // EXTRUDER 2 (FAN On Sprinter)
|
||||||
|
#define HEATER_2_PIN -1
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_0 == -1
|
||||||
|
#define TEMP_0_PIN 8 // ANALOG NUMBERING
|
||||||
|
#else
|
||||||
|
#define TEMP_0_PIN 13 // ANALOG NUMBERING
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TEMP_1_PIN 15 // ANALOG NUMBERING
|
||||||
|
#define TEMP_2_PIN -1 // ANALOG NUMBERING
|
||||||
|
#define HEATER_BED_PIN 10 // BED
|
||||||
|
#define TEMP_BED_PIN 14 // ANALOG NUMBERING
|
||||||
|
|
||||||
|
#define BEEPER 33 // Beeper on AUX-4
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ULTRA_LCD
|
||||||
|
|
||||||
|
#ifdef NEWPANEL
|
||||||
|
//arduino pin which triggers an piezzo beeper
|
||||||
|
|
||||||
|
#define LCD_PINS_RS 16
|
||||||
|
#define LCD_PINS_ENABLE 17
|
||||||
|
#define LCD_PINS_D4 23
|
||||||
|
#define LCD_PINS_D5 25
|
||||||
|
#define LCD_PINS_D6 27
|
||||||
|
#define LCD_PINS_D7 29
|
||||||
|
|
||||||
|
//buttons are directly attached using AUX-2
|
||||||
|
#define BTN_EN1 37
|
||||||
|
#define BTN_EN2 35
|
||||||
|
#define BTN_ENC 43 //the click
|
||||||
|
|
||||||
|
#define BLEN_C 2
|
||||||
|
#define BLEN_B 1
|
||||||
|
#define BLEN_A 0
|
||||||
|
|
||||||
|
#define SDCARDDETECT -1 // Ramps does not use this port
|
||||||
|
|
||||||
|
//encoder rotation values
|
||||||
|
#define encrot0 0
|
||||||
|
#define encrot1 2
|
||||||
|
#define encrot2 3
|
||||||
|
#define encrot3 1
|
||||||
|
#endif
|
||||||
|
#endif //ULTRA_LCD
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef KNOWN_BOARD
|
#ifndef KNOWN_BOARD
|
||||||
#error Unknown MOTHERBOARD value in configuration.h
|
#error Unknown MOTHERBOARD value in configuration.h
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-2
@@ -191,8 +191,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
|
|||||||
// 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(
|
accelerate_steps = ceil(intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count));
|
||||||
intersection_distance(block->initial_rate, block->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(accelerate_steps,block->step_event_count);
|
accelerate_steps = min(accelerate_steps,block->step_event_count);
|
||||||
plateau_steps = 0;
|
plateau_steps = 0;
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#if EXTRUDERS > 2
|
#if EXTRUDERS > 2
|
||||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}
|
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}
|
||||||
#define NORM_E_DIR() { if(current_block->active_extruder == 2) { WRITE(!E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(!E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}
|
#define NORM_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}
|
||||||
#define REV_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}}
|
#define REV_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, INVERT_E0_DIR); }}}
|
||||||
#elif EXTRUDERS > 1
|
#elif EXTRUDERS > 1
|
||||||
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}
|
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}
|
||||||
|
|||||||
+140
-56
@@ -58,15 +58,21 @@ int current_raw_bed = 0;
|
|||||||
#endif
|
#endif
|
||||||
#endif //PIDTEMP
|
#endif //PIDTEMP
|
||||||
|
|
||||||
|
#ifdef PIDTEMPBED
|
||||||
|
// used external
|
||||||
|
float pid_setpoint_bed = { 0.0 };
|
||||||
|
|
||||||
|
float bedKp=DEFAULT_bedKp;
|
||||||
|
float bedKi=(DEFAULT_bedKi*PID_dT);
|
||||||
|
float bedKd=(DEFAULT_bedKd/PID_dT);
|
||||||
|
#endif //PIDTEMPBED
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================private variables============================
|
//=============================private variables============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
static volatile bool temp_meas_ready = false;
|
static volatile bool temp_meas_ready = false;
|
||||||
|
|
||||||
static unsigned long previous_millis_bed_heater;
|
|
||||||
//static unsigned long previous_millis_heater;
|
|
||||||
|
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
//static cannot be external:
|
//static cannot be external:
|
||||||
static float temp_iState[EXTRUDERS] = { 0 };
|
static float temp_iState[EXTRUDERS] = { 0 };
|
||||||
@@ -82,7 +88,22 @@ static unsigned long previous_millis_bed_heater;
|
|||||||
// static float pid_output[EXTRUDERS];
|
// static float pid_output[EXTRUDERS];
|
||||||
static bool pid_reset[EXTRUDERS];
|
static bool pid_reset[EXTRUDERS];
|
||||||
#endif //PIDTEMP
|
#endif //PIDTEMP
|
||||||
|
#ifdef PIDTEMPBED
|
||||||
|
//static cannot be external:
|
||||||
|
static float temp_iState_bed = { 0 };
|
||||||
|
static float temp_dState_bed = { 0 };
|
||||||
|
static float pTerm_bed;
|
||||||
|
static float iTerm_bed;
|
||||||
|
static float dTerm_bed;
|
||||||
|
//int output;
|
||||||
|
static float pid_error_bed;
|
||||||
|
static float temp_iState_min_bed;
|
||||||
|
static float temp_iState_max_bed;
|
||||||
|
#else //PIDTEMPBED
|
||||||
|
static unsigned long previous_millis_bed_heater;
|
||||||
|
#endif //PIDTEMPBED
|
||||||
static unsigned char soft_pwm[EXTRUDERS];
|
static unsigned char soft_pwm[EXTRUDERS];
|
||||||
|
static unsigned char soft_pwm_bed;
|
||||||
|
|
||||||
#ifdef WATCHPERIOD
|
#ifdef WATCHPERIOD
|
||||||
int watch_raw[EXTRUDERS] = { -1000 }; // the first value used for all
|
int watch_raw[EXTRUDERS] = { -1000 }; // the first value used for all
|
||||||
@@ -122,44 +143,67 @@ static unsigned long previous_millis_bed_heater;
|
|||||||
//============================= functions ============================
|
//============================= functions ============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void PID_autotune(float temp)
|
void PID_autotune(float temp, int extruder, int ncycles)
|
||||||
{
|
{
|
||||||
float input;
|
float input = 0.0;
|
||||||
int cycles=0;
|
int cycles=0;
|
||||||
bool heating = true;
|
bool heating = true;
|
||||||
|
|
||||||
unsigned long temp_millis = millis();
|
unsigned long temp_millis = millis();
|
||||||
unsigned long t1=temp_millis;
|
unsigned long t1=temp_millis;
|
||||||
unsigned long t2=temp_millis;
|
unsigned long t2=temp_millis;
|
||||||
long t_high;
|
long t_high = 0;
|
||||||
long t_low;
|
long t_low = 0;
|
||||||
|
|
||||||
long bias=PID_MAX/2;
|
long bias, d;
|
||||||
long d = PID_MAX/2;
|
|
||||||
float Ku, Tu;
|
float Ku, Tu;
|
||||||
float Kp, Ki, Kd;
|
float Kp, Ki, Kd;
|
||||||
float max, min;
|
float max = 0, min = 10000;
|
||||||
|
|
||||||
|
if ((extruder > EXTRUDERS)
|
||||||
|
#if (TEMP_BED_PIN <= -1)
|
||||||
|
||(extruder < 0)
|
||||||
|
#endif
|
||||||
|
){
|
||||||
|
SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SERIAL_ECHOLN("PID Autotune start");
|
SERIAL_ECHOLN("PID Autotune start");
|
||||||
|
|
||||||
disable_heater(); // switch off all heaters.
|
disable_heater(); // switch off all heaters.
|
||||||
|
|
||||||
soft_pwm[0] = PID_MAX/2;
|
if (extruder<0)
|
||||||
|
{
|
||||||
|
soft_pwm_bed = (MAX_BED_POWER)/2;
|
||||||
|
bias = d = (MAX_BED_POWER)/2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
soft_pwm[extruder] = (PID_MAX)/2;
|
||||||
|
bias = d = (PID_MAX)/2;
|
||||||
|
}
|
||||||
|
|
||||||
for(;;) {
|
|
||||||
|
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
|
||||||
if(temp_meas_ready == true) { // temp sample ready
|
if(temp_meas_ready == true) { // temp sample ready
|
||||||
CRITICAL_SECTION_START;
|
CRITICAL_SECTION_START;
|
||||||
temp_meas_ready = false;
|
temp_meas_ready = false;
|
||||||
CRITICAL_SECTION_END;
|
CRITICAL_SECTION_END;
|
||||||
input = analog2temp(current_raw[0], 0);
|
input = (extruder<0)?analog2tempBed(current_raw_bed):analog2temp(current_raw[extruder], extruder);
|
||||||
|
|
||||||
max=max(max,input);
|
max=max(max,input);
|
||||||
min=min(min,input);
|
min=min(min,input);
|
||||||
if(heating == true && input > temp) {
|
if(heating == true && input > temp) {
|
||||||
if(millis() - t2 > 5000) {
|
if(millis() - t2 > 5000) {
|
||||||
heating=false;
|
heating=false;
|
||||||
soft_pwm[0] = (bias - d) >> 1;
|
if (extruder<0)
|
||||||
|
soft_pwm_bed = (bias - d) >> 1;
|
||||||
|
else
|
||||||
|
soft_pwm[extruder] = (bias - d) >> 1;
|
||||||
t1=millis();
|
t1=millis();
|
||||||
t_high=t1 - t2;
|
t_high=t1 - t2;
|
||||||
max=temp;
|
max=temp;
|
||||||
@@ -172,8 +216,8 @@ void PID_autotune(float temp)
|
|||||||
t_low=t2 - t1;
|
t_low=t2 - t1;
|
||||||
if(cycles > 0) {
|
if(cycles > 0) {
|
||||||
bias += (d*(t_high - t_low))/(t_low + t_high);
|
bias += (d*(t_high - t_low))/(t_low + t_high);
|
||||||
bias = constrain(bias, 20 ,PID_MAX-20);
|
bias = constrain(bias, 20 ,(extruder<0?(MAX_BED_POWER):(PID_MAX))-20);
|
||||||
if(bias > PID_MAX/2) d = PID_MAX - 1 - bias;
|
if(bias > (extruder<0?(MAX_BED_POWER):(PID_MAX))/2) d = (extruder<0?(MAX_BED_POWER):(PID_MAX)) - 1 - bias;
|
||||||
else d = bias;
|
else d = bias;
|
||||||
|
|
||||||
SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);
|
SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);
|
||||||
@@ -210,7 +254,10 @@ void PID_autotune(float temp)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
soft_pwm[0] = (bias + d) >> 1;
|
if (extruder<0)
|
||||||
|
soft_pwm_bed = (bias + d) >> 1;
|
||||||
|
else
|
||||||
|
soft_pwm[extruder] = (bias + d) >> 1;
|
||||||
cycles++;
|
cycles++;
|
||||||
min=temp;
|
min=temp;
|
||||||
}
|
}
|
||||||
@@ -221,17 +268,26 @@ void PID_autotune(float temp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(millis() - temp_millis > 2000) {
|
if(millis() - temp_millis > 2000) {
|
||||||
temp_millis = millis();
|
int p;
|
||||||
SERIAL_PROTOCOLPGM("ok T:");
|
if (extruder<0){
|
||||||
SERIAL_PROTOCOL(degHotend(0));
|
p=soft_pwm_bed;
|
||||||
|
SERIAL_PROTOCOLPGM("ok B:");
|
||||||
|
}else{
|
||||||
|
p=soft_pwm[extruder];
|
||||||
|
SERIAL_PROTOCOLPGM("ok T:");
|
||||||
|
}
|
||||||
|
|
||||||
|
SERIAL_PROTOCOL(input);
|
||||||
SERIAL_PROTOCOLPGM(" @:");
|
SERIAL_PROTOCOLPGM(" @:");
|
||||||
SERIAL_PROTOCOLLN(getHeaterPower(0));
|
SERIAL_PROTOCOLLN(p);
|
||||||
|
|
||||||
|
temp_millis = millis();
|
||||||
}
|
}
|
||||||
if(((millis() - t1) + (millis() - t2)) > (10L*60L*1000L*2L)) {
|
if(((millis() - t1) + (millis() - t2)) > (10L*60L*1000L*2L)) {
|
||||||
SERIAL_PROTOCOLLNPGM("PID Autotune failed! timeout");
|
SERIAL_PROTOCOLLNPGM("PID Autotune failed! timeout");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(cycles > 5) {
|
if(cycles > ncycles) {
|
||||||
SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
|
SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -246,29 +302,28 @@ void updatePID()
|
|||||||
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
|
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PIDTEMPBED
|
||||||
|
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int getHeaterPower(int heater) {
|
int getHeaterPower(int heater) {
|
||||||
|
if (heater<0)
|
||||||
|
return soft_pwm_bed;
|
||||||
return soft_pwm[heater];
|
return soft_pwm[heater];
|
||||||
}
|
}
|
||||||
|
|
||||||
void manage_heater()
|
void manage_heater()
|
||||||
{
|
{
|
||||||
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
|
||||||
static int bed_needs_heating=0;
|
|
||||||
static int bed_is_on=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WATCHDOG
|
|
||||||
wd_reset();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float pid_input;
|
float pid_input;
|
||||||
float pid_output;
|
float pid_output;
|
||||||
|
|
||||||
if(temp_meas_ready != true) //better readability
|
if(temp_meas_ready != true) //better readability
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//Reset the watchdog after we know we have a temperature measurement.
|
||||||
|
watchdog_reset();
|
||||||
|
|
||||||
CRITICAL_SECTION_START;
|
CRITICAL_SECTION_START;
|
||||||
temp_meas_ready = false;
|
temp_meas_ready = false;
|
||||||
CRITICAL_SECTION_END;
|
CRITICAL_SECTION_END;
|
||||||
@@ -298,12 +353,16 @@ void manage_heater()
|
|||||||
temp_iState[e] += pid_error[e];
|
temp_iState[e] += pid_error[e];
|
||||||
temp_iState[e] = constrain(temp_iState[e], temp_iState_min[e], temp_iState_max[e]);
|
temp_iState[e] = constrain(temp_iState[e], temp_iState_min[e], temp_iState_max[e]);
|
||||||
iTerm[e] = Ki * temp_iState[e];
|
iTerm[e] = Ki * temp_iState[e];
|
||||||
|
|
||||||
//K1 defined in Configuration.h in the PID settings
|
//K1 defined in Configuration.h in the PID settings
|
||||||
#define K2 (1.0-K1)
|
#define K2 (1.0-K1)
|
||||||
dTerm[e] = (Kd * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
|
dTerm[e] = (Kd * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
|
||||||
temp_dState[e] = pid_input;
|
temp_dState[e] = pid_input;
|
||||||
|
|
||||||
pid_output = constrain(pTerm[e] + iTerm[e] - dTerm[e], 0, PID_MAX);
|
pid_output = constrain(pTerm[e] + iTerm[e] - dTerm[e], 0, PID_MAX);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
pid_output = constrain(pid_setpoint[e], 0, PID_MAX);
|
||||||
#endif //PID_OPENLOOP
|
#endif //PID_OPENLOOP
|
||||||
#ifdef PID_DEBUG
|
#ifdef PID_DEBUG
|
||||||
SERIAL_ECHOLN(" PIDDEBUG "<<e<<": Input "<<pid_input<<" Output "<<pid_output" pTerm "<<pTerm[e]<<" iTerm "<<iTerm[e]<<" dTerm "<<dTerm[e]);
|
SERIAL_ECHOLN(" PIDDEBUG "<<e<<": Input "<<pid_input<<" Output "<<pid_output" pTerm "<<pTerm[e]<<" iTerm "<<iTerm[e]<<" dTerm "<<dTerm[e]);
|
||||||
@@ -338,42 +397,58 @@ void manage_heater()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
|
||||||
if (bed_needs_heating){
|
|
||||||
if (bed_is_on==0)
|
|
||||||
WRITE(HEATER_BED_PIN,HIGH);
|
|
||||||
if (bed_is_on==1)
|
|
||||||
WRITE(HEATER_BED_PIN,LOW);
|
|
||||||
bed_is_on=(bed_is_on+1) % HEATER_BED_DUTY_CYCLE_DIVIDER;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#ifndef PIDTEMPBED
|
||||||
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
|
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
|
||||||
return;
|
return;
|
||||||
previous_millis_bed_heater = millis();
|
previous_millis_bed_heater = millis();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if TEMP_BED_PIN > -1
|
#if TEMP_BED_PIN > -1
|
||||||
|
|
||||||
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
#ifdef PIDTEMPBED
|
||||||
bed_needs_heating=0;
|
pid_input = analog2tempBed(current_raw_bed);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BED_LIMIT_SWITCHING
|
#ifndef PID_OPENLOOP
|
||||||
|
pid_error_bed = pid_setpoint_bed - pid_input;
|
||||||
|
pTerm_bed = bedKp * pid_error_bed;
|
||||||
|
temp_iState_bed += pid_error_bed;
|
||||||
|
temp_iState_bed = constrain(temp_iState_bed, temp_iState_min_bed, temp_iState_max_bed);
|
||||||
|
iTerm_bed = bedKi * temp_iState_bed;
|
||||||
|
|
||||||
|
//K1 defined in Configuration.h in the PID settings
|
||||||
|
#define K2 (1.0-K1)
|
||||||
|
dTerm_bed= (bedKd * (pid_input - temp_dState_bed))*K2 + (K1 * dTerm_bed);
|
||||||
|
temp_dState_bed = pid_input;
|
||||||
|
|
||||||
|
pid_output = constrain(pTerm_bed + iTerm_bed - dTerm_bed, 0, MAX_BED_POWER);
|
||||||
|
|
||||||
|
#else
|
||||||
|
pid_output = constrain(pid_setpoint_bed, 0, MAX_BED_POWER);
|
||||||
|
#endif //PID_OPENLOOP
|
||||||
|
|
||||||
|
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp))
|
||||||
|
{
|
||||||
|
soft_pwm_bed = (int)pid_output >> 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
soft_pwm_bed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif not defined BED_LIMIT_SWITCHING
|
||||||
// Check if temperature is within the correct range
|
// Check if temperature is within the correct range
|
||||||
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
|
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
|
||||||
if(current_raw_bed >= target_raw_bed)
|
if(current_raw_bed >= target_raw_bed)
|
||||||
{
|
{
|
||||||
WRITE(HEATER_BED_PIN,LOW);
|
soft_pwm_bed = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
soft_pwm_bed = MAX_BED_POWER>>1;
|
||||||
bed_needs_heating=1;
|
|
||||||
#endif
|
|
||||||
WRITE(HEATER_BED_PIN,HIGH);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
soft_pwm_bed = 0;
|
||||||
WRITE(HEATER_BED_PIN,LOW);
|
WRITE(HEATER_BED_PIN,LOW);
|
||||||
}
|
}
|
||||||
#else //#ifdef BED_LIMIT_SWITCHING
|
#else //#ifdef BED_LIMIT_SWITCHING
|
||||||
@@ -381,18 +456,16 @@ void manage_heater()
|
|||||||
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
|
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
|
||||||
if(current_raw_bed > target_bed_high_temp)
|
if(current_raw_bed > target_bed_high_temp)
|
||||||
{
|
{
|
||||||
WRITE(HEATER_BED_PIN,LOW);
|
soft_pwm_bed = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(current_raw_bed <= target_bed_low_temp)
|
if(current_raw_bed <= target_bed_low_temp)
|
||||||
{
|
{
|
||||||
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
soft_pwm_bed = MAX_BED_POWER>>1;
|
||||||
bed_needs_heating=1;
|
|
||||||
#endif
|
|
||||||
WRITE(HEATER_BED_PIN,HIGH);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
soft_pwm_bed = 0;
|
||||||
WRITE(HEATER_BED_PIN,LOW);
|
WRITE(HEATER_BED_PIN,LOW);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -473,7 +546,6 @@ int temp2analogBed(int celsius) {
|
|||||||
#elif defined BED_USES_AD595
|
#elif defined BED_USES_AD595
|
||||||
return lround(((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
|
return lround(((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
|
||||||
#else
|
#else
|
||||||
#warning No heater-type defined for the bed.
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -550,7 +622,6 @@ float analog2tempBed(int raw) {
|
|||||||
#elif defined BED_USES_AD595
|
#elif defined BED_USES_AD595
|
||||||
return ((raw * ((5.0 * 100.0) / 1024.0) / 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
|
#else
|
||||||
#warning No heater-type defined for the bed.
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -568,6 +639,10 @@ void tp_init()
|
|||||||
temp_iState_min[e] = 0.0;
|
temp_iState_min[e] = 0.0;
|
||||||
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
|
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
|
||||||
#endif //PIDTEMP
|
#endif //PIDTEMP
|
||||||
|
#ifdef PIDTEMPBED
|
||||||
|
temp_iState_min_bed = 0.0;
|
||||||
|
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
|
||||||
|
#endif //PIDTEMPBED
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (HEATER_0_PIN > -1)
|
#if (HEATER_0_PIN > -1)
|
||||||
@@ -728,6 +803,7 @@ void disable_heater()
|
|||||||
|
|
||||||
#if TEMP_BED_PIN > -1
|
#if TEMP_BED_PIN > -1
|
||||||
target_raw_bed=0;
|
target_raw_bed=0;
|
||||||
|
soft_pwm_bed=0;
|
||||||
#if HEATER_BED_PIN > -1
|
#if HEATER_BED_PIN > -1
|
||||||
WRITE(HEATER_BED_PIN,LOW);
|
WRITE(HEATER_BED_PIN,LOW);
|
||||||
#endif
|
#endif
|
||||||
@@ -832,6 +908,7 @@ ISR(TIMER0_COMPB_vect)
|
|||||||
static unsigned char soft_pwm_0;
|
static unsigned char soft_pwm_0;
|
||||||
static unsigned char soft_pwm_1;
|
static unsigned char soft_pwm_1;
|
||||||
static unsigned char soft_pwm_2;
|
static unsigned char soft_pwm_2;
|
||||||
|
static unsigned char soft_pwm_b;
|
||||||
|
|
||||||
if(pwm_count == 0){
|
if(pwm_count == 0){
|
||||||
soft_pwm_0 = soft_pwm[0];
|
soft_pwm_0 = soft_pwm[0];
|
||||||
@@ -844,6 +921,10 @@ ISR(TIMER0_COMPB_vect)
|
|||||||
soft_pwm_2 = soft_pwm[2];
|
soft_pwm_2 = soft_pwm[2];
|
||||||
if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
|
if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
|
||||||
#endif
|
#endif
|
||||||
|
#if HEATER_BED_PIN > -1
|
||||||
|
soft_pwm_b = soft_pwm_bed;
|
||||||
|
if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if(soft_pwm_0 <= pwm_count) WRITE(HEATER_0_PIN,0);
|
if(soft_pwm_0 <= pwm_count) WRITE(HEATER_0_PIN,0);
|
||||||
#if EXTRUDERS > 1
|
#if EXTRUDERS > 1
|
||||||
@@ -852,6 +933,9 @@ ISR(TIMER0_COMPB_vect)
|
|||||||
#if EXTRUDERS > 2
|
#if EXTRUDERS > 2
|
||||||
if(soft_pwm_2 <= pwm_count) WRITE(HEATER_2_PIN,0);
|
if(soft_pwm_2 <= pwm_count) WRITE(HEATER_2_PIN,0);
|
||||||
#endif
|
#endif
|
||||||
|
#if HEATER_BED_PIN > -1
|
||||||
|
if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0);
|
||||||
|
#endif
|
||||||
|
|
||||||
pwm_count++;
|
pwm_count++;
|
||||||
pwm_count &= 0x7f;
|
pwm_count &= 0x7f;
|
||||||
|
|||||||
@@ -46,11 +46,15 @@ extern int current_raw_bed;
|
|||||||
extern int target_bed_low_temp ;
|
extern int target_bed_low_temp ;
|
||||||
extern int target_bed_high_temp ;
|
extern int target_bed_high_temp ;
|
||||||
#endif
|
#endif
|
||||||
extern float Kp,Ki,Kd,Kc;
|
|
||||||
|
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
|
extern float Kp,Ki,Kd,Kc;
|
||||||
extern float pid_setpoint[EXTRUDERS];
|
extern float pid_setpoint[EXTRUDERS];
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PIDTEMPBED
|
||||||
|
extern float bedKp,bedKi,bedKd;
|
||||||
|
extern float pid_setpoint_bed;
|
||||||
|
#endif
|
||||||
|
|
||||||
// #ifdef WATCHPERIOD
|
// #ifdef WATCHPERIOD
|
||||||
extern int watch_raw[EXTRUDERS] ;
|
extern int watch_raw[EXTRUDERS] ;
|
||||||
@@ -88,7 +92,9 @@ FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
|
|||||||
FORCE_INLINE void setTargetBed(const float &celsius) {
|
FORCE_INLINE void setTargetBed(const float &celsius) {
|
||||||
|
|
||||||
target_raw_bed = temp2analogBed(celsius);
|
target_raw_bed = temp2analogBed(celsius);
|
||||||
#ifdef BED_LIMIT_SWITCHING
|
#ifdef PIDTEMPBED
|
||||||
|
pid_setpoint_bed = celsius;
|
||||||
|
#elif defined BED_LIMIT_SWITCHING
|
||||||
if(celsius>BED_HYSTERESIS)
|
if(celsius>BED_HYSTERESIS)
|
||||||
{
|
{
|
||||||
target_bed_low_temp= temp2analogBed(celsius-BED_HYSTERESIS);
|
target_bed_low_temp= temp2analogBed(celsius-BED_HYSTERESIS);
|
||||||
@@ -163,7 +169,7 @@ FORCE_INLINE void autotempShutdown(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PID_autotune(float temp);
|
void PID_autotune(float temp, int extruder, int ncycles);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
#include "Marlin.h"
|
#include "Marlin.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
#include "EEPROMwrite.h"
|
#include "ConfigurationStore.h"
|
||||||
#include <LiquidCrystal.h>
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================imported variables============================
|
//=============================imported variables============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@@ -29,6 +29,14 @@ volatile char buttons=0; //the last checked buttons in a bit array.
|
|||||||
long encoderpos=0;
|
long encoderpos=0;
|
||||||
short lastenc=0;
|
short lastenc=0;
|
||||||
|
|
||||||
|
//TODO: This should be in a preferences file.
|
||||||
|
int plaPreheatHotendTemp;
|
||||||
|
int plaPreheatHPBTemp;
|
||||||
|
int plaPreheatFanSpeed;
|
||||||
|
|
||||||
|
int absPreheatHotendTemp;
|
||||||
|
int absPreheatHPBTemp;
|
||||||
|
int absPreheatFanSpeed;
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================private variables============================
|
//=============================private variables============================
|
||||||
@@ -38,16 +46,16 @@ static char messagetext[LCD_WIDTH]="";
|
|||||||
//return for string conversion routines
|
//return for string conversion routines
|
||||||
static char conv[8];
|
static char conv[8];
|
||||||
|
|
||||||
LiquidCrystal lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
|
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
|
||||||
|
|
||||||
static unsigned long previous_millis_lcd=0;
|
static unsigned long previous_millis_lcd=0;
|
||||||
//static long previous_millis_buttons=0;
|
//static long previous_millis_buttons=0;
|
||||||
|
|
||||||
|
|
||||||
#ifdef NEWPANEL
|
#ifdef NEWPANEL
|
||||||
static long blocking=0;
|
static unsigned long blocking=0;
|
||||||
#else
|
#else
|
||||||
static long blocking[8]={0,0,0,0,0,0,0,0};
|
static unsigned long blocking[8]={0,0,0,0,0,0,0,0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static MainMenu menu;
|
static MainMenu menu;
|
||||||
@@ -62,7 +70,7 @@ void lcdProgMemprint(const char *str)
|
|||||||
ch=pgm_read_byte(++str);
|
ch=pgm_read_byte(++str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define lcdprintPGM(x) lcdProgMemprint(MYPGM(x))
|
#define LCD_PRINT_PGM(x) lcdProgMemprint(PSTR(x))
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@@ -133,9 +141,36 @@ void lcd_init()
|
|||||||
B10001,
|
B10001,
|
||||||
B01110
|
B01110
|
||||||
};
|
};
|
||||||
byte uplevel[8]={0x04, 0x0e, 0x1f, 0x04, 0x1c, 0x00, 0x00, 0x00};//thanks joris
|
byte uplevel[8]={
|
||||||
byte refresh[8]={0x00, 0x06, 0x19, 0x18, 0x03, 0x13, 0x0c, 0x00}; //thanks joris
|
B00100,
|
||||||
byte folder [8]={0x00, 0x1c, 0x1f, 0x11, 0x11, 0x1f, 0x00, 0x00}; //thanks joris
|
B01110,
|
||||||
|
B11111,
|
||||||
|
B00100,
|
||||||
|
B11100,
|
||||||
|
B00000,
|
||||||
|
B00000,
|
||||||
|
B00000
|
||||||
|
}; //thanks joris
|
||||||
|
byte refresh[8]={
|
||||||
|
B00000,
|
||||||
|
B00110,
|
||||||
|
B11001,
|
||||||
|
B11000,
|
||||||
|
B00011,
|
||||||
|
B10011,
|
||||||
|
B01100,
|
||||||
|
B00000,
|
||||||
|
}; //thanks joris
|
||||||
|
byte folder [8]={
|
||||||
|
B00000,
|
||||||
|
B11100,
|
||||||
|
B11111,
|
||||||
|
B10001,
|
||||||
|
B10001,
|
||||||
|
B11111,
|
||||||
|
B00000,
|
||||||
|
B00000
|
||||||
|
}; //thanks joris
|
||||||
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
|
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
|
||||||
lcd.createChar(1,Degree);
|
lcd.createChar(1,Degree);
|
||||||
lcd.createChar(2,Thermometer);
|
lcd.createChar(2,Thermometer);
|
||||||
@@ -190,7 +225,7 @@ void lcd_status()
|
|||||||
//static long previous_lcdinit=0;
|
//static long previous_lcdinit=0;
|
||||||
// buttons_check(); // Done in temperature interrupt
|
// buttons_check(); // Done in temperature interrupt
|
||||||
//previous_millis_buttons=millis();
|
//previous_millis_buttons=millis();
|
||||||
long ms=millis();
|
unsigned long ms=millis();
|
||||||
for(int8_t i=0; i<8; i++) {
|
for(int8_t i=0; i<8; i++) {
|
||||||
#ifndef NEWPANEL
|
#ifndef NEWPANEL
|
||||||
if((blocking[i]>ms))
|
if((blocking[i]>ms))
|
||||||
@@ -331,11 +366,11 @@ void MainMenu::showStatus()
|
|||||||
{
|
{
|
||||||
encoderpos=feedmultiply;
|
encoderpos=feedmultiply;
|
||||||
clear();
|
clear();
|
||||||
lcd.setCursor(0,0);lcdprintPGM("\002---/---\001 ");
|
lcd.setCursor(0,0);LCD_PRINT_PGM("\002000/000\001 ");
|
||||||
#if defined BED_USES_THERMISTOR || defined BED_USES_AD595
|
#if defined BED_USES_THERMISTOR || defined BED_USES_AD595
|
||||||
lcd.setCursor(10,0);lcdprintPGM("B---/---\001 ");
|
lcd.setCursor(10,0);LCD_PRINT_PGM("B000/000\001 ");
|
||||||
#elif EXTRUDERS > 1
|
#elif EXTRUDERS > 1
|
||||||
lcd.setCursor(10,0);lcdprintPGM("\002---/---\001 ");
|
lcd.setCursor(10,0);LCD_PRINT_PGM("\002000/000\001 ");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +432,7 @@ void MainMenu::showStatus()
|
|||||||
|
|
||||||
if(starttime!=oldtime)
|
if(starttime!=oldtime)
|
||||||
{
|
{
|
||||||
lcd.print(itostr2(time/60));lcdprintPGM("h ");lcd.print(itostr2(time%60));lcdprintPGM("m");
|
lcd.print(itostr2(time/60));LCD_PRINT_PGM("h ");lcd.print(itostr2(time%60));LCD_PRINT_PGM("m");
|
||||||
oldtime=time;
|
oldtime=time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -406,7 +441,7 @@ void MainMenu::showStatus()
|
|||||||
if((currentz!=oldzpos)||force_lcd_update)
|
if((currentz!=oldzpos)||force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(10,1);
|
lcd.setCursor(10,1);
|
||||||
lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
|
LCD_PRINT_PGM("Z:");lcd.print(ftostr52(current_position[2]));
|
||||||
oldzpos=currentz;
|
oldzpos=currentz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +468,7 @@ void MainMenu::showStatus()
|
|||||||
{
|
{
|
||||||
oldfeedmultiply=curfeedmultiply;
|
oldfeedmultiply=curfeedmultiply;
|
||||||
lcd.setCursor(0,2);
|
lcd.setCursor(0,2);
|
||||||
lcd.print(itostr3(curfeedmultiply));lcdprintPGM("% ");
|
lcd.print(itostr3(curfeedmultiply));LCD_PRINT_PGM("% ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(messagetext[0]!='\0')
|
if(messagetext[0]!='\0')
|
||||||
@@ -452,7 +487,7 @@ void MainMenu::showStatus()
|
|||||||
{
|
{
|
||||||
lcd.setCursor(10,2);
|
lcd.setCursor(10,2);
|
||||||
lcd.print(itostr3((int)percent));
|
lcd.print(itostr3((int)percent));
|
||||||
lcdprintPGM("%SD");
|
LCD_PRINT_PGM("%SD");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else //smaller LCDS----------------------------------
|
#else //smaller LCDS----------------------------------
|
||||||
@@ -461,7 +496,7 @@ void MainMenu::showStatus()
|
|||||||
if(force_lcd_update) //initial display of content
|
if(force_lcd_update) //initial display of content
|
||||||
{
|
{
|
||||||
encoderpos=feedmultiply;
|
encoderpos=feedmultiply;
|
||||||
lcd.setCursor(0,0);lcdprintPGM("\002---/---\001 ");
|
lcd.setCursor(0,0);LCD_PRINT_PGM("\002---/---\001 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
int tHotEnd0=intround(degHotend0());
|
int tHotEnd0=intround(degHotend0());
|
||||||
@@ -515,26 +550,26 @@ void MainMenu::showPrepare()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemP_exit:
|
case ItemP_exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemP_autostart:
|
case ItemP_autostart:
|
||||||
MENUITEM( lcdprintPGM(MSG_AUTOSTART) , BLOCK;
|
MENUITEM( LCD_PRINT_PGM(MSG_AUTOSTART) , BLOCK;
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
card.lastnr=0;card.setroot();card.checkautostart(true);
|
card.lastnr=0;card.setroot();card.checkautostart(true);
|
||||||
#endif
|
#endif
|
||||||
beepshort(); ) ;
|
beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemP_disstep:
|
case ItemP_disstep:
|
||||||
MENUITEM( lcdprintPGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemP_home:
|
case ItemP_home:
|
||||||
MENUITEM( lcdprintPGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28");beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28");beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemP_origin:
|
case ItemP_origin:
|
||||||
MENUITEM( lcdprintPGM(MSG_SET_ORIGIN) , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_SET_ORIGIN) , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemP_preheat_pla:
|
case ItemP_preheat_pla:
|
||||||
MENUITEM( lcdprintPGM(MSG_PREHEAT_PLA) , BLOCK;setTargetHotend0(plaPreheatHotendTemp);setTargetBed(plaPreheatHPBTemp);
|
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_PLA) , BLOCK;setTargetHotend0(plaPreheatHotendTemp);setTargetBed(plaPreheatHPBTemp);
|
||||||
#if FAN_PIN > -1
|
#if FAN_PIN > -1
|
||||||
FanSpeed = plaPreheatFanSpeed;
|
FanSpeed = plaPreheatFanSpeed;
|
||||||
analogWrite(FAN_PIN, FanSpeed);
|
analogWrite(FAN_PIN, FanSpeed);
|
||||||
@@ -542,7 +577,7 @@ void MainMenu::showPrepare()
|
|||||||
beepshort(); );
|
beepshort(); );
|
||||||
break;
|
break;
|
||||||
case ItemP_preheat_abs:
|
case ItemP_preheat_abs:
|
||||||
MENUITEM( lcdprintPGM(MSG_PREHEAT_ABS) , BLOCK;setTargetHotend0(absPreheatHotendTemp);setTargetBed(absPreheatHPBTemp);
|
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_ABS) , BLOCK;setTargetHotend0(absPreheatHotendTemp);setTargetBed(absPreheatHPBTemp);
|
||||||
#if FAN_PIN > -1
|
#if FAN_PIN > -1
|
||||||
FanSpeed = absPreheatFanSpeed;
|
FanSpeed = absPreheatFanSpeed;
|
||||||
analogWrite(FAN_PIN, FanSpeed);
|
analogWrite(FAN_PIN, FanSpeed);
|
||||||
@@ -550,13 +585,13 @@ void MainMenu::showPrepare()
|
|||||||
beepshort(); );
|
beepshort(); );
|
||||||
break;
|
break;
|
||||||
case ItemP_cooldown:
|
case ItemP_cooldown:
|
||||||
MENUITEM( lcdprintPGM(MSG_COOLDOWN) , BLOCK;setTargetHotend0(0);setTargetHotend1(0);setTargetHotend2(0);setTargetBed(0);beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_COOLDOWN) , BLOCK;setTargetHotend0(0);setTargetHotend1(0);setTargetHotend2(0);setTargetBed(0);beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
// case ItemP_extrude:
|
// case ItemP_extrude:
|
||||||
// MENUITEM( lcdprintPGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
|
// MENUITEM( LCD_PRINT_PGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
|
||||||
// break;
|
// break;
|
||||||
case ItemP_move:
|
case ItemP_move:
|
||||||
MENUITEM( lcdprintPGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
|
MENUITEM( LCD_PRINT_PGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -582,14 +617,14 @@ void MainMenu::showAxisMove()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemAM_exit:
|
case ItemAM_exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_PREPARE_ALT) , BLOCK;status=Main_Prepare;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_PREPARE_ALT) , BLOCK;status=Main_Prepare;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemAM_X:
|
case ItemAM_X:
|
||||||
{
|
{
|
||||||
//oldencoderpos=0;
|
//oldencoderpos=0;
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(" X:");
|
lcd.setCursor(0,line);LCD_PRINT_PGM(" X:");
|
||||||
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
|
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,7 +669,7 @@ void MainMenu::showAxisMove()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(" Y:");
|
lcd.setCursor(0,line);LCD_PRINT_PGM(" Y:");
|
||||||
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
|
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,7 +714,7 @@ void MainMenu::showAxisMove()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(" Z:");
|
lcd.setCursor(0,line);LCD_PRINT_PGM(" Z:");
|
||||||
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
|
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,11 +757,11 @@ void MainMenu::showAxisMove()
|
|||||||
break;
|
break;
|
||||||
case ItemAM_E:
|
case ItemAM_E:
|
||||||
// ErikDB: TODO: this length should be changed for volumetric.
|
// ErikDB: TODO: this length should be changed for volumetric.
|
||||||
MENUITEM( lcdprintPGM(MSG_EXTRUDE) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F70 E1");beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_EXTRUDE) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F70 E1");beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemAM_ERetract:
|
case ItemAM_ERetract:
|
||||||
// ErikDB: TODO: this length should be changed for volumetric.
|
// ErikDB: TODO: this length should be changed for volumetric.
|
||||||
MENUITEM( lcdprintPGM(MSG_RETRACT) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E-1");beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_RETRACT) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E-1");beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -752,13 +787,13 @@ void MainMenu::showTune()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemT_exit:
|
case ItemT_exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemT_speed:
|
case ItemT_speed:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_SPEED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_SPEED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
|
lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -793,7 +828,7 @@ void MainMenu::showTune()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +862,7 @@ void MainMenu::showTune()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,7 +898,7 @@ void MainMenu::showTune()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
|
lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +933,7 @@ void MainMenu::showTune()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FLOW);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
|
lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -940,22 +975,22 @@ void MainMenu::showTune()
|
|||||||
updateActiveLines(ItemT_fan,encoderpos);
|
updateActiveLines(ItemT_fan,encoderpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//does not work
|
/*does not work
|
||||||
// #define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \
|
#define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \
|
||||||
// {\
|
{\
|
||||||
// if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
|
if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
|
||||||
// if(activeline==line) \
|
if(activeline==line) \
|
||||||
// { \
|
{ \
|
||||||
// if(CLICKED) \
|
if(CLICKED) \
|
||||||
// { \
|
{ \
|
||||||
// linechanging=!linechanging; \
|
linechanging=!linechanging; \
|
||||||
// if(linechanging) {enter_action;} \
|
if(linechanging) {enter_action;} \
|
||||||
// else {accept_action;} \
|
else {accept_action;} \
|
||||||
// } \
|
} \
|
||||||
// else \
|
else \
|
||||||
// if(linechanging) {change_action};}\
|
if(linechanging) {change_action};}\
|
||||||
// }
|
}
|
||||||
//
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ItemCT_exit,ItemCT_nozzle0,
|
ItemCT_exit,ItemCT_nozzle0,
|
||||||
@@ -987,13 +1022,13 @@ void MainMenu::showControlTemp()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemCT_exit:
|
case ItemCT_exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemCT_nozzle0:
|
case ItemCT_nozzle0:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1028,7 +1063,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE1);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE1);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend1())));
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend1())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,7 +1099,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE2);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE2);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend2())));
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend2())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1100,7 +1135,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_MIN);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_MIN);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
|
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1134,7 +1169,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_MAX);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_MAX);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
|
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1168,7 +1203,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_FACTOR);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FACTOR);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
|
lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,12 +1237,12 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_AUTOTEMP);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_AUTOTEMP);
|
||||||
lcd.setCursor(13,line);
|
lcd.setCursor(13,line);
|
||||||
if(autotemp_enabled)
|
if(autotemp_enabled)
|
||||||
lcdprintPGM(MSG_ON);
|
LCD_PRINT_PGM(MSG_ON);
|
||||||
else
|
else
|
||||||
lcdprintPGM(MSG_OFF);
|
LCD_PRINT_PGM(MSG_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((activeline!=line) )
|
if((activeline!=line) )
|
||||||
@@ -1218,9 +1253,9 @@ void MainMenu::showControlTemp()
|
|||||||
autotemp_enabled=!autotemp_enabled;
|
autotemp_enabled=!autotemp_enabled;
|
||||||
lcd.setCursor(13,line);
|
lcd.setCursor(13,line);
|
||||||
if(autotemp_enabled)
|
if(autotemp_enabled)
|
||||||
lcdprintPGM(MSG_ON);
|
LCD_PRINT_PGM(MSG_ON);
|
||||||
else
|
else
|
||||||
lcdprintPGM(MSG_OFF);
|
LCD_PRINT_PGM(MSG_OFF);
|
||||||
BLOCK;
|
BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1231,7 +1266,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1265,7 +1300,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
|
lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1301,7 +1336,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(" PID-P: ");
|
lcd.setCursor(0,line);LCD_PRINT_PGM(" PID-P: ");
|
||||||
lcd.setCursor(13,line);lcd.print(itostr4(Kp));
|
lcd.setCursor(13,line);lcd.print(itostr4(Kp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1336,7 +1371,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_I);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_PID_I);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
|
lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1371,7 +1406,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_D);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_PID_D);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
|
lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1408,7 +1443,7 @@ void MainMenu::showControlTemp()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_C);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_PID_C);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(Kc));
|
lcd.setCursor(13,line);lcd.print(itostr3(Kc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1443,10 +1478,10 @@ void MainMenu::showControlTemp()
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case ItemCT_PLA_PreHeat_Setting:
|
case ItemCT_PLA_PreHeat_Setting:
|
||||||
MENUITEM( lcdprintPGM(MSG_PREHEAT_PLA_SETTINGS) , BLOCK;status=Sub_PreheatPLASettings;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_PLA_SETTINGS) , BLOCK;status=Sub_PreheatPLASettings;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemCT_ABS_PreHeat_Setting:
|
case ItemCT_ABS_PreHeat_Setting:
|
||||||
MENUITEM( lcdprintPGM(MSG_PREHEAT_ABS_SETTINGS) , BLOCK;status=Sub_PreheatABSSettings;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_ABS_SETTINGS) , BLOCK;status=Sub_PreheatABSSettings;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1478,14 +1513,14 @@ void MainMenu::showControlMotion()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemCM_exit:
|
case ItemCM_exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemCM_acc:
|
case ItemCM_acc:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_ACC);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ACC);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));lcdprintPGM("00");
|
lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));LCD_PRINT_PGM("00");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((activeline!=line) )
|
if((activeline!=line) )
|
||||||
@@ -1510,7 +1545,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(encoderpos<5) encoderpos=5;
|
if(encoderpos<5) encoderpos=5;
|
||||||
if(encoderpos>990) encoderpos=990;
|
if(encoderpos>990) encoderpos=990;
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));LCD_PRINT_PGM("00");
|
||||||
}
|
}
|
||||||
|
|
||||||
}break;
|
}break;
|
||||||
@@ -1518,7 +1553,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_VXY_JERK);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VXY_JERK);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
|
lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1557,11 +1592,11 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_VMAX);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VMAX);
|
||||||
if(i==ItemCM_vmaxx)lcdprintPGM(MSG_X);
|
if(i==ItemCM_vmaxx)LCD_PRINT_PGM(MSG_X);
|
||||||
if(i==ItemCM_vmaxy)lcdprintPGM(MSG_Y);
|
if(i==ItemCM_vmaxy)LCD_PRINT_PGM(MSG_Y);
|
||||||
if(i==ItemCM_vmaxz)lcdprintPGM(MSG_Z);
|
if(i==ItemCM_vmaxz)LCD_PRINT_PGM(MSG_Z);
|
||||||
if(i==ItemCM_vmaxe)lcdprintPGM(MSG_E);
|
if(i==ItemCM_vmaxe)LCD_PRINT_PGM(MSG_E);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
|
lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1597,7 +1632,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_VMIN);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VMIN);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
|
lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1632,7 +1667,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_VTRAV_MIN);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VTRAV_MIN);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
|
lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1671,12 +1706,12 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(" Amax ");
|
lcd.setCursor(0,line);LCD_PRINT_PGM(" Amax ");
|
||||||
if(i==ItemCM_amaxx)lcdprintPGM(MSG_X);
|
if(i==ItemCM_amaxx)LCD_PRINT_PGM(MSG_X);
|
||||||
if(i==ItemCM_amaxy)lcdprintPGM(MSG_Y);
|
if(i==ItemCM_amaxy)LCD_PRINT_PGM(MSG_Y);
|
||||||
if(i==ItemCM_amaxz)lcdprintPGM(MSG_Z);
|
if(i==ItemCM_amaxz)LCD_PRINT_PGM(MSG_Z);
|
||||||
if(i==ItemCM_amaxe)lcdprintPGM(MSG_E);
|
if(i==ItemCM_amaxe)LCD_PRINT_PGM(MSG_E);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00");
|
lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));LCD_PRINT_PGM("00");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((activeline!=line) )
|
if((activeline!=line) )
|
||||||
@@ -1701,7 +1736,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(encoderpos<1) encoderpos=1;
|
if(encoderpos<1) encoderpos=1;
|
||||||
if(encoderpos>990) encoderpos=990;
|
if(encoderpos>990) encoderpos=990;
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));LCD_PRINT_PGM("00");
|
||||||
}
|
}
|
||||||
|
|
||||||
}break;
|
}break;
|
||||||
@@ -1711,8 +1746,8 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_A_RETRACT);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_A_RETRACT);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));lcdprintPGM("00");
|
lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));LCD_PRINT_PGM("00");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((activeline!=line) )
|
if((activeline!=line) )
|
||||||
@@ -1738,7 +1773,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(encoderpos<10) encoderpos=10;
|
if(encoderpos<10) encoderpos=10;
|
||||||
if(encoderpos>990) encoderpos=990;
|
if(encoderpos>990) encoderpos=990;
|
||||||
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00");
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));LCD_PRINT_PGM("00");
|
||||||
}
|
}
|
||||||
|
|
||||||
}break;
|
}break;
|
||||||
@@ -1746,7 +1781,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_XSTEPS);
|
||||||
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS]));
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1783,7 +1818,7 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_YSTEPS);
|
||||||
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS]));
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1821,8 +1856,8 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ZSTEPS);
|
||||||
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Z_AXIS]));
|
lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[Z_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if((activeline!=line) )
|
if((activeline!=line) )
|
||||||
@@ -1860,8 +1895,8 @@ void MainMenu::showControlMotion()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ESTEPS);
|
||||||
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
|
lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[E_AXIS]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if((activeline!=line) )
|
if((activeline!=line) )
|
||||||
@@ -1923,7 +1958,7 @@ void MainMenu::showControlRetract()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemR_exit:
|
case ItemR_exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//float retract_length=2, retract_feedrate=1200, retract_zlift=0.4;
|
//float retract_length=2, retract_feedrate=1200, retract_zlift=0.4;
|
||||||
@@ -1932,12 +1967,12 @@ void MainMenu::showControlRetract()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_AUTORETRACT);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_AUTORETRACT);
|
||||||
lcd.setCursor(13,line);
|
lcd.setCursor(13,line);
|
||||||
if(autoretract_enabled)
|
if(autoretract_enabled)
|
||||||
lcdprintPGM(MSG_ON);
|
LCD_PRINT_PGM(MSG_ON);
|
||||||
else
|
else
|
||||||
lcdprintPGM(MSG_OFF);
|
LCD_PRINT_PGM(MSG_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((activeline!=line) )
|
if((activeline!=line) )
|
||||||
@@ -1948,9 +1983,9 @@ void MainMenu::showControlRetract()
|
|||||||
autoretract_enabled=!autoretract_enabled;
|
autoretract_enabled=!autoretract_enabled;
|
||||||
lcd.setCursor(13,line);
|
lcd.setCursor(13,line);
|
||||||
if(autoretract_enabled)
|
if(autoretract_enabled)
|
||||||
lcdprintPGM(MSG_ON);
|
LCD_PRINT_PGM(MSG_ON);
|
||||||
else
|
else
|
||||||
lcdprintPGM(MSG_OFF);
|
LCD_PRINT_PGM(MSG_OFF);
|
||||||
BLOCK;
|
BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1960,7 +1995,7 @@ void MainMenu::showControlRetract()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr52(retract_length));
|
lcd.setCursor(13,line);lcd.print(ftostr52(retract_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1995,7 +2030,7 @@ void MainMenu::showControlRetract()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACTF);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACTF);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr4(retract_feedrate));
|
lcd.setCursor(13,line);lcd.print(itostr4(retract_feedrate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2030,7 +2065,7 @@ void MainMenu::showControlRetract()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_ZLIFT);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT_ZLIFT);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr52(retract_zlift));;
|
lcd.setCursor(13,line);lcd.print(ftostr52(retract_zlift));;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2065,7 +2100,7 @@ void MainMenu::showControlRetract()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVER);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT_RECOVER);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr52(retract_recover_length));;
|
lcd.setCursor(13,line);lcd.print(ftostr52(retract_recover_length));;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2101,7 +2136,7 @@ void MainMenu::showControlRetract()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVERF);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_CONTROL_RETRACT_RECOVERF);
|
||||||
lcd.setCursor(13,line);lcd.print(itostr4(retract_recover_feedrate));
|
lcd.setCursor(13,line);lcd.print(itostr4(retract_recover_feedrate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2161,59 +2196,59 @@ void MainMenu::showControl()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemC_exit:
|
case ItemC_exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_MAIN_WIDE) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_MAIN_WIDE) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemC_temp:
|
case ItemC_temp:
|
||||||
MENUITEM( lcdprintPGM(MSG_TEMPERATURE_WIDE) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_WIDE) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemC_move:
|
case ItemC_move:
|
||||||
MENUITEM( lcdprintPGM(MSG_MOTION_WIDE) , BLOCK;status=Sub_MotionControl;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_MOTION_WIDE) , BLOCK;status=Sub_MotionControl;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
#ifdef FWRETRACT
|
#ifdef FWRETRACT
|
||||||
case ItemC_rectract:
|
case ItemC_rectract:
|
||||||
MENUITEM( lcdprintPGM(MSG_RECTRACT_WIDE) , BLOCK;status=Sub_RetractControl;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_RECTRACT_WIDE) , BLOCK;status=Sub_RetractControl;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case ItemC_store:
|
case ItemC_store:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
|
||||||
}
|
}
|
||||||
if((activeline==line) && CLICKED)
|
if((activeline==line) && CLICKED)
|
||||||
{
|
{
|
||||||
//enquecommand("M84");
|
//enquecommand("M84");
|
||||||
beepshort();
|
beepshort();
|
||||||
BLOCK;
|
BLOCK;
|
||||||
EEPROM_StoreSettings();
|
Config_StoreSettings();
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case ItemC_load:
|
case ItemC_load:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_LOAD_EPROM);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_LOAD_EPROM);
|
||||||
}
|
}
|
||||||
if((activeline==line) && CLICKED)
|
if((activeline==line) && CLICKED)
|
||||||
{
|
{
|
||||||
//enquecommand("M84");
|
//enquecommand("M84");
|
||||||
beepshort();
|
beepshort();
|
||||||
BLOCK;
|
BLOCK;
|
||||||
EEPROM_RetrieveSettings();
|
Config_RetrieveSettings();
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case ItemC_failsafe:
|
case ItemC_failsafe:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_RESTORE_FAILSAFE);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_RESTORE_FAILSAFE);
|
||||||
}
|
}
|
||||||
if((activeline==line) && CLICKED)
|
if((activeline==line) && CLICKED)
|
||||||
{
|
{
|
||||||
//enquecommand("M84");
|
//enquecommand("M84");
|
||||||
beepshort();
|
beepshort();
|
||||||
BLOCK;
|
BLOCK;
|
||||||
EEPROM_RetrieveSettings(true);
|
Config_ResetDefault();
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
default:
|
default:
|
||||||
@@ -2253,7 +2288,7 @@ void MainMenu::showSD()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
// case 1:
|
// case 1:
|
||||||
// {
|
// {
|
||||||
@@ -2266,11 +2301,11 @@ void MainMenu::showSD()
|
|||||||
// if(true)
|
// if(true)
|
||||||
// #endif
|
// #endif
|
||||||
// {
|
// {
|
||||||
// lcdprintPGM(" \004Refresh");
|
// LCD_PRINT_PGM(" \004Refresh");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// lcdprintPGM(" \004Insert Card");
|
// LCD_PRINT_PGM(" \004Insert Card");
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
@@ -2285,7 +2320,7 @@ void MainMenu::showSD()
|
|||||||
// }break;
|
// }break;
|
||||||
case 1:
|
case 1:
|
||||||
MENUITEM( lcd.print(" ");card.getWorkDirName();
|
MENUITEM( lcd.print(" ");card.getWorkDirName();
|
||||||
if(card.filename[0]=='/') lcdprintPGM(MSG_REFRESH);
|
if(card.filename[0]=='/') LCD_PRINT_PGM(MSG_REFRESH);
|
||||||
else {
|
else {
|
||||||
lcd.print("\005");
|
lcd.print("\005");
|
||||||
lcd.print(card.filename);
|
lcd.print(card.filename);
|
||||||
@@ -2308,8 +2343,12 @@ void MainMenu::showSD()
|
|||||||
{
|
{
|
||||||
card.getfilename(i-FIRSTITEM);
|
card.getfilename(i-FIRSTITEM);
|
||||||
//Serial.print("Filenr:");Serial.println(i-2);
|
//Serial.print("Filenr:");Serial.println(i-2);
|
||||||
lcd.setCursor(0,line);lcdprintPGM(" ");
|
lcd.setCursor(0,line);LCD_PRINT_PGM(" ");
|
||||||
if(card.filenameIsDir) lcd.print("\005");
|
if(card.filenameIsDir)
|
||||||
|
{
|
||||||
|
lcd.print("\005");
|
||||||
|
card.longFilename[LCD_WIDTH-2] = '\0';
|
||||||
|
}
|
||||||
if (card.longFilename[0])
|
if (card.longFilename[0])
|
||||||
{
|
{
|
||||||
card.longFilename[LCD_WIDTH-1] = '\0';
|
card.longFilename[LCD_WIDTH-1] = '\0';
|
||||||
@@ -2326,7 +2365,7 @@ void MainMenu::showSD()
|
|||||||
card.getfilename(i-FIRSTITEM);
|
card.getfilename(i-FIRSTITEM);
|
||||||
if(card.filenameIsDir)
|
if(card.filenameIsDir)
|
||||||
{
|
{
|
||||||
for(int8_t i=0;i<strlen(card.filename);i++)
|
for(uint8_t i=0;i<strlen(card.filename);i++)
|
||||||
card.filename[i]=tolower(card.filename[i]);
|
card.filename[i]=tolower(card.filename[i]);
|
||||||
card.chdir(card.filename);
|
card.chdir(card.filename);
|
||||||
lineoffset=0;
|
lineoffset=0;
|
||||||
@@ -2335,7 +2374,7 @@ void MainMenu::showSD()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char cmd[30];
|
char cmd[30];
|
||||||
for(int8_t i=0;i<strlen(card.filename);i++)
|
for(uint8_t i=0;i<strlen(card.filename);i++)
|
||||||
card.filename[i]=tolower(card.filename[i]);
|
card.filename[i]=tolower(card.filename[i]);
|
||||||
sprintf(cmd,"M23 %s",card.filename);
|
sprintf(cmd,"M23 %s",card.filename);
|
||||||
//sprintf(cmd,"M115");
|
//sprintf(cmd,"M115");
|
||||||
@@ -2401,14 +2440,14 @@ void MainMenu::showMainMenu()
|
|||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case ItemM_watch:
|
case ItemM_watch:
|
||||||
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
case ItemM_prepare:
|
case ItemM_prepare:
|
||||||
MENUITEM( if(!tune) lcdprintPGM(MSG_PREPARE);else lcdprintPGM(MSG_TUNE); , BLOCK;status=Main_Prepare;beepshort(); ) ;
|
MENUITEM( if(!tune) LCD_PRINT_PGM(MSG_PREPARE);else LCD_PRINT_PGM(MSG_TUNE); , BLOCK;status=Main_Prepare;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemM_control:
|
case ItemM_control:
|
||||||
MENUITEM( lcdprintPGM(MSG_CONTROL_ARROW) , BLOCK;status=Main_Control;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL_ARROW) , BLOCK;status=Main_Control;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
case ItemM_file:
|
case ItemM_file:
|
||||||
@@ -2423,13 +2462,13 @@ void MainMenu::showMainMenu()
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(card.sdprinting)
|
if(card.sdprinting)
|
||||||
lcdprintPGM(MSG_STOP_PRINT);
|
LCD_PRINT_PGM(MSG_STOP_PRINT);
|
||||||
else
|
else
|
||||||
lcdprintPGM(MSG_CARD_MENU);
|
LCD_PRINT_PGM(MSG_CARD_MENU);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcdprintPGM(MSG_NO_CARD);
|
LCD_PRINT_PGM(MSG_NO_CARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CARDINSERTED
|
#ifdef CARDINSERTED
|
||||||
@@ -2455,13 +2494,13 @@ void MainMenu::showMainMenu()
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(card.sdprinting)
|
if(card.sdprinting)
|
||||||
lcdprintPGM(MSG_PAUSE_PRINT);
|
LCD_PRINT_PGM(MSG_PAUSE_PRINT);
|
||||||
else
|
else
|
||||||
lcdprintPGM(MSG_RESUME_PRINT);
|
LCD_PRINT_PGM(MSG_RESUME_PRINT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//lcdprintPGM(MSG_NO_CARD);
|
//LCD_PRINT_PGM(MSG_NO_CARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CARDINSERTED
|
#ifdef CARDINSERTED
|
||||||
@@ -2510,7 +2549,7 @@ void MainMenu::showMainMenu()
|
|||||||
void MainMenu::update()
|
void MainMenu::update()
|
||||||
{
|
{
|
||||||
static MainStatus oldstatus=Main_Menu; //init automatically causes foce_lcd_update=true
|
static MainStatus oldstatus=Main_Menu; //init automatically causes foce_lcd_update=true
|
||||||
static long timeoutToStatus=0;
|
static unsigned long timeoutToStatus=0;
|
||||||
static bool oldcardstatus=false;
|
static bool oldcardstatus=false;
|
||||||
#ifdef CARDINSERTED
|
#ifdef CARDINSERTED
|
||||||
if((CARDINSERTED != oldcardstatus))
|
if((CARDINSERTED != oldcardstatus))
|
||||||
@@ -2631,14 +2670,14 @@ void MainMenu::showPLAsettings()
|
|||||||
{
|
{
|
||||||
|
|
||||||
case ItemPLAPreHeat_Exit:
|
case ItemPLAPreHeat_Exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_TEMPERATURE_RTN) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_RTN) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemPLAPreHeat_set_PLA_FanSpeed:
|
case ItemPLAPreHeat_set_PLA_FanSpeed:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatFanSpeed));
|
lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatFanSpeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2672,7 +2711,7 @@ void MainMenu::showPLAsettings()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHotendTemp));
|
lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHotendTemp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2706,7 +2745,7 @@ void MainMenu::showPLAsettings()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHPBTemp));
|
lcd.setCursor(13,line);lcd.print(ftostr3(plaPreheatHPBTemp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2739,14 +2778,14 @@ void MainMenu::showPLAsettings()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
|
||||||
}
|
}
|
||||||
if((activeline==line) && CLICKED)
|
if((activeline==line) && CLICKED)
|
||||||
{
|
{
|
||||||
//enquecommand("M84");
|
//enquecommand("M84");
|
||||||
beepshort();
|
beepshort();
|
||||||
BLOCK;
|
BLOCK;
|
||||||
EEPROM_StoreSettings();
|
Config_StoreSettings();
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
default:
|
default:
|
||||||
@@ -2777,14 +2816,14 @@ void MainMenu::showABSsettings()
|
|||||||
{
|
{
|
||||||
|
|
||||||
case ItemABSPreHeat_Exit:
|
case ItemABSPreHeat_Exit:
|
||||||
MENUITEM( lcdprintPGM(MSG_TEMPERATURE_RTN) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
|
MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_RTN) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemABSPreHeat_set_FanSpeed:
|
case ItemABSPreHeat_set_FanSpeed:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatFanSpeed));
|
lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatFanSpeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2818,7 +2857,7 @@ void MainMenu::showABSsettings()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_NOZZLE);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHotendTemp));
|
lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHotendTemp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2852,7 +2891,7 @@ void MainMenu::showABSsettings()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_BED);
|
||||||
lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHPBTemp));
|
lcd.setCursor(13,line);lcd.print(ftostr3(absPreheatHPBTemp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2885,14 +2924,14 @@ void MainMenu::showABSsettings()
|
|||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
|
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
|
||||||
}
|
}
|
||||||
if((activeline==line) && CLICKED)
|
if((activeline==line) && CLICKED)
|
||||||
{
|
{
|
||||||
//enquecommand("M84");
|
//enquecommand("M84");
|
||||||
beepshort();
|
beepshort();
|
||||||
BLOCK;
|
BLOCK;
|
||||||
EEPROM_StoreSettings();
|
Config_StoreSettings();
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
default:
|
default:
|
||||||
+49
-26
@@ -1,37 +1,41 @@
|
|||||||
#ifndef ULTRALCD_H
|
#ifndef ULTRALCD_H
|
||||||
#define ULTRALCD_H
|
#define ULTRALCD_H
|
||||||
|
|
||||||
#include "Marlin.h"
|
#include "Marlin.h"
|
||||||
|
|
||||||
#ifdef ULTRA_LCD
|
#ifdef ULTRA_LCD
|
||||||
#include <LiquidCrystal.h>
|
#include "language.h"
|
||||||
void lcd_status();
|
|
||||||
void lcd_init();
|
|
||||||
void lcd_status(const char* message);
|
|
||||||
void beep();
|
|
||||||
void buttons_init();
|
|
||||||
void buttons_check();
|
|
||||||
|
|
||||||
#define LCD_UPDATE_INTERVAL 100
|
#if LANGUAGE_CHOICE == 6
|
||||||
#define STATUSTIMEOUT 15000
|
#include "LiquidCrystalRus.h"
|
||||||
extern LiquidCrystal lcd;
|
#define LCD_CLASS LiquidCrystalRus
|
||||||
extern volatile char buttons; //the last checked buttons in a bit array.
|
#else
|
||||||
|
#include <LiquidCrystal.h>
|
||||||
|
#define LCD_CLASS LiquidCrystal
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NEWPANEL
|
void lcd_status();
|
||||||
|
void lcd_init();
|
||||||
|
void lcd_status(const char* message);
|
||||||
|
void beep();
|
||||||
|
void buttons_init();
|
||||||
|
void buttons_check();
|
||||||
|
|
||||||
|
#define LCD_UPDATE_INTERVAL 100
|
||||||
|
#define STATUSTIMEOUT 15000
|
||||||
|
|
||||||
|
extern LCD_CLASS lcd;
|
||||||
|
|
||||||
|
extern volatile char buttons; //the last checked buttons in a bit array.
|
||||||
|
|
||||||
|
#ifdef NEWPANEL
|
||||||
#define EN_C (1<<BLEN_C)
|
#define EN_C (1<<BLEN_C)
|
||||||
#define EN_B (1<<BLEN_B)
|
#define EN_B (1<<BLEN_B)
|
||||||
#define EN_A (1<<BLEN_A)
|
#define EN_A (1<<BLEN_A)
|
||||||
|
|
||||||
#define CLICKED (buttons&EN_C)
|
#define CLICKED (buttons&EN_C)
|
||||||
#define BLOCK {blocking=millis()+blocktime;}
|
#define BLOCK {blocking=millis()+blocktime;}
|
||||||
#if (SDCARDDETECT > -1)
|
#else
|
||||||
#ifdef SDCARDDETECTINVERTED
|
|
||||||
#define CARDINSERTED (READ(SDCARDDETECT)!=0)
|
|
||||||
#else
|
|
||||||
#define CARDINSERTED (READ(SDCARDDETECT)==0)
|
|
||||||
#endif
|
|
||||||
#endif //SDCARDTETECTINVERTED
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
//atomatic, do not change
|
//atomatic, do not change
|
||||||
#define B_LE (1<<BL_LE)
|
#define B_LE (1<<BL_LE)
|
||||||
#define B_UP (1<<BL_UP)
|
#define B_UP (1<<BL_UP)
|
||||||
@@ -44,9 +48,18 @@
|
|||||||
|
|
||||||
#define CLICKED ((buttons&B_MI)||(buttons&B_ST))
|
#define CLICKED ((buttons&B_MI)||(buttons&B_ST))
|
||||||
#define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
|
#define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#if (SDCARDDETECT > -1)
|
||||||
|
#ifdef SDCARDDETECTINVERTED
|
||||||
|
#define CARDINSERTED (READ(SDCARDDETECT)!=0)
|
||||||
|
#else
|
||||||
|
#define CARDINSERTED (READ(SDCARDDETECT)==0)
|
||||||
|
#endif //SDCARDTETECTINVERTED
|
||||||
|
#else
|
||||||
|
//If we don't have a card detect line, aways asume the card is inserted
|
||||||
|
#define CARDINSERTED true
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// blocking time for recognizing a new keypress of one key, ms
|
// blocking time for recognizing a new keypress of one key, ms
|
||||||
@@ -143,8 +156,8 @@
|
|||||||
|
|
||||||
#define LCD_INIT lcd_init();
|
#define LCD_INIT lcd_init();
|
||||||
#define LCD_MESSAGE(x) lcd_status(x);
|
#define LCD_MESSAGE(x) lcd_status(x);
|
||||||
#define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x));
|
#define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
|
||||||
#define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(MYPGM(x));
|
#define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(PSTR(x));
|
||||||
#define LCD_STATUS lcd_status()
|
#define LCD_STATUS lcd_status()
|
||||||
#else //no lcd
|
#else //no lcd
|
||||||
#define LCD_INIT
|
#define LCD_INIT
|
||||||
@@ -169,4 +182,14 @@ char *itostr31(const int &xx);
|
|||||||
char *itostr3(const int &xx);
|
char *itostr3(const int &xx);
|
||||||
char *itostr4(const int &xx);
|
char *itostr4(const int &xx);
|
||||||
char *ftostr51(const float &x);
|
char *ftostr51(const float &x);
|
||||||
|
|
||||||
|
//TODO: These do not belong here.
|
||||||
|
extern int plaPreheatHotendTemp;
|
||||||
|
extern int plaPreheatHPBTemp;
|
||||||
|
extern int plaPreheatFanSpeed;
|
||||||
|
|
||||||
|
extern int absPreheatHotendTemp;
|
||||||
|
extern int absPreheatHPBTemp;
|
||||||
|
extern int absPreheatFanSpeed;
|
||||||
|
|
||||||
#endif //ULTRALCD
|
#endif //ULTRALCD
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
#include "Marlin.h"
|
||||||
|
|
||||||
|
#ifdef USE_WATCHDOG
|
||||||
|
#include <avr/wdt.h>
|
||||||
|
|
||||||
|
#include "watchdog.h"
|
||||||
|
#include "ultralcd.h"
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//=============================private variables ============================
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//=============================functinos ============================
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
|
||||||
|
/// intialise watch dog with a 1 sec interrupt time
|
||||||
|
void watchdog_init()
|
||||||
|
{
|
||||||
|
#ifdef WATCHDOG_RESET_MANUAL
|
||||||
|
//We enable the watchdog timer, but only for the interrupt.
|
||||||
|
//Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
|
||||||
|
wdt_reset();
|
||||||
|
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
|
||||||
|
_WD_CONTROL_REG = _BV(WDIE) | WDTO_1S;
|
||||||
|
#else
|
||||||
|
wdt_enable(WDTO_1S);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
||||||
|
void watchdog_reset()
|
||||||
|
{
|
||||||
|
wdt_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//=============================ISR ============================
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
|
||||||
|
#ifdef WATCHDOG_RESET_MANUAL
|
||||||
|
ISR(WDT_vect)
|
||||||
|
{
|
||||||
|
//TODO: This message gets overwritten by the kill() call
|
||||||
|
LCD_MESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display
|
||||||
|
LCD_STATUS;
|
||||||
|
SERIAL_ERROR_START;
|
||||||
|
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
|
||||||
|
kill(); //kill blocks
|
||||||
|
while(1); //wait for user or serial reset
|
||||||
|
}
|
||||||
|
#endif//RESET_MANUAL
|
||||||
|
|
||||||
|
#endif//USE_WATCHDOG
|
||||||
+8
-7
@@ -1,16 +1,17 @@
|
|||||||
#ifndef WATCHDOG_H
|
#ifndef WATCHDOG_H
|
||||||
#define WATCHDOG_H
|
#define WATCHDOG_H
|
||||||
|
|
||||||
#include "Marlin.h"
|
#include "Marlin.h"
|
||||||
|
|
||||||
#ifdef USE_WATCHDOG
|
#ifdef USE_WATCHDOG
|
||||||
|
|
||||||
// intialise watch dog with a 1 sec interrupt time
|
// intialise watch dog with a 1 sec interrupt time
|
||||||
void wd_init();
|
void watchdog_init();
|
||||||
// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
|
// pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or avr will go into emergency procedures..
|
||||||
void wd_reset();
|
void watchdog_reset();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
FORCE_INLINE void wd_init() {};
|
//If we do not have a watchdog, then we can have empty functions which are optimized away.
|
||||||
FORCE_INLINE void wd_reset() {};
|
FORCE_INLINE void watchdog_init() {};
|
||||||
|
FORCE_INLINE void watchdog_reset() {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
#ifdef USE_WATCHDOG
|
|
||||||
#include "Marlin.h"
|
|
||||||
#include "watchdog.h"
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//=============================private variables ============================
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
static volatile uint8_t timeout_seconds=0;
|
|
||||||
|
|
||||||
void(* ctrlaltdelete) (void) = 0; //does not work on my atmega2560
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//=============================functinos ============================
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
|
|
||||||
/// intialise watch dog with a 1 sec interrupt time
|
|
||||||
void wd_init()
|
|
||||||
{
|
|
||||||
WDTCSR |= (1<<WDCE )|(1<<WDE ); //allow changes
|
|
||||||
WDTCSR = (1<<WDCE )|(1<<WDE )|(1<<WDP3 )|(1<<WDP0); // Reset after 8 sec.
|
|
||||||
// WDTCSR = (1<<WDIF)|(1<<WDIE)| (1<<WDCE )|(1<<WDE )| (1<<WDP3) | (1<<WDP0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
|
||||||
void wd_reset()
|
|
||||||
{
|
|
||||||
wdt_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//=============================ISR ============================
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
//Watchdog timer interrupt, called if main program blocks >1sec
|
|
||||||
ISR(WDT_vect)
|
|
||||||
{
|
|
||||||
if(timeout_seconds++ >= WATCHDOG_TIMEOUT)
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef RESET_MANUAL
|
|
||||||
LCD_MESSAGEPGM("Please Reset!");
|
|
||||||
LCD_STATUS;
|
|
||||||
SERIAL_ERROR_START;
|
|
||||||
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
|
|
||||||
#else
|
|
||||||
LCD_MESSAGEPGM("Timeout, resetting!");
|
|
||||||
LCD_STATUS;
|
|
||||||
#endif
|
|
||||||
//disable watchdog, it will survife reboot.
|
|
||||||
WDTCSR |= (1<<WDCE) | (1<<WDE);
|
|
||||||
WDTCSR = 0;
|
|
||||||
#ifdef RESET_MANUAL
|
|
||||||
kill(); //kill blocks
|
|
||||||
while(1); //wait for user or serial reset
|
|
||||||
#else
|
|
||||||
ctrlaltdelete();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* USE_WATCHDOG */
|
|
||||||
Reference in New Issue
Block a user