Compare commits

...

75 Commits

Author SHA1 Message Date
daid303 06b58a9c4f First cleanup. Moved all code to cpp files, so there are no dependencies on pde files. And no more odd requirement to cat files together. (Still need to fix the Makefile). Also cleaned up some defines and made defines upper case as by C coding conventions. 2012-11-06 12:06:41 +01:00
daid 539f3b3fe4 Merge pull request #284 from brackendawson/Marlin_v1
Use the right pins for Gen7 1.4
2012-11-06 01:06:24 -08:00
daid 2f20df3f55 Merge pull request #289 from buildrob/Marlin_v1
Marlin v1 configurable serial port
2012-11-06 01:00:50 -08:00
Robert F-C 65c9a0728f Set default serial port back to 0. 2012-11-05 22:15:07 +11:00
Robert F-C ab9d183024 Make serial port configurable.
This change makes the choice of serial port configurable so that
wireless capability can be easily added by connecting Bluetooth modules
(such as BlueSmirf or JY-MCU) to the expansion port pins.
2012-11-05 21:34:27 +11:00
Bracken Dawson f5631a89e8 Add dummy Emergancy Pin to Gen7 1.4
Change required after pulling from ErikZalm.
2012-10-26 22:28:37 +01:00
Bracken Dawson a4f9e1ebf2 Merge git://github.com/ErikZalm/Marlin into Marlin_v1 2012-10-26 22:20:35 +01:00
Bracken Dawson 2873d67b17 Put bogus temp override back in Gen7 up to 1.3
Took out the ifdef when I split 1.4 out and forgot to permanently
define it for <=1.3.
2012-10-26 22:17:26 +01:00
ErikZalm a7e40b2903 Merge pull request #276 from setar/Marlin_v1
Fix num of digits on LCD for E and Z axis.
2012-10-23 09:48:55 -07:00
ErikZalm 23b0f8ed4b Merge pull request #279 from MaikStohn/Marlin_v1
Fixed wrong code (will not even compile when EXTRUDERS>2)
2012-10-23 09:48:02 -07:00
MaikStohn 6ed02c86be Fixed wrong code (will not even compile when EXTRUDERS>2) 2012-10-23 18:08:43 +02:00
Sergey Taranenko 2a67363e27 Fix ‘prog_uchar’ definition in LiquidCrystalRus.cpp 2012-10-22 11:05:17 +04:00
Sergey Taranenko 205304ddee Merge git://github.com/ErikZalm/Marlin into Marlin_v1 2012-10-22 10:59:27 +04:00
Erik vd Zalm 58bca87c72 fix LCD temp bed artifacts on power up ' B022/0.) -> B022/000 ' 2012-10-21 14:40:06 +02:00
Erik vd Zalm febeb43197 Revert "fix LCD temp bed artifacts on power up ' B022/0.) -> B022/000 '"
This reverts commit cb02c2f9d8.
2012-10-21 14:36:31 +02:00
Sergey Taranenko 8178dec4c3 Fix num of digits on LCD for E and Z axis.
The number of steps per mm often contains 4 digits before the decimal point and does not require precision greater than 0.1
2012-10-18 17:45:40 +04:00
ErikZalm 70f57a6844 Merge pull request #273 from setar/Marlin_v1
fix LCD temp bed artifacts on power up ' B022/0.) -> B022/000 '
2012-10-17 04:10:18 -07:00
ErikZalm ff14199e58 Merge pull request #270 from jothan/Marlin_v1
Create an explicit rule for building applet/Marlin.cpp.
2012-10-17 04:09:36 -07:00
ErikZalm bfdf0932c1 Merge pull request #274 from DanieleSdei/Marlin_v1
Italian language support
2012-10-17 04:09:13 -07:00
Daniele Sdei 695938ba3f Italian language support 2012-10-17 12:48:26 +02:00
Sergey Taranenko cb02c2f9d8 fix LCD temp bed artifacts on power up ' B022/0.) -> B022/000 ' 2012-10-17 10:49:05 +04:00
Jonathan Bastien-Filiatrault e4a5e333ef Generalize. 2012-10-15 21:34:33 -04:00
Jonathan Bastien-Filiatrault e10d3136c8 Create an explicit rule for building applet/Marlin.cpp.
It would seem that the pattern matches do not work when the source
file is created when make is running. The result of this is that it is
necessary to run "make" twice to build the firmware.

This adds an explicit rule without a pattern match for building
applet/Marlin.cpp it corrects the make behaviour at the cost of adding
a little redundancy in the Makefile.
2012-10-15 21:16:25 -04:00
ErikZalm 9f089756b7 Merge pull request #265 from setar/Marlin_v1
Added Russian translation
2012-10-14 14:11:58 -07:00
ErikZalm 654387297f Merge pull request #268 from brupje/Marlin_v1
Marlin v1
2012-10-14 08:55:01 -07:00
brupje 326423719f Add support for Megatronics 2012-10-14 14:05:57 +03:00
brupje d07b6e93d5 Add support for Megatronics 2012-10-14 14:05:12 +03:00
Sergey Taranenko efcc28d347 Fix check for include LiquidCrystalRus.h 2012-10-13 00:29:34 +04:00
Sergey Taranenko cfc193cdac Enables support the Cyrillic alphabet for LCD 2012-10-12 19:06:43 +04:00
Sergey Taranenko 24bcc9647d Added Russian translation 2012-10-12 18:33:05 +04:00
ErikZalm bc27d809fb Merge pull request #262 from markfinn/bedpid-clean3
Remove unwanted artifacts in merge of bed-pid tree
2012-10-09 13:18:58 -07:00
Mark Finn bf7e453d02 Unwanted artifacts from unclean merge of bed-pid tree 2012-10-09 14:47:35 -05:00
ErikZalm 36a746d7d5 Merge pull request #244 from markfinn/pidbed
PID for heated bed
2012-10-08 11:15:16 -07:00
ErikZalm 50daf27e5a Merge pull request #255 from elgambitero/Marlin_v1
Spanish language updated
2012-09-26 10:29:03 -07:00
elgambitero df09e2adce Spanish updated 2012-09-26 19:14:07 +02:00
elgambitero ddf6603d81 Spanish language updated. Bug fixes on dialogs. 2012-09-26 19:11:45 +02:00
elgambitero 4bf8b1aeee fesfas 2012-09-26 19:05:31 +02:00
elgambitero 7afd202b89 New dialogs translated to spanish. Bug fixes.
Dialogs from M119 translated, and "Set Preheat" dialogs adapted to the
screen size.
2012-09-25 19:16:57 +02:00
elgambitero ebc4601185 Some new dialogs translated to Spanish 2012-09-25 19:08:44 +02:00
ErikZalm c0aad4c28a Merge pull request #254 from ZetaPhoenix/Marlin_v1_bugfix
Changes to M119 response for easier visual comparison
2012-09-25 00:10:38 -07:00
Mark Finn d197f8504b clean up and changes from testing 2012-09-17 19:18:50 -05:00
Mark Finn eb06a886c4 missed 2012-09-17 14:23:49 -05:00
Mark Finn 04631d2250 cleanup for pull 2012-09-17 14:17:24 -05:00
Mark Finn 0a5ad3ab85 move comment to correct place 2012-09-17 08:42:35 -05:00
ZetaPhoenix 8ac5b29e02 Changes to M119 response for easier visual comparison
Changed to report on individual lines with "TRIGGERED" or "open" instead of "H" or "L" on one line as H&L could be confused with logic levels High and Low which may be wrong if using inverted logic.  Added strings to language.h.

Fixed typo "deu" in English language that was fixed in #134 but got added back in via 9f7f7354f5
2012-09-16 14:51:24 -07:00
ErikZalm 0a31ccb1d1 Merge pull request #251 from ZetaPhoenix/Marlin_v1_bugfix
Limit Switch locations based on MIN/MAX limits and homing direction
2012-09-16 01:47:51 -07:00
ZetaPhoenix c6caa45ae2 Limit Switch locations based on MIN/MAX limits and homing direction
fixes #246
Added statements to set the limit switch positions to the maximum travel if homing in the positive direction as well as bed center at (0,0) if defined.
Relocated code based on feedback.
2012-09-15 15:25:49 -07:00
ZetaPhoenix dc566d654f fixes #246
Added statements to set the limit switch positions to the maximum travel if homing in the positive direction as well as bed center at (0,0) if defined.
2012-09-14 21:48:49 -07:00
ErikZalm ba898faa7d Merge pull request #249 from gwelchc/patch-2
Slight modification for byte savings
2012-09-14 12:13:36 -07:00
ErikZalm 0152ee71a5 Merge pull request #248 from gwelchc/patch-1
Binary representation for characters in ultraldc.pde
2012-09-14 12:10:28 -07:00
ErikZalm 348d543425 Merge pull request #245 from andrey-vasilyev/patch-1
Fix M81 not working reliably on Gen7
2012-09-14 12:04:57 -07:00
G. W. C. 6ccbfeb80c Update Marlin/Marlin.pde
Added function 'setTargetedHotend' that turns into a function an operation repeated 3 times through the M-codes processing.

This modification saves a few bytes that can be used to add support for new commands.
2012-09-14 16:38:54 +03:00
G. W. C. c433142abf Update Marlin/ultralcd.pde
The joris' char drawins are expressed in binary so to show their content's in a more visual fashion.

This is not a code modification as much as a readibility modification.
2012-09-14 16:29:43 +03:00
andrey-vasilyev 1d389ad3a8 Fix M81 not working reliably on Gen7
Some discussion of the issue is here http://forums.reprap.org/read.php?181,118329,page=1
2012-09-13 19:23:48 +04:00
Mark Finn 5bfccab650 readme 2012-09-12 21:52:16 -05:00
Mark Finn 9698f4ea64 bed pid
Conflicts:

	Marlin/Configuration.h
2012-09-12 21:18:59 -05:00
ErikZalm 769796ed4c Merge pull request #240 from ZetaPhoenix/Marlin_v1_bugfix
Missing #else in temperature.cpp prevented reading bed temp when TEMP_BE...
2012-09-11 02:10:39 -07:00
ZetaPhoenix e8c92e0a95 Missing #else in temperature.cpp prevented reading bed temp when TEMP_BED_PIN <7. Thanks to Leland Wallace for helping me track this down via "Sesame Street" coding (what is not like the other) 2012-09-09 16:06:02 -07:00
Erik vd Zalm abf0693e8e Added KILL_PIN -1 to gen7 boards 2012-09-04 08:20:27 +02:00
Erik vd Zalm 47319cf64e Fixed typo in SF arc fix code. 2012-09-03 21:28:31 +02:00
Erik vd Zalm e358a2d7af Added fix for SF Arc Point fillet procedure 2012-09-02 01:12:49 +02:00
ErikZalm 044a64a1fb Merge pull request #225 from Justblair/Marlin_v1
Added PDF file containing Menu Tree for documentation purposes.
2012-09-01 04:41:49 -07:00
ErikZalm cd91e0e3e1 Merge pull request #228 from Drakelive/patch-1
Update Marlin/pins.h
2012-08-30 13:39:37 -07:00
Drakelive d728e35658 Update Marlin/pins.h 2012-08-30 23:36:49 +03:00
Blair Thompson dcd3e8a211 Tidy up 2012-08-29 22:53:41 +01:00
Blair Thompson ddd9d0cfd4 Added PDF file containing Menu Tree for documentation purposes. Source xlsx document included. 2012-08-29 21:08:41 +01:00
Erik vd Zalm 0e58ef6805 Some dialogs are corrected 2012-08-29 21:15:59 +02:00
Erik vd Zalm 0e89022cc3 Correct temptable_55 name. 2012-08-28 19:47:22 +02:00
Bracken Dawson 47d4f55bc0 Fix Gen7 1.4 pinout
Gen7 1.4 uses very different pin assignments, might as well make a new
section and remove some of the conditionals from each. It's easier to change
your pin assingment this way if like me you don't wire it exactly to plan.
2012-08-22 23:15:46 +01:00
elgambitero 6cd150842f Update Marlin/language.h
Some dialogs corrected and Default language set to 1
2012-08-22 21:46:22 +03:00
elgambitero 299c18596f Update Marlin/language.h
Some dialogs are corrected
2012-08-22 21:44:57 +03:00
ErikZalm b86336c3f5 Merge pull request #221 from daid/Marlin_v1
Long filename support for LCD display
2012-08-22 06:30:35 -07:00
daid b69e75c89a Added long filename support. 2012-08-22 14:49:57 +02:00
daid 87ff61a8a6 Fix for #201 2012-08-22 10:54:55 +02:00
elgambitero d38b96fff1 Update Marlin/language.h 2012-08-12 22:45:11 +03:00
33 changed files with 3700 additions and 2251 deletions
+56 -5
View File
@@ -11,6 +11,11 @@
#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.
// 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
#define BAUDRATE 250000
//#define BAUDRATE 115200
@@ -30,6 +35,7 @@
// Ultimaker = 7
// Teensylu = 8
// Gen3+ =9
// Megatronics =70
#ifndef MOTHERBOARD
#define MOTHERBOARD 7
@@ -98,7 +104,7 @@
#define PID_MAX 255 // limits current to nozzle; 255=full current
#ifdef PIDTEMP
//#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 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
@@ -120,6 +126,44 @@
// #define DEFAULT_Kd 440
#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
//can be software-disabled for whatever purposes by
#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 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
#define X_HOME_POS 0
#define Y_HOME_POS 0
#define Z_HOME_POS 0
// The position of the homing switches
//#define MANUAL_HOME_POSITIONS // If defined, manualy programed locations will be used
//#define BED_CENTER_AT_0_0 // If defined the center of the bed is defined as (0,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
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
@@ -285,6 +333,9 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
// Data from: http://www.doc-diy.net/photo/rc-1_hacked/
// #define PHOTOGRAPH_PIN 23
// SF send wrong arc g-codes when using Arc Point as fillet procedure
//#define SF_ARC_FIX
#include "Configuration_adv.h"
#include "thermistortables.h"
+57 -13
View File
@@ -5,13 +5,10 @@
//=============================Thermal Settings ============================
//===========================================================================
// Select one of these only to define how the bed temp is read.
//
//#define 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
#endif
#define BED_CHECK_INTERVAL 5000 //ms
#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
//// Heating sanity check:
// 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
//// 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.
// A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -136,15 +181,14 @@
#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.
// The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However:
// the Watchdog is not working well, so please only enable this for testing
// this enables the watchdog interrupt.
//#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:
// The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
#define USE_WATCHDOG
#ifdef USE_WATCHDOG
// you cannot watchdog reboot on Arduino mega2560 due to a bug in he bootloader. Hence we need to ask the user to reset.
// 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 RESET_MANUAL
//#define WATCHDOG_TIMEOUT 4 //seconds
//#endif
#endif
// extruder advance constant (s2/mm3)
//
@@ -169,7 +213,7 @@
#define MM_PER_ARC_SEGMENT 1
#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
// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
-8
View File
@@ -6,14 +6,6 @@
#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;
Binary file not shown.
+389
View File
@@ -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;
}
+129
View File
@@ -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
+4
View File
@@ -277,6 +277,10 @@ applet/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
$(Pecho) " CC $@"
$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)
$(Pecho) " CXX $@"
$P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
+7 -16
View File
@@ -17,8 +17,8 @@
#include <util/delay.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include "fastio.h"
@@ -52,22 +52,11 @@
#define MYSERIAL MSerial
#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_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_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MYSERIAL.write('\n');}
#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(PSTR(x));MYSERIAL.write('\n');}
const char errormagic[] PROGMEM ="Error:";
@@ -92,7 +81,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.
#define SerialprintPGM(x) serialprintPGM(MYPGM(x))
FORCE_INLINE void serialprintPGM(const char *str)
{
char ch=pgm_read_byte(str);
@@ -197,6 +185,9 @@ extern float min_pos[3];
extern float max_pos[3];
extern unsigned char FanSpeed;
extern unsigned long starttime;
extern unsigned long stoptime;
// Handling multiple extruders pins
extern uint8_t active_extruder;
+5 -1795
View File
File diff suppressed because it is too large Load Diff
+18 -24
View File
@@ -28,7 +28,7 @@
// 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)
#if UART_PRESENT(SERIAL_PORT)
ring_buffer rx_buffer = { { 0 }, 0, 0 };
#endif
@@ -48,18 +48,12 @@ FORCE_INLINE void store_char(unsigned char c)
//#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
//SIGNAL(SIG_USART_RECV)
SIGNAL(USART0_RX_vect)
SIGNAL(M_USARTx_RX_vect)
{
#if defined(UDR0)
unsigned char c = UDR0;
#elif defined(UDR)
unsigned char c = UDR; // atmega8, atmega32
#else
#error UDR not defined
#endif
unsigned char c = M_UDRx;
store_char(c);
}
#endif
@@ -76,39 +70,39 @@ MarlinSerial::MarlinSerial()
void MarlinSerial::begin(long baud)
{
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
// with the Duemilanove and previous boards and the firmware on the 8U2
// on the Uno and Mega 2560.
if (baud == 57600) {
useU2X0 = false;
useU2X = false;
}
#endif
if (useU2X0) {
UCSR0A = 1 << U2X0;
if (useU2X) {
M_UCSRxA = 1 << M_U2Xx;
baud_setting = (F_CPU / 4 / baud - 1) / 2;
} else {
UCSR0A = 0;
M_UCSRxA = 0;
baud_setting = (F_CPU / 8 / baud - 1) / 2;
}
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
UBRR0H = baud_setting >> 8;
UBRR0L = baud_setting;
M_UBRRxH = baud_setting >> 8;
M_UBRRxL = baud_setting;
sbi(UCSR0B, RXEN0);
sbi(UCSR0B, TXEN0);
sbi(UCSR0B, RXCIE0);
sbi(M_UCSRxB, M_RXENx);
sbi(M_UCSRxB, M_TXENx);
sbi(M_UCSRxB, M_RXCIEx);
}
void MarlinSerial::end()
{
cbi(UCSR0B, RXEN0);
cbi(UCSR0B, TXEN0);
cbi(UCSR0B, RXCIE0);
cbi(M_UCSRxB, M_RXENx);
cbi(M_UCSRxB, M_TXENx);
cbi(M_UCSRxB, M_RXCIEx);
}
+44 -6
View File
@@ -23,6 +23,44 @@
#define MarlinSerial_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)
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
// 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 HEX 16
@@ -46,7 +84,7 @@ struct ring_buffer
int tail;
};
#if defined(UBRRH) || defined(UBRR0H)
#if UART_PRESENT(SERIAL_PORT)
extern ring_buffer rx_buffer;
#endif
@@ -68,17 +106,17 @@ class MarlinSerial //: public Stream
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)
{
if((UCSR0A & (1<<RXC0)) != 0) {
unsigned char c = UDR0;
if((M_UCSRxA & (1<<M_RXCx)) != 0) {
unsigned char c = M_UDRx;
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
// if we should be storing the received character into the location
@@ -147,4 +185,4 @@ class MarlinSerial //: public Stream
extern MarlinSerial MSerial;
#endif // ! teensylu
#endif
#endif
File diff suppressed because it is too large Load Diff
Binary file not shown.
+1 -3
View File
@@ -369,7 +369,6 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
*
* \param[in] blockNumber Logical block to be read.
* \param[out] dst Pointer to the location that will receive the data.
* \return The value one, true, is returned for success and
* the value zero, false, is returned for failure.
*/
@@ -639,5 +638,4 @@ bool Sd2Card::writeStop() {
return false;
}
#endif
#endif
+37 -3
View File
@@ -867,7 +867,7 @@ bool SdBaseFile::openParent(SdBaseFile* dir) {
}
// search for parent in '../..'
do {
if (file.readDir(&entry) != 32) goto fail;
if (file.readDir(&entry, NULL) != 32) goto fail;
c = entry.firstClusterLow;
c |= (uint32_t)entry.firstClusterHigh << 16;
} while (c != cluster);
@@ -1108,10 +1108,16 @@ int16_t SdBaseFile::read(void* buf, uint16_t nbyte) {
* readDir() called before a directory has been opened, this is not
* a directory file or an I/O error occurred.
*/
int8_t SdBaseFile::readDir(dir_t* dir) {
int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
int16_t n;
// if not a directory file or miss-positioned return an error
if (!isDir() || (0X1F & curPosition_)) return -1;
//If we have a longFilename buffer, mark it as invalid. If we find a long filename it will be filled automaticly.
if (longFilename != NULL)
{
longFilename[0] = '\0';
}
while (1) {
n = read(dir, sizeof(dir_t));
@@ -1120,6 +1126,34 @@ int8_t SdBaseFile::readDir(dir_t* dir) {
if (dir->name[0] == DIR_NAME_FREE) return 0;
// skip empty entries and entry for . and ..
if (dir->name[0] == DIR_NAME_DELETED || dir->name[0] == '.') continue;
//Fill the long filename if we have a long filename entry,
// long filename entries are stored before the actual filename.
if (DIR_IS_LONG_NAME(dir) && longFilename != NULL)
{
vfat_t *VFAT = (vfat_t*)dir;
//Sanity check the VFAT entry. The first cluster is always set to zero. And th esequence number should be higher then 0
if (VFAT->firstClusterLow == 0 && (VFAT->sequenceNumber & 0x1F) > 0 && (VFAT->sequenceNumber & 0x1F) <= MAX_VFAT_ENTRIES)
{
//TODO: Store the filename checksum to verify if a none-long filename aware system modified the file table.
n = ((VFAT->sequenceNumber & 0x1F) - 1) * 13;
longFilename[n+0] = VFAT->name1[0];
longFilename[n+1] = VFAT->name1[1];
longFilename[n+2] = VFAT->name1[2];
longFilename[n+3] = VFAT->name1[3];
longFilename[n+4] = VFAT->name1[4];
longFilename[n+5] = VFAT->name2[0];
longFilename[n+6] = VFAT->name2[1];
longFilename[n+7] = VFAT->name2[2];
longFilename[n+8] = VFAT->name2[3];
longFilename[n+9] = VFAT->name2[4];
longFilename[n+10] = VFAT->name2[5];
longFilename[n+11] = VFAT->name3[0];
longFilename[n+12] = VFAT->name3[1];
//If this VFAT entry is the last one, add a NUL terminator at the end of the string
if (VFAT->sequenceNumber & 0x40)
longFilename[n+13] = '\0';
}
}
// return if normal file or subdirectory
if (DIR_IS_FILE_OR_SUBDIR(dir)) return n;
}
@@ -1788,4 +1822,4 @@ void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0; // NOLINT
#endif // ALLOW_DEPRECATED_FUNCTIONS
#endif
#endif
+3 -3
View File
@@ -283,7 +283,7 @@ class SdBaseFile {
bool printName();
int16_t read();
int16_t read(void* buf, uint16_t nbyte);
int8_t readDir(dir_t* dir);
int8_t readDir(dir_t* dir, char* longFilename);
static bool remove(SdBaseFile* dirFile, const char* path);
bool remove();
/** Set the file's current position to zero. */
@@ -455,7 +455,7 @@ class SdBaseFile {
* \param[out] dir The dir_t struct that will receive the data.
* \return bytes read for success zero for eof or -1 for failure.
*/
int8_t readDir(dir_t& dir) {return readDir(&dir);} // NOLINT
int8_t readDir(dir_t& dir, char* longFilename) {return readDir(&dir, longFilename);} // NOLINT
/** \deprecated Use:
* static uint8_t remove(SdBaseFile* dirFile, const char* path);
* \param[in] dirFile The directory that contains the file.
@@ -480,4 +480,4 @@ class SdBaseFile {
};
#endif // SdBaseFile_h
#endif
#endif
+8 -1
View File
@@ -108,7 +108,14 @@ uint8_t const SOFT_SPI_SCK_PIN = 13;
* a pure virtual function is called.
*/
#define USE_CXA_PURE_VIRTUAL 1
/**
* Defines for long (vfat) filenames
*/
/** Number of VFAT entries used. Every entry has 13 UTF-16 characters */
#define MAX_VFAT_ENTRIES (2)
/** Total size of the buffer used to store the long filenames */
#define LONG_FILENAME_LENGTH (13*MAX_VFAT_ENTRIES+1)
#endif // SdFatConfig_h
#endif
#endif
+43 -7
View File
@@ -22,6 +22,8 @@
#ifndef SdFatStructs_h
#define SdFatStructs_h
#define PACKED __attribute__((__packed__))
/**
* \file
* \brief FAT file structures
@@ -95,7 +97,7 @@ struct partitionTable {
uint32_t firstSector;
/** Length of the partition, in blocks. */
uint32_t totalSectors;
};
} PACKED;
/** Type name for partitionTable */
typedef struct partitionTable part_t;
//------------------------------------------------------------------------------
@@ -119,7 +121,7 @@ struct masterBootRecord {
uint8_t mbrSig0;
/** Second MBR signature byte. Must be 0XAA */
uint8_t mbrSig1;
};
} PACKED;
/** Type name for masterBootRecord */
typedef struct masterBootRecord mbr_t;
//------------------------------------------------------------------------------
@@ -247,7 +249,7 @@ struct fat_boot {
uint8_t bootSectorSig0;
/** must be 0XAA */
uint8_t bootSectorSig1;
};
} PACKED;
/** Type name for FAT Boot Sector */
typedef struct fat_boot fat_boot_t;
//------------------------------------------------------------------------------
@@ -401,7 +403,7 @@ struct fat32_boot {
uint8_t bootSectorSig0;
/** must be 0XAA */
uint8_t bootSectorSig1;
};
} PACKED;
/** Type name for FAT32 Boot Sector */
typedef struct fat32_boot fat32_boot_t;
//------------------------------------------------------------------------------
@@ -441,7 +443,7 @@ struct fat32_fsinfo {
uint8_t reserved2[12];
/** must be 0X00, 0X00, 0X55, 0XAA */
uint8_t tailSignature[4];
};
} PACKED;
/** Type name for FAT32 FSINFO Sector */
typedef struct fat32_fsinfo fat32_fsinfo_t;
//------------------------------------------------------------------------------
@@ -539,12 +541,46 @@ struct directoryEntry {
uint16_t firstClusterLow;
/** 32-bit unsigned holding this file's size in bytes. */
uint32_t fileSize;
};
} PACKED;
/**
* \struct directoryVFATEntry
* \brief VFAT long filename directory entry
*
* directoryVFATEntries are found in the same list as normal directoryEntry.
* But have the attribute field set to DIR_ATT_LONG_NAME.
*
* Long filenames are saved in multiple directoryVFATEntries.
* Each entry containing 13 UTF-16 characters.
*/
struct directoryVFATEntry {
/**
* Sequence number. Consists of 2 parts:
* bit 6: indicates first long filename block for the next file
* bit 0-4: the position of this long filename block (first block is 1)
*/
uint8_t sequenceNumber;
/** First set of UTF-16 characters */
uint16_t name1[5];//UTF-16
/** attributes (at the same location as in directoryEntry), always 0x0F */
uint8_t attributes;
/** Reserved for use by Windows NT. Always 0. */
uint8_t reservedNT;
/** Checksum of the short 8.3 filename, can be used to checked if the file system as modified by a not-long-filename aware implementation. */
uint8_t checksum;
/** Second set of UTF-16 characters */
uint16_t name2[6];//UTF-16
/** firstClusterLow is always zero for longFilenames */
uint16_t firstClusterLow;
/** Third set of UTF-16 characters */
uint16_t name3[2];//UTF-16
} PACKED;
//------------------------------------------------------------------------------
// Definitions for directory entries
//
/** Type name for directoryEntry */
typedef struct directoryEntry dir_t;
/** Type name for directoryVFATEntry */
typedef struct directoryVFATEntry vfat_t;
/** escape for name[0] = 0XE5 */
uint8_t const DIR_NAME_0XE5 = 0X05;
/** name[0] value for entry that is free after being "deleted" */
@@ -607,4 +643,4 @@ static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) {
#endif // SdFatStructs_h
#endif
#endif
+9 -6
View File
@@ -55,13 +55,16 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) {
* Use writeError to check for errors.
*/
#if ARDUINO >= 100
size_t SdFile::write(uint8_t b)
#else
void SdFile::write(uint8_t b)
#endif
size_t SdFile::write(uint8_t b)
{
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.
* \param[in] str Pointer to the string.
@@ -89,4 +92,4 @@ void SdFile::writeln_P(PGM_P str) {
}
#endif
#endif
+4 -4
View File
@@ -51,7 +51,7 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
dir_t p;
uint8_t cnt=0;
while (parent.readDir(p) > 0)
while (parent.readDir(p, longFilename) > 0)
{
if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
{
@@ -429,16 +429,16 @@ void CardReader::checkautostart(bool force)
char autoname[30];
sprintf(autoname,"auto%i.g",lastnr);
for(int8_t i=0;i<(int)strlen(autoname);i++)
for(int8_t i=0;i<(int8_t)strlen(autoname);i++)
autoname[i]=tolower(autoname[i]);
dir_t p;
root.rewind();
bool found=false;
while (root.readDir(p) > 0)
while (root.readDir(p, NULL) > 0)
{
for(int8_t i=0;i<(int)strlen((char*)p.name);i++)
for(int8_t i=0;i<(int8_t)strlen((char*)p.name);i++)
p.name[i]=tolower(p.name[i]);
//Serial.print((char*)p.name);
//Serial.print(" ");
+3 -2
View File
@@ -45,7 +45,8 @@ public:
bool saving;
bool sdprinting ;
bool cardOK ;
char filename[12];
char filename[13];
char longFilename[LONG_FILENAME_LENGTH];
bool filenameIsDir;
int lastnr; //last number of the autostart;
private:
@@ -72,4 +73,4 @@ private:
#define IS_SD_PRINTING (false)
#endif //SDSUPPORT
#endif
#endif
+359 -32
View File
@@ -12,7 +12,9 @@
// 3 French (Waiting translation)
// 4 German
// 5 Spanish
// 6 Etc
// 6 Russian
// 7 Italian
// 8 Etc
#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_COUNT_X " Count X:"
#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_UNKNOWN_COMMAND "Unknown command:\""
#define MSG_ACTIVE_EXTRUDER "Active Extruder: "
#define MSG_INVALID_EXTRUDER "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_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 "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_INIT_FAIL "SD init fail"
@@ -311,12 +316,15 @@
#define MSG_UNKNOWN_COMMAND "Unknown command:\""
#define MSG_ACTIVE_EXTRUDER "Active Extruder: "
#define MSG_INVALID_EXTRUDER "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_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 "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_INIT_FAIL "SD init fail"
@@ -354,17 +362,17 @@
#define MSG_SET_ORIGIN " Establecer Cero"
#define MSG_COOLDOWN " Enfriar"
#define MSG_EXTRUDE " Extruir"
#define MSG_RETRACT " Retract"
#define MSG_RETRACT " Retraer"
#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_SETTINGS " Precalentar ABS Setting"
#define MSG_PREHEAT_ABS_SETTINGS " Ajustar temp. ABS"
#define MSG_MOVE_AXIS " Mover Ejes \x7E"
#define MSG_SPEED " Velocidad:"
#define MSG_NOZZLE " \002Nozzle:"
#define MSG_NOZZLE1 " \002Nozzle2:"
#define MSG_NOZZLE2 " \002Nozzle3:"
#define MSG_BED " \002Bed:"
#define MSG_BED " \002Base:"
#define MSG_FAN_SPEED " Ventilador:"
#define MSG_FLOW " Flujo:"
#define MSG_CONTROL " Control \003"
@@ -406,10 +414,10 @@
#define MSG_PREPARE " Preparar \x7E"
#define MSG_PREPARE_ALT " Preparar \003"
#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_PAUSE_PRINT " Pause Print \x7E"
#define MSG_RESUME_PRINT " Resume Print \x7E"
#define MSG_PAUSE_PRINT " Pausar Impresion \x7E"
#define MSG_RESUME_PRINT " Reanudar Impresion \x7E"
#define MSG_STOP_PRINT " Detener Impresion \x7E"
#define MSG_CARD_MENU " Menu de SD \x7E"
#define MSG_NO_CARD " No hay Tarjeta SD"
@@ -447,15 +455,15 @@
#define MSG_ERR_CHECKSUM_MISMATCH "el checksum no coincide, Ultima Linea:"
#define MSG_ERR_NO_CHECKSUM "No se pudo hallar el Checksum con el numero de linea, Ultima Linea:"
#define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No se hallo el Numero de Linea con el Checksum, Ultima Linea:"
#define MSG_FILE_PRINTED "Impresion terminado"
#define MSG_FILE_PRINTED "Impresion terminada"
#define MSG_BEGIN_FILE_LIST "Comienzo de la lista de archivos"
#define MSG_END_FILE_LIST "Fin de la lista de archivos"
#define MSG_M104_INVALID_EXTRUDER "M104 Extrusor Invalido "
#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor Invalido "
#define MSG_ERR_NO_THERMISTORS "No hay termistores - no temp"
#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor Invalido "
#define MSG_HEATING "Calientando..."
#define MSG_HEATING_COMPLETE "Calentamiento terminado."
#define MSG_HEATING "Calentando..."
#define MSG_HEATING_COMPLETE "Calentamiento Hecho."
#define MSG_BED_HEATING "Calentando la base."
#define MSG_BED_DONE "Base Caliente."
#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"
@@ -466,13 +474,15 @@
#define MSG_UNKNOWN_COMMAND "Comando Desconocido:\""
#define MSG_ACTIVE_EXTRUDER "Extrusor Activo: "
#define MSG_INVALID_EXTRUDER "Extrusor Invalido"
#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_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_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_INIT_FAIL "Fallo al iniciar la SD"
#define MSG_SD_VOL_INIT_FAIL "Fallo al montar el volumen"
@@ -487,7 +497,7 @@
#define MSG_SD_PRINTING_BYTE "SD imprimiendo el byte "
#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_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_ENDSTOPS_HIT "Se ha tocado el fin de carril: "
@@ -495,4 +505,321 @@
#define MSG_ERR_LONG_EXTRUDE_STOP " extrusion demasiado larga evitada"
#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
+184 -9
View File
@@ -45,16 +45,11 @@
#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
#define MOTHERBOARD 11
#define GEN7_VERSION 13 // v1.3
@@ -108,6 +103,7 @@
#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
@@ -121,12 +117,86 @@
#endif
#define PS_ON_PIN 15
#if (GEN7_VERSION < 14)
// Gen 1.3 and earlier supplied thermistor power via PS_ON
// Need to ignore the bad thermistor readings on those units
//All these generations of Gen7 supply thermistor power
//via PS_ON, so ignore bad thermistor readings
#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
/****************************************************************************************
* 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.
#define DEBUG_PIN 0
@@ -206,6 +276,7 @@
#define SDCARDDETECT -1
#define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work
#define KILL_PIN -1
//Pins for 4bit LCD Support
#define LCD_PINS_RS 18
#define LCD_PINS_ENABLE 17
@@ -543,6 +614,7 @@
#define LED_PIN -1 //changed @ rkoeppl 20110410
#define FAN_PIN -1 //changed @ rkoeppl 20110410
#define PS_ON_PIN -1 //changed @ rkoeppl 20110410
#define KILL_PIN -1 //changed @ drakelive 20120830
//our pin for debugging.
#define DEBUG_PIN 0
@@ -1129,6 +1201,109 @@
#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
#error Unknown MOTHERBOARD value in configuration.h
#endif
+1 -2
View File
@@ -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
// in order to reach the final_rate exactly at the end of this block.
if (plateau_steps < 0) {
accelerate_steps = ceil(
intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count));
accelerate_steps = ceil(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 = min(accelerate_steps,block->step_event_count);
plateau_steps = 0;
+1 -1
View File
@@ -25,7 +25,7 @@
#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 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); }}}
#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); }}
+148 -62
View File
@@ -57,6 +57,15 @@ int current_raw_bed = 0;
float Kc=DEFAULT_Kc;
#endif
#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
//===========================================================================
@@ -64,9 +73,6 @@ int current_raw_bed = 0;
//===========================================================================
static volatile bool temp_meas_ready = false;
static unsigned long previous_millis_bed_heater;
//static unsigned long previous_millis_heater;
#ifdef PIDTEMP
//static cannot be external:
static float temp_iState[EXTRUDERS] = { 0 };
@@ -82,7 +88,22 @@ static unsigned long previous_millis_bed_heater;
// static float pid_output[EXTRUDERS];
static bool pid_reset[EXTRUDERS];
#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_bed;
#ifdef WATCHPERIOD
int watch_raw[EXTRUDERS] = { -1000 }; // the first value used for all
@@ -122,44 +143,67 @@ static unsigned long previous_millis_bed_heater;
//============================= functions ============================
//===========================================================================
void PID_autotune(float temp)
void PID_autotune(float temp, int extruder, int ncycles)
{
float input;
float input = 0.0;
int cycles=0;
bool heating = true;
unsigned long temp_millis = millis();
unsigned long t1=temp_millis;
unsigned long t2=temp_millis;
long t_high;
long t_low;
long t_high = 0;
long t_low = 0;
long bias=PID_MAX/2;
long d = PID_MAX/2;
long bias, d;
float Ku, Tu;
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");
disable_heater(); // switch off all heaters.
soft_pwm[0] = PID_MAX/2;
for(;;) {
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(;;) {
if(temp_meas_ready == true) { // temp sample ready
CRITICAL_SECTION_START;
temp_meas_ready = false;
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);
min=min(min,input);
if(heating == true && input > temp) {
if(millis() - t2 > 5000) {
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();
t_high=t1 - t2;
max=temp;
@@ -172,8 +216,8 @@ void PID_autotune(float temp)
t_low=t2 - t1;
if(cycles > 0) {
bias += (d*(t_high - t_low))/(t_low + t_high);
bias = constrain(bias, 20 ,PID_MAX-20);
if(bias > PID_MAX/2) d = PID_MAX - 1 - bias;
bias = constrain(bias, 20 ,(extruder<0?(MAX_BED_POWER):(PID_MAX))-20);
if(bias > (extruder<0?(MAX_BED_POWER):(PID_MAX))/2) d = (extruder<0?(MAX_BED_POWER):(PID_MAX)) - 1 - bias;
else d = 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++;
min=temp;
}
@@ -221,17 +268,26 @@ void PID_autotune(float temp)
return;
}
if(millis() - temp_millis > 2000) {
temp_millis = millis();
SERIAL_PROTOCOLPGM("ok T:");
SERIAL_PROTOCOL(degHotend(0));
int p;
if (extruder<0){
p=soft_pwm_bed;
SERIAL_PROTOCOLPGM("ok B:");
}else{
p=soft_pwm[extruder];
SERIAL_PROTOCOLPGM("ok T:");
}
SERIAL_PROTOCOL(input);
SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOLLN(getHeaterPower(0));
SERIAL_PROTOCOLLN(p);
temp_millis = millis();
}
if(((millis() - t1) + (millis() - t2)) > (10L*60L*1000L*2L)) {
SERIAL_PROTOCOLLNPGM("PID Autotune failed! timeout");
return;
}
if(cycles > 5) {
if(cycles > ncycles) {
SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
return;
}
@@ -246,29 +302,28 @@ void updatePID()
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
}
#endif
#ifdef PIDTEMPBED
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
#endif
}
int getHeaterPower(int heater) {
if (heater<0)
return soft_pwm_bed;
return soft_pwm[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_output;
if(temp_meas_ready != true) //better readability
return;
//Reset the watchdog after we know we have a temperature measurement.
watchdog_reset();
CRITICAL_SECTION_START;
temp_meas_ready = false;
CRITICAL_SECTION_END;
@@ -298,12 +353,16 @@ void manage_heater()
temp_iState[e] += pid_error[e];
temp_iState[e] = constrain(temp_iState[e], temp_iState_min[e], temp_iState_max[e]);
iTerm[e] = Ki * temp_iState[e];
//K1 defined in Configuration.h in the PID settings
#define K2 (1.0-K1)
dTerm[e] = (Kd * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
temp_dState[e] = pid_input;
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
#ifdef PID_DEBUG
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
#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)
return;
previous_millis_bed_heater = millis();
#if TEMP_BED_PIN > -1
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
bed_needs_heating=0;
#endif
#ifndef BED_LIMIT_SWITCHING
#if TEMP_BED_PIN > -1
#ifdef PIDTEMPBED
pid_input = analog2tempBed(current_raw_bed);
#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
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
if(current_raw_bed >= target_raw_bed)
{
WRITE(HEATER_BED_PIN,LOW);
soft_pwm_bed = 0;
}
else
{
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
bed_needs_heating=1;
#endif
WRITE(HEATER_BED_PIN,HIGH);
soft_pwm_bed = MAX_BED_POWER>>1;
}
}
else {
soft_pwm_bed = 0;
WRITE(HEATER_BED_PIN,LOW);
}
#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 > target_bed_high_temp)
{
WRITE(HEATER_BED_PIN,LOW);
soft_pwm_bed = 0;
}
else
if(current_raw_bed <= target_bed_low_temp)
{
#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
bed_needs_heating=1;
#endif
WRITE(HEATER_BED_PIN,HIGH);
soft_pwm_bed = MAX_BED_POWER>>1;
}
}
else {
soft_pwm_bed = 0;
WRITE(HEATER_BED_PIN,LOW);
}
#endif
@@ -473,7 +546,6 @@ int temp2analogBed(int celsius) {
#elif defined BED_USES_AD595
return lround(((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
#else
#warning No heater-type defined for the bed.
return 0;
#endif
}
@@ -550,7 +622,6 @@ float analog2tempBed(int raw) {
#elif defined BED_USES_AD595
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else
#warning No heater-type defined for the bed.
return 0;
#endif
}
@@ -568,6 +639,10 @@ void tp_init()
temp_iState_min[e] = 0.0;
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
#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)
@@ -728,6 +803,7 @@ void disable_heater()
#if TEMP_BED_PIN > -1
target_raw_bed=0;
soft_pwm_bed=0;
#if HEATER_BED_PIN > -1
WRITE(HEATER_BED_PIN,LOW);
#endif
@@ -832,6 +908,7 @@ ISR(TIMER0_COMPB_vect)
static unsigned char soft_pwm_0;
static unsigned char soft_pwm_1;
static unsigned char soft_pwm_2;
static unsigned char soft_pwm_b;
if(pwm_count == 0){
soft_pwm_0 = soft_pwm[0];
@@ -844,6 +921,10 @@ ISR(TIMER0_COMPB_vect)
soft_pwm_2 = soft_pwm[2];
if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
#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 EXTRUDERS > 1
@@ -852,6 +933,9 @@ ISR(TIMER0_COMPB_vect)
#if EXTRUDERS > 2
if(soft_pwm_2 <= pwm_count) WRITE(HEATER_2_PIN,0);
#endif
#if HEATER_BED_PIN > -1
if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0);
#endif
pwm_count++;
pwm_count &= 0x7f;
@@ -885,6 +969,8 @@ ISR(TIMER0_COMPB_vect)
#if (TEMP_BED_PIN > -1)
#if TEMP_BED_PIN > 7
ADCSRB = 1<<MUX5;
#else
ADCSRB = 0;
#endif
ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion
+10 -4
View File
@@ -46,11 +46,15 @@ extern int current_raw_bed;
extern int target_bed_low_temp ;
extern int target_bed_high_temp ;
#endif
extern float Kp,Ki,Kd,Kc;
#ifdef PIDTEMP
extern float Kp,Ki,Kd,Kc;
extern float pid_setpoint[EXTRUDERS];
#endif
#ifdef PIDTEMPBED
extern float bedKp,bedKi,bedKd;
extern float pid_setpoint_bed;
#endif
// #ifdef WATCHPERIOD
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) {
target_raw_bed = temp2analogBed(celsius);
#ifdef BED_LIMIT_SWITCHING
#ifdef PIDTEMPBED
pid_setpoint_bed = celsius;
#elif defined BED_LIMIT_SWITCHING
if(celsius>BED_HYSTERESIS)
{
target_bed_low_temp= temp2analogBed(celsius-BED_HYSTERESIS);
@@ -163,7 +169,7 @@ FORCE_INLINE void autotempShutdown(){
#endif
}
void PID_autotune(float temp);
void PID_autotune(float temp, int extruder, int ncycles);
#endif
+1 -1
View File
@@ -419,7 +419,7 @@ const short temptable_52[][2] PROGMEM = {
// Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
// Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
// Advantage: More resolution and better linearity from 150C to 200C
const short temptable_52[][2] PROGMEM = {
const short temptable_55[][2] PROGMEM = {
{1*OVERSAMPLENR, 500},
{76*OVERSAMPLENR, 300},
{87*OVERSAMPLENR, 290},
+200 -145
View File
@@ -6,7 +6,7 @@
#include "language.h"
#include "temperature.h"
#include "EEPROMwrite.h"
#include <LiquidCrystal.h>
//===========================================================================
//=============================imported variables============================
//===========================================================================
@@ -29,6 +29,14 @@ volatile char buttons=0; //the last checked buttons in a bit array.
long encoderpos=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============================
@@ -38,7 +46,7 @@ static char messagetext[LCD_WIDTH]="";
//return for string conversion routines
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 long previous_millis_buttons=0;
@@ -62,7 +70,7 @@ void lcdProgMemprint(const char *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,
B01110
};
byte uplevel[8]={0x04, 0x0e, 0x1f, 0x04, 0x1c, 0x00, 0x00, 0x00};//thanks joris
byte refresh[8]={0x00, 0x06, 0x19, 0x18, 0x03, 0x13, 0x0c, 0x00}; //thanks joris
byte folder [8]={0x00, 0x1c, 0x1f, 0x11, 0x11, 0x1f, 0x00, 0x00}; //thanks joris
byte uplevel[8]={
B00100,
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.createChar(1,Degree);
lcd.createChar(2,Thermometer);
@@ -331,11 +366,11 @@ void MainMenu::showStatus()
{
encoderpos=feedmultiply;
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
lcd.setCursor(10,0);lcdprintPGM("B---/---\001 ");
lcd.setCursor(10,0);LCD_PRINT_PGM("B000/000\001 ");
#elif EXTRUDERS > 1
lcd.setCursor(10,0);lcdprintPGM("\002---/---\001 ");
lcd.setCursor(10,0);LCD_PRINT_PGM("\002000/000\001 ");
#endif
}
@@ -397,7 +432,7 @@ void MainMenu::showStatus()
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;
}
}
@@ -406,7 +441,7 @@ void MainMenu::showStatus()
if((currentz!=oldzpos)||force_lcd_update)
{
lcd.setCursor(10,1);
lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
LCD_PRINT_PGM("Z:");lcd.print(ftostr52(current_position[2]));
oldzpos=currentz;
}
@@ -433,7 +468,7 @@ void MainMenu::showStatus()
{
oldfeedmultiply=curfeedmultiply;
lcd.setCursor(0,2);
lcd.print(itostr3(curfeedmultiply));lcdprintPGM("% ");
lcd.print(itostr3(curfeedmultiply));LCD_PRINT_PGM("% ");
}
if(messagetext[0]!='\0')
@@ -452,7 +487,7 @@ void MainMenu::showStatus()
{
lcd.setCursor(10,2);
lcd.print(itostr3((int)percent));
lcdprintPGM("%SD");
LCD_PRINT_PGM("%SD");
}
#endif
#else //smaller LCDS----------------------------------
@@ -461,7 +496,7 @@ void MainMenu::showStatus()
if(force_lcd_update) //initial display of content
{
encoderpos=feedmultiply;
lcd.setCursor(0,0);lcdprintPGM("\002---/---\001 ");
lcd.setCursor(0,0);LCD_PRINT_PGM("\002---/---\001 ");
}
int tHotEnd0=intround(degHotend0());
@@ -515,26 +550,26 @@ void MainMenu::showPrepare()
switch(i)
{
case ItemP_exit:
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemP_autostart:
MENUITEM( lcdprintPGM(MSG_AUTOSTART) , BLOCK;
MENUITEM( LCD_PRINT_PGM(MSG_AUTOSTART) , BLOCK;
#ifdef SDSUPPORT
card.lastnr=0;card.setroot();card.checkautostart(true);
#endif
beepshort(); ) ;
break;
case ItemP_disstep:
MENUITEM( lcdprintPGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ;
break;
case ItemP_home:
MENUITEM( lcdprintPGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28");beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28");beepshort(); ) ;
break;
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;
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
FanSpeed = plaPreheatFanSpeed;
analogWrite(FAN_PIN, FanSpeed);
@@ -542,7 +577,7 @@ void MainMenu::showPrepare()
beepshort(); );
break;
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
FanSpeed = absPreheatFanSpeed;
analogWrite(FAN_PIN, FanSpeed);
@@ -550,13 +585,13 @@ void MainMenu::showPrepare()
beepshort(); );
break;
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;
// 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;
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;
default:
break;
@@ -582,14 +617,14 @@ void MainMenu::showAxisMove()
switch(i)
{
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;
case ItemAM_X:
{
//oldencoderpos=0;
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]));
}
@@ -634,7 +669,7 @@ void MainMenu::showAxisMove()
{
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]));
}
@@ -679,7 +714,7 @@ void MainMenu::showAxisMove()
{
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]));
}
@@ -722,11 +757,11 @@ void MainMenu::showAxisMove()
break;
case ItemAM_E:
// 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;
case ItemAM_ERetract:
// 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;
default:
break;
@@ -752,13 +787,13 @@ void MainMenu::showTune()
switch(i)
{
case ItemT_exit:
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemT_speed:
{
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));
}
@@ -793,7 +828,7 @@ void MainMenu::showTune()
{
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())));
}
@@ -827,7 +862,7 @@ void MainMenu::showTune()
{
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())));
}
@@ -863,7 +898,7 @@ void MainMenu::showTune()
{
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));
}
@@ -898,7 +933,7 @@ void MainMenu::showTune()
{
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]));
}
@@ -940,22 +975,22 @@ void MainMenu::showTune()
updateActiveLines(ItemT_fan,encoderpos);
}
//does not work
// #define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \
// {\
// if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
// if(activeline==line) \
// { \
// if(CLICKED) \
// { \
// linechanging=!linechanging; \
// if(linechanging) {enter_action;} \
// else {accept_action;} \
// } \
// else \
// if(linechanging) {change_action};}\
// }
//
/*does not work
#define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \
{\
if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
if(activeline==line) \
{ \
if(CLICKED) \
{ \
linechanging=!linechanging; \
if(linechanging) {enter_action;} \
else {accept_action;} \
} \
else \
if(linechanging) {change_action};}\
}
*/
enum {
ItemCT_exit,ItemCT_nozzle0,
@@ -987,13 +1022,13 @@ void MainMenu::showControlTemp()
switch(i)
{
case ItemCT_exit:
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
case ItemCT_nozzle0:
{
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())));
}
@@ -1028,7 +1063,7 @@ void MainMenu::showControlTemp()
{
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())));
}
@@ -1064,7 +1099,7 @@ void MainMenu::showControlTemp()
{
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())));
}
@@ -1100,7 +1135,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1134,7 +1169,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1168,7 +1203,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1202,12 +1237,12 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(MSG_AUTOTEMP);
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_AUTOTEMP);
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM(MSG_ON);
LCD_PRINT_PGM(MSG_ON);
else
lcdprintPGM(MSG_OFF);
LCD_PRINT_PGM(MSG_OFF);
}
if((activeline!=line) )
@@ -1218,9 +1253,9 @@ void MainMenu::showControlTemp()
autotemp_enabled=!autotemp_enabled;
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM(MSG_ON);
LCD_PRINT_PGM(MSG_ON);
else
lcdprintPGM(MSG_OFF);
LCD_PRINT_PGM(MSG_OFF);
BLOCK;
}
@@ -1231,7 +1266,7 @@ void MainMenu::showControlTemp()
{
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())));
}
@@ -1265,7 +1300,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1301,7 +1336,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1336,7 +1371,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1371,7 +1406,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1408,7 +1443,7 @@ void MainMenu::showControlTemp()
{
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));
}
@@ -1443,10 +1478,10 @@ void MainMenu::showControlTemp()
#endif
break;
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;
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;
default:
break;
@@ -1478,14 +1513,14 @@ void MainMenu::showControlMotion()
switch(i)
{
case ItemCM_exit:
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
case ItemCM_acc:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(MSG_ACC);
lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));lcdprintPGM("00");
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ACC);
lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));LCD_PRINT_PGM("00");
}
if((activeline!=line) )
@@ -1510,7 +1545,7 @@ void MainMenu::showControlMotion()
{
if(encoderpos<5) encoderpos=5;
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;
@@ -1518,7 +1553,7 @@ void MainMenu::showControlMotion()
{
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));
}
@@ -1557,11 +1592,11 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(MSG_VMAX);
if(i==ItemCM_vmaxx)lcdprintPGM(MSG_X);
if(i==ItemCM_vmaxy)lcdprintPGM(MSG_Y);
if(i==ItemCM_vmaxz)lcdprintPGM(MSG_Z);
if(i==ItemCM_vmaxe)lcdprintPGM(MSG_E);
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_VMAX);
if(i==ItemCM_vmaxx)LCD_PRINT_PGM(MSG_X);
if(i==ItemCM_vmaxy)LCD_PRINT_PGM(MSG_Y);
if(i==ItemCM_vmaxz)LCD_PRINT_PGM(MSG_Z);
if(i==ItemCM_vmaxe)LCD_PRINT_PGM(MSG_E);
lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
}
@@ -1597,7 +1632,7 @@ void MainMenu::showControlMotion()
{
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));
}
@@ -1632,7 +1667,7 @@ void MainMenu::showControlMotion()
{
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));
}
@@ -1671,12 +1706,12 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Amax ");
if(i==ItemCM_amaxx)lcdprintPGM(MSG_X);
if(i==ItemCM_amaxy)lcdprintPGM(MSG_Y);
if(i==ItemCM_amaxz)lcdprintPGM(MSG_Z);
if(i==ItemCM_amaxe)lcdprintPGM(MSG_E);
lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00");
lcd.setCursor(0,line);LCD_PRINT_PGM(" Amax ");
if(i==ItemCM_amaxx)LCD_PRINT_PGM(MSG_X);
if(i==ItemCM_amaxy)LCD_PRINT_PGM(MSG_Y);
if(i==ItemCM_amaxz)LCD_PRINT_PGM(MSG_Z);
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));LCD_PRINT_PGM("00");
}
if((activeline!=line) )
@@ -1701,7 +1736,7 @@ void MainMenu::showControlMotion()
{
if(encoderpos<1) encoderpos=1;
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;
@@ -1711,8 +1746,8 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(MSG_A_RETRACT);
lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));lcdprintPGM("00");
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_A_RETRACT);
lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));LCD_PRINT_PGM("00");
}
if((activeline!=line) )
@@ -1738,7 +1773,7 @@ void MainMenu::showControlMotion()
{
if(encoderpos<10) encoderpos=10;
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;
@@ -1746,7 +1781,7 @@ void MainMenu::showControlMotion()
{
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]));
}
@@ -1783,7 +1818,7 @@ void MainMenu::showControlMotion()
{
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]));
}
@@ -1821,8 +1856,8 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Z_AXIS]));
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ZSTEPS);
lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[Z_AXIS]));
}
if((activeline!=line) )
@@ -1860,8 +1895,8 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_ESTEPS);
lcd.setCursor(11,line);lcd.print(ftostr51(axis_steps_per_unit[E_AXIS]));
}
if((activeline!=line) )
@@ -1923,7 +1958,7 @@ void MainMenu::showControlRetract()
switch(i)
{
case ItemR_exit:
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
//float retract_length=2, retract_feedrate=1200, retract_zlift=0.4;
@@ -1932,12 +1967,12 @@ void MainMenu::showControlRetract()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(MSG_AUTORETRACT);
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_AUTORETRACT);
lcd.setCursor(13,line);
if(autoretract_enabled)
lcdprintPGM(MSG_ON);
LCD_PRINT_PGM(MSG_ON);
else
lcdprintPGM(MSG_OFF);
LCD_PRINT_PGM(MSG_OFF);
}
if((activeline!=line) )
@@ -1948,9 +1983,9 @@ void MainMenu::showControlRetract()
autoretract_enabled=!autoretract_enabled;
lcd.setCursor(13,line);
if(autoretract_enabled)
lcdprintPGM(MSG_ON);
LCD_PRINT_PGM(MSG_ON);
else
lcdprintPGM(MSG_OFF);
LCD_PRINT_PGM(MSG_OFF);
BLOCK;
}
@@ -1960,7 +1995,7 @@ void MainMenu::showControlRetract()
{
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));
}
@@ -1995,7 +2030,7 @@ void MainMenu::showControlRetract()
{
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));
}
@@ -2030,7 +2065,7 @@ void MainMenu::showControlRetract()
{
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));;
}
@@ -2065,7 +2100,7 @@ void MainMenu::showControlRetract()
{
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));;
}
@@ -2101,7 +2136,7 @@ void MainMenu::showControlRetract()
{
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));
}
@@ -2161,24 +2196,24 @@ void MainMenu::showControl()
switch(i)
{
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;
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;
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;
#ifdef FWRETRACT
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;
#endif
case ItemC_store:
{
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)
{
@@ -2192,7 +2227,7 @@ void MainMenu::showControl()
{
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)
{
@@ -2206,7 +2241,7 @@ void MainMenu::showControl()
{
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)
{
@@ -2253,7 +2288,7 @@ void MainMenu::showSD()
switch(i)
{
case 0:
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
// case 1:
// {
@@ -2266,11 +2301,11 @@ void MainMenu::showSD()
// if(true)
// #endif
// {
// lcdprintPGM(" \004Refresh");
// LCD_PRINT_PGM(" \004Refresh");
// }
// else
// {
// lcdprintPGM(" \004Insert Card");
// LCD_PRINT_PGM(" \004Insert Card");
// }
//
// }
@@ -2285,7 +2320,7 @@ void MainMenu::showSD()
// }break;
case 1:
MENUITEM( lcd.print(" ");card.getWorkDirName();
if(card.filename[0]=='/') lcdprintPGM(MSG_REFRESH);
if(card.filename[0]=='/') LCD_PRINT_PGM(MSG_REFRESH);
else {
lcd.print("\005");
lcd.print(card.filename);
@@ -2308,9 +2343,21 @@ void MainMenu::showSD()
{
card.getfilename(i-FIRSTITEM);
//Serial.print("Filenr:");Serial.println(i-2);
lcd.setCursor(0,line);lcdprintPGM(" ");
if(card.filenameIsDir) lcd.print("\005");
lcd.print(card.filename);
lcd.setCursor(0,line);LCD_PRINT_PGM(" ");
if(card.filenameIsDir)
{
lcd.print("\005");
card.longFilename[LCD_WIDTH-2] = '\0';
}
if (card.longFilename[0])
{
card.longFilename[LCD_WIDTH-1] = '\0';
lcd.print(card.longFilename);
}
else
{
lcd.print(card.filename);
}
}
if((activeline==line) && CLICKED)
{
@@ -2335,7 +2382,15 @@ void MainMenu::showSD()
enquecommand("M24");
beep();
status=Main_Status;
lcd_status(card.filename);
if (card.longFilename[0])
{
card.longFilename[LCD_WIDTH-1] = '\0';
lcd_status(card.longFilename);
}
else
{
lcd_status(card.filename);
}
}
}
}
@@ -2385,14 +2440,14 @@ void MainMenu::showMainMenu()
switch(i)
{
case ItemM_watch:
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
MENUITEM( LCD_PRINT_PGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
break;
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;
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;
#ifdef SDSUPPORT
case ItemM_file:
@@ -2407,13 +2462,13 @@ void MainMenu::showMainMenu()
#endif
{
if(card.sdprinting)
lcdprintPGM(MSG_STOP_PRINT);
LCD_PRINT_PGM(MSG_STOP_PRINT);
else
lcdprintPGM(MSG_CARD_MENU);
LCD_PRINT_PGM(MSG_CARD_MENU);
}
else
{
lcdprintPGM(MSG_NO_CARD);
LCD_PRINT_PGM(MSG_NO_CARD);
}
}
#ifdef CARDINSERTED
@@ -2439,13 +2494,13 @@ void MainMenu::showMainMenu()
#endif
{
if(card.sdprinting)
lcdprintPGM(MSG_PAUSE_PRINT);
LCD_PRINT_PGM(MSG_PAUSE_PRINT);
else
lcdprintPGM(MSG_RESUME_PRINT);
LCD_PRINT_PGM(MSG_RESUME_PRINT);
}
else
{
//lcdprintPGM(MSG_NO_CARD);
//LCD_PRINT_PGM(MSG_NO_CARD);
}
}
#ifdef CARDINSERTED
@@ -2615,14 +2670,14 @@ void MainMenu::showPLAsettings()
{
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;
case ItemPLAPreHeat_set_PLA_FanSpeed:
{
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));
}
@@ -2656,7 +2711,7 @@ void MainMenu::showPLAsettings()
{
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));
}
@@ -2690,7 +2745,7 @@ void MainMenu::showPLAsettings()
{
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));
}
@@ -2723,7 +2778,7 @@ void MainMenu::showPLAsettings()
{
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)
{
@@ -2761,14 +2816,14 @@ void MainMenu::showABSsettings()
{
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;
case ItemABSPreHeat_set_FanSpeed:
{
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));
}
@@ -2802,7 +2857,7 @@ void MainMenu::showABSsettings()
{
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));
}
@@ -2836,7 +2891,7 @@ void MainMenu::showABSsettings()
{
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));
}
@@ -2869,7 +2924,7 @@ void MainMenu::showABSsettings()
{
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)
{
+52 -29
View File
@@ -1,37 +1,41 @@
#ifndef ULTRALCD_H
#define ULTRALCD_H
#include "Marlin.h"
#ifdef ULTRA_LCD
#include <LiquidCrystal.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
#define STATUSTIMEOUT 15000
extern LiquidCrystal lcd;
extern volatile char buttons; //the last checked buttons in a bit array.
#include "Marlin.h"
#ifdef ULTRA_LCD
#include "language.h"
#if LANGUAGE_CHOICE == 6
#include "LiquidCrystalRus.h"
#define LCD_CLASS LiquidCrystalRus
#else
#include <LiquidCrystal.h>
#define LCD_CLASS LiquidCrystal
#endif
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
#ifdef NEWPANEL
#define EN_C (1<<BLEN_C)
#define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A)
#define CLICKED (buttons&EN_C)
#define BLOCK {blocking=millis()+blocktime;}
#if (SDCARDDETECT > -1)
#ifdef SDCARDDETECTINVERTED
#define CARDINSERTED (READ(SDCARDDETECT)!=0)
#else
#define CARDINSERTED (READ(SDCARDDETECT)==0)
#endif
#endif //SDCARDTETECTINVERTED
#else
#else
//atomatic, do not change
#define B_LE (1<<BL_LE)
#define B_UP (1<<BL_UP)
@@ -44,9 +48,18 @@
#define CLICKED ((buttons&B_MI)||(buttons&B_ST))
#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
@@ -143,8 +156,8 @@
#define LCD_INIT lcd_init();
#define LCD_MESSAGE(x) lcd_status(x);
#define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x));
#define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(MYPGM(x));
#define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
#define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(PSTR(x));
#define LCD_STATUS lcd_status()
#else //no lcd
#define LCD_INIT
@@ -169,4 +182,14 @@ char *itostr31(const int &xx);
char *itostr3(const int &xx);
char *itostr4(const int &xx);
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
+54
View File
@@ -0,0 +1,54 @@
#include "Marlin.h"
#ifdef USE_WATCHDOG
#include "watchdog.h"
#include "ultralcd.h"
//===========================================================================
//=============================private variables ============================
//===========================================================================
//===========================================================================
//=============================functinos ============================
//===========================================================================
/// intialise watch dog with a 1 sec interrupt time
void watchdog_init()
{
#ifdef 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 RESET_MANUAL
ISR(WDT_vect)
{
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
View File
@@ -1,16 +1,17 @@
#ifndef WATCHDOG_H
#define WATCHDOG_H
#include "Marlin.h"
#ifdef USE_WATCHDOG
// intialise watch dog with a 1 sec interrupt time
void wd_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..
void wd_reset();
void watchdog_init();
// 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 watchdog_reset();
#else
FORCE_INLINE void wd_init() {};
FORCE_INLINE void wd_reset() {};
//If we do not have a watchdog, then we can have empty functions which are optimized away.
FORCE_INLINE void watchdog_init() {};
FORCE_INLINE void watchdog_reset() {};
#endif
#endif
-63
View File
@@ -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 */